From ecd199da5b4fafb29df83725999d3376168cd835 Mon Sep 17 00:00:00 2001 From: scarf Date: Sun, 17 Sep 2023 10:59:42 +0900 Subject: [PATCH] fix: elevators for aftershock reactors and hospitals (#3167) * refactor: use consistent names * fix: municipal reactor elevators not working * feat: enable elevators in hostpital Electronics should work since autodocs and centrifuges are already powered. --- data/json/mapgen/hospital.json | 2 +- .../maps/mapgen/municipal_microreactor.json | 16 ++++++++-------- src/iexamine_elevator.cpp | 9 +++------ src/point_rotate.cpp | 3 ++- src/point_rotate.h | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/data/json/mapgen/hospital.json b/data/json/mapgen/hospital.json index 46d72391eac6..f706ed72ff28 100644 --- a/data/json/mapgen/hospital.json +++ b/data/json/mapgen/hospital.json @@ -236,7 +236,7 @@ ";": "t_door_locked", "x": "t_wall_glass", "4": "t_sidewalk", - "5": "t_elevator_control_off" + "5": "t_elevator_control" }, "place_vehicles": [ { "vehicle": "helicopters", "x": 10, "y": 56, "chance": 80, "rotation": 270 } ] } diff --git a/data/mods/Aftershock/maps/mapgen/municipal_microreactor.json b/data/mods/Aftershock/maps/mapgen/municipal_microreactor.json index 1d3b30d7649c..da4821a94107 100644 --- a/data/mods/Aftershock/maps/mapgen/municipal_microreactor.json +++ b/data/mods/Aftershock/maps/mapgen/municipal_microreactor.json @@ -117,11 +117,11 @@ "#########-% -##########", "#########-% -##########", "######-----55-----------", - "######-**%% ****2**2 ", - "######-** M 2 2 ", - "######- M ---- ", - "######-*** ** ****-``- ", - "######-*** ** ****-``- ", + "######-**%% ****2***2 ", + "######-** M 2 2 ", + "######- M ----- ", + "######-*** ** ****-```- ", + "######-*** ** ****-```- ", "######------------------", "########################" ], @@ -224,9 +224,9 @@ "####- ^ 6-G55--l b l-#", "####--2----- 2 l-#", "####- -(22(-------#", - "####- d YYY 2eE-##", - "####- hd 2ee-##", - "####------------------##", + "####- d YYY 2eeE-#", + "####- hd 2eee-#", + "####-------------------#", "########################" ], "set": [ diff --git a/src/iexamine_elevator.cpp b/src/iexamine_elevator.cpp index 8996d3257313..34fefc1881c4 100644 --- a/src/iexamine_elevator.cpp +++ b/src/iexamine_elevator.cpp @@ -69,9 +69,9 @@ auto choose_floor( const tripoint &examp, const tripoint_abs_omt &this_omt, choice.title = _( "Please select destination floor" ); for( int z = OVERMAP_HEIGHT; z >= -OVERMAP_DEPTH; z-- ) { const tripoint_abs_omt that_omt{ this_omt.xy(), z }; - const int delta = get_rot_delta( this_omt, that_omt ); + const int turns = get_rot_turns( this_omt, that_omt ); const tripoint zp = - rotate_point_sm( { examp.xy(), z }, sm_orig, delta ); + rotate_point_sm( { examp.xy(), z }, sm_orig, turns ); if( here.ter( zp )->examine != &iexamine::elevator ) { continue; @@ -201,9 +201,6 @@ auto move_vehicles( const elevator_vehicles &vehs, const tripoint &sm_orig, int } // namespace -/** - * If underground, move 2 levels up else move 2 levels down. Stable movement between levels 0 and -2. - */ void iexamine::elevator( player &p, const tripoint &examp ) { map &here = get_map(); @@ -223,7 +220,7 @@ void iexamine::elevator( player &p, const tripoint &examp ) } const tripoint_abs_omt that_omt{ this_omt.xy(), movez }; - const int turns = get_rot_delta( this_omt, that_omt ); + const int turns = get_rot_turns( this_omt, that_omt ); const auto elevator_dest = elevator::dest( elevator_here, sm_orig, turns, movez ); const auto vehicles_dest = elevator::vehicles_on( elevator_dest ); diff --git a/src/point_rotate.cpp b/src/point_rotate.cpp index 590350aa6fba..5044e4f27f8f 100644 --- a/src/point_rotate.cpp +++ b/src/point_rotate.cpp @@ -30,7 +30,8 @@ auto rotate_point_sm( const tripoint &p, const tripoint &orig, int turns ) -> tr return tripoint{ rd + orig.xy() }; } -auto get_rot_delta( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int +/** @return The difference in rotation between two overmap terrain points. */ +auto get_rot_turns( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int { const auto this_dir = overmap_buffer.ter( there )->get_dir(); const auto that_dir = overmap_buffer.ter( here )->get_dir(); diff --git a/src/point_rotate.h b/src/point_rotate.h index a93706e806e0..ed2bfa603943 100644 --- a/src/point_rotate.h +++ b/src/point_rotate.h @@ -21,6 +21,6 @@ auto rotate( const tripoint &p, point dim, int turns ) -> tripoint; /** works like rotate but for submaps. */ auto rotate_point_sm( const tripoint &p, const tripoint &orig, int turns ) -> tripoint; -auto get_rot_delta( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int; +auto get_rot_turns( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int; #endif // CATA_SRC_POINT_ROTATE_H