Skip to content

Commit

Permalink
Merge pull request #78646 from Maarifrah/carcrash-ter_furn_transform-…
Browse files Browse the repository at this point in the history
…tests

Structure Damage: Car Crashes, migration to ter_furn_transform to retain terrains
  • Loading branch information
Night-Pryanik authored Dec 19, 2024
2 parents 13c7a44 + d4d7200 commit 881f103
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 25 deletions.
2 changes: 1 addition & 1 deletion data/json/mapgen/house/bungalow09.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
},
"place_nested": [
{ "chunks": [ "rolling_trash_can_1x1" ], "x": 9, "y": 0 },
{ "chunks": [ [ "null", 10 ], [ "carcrash_8x8_straight", 90 ] ], "x": [ 14, 15 ], "y": 0 }
{ "chunks": [ [ "null", 95 ], [ "carcrash_8x8_straight", 5 ] ], "x": [ 14, 15 ], "y": 0 }
],
"place_loot": [ { "item": "laptop", "x": 17, "y": 5, "chance": 100 }, { "item": "television", "x": 9, "y": 7, "chance": 100 } ]
}
Expand Down
111 changes: 87 additions & 24 deletions data/json/mapgen/nested/structure_damage_nested.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,88 @@
"type": "palette",
"id": "struc_damage",
"parameters": { "crashvariant": { "type": "string", "scope": "omt", "default": { "distribution": [ "fromleft", "fromright" ] } } },
"terrain": {
"c": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "t_dirtmoundfloor", "fromright": "t_null" } },
"v": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "t_null", "fromright": "t_dirtmoundfloor" } },
"d": "t_dirtmoundfloor",
"r": "t_dirtmoundfloor",
"w": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "t_dirtmoundfloor", "fromright": "t_null" } },
"j": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "t_null", "fromright": "t_dirtmoundfloor" } }
"ter_furn_transforms": {
"c": {
"transform": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "struc_carcrash_dirt", "fromright": "tft_null" } }
},
"v": {
"transform": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "tft_null", "fromright": "struc_carcrash_dirt" } }
},
"w": {
"transform": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "struc_carcrash_rubble", "fromright": "tft_null" } }
},
"j": {
"transform": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "tft_null", "fromright": "struc_carcrash_rubble" } }
},
"r": { "transform": "struc_carcrash_rubble" },
"x": { "transform": "struc_carcrash_clear" },
"d": { "transform": "struc_carcrash_dirt" }
},
"fields": {
"m": { "field": "fd_blood", "intensity": 2 },
"h": { "field": "fd_blood", "intensity": 3 },
"k": { "field": "fd_blood", "intensity": 3 }
},
"furniture": {
"r": "f_rubble",
"w": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "f_rubble", "fromright": "f_null" } },
"j": { "switch": { "param": "crashvariant" }, "cases": { "fromleft": "f_null", "fromright": "f_rubble" } }
}
},
{
"type": "ter_furn_transform",
"id": "tft_null",
"//": "transform won't accept null in a switch statement, so for now this is the solution. Does nothing.",
"terrain": [ { "result": "t_null", "valid_terrain": [ "t_null" ] } ]
},
{
"type": "ter_furn_transform",
"id": "struc_carcrash_rubble",
"terrain": [
{
"result": "t_floor",
"valid_terrain": [
"t_door_white_frame",
"t_door_frame",
"t_door_lab_frame",
"t_door_red_frame",
"t_door_green_frame",
"t_door_gray_frame",
"t_mdoor_lab_frame",
"t_mdoor_frame"
],
"valid_flags": [ "DOOR", "WALL", "WINDOW", "BARRICADABLE_DOOR", "BARRICADABLE_DOOR_DAMAGED" ]
},
{
"result": "t_dirtmoundfloor",
"valid_terrain": [ "t_gutter_downspout" ],
"valid_flags": [ "DIGGABLE", "TREE", "SHRUB", "FLOWER" ]
}
],
"furniture": [ { "result": "f_rubble", "valid_furniture": [ "f_null" ], "valid_flags": [ "BLOCKSDOOR", "TRANSPARENT" ] } ]
},
{
"type": "ter_furn_transform",
"id": "struc_carcrash_dirt",
"terrain": [ { "result": "t_dirtmoundfloor", "valid_flags": [ "DIGGABLE", "TREE", "SHRUB", "FLOWER" ] } ],
"furniture": [ { "result": "f_null", "valid_flags": [ "BLOCKSDOOR", "TRANSPARENT" ] } ]
},
{
"type": "ter_furn_transform",
"id": "struc_carcrash_clear",
"terrain": [
{
"result": "t_floor",
"valid_terrain": [
"t_door_white_frame",
"t_door_frame",
"t_door_lab_frame",
"t_door_red_frame",
"t_door_green_frame",
"t_door_gray_frame",
"t_mdoor_lab_frame",
"t_mdoor_frame"
],
"valid_flags": [ "DOOR", "WINDOW", "WALL", "BARRICADABLE_DOOR", "BARRICADABLE_DOOR_DAMAGED" ]
}
],
"furniture": [ { "result": "f_null", "valid_flags": [ "BLOCKSDOOR", "TRANSPARENT" ] } ]
},
{
"type": "mapgen",
"method": "json",
Expand Down Expand Up @@ -61,10 +124,10 @@
" cccdvvv",
" ccdddvv",
" ccdddv ",
" jddddw ",
" jddddw ",
"jvddddcw",
"jvddddcw",
" jxxxxw ",
" jxxxxw ",
"jjxxxxww",
"jjxxxxww",
"jjrrrrww"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
Expand All @@ -84,10 +147,10 @@
"dddd ",
"ddddd ",
"dddddddd ",
"rdddddddw ",
"rdddddddrw",
"jrddddddrw",
"jjrrddddr ",
"rrrrxrrrw ",
"rrrxxxxrrw",
"jrxxxxxrrw",
"jjrrxxxrr ",
" jjjrrrw ",
" ",
" "
Expand All @@ -109,10 +172,10 @@
" dddd",
" ddddd",
" dddddddd",
" wdddddddr",
"wrdddddddr",
"wrddddddrj",
" rddddrrjj",
" wrrrxrrrr",
"wrrxxxxrrr",
"wrrxxxxxrj",
" rrxxxrrjj",
" wrrrjjj ",
" ",
" "
Expand Down

0 comments on commit 881f103

Please sign in to comment.