Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow adding to existing monster groups in json #24301
Conversation
glamcube17
added some commits
Jul 14, 2018
DracoGriffin
reviewed
Jul 15, 2018
| @@ -317,7 +317,14 @@ void MonsterGroupManager::LoadMonsterGroup( JsonObject &jo ) | |||
| MonsterGroup g; | |||
|
|
|||
| g.name = mongroup_id( jo.get_string( "name" ) ); | |||
| g.defaultMonster = mtype_id( jo.get_string( "default" ) ); | |||
| bool extending = false; //If already a group with that name, add to it instead of overwriting it | |||
| if( monsterGroupMap.count( g.name ) != 0 && !jo.get_bool( "override", false) ) { | |||
This comment has been minimized.
This comment has been minimized.
DracoGriffin
reviewed
Jul 15, 2018
| g = monsterGroupMap[g.name]; | ||
| extending = true; | ||
| } | ||
| if( !extending || jo.has_string("default") ) { //Not mandatory to specify default if extending existing group |
This comment has been minimized.
This comment has been minimized.
DracoGriffin
Jul 15, 2018
Member
And I think "default" needs space on either side jo.has_string( "default" )
This comment has been minimized.
This comment has been minimized.
glamcube17
Jul 16, 2018
•
Author
Contributor
Fixed, along with splitting a line that was too long. That should be all the astyle issues from what I could tell.
glamcube17
added some commits
Jul 16, 2018
ZhilkinSerg
self-assigned this
Jul 18, 2018
This comment has been minimized.
This comment has been minimized.
|
Can you please use it in some mod as an example? |
ZhilkinSerg
removed their assignment
Jul 18, 2018
This comment has been minimized.
This comment has been minimized.
|
Say you wanted to make bunnies sometimes spawn instead of zombies earlygame. You could do:
Or maybe you think mansions are too easy and want to turn them into a hellscape nightmarezone:
Or maybe you want mininuke hacks to occasionally spawn in the forest for some reason:
The second would be possible to do the way it currently works, but the first and third would require reproducing the whole list and scaling them proportionally to the ones you're adding. |
glamcube17 commentedJul 15, 2018
•
edited
Currently, there is no way for a mod to modify the contents of a monster group without entirely overriding it. This makes it... rather difficult to get modded monsters to show up in existing locations. And by "rather difficult" I mean "this PR was the easiest way".
For situations where entirely overriding the group is desired, adding
"override": truewill result in the old behavior of discarding the existing contents.Additionally,
"freq_total": intand"auto_total": truechange the maximum number to "roll" for spawns, rather than it being hardcoded at 1000. freq_total changes it to the number specified, while auto_total changes it to the sum of each entry's frequencies.