From c0d3efca7c93aef61505bd9da2ebc35ebc5e3522 Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Fri, 21 Apr 2023 22:17:39 -0700 Subject: [PATCH] Die Rise: make both elevator direction lights active when elevator is locked --- scripts/zm/replaced/zm_highrise_elevators.gsc | 60 +++++++++++++++++-- .../zm/zm_highrise/zm_highrise_reimagined.gsc | 43 +++++++++++++ 2 files changed, 99 insertions(+), 4 deletions(-) diff --git a/scripts/zm/replaced/zm_highrise_elevators.gsc b/scripts/zm/replaced/zm_highrise_elevators.gsc index 7baab5fb..13e716af 100644 --- a/scripts/zm/replaced/zm_highrise_elevators.gsc +++ b/scripts/zm/replaced/zm_highrise_elevators.gsc @@ -177,9 +177,15 @@ elevator_think( elevator ) if ( dist > 0 ) { if ( elevator.body.origin[2] > floor_goal[2] ) - clientnotify( elevator.name + "_d" ); + { + elevator.dir = "_d"; + } else - clientnotify( elevator.name + "_u" ); + { + elevator.dir = "_u"; + } + + clientnotify( elevator.name + elevator.dir ); } if ( is_true( start_location ) ) @@ -223,9 +229,15 @@ elevator_think( elevator ) if ( dist > 0 ) { if ( elevator.body.origin[2] > floor_goal[2] ) - clientnotify( elevator.name + "_d" ); + { + elevator.dir = "_d"; + } else - clientnotify( elevator.name + "_u" ); + { + elevator.dir = "_u"; + } + + clientnotify( elevator.name + elevator.dir ); } } } @@ -254,6 +266,46 @@ elevator_think( elevator ) } } +predict_floor( elevator, next, speed ) +{ + next = elevator_next_floor( elevator, next, 1 ); + + if ( isdefined( elevator.floors["" + ( next + 1 )] ) ) + elevator.body.next_level = "" + ( next + 1 ); + else + { + start_location = 1; + elevator.body.next_level = "0"; + } + + floor_stop = elevator.floors[elevator.body.next_level]; + floor_goal = undefined; + cur_level_start_pos = elevator.floors[elevator.body.next_level].starting_position; + start_level_start_pos = elevator.floors[elevator.body.starting_floor].starting_position; + + if ( elevator.body.next_level == elevator.body.starting_floor || isdefined( cur_level_start_pos ) && isdefined( start_level_start_pos ) && cur_level_start_pos == start_level_start_pos ) + floor_goal = cur_level_start_pos; + else + floor_goal = floor_stop.origin; + + dist = distance( elevator.body.origin, floor_goal ); + time = dist / speed; + + if ( dist > 0 ) + { + if ( elevator.body.origin[2] > floor_goal[2] ) + { + elevator.dir = "_d"; + } + else + { + elevator.dir = "_u"; + } + + clientnotify( elevator.name + elevator.dir ); + } +} + elevator_initial_wait( elevator, minwait, maxwait, delaybeforeleaving ) { elevator.body endon( "forcego" ); diff --git a/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc b/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc index afa034b3..613df990 100644 --- a/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc +++ b/scripts/zm/zm_highrise/zm_highrise_reimagined.gsc @@ -203,6 +203,11 @@ elevator_call() trig thread watch_elevator_prompt(); trig thread watch_elevator_body_prompt(); } + + foreach (elevator in level.elevators) + { + elevator thread watch_elevator_lights(); + } } elevator_call_think() @@ -346,6 +351,44 @@ watch_elevator_body_prompt() } } +watch_elevator_lights() +{ + set = 1; + dir = "_d"; + + while ( 1 ) + { + if ( is_true( self.body.elevator_stop ) ) + { + if ( set ) + { + set = 0; + + dir = self.dir; + } + + clientnotify( self.name + dir ); + + if ( dir == "_d" ) + { + dir = "_u"; + } + else + { + dir = "_d"; + } + } + else if ( !set ) + { + set = 1; + + clientnotify( self.name + self.dir ); + } + + wait 0.05; + } +} + escape_pod_call() { trig = getent( "escape_pod_key_console_trigger", "targetname" );