Skip to content

Commit

Permalink
Merge pull request #36433 from BevapDin/rnm
Browse files Browse the repository at this point in the history
* Remove useless debug message:

"info" and "default" are optional and ignored anyway.

* Convert silent debug message to load message

This informs the user that their mods use outdated syntax and encourage them / the mod authors to convert them to the new syntax to get rid of the debug message.

* Remove JSON members that are not visited and therefor useless.

* Actually read JSON object member instead of only checking their existence.

This ensures the member type is checked and reported if it does not fit the expected type.

It also means `"foo": false` is properly recognized as such (instead of being interpreted the same as `"foo": true`).

* Only register JSON object members as visited when their value has been read.

* Change code to load "looks_like" to only read strings and fail if the member isn't a string

* Change checks for JSON member existence to ignore the type.

Now it only checks whether a member of the given name exists. The type is ignored hereby. The type is checked later, when the value of the member is read. If the type is not what we expect, an error will be generated.

* Remove generating explicit error message:

The message will be shown anyway when the member is actually accessed.

* Explicitly check the value of a boolean JSON object member.

* Remove check for unused member.

The JSON object member "om_special" is never actually loaded, so it should not be required.

* Fix missing "context" member in "json_flag" objects

* Fix JSON members having the wrong type.

* Temporarily comment out some JSON members that don't work as desired.

"items" must be a string or an array of strings.

* Replace monster size entry with volume and mass entry.

The "size" entry is no longer used and it is now ignored.

* Add two spaces after a period.

As required by the style we use.

* Fix name of JSON member

* Fix item flags being set on gun data (item flags need to be set on item types directly).

* Remove unnecessary spaces before end of line

* Remove mods from blacklist as they load properly now.

* Add subtype entry, so the loading code actually parses the "entries" array.

* Ignore unvisited members when skipping an out-of-bounds entry

* Commit changes after running `make style-all-json`

* Fix spelling mistake. Thanks for pointing that out.

Co-Authored-By: ZhilkinSerg <[email protected]>

Co-authored-by: ZhilkinSerg <[email protected]>
  • Loading branch information
