From f1dd7655d7a1113a85d45d719223861d2097326e Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Tue, 7 Mar 2023 10:40:02 -0800 Subject: [PATCH] Tranzit: allow sprinting and going prone on bus --- README.md | 1 + scripts/zm/replaced/zm_transit_bus.gsc | 148 ++++++++++++++++++ .../zm/zm_transit/zm_transit_reimagined.gsc | 2 + 3 files changed, 151 insertions(+) create mode 100644 scripts/zm/replaced/zm_transit_bus.gsc diff --git a/README.md b/README.md index 6ca97392..407750d4 100644 --- a/README.md +++ b/README.md @@ -365,6 +365,7 @@ ### Tranzit * Any door that requires a Turbine to open is automatically open whenever the power is on +* Players can sprint and go prone on the bus * Lava in starting area activates after the power is on * Lava destroys grenades instantly * Decreased brightness at Power Station diff --git a/scripts/zm/replaced/zm_transit_bus.gsc b/scripts/zm/replaced/zm_transit_bus.gsc new file mode 100644 index 00000000..67de88f3 --- /dev/null +++ b/scripts/zm/replaced/zm_transit_bus.gsc @@ -0,0 +1,148 @@ +#include common_scripts\utility; +#include maps\mp\_utility; +#include maps\mp\zombies\_zm_utility; +#include maps\mp\zombies\_zm_weapons; +#include maps\mp\zm_transit_utility; +#include maps\mp\zm_transit_automaton; +#include maps\mp\zm_transit_cling; +#include maps\mp\zm_transit_openings; +#include maps\mp\zombies\_zm_zonemgr; +#include maps\mp\zm_transit_ambush; +#include maps\mp\zombies\_zm; +#include maps\mp\zombies\_zm_spawner; +#include maps\mp\zombies\_zm_ai_basic; +#include maps\mp\zombies\_zm_equipment; +#include maps\mp\zombies\_zm_stats; +#include maps\mp\zombies\_zm_laststand; +#include maps\mp\zombies\_zm_powerups; +#include maps\mp\zombies\_zm_buildables; +#include maps\mp\zombies\_zm_weap_emp_bomb; +#include maps\mp\zm_transit_lava; +#include maps\mp\zombies\_zm_audio; +#include maps\mp\zm_transit_bus; + +busupdateplayers() +{ + level endon( "end_game" ); + + while ( true ) + { + self.numplayers = 0; + self.numplayerson = 0; + self.numplayersonroof = 0; + self.numplayersinsidebus = 0; + self.numplayersnear = 0; + self.numaliveplayersridingbus = 0; + self.frontworld = self localtoworldcoords( self.frontlocal ); + self.backworld = self localtoworldcoords( self.backlocal ); + self.bus_riders_alive = []; + + players = get_players(); + + foreach ( player in players ) + { + if ( !isalive( player ) ) + continue; + + self.numplayers++; + + if ( distance2d( player.origin, self.origin ) < 1700 ) + self.numplayersnear++; + + playerisinbus = 0; + mover = player getmoverent(); + + if ( isdefined( mover ) ) + { + if ( isdefined( mover.targetname ) ) + { + if ( mover.targetname == "the_bus" || mover.targetname == "bus_path_blocker" || mover.targetname == "hatch_clip" || mover.targetname == "ladder_mantle" ) + playerisinbus = 1; + } + + if ( isdefined( mover.equipname ) ) + { + if ( mover.equipname == "riotshield_zm" ) + { + if ( isdefined( mover.isonbus ) && mover.isonbus ) + playerisinbus = 1; + } + } + + if ( isdefined( mover.is_zombie ) && mover.is_zombie && ( isdefined( mover.isonbus ) && mover.isonbus ) ) + playerisinbus = 1; + } + + if ( playerisinbus ) + { + self.numplayerson++; + + if ( is_player_valid( player ) ) + { + self.numaliveplayersridingbus++; + self.bus_riders_alive[self.bus_riders_alive.size] = player; + } + } + + ground_ent = player getgroundent(); + + if ( player isonladder() ) + ground_ent = mover; + + if ( isdefined( ground_ent ) ) + { + if ( isdefined( ground_ent.is_zombie ) && ground_ent.is_zombie ) + player thread zombie_surf( ground_ent ); + else + { + if ( playerisinbus && !( isdefined( player.isonbus ) && player.isonbus ) ) + { + bbprint( "zombie_events", "category %s type %s round %d playername %s", "BUS", "player_enter", level.round_number, player.name ); + player thread bus_audio_interior_loop( self ); + player clientnotify( "OBS" ); + player setclientplayerpushamount( 0 ); + + if ( randomint( 100 ) > 80 && level.automaton.greeting_timer == 0 ) + { + thread automatonspeak( "convo", "player_enter" ); + level.automaton thread greeting_timer(); + } + } + + if ( !playerisinbus && ( isdefined( player.isonbus ) && player.isonbus ) ) + { + bbprint( "zombie_events", "category %s type %s round %d playername %s", "BUS", "player_exit", level.round_number, player.name ); + self.buyable_weapon setinvisibletoplayer( player ); + player setclientplayerpushamount( 1 ); + player notify( "left bus" ); + player clientnotify( "LBS" ); + + if ( randomint( 100 ) > 80 && level.automaton.greeting_timer == 0 ) + { + thread automatonspeak( "convo", "player_leave" ); + level.automaton thread greeting_timer(); + } + } + + player.isonbus = playerisinbus; + player.isonbusroof = player _entityisonroof(); + } + } + + if ( isdefined( player.isonbusroof ) && player.isonbusroof ) + { + self.buyable_weapon setinvisibletoplayer( player ); + self.numplayersonroof++; + } + else if ( isdefined( player.isonbus ) && player.isonbus ) + { + self.buyable_weapon setvisibletoplayer( player ); + self.numplayersinsidebus++; + } + + wait 0.05; + } + + wait 0.05; + } +} \ No newline at end of file diff --git a/scripts/zm/zm_transit/zm_transit_reimagined.gsc b/scripts/zm/zm_transit/zm_transit_reimagined.gsc index 211fdf90..7ddb3afb 100644 --- a/scripts/zm/zm_transit/zm_transit_reimagined.gsc +++ b/scripts/zm/zm_transit/zm_transit_reimagined.gsc @@ -5,6 +5,7 @@ #include scripts\zm\replaced\zm_transit; #include scripts\zm\replaced\zm_transit_gamemodes; #include scripts\zm\replaced\zm_transit_utility; +#include scripts\zm\replaced\zm_transit_bus; #include scripts\zm\replaced\_zm_weap_jetgun; #include scripts\zm\replaced\_zm_weap_emp_bomb; #include scripts\zm\replaced\_zm_equip_electrictrap; @@ -18,6 +19,7 @@ main() replaceFunc(maps\mp\zm_transit::lava_damage_depot, scripts\zm\replaced\zm_transit::lava_damage_depot); replaceFunc(maps\mp\zm_transit_gamemodes::init, scripts\zm\replaced\zm_transit_gamemodes::init); replaceFunc(maps\mp\zm_transit_utility::solo_tombstone_removal, scripts\zm\replaced\zm_transit_utility::solo_tombstone_removal); + replaceFunc(maps\mp\zm_transit_bus::busupdateplayers, scripts\zm\replaced\zm_transit_bus::busupdateplayers); replaceFunc(maps\mp\zombies\_zm_weap_jetgun::is_jetgun_firing, scripts\zm\replaced\_zm_weap_jetgun::is_jetgun_firing); replaceFunc(maps\mp\zombies\_zm_weap_jetgun::jetgun_check_enemies_in_range, scripts\zm\replaced\_zm_weap_jetgun::jetgun_check_enemies_in_range); replaceFunc(maps\mp\zombies\_zm_weap_jetgun::jetgun_grind_zombie, scripts\zm\replaced\_zm_weap_jetgun::jetgun_grind_zombie);