Skip to content

Commit

Permalink
fix: elevators for aftershock reactors and hospitals (#3167)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
scarf005 authored Sep 17, 2023
1 parent 4e48081 commit ecd199d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion data/json/mapgen/hospital.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 } ]
}
Expand Down
16 changes: 8 additions & 8 deletions data/mods/Aftershock/maps/mapgen/municipal_microreactor.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@
"#########-% -##########",
"#########-% -##########",
"######-----55-----------",
"######-**%% ****2**2 ",
"######-** M 2 2 ",
"######- M ---- ",
"######-*** ** ****-``- ",
"######-*** ** ****-``- ",
"######-**%% ****2***2 ",
"######-** M 2 2 ",
"######- M ----- ",
"######-*** ** ****-```- ",
"######-*** ** ****-```- ",
"######------------------",
"########################"
],
Expand Down Expand Up @@ -224,9 +224,9 @@
"####- ^ 6-G55--l b l-#",
"####--2----- 2 l-#",
"####- -(22(-------#",
"####- d YYY 2eE-##",
"####- hd 2ee-##",
"####------------------##",
"####- d YYY 2eeE-#",
"####- hd 2eee-#",
"####-------------------#",
"########################"
],
"set": [
Expand Down
9 changes: 3 additions & 6 deletions src/iexamine_elevator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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 );
Expand Down
3 changes: 2 additions & 1 deletion src/point_rotate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/point_rotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ecd199d

Please sign in to comment.