Skip to content

Commit

Permalink
Merge pull request #44933 from Night-Pryanik/jsonify-parking-lot
Browse files Browse the repository at this point in the history
Jsonify parking lot
  • Loading branch information
ZhilkinSerg authored Oct 27, 2020
2 parents 913676c + 38d2053 commit 415056f
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 45 deletions.
36 changes: 36 additions & 0 deletions data/json/mapgen/parking_lot.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,41 @@
"terrain": { ".": [ [ "t_grass", 6 ], [ "t_dirt", 5 ] ], "_": "t_pavement", "-": "t_pavement_y", ",": "t_concrete" },
"furniture": { "Y": "f_street_light" }
}
},
{
"type": "mapgen",
"method": "json",
"om_terrain": [ "s_lot" ],
"object": {
"rows": [
"........................",
"........................",
"........................",
"######............######",
"........................",
".....................>..",
"..<.....................",
"........................",
"######............######",
"........................",
".....................>..",
"..<.....................",
"........................",
"######............######",
"........................",
".....................>..",
"..<.....................",
"........................",
"######............######",
"........................",
".....................>..",
"..<.....................",
"........................",
"######............######"
],
"terrain": { ".": "t_pavement", ">": "t_pavement", "<": "t_pavement", "#": "t_pavement_y" },
"items": { ".": { "item": "road", "chance": 1 } },
"vehicles": { ">": { "vehicle": "parkinglot", "chance": 10 }, "<": { "vehicle": "parkinglot", "chance": 10, "rotation": 180 } }
}
}
]
6 changes: 6 additions & 0 deletions data/json/overmap/multitile_city_buildings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3855,5 +3855,11 @@
{ "point": [ 0, 0, 1 ], "overmap": "s_diner_2ndfloor_north" },
{ "point": [ 0, 0, 2 ], "overmap": "s_diner_roof_north" }
]
},
{
"type": "city_building",
"id": "s_lot",
"locations": [ "land" ],
"overmaps": [ { "point": [ 0, 0, 0 ], "overmap": "s_lot_north" } ]
}
]
2 changes: 1 addition & 1 deletion data/json/overmap/overmap_special/specials.json
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@
{
"type": "overmap_special",
"id": "Mine Entrance",
"overmaps": [ { "point": [ 0, 0, 0 ], "overmap": "s_lot" }, { "point": [ 0, 1, 0 ], "overmap": "mine_entrance" } ],
"overmaps": [ { "point": [ 0, 0, 0 ], "overmap": "s_lot_north" }, { "point": [ 0, 1, 0 ], "overmap": "mine_entrance" } ],
"connections": [ { "point": [ 0, -1, 0 ], "terrain": "road", "connection": "local_road", "from": [ 0, 0, 0 ] } ],
"locations": [ "wilderness" ],
"city_distance": [ 15, -1 ],
Expand Down
12 changes: 0 additions & 12 deletions data/json/overmap/overmap_terrain/overmap_terrain_hardcoded.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@
"mapgen": [ { "method": "builtin", "name": "forest" } ],
"flags": [ "NO_ROTATE", "SOURCE_FORAGE", "RISK_HIGH" ]
},
{
"type": "overmap_terrain",
"id": "s_lot",
"name": "parking lot",
"sym": "O",
"color": "dark_gray",
"see_cost": 1,
"extras": "build",
"mondensity": 2,
"mapgen": [ { "method": "builtin", "name": "parking_lot" } ],
"flags": [ "SIDEWALK", "NO_ROTATE" ]
},
{
"type": "overmap_terrain",
"id": "temple",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,5 +461,13 @@
"color": "dark_gray",
"see_cost": 5,
"extras": "build"
},
{
"type": "overmap_terrain",
"id": "s_lot",
"copy-from": "generic_city_building",
"name": "parking lot",
"sym": "O",
"color": "dark_gray"
}
]
2 changes: 1 addition & 1 deletion data/mods/Aftershock/maps/overmap_specials.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{ "point": [ 0, 2, 0 ], "overmap": "park_north" },
{ "point": [ 1, 2, 0 ], "overmap": "office_cubical_north" },
{ "point": [ -1, 2, 0 ], "overmap": "pwr_sub_s_north" },
{ "point": [ -1, 0, 0 ], "overmap": "s_lot" }
{ "point": [ -1, 0, 0 ], "overmap": "s_lot_north" }
],
"locations": [ "wilderness", "swamp" ],
"city_distance": [ -1, 6 ],
Expand Down
30 changes: 0 additions & 30 deletions src/mapgen_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ building_gen_pointer get_mapgen_cfunction( const std::string &ident )
{ "river_curved_not", &mapgen_river_curved_not },
{ "river_straight", &mapgen_river_straight },
{ "river_curved", &mapgen_river_curved },
{ "parking_lot", &mapgen_parking_lot },
{ "spider_pit", mapgen_spider_pit },
{ "cavern", &mapgen_cavern },
{ "open_air", &mapgen_open_air },
Expand Down Expand Up @@ -1842,35 +1841,6 @@ void mapgen_river_curved( mapgendata &dat )
}
}

void mapgen_parking_lot( mapgendata &dat )
{
map *const m = &dat.m;
for( int i = 0; i < SEEX * 2; i++ ) {
for( int j = 0; j < SEEY * 2; j++ ) {
if( ( j == 5 || j == 9 || j == 13 || j == 17 || j == 21 ) &&
( ( i > 1 && i < 8 ) || ( i > 14 && i < SEEX * 2 - 2 ) ) ) {
m->ter_set( point( i, j ), t_pavement_y );
} else if( ( j < 2 && i > 7 && i < 17 ) || ( j >= 2 && j < SEEY * 2 - 2 && i > 1 &&
i < SEEX * 2 - 2 ) ) {
m->ter_set( point( i, j ), t_pavement );
} else {
m->ter_set( point( i, j ), dat.groundcover() );
}
}
}

VehicleSpawn::apply( vspawn_id( "default_parkinglot" ), *m, "parkinglot" );

m->place_items( item_group_id( "road" ), 8, point_zero, point( SEEX * 2 - 1, SEEY * 2 - 1 ),
false, dat.when() );
for( int i = 1; i < 4; i++ ) {
const std::string &id = dat.t_nesw[i].id().str();
if( id.size() > 5 && id.find( "road_" ) == 0 ) {
m->rotate( i );
}
}
}

void mapgen_cavern( mapgendata &dat )
{
map *const m = &dat.m;
Expand Down
1 change: 0 additions & 1 deletion src/mapgen_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ void mapgen_highway( mapgendata &dat );
void mapgen_river_curved_not( mapgendata &dat );
void mapgen_river_straight( mapgendata &dat );
void mapgen_river_curved( mapgendata &dat );
void mapgen_parking_lot( mapgendata &dat );
void mapgen_cave( mapgendata &dat );
void mapgen_cave_rat( mapgendata &dat );
void mapgen_cavern( mapgendata &dat );
Expand Down

0 comments on commit 415056f

Please sign in to comment.