ZhilkinSerg authored Dec 28, 2019
2 parents 311b795 + 040ae76 commit 556e4a8
Show file tree
Hide file tree
Showing 62 changed files with 224 additions and 360 deletions.
5 changes: 0 additions & 5 deletions build-scripts/mod_test_blacklist
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
aftershock
blazemod
crazy_cataclysm
crt_expansion
FIC_Weapons
generic_guns
Graphical_Overmap
mapgen_demo
modular_turrets
more_locations
my_sweet_cataclysm
national_guard_camp
no_medieval_items
sees_player_hitbutton
sees_player_retro
12 changes: 12 additions & 0 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
{
"id": "EFFECT_INVISIBLE",
"context": [ ],
"type": "json_flag"
},
{
Expand Down Expand Up @@ -70,6 +71,7 @@
},
{
"id": "EFFECT_NIGHT_VISION",
"context": [ ],
"type": "json_flag"
},
{
Expand Down Expand Up @@ -144,6 +146,7 @@
{
"id": "ETHEREAL_ITEM",
"type": "json_flag",
"context": [ ],
"info": "This item disappears as soon as its timer runs out whether it is food or not."
},
{
Expand Down Expand Up @@ -680,38 +683,47 @@
},
{
"id": "EFFECT_FEATHER_FALL",
"context": [ ],
"type": "json_flag"
},
{
"id": "EFFECT_BIO_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
"id": "EFFECT_BASH_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
"id": "EFFECT_CUT_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
"id": "EFFECT_ACID_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
"id": "EFFECT_STAB_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
"id": "EFFECT_HEAT_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
"id": "EFFECT_COLD_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
"id": "ELECTRIC_IMMUNE",
"context": [ ],
"type": "json_flag"
},
{
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/comestibles/carnivore.json
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@
"color": "brown",
"healthy": -8,
"quench": -5,
"calories": "54",
"calories": 54,
"vitamins": [ [ "vitA", 6 ], [ "vitC", 2 ], [ "calcium", 0 ], [ "iron", 8 ], [ "vitB", 155 ] ]
},
{
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/tool/deployable.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"to_hit": -4,
"bashing": 7,
"material": [ "wood" ],
"looks_like": [ "f_wood_keg" ],
"looks_like": "f_wood_keg",
"symbol": "u",
"color": "light_gray",
"use_action": { "type": "deploy_furn", "furn_type": "f_butter_churn" },
Expand Down
2 changes: 1 addition & 1 deletion data/json/mapgen/steel_mill/steel_mill_z2.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::",
"::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
],
"terrain": [ { "M": "t_grate" }, { "8": "t_grate" } ],
"terrain": { "M": "t_grate", "8": "t_grate" },
"furniture": { },
"palettes": [ "steel_mill_palette" ],
"place_monsters": [
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/TALK_TEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"responses": [
{ "text": "This is a basic test response.", "topic": "TALK_DONE" },
{ "text": "This is a cash test response.", "topic": "TALK_DONE", "condition": { "u_has_cash": 500 } },
{ "text": "This is an npc service test response.", "topic": "TALK_DONE", "condition": { "npc_service": 500 } },
{ "text": "This is an npc service test response.", "topic": "TALK_DONE", "condition": { "npc_service": true } },
{ "text": "This is an npc available test response.", "topic": "TALK_DONE", "condition": "npc_available" }
]
},
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/TALK_TRUE_FOODPERSON.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
]
},
"text": "I am you but from an alternate reality.",
"trial": { "type": "LIE", "difficulty": 10, "mod": { "trust": 1, "value": 1 } },
"trial": { "type": "LIE", "difficulty": 10, "mod": [ [ "TRUST", 1 ], [ "VALUE", 1 ] ] },
"success": { "topic": "TALK_FOODPERSON_MULTIVERSE", "opinion": { "trust": 2, "value": 2 } },
"failure": { "topic": "TALK_FOODPERSON_ONLYONE", "opinion": { "trust": -5, "value": -5 } }
},
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/isherwood_farm/NPC_Barry_Isherwood.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"destination": "dairy_farm_isherwood_W",
"start": {
"effect": [ { "u_add_var": "u_have_barry_escape", "type": "general", "context": "meeting", "value": "yes" } ],
"assign_mission_target": { "om_terrain": "dairy_farm_isherwood_W", "om_special": "Isherwood Farms", "reveal_radius": 3 }
"assign_mission_target": { "om_terrain": "dairy_farm_isherwood_W", "reveal_radius": 3 }
},
"end": {
"opinion": { "trust": 5, "value": 5 },
Expand Down
8 changes: 1 addition & 7 deletions data/json/npcs/isherwood_farm/NPC_Carlos_Isherwood.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,7 @@
"end": {
"opinion": { "trust": 1, "value": 1 },
"effect": [ { "u_buy_item": "leather_armor_horse", "count": 1 } ],
"update_mapgen": [
{
"om_terrain": "horse_farm_isherwood_4",
"om_special": "Isherwood Farms",
"set": [ { "point": "furniture", "id": "f_anvil", "x": 6, "y": 12 } ]
}
]
"update_mapgen": [ { "om_terrain": "horse_farm_isherwood_4", "set": [ { "point": "furniture", "id": "f_anvil", "x": 6, "y": 12 } ] } ]
}
},
{
Expand Down
8 changes: 1 addition & 7 deletions data/json/npcs/isherwood_farm/NPC_Chris_Isherwood.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,7 @@
},
"end": {
"opinion": { "trust": 5, "value": 5 },
"update_mapgen": [
{
"om_terrain": "cabin_isherwood",
"om_special": "Isherwood Farms",
"place_nested": [ { "chunks": [ "cabin_isherwood_update" ], "x": 3, "y": 1 } ]
}
]
"update_mapgen": [ { "om_terrain": "cabin_isherwood", "place_nested": [ { "chunks": [ "cabin_isherwood_update" ], "x": 3, "y": 1 } ] } ]
}
}
]
1 change: 0 additions & 1 deletion data/json/npcs/isherwood_farm/NPC_Eddie_Isherwood.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@
"update_mapgen": [
{
"om_terrain": "rural_outbuilding",
"om_special": "Isherwood Farms",
"place_nested": [ { "chunks": [ "isherwood_outbuilding_kilns" ], "x": 0, "y": 0 } ],
"set": [
{ "point": "furniture", "id": "f_kiln_empty", "x": 8, "y": 13 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
"item": "landough_calrisean",
"start": {
"assign_mission_target": { "om_terrain": "bakery", "reveal_radius": 1, "random": true, "search_range": 120 },
"update_mapgen": { "om_terrain": "bakery", "om_special": "bakery", "place_item": [ { "item": "landough_calrisean", "x": 5, "y": 16 } ] },
"update_mapgen": { "om_terrain": "bakery", "place_item": [ { "item": "landough_calrisean", "x": 5, "y": 16 } ] },
"effect": { "u_add_var": "Dana_Sourdough", "type": "mission", "context": "flag", "value": "in_progress" }
},
"end": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@
"assign_mission_target": { "om_terrain": "evac_center_9", "reveal_radius": 1 },
"update_mapgen": {
"om_terrain": "evac_center_9",
"om_special": "evac_center",
"place_monster": [ { "group": "GROUP_REFUGEE_BOSS_ZOMBIE", "name": "Sean McLaughlin", "x": 10, "y": 10, "target": true } ]
}
},
Expand All @@ -426,7 +425,6 @@
],
"update_mapgen": {
"om_terrain": "evac_center_9",
"om_special": "evac_center",
"set": [ { "square": "terrain", "id": "t_floor", "x": 0, "y": 23, "x2": 1, "y2": 23 } ]
}
},
Expand Down Expand Up @@ -556,7 +554,6 @@
],
"update_mapgen": {
"om_terrain": "evac_center_8",
"om_special": "evac_center",
"set": [
{ "point": "terrain", "id": "t_gates_mech_control_lab", "x": 17, "y": 1 },
{ "point": "terrain", "id": "t_gates_mech_control_lab", "x": 17, "y": 3 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,9 @@
"value": 50000,
"start": {
"update_mapgen": [
{
"om_terrain": "evac_center_19",
"om_special": "evac_center",
"place_npcs": [ { "class": "evac_guard3", "x": 12, "y": 12, "target": true } ]
},
{ "om_terrain": "evac_center_19", "place_npcs": [ { "class": "evac_guard3", "x": 12, "y": 12, "target": true } ] },
{
"om_terrain": "evac_center_7",
"om_special": "evac_center",
"place_npcs": [ { "class": "scavenger_hunter", "x": [ 9, 15 ], "y": [ 9, 15 ] } ]
}
]
Expand Down Expand Up @@ -166,7 +161,7 @@
"difficulty": 5,
"value": 100000,
"start": {
"assign_mission_target": { "om_terrain": "field", "reveal_radius": 5, "random": true, "search_range": [ 10, 50 ] },
"assign_mission_target": { "om_terrain": "field", "reveal_radius": 5, "random": true, "search_range": 30 },
"update_mapgen": {
"place_monster": [
{ "monster": "mon_graboid", "name": "Little Guy", "x": 12, "y": 12, "target": true },
Expand Down
2 changes: 0 additions & 2 deletions data/json/npcs/robofac/NPC_ROBOFAC_INTERCOM.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,10 @@
"update_mapgen": [
{
"om_terrain": "robofachq_surface_b0",
"om_special": "hub_01",
"place_nested": [ { "chunks": [ "robofac_hq_surface_freemerchant_camp" ], "x": 4, "y": 0 } ]
},
{
"om_terrain": "robofachq_surface_entrance",
"om_special": "hub_01",
"place_nested": [ { "chunks": [ "robofac_hq_surface_merc_1" ], "x": 3, "y": 10 } ]
}
],
Expand Down
4 changes: 0 additions & 4 deletions data/json/npcs/tacoma_ranch/NPC_ranch_bartender.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"end": {
"update_mapgen": {
"om_terrain": "ranch_camp_51",
"om_special": "ranch_camp",
"place_nested": [ { "chunks": [ "tacoma_commune_bar_bartender_1" ], "x": 0, "y": 0 } ]
}
}
Expand Down Expand Up @@ -124,7 +123,6 @@
"effect": { "npc_add_trait": "NPC_BRANDY" },
"update_mapgen": {
"om_terrain": "ranch_camp_51",
"om_special": "ranch_camp",
"place_nested": [ { "chunks": [ "tacoma_commune_bar_bartender_2" ], "x": 0, "y": 0 } ]
}
}
Expand Down Expand Up @@ -155,7 +153,6 @@
"effect": { "npc_add_trait": "NPC_RUM" },
"update_mapgen": {
"om_terrain": "ranch_camp_51",
"om_special": "ranch_camp",
"place_nested": [ { "chunks": [ "tacoma_commune_bar_bartender_3" ], "x": 0, "y": 0 } ]
}
}
Expand Down Expand Up @@ -186,7 +183,6 @@
"effect": { "npc_add_trait": "NPC_WHISKEY" },
"update_mapgen": {
"om_terrain": "ranch_camp_51",
"om_special": "ranch_camp",
"place_nested": [ { "chunks": [ "tacoma_commune_bar_bartender_4" ], "x": 0, "y": 0 } ]
}
}
Expand Down
Loading

0 comments on commit 556e4a8

Please sign in to comment.