Skip to content

Commit

Permalink
Various mapgen fixes
Browse files Browse the repository at this point in the history
Fix lots of situations that led to out-of-bounds spawns, or colliding
spawns.

These generally occur with nested mapgen, but can also occur due to
predecessor mapgen, hardcoded mapgen, or map extras.

Where terrain definitions conflict with other stuff that's already
present on the map we use one of a variety of solutions, according to
each individual situation:

- Add one of the two new flags.
- Remove the terrain definition entirely.
- Add targeted removal instructions.
  • Loading branch information
jbytheway authored and kevingranade committed Jan 21, 2022
1 parent 0f101a6 commit 5039c34
Show file tree
Hide file tree
Showing 28 changed files with 226 additions and 111 deletions.
1 change: 1 addition & 0 deletions data/json/mapgen/abandoned01.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
".S.ww^...T......Tz.z.S..",
"..^...T......z.^..^.z.^."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"set": [
{ "point": "bash", "x": 7, "y": 7 },
{ "point": "bash", "x": 3, "y": 20 },
Expand Down
4 changes: 2 additions & 2 deletions data/json/mapgen/apartment_mod_new.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@
[ "roof_4x4_party", 20 ],
[ "roof_3x3_wine", 20 ]
],
"x": [ 24, 40 ],
"y": [ 24, 40 ]
"x": [ 24, 39 ],
"y": [ 24, 38 ]
}
],
"place_monsters": [ { "monster": "GROUP_ROOF_ZOMBIE", "x": [ 4, 23 ], "y": [ 4, 23 ], "repeat": [ 0, 1 ] } ]
Expand Down
1 change: 1 addition & 0 deletions data/json/mapgen/bugs/ants.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
" ",
" "
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"terrain": { "<": "t_slope_down", "+": "t_dirtmound", "-": [ "t_dirtmound", "t_region_groundcover_barren" ] }
}
},
Expand Down
13 changes: 4 additions & 9 deletions data/json/mapgen/dock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
{
"type": "palette",
"id": "dock_small",
"terrain": { " ": "t_null", "d": "t_dock" },
"nested": { "d": { "chunks": [ [ "clear_furniture", 1 ] ] } }
"terrain": { "d": "t_dock" }
},
{
"type": "mapgen",
Expand Down Expand Up @@ -38,6 +37,7 @@
" dd ",
" dd "
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "dock_small" ]
}
},
Expand Down Expand Up @@ -74,6 +74,7 @@
" dddddddddddd ",
" dddddddddddd "
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "dock_small" ],
"place_nested": [ { "chunks": [ [ "NPC_lighthouse_man_spawn", 25 ], [ "null", 75 ] ], "x": 12, "y": 21 } ]
}
Expand Down Expand Up @@ -110,18 +111,12 @@
" ",
" "
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "dock_small" ],
"place_vehicles": [
{ "chance": 10, "fuel": 15, "vehicle": "boat_motor_single", "x": 8, "y": 5, "rotation": 270 },
{ "chance": 10, "fuel": 15, "vehicle": "boat_motor_single", "x": 13, "y": 5, "rotation": 270 }
]
}
},
{
"type": "mapgen",
"method": "json",
"nested_mapgen_id": "clear_furniture",
"//": "used to be able to clear furniture when using a 'rows' placement mapping, since f_null directly is ignored",
"object": { "mapgensize": [ 1, 1 ], "set": [ { "point": "furniture", "id": "f_null", "x": 0, "y": 0 } ] }
}
]
19 changes: 18 additions & 1 deletion data/json/mapgen/farm_tiles.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 4, 18 ], "y": [ 0, 22 ] } ],
"place_vehicles": [ { "vehicle": "farm_vehicles", "x": [ 7, 13 ], "y": [ 0, 18 ], "chance": 10, "status": 1, "rotation": 270 } ]
Expand Down Expand Up @@ -324,6 +325,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 4, 18 ], "y": [ 0, 22 ] } ],
"place_vehicles": [ { "vehicle": "farm_vehicles", "x": [ 7, 13 ], "y": [ 0, 18 ], "chance": 10, "status": 1, "rotation": 270 } ]
Expand Down Expand Up @@ -363,6 +365,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 8, 18 ], "y": [ 0, 22 ] } ],
"place_vehicles": [ { "vehicle": "farm_vehicles", "x": [ 7, 13 ], "y": [ 0, 18 ], "chance": 10, "status": 1, "rotation": 270 } ]
Expand Down Expand Up @@ -403,6 +406,7 @@
".......////////.........",
".......////////........."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 4, 10 ], "y": [ 0, 22 ] } ],
"place_vehicles": [ { "vehicle": "farm_vehicles", "x": [ 7, 13 ], "y": [ 0, 18 ], "chance": 10, "status": 1, "rotation": 270 } ]
Expand Down Expand Up @@ -443,6 +447,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 4, 10 ], "y": [ 0, 22 ] } ],
"place_vehicles": [ { "vehicle": "farm_vehicles", "x": [ 7, 13 ], "y": [ 0, 18 ], "chance": 10, "status": 1, "rotation": 270 } ]
Expand Down Expand Up @@ -483,6 +488,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 10, 20 ], "y": [ 0, 22 ] } ],
"place_vehicles": [ { "vehicle": "farm_vehicles", "x": [ 7, 13 ], "y": [ 0, 18 ], "chance": 10, "status": 1, "rotation": 270 } ]
Expand Down Expand Up @@ -522,6 +528,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ]
}
},
Expand Down Expand Up @@ -559,6 +566,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ]
}
},
Expand Down Expand Up @@ -596,6 +604,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ]
}
},
Expand Down Expand Up @@ -633,6 +642,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ]
}
},
Expand Down Expand Up @@ -670,6 +680,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ]
}
},
Expand Down Expand Up @@ -707,6 +718,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ]
}
},
Expand Down Expand Up @@ -745,6 +757,7 @@
"........////////........",
"........////////........"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ]
}
},
Expand Down Expand Up @@ -1024,7 +1037,9 @@
"ccccccccc|,,,,,,|.......",
".........||||||||......."
],
"flags": [ "ALLOW_TERRAIN_UNDER_OTHER_DATA" ],
"palettes": [ "farm_lots" ],
"remove_all": { "c": { }, "C": { }, "|": { } },
"place_monster": [ { "monster": "mon_chicken", "x": [ 1, 17 ], "y": [ 1, 22 ], "repeat": [ 4, 10 ] } ],
"terrain": { "_": [ [ "t_dirt", 15 ], [ "t_grass_long", 5 ], [ "t_underbrush", 1 ], [ "t_grass", 10 ] ] },
"item": { "_": { "item": "birdfood", "chance": 1, "repeat": [ 1, 3 ] } }
Expand Down Expand Up @@ -1064,6 +1079,7 @@
"%%%%%%%%%%%%%%%%%%......",
"........................"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "farm_lots" ],
"terrain": {
"O": "t_dirtmound",
Expand Down Expand Up @@ -1118,12 +1134,13 @@
"........................",
"........................"
],
"flags": [ "ALLOW_TERRAIN_UNDER_OTHER_DATA" ],
"palettes": [ "farm_lots" ],
"place_nested": [
{ "chunks": [ [ "null", 25 ], [ "24x24_fence3", 20 ], [ "24x24_fence4", 20 ], [ "24x24_fence5", 15 ] ], "x": 0, "y": 0 }
],
"remove_all": { "♥": { }, "♠": { }, "♦": { }, "♣": { }, "Ʌ": { } },
"terrain": {
"O": "t_dirtmound",
"♥": "t_dirtmound",
"♠": "t_dirtmound",
"♦": "t_dirtmound",
Expand Down
10 changes: 10 additions & 0 deletions data/json/mapgen/isherwood_farms/rural_roads_trails.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 4, 18 ], "y": [ 0, 22 ] } ]
}
Expand Down Expand Up @@ -71,6 +72,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 4, 18 ], "y": [ 0, 22 ] } ]
}
Expand Down Expand Up @@ -110,6 +112,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ],
"place_nested": [ { "chunks": [ [ "2x2_haybale", 5 ], [ "null", 20 ] ], "x": [ 10, 20 ], "y": [ 0, 22 ] } ]
}
Expand Down Expand Up @@ -148,6 +151,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ]
}
},
Expand Down Expand Up @@ -185,6 +189,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ]
}
},
Expand Down Expand Up @@ -222,6 +227,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ]
}
},
Expand Down Expand Up @@ -259,6 +265,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ]
}
},
Expand Down Expand Up @@ -296,6 +303,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ]
}
},
Expand Down Expand Up @@ -333,6 +341,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ]
}
},
Expand Down Expand Up @@ -371,6 +380,7 @@
".......i///ii///i.......",
".......i///ii///i......."
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "rural_road" ]
}
},
Expand Down
1 change: 0 additions & 1 deletion data/json/mapgen/lab/lab_floorplans.json
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@
"object": {
"mapgensize": [ 1, 1 ],
"rows": [ "X" ],
"terrain": { "X": "t_thconc_floor" },
"furniture": { "X": [ "f_crate_c", "f_crate_c", "f_crate_c", "f_crate_o" ] },
"mapping": {
"X": {
Expand Down
Loading

0 comments on commit 5039c34

Please sign in to comment.