diff --git a/data/json/mapgen/mine/mine_entrance.json b/data/json/mapgen/mine/mine_entrance.json new file mode 100644 index 0000000000000..71f2e6a6508c2 --- /dev/null +++ b/data/json/mapgen/mine/mine_entrance.json @@ -0,0 +1,194 @@ +[ + { + "type": "mapgen", + "method": "json", + "om_terrain": "mine_entrance", + "object": { + "rows": [ + "fffffffffffФФfffffffffff", + "f v ,,,,,,,,,,,, !f", + "f/ ,,,,,,,,,,,,,,,,,f", + "|-000--000-0+0|00--00|,f", + "|dddrFFddcW..2|2..Fdd|,f", + "0dC.....Cc....?....dC|,f", + "0............a|b...d.|,f", + "0..C...|*-|-*-|b.....|,f", + "|rddd1p|.l|&_s|a36561|,f", + "|-000--|--|---|------|,f", + "f ,,,,,,,,,,,,,,,,,f", + "|----|+|----| ,,,,,,,/f", + "|I.hĎ|.|дh.I| ,|---%--|", + "0BB..+.+..BB0 ,|eEE~~4|", + "|----|.|----| ,|~EE~~4|", + "|I.hĎ|.|дh.I| ,|------|", + "0BB..+.+..BB0 ,|888888|", + "|----|.|----| ,?~~~~~8|", + "|I.hD|.|Дh.I| ,|888888|", + "0BB..+.+..BB0 ,|------|", + "|----|.|----| ,^`````@|", + "|&___+.+____| ,^``````|", + "|R__s|.|Й__7|/ №|999``$|", + "|----|0|----|fff|------|" + ], + "fill_ter": "t_floor", + "terrain": { + " ": [ [ "t_region_groundcover", 4 ], [ "t_region_shrub", 2 ], [ "t_region_tree", 1 ] ], + "!": "t_manhole_cover", + "/": "t_gutter_downspout", + "|": "t_wall", + "-": "t_wall", + "_": "t_linoleum_white", + "&": "t_linoleum_white", + "*": "t_door_c", + "?": "t_door_locked_alarm", + "+": "t_door_locked", + "%": "t_door_metal_c", + "^": "t_door_metal_locked", + "№": "t_gates_mech_control", + ",": "t_sidewalk", + ".": "t_floor", + "~": "t_thconc_floor", + "`": "t_thconc_floor", + "0": "t_metal_grate_window_with_curtain", + "4": "t_thconc_floor", + "8": "t_thconc_floor", + "9": "t_thconc_floor", + "E": "t_elevator", + "e": "t_elevator_control_off", + "f": "t_chainfence", + "L": "t_door_metal_locked", + "R": "t_linoleum_white", + "s": "t_linoleum_white", + "v": "t_dirt", + "w": "t_window_alarm", + "W": "t_water_dispenser", + "Й": "t_linoleum_white", + "Ф": "t_chaingate_l" + }, + "furniture": { + "1": "f_shredder", + "2": "f_rack_coat", + "3": "f_server", + "4": "f_metal_bench", + "5": "f_console", + "6": "f_console_broken", + "7": "f_shower", + "8": "f_utility_shelf", + "9": "f_utility_shelf", + "a": "f_air_conditioner", + "B": "f_bed", + "b": "f_bookcase", + "c": "f_counter", + "C": "f_chair", + "d": "f_desk", + "D": "f_desk", + "Ď": "f_desk", + "F": "f_filing_cabinet", + "h": "f_chair", + "I": "f_dresser", + "l": "f_locker", + "p": [ "f_indoor_plant", "f_indoor_plant_y" ], + "R": "f_trashcan", + "r": "f_trashcan", + "s": "f_sink", + "v": "f_vent_pipe", + "Д": "f_desk", + "д": "f_desk", + "Й": "f_rack_coat" + }, + "toilets": { "&": { } }, + "items": { + "2": { "item": "coat_rack", "chance": 60, "repeat": 2 }, + "8": { "item": "mine_storage", "chance": 50, "repeat": 4 }, + "9": { "item": "car_kit", "chance": 60, "repeat": 2 }, + "B": { "item": "bed", "chance": 50 }, + "b": { "item": "lab_bookshelves", "chance": 60, "repeat": 2 }, + "c": { "item": "office_supplies", "chance": 60 }, + "D": { "item": "SUS_junk_drawer_artsy", "chance": 90 }, + "Ď": { "item": "SUS_junk_drawer_messy", "chance": 90 }, + "d": { "item": "SUS_office_desk", "chance": 90 }, + "F": { "item": "SUS_office_filing_cabinet", "chance": 90 }, + "I": { "item": "SUS_dresser_mens", "chance": 60 }, + "l": { "item": "SUS_janitors_closet", "chance": 85 }, + "R": { "item": "trash_cart", "chance": 50 }, + "r": { "item": "trash_cart", "chance": 50 }, + "s": { "item": "SUS_bathroom_sink", "chance": 70 }, + "Д": { "item": "SUS_junk_drawer_handy", "chance": 90 }, + "д": { "item": "SUS_junk_drawer_tidy", "chance": 90 } + }, + "monster": { + ",": { "monster": "mon_zombie_miner", "chance": 5 }, + ".": { "monster": "mon_zombie_miner", "chance": 5 }, + "`": { "monster": "mon_zombie_miner", "chance": 5 }, + " ": { "monster": "mon_zombie_miner", "chance": 5 }, + "~": { "monster": "mon_zombie_miner", "chance": 5 } + }, + "computers": { + "5": { + "name": "NEPowerOS", + "security": 2, + "options": [ { "name": "Divert power to elevator", "action": "elevator_on" } ], + "failures": [ { "action": "alarm" } ] + } + }, + "gaspumps": { "@": { "fuel": "gasoline", "amount": [ 10000, 50000 ] }, "$": { "fuel": "diesel", "amount": [ 10000, 50000 ] } }, + "nested": { "`": { "chunks": [ [ "mechanical_fluid", 10 ], [ "gasoline_diesel_motor_oil", 80 ], [ "null", 80 ] ] } } + } + }, + { + "type": "mapgen", + "method": "json", + "om_terrain": "mine_entrance_roof", + "object": { + "rows": [ + " ", + " ", + " ", + "Ю--------------------| ", + "|....................| ", + "|....................| ", + "|....................| ", + "|....................| ", + "|....................| ", + "|--------------------| ", + " ", + "|-----------| ", + "|...........| |------Ю", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|...........| |......|", + "|-----------Ю |------|" + ], + "terrain": { " ": "t_open_air", "|": "t_gutter_north", "-": "t_gutter_west", "Ю": "t_gutter_drop", ".": "t_flat_roof" } + } + }, + { + "type": "mapgen", + "method": "json", + "nested_mapgen_id": "mechanical_fluid", + "object": { + "mapgensize": [ 1, 1 ], + "place_fields": [ { "field": "fd_mechanical_fluid", "x": 0, "y": 0, "intensity": 1, "age": 10 } ] + } + }, + { + "type": "mapgen", + "method": "json", + "nested_mapgen_id": "gasoline_diesel_motor_oil", + "object": { + "mapgensize": [ 1, 1 ], + "place_liquids": [ + { "liquid": "gasoline", "x": 0, "y": 0, "chance": 20 }, + { "liquid": "diesel", "x": 0, "y": 0, "chance": 20 }, + { "liquid": "motor_oil", "x": 0, "y": 0, "chance": 20 } + ] + } + } +] diff --git a/data/json/mapgen/mine/mine_shaft.json b/data/json/mapgen/mine/mine_shaft.json new file mode 100644 index 0000000000000..674b1d3d59031 --- /dev/null +++ b/data/json/mapgen/mine/mine_shaft.json @@ -0,0 +1,88 @@ +[ + { + "type": "mapgen", + "method": "json", + "om_terrain": "mine_shaft_middle", + "object": { + "fill_ter": "t_rock", + "rows": [ + " <# ", + " # ", + " # ", + " # ", + " # ", + " # ", + " # ", + " # ", + " # ", + " # ", + " # ", + " # ", + " # ", + " ....#># ", + " ....### ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ], + "terrain": { "<": "t_ladder_up", ">": "t_ladder_down", "#": "t_grate", ".": "t_hole" } + } + }, + { + "type": "mapgen", + "method": "json", + "om_terrain": "mine_shaft_lower", + "object": { + "fill_ter": "t_rock_floor", + "rows": [ + "###### ## ########", + "####### ##########", + "######## ##########", + "######## ########", + " ###### #########", + " ## ##########", + "# ########## ", + " ###### ######### ", + "######## #### #", + "###### ", + "###### ######", + "##### ######", + "### |------| ######", + "# |!@@..<|-| ###", + " |.@@....S| ", + "### |---....S| #", + " +.......S| ", + " |.......S| ####", + "## |LLLLLL|-| ######", + "#### |------| ######", + "###### ######", + "####### ## #######", + "######## ## #######", + "######### # ########" + ], + "terrain": { + "<": "t_ladder_up", + "-": "t_wall", + "|": "t_wall", + ".": "t_thconc_floor", + "+": "t_door_metal_c", + "!": "t_elevator_control", + "@": "t_elevator", + "#": [ [ "t_rock", 4 ], [ "t_rock_floor", 1 ] ], + "L": "t_thconc_floor", + "S": "t_thconc_floor" + }, + "furniture": { "L": "f_locker", "S": "f_utility_shelf" }, + "items": { + "L": [ { "item": "clothing_work_set", "chance": 50 }, { "item": "hardware_clothing", "chance": 50 } ], + "S": { "item": "mine_equipment", "chance": 80 } + } + } + } +] diff --git a/data/json/monsterdrops/zombie_technician.json b/data/json/monsterdrops/zombie_technician.json index 08f86d38970f2..4b460cefd2293 100644 --- a/data/json/monsterdrops/zombie_technician.json +++ b/data/json/monsterdrops/zombie_technician.json @@ -13,5 +13,29 @@ { "group": "supplies_electronics", "prob": 50 }, { "item": "id_industrial", "prob": 20 } ] + }, + { + "id": "mon_zombie_miner_death_drops", + "type": "item_group", + "subtype": "collection", + "entries": [ + { "group": "clothing_work_boots", "damage": [ 1, 4 ] }, + { "group": "clothing_work_glasses", "prob": 60, "damage": [ 1, 4 ] }, + { "group": "clothing_work_gloves", "prob": 75, "damage": [ 1, 4 ] }, + { "group": "clothing_work_mask", "prob": 40, "damage": [ 1, 4 ] }, + { "item": "ear_plugs", "prob": 15, "damage": [ 1, 4 ] }, + { "item": "tool_belt", "prob": 25, "damage": [ 1, 4 ] }, + { + "distribution": [ + { + "collection": [ { "group": "clothing_work_pants", "damage": [ 1, 4 ] }, { "group": "clothing_work_torso", "damage": [ 1, 4 ] } ], + "prob": 75 + }, + { "item": "jumpsuit", "prob": 25, "damage": [ 1, 4 ] } + ] + }, + { "group": "underwear", "damage": [ 1, 4 ] }, + { "item": "miner_hat", "prob": 90, "damage": [ 1, 4 ] } + ] } ] diff --git a/data/json/monsters/zed_misc.json b/data/json/monsters/zed_misc.json index d6290e4a8882b..7303d05206aa1 100644 --- a/data/json/monsters/zed_misc.json +++ b/data/json/monsters/zed_misc.json @@ -1313,6 +1313,41 @@ "RANGED_ATTACKER" ] }, + { + "id": "mon_zombie_miner", + "type": "MONSTER", + "name": { "str": "zombie miner" }, + "description": "This zombie's face, hands, work clothes, and miner's helmet are fully covered with stains of coal dust.", + "default_faction": "zombie", + "looks_like": "mon_zombie_technician", + "bodytype": "human", + "species": [ "ZOMBIE", "HUMAN" ], + "diff": 2, + "volume": "62500 ml", + "weight": "81500 g", + "hp": 85, + "speed": 75, + "material": [ "flesh" ], + "symbol": "Z", + "color": "i_light_cyan", + "aggression": 70, + "morale": 100, + "melee_skill": 5, + "melee_dice": 2, + "melee_dice_sides": 3, + "melee_cut": 0, + "dodge": 1, + "armor_bash": 2, + "armor_cut": 2, + "armor_bullet": 2, + "vision_day": 15, + "vision_night": 2, + "harvest": "zombie", + "special_attacks": [ { "type": "bite", "cooldown": 20 } ], + "death_drops": "mon_zombie_miner_death_drops", + "death_function": [ "NORMAL" ], + "flags": [ "SEES", "HEARS", "SMELLS", "WARM", "BASHES", "GROUP_BASH", "POISON", "NO_BREATHE", "REVIVES", "FILTHY" ] + }, { "id": "mon_zombie_thorny", "type": "MONSTER", diff --git a/data/json/obsolete_terrains.json b/data/json/obsolete_terrains.json index 3bd39eb0b7947..9d6f430d64b54 100644 --- a/data/json/obsolete_terrains.json +++ b/data/json/obsolete_terrains.json @@ -23,7 +23,9 @@ "office_tower_1_entrance", "office_tower_1", "office_tower_b_entrance", - "office_tower_b" + "office_tower_b", + "mine_entrance", + "mine_shaft" ] } ] diff --git a/data/json/overmap/overmap_special/specials.json b/data/json/overmap/overmap_special/specials.json index a224570fb4db6..845aed0757c17 100644 --- a/data/json/overmap/overmap_special/specials.json +++ b/data/json/overmap/overmap_special/specials.json @@ -1126,7 +1126,13 @@ { "type": "overmap_special", "id": "Mine Entrance", - "overmaps": [ { "point": [ 0, 0, 0 ], "overmap": "s_lot_north" }, { "point": [ 0, 1, 0 ], "overmap": "mine_entrance" } ], + "overmaps": [ + { "point": [ 0, 0, 0 ], "overmap": "s_lot_north" }, + { "point": [ 0, 1, 0 ], "overmap": "mine_entrance_north" }, + { "point": [ 0, 1, 1 ], "overmap": "mine_entrance_roof_north" }, + { "point": [ 0, 1, -1 ], "overmap": "mine_shaft_middle_north" }, + { "point": [ 0, 1, -2 ], "overmap": "mine_shaft_lower_north" } + ], "connections": [ { "point": [ 0, -1, 0 ], "terrain": "road", "connection": "local_road", "from": [ 0, 0, 0 ] } ], "locations": [ "wilderness" ], "city_distance": [ 10, 40 ], diff --git a/data/json/overmap/overmap_terrain/overmap_terrain_hardcoded.json b/data/json/overmap/overmap_terrain/overmap_terrain_hardcoded.json index aab627c0704bc..5c36476c5a420 100644 --- a/data/json/overmap/overmap_terrain/overmap_terrain_hardcoded.json +++ b/data/json/overmap/overmap_terrain/overmap_terrain_hardcoded.json @@ -103,24 +103,6 @@ "see_cost": 5, "flags": [ "KNOWN_DOWN", "NO_ROTATE" ] }, - { - "type": "overmap_terrain", - "id": "mine_entrance", - "name": "mine entrance", - "sym": "M", - "color": "magenta", - "see_cost": 5, - "flags": [ "KNOWN_DOWN", "NO_ROTATE" ] - }, - { - "type": "overmap_terrain", - "id": "mine_shaft", - "name": "mine shaft", - "sym": "O", - "color": "dark_gray", - "see_cost": 5, - "flags": [ "KNOWN_UP", "KNOWN_DOWN", "NO_ROTATE" ] - }, { "type": "overmap_terrain", "id": "mine", diff --git a/data/json/overmap/overmap_terrain/overmap_terrain_industrial.json b/data/json/overmap/overmap_terrain/overmap_terrain_industrial.json index 0485bde2cc4ff..805072815c9a4 100644 --- a/data/json/overmap/overmap_terrain/overmap_terrain_industrial.json +++ b/data/json/overmap/overmap_terrain/overmap_terrain_industrial.json @@ -357,5 +357,41 @@ "see_cost": 5, "extras": "build", "mondensity": 2 + }, + { + "type": "overmap_terrain", + "id": "mine_entrance", + "name": "mine entrance", + "sym": "M", + "color": "magenta", + "see_cost": 5, + "flags": [ "KNOWN_DOWN" ] + }, + { + "type": "overmap_terrain", + "id": "mine_entrance_roof", + "name": "mine entrance roof", + "sym": "M", + "color": "magenta", + "see_cost": 5, + "flags": [ "KNOWN_DOWN" ] + }, + { + "type": "overmap_terrain", + "id": "mine_shaft_middle", + "name": "mine shaft", + "sym": "O", + "color": "dark_gray", + "see_cost": 5, + "flags": [ "KNOWN_UP", "KNOWN_DOWN" ] + }, + { + "type": "overmap_terrain", + "id": "mine_shaft_lower", + "name": "mine shaft", + "sym": "O", + "color": "dark_gray", + "see_cost": 5, + "flags": [ "KNOWN_UP" ] } ] diff --git a/data/mods/Graphical_Overmap/go_overmap_terrain_hardcoded.json b/data/mods/Graphical_Overmap/go_overmap_terrain_hardcoded.json index bfad7b7e1e650..cabc893f2281c 100644 --- a/data/mods/Graphical_Overmap/go_overmap_terrain_hardcoded.json +++ b/data/mods/Graphical_Overmap/go_overmap_terrain_hardcoded.json @@ -73,8 +73,20 @@ }, { "type": "overmap_terrain", - "id": "mine_shaft", - "copy-from": "mine_shaft", + "id": "mine_entrance_roof", + "copy-from": "mine_entrance_roof", + "sym": "\u00D3" + }, + { + "type": "overmap_terrain", + "id": "mine_shaft_middle", + "copy-from": "mine_shaft_middle", + "sym": "\u00D3" + }, + { + "type": "overmap_terrain", + "id": "mine_shaft_lower", + "copy-from": "mine_shaft_lower", "sym": "\u00D3" }, { diff --git a/data/mods/alt_map_key/overmap_terrain.json b/data/mods/alt_map_key/overmap_terrain.json index 0d60bd267ba3c..b36f4871df532 100644 --- a/data/mods/alt_map_key/overmap_terrain.json +++ b/data/mods/alt_map_key/overmap_terrain.json @@ -1836,11 +1836,18 @@ }, { "type": "overmap_terrain", - "id": "mine_shaft", - "copy-from": "mine_shaft", - "name": "mine shaft", - "sym": "m", - "color": "i_black" + "id": "mine_entrance_roof", + "copy-from": "mine_entrance_roof" + }, + { + "type": "overmap_terrain", + "id": "mine_shaft_middle", + "copy-from": "mine_shaft_middle" + }, + { + "type": "overmap_terrain", + "id": "mine_shaft_lower", + "copy-from": "mine_shaft_lower" }, { "type": "overmap_terrain", diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 87be7a15af895..f71fed4becd0e 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -103,8 +103,6 @@ static const trait_id trait_NPC_STATIC_NPC( "NPC_STATIC_NPC" ); static constexpr int MON_RADIUS = 3; static void science_room( map *m, const point &p1, const point &p2, int z, int rotate ); -static void build_mine_room( room_type type, const point &p1, const point &p2, - const mapgendata &dat ); // (x,y,z) are absolute coordinates of a submap // x%2 and y%2 must be 0! @@ -4254,48 +4252,7 @@ void map::draw_temple( const mapgendata &dat ) void map::draw_mine( mapgendata &dat ) { const oter_id &terrain_type = dat.terrain_type(); - if( terrain_type == "mine_entrance" ) { - dat.fill_groundcover(); - int tries = 0; - bool build_shaft = true; - do { - point p1( rng( 1, 2 * SEEX - 10 ), rng( 1, 2 * SEEY - 10 ) ); - point p2( p1 + point( rng( 4, 9 ), rng( 4, 9 ) ) ); - if( build_shaft ) { - build_mine_room( room_mine_shaft, p1, p2, dat ); - build_shaft = false; - } else { - bool okay = true; - for( int x = p1.x - 1; x <= p2.x + 1 && okay; x++ ) { - for( int y = p1.y - 1; y <= p2.y + 1 && okay; y++ ) { - okay = dat.is_groundcover( ter( point( x, y ) ) ); - } - } - if( okay ) { - room_type type = static_cast( rng( room_mine_office, room_mine_housing ) ); - build_mine_room( type, p1, p2, dat ); - tries = 0; - } else { - tries++; - } - } - } while( tries < 5 ); - int ladderx = rng( 0, EAST_EDGE ), laddery = rng( 0, SOUTH_EDGE ); - while( !dat.is_groundcover( ter( point( ladderx, laddery ) ) ) ) { - ladderx = rng( 0, EAST_EDGE ); - laddery = rng( 0, SOUTH_EDGE ); - } - ter_set( point( ladderx, laddery ), t_manhole_cover ); - } else if( terrain_type == "mine_shaft" ) { - // Not intended to actually be inhabited! - fill_background( this, t_rock ); - square( this, t_hole, point( SEEX - 3, SEEY - 3 ), point( SEEX + 2, SEEY + 2 ) ); - line( this, t_grate, point( SEEX - 3, SEEY - 4 ), point( SEEX + 2, SEEY - 4 ) ); - ter_set( point( SEEX - 3, SEEY - 5 ), t_ladder_up ); - ter_set( point( SEEX + 2, SEEY - 5 ), t_ladder_down ); - rotate( rng( 0, 3 ) ); - } else if( terrain_type == "mine" || - terrain_type == "mine_down" ) { + if( terrain_type == "mine" || terrain_type == "mine_down" ) { if( is_ot_match( "mine", dat.north(), ot_match_type::prefix ) ) { dat.n_fac = ( one_in( 10 ) ? 0 : -2 ); } else { @@ -4329,140 +4286,117 @@ void map::draw_mine( mapgendata &dat ) } } - if( dat.above() == "mine_shaft" ) { // We need the entrance room - square( this, t_floor, point( 10, 10 ), point( 15, 15 ) ); - line( this, t_wall, point( 9, 9 ), point( 16, 9 ) ); - line( this, t_wall, point( 9, 16 ), point( 16, 16 ) ); - line( this, t_wall, point( 9, 10 ), point( 9, 15 ) ); - line( this, t_wall, point( 16, 10 ), point( 16, 15 ) ); - line( this, t_wall, point( 10, 11 ), point( 12, 11 ) ); - ter_set( point( 10, 10 ), t_elevator_control ); - ter_set( point( 11, 10 ), t_elevator ); - ter_set( point( 10, 12 ), t_ladder_up ); - line_furn( this, f_counter, point( 10, 15 ), point( 15, 15 ) ); - place_items( item_group_id( "mine_equipment" ), 86, point( 10, 15 ), point( 15, 15 ), - false, calendar::start_of_cataclysm ); - if( one_in( 2 ) ) { - ter_set( point( 9, 12 ), t_door_c ); - } else { - ter_set( point( 16, 12 ), t_door_c ); - } - - } else { // Not an entrance; maybe some hazards! - switch( rng( 0, 6 ) ) { - case 0: - break; // Nothing! Lucky! + // Not an entrance; maybe some hazards! + switch( rng( 0, 6 ) ) { + case 0: + break; // Nothing! Lucky! - case 1: { // Toxic gas - int cx = rng( 9, 14 ); - int cy = rng( 9, 14 ); - ter_set( point( cx, cy ), t_rock ); - add_field( {cx, cy, abs_sub.z}, fd_gas_vent, 2 ); - } - break; + case 1: { // Toxic gas + point gas_vent_location( rng( 9, 14 ), rng( 9, 14 ) ); + ter_set( point( gas_vent_location ), t_rock ); + add_field( { gas_vent_location, abs_sub.z}, fd_gas_vent, 2 ); + } + break; - case 2: { // Lava - int x1 = rng( 6, SEEX ); - int y1 = rng( 6, SEEY ); - int x2 = rng( SEEX + 1, SEEX * 2 - 7 ); - int y2 = rng( SEEY + 1, SEEY * 2 - 7 ); - int num = rng( 2, 4 ); - for( int i = 0; i < num; i++ ) { - int lx1 = x1 + rng( -1, 1 ), lx2 = x2 + rng( -1, 1 ), - ly1 = y1 + rng( -1, 1 ), ly2 = y2 + rng( -1, 1 ); - line( this, t_lava, point( lx1, ly1 ), point( lx2, ly2 ) ); - } + case 2: { // Lava + point start_location( rng( 6, SEEX ), rng( 6, SEEY ) ); + point end_location( rng( SEEX + 1, SEEX * 2 - 7 ), rng( SEEY + 1, SEEY * 2 - 7 ) ); + const int num = rng( 2, 4 ); + for( int i = 0; i < num; i++ ) { + int lx1 = start_location.x + rng( -1, 1 ), lx2 = end_location.x + rng( -1, 1 ), + ly1 = start_location.y + rng( -1, 1 ), ly2 = end_location.y + rng( -1, 1 ); + line( this, t_lava, point( lx1, ly1 ), point( lx2, ly2 ) ); } - break; + } + break; - case 3: { // Wrecked equipment - int x = rng( 9, 14 ); - int y = rng( 9, 14 ); - for( int i = x - 3; i < x + 3; i++ ) { - for( int j = y - 3; j < y + 3; j++ ) { - if( !one_in( 4 ) ) { - make_rubble( tripoint( i, j, abs_sub.z ), f_wreckage, true ); - } + case 3: { // Wrecked equipment + point wreck_location( rng( 9, 14 ), rng( 9, 14 ) ); + for( int i = wreck_location.x - 3; i < wreck_location.x + 3; i++ ) { + for( int j = wreck_location.y - 3; j < wreck_location.y + 3; j++ ) { + if( !one_in( 4 ) ) { + make_rubble( tripoint( i, j, abs_sub.z ), f_wreckage, true ); } } - place_items( item_group_id( "wreckage" ), 70, point( x - 3, y - 3 ), - point( x + 2, y + 2 ), false, calendar::start_of_cataclysm ); } - break; + place_items( item_group_id( "wreckage" ), 70, wreck_location + point( -3, -3 ), + wreck_location + point( 2, 2 ), false, calendar::start_of_cataclysm ); + } + break; - case 4: { // Dead miners - int num_bodies = rng( 4, 8 ); - for( int i = 0; i < num_bodies; i++ ) { - if( const auto body = random_point( *this, [this]( const tripoint & p ) { - return move_cost( p ) == 2; - } ) ) { - add_item( *body, item::make_corpse() ); - place_items( item_group_id( "mine_equipment" ), 60, *body, *body, - false, calendar::start_of_cataclysm ); - } + case 4: { // Dead miners + const int num_bodies = rng( 4, 8 ); + for( int i = 0; i < num_bodies; i++ ) { + if( const auto body = random_point( *this, [this]( const tripoint & p ) { + return move_cost( p ) == 2; + } ) ) { + add_item( *body, item::make_corpse() ); + place_items( item_group_id( "mine_equipment" ), 60, *body, *body, + false, calendar::start_of_cataclysm ); } } - break; + } + break; - case 5: { // Dark worm! - int num_worms = rng( 1, 5 ); - for( int i = 0; i < num_worms; i++ ) { - std::vector sides; - if( dat.n_fac == 6 ) { - sides.push_back( direction::NORTH ); - } - if( dat.e_fac == 6 ) { - sides.push_back( direction::EAST ); - } - if( dat.s_fac == 6 ) { - sides.push_back( direction::SOUTH ); - } - if( dat.w_fac == 6 ) { - sides.push_back( direction::WEST ); - } - if( sides.empty() ) { - place_spawns( GROUP_DARK_WYRM, 1, point( SEEX, SEEY ), point( SEEX, SEEY ), 1, true ); - i = num_worms; - } else { - point p; - switch( random_entry( sides ) ) { - case direction::NORTH: - p = point( rng( 1, SEEX * 2 - 2 ), rng( 1, 5 ) ); - break; - case direction::EAST: - p = point( SEEX * 2 - rng( 2, 6 ), rng( 1, SEEY * 2 - 2 ) ); - break; - case direction::SOUTH: - p = point( rng( 1, SEEX * 2 - 2 ), SEEY * 2 - rng( 2, 6 ) ); - break; - case direction::WEST: - p = point( rng( 1, 5 ), rng( 1, SEEY * 2 - 2 ) ); - break; - default: - break; - } - ter_set( p, t_rock_floor ); - place_spawns( GROUP_DARK_WYRM, 1, p, p, 1, true ); + case 5: { // Dark worm! + const int num_worms = rng( 1, 5 ); + for( int i = 0; i < num_worms; i++ ) { + std::vector sides; + if( dat.n_fac == 6 ) { + sides.push_back( direction::NORTH ); + } + if( dat.e_fac == 6 ) { + sides.push_back( direction::EAST ); + } + if( dat.s_fac == 6 ) { + sides.push_back( direction::SOUTH ); + } + if( dat.w_fac == 6 ) { + sides.push_back( direction::WEST ); + } + if( sides.empty() ) { + place_spawns( GROUP_DARK_WYRM, 1, point( SEEX, SEEY ), point( SEEX, SEEY ), 1, true ); + i = num_worms; + } else { + point p; + switch( random_entry( sides ) ) { + case direction::NORTH: + p = point( rng( 1, SEEX * 2 - 2 ), rng( 1, 5 ) ); + break; + case direction::EAST: + p = point( SEEX * 2 - rng( 2, 6 ), rng( 1, SEEY * 2 - 2 ) ); + break; + case direction::SOUTH: + p = point( rng( 1, SEEX * 2 - 2 ), SEEY * 2 - rng( 2, 6 ) ); + break; + case direction::WEST: + p = point( rng( 1, 5 ), rng( 1, SEEY * 2 - 2 ) ); + break; + default: + break; } + ter_set( p, t_rock_floor ); + place_spawns( GROUP_DARK_WYRM, 1, p, p, 1, true ); } } - break; + } + break; - case 6: { // Spiral - int orx = rng( SEEX - 4, SEEX ), ory = rng( SEEY - 4, SEEY ); - line( this, t_rock, point( orx, ory ), point( orx + 5, ory ) ); - line( this, t_rock, point( orx + 5, ory ), point( orx + 5, ory + 5 ) ); - line( this, t_rock, point( orx + 1, ory + 5 ), point( orx + 5, ory + 5 ) ); - line( this, t_rock, point( orx + 1, ory + 2 ), point( orx + 1, ory + 4 ) ); - line( this, t_rock, point( orx + 1, ory + 2 ), point( orx + 3, ory + 2 ) ); - ter_set( point( orx + 3, ory + 3 ), t_rock ); - add_item( point( orx + 2, ory + 3 ), item::make_corpse() ); - place_items( item_group_id( "mine_equipment" ), 60, point( orx + 2, ory + 3 ), - point( orx + 2, ory + 3 ), false, calendar::start_of_cataclysm ); - } - break; + case 6: { // Spiral + const int orx = rng( SEEX - 4, SEEX ), ory = rng( SEEY - 4, SEEY ); + line( this, t_rock, point( orx, ory ), point( orx + 5, ory ) ); + line( this, t_rock, point( orx + 5, ory ), point( orx + 5, ory + 5 ) ); + line( this, t_rock, point( orx + 1, ory + 5 ), point( orx + 5, ory + 5 ) ); + line( this, t_rock, point( orx + 1, ory + 2 ), point( orx + 1, ory + 4 ) ); + line( this, t_rock, point( orx + 1, ory + 2 ), point( orx + 3, ory + 2 ) ); + ter_set( point( orx + 3, ory + 3 ), t_rock ); + add_item( point( orx + 2, ory + 3 ), item::make_corpse() ); + place_items( item_group_id( "mine_equipment" ), 60, point( orx + 2, ory + 3 ), + point( orx + 2, ory + 3 ), false, calendar::start_of_cataclysm ); } + break; } + if( terrain_type == "mine_down" ) { // Don't forget to build a slope down! std::vector open; if( dat.n_fac == 4 ) { @@ -4634,14 +4568,14 @@ void map::draw_mine( mapgendata &dat ) computer *tmpcomp = nullptr; switch( rn ) { case 1: { // Wyrms - int x = rng( SEEX, SEEX + 1 ), y = rng( SEEY, SEEY + 1 ); + const int x = rng( SEEX, SEEX + 1 ), y = rng( SEEY, SEEY + 1 ); ter_set( point( x, y ), t_pedestal_wyrm ); spawn_item( point( x, y ), "petrified_eye" ); } break; // That's it! game::examine handles the pedestal/wyrm spawns case 2: { // The Thing dog - int num_bodies = rng( 4, 8 ); + const int num_bodies = rng( 4, 8 ); for( int i = 0; i < num_bodies; i++ ) { int x = rng( 4, SEEX * 2 - 5 ); int y = rng( 4, SEEX * 2 - 5 ); @@ -6126,191 +6060,6 @@ void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) } } -void build_mine_room( room_type type, const point &p1, const point &p2, const mapgendata &dat ) -{ - map *const m = &dat.m; - std::vector possibilities; - point mid( static_cast( ( p1.x + p2.x ) / 2 ), static_cast( ( p1.y + p2.y ) / 2 ) ); - if( p2.x < SEEX ) { - possibilities.push_back( direction::EAST ); - } - if( p1.x > SEEX + 1 ) { - possibilities.push_back( direction::WEST ); - } - if( p1.y > SEEY + 1 ) { - possibilities.push_back( direction::NORTH ); - } - if( p2.y < SEEY ) { - possibilities.push_back( direction::SOUTH ); - } - - if( possibilities.empty() ) { // We're in the middle of the map! - if( mid.x <= SEEX ) { - possibilities.push_back( direction::EAST ); - } else { - possibilities.push_back( direction::WEST ); - } - if( mid.y <= SEEY ) { - possibilities.push_back( direction::SOUTH ); - } else { - possibilities.push_back( direction::NORTH ); - } - } - - const direction door_side = random_entry( possibilities ); - point door_point; - switch( door_side ) { - case direction::NORTH: - door_point.x = mid.x; - door_point.y = p1.y; - break; - case direction::EAST: - door_point.x = p2.x; - door_point.y = mid.y; - break; - case direction::SOUTH: - door_point.x = mid.x; - door_point.y = p2.y; - break; - case direction::WEST: - door_point.x = p1.x; - door_point.y = mid.y; - break; - default: - break; - } - square( m, t_floor, p1, p2 ); - line( m, t_wall, p1, point( p2.x, p1.y ) ); - line( m, t_wall, point( p1.x, p2.y ), p2 ); - line( m, t_wall, p1 + point_south, point( p1.x, p2.y - 1 ) ); - line( m, t_wall, point( p2.x, p1.y + 1 ), p2 + point_north ); - // Main build switch! - switch( type ) { - case room_mine_shaft: { - m->furn_set( p1 + point_south_east, furn_str_id( "f_console" ) ); - line( m, t_wall, point( p2.x - 2, p1.y + 2 ), point( p2.x - 1, p1.y + 2 ) ); - m->ter_set( point( p2.x - 2, p1.y + 1 ), t_elevator ); - m->ter_set( point( p2.x - 1, p1.y + 1 ), t_elevator_control_off ); - computer *tmpcomp = m->add_computer( p1 + tripoint( 1, 1, m->get_abs_sub().z ), - _( "NEPowerOS" ), 2 ); - tmpcomp->add_option( _( "Divert power to elevator" ), COMPACT_ELEVATOR_ON, 0 ); - tmpcomp->add_failure( COMPFAIL_ALARM ); - } - break; - - case room_mine_office: - line_furn( m, f_counter, point( mid.x, p1.y + 2 ), point( mid.x, p2.y - 2 ) ); - line( m, t_window, point( mid.x - 1, p1.y ), point( mid.x + 1, p1.y ) ); - line( m, t_window, point( mid.x - 1, p2.y ), point( mid.x + 1, p2.y ) ); - line( m, t_window, point( p1.x, mid.y - 1 ), point( p1.x, mid.y + 1 ) ); - line( m, t_window, point( p2.x, mid.y - 1 ), point( p2.x, mid.y + 1 ) ); - m->place_items( item_group_id( "office" ), 80, p1 + point_south_east, - p2 + point_north_west, false, calendar::start_of_cataclysm ); - break; - - case room_mine_storage: - m->place_items( item_group_id( "mine_storage" ), 85, p1 + point( 2, 2 ), - p2 + point( -2, -2 ), false, calendar::start_of_cataclysm ); - break; - - case room_mine_fuel: { - int spacing = rng( 2, 4 ); - if( door_side == direction::NORTH || door_side == direction::SOUTH ) { - int y = ( door_side == direction::NORTH ? p1.y + 2 : p2.y - 2 ); - for( int x = p1.x + 1; x <= p2.x - 1; x += spacing ) { - m->place_gas_pump( point( x, y ), rng( 10000, 50000 ) ); - } - } else { - int x = ( door_side == direction::EAST ? p2.x - 2 : p1.x + 2 ); - for( int y = p1.y + 1; y <= p2.y - 1; y += spacing ) { - m->place_gas_pump( point( x, y ), rng( 10000, 50000 ) ); - } - } - } - break; - - case room_mine_housing: - if( door_side == direction::NORTH || door_side == direction::SOUTH ) { - for( int y = p1.y + 2; y <= p2.y - 2; y += 2 ) { - m->ter_set( point( p1.x, y ), t_window ); - m->furn_set( point( p1.x + 1, y ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( p1.x + 1, y ), - point( p1.x + 1, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( p1.x + 2, y ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( p1.x + 2, y ), - point( p1.x + 2, y ), false, calendar::start_of_cataclysm ); - m->ter_set( point( p2.x, y ), t_window ); - m->furn_set( point( p2.x - 1, y ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( p2.x - 1, y ), - point( p2.x - 1, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( p2.x - 2, y ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( p2.x - 2, y ), - point( p2.x - 2, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( p1.x + 1, y + 1 ), f_dresser ); - m->place_items( item_group_id( "dresser" ), 78, point( p1.x + 1, y + 1 ), - point( p1.x + 1, y + 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( p2.x - 1, y + 1 ), f_dresser ); - m->place_items( item_group_id( "dresser" ), 78, point( p2.x - 1, y + 1 ), - point( p2.x - 1, y + 1 ), false, calendar::start_of_cataclysm ); - } - } else { - for( int x = p1.x + 2; x <= p2.x - 2; x += 2 ) { - m->ter_set( point( x, p1.y ), t_window ); - m->furn_set( point( x, p1.y + 1 ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( x, p1.y + 1 ), - point( x, p1.y + 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x, p1.y + 2 ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( x, p1.y + 2 ), - point( x, p1.y + 2 ), false, calendar::start_of_cataclysm ); - m->ter_set( point( x, p2.y ), t_window ); - m->furn_set( point( x, p2.y - 1 ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( x, p2.y - 1 ), - point( x, p2.y - 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x, p2.y - 2 ), f_bed ); - m->place_items( item_group_id( "bed" ), 60, point( x, p2.y - 2 ), - point( x, p2.y - 2 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x + 1, p1.y + 1 ), f_dresser ); - m->place_items( item_group_id( "dresser" ), 78, point( x + 1, p1.y + 1 ), - point( x + 1, p1.y + 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x + 1, p2.y - 1 ), f_dresser ); - m->place_items( item_group_id( "dresser" ), 78, point( x + 1, p2.y - 1 ), - point( x + 1, p2.y - 1 ), false, calendar::start_of_cataclysm ); - } - } - m->place_items( item_group_id( "bedroom" ), 65, p1 + point_south_east, - p2 + point_north_west, false, calendar::start_of_cataclysm ); - break; - default: - //Suppress warnings - break; - } - - if( type == room_mine_fuel ) { // Fuel stations are open on one side - switch( door_side ) { - case direction::NORTH: - line( m, t_floor, p1, point( p2.x, p1.y ) ); - break; - case direction::EAST: - line( m, t_floor, point( p2.x, p1.y + 1 ), p2 + point_north ); - break; - case direction::SOUTH: - line( m, t_floor, point( p1.x, p2.y ), p2 ); - break; - case direction::WEST: - line( m, t_floor, p1 + point_south, point( p1.x, p2.y - 1 ) ); - break; - default: - break; - } - } else { - if( type == room_mine_storage ) { // Storage has a locked door - m->ter_set( door_point, t_door_locked ); - } else { - m->ter_set( door_point, t_door_c ); - } - } -} - void map::create_anomaly( const tripoint &cp, artifact_natural_property prop, bool create_rubble ) { // TODO: Z diff --git a/src/mapgen.h b/src/mapgen.h index 4dda960cc54bc..7767c4ddc683a 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -458,11 +458,6 @@ enum room_type { room_bedroom, room_backyard, room_study, - room_mine_shaft, - room_mine_office, - room_mine_storage, - room_mine_fuel, - room_mine_housing, room_split }; diff --git a/src/overmap.cpp b/src/overmap.cpp index 55b75bb19f8d5..bef724449325b 100644 --- a/src/overmap.cpp +++ b/src/overmap.cpp @@ -744,9 +744,7 @@ bool oter_t::is_hardcoded() const "looted_building", // pseudo-terrain "mine", "mine_down", - "mine_entrance", "mine_finale", - "mine_shaft", "office_tower_1", "office_tower_1_entrance", "office_tower_b", @@ -1513,7 +1511,6 @@ bool overmap::generate_sub( const int z ) std::vector central_lab_points; std::vector lab_train_points; std::vector central_lab_train_points; - std::vector shaft_points; std::vector mine_points; // These are so common that it's worth checking first as int. const oter_id skip_above[5] = { @@ -1583,10 +1580,10 @@ bool overmap::generate_sub( const int z ) ter_set( p, oter_id( "central_lab" ) ); } else if( is_ot_match( "hidden_lab_stairs", oter_above, ot_match_type::contains ) ) { lab_points.push_back( city( p.xy(), rng( 1, 5 + z ) ) ); - } else if( oter_above == "mine_entrance" ) { - shaft_points.push_back( p.xy() ); - } else if( oter_above == "mine_shaft" || - oter_above == "mine_down" ) { + } else if( is_ot_match( "mine_entrance", oter_ground, ot_match_type::type ) && z == -2 ) { + mine_points.push_back( city( ( p + tripoint_west ).xy(), rng( 6 + z, 10 + z ) ) ); + requires_sub = true; + } else if( oter_above == "mine_down" ) { ter_set( p, oter_id( "mine" ) ); mine_points.push_back( city( p.xy(), rng( 6 + z, 10 + z ) ) ); // technically not all finales need a sub level, @@ -1746,10 +1743,6 @@ bool overmap::generate_sub( const int z ) build_mine( tripoint_om_omt( i.pos, z ), i.size ); } - for( auto &i : shaft_points ) { - ter_set( tripoint_om_omt( i, z ), oter_id( "mine_shaft" ) ); - requires_sub = true; - } for( auto &i : ant_points ) { const tripoint_om_omt p_loc( i.pos, z ); if( ter( p_loc ) != "empty_rock" ) { diff --git a/src/savegame.cpp b/src/savegame.cpp index 941fc16a7f334..96a1b941acfd4 100644 --- a/src/savegame.cpp +++ b/src/savegame.cpp @@ -348,7 +348,7 @@ void overmap::convert_terrain( if( old == "fema" || old == "fema_entrance" || old == "fema_1_3" || old == "fema_2_1" || old == "fema_2_2" || old == "fema_2_3" || old == "fema_3_1" || old == "fema_3_2" || old == "fema_3_3" || - old == "s_lot" ) { + old == "s_lot" || old == "mine_entrance" ) { ter_set( pos, oter_id( old + "_north" ) ); } else if( old.compare( 0, 6, "bridge" ) == 0 ) { ter_set( pos, oter_id( old ) ); @@ -361,6 +361,8 @@ void overmap::convert_terrain( } } else if( old.compare( 0, 10, "mass_grave" ) == 0 ) { ter_set( pos, oter_id( "field" ) ); + } else if( old == "mine_shaft" ) { + ter_set( pos, oter_id( "mine_shaft_middle_north" ) ); } else if( old.compare( 0, 23, "office_tower_1_entrance" ) == 0 ) { ter_set( pos, oter_id( "office_tower_ne_north" ) ); ter_set( pos + point_west, oter_id( "office_tower_nw_north" ) );