Problem with modding json files (0.8.0.8)

2 posts / 0 new
Last post
#1
Problem with modding json files (0.8.0.8)

I try the newly modding feature comes in 0.8.0.8 and find it a bit complicated to modify json files.

For example, if I want to change the title/description of "Pressure Suit Helmet", I need to write all data of "OutfitHelmet02" in a condowners.json in my mod, and then write new values of "strNameFriendly" and "strDesc":

[ { "strName" : "OutfitHelmet02", "strNameFriendly" : "title text1 text1 text1", "strDesc" : "description text2 text2 text2", "strItemDef" : "OutfitHelmet02", "strType" : "Item", "strLoot" : null, "aInteractions" : [ "EquipItem", "DropItem", "PickupItem" ], "aStartingConds" : [ "IsPSHelmet=1.0x1.0", "IsRigid=1.0x1.0", "IsSolid=1.0x1.0", "StatMass=1.0x1.5", "StatBasePrice=1.0x235.0" ], "mapCondTolerance" : [ ], "mapPoints" : [ ], "aUpdateCommands" : [ ], "mapGUIPropMaps" : null, "strPortraitImg" : "CrewHelmet02", "mapSlotImage" : [ "helmet","paperdoll/helmetOutfitHelmet02", "heldL","CrewHelmet02", "heldR","CrewHelmet02" ], "mapSlotUsage" : [ "helmet","CONDHelmet02,EVAHelmet:Crew2PS01:Crew2PS01n", "heldL","Blank", "heldR","Blank" ], "aTickers" : [ ], "jsonPI" : null } ]

The game will work well only with a Debug message "Warning: Trying to add OutfitHelmet02 twice.".

I want to achieve this change with a more simple condowner.json, but it seems like not working (will cause game lag and error):

[ { "strName" : "OutfitHelmet02", "strNameFriendly" : "title text1 text1 text1", "strDesc" : "description text2 text2 text2" } ]

Can we support the latter way of modding json files that mods can overwrite only a part of the origin object? In this way, Mods will be lighter and have more compatibility. Current way of modding will cause mods to overlap each other. For example, if another mod wants to change the price of this Helmet from 235 to 999, then only one of the two mods can work.

Thanks for testing out the new modding features! And that's a good question.

My gut feeling is that the smaller json approach might not be possible without a significant rewrite of how the game loads data. The parser we use (LitJSON) interprets missing data as null, which might overwrite existing non-null values.

For example, let's say you are editing the OutfitEVA01, the EVA suit. (It has a few other features that help illustrate the problem.)

It has a jsonPI of "EVASuit" to tell the game that it consumes power like an EVASuit. If the game reads your smaller json, which has no jsonPI specified, the parser interprets any unspecified properties as if they were null. The game will assume you want to replace jsonPI of "EVASuit" with null, making it a non-powered item.

Basically, I think the parser is an "all or nothing" type. I'll have to dig a bit to verify.

Dan Fedor - Founder, Blue Bottle Games