From 4c71bedfec5238a311d7af51d29f2df6c227e71f Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Thu, 20 Apr 2023 16:16:58 -0700 Subject: [PATCH] Die Rise: fix elevator call during start location wait --- scripts/zm/replaced/zm_highrise_elevators.gsc | 5 +++ .../zm/zm_highrise/zm_highrise_reimagined.gsc | 38 +++++++++++++++---- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/scripts/zm/replaced/zm_highrise_elevators.gsc b/scripts/zm/replaced/zm_highrise_elevators.gsc index e47f9b7d..d40a6e9a 100644 --- a/scripts/zm/replaced/zm_highrise_elevators.gsc +++ b/scripts/zm/replaced/zm_highrise_elevators.gsc @@ -188,8 +188,13 @@ elevator_think( elevator ) if ( !skipinitialwait ) { + elevator.body.start_location_wait = 1; + + elevator.body notify( "startwait" ); event = elevator.body waittill_any_timeout( 3, "forcego" ); + elevator.body.start_location_wait = 0; + if ( event == "forcego" ) { next = elevator_next_floor( elevator, next, 0 ); diff --git a/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc b/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc index 4e100202..2bc83699 100644 --- a/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc +++ b/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc @@ -194,15 +194,15 @@ elevator_call_think() while ( 1 ) { - if ( !self.elevator.body.is_moving && self.elevator maps\mp\zm_highrise_elevators::elevator_is_on_floor( self.floor ) ) + if ( !self.elevator.body.is_moving && self.elevator maps\mp\zm_highrise_elevators::elevator_is_on_floor( self.floor ) && !is_true( self.elevator.body.start_location_wait ) ) { if ( !is_true( self.elevator.body.elevator_stop ) ) { - self sethintstring( "Hold ^3[{+activate}]^7 to lock the elevator" ); + self sethintstring( "Hold ^3[{+activate}]^7 to lock elevator" ); } else { - self sethintstring( "Hold ^3[{+activate}]^7 to unlock the elevator" ); + self sethintstring( "Hold ^3[{+activate}]^7 to unlock elevator" ); } } else @@ -221,7 +221,7 @@ elevator_call_think() self playsound( "zmb_elevator_ding" ); - if ( !self.elevator.body.is_moving && self.elevator maps\mp\zm_highrise_elevators::elevator_is_on_floor( self.floor ) ) + if ( !self.elevator.body.is_moving && self.elevator maps\mp\zm_highrise_elevators::elevator_is_on_floor( self.floor ) && !is_true( self.elevator.body.start_location_wait ) ) { if ( !is_true( self.elevator.body.elevator_stop ) ) { @@ -239,6 +239,11 @@ elevator_call_think() self sethintstring( "" ); self trigger_off(); + if ( self.elevator maps\mp\zm_highrise_elevators::elevator_is_on_floor( self.floor ) && !is_true( self.elevator.body.start_location_wait ) ) + { + return; + } + self.elevator.body.elevator_stop = 0; self.elevator.body.elevator_force_go = 1; self maps\mp\zm_highrise_buildables::onuseplantobject_elevatorkey( who ); @@ -264,7 +269,7 @@ watch_elevator_body_prompt() { while ( 1 ) { - msg = self.elevator.body waittill_any_return( "movedone", "forcego" ); + msg = self.elevator.body waittill_any_return( "movedone", "forcego", "startwait" ); if ( msg == "movedone" ) { @@ -276,17 +281,34 @@ watch_elevator_body_prompt() self.elevator.body.elevator_force_go = 0; self thread elevator_call_think(); } - else + else if ( msg == "forcego" ) { - while ( !is_true( self.elevator.body.is_moving ) ) + while ( !is_true( self.elevator.body.is_moving ) && !is_true( self.elevator.body.start_location_wait ) ) { wait 0.05; } - if ( !self.elevator maps\mp\zm_highrise_elevators::elevator_is_on_floor( self.floor ) ) + if ( is_true( self.elevator.body.start_location_wait ) ) { + while ( is_true( self.elevator.body.start_location_wait ) ) + { + wait 0.05; + } + + self.elevator.body.elevator_force_go = 0; self thread elevator_call_think(); } + else + { + if ( !self.elevator maps\mp\zm_highrise_elevators::elevator_is_on_floor( self.floor ) ) + { + self thread elevator_call_think(); + } + } + } + else + { + self thread elevator_call_think(); } } }