This commit is contained in:
Future committed 2023-04-13 17:30:38 +02:00
commit 013c6f3b4d
921 files changed
+337975

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\system_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace ability_gadgets;
function autoexec __init__sytem__() { system::register("ability_gadgets",&__init__,undefined,undefined); }
function __init__()
{
}
+109
View File
@@ -0,0 +1,109 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\hud_util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace ability_gadgets;
function autoexec __init__sytem__() { system::register("ability_gadgets",&__init__,undefined,undefined); }
function __init__()
{
callback::on_connect( &on_player_connect );
callback::on_spawned( &on_player_spawned );
}
function gadgets_print( str )
{
/#
if ( GetDvarInt( "scr_debug_gadgets" ) )
{
toprint = str;
PrintLn( self.playername + ": " + "GADGET: " + toprint );
}
#/
}
//---------------------------------------------------------
// power and gadget activation
function on_player_connect()
{
}
function SetFlickering( slot, length )
{
if ( !IsDefined( length ) )
{
length = 0;
}
self GadgetFlickering( slot, true, length );
}
function on_player_spawned()
{
}
function gadget_give_callback( ent, slot, weapon )
{
/# ent gadgets_print( "" + slot + " give cb" ); #/
ent ability_player::give_gadget( slot, weapon );
}
function gadget_take_callback( ent, slot, weapon )
{
/# ent gadgets_print( "" + slot + " take cb" ); #/
ent ability_player::take_gadget( slot, weapon );
}
function gadget_primed_callback( ent, slot, weapon )
{
/# ent gadgets_print( "" + slot + " primed cb" ); #/
ent ability_player::gadget_primed( slot, weapon );
}
function gadget_ready_callback( ent, slot, weapon )
{
/# ent gadgets_print( "" + slot + " ready cb" ); #/
ent ability_player::gadget_ready( slot, weapon );
}
function gadget_on_callback( ent, slot, weapon )
{
/# ent gadgets_print( "" + slot + " on cb" ); #/
if( IsDefined( level.BZMOnCyberComOnCallback ) ) level thread [[level.BZMOnCyberComOnCallback]](ent);;
ent ability_player::turn_gadget_on( slot, weapon );
}
function gadget_off_callback( ent, slot, weapon )
{
/# ent gadgets_print( "" + slot + " off cb" ); #/
ent ability_player::turn_gadget_off( slot, weapon );
}
function gadget_flicker_callback( ent, slot, weapon )
{
/# ent gadgets_print( "" + slot + " flicker cb" ); #/
ent ability_player::gadget_flicker( slot, weapon );
}
+65
View File
@@ -0,0 +1,65 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\weapons\replay_gun;
#using scripts\shared\system_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_gadgets;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\abilities\gadgets\_gadget_armor; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_speed_burst; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_camo; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_vision_pulse; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_hero_weapon; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_other; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_combat_efficiency; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_flashback; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_cleanse; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_system_overload; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_servo_shortout; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_exo_breakdown; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_surge; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_security_breach; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_iff_override; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_cacophany; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_es_strike; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_ravage_core; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_concussive_wave; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_overdrive; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_unstoppable_force; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_rapid_strike; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_sensory_overload; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_forced_malfunction; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_immolation; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_firefly_swarm; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_smokescreen; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_misdirection; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_mrpukey; // for loading purposes only - do not use from here
//#using scripts\shared\abilities\gadgets\_gadget_active_camo; // reusing optic_camo client script
#using scripts\shared\abilities\gadgets\_gadget_shock_field; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_resurrect; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_heat_wave; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_clone; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_roulette; // for loading purposes only - do not use from here
#using scripts\shared\abilities\gadgets\_gadget_thief; // for loading purposes only - do not use from here
Line truncated
#namespace ability_player;
function autoexec __init__sytem__() { system::register("ability_player",&__init__,undefined,undefined); }
function __init__()
{
// this makes sure we can turn off gadgets visionsets with a default one
// visionset_mgr::init_fog_vol_to_visionset_monitor( "default_night", 2 );
}
File diff suppressed because it is too large. Load diff
+16
View File
@@ -0,0 +1,16 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\system_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace ability_power;
function autoexec __init__sytem__() { system::register("ability_power",&__init__,undefined,undefined); }
function __init__()
{
}
+304
View File
@@ -0,0 +1,304 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\hud_util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\abilities\_ability_gadgets;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace ability_power;
function autoexec __init__sytem__() { system::register("ability_power",&__init__,undefined,undefined); }
function __init__()
{
callback::on_connect( &on_player_connect );
}
/#
function cpower_print( slot, str )
{
color = "^2";
toprint = color + "GADGET POWER: ^7" + str;
weaponName = "null";
if ( IsDefined( self._gadgets_player[slot] ) )
{
weaponName = self._gadgets_player[slot].name;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( toprint );
else
PrintLn( self.playername + ": " + weaponName + ": " + toprint );
}
#/
//---------------------------------------------------------
// power and gadget activation
function on_player_connect()
{
}
function power_is_hero_ability( gadget )
{
return gadget.gadget_type != 0;
}
function is_weapon_or_variant_same_as_gadget( weapon, gadget )
{
if ( weapon == gadget )
{
return true;
}
if ( isdefined( level.weaponLightningGun ) && gadget == level.weaponLightningGun )
{
if ( isdefined( level.weaponLightningGunArc ) && weapon == level.weaponLightningGunArc )
{
return true;
}
}
return false;
}
function power_gain_event_score( eAttacker, score, weapon, hero_restricted )
{
if( score > 0 )
{
for ( slot = 0; slot < 3; slot++ )
{
gadget = self._gadgets_player[slot];
if ( isdefined( gadget ) )
{
ignoreSelf = gadget.gadget_powerGainScoreIgnoreSelf;
if ( isdefined( weapon ) && ignoreSelf && is_weapon_or_variant_same_as_gadget( weapon, gadget ) )
{
continue;
}
ignoreWhenActive = gadget.gadget_powerGainScoreIgnoreWhenActive;
if ( ignoreWhenActive && self GadgetIsActive( slot ) )
{
continue;
}
if ( isdefined( hero_restricted ) && hero_restricted && power_is_hero_ability( gadget ) )
{
continue;
}
scoreFactor = gadget.gadget_powerGainScoreFactor;
if ( isdefined( self.gadgetThiefActive ) && self.gadgetThiefActive == true )
{
continue; // handled exclusively by gadget_thief
}
gametypeFactor = GetGametypeSetting( "scoreHeroPowerGainFactor" );
perkFactor = 1.0;
if ( self hasperk( "specialty_overcharge" ) )
{
perkFactor = GetDvarFloat( "gadgetPowerOverchargePerkScoreFactor" );
}
if ( scoreFactor > 0 && gametypeFactor > 0 )
{
gainToAdd = score * scoreFactor * gametypeFactor * perkFactor;
self power_gain_event( slot, eAttacker, gainToAdd, "score" );
}
}
}
}
}
function power_gain_event_damage_actor( eAttacker )
{
baseGain = 0.0;
if( baseGain > 0 )
{
for ( slot = 0; slot < 3; slot++ )
{
if ( IsDefined( self._gadgets_player[slot] ) )
{
self power_gain_event( slot, eAttacker, baseGain, "damaged actor" );
}
}
}
}
function power_gain_event_killed_actor( eAttacker, meansOfDeath )
{
baseGain = 5.0;
for ( slot = 0; slot < 3; slot++ )
{
if ( IsDefined( self._gadgets_player[slot] ) )
{
if ( meansOfDeath == "MOD_MELEE_ASSASSINATE" && self ability_util::gadget_is_camo_suit_on() )
{
if ( self._gadgets_player[slot].gadget_powertakedowngain > 0 )
{
source = "assassinate actor";
self power_gain_event( slot, eAttacker, self._gadgets_player[slot].gadget_powertakedowngain, source );
}
}
if ( self._gadgets_player[slot].gadget_powerreplenishfactor > 0 )
{
gainToAdd = baseGain * self._gadgets_player[slot].gadget_powerreplenishfactor;
if ( gainToAdd > 0 )
{
source = "killed actor";
self power_gain_event( slot, eAttacker, gainToAdd, source );
}
}
}
}
}
function power_gain_event( slot, eAttacker, val, source )
{
if ( !isdefined( self ) || !isalive( self ) )
{
return;
}
powerToAdd = val;
if ( powerToAdd > 0.1 || powerToAdd < -0.1 )
{
powerLeft = self GadgetPowerChange( slot, powerToAdd );
/#
self cpower_print( slot, "^2gain^3 " + powerToAdd + "^7 from ^3" + source + "^7, remaining " + powerLeft );
#/
}
}
function power_loss_event_took_damage( eAttacker, eInflictor, weapon, sMeansOfDeath, iDamage )
{
baseLoss = iDamage;
for ( slot = 0; slot < 3; slot++ )
{
if ( IsDefined( self._gadgets_player[slot] ) )
{
if ( self GadgetIsActive( slot ) )
{
powerLoss = baseLoss * self._gadgets_player[slot].gadget_powerOnLossOnDamage;
if ( powerLoss > 0 )
{
self power_loss_event( slot, eAttacker, powerLoss, "took damage with power on" );
}
if ( self._gadgets_player[slot].gadget_flickerOnDamage > 0 )
{
self ability_gadgets::SetFlickering( slot, self._gadgets_player[slot].gadget_flickerOnDamage );
}
}
else
{
powerLoss = baseLoss * self._gadgets_player[slot].gadget_powerOffLossOnDamage;
if ( powerLoss > 0 )
{
self power_loss_event( slot, eAttacker, powerLoss, "took damage" );
}
}
}
}
}
function power_loss_event( slot, eAttacker, val, source )
{
powerToRemove = -val;
if ( powerToRemove > 0.1 || powerToRemove < -0.1 )
{
powerLeft = self GadgetPowerChange( slot, powerToRemove );
/#
self cpower_print( slot, "^1loss^3 " + powerToRemove + "^7 from ^3" + source + "^7, remaining " + powerLeft );
#/
}
}
function power_drain_completely( slot )
{
powerLeft = self GadgetPowerChange( slot, 0 );
powerLeft = self GadgetPowerChange( slot, -powerLeft );
}
function IsMovingPowerloss()
{
velocity = self GetVelocity();
speedsq = lengthsquared( velocity );
return speedsq > self._gadgets_player.gadget_powermovespeed * self._gadgets_player.gadget_powermovespeed;
}
function power_consume_timer_think( slot, weapon )
{
self endon( "disconnect" );
self endon( "death" );
time = GetTime();
while ( 1 )
{
wait( 0.1 );
if ( !IsDefined( self._gadgets_player[slot] ) )
{
return;
}
if ( !self GadgetIsActive( slot ) )
{
return;
}
currentTime = GetTime();
interval = currentTime - time;
time = currentTime;
powerConsumpted = 0;
//sprint
if( self IsOnGround() )
{
if ( self._gadgets_player[slot].gadget_powersprintloss > 0 && self IsSprinting() )
{
powerConsumpted += 1.0 * interval / 1000 * self._gadgets_player[slot].gadget_powersprintloss;
}
//move
else if ( self._gadgets_player[slot].gadget_powermoveloss && self IsMovingPowerloss() )
{
powerConsumpted += 1.0 * interval / 1000 * self._gadgets_player[slot].gadget_powermoveloss;
}
}
//--jump
//--juke
//--melee
//--attack
if ( powerConsumpted > 0.1 )
{
self power_loss_event( slot, self, powerConsumpted, "consume" );
if ( self._gadgets_player[slot].gadget_flickerOnPowerloss > 0 )
{
self ability_gadgets::SetFlickering( slot, self._gadgets_player[slot].gadget_flickerOnPowerloss );
}
}
}
}
+6
View File
@@ -0,0 +1,6 @@
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
Line truncated
#namespace player_character_util;
+177
View File
@@ -0,0 +1,177 @@
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
Line truncated
#namespace ability_util;
function gadget_is_type( slot, type )
{
if ( !IsDefined( self._gadgets_player[slot] ) )
{
return false;
}
return self._gadgets_player[slot].gadget_type == type;
}
//TODO: move to code
function gadget_slot_for_type( type )
{
invalid = 3;
for ( i = 0; i < 3; i++ )
{
if ( !self gadget_is_type( i, type ) )
{
continue;
}
return i;
}
return invalid;
}
function gadget_is_camo_suit_on()
{
return gadget_is_active( 2 );
}
function gadget_combat_efficiency_enabled()
{
if ( isdefined( self._gadget_combat_efficiency ) )
{
return self._gadget_combat_efficiency;
}
return false;
}
function gadget_combat_efficiency_power_drain( score )
{
powerChange = -1 * score * GetDvarFloat( "scr_combat_efficiency_power_loss_scalar", .275 );
slot = gadget_slot_for_type( 15 );
if( slot != 3 )
{
self GadgetPowerChange( slot, powerChange );
}
}
function gadget_is_camo_suit_flickering()
{
slot = self gadget_slot_for_type( 2 );
if ( slot >= 0 && slot < 3 )
{
if ( self ability_player::gadget_is_flickering( slot ) )
{
return true;
}
}
return false;
}
function gadget_is_escort_drone_on()
{
return gadget_is_active( 5 );
}
//TODO: move to code
function is_weapon_gadget( weapon )
{
foreach( gadget_key, gadget_val in level._gadgets_level )
{
if ( gadget_key == weapon )
return true;
}
return false;
}
function gadget_power_reset( gadgetWeapon )
{
slot = self GadgetGetSlot( gadgetWeapon );
if ( slot >= 0 && slot < 3 )
{
self GadgetPowerReset( slot );
self GadgetCharging( slot, true );
}
}
function gadget_reset( gadgetWeapon, changedClass, roundBased, firstRound )
{
if ( GetDvarint( "gadgetEnabled") == 0 )
{
return;
}
slot = self GadgetGetSlot( gadgetWeapon );
if ( slot >= 0 && slot < 3 )
{
if ( isdefined( self.pers["held_gadgets_power"] ) && isdefined( self.pers["held_gadgets_power"][gadgetWeapon] ) )
{
self GadgetPowerSet( slot, self.pers["held_gadgets_power"][gadgetWeapon] );
}
else if( isdefined( self.pers["held_gadgets_power"] ) && isdefined( self.pers[#"thiefWeapon"] ) && isdefined( self.pers["held_gadgets_power"][self.pers[#"thiefWeapon"]] ) )
{
self GadgetPowerSet( slot, self.pers["held_gadgets_power"][self.pers[#"thiefWeapon"]] );
}
else if( isdefined( self.pers["held_gadgets_power"] ) && isdefined( self.pers[#"rouletteWeapon"] ) && isdefined( self.pers["held_gadgets_power"][self.pers[#"rouletteWeapon"]] ) )
{
self GadgetPowerSet( slot, self.pers["held_gadgets_power"][self.pers[#"rouletteWeapon"]] );
}
resetOnClassChange = changedClass && gadgetWeapon.gadget_power_reset_on_class_change;
resetOnFirstRound = !isdefined( self.firstSpawn ) && ( !roundBased || firstRound );
resetOnRoundSwitch = !isdefined( self.firstSpawn ) && roundBased && !firstRound && gadgetWeapon.gadget_power_reset_on_round_switch;
resetOnTeamChanged = isdefined( self.firstSpawn ) && ( isdefined( self.switchedTeamsResetGadgets ) && self.switchedTeamsResetGadgets ) && gadgetWeapon.gadget_power_reset_on_team_change;
if ( resetOnClassChange || resetOnFirstRound || resetOnRoundSwitch || resetOnTeamChanged )
{
self GadgetPowerReset( slot );
self GadgetCharging( slot, true );
}
}
}
function gadget_power_armor_on()
{
return gadget_is_active( 4 );
}
//TODO: move to code
function gadget_is_active( gadgetType )
{
slot = self gadget_slot_for_type( gadgetType );
if ( slot >= 0 && slot < 3 )
{
if ( self ability_player::gadget_is_in_use( slot ) )
{
return true;
}
}
return false;
}
//TODO: move to code
function gadget_has_type( gadgetType )
{
slot = self gadget_slot_for_type( gadgetType );
if ( slot >= 0 && slot < 3 )
{
return true;
}
return false;
}
+104
View File
@@ -0,0 +1,104 @@
// Keep in sync with C enum gadgetType_e
// src\bgame\bg_common_db.h
// forced
// voluntary
// KEEP THESE IN SYNC WITH gadgetAction_e IN CODE
@@ -0,0 +1,169 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\abilities\_ability_gadgets;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_active_camo",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 31, &camo_gadget_on, &camo_gadget_off );
ability_player::register_gadget_possession_callbacks( 31, &camo_on_give, &camo_on_take );
ability_player::register_gadget_flicker_callbacks( 31, &camo_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 31, &camo_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 31, &camo_is_flickering );
//clientfield::register( "allplayers", "camo_shader", VERSION_SHIP, 3, "int" ); //already registered in _gadget_camo
callback::on_connect( &camo_on_connect );
callback::on_spawned( &camo_on_spawn );
callback::on_disconnect( &camo_on_disconnect );
}
function camo_on_connect()
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self [[level.cybercom.active_camo._on_connect]]();
}
}
function camo_on_disconnect()
{
/*if ( IsDefined( self.active_camo_sound_ent ) )
{
self.active_camo_sound_ent stoploopsound( .05 );
self.active_camo_sound_ent delete();
}*/
}
function camo_on_spawn()
{
self flagsys::clear( "camo_suit_on" );
self notify( "camo_off" );
self clientfield::set( "camo_shader", 0 );
/*if ( IsDefined( self.active_camo_sound_ent ) )
{
self.active_camo_sound_ent stoploopsound( .05 );
self.active_camo_sound_ent delete();
}*/
}
function camo_is_inuse( slot )
{
return self flagsys::get( "camo_suit_on" );
}
function camo_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function camo_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self [[level.cybercom.active_camo._on_give]](slot, weapon);
}
}
function camo_on_take( slot, weapon )
{
self notify( "camo_removed" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self [[level.cybercom.active_camo._on_take]](slot, weapon);
}
}
function camo_on_flicker( slot, weapon )
{
self thread suspend_camo_suit( slot, weapon );
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self thread [[level.cybercom.active_camo._on_flicker]](slot, weapon);
}
}
function camo_gadget_on( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self thread [[level.cybercom.active_camo._on]](slot, weapon);
}
else
{
self clientfield::set( "camo_shader", 1 );
}
self flagsys::set( "camo_suit_on" );
//self thread camo_loop_audio();
}
function camo_gadget_off( slot, weapon )
{
self flagsys::clear( "camo_suit_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self thread [[level.cybercom.active_camo._off]](slot, weapon);
}
/*if ( IsDefined( self.active_camo_sound_ent ) )
{
self.active_camo_sound_ent PlaySound( "gdt_camo_suit_off");
self.active_camo_sound_ent delete();
}*/
self notify( "camo_off" );
self clientfield::set( "camo_shader", 0 );
}
function suspend_camo_suit( slot, weapon )
{
self endon( "disconnect" );
self endon( "camo_off" );
self clientfield::set( "camo_shader", 2 );
suspend_camo_suit_wait( slot, weapon );
if ( self camo_is_inuse( slot ) )
{
self clientfield::set( "camo_shader", 1 );
}
}
function suspend_camo_suit_wait( slot, weapon )
{
self endon( "death" );
self endon( "camo_off" );
while ( self camo_is_flickering( slot ) )
{
wait 0.5;
}
}
/*function camo_loop_audio()
{
if ( IsDefined( self.active_camo_sound_ent ) )
{
self.active_camo_sound_ent stoploopsound( .05 );
self.active_camo_sound_ent delete();
}
self.active_camo_sound_ent = Spawn( "script_origin", self.origin );
self.active_camo_sound_ent linkto( self );
self playsound ("gdt_camo_suit_on");
wait .5;
if ( IsDefined( self.active_camo_sound_ent ) )
{
self.active_camo_sound_ent PlayLoopSound( "gdt_camo_suit_loop" , .1 );
}
}
*/
+233
View File
@@ -0,0 +1,233 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
function autoexec __init__sytem__() { system::register("gadget_armor",&__init__,undefined,undefined); }
function __init__()
{
callback::on_localplayer_spawned( &on_local_player_spawned );
clientfield::register( "allplayers", "armor_status", 1, 5, "int", &player_armor_changed, !true, !true );
clientfield::register( "toplayer", "player_damage_type", 1, 1, "int", &player_damage_type_changed, !true, !true );
duplicate_render::set_dr_filter_framebuffer_duplicate( "armor_pl", 40, "armor_on", undefined, 1, "mc/mtl_power_armor", 0 );
/#
level thread armor_overlay_think();
#/
}
function on_local_player_spawned( localClientNum )
{
if( self != GetLocalPlayer( localClientNum ) )
return;
newVal = self clientfield::get( "armor_status" );
self player_armor_changed_event( localClientNum, newVal );
}
function player_damage_type_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
self armor_update_fx_event( localClientNum, newVal);
}
function player_armor_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
self player_armor_changed_event( localClientNum, newVal);
}
function player_armor_changed_event( localClientNum, newVal )
{
self armor_update_fx_event( localClientNum, newVal);
self armor_update_shader_event( localClientNum, newVal );
}
function armor_update_shader_event( localClientNum, armorStatusNew )
{
if ( armorStatusNew )
{
self duplicate_render::update_dr_flag( localClientNum, "armor_on", true );
shieldExpansionNcolor = "scriptVector3";
shieldExpansionValueX = .3;
colorVector = armor_get_shader_color( armorStatusNew ); //( 0.2, 0.8, 1 );
if ( GetDvarInt( "scr_armor_dev" ) )
{
shieldExpansionValueX = GetDvarFloat( "scr_armor_expand", shieldExpansionValueX );
colorVector = ( GetDvarFloat( "scr_armor_colorR", colorVector[0] ), GetDvarFloat( "scr_armor_colorG", colorVector[1] ), GetDvarFloat( "scr_armor_colorB", colorVector[2] ) );
}
colorTintValueY = colorVector[0];
colorTintValueZ = colorVector[1];
colorTintValueW = colorVector[2];
damageState = "scriptVector4";
damageStateValue = armorStatusNew / 5;
self MapShaderConstant( localClientNum, 0, shieldExpansionNcolor, shieldExpansionValueX, colorTintValueY, colorTintValueZ, colorTintValueW );
self MapShaderConstant( localClientNum, 0, damageState, damageStateValue );
}
else
{
self duplicate_render::update_dr_flag( localClientNum, "armor_on", false );
}
}
function armor_get_shader_color( armorStatusNew )
{
// if ( armorStatusNew == ARMOR_STATUS_FULL )
// {
// color = ( 0.03, 0.11, 0.97 );
// }
// else if ( armorStatusNew == ARMOR_STATUS_GOOD )
// {
// color = ( 0.02, 0.65, 0.98 );
// }
// else if ( armorStatusNew == ARMOR_STATUS_OK )
// {
// color = ( 0.03, 0.82, 0.97 );
// }
// else if ( armorStatusNew == ARMOR_STATUS_DANGER )
// {
// color = ( 0.47, 0.97, 0.96 );
// }
// else if ( armorStatusNew == ARMOR_STATUS_CRITICAL )
// {
// color = ( 0.97, 0.04, 0.10 );
// }
// else
// {
// color = (0.03, 0.11, 0.97 );
// }
color = ( .3, .3, .2 );
return color;
}
function armor_update_fx_event( localClientNum, doArmorFx )
{
if ( !self armor_is_local_player( localClientNum ) )
{
return;
}
if ( doArmorFx )
{
self SetDamageDirectionIndicator(1);
setsoundcontext( "plr_impact", "pwr_armor" );
}
else
{
self SetDamageDirectionIndicator(0);
setsoundcontext( "plr_impact", "" );
}
}
function armor_overlay_transition_fx( localClientNum, armorStatusNew )
{
self endon( "disconnect" );
if ( !isdefined( self._gadget_armor_state ) )
{
self._gadget_armor_state = 0;
}
if ( armorStatusNew == self._gadget_armor_state )
{
return;
}
self._gadget_armor_state = armorStatusNew;
if ( armorStatusNew == 5 )
{
return;
}
if ( ( isdefined( self._armor_doing_transition ) && self._armor_doing_transition ) )
{
return;
}
self._armor_doing_transition = true;
transition = 0;
flicker_start_time = GetRealTime();
saved_vision = GetVisionSetNaked( localClientNum );
visionsetnaked( localClientNum, "taser_mine_shock", transition );
self playsound (0, "wpn_taser_mine_tacmask");
wait( 0.3 );
visionSetNaked( localClientNum, saved_vision, transition );
self._armor_doing_transition = false;
}
function armor_is_local_player( localClientNum )
{
player_view = getlocalplayer( localClientNum );
sameEntity = ( self == player_view );
return sameEntity;
}
/#
function armor_overlay_think()
{
armorStatus = 0;
SetDvar( "scr_armor_status", 0 );
while( 1 )
{
wait( 0.1 );
armorStatusNew = GetDvarInt( "scr_armor_status" );
if ( armorStatusNew != armorStatus )
{
players = getlocalplayers();
foreach ( i, localPlayer in players )
{
if ( !isdefined( localPlayer ) )
{
continue;
}
localPlayer player_armor_changed_event( i, armorStatusNew );
}
armorStatus = armorStatusNew;
}
}
}
#/
+389
View File
@@ -0,0 +1,389 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\weapons\_weaponobjects;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace armor;
function autoexec __init__sytem__() { system::register("gadget_armor",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 4, &gadget_armor_on, &gadget_armor_off );
ability_player::register_gadget_possession_callbacks( 4, &gadget_armor_on_give, &gadget_armor_on_take );
ability_player::register_gadget_flicker_callbacks( 4, &gadget_armor_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 4, &gadget_armor_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 4, &gadget_armor_is_flickering );
clientfield::register( "allplayers", "armor_status" , 1, 5, "int" );
clientfield::register( "toplayer", "player_damage_type" , 1, 1, "int" );
callback::on_connect( &gadget_armor_on_connect );
}
function gadget_armor_is_inuse( slot )
{
// returns true when local script gadget state is on
return self GadgetIsActive( slot );
}
function gadget_armor_is_flickering( slot )
{
// returns true when local script gadget state is flickering
return self GadgetFlickering( slot );
}
function gadget_armor_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
self thread gadget_armor_flicker( slot, weapon );
}
function gadget_armor_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
self clientfield::set( "armor_status", 0 );
self._gadget_armor_slot = slot;
self._gadget_armor_weapon = weapon;
}
function gadget_armor_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
self gadget_armor_off( slot, weapon );
}
//self is the player
function gadget_armor_on_connect()
{
// setup up stuff on player connec
}
function gadget_armor_on( slot, weapon )
{
if ( IsAlive(self) )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_armor_on" );
//armor section
self.shock_onpain = 0;
//set the hitpoints
self.gadgetHitPoints = ( ( IsDefined( weapon.gadget_max_hitpoints ) && weapon.gadget_max_hitpoints > 0 ) ? weapon.gadget_max_hitpoints : undefined );
if ( isdefined( self.overridePlayerDamage ) )
{
self.originalOverridePlayerDamage = self.overridePlayerDamage;
}
self.overridePlayerDamage = &armor_player_damage;
self thread gadget_armor_status( slot, weapon );
}
}
function gadget_armor_off( slot, weapon )
{
armorOn = flagsys::get( "gadget_armor_on" );
self notify( "gadget_armor_off" );
// excecutes when the gadget is turned off
self flagsys::clear( "gadget_armor_on" );
//armor section
self.shock_onpain = 1;
self clientfield::set( "armor_status", 0 );
if ( isdefined( self.originalOverridePlayerDamage ) )
{
self.overridePlayerDamage = self.originalOverridePlayerDamage;
self.originalOverridePlayerDamage = undefined;
}
if ( armorOn && IsAlive( self ) && isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon );
}
}
function gadget_armor_flicker( slot, weapon )
{
self endon( "disconnect" );
if ( !self gadget_armor_is_inuse( slot ) )
{
return;
}
eventTime = self._gadgets_player[slot].gadget_flickertime;
self set_gadget_status( "Flickering", eventTime );
while( 1 )
{
if ( !self GadgetFlickering( slot ) )
{
self set_gadget_status( "Normal" );
return;
}
wait( 0.5 );
}
}
function set_gadget_status( status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Gadget Armor: " + status + timeStr );
}
function armor_damage_type_multiplier( sMeansOfDeath )
{
switch(sMeansOfDeath)
{
case "MOD_CRUSH":
case "MOD_TELEFRAG":
case "MOD_SUICIDE":
case "MOD_DROWN":
case "MOD_HIT_BY_OBJECT":
case "MOD_FALLING":
return 0; // no protection - damage will fall through to player
case "MOD_PROJECTILE":
return GetDvarFloat( "scr_armor_mod_proj_mult", 1 );
case "MOD_MELEE":
case "MOD_MELEE_WEAPON_BUTT":
return GetDvarFloat( "scr_armor_mod_melee_mult", 2 );
break;
case "MOD_EXPLOSIVE":
case "MOD_PROJECTILE_SPLASH":
case "MOD_GRENADE":
case "MOD_GRENADE_SPLASH":
return GetDvarFloat( "scr_armor_mod_expl_mult", 1 );
break;
case "MOD_PISTOL_BULLET":
case "MOD_RIFLE_BULLET":
return GetDvarFloat( "scr_armor_mod_bullet_mult", .7 );
break;
case "MOD_BURNED":
case "MOD_UNKNOWN":
case "MOD_TRIGGER_HURT":
default:
return GetDvarFloat( "scr_armor_mod_misc_mult", 1 );
}
}
function armor_damage_mod_allowed( weapon, sMeansOfDeath )
{
switch( weapon.name )
{
case "hero_lightninggun":
case "hero_lightninggun_arc":
return false;
default:
break;
}
switch(sMeansOfDeath)
{
case "MOD_CRUSH":
case "MOD_TELEFRAG":
case "MOD_SUICIDE":
case "MOD_DROWN":
case "MOD_HIT_BY_OBJECT":
case "MOD_FALLING":
case "MOD_MELEE":
case "MOD_MELEE_WEAPON_BUTT":
case "MOD_EXPLOSIVE":
case "MOD_PROJECTILE_SPLASH":
case "MOD_GRENADE":
case "MOD_GRENADE_SPLASH":
case "MOD_BURNED":
case "MOD_UNKNOWN":
case "MOD_TRIGGER_HURT":
return false;
case "MOD_PISTOL_BULLET":
case "MOD_RIFLE_BULLET":
return true;
case "MOD_PROJECTILE":
// if we are using this as a impact damage only projectile then we allow it
if (weapon.explosionradius == 0 )
{
return true;
}
return false;
default:
return false;
}
return false;
}
function armor_should_take_damage( eAttacker, weapon, sMeansOfDeath, sHitLoc )
{
if ( isdefined( eAttacker ) && !weaponobjects::friendlyFireCheck( self, eAttacker ) )
{
return false;
}
if ( !armor_damage_mod_allowed( weapon, sMeansOfDeath ) )
{
return false;
}
if( isDefined( sHitLoc ) && ( sHitLoc == "head" || sHitLoc == "helmet" ) )
{
return false;
}
return true;
}
function armor_player_damage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, weapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime )
{
damage = iDamage;
self.power_armor_took_damage = false;
if ( ( self armor_should_take_damage( eAttacker, weapon, sMeansOfDeath, sHitLoc ) ) && isdefined( self._gadget_armor_slot ) )
{
self clientfield::set_to_player( "player_damage_type", 1 );
if ( self gadget_armor_is_inuse( self._gadget_armor_slot ) )
{
armor_damage = damage * armor_damage_type_multiplier( sMeansOfDeath );
damage = 0;
if ( armor_damage > 0 )
{
if( IsDefined( self.gadgetHitPoints ) )
{
hitPointsLeft = self.gadgetHitPoints;
}
else
{
hitPointsLeft = self GadgetPowerChange( self._gadget_armor_slot, 0.0 );
}
if ( weapon == level.weaponLightningGun || weapon == level.weaponLightningGunArc )
{
// lightning gun will take all armor but do no damage
armor_damage = hitPointsLeft;
}
else if ( hitPointsLeft < armor_damage )
{
// will apply rest of damage back to player
damage = armor_damage - hitPointsLeft;
}
if( IsDefined( self.gadgetHitPoints ) )
{
self hitpoints_loss_event( armor_damage );
}
else
{
self ability_power::power_loss_event( self._gadget_armor_slot, eAttacker, armor_damage, "armor damage" );
}
self.power_armor_took_damage = true;
self.power_armor_last_took_damage_time = GetTime();
self AddToDamageIndicator( int( armor_damage * GetDvarFloat( "scr_armor_mod_view_kick_mult", .001 ) ), vDir);
}
}
else
{
self clientfield::set_to_player( "player_damage_type", 0 );
}
}
else
{
self clientfield::set_to_player( "player_damage_type", 0 );
}
return damage;
}
function hitpoints_loss_event( val )
{
if ( val > 0 )
{
self.gadgetHitPoints -= val;
}
}
function gadget_armor_status( slot, weapon )
{
self endon( "disconnect" );
maxHitPoints = ( ( IsDefined( weapon.gadget_max_hitpoints ) && weapon.gadget_max_hitpoints > 0 ) ? weapon.gadget_max_hitpoints : 100 );
while ( self flagsys::get( "gadget_armor_on" ) )
{
if( IsDefined( self.gadgetHitPoints ) && self.gadgetHitPoints <= 0 )
{
self playsoundtoplayer( "wpn_power_armor_destroyed_plr", self );
self playsoundtoallbutplayer( "wpn_power_armor_destroyed_npc", self );
self GadgetDeactivate( slot, weapon );
self GadgetPowerSet( slot, 0.0 );
break;
}
if( IsDefined( self.gadgetHitPoints ) )
{
hitPointsRatio = self.gadgetHitPoints / maxHitPoints;
}
else
{
hitPointsRatio = self GadgetPowerChange( self._gadget_armor_slot, 0.0 ) / maxHitPoints;
}
stage = 1 + int( hitPointsRatio * 5 );
if ( stage > 5 )
{
stage = 5;
}
self clientfield::set( "armor_status", stage );
{wait(.05);};
}
self clientfield::set( "armor_status", 0 );
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_cacophany",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,110 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_cacophany",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 25, &gadget_cacophany_on, &gadget_cacophany_off );
ability_player::register_gadget_possession_callbacks( 25, &gadget_cacophany_on_give, &gadget_cacophany_on_take );
ability_player::register_gadget_flicker_callbacks( 25, &gadget_cacophany_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 25, &gadget_cacophany_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 25, &gadget_cacophany_is_flickering );
ability_player::register_gadget_primed_callbacks( 25, &gadget_cacophany_is_primed );
callback::on_connect( &gadget_cacophany_on_connect );
}
function gadget_cacophany_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_cacophany_on" );
}
function gadget_cacophany_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
return self [[level.cybercom.cacophany._is_flickering]](slot);
}
}
function gadget_cacophany_on_flicker( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
self [[level.cybercom.cacophany._on_flicker]](slot, weapon);
} // // excuted when the gadget flickers
}
function gadget_cacophany_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
self [[level.cybercom.cacophany._on_give]](slot, weapon);
} // executed when gadget is added to the players inventory
}
function gadget_cacophany_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
self [[level.cybercom.cacophany._on_take]](slot, weapon);
}
}
//self is the player
function gadget_cacophany_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
self [[level.cybercom.cacophany._on_connect]]();
}
}
function gadget_cacophany_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_cacophany_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
self [[level.cybercom.cacophany._on]](slot, weapon);
}
}
function gadget_cacophany_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_cacophany_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
self [[level.cybercom.cacophany._off]](slot, weapon);
}
}
function gadget_cacophany_is_primed( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.cacophany))
{
self [[level.cybercom.cacophany._is_primed]](slot, weapon);
}
}
+62
View File
@@ -0,0 +1,62 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\abilities\gadgets\_gadget_camo_render;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_camo",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "allplayers", "camo_shader", 1, 3, "int", &ent_camo_material_callback, !true, true );
}
function ent_camo_material_callback( local_client_num, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( oldVal == newVal && oldVal == 0 && !bWasTimeJump )
{
return;
}
flags_changed = self duplicate_render::set_dr_flag_not_array( "gadget_camo_friend", util::friend_not_foe( local_client_num, true ) );
flags_changed |= self duplicate_render::set_dr_flag_not_array( "gadget_camo_flicker", newVal == 2 );
flags_changed |= self duplicate_render::set_dr_flag_not_array( "gadget_camo_break", newVal == 3 );
flags_changed |= self duplicate_render::set_dr_flag_not_array( "gadget_camo_reveal", newVal != oldVal );
flags_changed |= self duplicate_render::set_dr_flag_not_array( "gadget_camo_on", newVal != 0 );
flags_changed |= self duplicate_render::set_dr_flag_not_array( "hide_model", newVal == 0 );
flags_changed |= bNewEnt;
if ( flags_changed )
{
self duplicate_render::update_dr_filters(local_client_num);
}
self notify( "endtest" );
if ( newVal && ( bWasTimeJump || bNewEnt ) )
{
self thread gadget_camo_render::forceOn( local_client_num );
}
else if ( newVal != oldVal )
{
self thread gadget_camo_render::doReveal( local_client_num, newVal != 0 );
}
if ( newVal && !oldVal || ( newVal && ( bWasTimeJump || bNewEnt ) ) )
{
self GadgetPulseResetReveal();
}
}
+394
View File
@@ -0,0 +1,394 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\abilities\_ability_gadgets;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_camo",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 2, &camo_gadget_on, &camo_gadget_off );
ability_player::register_gadget_possession_callbacks( 2, &camo_on_give, &camo_on_take );
ability_player::register_gadget_flicker_callbacks( 2, &camo_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 2, &camo_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 2, &camo_is_flickering );
clientfield::register( "allplayers", "camo_shader", 1, 3, "int" );
//clientfield::register( "actor", "camo_shader", VERSION_SHIP, 3, "int" );
callback::on_connect( &camo_on_connect );
callback::on_spawned( &camo_on_spawn );
callback::on_disconnect( &camo_on_disconnect );
}
function camo_is_inuse( slot )
{
return self flagsys::get( "camo_suit_on" );
}
function camo_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function camo_on_connect()
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self [[level.cybercom.active_camo._on_connect]]();
}
}
function camo_on_disconnect()
{
if ( IsDefined( self.sound_ent ) )
{
self.sound_ent stoploopsound( .05 );
self.sound_ent delete();
}
}
function camo_on_spawn()
{
self flagsys::clear( "camo_suit_on" );
self notify( "camo_off" );
//self._gadget_camo_oldIgnoreme = undefined;
//self.ignoreme = false;
self camo_bread_crumb_delete();
self clientfield::set( "camo_shader", 0 );
if ( IsDefined( self.sound_ent ) )
{
self.sound_ent stoploopsound( .05 );
self.sound_ent delete();
}
}
/////////////////////////////////////////////////////////////////
//
// Player Camo Suit
//
/////////////////////////////////////////////////////////////////
function suspend_camo_suit( slot, weapon )
{
self endon( "disconnect" );
self endon( "camo_off" );
self clientfield::set( "camo_shader", 2 );
suspend_camo_suit_wait( slot, weapon );
if ( self camo_is_inuse( slot ) )
{
self clientfield::set( "camo_shader", 1 );
}
}
function suspend_camo_suit_wait( slot, weapon )
{
self endon( "death" );
self endon( "camo_off" );
while ( self camo_is_flickering( slot ) )
{
wait 0.5;
}
}
function camo_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self [[level.cybercom.active_camo._on_give]](slot, weapon);
}
}
function camo_on_take( slot, weapon )
{
self notify( "camo_removed" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self [[level.cybercom.active_camo._on_take]](slot, weapon);
}
}
function camo_on_flicker( slot, weapon )
{
self thread camo_suit_flicker( slot, weapon );
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self thread [[level.cybercom.active_camo._on_flicker]](slot, weapon);
}
}
function camo_all_actors( value )
{
str_opposite_team = "axis";
if ( self.team == "axis" )
{
str_opposite_team = "allies";
}
aiTargets = GetAIArray( str_opposite_team );
for ( i = 0; i < aiTargets.size; i++ )
{
testTarget = aiTargets[i];
if ( !IsDefined( testTarget ) || !IsAlive( testTarget ) )
{
continue;
}
//testTarget clientfield::set( "camo_shader", value );
}
}
function camo_gadget_on( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self thread [[level.cybercom.active_camo._on]](slot, weapon);
}
self thread camo_takedown_watch( slot, weapon );
self._gadget_camo_oldIgnoreme = self.ignoreme;
self.ignoreme = true;
self clientfield::set( "camo_shader", 1 );
self flagsys::set( "camo_suit_on" );
self thread camo_bread_crumb( slot, weapon );
//self camo_all_actors( GADGET_CAMO_SHADER_ON );
//self thread camo_loop_audio();
}
/*function camo_loop_audio()
{
if ( IsDefined( self.sound_ent ) )
{
self.sound_ent stoploopsound( .05 );
self.sound_ent delete();
}
self.sound_ent = Spawn( "script_origin", self.origin );
self.sound_ent linkto( self );
self playsound ("gdt_camo_suit_on");
wait .5;
if ( IsDefined( self.sound_ent ) )
{
self.sound_ent PlayLoopSound( "gdt_camo_suit_loop" , .1 );
}
}*/
function camo_gadget_off( slot, weapon )
{
self flagsys::clear( "camo_suit_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
{
self thread [[level.cybercom.active_camo._off]](slot, weapon);
}
if ( IsDefined( self.sound_ent ) )
{
//self.sound_ent stoploopsound( );
//self.sound_ent PlaySound( "gdt_camo_suit_off");
//self.sound_ent PlaySoundWithNotify( "gdt_camo_suit_off" , "sound_done" );
//self.sound_ent delete();
//self.sound_ent waittill( "sound_done" );
}
self notify( "camo_off" );
if ( IsDefined( self._gadget_camo_oldIgnoreme ) )
{
self.ignoreme = self._gadget_camo_oldIgnoreme;
self._gadget_camo_oldIgnoreme = undefined;
}
else
{
self.ignoreme = false;
}
self camo_bread_crumb_delete();
self.gadget_camo_off_time = GetTime();
self clientfield::set( "camo_shader", 0 );
//self camo_all_actors( GADGET_CAMO_SHADER_OFF );
}
function camo_bread_crumb( slot, weapon )
{
self notify( "camo_bread_crumb" );
self endon( "camo_bread_crumb" );
self camo_bread_crumb_delete();
if ( !self camo_is_inuse() )
{
return;
}
self._camo_crumb = spawn( "script_model", self.origin );
self._camo_crumb SetModel( "tag_origin" );
//self GadgetSetEntity( slot, self._camo_crumb );
//self GadgetSetActivateTime( slot, GetTime() );
self camo_bread_crumb_wait( slot, weapon );
self camo_bread_crumb_delete();
}
function camo_bread_crumb_wait( slot, weapon )
{
self endon( "disconnect" );
self endon( "death" );
self endon( "camo_off" );
self endon( "camo_bread_crumb" );
startTime = GetTime();
while ( 1 )
{
currentTime = GetTime();
if ( currentTime - startTime > self._gadgets_player[slot].gadget_breadCrumbDuration )
{
return;
}
wait 0.5;
}
}
function camo_bread_crumb_delete()
{
if ( IsDefined( self._camo_crumb ) )
{
self._camo_crumb delete();
self._camo_crumb = undefined;
}
}
function camo_takedown_watch( slot, weapon )
{
self endon( "disconnect" );
self endon( "camo_off" );
while( 1 )
{
self waittill( "weapon_assassination" );
if ( self camo_is_inuse() )
{
if ( self._gadgets_player[slot].gadget_takedownrevealtime > 0 )
{
self ability_gadgets::SetFlickering( slot, self._gadgets_player[slot].gadget_takedownrevealtime );
}
}
}
}
function camo_temporary_dont_ignore( slot )
{
self endon( "disconnect" );
if ( !self camo_is_inuse() )
{
return;
}
self notify( "temporary_dont_ignore" );
wait(0.1);
old_ignoreme = false;
if ( IsDefined( self._gadget_camo_oldIgnoreme ) )
{
old_ignoreme = self._gadget_camo_oldIgnoreme;
}
self.ignoreme = old_ignoreme;
camo_temporary_dont_ignore_wait( slot );
self.ignoreme = ( self camo_is_inuse() || old_ignoreme );
}
function camo_temporary_dont_ignore_wait( slot )
{
self endon( "disconnect" );
self endon( "death" );
self endon( "camo_off" );
self endon( "temporary_dont_ignore" );
while( 1 )
{
if ( !self camo_is_flickering( slot ) )
{
return;
}
wait( 0.25 );
}
}
function camo_suit_flicker( slot, weapon )
{
self endon( "disconnect" );
self endon( "death" );
self endon( "camo_off" );
if ( !self camo_is_inuse() )
{
return;
}
// temp
self thread camo_temporary_dont_ignore( slot );
self thread suspend_camo_suit( slot, weapon );
while( 1 )
{
if ( !self camo_is_flickering( slot ) )
{
self thread camo_bread_crumb( slot );
return;
}
wait( 0.25 );
}
}
function set_camo_reveal_status( status, time )
{
timeStr = "";
self._gadget_camo_reveal_status = undefined;
if ( IsDefined( time ) )
{
timeStr = ", ^3time: " + time;
self._gadget_camo_reveal_status = status;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Camo Reveal: " + status + timeStr );
}
@@ -0,0 +1,131 @@
#using scripts\codescripts\struct;
#using scripts\shared\duplicaterender_mgr;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_camo_render",&__init__,undefined,undefined); }
function __init__()
{
duplicate_render::set_dr_filter_framebuffer_duplicate( "camo_rev_dr", 90,
"gadget_camo_reveal,", "gadget_camo_flicker,gadget_camo_break,hide_model",
1, "mc/hud_outline_predator", 0 );
duplicate_render::set_dr_filter_framebuffer( "camo_rev", 90,
"gadget_camo_reveal,hide_model", "gadget_camo_flicker,gadget_camo_break",
0, "mc/hud_outline_predator", 0 );
duplicate_render::set_dr_filter_framebuffer( "camo_fr", 90,
"gadget_camo_on,gadget_camo_friend,hide_model", "gadget_camo_flicker,gadget_camo_break",
0, "mc/hud_outline_predator_camo_active_ally", 0 );
duplicate_render::set_dr_filter_framebuffer( "camo_en", 90,
"gadget_camo_on,hide_model", "gadget_camo_flicker,gadget_camo_break,gadget_camo_friend",
0, "mc/hud_outline_predator_camo_active_enemy", 0 );
duplicate_render::set_dr_filter_framebuffer( "camo_fr_fl", 80,
"gadget_camo_on,gadget_camo_flicker,gadget_camo_friend", "gadget_camo_break",
0, "mc/hud_outline_predator_camo_disruption_ally", 0 );
duplicate_render::set_dr_filter_framebuffer( "camo_en_fl", 80,
"gadget_camo_on,gadget_camo_flicker", "gadget_camo_break,gadget_camo_friend",
0, "mc/hud_outline_predator_camo_disruption_enemy", 0 );
duplicate_render::set_dr_filter_framebuffer( "camo_brk", 70,
"gadget_camo_on,gadget_camo_break", undefined,
0, "mc/hud_outline_predator_break", 0 );
}
#namespace gadget_camo_render;
function forceOn( local_client_num )
{
self notify( "kill_gadget_camo_render_doreveal" );
self duplicate_render::update_dr_flag( local_client_num, "hide_model", true );
self MapShaderConstant( local_client_num, 0, "scriptVector0", 1, 0, 0, 0 );
self duplicate_render::set_dr_flag( "gadget_camo_reveal", false );
self duplicate_render::set_dr_flag( "gadget_camo_on", 1 );
self duplicate_render::update_dr_filters(local_client_num);
}
function doReveal( local_client_num, direction )
{
self notify( "kill_gadget_camo_render_doreveal" );
self endon( "kill_gadget_camo_render_doreveal" );
self endon( "entityshutdown" );
if ( !isdefined( self ) )
return;
delta = .016 / 0.35;
if( direction )
{
// start
self duplicate_render::update_dr_flag( local_client_num, "hide_model", false );
self MapShaderConstant( local_client_num, 0, "scriptVector0", 0, 0, 0, 0 );
// loop
model_hidden = 0;
for( currentValue = 0; currentValue < 1; currentValue += delta )
{
self MapShaderConstant( local_client_num, 0, "scriptVector0", currentValue, 0, 0, 0 );
if( currentValue >= .5 && model_hidden == 0 )
{
model_hidden = 1;
self duplicate_render::update_dr_flag( local_client_num, "hide_model", true );
}
wait( .016 );
}
// end
self MapShaderConstant( local_client_num, 0, "scriptVector0", 1, 0, 0, 0 );
self duplicate_render::set_dr_flag( "gadget_camo_reveal", false );
self duplicate_render::set_dr_flag( "gadget_camo_on", 1 );
self duplicate_render::update_dr_filters(local_client_num);
}
else
{
// start
self duplicate_render::update_dr_flag( local_client_num, "hide_model", true );
self MapShaderConstant( local_client_num, 0, "scriptVector0", 1, 0, 0, 0 );
// loop
model_hidden = 1;
for( currentValue = 1; currentValue > 0; currentValue -= delta )
{
self MapShaderConstant( local_client_num, 0, "scriptVector0", currentValue, 0, 0, 0 );
if ( currentValue < .5 && model_hidden )
{
self duplicate_render::update_dr_flag( local_client_num, "hide_model", false );
model_hidden = 0;
}
wait( .016 );
}
// end
self MapShaderConstant( local_client_num, 0, "scriptVector0", 0, 0, 0, 0 );
self duplicate_render::set_dr_flag( "gadget_camo_reveal", false );
self duplicate_render::set_dr_flag( "gadget_camo_on", 0 );
self duplicate_render::update_dr_filters(local_client_num);
}
}
@@ -0,0 +1,38 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
// no alpha to differentiate from view model in shader
function autoexec __init__sytem__() { system::register("gadget_cleanse",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "allplayers", "gadget_cleanse_on", 1, 1, "int", &has_cleanse_changed, !true, true );
duplicate_render::set_dr_filter_offscreen( "cleanse_pl", 50, "cleanse_player", undefined, 2, "mc/hud_outline_model_z_green" );
}
function has_cleanse_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( newVal != oldVal )
{
self duplicate_render::update_dr_flag( localClientNum, "cleanse_player", newVal );
}
}
@@ -0,0 +1,110 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_cleanse",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 17, &gadget_cleanse_on, &gadget_cleanse_off );
ability_player::register_gadget_possession_callbacks( 17, &gadget_cleanse_on_give, &gadget_cleanse_on_take );
ability_player::register_gadget_flicker_callbacks( 17, &gadget_cleanse_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 17, &gadget_cleanse_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 17, &gadget_cleanse_is_flickering );
clientfield::register( "allplayers", "gadget_cleanse_on", 1, 1, "int" );
callback::on_connect( &gadget_cleanse_on_connect );
}
function gadget_cleanse_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_cleanse_on" );
}
function gadget_cleanse_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function gadget_cleanse_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
self thread gadget_cleanse_flicker( slot, weapon );
}
function gadget_cleanse_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
}
function gadget_cleanse_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
}
//self is the player
function gadget_cleanse_on_connect()
{
// setup up stuff on player connect
}
function gadget_cleanse_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_cleanse_on" );
self thread gadget_cleanse_start( slot, weapon );
self clientfield::set( "gadget_cleanse_on", 1 );
}
function gadget_cleanse_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_cleanse_on" );
self clientfield::set( "gadget_cleanse_on", 0 );
}
function gadget_cleanse_start( slot, weapon )
{
self setEMPJammed( false );
self GadgetSetActivateTime( slot, GetTime() );
self setnormalhealth( self.maxHealth );
self setdoublejumpenergy( 1.0 );
self stopshellshock();
self notify( "gadget_cleanse_on" );
}
function wait_until_is_done( slot, timePulse )
{
}
function gadget_cleanse_flicker( slot, weapon )
{
self endon( "disconnect" );
}
function set_gadget_cleanse_status( status, time )
{
}
+107
View File
@@ -0,0 +1,107 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\abilities\gadgets\_gadget_clone_render;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_clone",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "actor", "clone_activated", 1, 1, "int", &clone_activated, !true, true );
clientfield::register( "actor", "clone_damaged", 1, 1, "int", &clone_damaged, !true, !true );
clientfield::register( "allplayers", "clone_activated", 1, 1, "int", &player_clone_activated, !true, !true );
}
function set_shader( localClientNum, enabled, entity )
{
if( entity isfriendly( localclientnum ) )
{
self duplicate_render::update_dr_flag( localClientNum, "clone_ally_on", enabled );
}
else
{
self duplicate_render::update_dr_flag( localClientNum, "clone_enemy_on", enabled );
}
}
function clone_activated( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if( newVal )
{
self._isClone = true;
self set_shader( localClientNum, true, self getowner( localClientNum ) );
if( isDefined( level._monitor_tracker ) )
{
self thread [[level._monitor_tracker]]( localClientNum );
}
self thread gadget_clone_render::transition_shader( localClientNum );
}
}
function player_clone_activated( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( !isdefined( self ) )
return;
if( newVal )
{
self set_shader( localclientnum, true, self );
self thread gadget_clone_render::transition_shader( localClientNum );
}
else
{
self set_shader( localclientnum, false, self );
self notify ( "clone_shader_off" );
self MapShaderConstant( localClientNum, 0, "scriptVector3", 1, 0, 0, 1 );
}
}
function clone_damage_flicker( localClientNum )
{
self endon( "entityshutdown" );
self notify( "start_flicker" );
self endon( "start_flicker" );
self duplicate_render::update_dr_flag( localClientNum, "clone_damage", true );
self waittill( "stop_flicker" );
self duplicate_render::update_dr_flag( localClientNum, "clone_damage", false );
}
function clone_damage_finish()
{
self endon( "entityshutdown" );
self endon( "start_flicker" );
self endon( "stop_flicker" );
wait( .2 );
self notify( "stop_flicker" );
}
function clone_damaged( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if( newVal )
{
self thread clone_damage_flicker( localClientNum );
}
else
{
self thread clone_damage_finish();
}
}
+873
View File
@@ -0,0 +1,873 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\ai_shared;
#using scripts\shared\ai_puppeteer_shared;
#using scripts\shared\ai\systems\blackboard;
#using scripts\shared\ai\systems\shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\array_shared;
#using scripts\shared\_oob;
#using scripts\shared\scoreevents_shared;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_clone",&__init__,undefined,undefined); }
// don't change this.
// ( Max time is equivalent to CLONE_SPAWN_FROM_PLAYER_MAX / ORB_TRAVEL_VELOCITY )
#precache( "fx", "player/fx_plyr_clone_vanish" );
#precache( "fx", "player/fx_plyr_clone_reaper_orb" );
#precache( "fx", "player/fx_plyr_clone_reaper_appear" );
function __init__()
{
ability_player::register_gadget_activation_callbacks( 42, &gadget_clone_on, &gadget_clone_off );
ability_player::register_gadget_possession_callbacks( 42, &gadget_clone_on_give, &gadget_clone_on_take );
ability_player::register_gadget_flicker_callbacks( 42, &gadget_clone_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 42, &gadget_clone_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 42, &gadget_clone_is_flickering );
callback::on_connect( &gadget_clone_on_connect );
clientfield::register( "actor", "clone_activated", 1, 1, "int" );
clientfield::register( "actor", "clone_damaged", 1, 1, "int" );
clientfield::register( "allplayers", "clone_activated", 1, 1, "int" );
level._clone = [];
}
function gadget_clone_is_inuse( slot )
{
return self GadgetIsActive( slot );
}
function gadget_clone_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function gadget_clone_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
}
function gadget_clone_on_give( slot, weapon )
{
}
function gadget_clone_on_take( slot, weapon )
{
}
//self is the player
function gadget_clone_on_connect()
{
// setup up stuff on player connect
}
function killClones( player )
{
if( isDefined( player._clone ) )
{
foreach( clone in player._clone )
{
if( isDefined( clone ) )
{
clone notify( "clone_shutdown" );
}
}
}
}
function is_jumping()
{
// checking PMF_JUMPING in code would give more accurate results
ground_ent = self GetGroundEnt();
return (!isdefined(ground_ent));
}
function CalculateSpawnOrigin( origin, angles, cloneDistance )
{
player = self;
startAngles = [];
testangles = [];
testangles[0] = ( 0, 0, 0);
testangles[1] = ( 0, -30, 0);
testangles[2] = ( 0, 30, 0);
testangles[3] = ( 0, -60, 0);
testangles[4] = ( 0, 60, 0);
testangles[5] = ( 0, 90, 0);
testangles[6] = ( 0, -90, 0);
testangles[7] = ( 0, 120, 0);
testangles[8] = ( 0, -120, 0);
testangles[9] = ( 0, 150, 0);
testangles[10] = ( 0, -150, 0);
testangles[11] = ( 0, 180, 0);
validSpawns = spawnStruct();
validPositions = [];
validAngles = [];
zoffests = [];
zoffests[0] = 5;
zoffests[1] = 0;
if( player is_jumping() )
zoffests[2] = -5;
foreach( zoff in zoffests )
{
for( i = 0; i < testangles.size; i++ )
{
startAngles[i] = ( 0, angles[1], 0 );
startPoint = origin + VectorScale( anglestoforward( startAngles[i] + testangles[i]), cloneDistance );
startPoint += ( 0, 0, zoff );
if( PlayerPositionValidIgnoreEnt( startPoint, self ) )
{
closestNavMeshPoint = GetClosestPointOnNavMesh( startpoint, 500 );
if( isDefined( closestNavMeshPoint ) )
{
startPoint = closestNavMeshPoint;
// Trace downward to find out the actual position on the terrain to spawn the clone.
const height_diff = 24;
trace = GroundTrace( startPoint + (0, 0, height_diff), startPoint - ( 0, 0, height_diff ), false, false, false );
if ( IsDefined( trace[ "position" ] ) )
{
startPoint = trace[ "position" ];
}
}
validpositions[ validpositions.size ] = startPoint;
validAngles[ validAngles.size ] = startAngles[i] + testangles[i];
if( validAngles.size == 3 )
{
break;
}
}
}
if( validAngles.size == 3 )
{
break;
}
}
validspawns.validPositions = validpositions;
validspawns.validAngles = validAngles;
return validspawns;
}
function insertClone( clone )
{
insertedClone = false;
for( i = 0; i < 20; i++ )
{
if( !isDefined( level._clone[i] ) )
{
level._clone[i] = clone;
insertedClone = true;
/#
PrintLn( "inserted at index: " + i + " clone count is: " + level._clone.size );
#/
break;
}
}
assert( insertedClone );
}
function removeClone( clone )
{
for( i = 0; i < 20; i++ )
{
if( isDefined( level._clone[i] ) && ( level._clone[i] == clone ) )
{
level._clone[i] = undefined;
array::remove_undefined( level._clone );
/#
PrintLn( "removed clone at index: " + i + " clone count is: " + level._clone.size );
#/
break;
}
}
}
function removeOldestClone()
{
assert( level._clone.size == 20 );
oldestClone = undefined;
for( i = 0; i < 20; i++ )
{
if( !isDefined( oldestClone ) && isDefined( level._clone[i] ) )
{
oldestClone = level._clone[i];
oldestIndex = i;
}
else if( isDefined( level._clone[i] ) && ( level._clone[i].spawnTime < oldestClone.spawnTime ) )
{
oldestClone = level._clone[i];
oldestIndex = i;
}
}
/#
PrintLn( "Exceeded max clones: removing clone at index: " + i + " clone count is: " + level._clone.size );
#/
level._clone[oldestIndex] notify ( "clone_shutdown" );
level._clone[oldestIndex] = undefined;
array::remove_undefined( level._clone );
}
function spawnClones() // self is player
{
self endon( "death" );
self killClones( self );
self._clone = [];
velocity = self getvelocity();
velocity = velocity + ( 0, 0, -velocity[2] );
velocity = Vectornormalize( velocity );
origin = self.origin + velocity * 17 + VectorScale( anglestoforward( self getangles() ), 17 );
validSpawns = CalculateSpawnOrigin( origin, self getangles(), 60 );
// If there weren't enough valid spawn positions, try extending the spawn distance to find additional spawn points.
if ( validSpawns.validPositions.size < 3 )
{
validExtendedSpawns = CalculateSpawnOrigin( origin, self getangles(), 60 * 3 );
for ( index = 0; index < validExtendedSpawns.validPositions.size && validSpawns.validPositions.size < 3; index++ )
{
validSpawns.validPositions[ validSpawns.validPositions.size ] = validExtendedSpawns.validPositions[ index ];
validSpawns.validAngles[ validSpawns.validAngles.size ] = validExtendedSpawns.validAngles[ index ];
}
}
for( i = 0; i < validSpawns.validpositions.size; i++ )
{
travelDistance = Distance( validSpawns.validpositions[i], self.origin );
validspawns.spawnTimes[i] = travelDistance / 800;
self thread _CloneOrbFx( validSpawns.validpositions[i], validspawns.spawnTimes[i] );
}
for( i = 0; i < validSpawns.validpositions.size; i++ )
{
if( level._clone.size < 20 )
{
// do nothing here
}
else
{
removeOldestClone();
}
clone = SpawnActor(
"spawner_bo3_human_male_reaper_mp",
validSpawns.validpositions[i],
validSpawns.validAngles[i],
"",
true );
/# RecordCircle( validSpawns.validpositions[i], 2, ( 1, .5, 0 ), "Animscript", clone ); #/
_ConfigureClone( clone, self, AnglesToForward( validSpawns.validAngles[i] ), validspawns.spawnTimes[i] );
self._clone[self._clone.size] = clone;
insertClone( clone );
{wait(.05);};
}
self notify( "reveal_clone" );
if( self oob::IsOutOfBounds() )
{
gadget_clone_off( self, undefined );
}
}
function gadget_clone_on( slot, weapon )
{
self clientfield::set( "clone_activated", 1 );
self flagsys::set( "clone_activated" );
fx = PlayFx( "player/fx_plyr_clone_reaper_appear", self.origin, AnglesToForward( self getangles() ));
fx.team = self.team;
thread spawnClones();
}
function private _UpdateClonePathing() // self is clone
{
self endon( "death" );
while( true )
{
if ( GetDvarInt( "tu1_gadgetCloneSwimming", 1 ) )
{
if ( ( self.origin[2] + 72 / 2.0 ) <= GetWaterHeight( self.origin ) )
{
Blackboard::SetBlackBoardAttribute( self, "_stance", "swim" );
self SetGoal( self.origin, true );
wait ( 0.5 );
continue;
}
}
if ( GetDvarInt( "tu1_gadgetCloneCrouching", 1 ) )
{
if ( !IsDefined( self.lastKnownPos ) )
{
self.lastKnownPos = self.origin;
self.lastKnownPosTime = GetTime();
}
// If the clone hasn't moved by atleast CLONE_NOT_MOVING_DIST_SQ within
// CLONE_NOT_MOVING_POLL_TIME then make the clone go crouched.
if ( DistanceSquared( self.lastKnownPos, self.origin ) < ( (24) * (24) ) && !self HasPath() )
{
Blackboard::SetBlackBoardAttribute( self, "_stance", "crouch" );
wait ( 0.5 );
continue;
}
if ( ( self.lastKnownPosTime + 2000 ) <= GetTime() )
{
self.lastKnownPos = self.origin;
self.lastKnownPosTime = GetTime();
}
}
distance = 0;
if( isDefined( self._clone_goal ) )
{
distance = DistanceSquared( self._clone_goal, self.origin );
}
if( distance < 120 * 120 || !self HasPath() )
{
forward = AnglesToForward( self getangles() );
searchOrigin = self.origin + forward * 750;
self._goal_center_point = searchOrigin;
queryResult = PositionQuery_Source_Navigation(
self._goal_center_point,
500,
750,
750,
100,
self );
if( queryResult.data.size == 0 )
{
queryResult = PositionQuery_Source_Navigation(
self.origin,
500,
750,
750,
100,
self );
}
if( queryResult.data.size > 0 )
{
randIndex = RandomIntRange( 0, queryResult.data.size );
self setgoalpos( queryResult.data[ randIndex ].origin, true );
self._clone_goal = queryresult.data[ randIndex ].origin;
self._clone_goal_max_dist = 750;
}
}
//util::drawcylinder( self._goal_center_point, self._clone_goal_max_dist, 10, .5, "stop_notify_asdf" );
//util::debug_sphere( self._clone_goal, 10, ( 1, 0, 1 ), 1, 1 );
wait( .5 );
}
}
function _CloneOrbFx( endPos, travelTime ) //self is player
{
spawnPos = self GetTagOrigin( "j_spine4" );
fxOrg = spawn( "script_model", spawnPos );
fxOrg SetModel( "tag_origin" );
fx = PlayFxOnTag( "player/fx_plyr_clone_reaper_orb", fxOrg, "tag_origin" );
fx.team = self.team;
fxEndPos = endPos + ( 0, 0, ( 40 - 5 ) );
fxOrg MoveTo( fxEndPos, travelTime );
self util::waittill_any_timeout( traveltime, "death", "disconnect" );
fxOrg delete();
}
function private _CloneCopyPlayerLook( clone, player )
{
if ( GetDvarInt( "tu1_gadgetCloneCopyLook", 1 ) )
{
if ( IsPlayer( player ) && IsAI( clone ) )
{
bodyModel = player GetCharacterBodyModel();
if ( IsDefined( bodyModel ) )
{
clone SetModel( bodyModel );
}
headModel = player GetCharacterHeadModel();
if ( IsDefined( headModel ) )
{
if ( IsDefined( clone.head ) )
{
clone Detach( clone.head );
}
clone Attach( headModel );
}
helmetModel = player GetCharacterHelmetModel();
if ( IsDefined( helmetModel ) )
{
clone Attach( helmetModel );
}
}
}
}
function private _ConfigureClone( clone, player, forward, spawnTime ) // self is player
{
clone.isAiClone = true;
clone.properName = "";
clone.ignoreTriggerDamage = true;
clone.minWalkDistance = 125;
clone.overrideActorDamage = &cloneDamageOverride;
clone.spawnTime = GetTime();
clone setmaxhealth( int(1.5 * level.playerMaxHealth) );
if ( GetDvarInt( "tu1_aiPathableMaterials", 0 ) )
{
if ( IsDefined( clone.pathablematerial ) )
{
clone.pathablematerial = clone.pathablematerial & ~(1 << 1); // Don't path through water.
}
}
clone PushActors( true ); // Don't collide with other actors.
clone PushPlayer( true ); // Don't collide with players.
clone SetContents( (1 << 13) ); // Collide with bullets.
clone SetAvoidanceMask( "avoid none" ); // Disable all avoidance.
clone ASMSetAnimationRate( RandomFloatRange( 0.98, 1.02 ) );
clone setclone();
clone _CloneCopyPlayerLook( clone, player );
clone _CloneSelectWeapon( player );
clone thread _CloneWatchDeath();
clone thread _CloneWatchOwnerDisconnect( player );
clone thread _CloneWatchShutdown();
clone thread _CloneFakeFire();
clone thread _CloneBreakGlass();
clone._goal_center_point = forward * 1000 + clone.origin;
clone._goal_center_point = GetClosestPointOnNavMesh( clone._goal_center_point, 600 );
queryResult = undefined;
if ( IsDefined( clone._goal_center_point ) &&
clone FindPath( clone.origin, clone._goal_center_point, true, false ) )
{
queryResult = PositionQuery_Source_Navigation(
clone._goal_center_point,
0,
450,
450,
100,
clone );
}
else
{
queryResult = PositionQuery_Source_Navigation(
clone.origin,
500,
750,
750,
50,
clone );
}
if( queryResult.data.size > 0 )
{
clone setgoalpos( queryResult.data[0].origin, true );
clone._clone_goal = queryresult.data[0].origin;
clone._clone_goal_max_dist = 450;
}
else
{
clone._goal_center_point = clone.origin;
}
clone thread _UpdateClonePathing();
clone ghost();
clone thread _show( spawnTime );
_ConfigureCloneTeam( clone, player, false );
}
function private _PlayDematerialization()
{
if( isDefined( self ) )
{
fx = PlayFx( "player/fx_plyr_clone_vanish", self.origin );
fx.team = self.team;
PlaySoundAtPosition( "mpl_clone_holo_death", self.origin );
}
}
function private _CloneWatchDeath()
{
self waittill( "death" );
if( isDefined( self ) )
{
self stoploopsound();
self _PlayDematerialization();
removeClone( self );
self delete();
}
}
function private _ConfigureCloneTeam( clone, player, isHacked )
{
if ( isHacked == false )
{
clone.originalteam = player.team;
}
clone.ignoreall = true;
clone.owner = player;
clone SetTeam( player.team );
clone.team = player.team;
clone SetEntityOwner( player );
}
function private _show( spawnTime )
{
self endon( "death" );
wait( spawnTime );
self show();
self clientfield::set( "clone_activated", 1 );
fx = PlayFx( "player/fx_plyr_clone_reaper_appear", self.origin, AnglesToForward( self getangles() ));
fx.team = self.team;
self playloopsound( "mpl_clone_gadget_loop_npc" );
}
function gadget_clone_off( slot, weapon )
{
self clientfield::set( "clone_activated", 0 );
self flagsys::clear( "clone_activated" );
self killClones( self );
self _PlayDematerialization();
if ( IsAlive( self ) && isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon, "cloneSuccessDelay" );
}
}
function private _cloneDamaged()
{
self endon ( "death" );
self clientfield::set( "clone_damaged", 1 );
util::wait_network_frame();
self clientfield::set( "clone_damaged", 0 );
}
function ProcessCloneScoreEvent( clone, attacker, weapon )
{
if ( isdefined( attacker ) && isplayer( attacker ) )
{
if ( !level.teamBased || (clone.team != attacker.pers["team"]) )
{
if( isDefined( clone.isAiClone ) && clone.isAiClone )
{
scoreevents::processScoreEvent( "killed_clone_enemy", attacker, clone, weapon );
}
}
}
}
function cloneDamageOverride( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, weapon, vPoint, vDir, sHitLoc, vDamageOrigin, timeOffset, boneIndex, modelIndex, surfaceType, surfaceNormal )
{
self thread _cloneDamaged();
if( weapon.isEmp && sMeansOfDeath == "MOD_GRENADE_SPLASH" )
{
ProcessCloneScoreEvent( self, eAttacker, weapon );
self notify( "clone_shutdown" );
}
if( isDefined( level.weaponLightningGun ) && weapon == level.weaponLightningGun )
{
ProcessCloneScoreEvent( self, eAttacker, weapon );
self notify( "clone_shutdown" );
}
supplyDrop = GetWeapon( "supplydrop" );
if( isDefined( supplyDrop ) && supplyDrop == weapon )
{
ProcessCloneScoreEvent( self, eAttacker, weapon );
self notify( "clone_shutdown" );
}
return iDamage;
}
function _CloneWatchOwnerDisconnect( player )
{
clone = self;
clone notify( "WatchCloneOwnerDisconnect" );
clone endon( "WatchCloneOwnerDisconnect" );
clone endon( "clone_shutdown" );
player util::waittill_any( "joined_team", "disconnect", "joined_spectators" );
if( isDefined( clone ) )
{
clone notify( "clone_shutdown" );
}
}
function _CloneWatchShutdown()
{
clone = self;
clone waittill( "clone_shutdown" );
removeClone( clone );
if( isdefined( clone ) )
{
if( !level.gameEnded ) // kill and do damage do nothing after game end
{
clone Kill();
}
else
{
clone stoploopsound();
self _PlayDematerialization();
clone hide();
}
}
}
function _CloneBreakGlass()
{
clone = self;
clone endon( "clone_shutdown" );
clone endon( "death" );
while( true )
{
clone util::break_glass();
wait 0.25;
}
}
function _CloneFakeFire()
{
clone = self;
clone endon( "clone_shutdown" );
clone endon( "death" );
while( true )
{
waitTime = RandomFloatRange( .5, 3 );
wait( waitTime );
shotsFired = RandomIntRange( 1, 4 );
if( isDefined( clone.fakeFireWeapon ) && ( clone.fakeFireWeapon != level.weaponnone ) )
{
players = GetPlayers();
foreach( player in players )
{
if( isDefined( player ) && isAlive( player ) && ( player getteam() != clone.team ) )
{
if( DistanceSquared( player.origin, clone.origin ) < ( 750 * 750 ) )
{
if( clone cansee( player ) )
{
clone FakeFire( clone.owner, clone.origin, clone.fakeFireWeapon, shotsFired );
break;
}
}
}
}
}
//clone SetFakeFire( true );
wait( shotsFired / 2 ); // Either fire number of shots or simulate firing that duration. May need to adjust this to get it even
clone SetFakeFire( false );
}
}
function _CloneSelectWeapon( player )
{
clone = self;
items = _CloneBuildItemList( player );
playerWeapon = player GetCurrentWeapon();
ball = GetWeapon( "ball" );
if( IsDefined( playerWeapon ) && IsDefined( ball ) && ( playerWeapon == ball ) )
{
weapon = ball;
}
else if( IsDefined( playerWeapon.worldModel ) && ( _TestPlayerWeapon( playerWeapon, items["primary"] ) ) )
{
weapon = playerWeapon;
}
else
{
if ( isdefined( level.onCloneSelectWeapon ) )
{
weapon = [[level.onCloneSelectWeapon]]( player );
}
else
{
weapon = undefined;
}
if ( !isdefined( weapon ) )
{
weapon = _ChooseWeapon( player );
}
}
if( isDefined( weapon ) )
{
clone shared::placeWeaponOn( weapon, "right" );
clone.fakeFireWeapon = weapon;
}
}
function _CloneBuildItemList( player )
{
pixbeginevent( "clone_build_item_list" );
items = [];
for( i = 0; i < 256; i++ )
{
row = tableLookupRowNum( level.statsTableID, 0, i );
if ( row > -1 )
{
slot = tableLookupColumnForRow( level.statsTableID, row, 13 );
if ( slot == "" )
{
continue;
}
number = Int( tableLookupColumnForRow( level.statsTableID, row, 0 ) );
if ( player IsItemLocked( number ) )
{
continue;
}
allocation = Int( tableLookupColumnForRow( level.statsTableID, row, 12 ) );
if ( allocation < 0 )
{
continue;
}
name = tableLookupColumnForRow( level.statsTableID, row, 3 );
if ( !isdefined( items[slot] ) )
{
items[slot] = [];
}
items[ slot ][ items[slot].size ] = name;
}
}
pixendevent();
return items;
}
function private _ChooseWeapon( player )
{
classNum = RandomInt( 10 );
for( i = 0; i < 10; i++ )
{
weapon = player GetLoadoutWeapon( ( i + classNum ) % 10, "primary" );
if( weapon != level.weaponnone )
{
break;
}
}
return weapon;
}
function private _TestPlayerWeapon( playerweapon, items )
{
if ( !isdefined( items ) || !items.size || !isdefined( playerweapon ) )
{
return false;
}
for( i = 0; i < items.size; i++ )
{
displayName = items[ i ];
if ( playerweapon.displayname == displayName )
{
return true;
}
}
return false;
}
@@ -0,0 +1,55 @@
#using scripts\codescripts\struct;
#using scripts\shared\duplicaterender_mgr;
Line truncated
#using scripts\shared\system_shared;
// Units per network frame. 0 < speed <= 1.0
function autoexec __init__sytem__() { system::register("gadget_clone_render",&__init__,undefined,undefined); }
function __init__()
{
duplicate_render::set_dr_filter_framebuffer( "clone_ally", 90,
"clone_ally_on", "clone_damage",
0, "mc/ability_clone_ally", 0 );
duplicate_render::set_dr_filter_framebuffer( "clone_enemy", 90,
"clone_enemy_on", "clone_damage",
0, "mc/ability_clone_enemy", 0 );
duplicate_render::set_dr_filter_framebuffer( "clone_damage_ally", 90,
"clone_ally_on,clone_damage", undefined,
0, "mc/ability_clone_ally_damage", 0 );
duplicate_render::set_dr_filter_framebuffer( "clone_damage_enemy", 90,
"clone_enemy_on,clone_damage", undefined,
0, "mc/ability_clone_enemy_damage", 0 );
}
#namespace gadget_clone_render;
function transition_shader( localClientNum )
{
self endon ( "entityshutdown" );
self endon ( "clone_shader_off" );
rampInShader = 0.0;
while( rampInShader < 1.0 )
{
if( isDefined( self ) )
{
self MapShaderConstant( localClientNum, 0, "scriptVector3", 1, rampInShader, 0, 0.04 );
}
rampInShader += .04;
{wait(.016);};
}
}
@@ -0,0 +1,25 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_combat_efficiency",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,111 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_combat_efficiency",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 15, &gadget_combat_efficiency_on_activate, &gadget_combat_efficiency_on_off );
ability_player::register_gadget_possession_callbacks( 15, &gadget_combat_efficiency_on_give, &gadget_combat_efficiency_on_take );
ability_player::register_gadget_flicker_callbacks( 15, &gadget_combat_efficiency_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 15, &gadget_combat_efficiency_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 15, &gadget_combat_efficiency_is_flickering );
ability_player::register_gadget_ready_callbacks( 15, &gadget_combat_efficiency_ready );
//callback::on_connect( &gadget_combat_efficiency_on_connect );
//callback::on_spawned( &gadget_combat_efficiency_on_spawn );
}
function gadget_combat_efficiency_is_inuse( slot )
{
// returns true when the gadget is on
return self GadgetIsActive( slot );
}
function gadget_combat_efficiency_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function gadget_combat_efficiency_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
}
function gadget_combat_efficiency_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
}
function gadget_combat_efficiency_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
}
//self is the player
function gadget_combat_efficiency_on_connect()
{
// setup up stuff on player connect
}
//self is the player
function gadget_combat_efficiency_on_spawn()
{
// setup up stuff on player spawn
self.combatEfficiencyLastOnTime = 0;
}
function gadget_combat_efficiency_on_activate( slot, weapon )
{
self._gadget_combat_efficiency = true;
self._gadget_combat_efficiency_success = false;
self.scoreStreaksEarnedPerUse = 0;
self.combatEfficiencyLastOnTime = getTime();
}
function gadget_combat_efficiency_on_off( slot, weapon )
{
self._gadget_combat_efficiency = false;
self.combatEfficiencyLastOnTime = getTime();
self addWeaponStat( self.heroAbility, "scorestreaks_earned_2", int( self.scoreStreaksEarnedPerUse / 2 ) );
self addWeaponStat( self.heroAbility, "scorestreaks_earned_3", int( self.scoreStreaksEarnedPerUse / 3 ) );
if ( IsAlive( self ) && isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon );
}
}
function gadget_combat_efficiency_ready( slot, weapon )
{
// unused
}
function set_gadget_combat_efficiency_status( weapon, status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Gadget Combat Efficiency " + weapon.name + ": " + status + timeStr );
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_concussive_wave",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,111 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_concussive_wave",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 27, &gadget_concussive_wave_on, &gadget_concussive_wave_off );
ability_player::register_gadget_possession_callbacks( 27, &gadget_concussive_wave_on_give, &gadget_concussive_wave_on_take );
ability_player::register_gadget_flicker_callbacks( 27, &gadget_concussive_wave_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 27, &gadget_concussive_wave_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 27, &gadget_concussive_wave_is_flickering );
ability_player::register_gadget_primed_callbacks( 27, &gadget_concussive_wave_is_primed );
callback::on_connect( &gadget_concussive_wave_on_connect );
}
function gadget_concussive_wave_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_concussive_wave_on" );
}
function gadget_concussive_wave_is_flickering( slot )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
return self [[level.cybercom.concussive_wave._is_flickering]](slot);
}
return false;
}
function gadget_concussive_wave_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
self [[level.cybercom.concussive_wave._on_flicker]](slot, weapon);
}
}
function gadget_concussive_wave_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
self [[level.cybercom.concussive_wave._on_give]](slot, weapon);
}
}
function gadget_concussive_wave_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
self [[level.cybercom.concussive_wave._on_take]](slot, weapon);
}
}
//self is the player
function gadget_concussive_wave_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
self [[level.cybercom.concussive_wave._on_connect]]();
}
}
function gadget_concussive_wave_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_concussive_wave_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
self [[level.cybercom.concussive_wave._on]](slot, weapon);
}
}
function gadget_concussive_wave_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_concussive_wave_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
self [[level.cybercom.concussive_wave._off]](slot, weapon);
}
}
function gadget_concussive_wave_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.concussive_wave))
{
self [[level.cybercom.concussive_wave._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,27 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_es_strike",&__init__,undefined,undefined); }
function __init__()
{
callback::on_spawned( &on_player_spawned );
}
function on_player_spawned( local_client_num )
{
}
@@ -0,0 +1,102 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_es_strike",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 33, &gadget_es_strike_on, &gadget_es_strike_off );
ability_player::register_gadget_possession_callbacks( 33, &gadget_es_strike_on_give, &gadget_es_strike_on_take );
ability_player::register_gadget_flicker_callbacks( 33, &gadget_es_strike_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 33, &gadget_es_strike_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 33, &gadget_es_strike_is_flickering );
callback::on_connect( &gadget_es_strike_on_connect );
}
function gadget_es_strike_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_es_strike_on" );
}
function gadget_es_strike_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.electro_strike))
{
return self [[level.cybercom.electro_strike._is_flickering]](slot);
}
}
function gadget_es_strike_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.electro_strike))
{
self [[level.cybercom.electro_strike._on_flicker]](slot, weapon);
}
}
function gadget_es_strike_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.electro_strike))
{
self [[level.cybercom.electro_strike._on_give]](slot, weapon);
}
}
function gadget_es_strike_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.electro_strike))
{
self [[level.cybercom.electro_strike._on_take]](slot, weapon);
}
}
//self is the player
function gadget_es_strike_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.electro_strike))
{
self [[level.cybercom.electro_strike._on_connect]]();
}
}
function gadget_es_strike_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_es_strike_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.electro_strike))
{
self [[level.cybercom.electro_strike._on]](slot, weapon);
}
}
function gadget_es_strike_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_es_strike_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.electro_strike))
{
self [[level.cybercom.electro_strike._off]](slot, weapon);
}
}
@@ -0,0 +1,22 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_exo_breakdown",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,108 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_exo_breakdown",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 20, &gadget_exo_breakdown_on, &gadget_exo_breakdown_off );
ability_player::register_gadget_possession_callbacks( 20, &gadget_exo_breakdown_on_give, &gadget_exo_breakdown_on_take );
ability_player::register_gadget_flicker_callbacks( 20, &gadget_exo_breakdown_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 20, &gadget_exo_breakdown_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 20, &gadget_exo_breakdown_is_flickering );
ability_player::register_gadget_primed_callbacks( 20, &gadget_exo_breakdown_is_primed );
callback::on_connect( &gadget_exo_breakdown_on_connect );
}
function gadget_exo_breakdown_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_exo_breakdown_on" );
}
function gadget_exo_breakdown_is_flickering( slot )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
return self [[level.cybercom.exo_breakdown._is_flickering]](slot);
}
return false;
}
function gadget_exo_breakdown_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
self [[level.cybercom.exo_breakdown._on_flicker]](slot, weapon);
}
}
function gadget_exo_breakdown_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
self [[level.cybercom.exo_breakdown._on_give]](slot, weapon);
}
}
function gadget_exo_breakdown_on_take( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
self [[level.cybercom.exo_breakdown._on_take]](slot, weapon);
}
}
//self is the player
function gadget_exo_breakdown_on_connect()
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
self [[level.cybercom.exo_breakdown._on_connect]]();
}
}
function gadget_exo_breakdown_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_exo_breakdown_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
self [[level.cybercom.exo_breakdown._on]](slot, weapon);
}
}
function gadget_exo_breakdown_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_exo_breakdown_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
self [[level.cybercom.exo_breakdown._off]](slot, weapon);
}
}
function gadget_exo_breakdown_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.exo_breakdown))
{
self [[level.cybercom.exo_breakdown._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,22 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_firefly_swarm",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,108 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_firefly_swarm",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 35, &gadget_firefly_swarm_on, &gadget_firefly_swarm_off );
ability_player::register_gadget_possession_callbacks( 35, &gadget_firefly_swarm_on_give, &gadget_firefly_swarm_on_take );
ability_player::register_gadget_flicker_callbacks( 35, &gadget_firefly_swarm_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 35, &gadget_firefly_swarm_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 35, &gadget_firefly_swarm_is_flickering );
ability_player::register_gadget_primed_callbacks( 35, &gadget_firefly_is_primed );
callback::on_connect( &gadget_firefly_swarm_on_connect );
}
function gadget_firefly_swarm_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_firefly_swarm_on" );
}
function gadget_firefly_swarm_is_flickering( slot )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
return self [[level.cybercom.firefly_swarm._is_flickering]](slot);
}
return false;
}
function gadget_firefly_swarm_on_flicker( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
self [[level.cybercom.firefly_swarm._on_flicker]](slot, weapon);
}
}
function gadget_firefly_swarm_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
self [[level.cybercom.firefly_swarm._on_give]](slot, weapon);
}
}
function gadget_firefly_swarm_on_take( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
self [[level.cybercom.firefly_swarm._on_take]](slot, weapon);
}
}
//self is the player
function gadget_firefly_swarm_on_connect()
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
self [[level.cybercom.firefly_swarm._on_connect]]();
}
}
function gadget_firefly_swarm_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_firefly_swarm_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
self [[level.cybercom.firefly_swarm._on]](slot, weapon);
}
}
function gadget_firefly_swarm_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_firefly_swarm_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
self [[level.cybercom.firefly_swarm._off]](slot, weapon);
}
}
function gadget_firefly_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.firefly_swarm))
{
self [[level.cybercom.firefly_swarm._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,137 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\system_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
function autoexec __init__sytem__() { system::register("gadget_flashback",&__init__,undefined,undefined); }
#precache( "client_fx", "player/fx_plyr_flashback_trail" );
#precache( "client_tagfxset", "gadget_flashback_3p_off" );
function __init__()
{
clientfield::register( "scriptmover", "flashback_trail_fx", 1, 1, "int", &set_flashback_trail_fx, !true, !true );
clientfield::register( "playercorpse", "flashback_clone", 1, 1, "int", &clone_flashback_changed, !true, !true );
clientfield::register( "allplayers", "flashback_activated" , 1, 1, "int", &flashback_activated, !true, !true );
visionset_mgr::register_overlay_info_style_postfx_bundle( "flashback_warp", 1, 1, "pstfx_flashback_warp", 0.8 );
duplicate_render::set_dr_filter_framebuffer( "flashback", 90, "flashback_on", "", 0, "mc/mtl_glitch", 0 );
}
function flashback_activated( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
self notify ( "player_flashback" );
player = GetLocalPlayer( localclientnum );
isFirstPerson = !IsThirdPerson( localclientnum ) && ( player == self );
if( newVal )
{
if( isFirstPerson )
{
self PlaySound( localclientnum, "mpl_flashback_reappear_plr" );
}
else
{
self endon( "entityshutdown" );
self util::waittill_dobj( localClientNum );
self PlaySound( localclientnum, "mpl_flashback_reappear_npc" );
PlayTagFXSet( localClientNum, "gadget_flashback_3p_off", self );
}
}
}
function set_flashback_trail_fx( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
player = GetLocalPlayer( localclientnum );
isFirstPerson = !IsThirdPerson( localclientnum ) && isDefined( self.owner ) && isDefined( player ) && ( self.owner == player );
if( newVal )
{
if( isFirstPerson )
{
player PlaySound( localclientnum, "mpl_flashback_disappear_plr" );
}
else
{
self endon( "entityshutdown" );
self util::waittill_dobj( localClientNum );
self PlaySound( localclientnum, "mpl_flashback_disappear_npc" );
PlayFxOnTag( localclientnum, "player/fx_plyr_flashback_demat", self, "tag_origin" );
PlayFxOnTag( localclientnum, "player/fx_plyr_flashback_trail", self, "tag_origin" );
}
}
}
function clone_flashback_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( newVal )
{
self clone_flashback_changed_event( localClientNum, newVal);
}
}
function clone_fade( localClientNum )
{
self endon ( "entityshutdown" );
startTime = GetServerTime( localClientnum );
while( true )
{
currentTime = GetServerTime( localClientnum );
elapsedTime = currentTime - startTime;
elapsedtime = float( elapsedtime / 1000 );
if( elapsedTime < 1.0 )
{
amount = 1.0 - elapsedTime / 1.0;
self MapShaderConstant( localClientNum, 0, "scriptVector3", 1, 1, 0, amount );
}
else
{
self MapShaderConstant( localClientNum, 0, "scriptVector3", 1, 1, 0, 0 );
break;
}
{wait(.016);};
}
}
function clone_flashback_changed_event( localClientNum, armorStatusNew )
{
if ( armorStatusNew )
{
self duplicate_render::set_dr_flag( "flashback_on", true );
self duplicate_render::update_dr_filters(localClientNum);
self clone_fade( localClientNum );
}
}
@@ -0,0 +1,281 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace flashback;
#precache( "fx", "player/fx_plyr_flashback_trail_impact" );
function autoexec __init__sytem__() { system::register("gadget_flashback",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "scriptmover", "flashback_trail_fx", 1, 1, "int" );
clientfield::register( "playercorpse", "flashback_clone" , 1, 1, "int" );
clientfield::register( "allplayers", "flashback_activated" , 1, 1, "int" );
ability_player::register_gadget_activation_callbacks( 16, &gadget_flashback_on, &gadget_flashback_off );
ability_player::register_gadget_possession_callbacks( 16, &gadget_flashback_on_give, &gadget_flashback_on_take );
ability_player::register_gadget_flicker_callbacks( 16, &gadget_flashback_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 16, &gadget_flashback_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 16, &gadget_flashback_is_flickering );
ability_player::register_gadget_primed_callbacks( 16, &gadget_flashback_is_primed );
callback::on_connect( &gadget_flashback_on_connect );
callback::on_spawned( &gadget_flashback_spawned );
if ( !IsDefined( level.vsmgr_prio_overlay_flashback_warp ) )
{
level.vsmgr_prio_overlay_flashback_warp = 27;
}
visionset_mgr::register_info( "overlay", "flashback_warp", 1, level.vsmgr_prio_overlay_flashback_warp, 1, true, &visionset_mgr::ramp_in_out_thread_per_player_death_shutdown, false );
}
function gadget_flashback_spawned()
{
self clientfield::set( "flashback_activated", 0 );
}
function gadget_flashback_is_inuse( slot )
{
// returns true when local script gadget state is on
return self flagsys::get( "gadget_flashback_on" );
}
function gadget_flashback_is_flickering( slot )
{
// returns true when local script gadget state is flickering
return self GadgetFlickering( slot );
}
function gadget_flashback_on_flicker( slot, weapon )
{
}
function gadget_flashback_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
}
function gadget_flashback_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
}
//self is the player
function gadget_flashback_on_connect()
{
// setup up stuff on player connect
}
function clone_watch_death()
{
self endon ( "death" );
wait( 1.0 );
// do not delete the clones
// player corpses should never get deleted
self clientfield::set( "flashback_clone", 0 );
self ghost();
}
/#
function debug_star( origin, seconds, color )
{
if ( !isdefined( seconds ) )
{
seconds = 1;
}
if ( !isdefined( color ) )
{
color = ( 1, 0, 0 );
}
frames = Int( 20 * seconds );
DebugStar( origin, frames, color );
}
#/
function drop_unlinked_grenades( linkedGrenades )
{
waittillframeend;
foreach( grenade in linkedGrenades )
{
grenade launch( (RandomFloatRange( -5, 5 ),RandomFloatRange( -5, 5 ),5) );
}
}
function unlink_grenades( oldpos )
{
radius = 32;
origin = oldpos;
grenades = getentarray( "grenade", "classname" );
radiusSq = radius * radius;
linkedGrenades = [];
foreach( grenade in grenades )
{
if( DistanceSquared( origin, grenade.origin ) < radiusSq )
{
if ( IsDefined( grenade.stuckToPlayer ) && ( grenade.stuckToPlayer == self ) )
{
grenade unlink();
linkedGrenades[linkedGrenades.size] = grenade;
}
}
}
thread drop_unlinked_grenades( linkedGrenades );
}
function gadget_flashback_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_flashback_on" );
self GadgetSetActivateTime( slot, GetTime() );
visionset_mgr::activate( "overlay", "flashback_warp", self, 0.8, 0.8 );
self.flashbackTime = GetTime();
self notify("flashback");
clone = self CreateFlashbackClone();
clone thread clone_watch_death();
clone clientfield::set( "flashback_clone", 1 );
self thread watchClientfields();
oldpos = self GetTagOrigin( "j_spineupper" );
offset = oldpos - self.origin;
self unlink_grenades( oldpos );
newpos = self flashbackstart( weapon ) + offset;
self NotSolid();
if ( isdefined ( newpos ) && isdefined ( oldpos ) )
{
self thread flashbackTrailFx( slot, weapon, oldpos, newpos );
flashbackTrailImpact( newpos, oldpos, 8 );
flashbackTrailImpact( oldpos, newpos, 8 );
if ( isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon, "flashbackSuccessDelay" );
}
}
self thread deactivateFlashbackWarpAfterTime( 0.8 );
}
function watchClientfields()
{
self endon ( "death" );
self endon ( "disconnect" );
util::wait_network_frame();
self clientfield::set( "flashback_activated", 1 );
util::wait_network_frame();
self clientfield::set( "flashback_activated", 0 );
}
function flashBackTrailImpact( startPos, endPos, recursionDepth )
{
recursionDepth--;
if ( recursionDepth <= 0 )
{
return;
}
trace = BulletTrace( startPos, endPos, false, self );
if ( trace[ "fraction" ] < 1.0 && trace[ "normal" ] != ( 0,0,0 ) )
{
PlayFx( "player/fx_plyr_flashback_trail_impact", trace[ "position" ], trace[ "normal" ] );
newStartPos = trace[ "position" ] - trace[ "normal" ];
/#
// debug_star( trace[ "position" ], 100 );
#/
flashBackTrailImpact( newStartPos, endPos, recursionDepth );
}
}
function deactivateFlashbackWarpAfterTime( time )
{
self endon( "disconnect" );
self util::waittill_any_timeout( time, "death" );
visionset_mgr::deactivate( "overlay", "flashback_warp", self );
}
function flashbackTrailFx( slot, weapon, oldpos, newPos )
{
dirVec = newPos - oldPos;
if ( dirVec == (0,0,0) )
{
dirVec = (0,0,1);
}
dirVec = VectorNormalize( dirVec );
angles = VectorToAngles( dirVec );
fxOrg = spawn( "script_model", oldpos, 0, angles );
fxOrg.angles = angles;
fxOrg setowner( self );
fxOrg SetModel( "tag_origin" );
fxOrg clientfield::set( "flashback_trail_fx", 1 );
util::wait_network_frame();
tagPos = self GetTagOrigin( "j_spineupper" );
fxOrg MoveTo( tagPos, 0.1 );
fxOrg waittill( "movedone" );
wait( 1 );
fxOrg clientfield::set( "flashback_trail_fx", 0 );
util::wait_network_frame();
fxOrg delete();
}
function gadget_flashback_is_primed( slot, weapon )
{
}
function gadget_flashback_off( slot, weapon )
{
// excecutes when the gadget is turned off
self flagsys::clear( "gadget_flashback_on" );
self Solid();
self flashbackfinish();
if( level.gameEnded )
{
self FreezeControls( true );
}
}
Whitespace-only changes.
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_forced_malfunction",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,112 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_forced_malfunction",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 26, &gadget_forced_malfunction_on, &gadget_forced_malfunction_off );
ability_player::register_gadget_possession_callbacks( 26, &gadget_forced_malfunction_on_give, &gadget_forced_malfunction_on_take );
ability_player::register_gadget_flicker_callbacks( 26, &gadget_forced_malfunction_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 26, &gadget_forced_malfunction_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 26, &gadget_forced_malfunction_is_flickering );
ability_player::register_gadget_primed_callbacks( 26, &gadget_forced_malfunction_is_primed );
callback::on_connect( &gadget_forced_malfunction_on_connect );
}
function gadget_forced_malfunction_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_forced_malfunction_on" );
}
function gadget_forced_malfunction_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
return self [[level.cybercom.forced_malfunction._is_flickering]](slot);
}
return false;
}
function gadget_forced_malfunction_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
self [[level.cybercom.forced_malfunction._on_flicker]](slot, weapon);
}
}
function gadget_forced_malfunction_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
self [[level.cybercom.forced_malfunction._on_give]](slot, weapon);
}
}
function gadget_forced_malfunction_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
self [[level.cybercom.forced_malfunction._on_take]](slot, weapon);
}
}
//self is the player
function gadget_forced_malfunction_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
self [[level.cybercom.forced_malfunction._on_connect]]();
}
}
function gadget_forced_malfunction_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_forced_malfunction_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
self [[level.cybercom.forced_malfunction._on]](slot, weapon);
}
}
function gadget_forced_malfunction_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_forced_malfunction_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
self [[level.cybercom.forced_malfunction._off]](slot, weapon);
}
}
function gadget_forced_malfunction_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.forced_malfunction))
{
self [[level.cybercom.forced_malfunction._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,231 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\postfx_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\_burnplayer;
Line truncated
// This does more traces accordingly.
#precache( "client_fx", "player/fx_plyr_heat_wave" );
#precache( "client_fx", "player/fx_plyr_heat_wave_1p" );
#precache( "client_fx", "player/fx_plyr_heat_wave_distortion_volume" );
#precache( "client_fx", "player/fx_plyr_heat_wave_distortion_volume_air" );
#precache( "client_tagfxset", "ability_hero_heat_wave_player_impact" );
function autoexec __init__sytem__() { system::register("gadget_heat_wave",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "scriptmover", "heatwave_fx", 1, 1, "int", &set_heatwave_fx, !true, !true );
clientfield::register( "allplayers", "heatwave_victim", 1, 1, "int", &update_victim, !true, !true );
clientfield::register( "toplayer", "heatwave_activate", 1, 1, "int", &update_activate, !true, !true );
level.debug_heat_wave_traces = GetDvarInt( "scr_debug_heat_wave_traces", 0 );
visionset_mgr::register_visionset_info( "heatwave", 1, 16, undefined, "heatwave" );
visionset_mgr::register_visionset_info( "charred", 1, 16, undefined, "charred" );
/#
level thread updateDvars();
#/
}
/#
function updateDvars()
{
while(1)
{
level.debug_heat_wave_traces = GetDvarInt( "scr_debug_heat_wave_traces", level.debug_heat_wave_traces );
wait(1.0);
}
}
#/
function update_activate( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if( newVal )
{
self thread postfx::PlayPostfxBundle( "pstfx_heat_pulse" );
}
}
function update_victim( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if( newVal )
{
self endon( "entityshutdown" );
self util::waittill_dobj( localClientNum );
self PlayRumbleOnEntity( localClientNum, "heat_wave_damage" );
PlayTagFXSet( localClientNum, "ability_hero_heat_wave_player_impact", self );
}
}
function set_heatwave_fx( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
self clear_heat_wave_fx( localClientNum );
if( newVal )
{
self.heatWaveFx = [];
self thread aoe_fx( localClientNum );
}
}
function clear_heat_wave_fx( localClientNum )
{
if( !isDefined( self.heatWaveFx ) )
{
return;
}
foreach( fx in self.heatWaveFx )
{
StopFx( localClientNum, fx );
}
}
function aoe_fx( localClientNum )
{
self endon ( "entityshutdown" );
center = self.origin + ( 0, 0, 30 );
startPitch = -90;
yaw_count = [];
yaw_count[ 0 ] = 1;
yaw_count[ 1 ] = 4;
yaw_count[ 2 ] = 6;
yaw_count[ 3 ] = 8;
yaw_count[ 4 ] = 6;
yaw_count[ 5 ] = 4;
yaw_count[ 6 ] = 1;
pitch_vals = [];
pitch_vals[0] = 90;
pitch_vals[3] = 0;
pitch_vals[6] = -90;
trace = bullettrace( center, center + ( 0, 0, -1 ) * 400, false, self );
if ( trace["fraction"] < 1.0 )
{
pitch_vals[1] = 90 - atan( 150 / ( trace["fraction"] * 400 ) ); // evenly spaced 200 units away
pitch_vals[2] = 90 - atan( 300 / ( trace["fraction"] * 400 ) );
}
else
{
pitch_vals[1] = 60;
pitch_vals[2] = 30;
}
trace = bullettrace( center, center + ( 0, 0, 1 ) * 400, false, self );
if ( trace["fraction"] < 1.0 )
{
pitch_vals[5] = -90 + atan( 150 / ( trace["fraction"] * 400 ) ); // evenly spaced 200 units away
pitch_vals[4] = -90 + atan( 300 / ( trace["fraction"] * 400 ) );
}
else
{
pitch_vals[5] = -60;
pitch_vals[4] = -30;
}
currentPitch = startPitch;
for ( yaw_level = 0; yaw_level < yaw_count.size; yaw_level++ )
{
currentPitch = pitch_vals[yaw_level];
do_fx( localClientNum, center, yaw_count[yaw_level], currentPitch );
}
}
function do_fx( localClientNum, center, yaw_count, pitch )
{
currentYaw = RandomInt( 360 );
for( fxCount = 0; fxCount < yaw_count; fxCount++ )
{
randomOffsetPitch = RandomInt( 5 ) - 2.5;
randomOffsetYaw = RandomInt( 30 ) - 15;
angles = ( pitch + randomOffsetPitch, currentYaw + randomOffsetYaw, 0 );
traceDir = AnglesToForward( angles );
currentYaw += 360 / yaw_count;
fx_position = center + traceDir * 400;
trace = bullettrace( center, fx_position, false, self );
sphere_size = 5;
angles = ( 0, RandomInt( 360 ), 0 );
forward = AnglesToForward( angles );
if ( trace["fraction"] < 1.0 )
{
fx_position = center + traceDir * 400 * trace["fraction"];
/#
if( level.debug_heat_wave_traces )
{
Sphere( fx_position, sphere_size, ( 1, 0, 1 ), 1, true, 8, 300 );
Sphere( trace["position"], sphere_size, ( 1, 1, 0 ), 1, true, 8, 300 );
}
#/
normal = trace["normal"];
if ( LengthSquared( normal ) == 0 )
{
normal = -1 * traceDir;
}
right = ( normal[2] * -1, normal[1] * -1, normal[0] );
if( LengthSquared( VectorCross( forward, normal ) ) == 0 )
{
forward = VectorCross( right, forward );
}
self.heatWaveFx[self.heatWaveFx.size] = PlayFx( localClientNum, "player/fx_plyr_heat_wave_distortion_volume", trace["position"], normal, forward );
}
else
{
/#
if( level.debug_heat_wave_traces )
{
Line( fx_position + ( 0,0,50 ), fx_position - ( 0,0,50 ), ( 1, 0, 0 ), 1, false, 300 );
Sphere( fx_position, sphere_size, ( 1, 0, 1 ), 1, true, 8, 300 );
}
#/
if( LengthSquared( VectorCross( forward, traceDir * -1 ) ) == 0 )
{
forward = VectorCross( right, forward );
}
self.heatWaveFx[self.heatWaveFx.size] = PlayFx( localClientNum, "player/fx_plyr_heat_wave_distortion_volume_air", fx_position, traceDir * -1, forward );
}
if( fxCount % 2 )
{
{wait(.016);};
}
}
}
@@ -0,0 +1,500 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\weapons\_weaponobjects;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_gadgets;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\_burnplayer;
Line truncated
#namespace heat_wave;
function autoexec __init__sytem__() { system::register("gadget_heat_wave",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 41, &gadget_heat_wave_on_activate, &gadget_heat_wave_on_deactivate );
ability_player::register_gadget_possession_callbacks( 41, &gadget_heat_wave_on_give, &gadget_heat_wave_on_take );
ability_player::register_gadget_flicker_callbacks( 41, &gadget_heat_wave_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 41, &gadget_heat_wave_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 41, &gadget_heat_wave_is_flickering );
callback::on_connect( &gadget_heat_wave_on_connect );
callback::on_spawned( &gadget_heat_wave_on_player_spawn );
clientfield::register( "scriptmover", "heatwave_fx", 1, 1, "int" );
clientfield::register( "allplayers", "heatwave_victim", 1, 1, "int" );
clientfield::register( "toplayer", "heatwave_activate", 1, 1, "int" );
if ( !IsDefined( level.vsmgr_prio_visionset_heatwave_activate ) )
{
level.vsmgr_prio_visionset_heatwave_activate = 52;
}
if ( !IsDefined( level.vsmgr_prio_visionset_heatwave_charred ) )
{
level.vsmgr_prio_visionset_heatwave_charred = 53;
}
visionset_mgr::register_info( "visionset", "heatwave", 1, level.vsmgr_prio_visionset_heatwave_activate, 16, true, &visionset_mgr::ramp_in_out_thread_per_player_death_shutdown, false );
visionset_mgr::register_info( "visionset", "charred", 1, level.vsmgr_prio_visionset_heatwave_charred, 16, true, &visionset_mgr::ramp_in_out_thread_per_player_death_shutdown, false );
/#
//level thread updateDvars();
#/
}
function updateDvars()
{
while(1)
{
wait(1.0);
}
}
function gadget_heat_wave_is_inuse( slot )
{
// returns true when local script gadget state is on
return self GadgetIsActive( slot );
}
function gadget_heat_wave_is_flickering( slot )
{
// returns true when local script gadget state is flickering
return self GadgetFlickering( slot );
}
function gadget_heat_wave_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
self thread gadget_heat_wave_flicker( slot, weapon );
}
function gadget_heat_wave_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
}
function gadget_heat_wave_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
self clientfield::set_to_player( "heatwave_activate", 0 );
}
//self is the player
function gadget_heat_wave_on_connect()
{
// setup up stuff on player connec
}
function gadget_heat_wave_on_player_spawn()
{
// setup up stuff on player spawned
self clientfield::set( "heatwave_victim", 0 );
self._heat_wave_stuned_end = 0;
self._heat_wave_stunned_by = undefined;
self thread watch_entity_shutdown();
}
function watch_entity_shutdown()
{
self endon ( "disconnect" );
self waittill( "death" );
if ( self IsRemoteControlling() == false )
{
visionset_mgr::deactivate( "visionset", "charred", self );
visionset_mgr::deactivate( "visionset", "heatwave", self );
}
}
function gadget_heat_wave_on_activate( slot, weapon )
{
self PlayRumbleOnEntity( "heat_wave_activate" );
self thread toggle_activate_clientfields();
visionset_mgr::activate( "visionset", "heatwave", self, ( .01 ), ( 0.1 ), ( 1.1 ) );
self thread heat_wave_think( slot, weapon );
}
function toggle_activate_clientfields()
{
self endon ( "death" );
self endon ( "disconnect" );
self clientfield::set_to_player( "heatwave_activate", 1 );
util::wait_network_frame();
self clientfield::set_to_player( "heatwave_activate", 0 );
}
function gadget_heat_wave_on_deactivate( slot, weapon )
{
}
function gadget_heat_wave_flicker( slot, weapon )
{
}
function set_gadget_status( status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Gadget Heat Wave: " + status + timeStr );
}
function is_entity_valid( entity, heatwave )
{
if( !IsPlayer( entity ) )
{
return false;
}
if( self GetEntityNumber() == entity GetEntityNumber() )
{
return false;
}
if ( !IsAlive( entity ) )
{
return false;
}
if ( !( entity util::mayApplyScreenEffect() ) )
{
return false;
}
if( !heat_wave_trace_entity( entity, heatwave ) )
{
return false;
}
return true;
}
function heat_wave_trace_entity( entity, heatwave )
{
entityPoint = entity.origin + ( 0, 0, 50 );
if ( !BulletTracePassed( heatwave.origin, entityPoint, true, self, undefined, false, true ) )
{
return false;
}
/#
thread util::draw_debug_line( heatwave.origin, entityPoint, 1 );
#/
return true;
}
function heat_wave_fx_cleanup( fxOrg, direction )
{
self util::waittill_any( "heat_wave_think", "heat_wave_think_finished" );
if( isDefined( fxOrg ) )
{
fxOrg StopLoopSound();
fxOrg PlaySound( "gdt_heatwave_dissipate" );
fxOrg clientfield::set( "heatwave_fx", 0 );
fxOrg delete();
}
}
function heat_wave_fx( origin, direction )
{
if ( direction == (0,0,0) )
{
direction = (0,0,1);
}
dirVec = VectorNormalize( direction );
angles = VectorToAngles( dirVec );
fxOrg = spawn( "script_model", origin+(0,0,-30), 0, angles );
fxOrg.angles = angles;
fxOrg setowner( self );
fxOrg SetModel( "tag_origin" );
fxOrg clientfield::set( "heatwave_fx", 1 );
fxOrg PlayLoopSound( "gdt_heatwave_3p_loop" );
fxOrg.soundMod = "heatwave";
fxOrg.hitsomething = false;
self thread heat_wave_fx_cleanup( fxOrg, direction );
return fxOrg;
}
function heat_wave_setup( weapon )
{
heatwave = spawnStruct();
heatwave.radius = weapon.gadget_shockfield_radius;
heatwave.origin = self geteye();
heatwave.direction = AnglesToForward( self GetPlayerAngles() );
heatwave.up = AnglesToUp( self GetPlayerAngles() );
heatwave.fxOrg = heat_wave_fx( heatwave.origin, heatwave.direction );
return heatwave;
}
function heat_wave_think( slot, weapon )
{
self endon( "disconnect" );
self notify ( "heat_wave_think" );
self endon( "heat_wave_think" );
self.heroAbilityActive = true;
heatwave = heat_wave_setup( weapon );
GlassRadiusDamage( heatwave.origin, heatwave.radius, 400, 400, "MOD_BURNED" );
self thread heat_wave_damage_entities( weapon, heatwave );
self thread heat_wave_damage_projectiles( weapon, heatwave );
wait( 250 / 1000 );
self.heroAbilityActive = false;
self notify( "heat_wave_think_finished" );
}
function heat_wave_damage_entities( weapon, heatwave )
{
self endon( "disconnect" );
self endon( "heat_wave_think" );
startTime = getTime();
burnedEnemy = false;
while( 250 + startTime > getTime() )
{
entities = GetDamageableEntArray( heatwave.origin, heatwave.radius, true );
foreach( entity in entities )
{
if( isDefined( entity._heat_wave_damaged_time ) && ( entity._heat_wave_damaged_time + 250 + 1 > getTime() ) )
{
continue;
}
if( is_entity_valid( entity, heatwave ) )
{
burnedEnemy |= heat_wave_burn_entities( weapon, entity, heatwave );
}
else if( !isPlayer( entity ) )
{
entity DoDamage( 1, heatwave.origin, self, self, "none", "MOD_BURNED", 0, weapon );
entity thread update_last_burned_by( heatwave );
}
}
{wait(.05);};
}
if ( IsAlive( self ) && ( isdefined( burnedEnemy ) && burnedEnemy ) && isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon, "heatwaveSuccessDelay" );
}
}
function heat_wave_burn_entities( weapon, entity, heatwave )
{
burn_self = false;
burn_entity = true;
burned_enemy = true;
if( ( self.team == entity.team ) )
{
burned_enemy = false;
switch ( level.friendlyfire )
{
case 0: // no FF
burn_entity = false;
break;
case 1: // FF
// burns ally
break;
case 2: // reflect
burn_entity = false;
burn_self = true;
break;
case 3: // share (both)
burn_self = true;
break;
}
}
if( burn_entity )
{
apply_burn( weapon, entity, heatwave );
entity thread update_last_burned_by( heatwave );
}
if( burn_self )
{
apply_burn( weapon, self, heatwave );
self thread update_last_burned_by( heatwave );
}
return burned_enemy;
}
function heat_wave_damage_projectiles( weapon, heatwave )
{
self endon( "disconnect" );
self endon( "heat_wave_think" );
owner = self;
startTime = getTime();
while( 250 + startTime > getTime() )
{
if ( level.missileEntities.size < 1 )
{
{wait(.05);};
continue;
}
for ( index=0; index < level.missileEntities.size; index++ )
{
{wait(.05);};
grenade = level.missileEntities[index];
if ( !isdefined (grenade ) )
continue;
if ( grenade.weapon.isTacticalInsertion )
{
// tagTMR<NOTE>: trophy systems will attack the scriptmover not the invisible ET_MISSILE for tac inserts
continue;
}
switch( grenade.model )
{
case "t6_wpn_grenade_supply_projectile":
continue;
}
if ( !isdefined( grenade.owner ) )
{
grenade.owner = GetMissileOwner( grenade );
}
if ( isdefined( grenade.owner ))
{
if ( level.teamBased )
{
if ( grenade.owner.team == owner.team )
{
continue;
}
}
else
{
if ( grenade.owner == owner )
{
continue;
}
}
grenadeDistanceSquared = DistanceSquared( grenade.origin, heatwave.origin );
if ( grenadeDistanceSquared < ( heatwave.radius * heatwave.radius ))
{
if ( BulletTracePassed( grenade.origin, heatwave.origin + ( 0, 0, 29 ), false, owner, grenade, false, true ) )
{
owner projectileExplode( grenade, heatwave, weapon );
index--;
}
}
}
}
}
}
function projectileExplode( projectile, heatwave, weapon ) // self == trophy owning player
{
projPosition = projectile.origin;
playFX( level.trophyDetonationFX, projPosition );
projectile notify ( "trophy_destroyed" );
self RadiusDamage( projPosition, 128, 105, 10, self, "MOD_BURNED", weapon );
projectile delete();
}
function apply_burn( weapon, entity, heatwave )
{
damage = floor( entity.health * .2 );
entity DoDamage( damage, self.origin + ( 0, 0, 30 ), self, heatwave.fxOrg, 0, "MOD_BURNED", 0, weapon );
entity setdoublejumpenergy( 0 );
entity clientfield::set( "heatwave_victim", 1 );
visionset_mgr::activate( "visionset", "charred", entity, ( .01 ), ( 2 ), ( 1.5 ) );
entity thread watch_burn_clear();
entity resetdoublejumprechargetime();
shellshock_duration = 2.5;
entity._heat_wave_stuned_end = getTime() + ( shellshock_duration * 1000 );
if(!isdefined(entity._heat_wave_stunned_by))entity._heat_wave_stunned_by=[];
entity._heat_wave_stunned_by[self.clientid] = entity._heat_wave_stuned_end;
entity shellshock( "heat_wave", shellshock_duration, true );
entity thread heat_wave_burn_sound(shellshock_duration);
burned = true;
}
function watch_burn_clear()
{
self endon ("disconnect");
self endon ("death");
util::wait_network_frame();
self clientfield::set( "heatwave_victim", 0 );
}
function update_last_burned_by( heatwave )
{
self endon ( "disconnect" );
self endon ( "death" );
self._heat_wave_damaged_time = getTime();
wait( 250 );
}
function heat_wave_burn_sound(shellshock_duration)
{
fire_sound_ent = spawn( "script_origin", self.origin );
fire_sound_ent linkto( self, "tag_origin", (0,0,0), (0,0,0) );
fire_sound_ent playloopsound ("mpl_heatwave_burn_loop");
wait( shellshock_duration );
if ( isdefined( fire_sound_ent ) )
{
fire_sound_ent StopLoopSound( .5 );
util::wait_network_frame();
fire_sound_ent delete();
}
}
@@ -0,0 +1,15 @@
// Name of the visionset file
// alias in script
// priority vs other visionsets
// number of steps when ramping in/out
// activation ramp-in time
// How long to hold after ramp-in is done and before ramping-out
// deactivation ramp-out time
// Name of the visionset file
// alias in script
// priority vs other visionsets
// number of steps when ramping in/out
// activation ramp-in time
// How long to hold after ramp-in is done and before ramping-out
// deactivation ramp-out time
@@ -0,0 +1,25 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_hero_weapon",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,219 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
#precache( "eventstring", "hero_weapon_received" );
function autoexec __init__sytem__() { system::register("gadget_hero_weapon",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 14, &gadget_hero_weapon_on_activate, &gadget_hero_weapon_on_off );
ability_player::register_gadget_possession_callbacks( 14, &gadget_hero_weapon_on_give, &gadget_hero_weapon_on_take );
ability_player::register_gadget_flicker_callbacks( 14, &gadget_hero_weapon_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 14, &gadget_hero_weapon_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 14, &gadget_hero_weapon_is_flickering );
ability_player::register_gadget_ready_callbacks( 14, &gadget_hero_weapon_ready );
//callback::on_connect( &gadget_hero_weapon_on_connect );
//callback::on_spawned( &gadget_hero_weapon_on_spawn );
}
function gadget_hero_weapon_is_inuse( slot )
{
// returns true when the gadget is on
return self GadgetIsActive( slot );
}
function gadget_hero_weapon_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function gadget_hero_weapon_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
}
function gadget_hero_weapon_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if ( !isdefined( self.pers["held_hero_weapon_ammo_count"] ) )
{
self.pers["held_hero_weapon_ammo_count"] = [];
}
if( weapon.gadget_power_consume_on_ammo_use || !isdefined( self.pers["held_hero_weapon_ammo_count"][weapon] ) )
{
self.pers["held_hero_weapon_ammo_count"][weapon] = 0;
}
self SetWeaponAmmoClip( weapon, self.pers["held_hero_weapon_ammo_count"][weapon] );
n_ammo = self GetAmmoCount( weapon );
if ( n_ammo > 0 )
{
stock = self.pers["held_hero_weapon_ammo_count"][weapon] - n_ammo;
if ( stock > 0 && !weapon.isClipOnly )
{
self SetWeaponAmmoStock( weapon, stock );
}
self hero_handle_ammo_save( slot, weapon );
}
else
{
self GadgetCharging( slot, true );
}
}
function gadget_hero_weapon_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
}
//self is the player
function gadget_hero_weapon_on_connect()
{
// setup up stuff on player connect
}
//self is the player
function gadget_hero_weapon_on_spawn()
{
// setup up stuff on player spawn
}
function gadget_hero_weapon_on_activate( slot, weapon )
{
// excecutes when the gadget is turned on
self.heroweaponKillCount = 0;
self.heroweaponShots = 0;
self.heroweaponHits = 0;
if ( !weapon.gadget_power_consume_on_ammo_use )
{
self hero_give_ammo( slot, weapon );
self hero_handle_ammo_save( slot, weapon );
}
}
function gadget_hero_weapon_on_off( slot, weapon )
{
if ( weapon.gadget_power_consume_on_ammo_use )
{
self SetWeaponAmmoClip( weapon, 0 );
}
}
function gadget_hero_weapon_ready( slot, weapon )
{
if ( weapon.gadget_power_consume_on_ammo_use )
{
hero_give_ammo( slot, weapon );
}
}
function hero_give_ammo( slot, weapon )
{
self GiveMaxAmmo( weapon );
self SetWeaponAmmoClip( weapon, weapon.clipSize );
}
function hero_handle_ammo_save( slot, weapon )
{
self thread hero_wait_for_out_of_ammo( slot, weapon );
self thread hero_wait_for_game_end( slot, weapon );
self thread hero_wait_for_death( slot, weapon );
}
function hero_wait_for_game_end( slot, weapon )
{
self endon( "disconnect" );
self notify( "hero_ongameend" );
self endon( "hero_ongameend" );
level waittill("game_ended");
if ( IsAlive( self ) )
{
self hero_save_ammo( slot, weapon );
}
}
function hero_wait_for_death( slot, weapon )
{
self endon( "disconnect" );
self notify( "hero_ondeath" );
self endon( "hero_ondeath" );
self waittill( "death" );
self hero_save_ammo( slot, weapon );
}
function hero_save_ammo( slot, weapon )
{
self.pers["held_hero_weapon_ammo_count"][weapon] = self GetAmmoCount( weapon );
}
function hero_wait_for_out_of_ammo( slot, weapon )
{
self endon( "disconnect" );
self endon( "death" );
self notify( "hero_noammo" );
self endon( "hero_noammo" );
while( 1 )
{
wait ( 0.1 );
n_ammo = self GetAmmoCount( weapon );
if ( n_ammo == 0 )
{
break;
}
}
self GadgetPowerReset( slot );
self GadgetCharging( slot, true );
}
function set_gadget_hero_weapon_status( weapon, status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Hero Weapon " + weapon.name + ": " + status + timeStr );
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_iff_override",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,107 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_iff_override",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 24, &gadget_iff_override_on, &gadget_iff_override_off );
ability_player::register_gadget_possession_callbacks( 24, &gadget_iff_override_on_give, &gadget_iff_override_on_take );
ability_player::register_gadget_flicker_callbacks( 24, &gadget_iff_override_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 24, &gadget_iff_override_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 24, &gadget_iff_override_is_flickering );
ability_player::register_gadget_primed_callbacks( 24, &gadget_iff_override_is_primed );
callback::on_connect( &gadget_iff_override_on_connect );
}
function gadget_iff_override_is_inuse( slot )
{
return self flagsys::get( "gadget_iff_override_on" );
}
function gadget_iff_override_is_flickering( slot )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
return self [[level.cybercom.iff_override._is_flickering]](slot);
}
return false;
}
function gadget_iff_override_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
self [[level.cybercom.iff_override._on_flicker]](slot, weapon);
}
}
function gadget_iff_override_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
self [[level.cybercom.iff_override._on_give]](slot, weapon);
}
}
function gadget_iff_override_on_take( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
self [[level.cybercom.iff_override._on_take]](slot, weapon);
}
}
//self is the player
function gadget_iff_override_on_connect()
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
self [[level.cybercom.iff_override._on_connect]]();
}
}
function gadget_iff_override_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_iff_override_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
self [[level.cybercom.iff_override._on]](slot, weapon);
}
}
function gadget_iff_override_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_iff_override_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
self [[level.cybercom.iff_override._off]](slot, weapon);
}
}
function gadget_iff_override_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.iff_override))
{
self [[level.cybercom.iff_override._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_immolation",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,115 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_immolation",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 34, &gadget_immolation_on, &gadget_immolation_off );
ability_player::register_gadget_possession_callbacks( 34, &gadget_immolation_on_give, &gadget_immolation_on_take );
ability_player::register_gadget_flicker_callbacks( 34, &gadget_immolation_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 34, &gadget_immolation_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 34, &gadget_immolation_is_flickering );
ability_player::register_gadget_primed_callbacks( 34, &gadget_immolation_is_primed );
callback::on_connect( &gadget_immolation_on_connect );
}
function gadget_immolation_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_immolation_on" );
}
function gadget_immolation_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
return self [[level.cybercom.immolation._is_flickering]](slot);
}
return false;
}
function gadget_immolation_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
self [[level.cybercom.immolation._on_flicker]](slot, weapon);
}
}
function gadget_immolation_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
self [[level.cybercom.immolation._on_give]](slot, weapon);
}
}
function gadget_immolation_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
self [[level.cybercom.immolation._on_take]](slot, weapon);
}
}
//self is the player
function gadget_immolation_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
self [[level.cybercom.immolation._on_connect]]();
}
}
function gadget_immolation_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_immolation_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
self [[level.cybercom.immolation._on]](slot, weapon);
}
}
function gadget_immolation_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_immolation_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
self [[level.cybercom.immolation._off]](slot, weapon);
}
}
function gadget_immolation_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.immolation))
{
self [[level.cybercom.immolation._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_misdirection",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,113 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_misdirection",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 37, &gadget_misdirection_on, &gadget_misdirection_off );
ability_player::register_gadget_possession_callbacks( 37, &gadget_misdirection_on_give, &gadget_misdirection_on_take );
ability_player::register_gadget_flicker_callbacks( 37, &gadget_misdirection_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 37, &gadget_misdirection_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 37, &gadget_misdirection_is_flickering );
ability_player::register_gadget_primed_callbacks( 37, &gadget_misdirection_is_primed );
callback::on_connect( &gadget_misdirection_on_connect );
}
function gadget_misdirection_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_misdirection_on" );
}
function gadget_misdirection_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
return self [[level.cybercom.misdirection._is_flickering]](slot);
}
return false;
}
function gadget_misdirection_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
self [[level.cybercom.misdirection._on_flicker]](slot, weapon);
}
}
function gadget_misdirection_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
self [[level.cybercom.misdirection._on_give]](slot, weapon);
}
}
function gadget_misdirection_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
self [[level.cybercom.misdirection._on_take]](slot, weapon);
}
}
//self is the player
function gadget_misdirection_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
self [[level.cybercom.misdirection._on_connect]]();
}
}
function gadget_misdirection_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_misdirection_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
self [[level.cybercom.misdirection._on]](slot, weapon);
}
}
function gadget_misdirection_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_misdirection_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
self [[level.cybercom.misdirection._off]](slot, weapon);
}
}
function gadget_misdirection_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.misdirection))
{
self [[level.cybercom.misdirection._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_es_strike",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,109 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_mrpukey",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 38, &gadget_mrpukey_on, &gadget_mrpukey_off );
ability_player::register_gadget_possession_callbacks( 38, &gadget_mrpukey_on_give, &gadget_mrpukey_on_take );
ability_player::register_gadget_flicker_callbacks( 38, &gadget_mrpukey_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 38, &gadget_mrpukey_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 38, &gadget_mrpukey_is_flickering );
ability_player::register_gadget_primed_callbacks( 38, &gadget_mrpukey_is_primed );
}
function gadget_mrpukey_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_mrpukey_on" );
}
function gadget_mrpukey_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
return self [[level.cybercom.mrpukey._is_flickering]](slot);
}
}
function gadget_mrpukey_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
self [[level.cybercom.mrpukey._on_flicker]](slot, weapon);
}
}
function gadget_mrpukey_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
self [[level.cybercom.mrpukey._on_give]](slot, weapon);
}
}
function gadget_mrpukey_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
self [[level.cybercom.mrpukey._on_take]](slot, weapon);
}
}
//self is the player
function gadge_mrpukey_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
self [[level.cybercom.mrpukey._on_connect]]();
}
}
function gadget_mrpukey_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_mrpukey_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
self [[level.cybercom.mrpukey._on]](slot, weapon);
}
}
function gadget_mrpukey_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_mrpukey_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
self [[level.cybercom.mrpukey._off]](slot, weapon);
}
}
function gadget_mrpukey_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.mrpukey))
{
self [[level.cybercom.mrpukey._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,25 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_other",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,96 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_other",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 1, &gadget_other_on_activate, &gadget_other_on_off );
ability_player::register_gadget_possession_callbacks( 1, &gadget_other_on_give, &gadget_other_on_take );
ability_player::register_gadget_flicker_callbacks( 1, &gadget_other_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 1, &gadget_other_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 1, &gadget_other_is_flickering );
ability_player::register_gadget_ready_callbacks( 1, &gadget_other_ready );
//callback::on_connect( &gadget_other_on_connect );
//callback::on_spawned( &gadget_other_on_spawn );
}
function gadget_other_is_inuse( slot )
{
// returns true when the gadget is on
return self GadgetIsActive( slot );
}
function gadget_other_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function gadget_other_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
}
function gadget_other_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
}
function gadget_other_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
}
//self is the player
function gadget_other_on_connect()
{
// setup up stuff on player connect
}
//self is the player
function gadget_other_on_spawn()
{
// setup up stuff on player spawn
}
function gadget_other_on_activate( slot, weapon )
{
}
function gadget_other_on_off( slot, weapon )
{
}
function gadget_other_ready( slot, weapon )
{
// unused
}
function set_gadget_other_status( weapon, status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Gadget Other " + weapon.name + ": " + status + timeStr );
}
@@ -0,0 +1,219 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\postfx_shared;
#using scripts\shared\lui_shared;
#precache( "client_fx", "player/fx_plyr_ability_screen_blur_overdrive" );
function autoexec __init__sytem__() { system::register("gadget_overdrive",&__init__,undefined,undefined); }
function __init__()
{
callback::on_localclient_connect( &on_player_connect );
callback::on_localplayer_spawned( &on_localplayer_spawned );
callback::on_localclient_shutdown( &on_localplayer_shutdown );
clientfield::register( "toplayer", "overdrive_state", 1, 1, "int", &player_overdrive_handler, !true, true);
visionset_mgr::register_visionset_info( "overdrive", 1, 15, undefined, "overdrive_initialize" );
}
function on_localplayer_shutdown(localClientNum)
{
self overdrive_shutdown( localClientNum );
}
function on_localplayer_spawned( localClientNum )
{
if( self != GetLocalPlayer( localClientNum ) )
return;
filter::init_filter_overdrive(self);
filter::disable_filter_overdrive( self,3 );
DisableSpeedBlur( localClientNum );
}
function on_player_connect( local_client_num )
{
}
function player_overdrive_handler(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
{
if ( !self IsLocalPlayer() || IsSpectating( localClientNum, false ) || ( (isdefined(level.localPlayers[localClientNum])) && (self GetEntityNumber() != level.localPlayers[localClientNum] GetEntityNumber())) )
{
return;
}
if( (newVal != oldval) && newval )
{
EnableSpeedBlur( localClientNum, GetDvarFloat( "scr_overdrive_amount", 0.15 ), GetDvarFloat( "scr_overdrive_inner_radius", 0.6 ), GetDvarFloat( "scr_overdrive_outer_radius", 1 ), GetDvarInt( "scr_overdrive_velShouldScale", 1 ),GetDvarInt( "scr_overdrive_velScale", 220 ));
filter::enable_filter_overdrive( self, 3 );
self UseAlternateAimParams();
self thread activation_flash(localClientNum);
self boost_fx_on_velocity(localClientNum);
}
else if ( (newVal != oldval) && !newval )
{
self overdrive_shutdown( localClientNum );
}
}
// Flashes the screen white on activation.
function activation_flash(localClientNum)
{
self notify("activation_flash");
self endon("activation_flash");
self endon("death");
self endon("entityshutdown");
self endon("stop_player_fx");
self endon("disable_cybercom");
self.whiteFlashFade = 1;
lui::screen_fade( GetDvarFloat("scr_overdrive_flash_fade_in_time", 0.075), GetDvarFloat("scr_overdrive_flash_alpha", 0.7), 0, "white" );
wait GetDvarFloat("scr_overdrive_flash_fade_in_time", 0.075);
lui::screen_fade( GetDvarFloat("scr_overdrive_flash_fade_out_time", 0.45), 0, GetDvarFloat("scr_overdrive_flash_alpha", 0.7), "white" );
self.whiteFlashFade = undefined;
}
// Turn on the "hyperdrive" boost effects on camera
function enable_boost_camera_fx(localClientNum)
{
if (isDefined(self.firstperson_fx_overdrive))
{
StopFX(localClientNum, self.firstperson_fx_overdrive);
self.firstperson_fx_overdrive = undefined;
}
self.firstperson_fx_overdrive = PlayFXOnCamera( localClientNum, "player/fx_plyr_ability_screen_blur_overdrive", (0,0,0), (1,0,0), (0,0,1) );
self thread watch_stop_player_fx( localClientNum, self.firstperson_fx_overdrive );
}
function watch_stop_player_fx( localClientNum, fx )
{
self notify("watch_stop_player_fx");
self endon("watch_stop_player_fx");
self endon("entityshutdown");
self util::waittill_any( "stop_player_fx","death","disable_cybercom" );
if ( IsDefined( fx ) )
{
StopFx( localClientNum, fx );
self.firstperson_fx_overdrive = undefined;
}
}
// Turn off the "hyperdrive" boost effects on camera
function stop_boost_camera_fx(localClientNum)
{
self notify( "stop_player_fx" );
if(( isdefined( self.whiteFlashFade ) && self.whiteFlashFade ))
{
lui::screen_fade( GetDvarFloat("scr_overdrive_flash_fade_out_time", 0.45), 0, GetDvarFloat("scr_overdrive_flash_alpha", 0.7), "white" );
}
}
// Stop FX when we die or hit a cybercom turnoff event.
function overdrive_boost_fx_interrupt_handler(localClientNum)
{
self endon("overdrive_boost_fx_interrupt_handler");
self endon("end_overdrive_boost_fx");
self endon("entityshutdown");
self util::waittill_any( "death", "disable_cybercom" );
self overdrive_shutdown( localClientNum );
}
// Turns off all effects and ability buffs given by overdrive.
// self == player
function overdrive_shutdown( localClientNum )
{
if (isdefined(localClientNum))
{
self stop_boost_camera_fx( localClientNum );
self ClearAlternateAimParams();
filter::disable_filter_overdrive( self,3 );
DisableSpeedBlur( localClientNum );
self notify( "end_overdrive_boost_fx");
}
}
// Turn on boost FX (hyperdrive!) when we're moving forward fast enough.
// This effectively translates to sprinting forward with its current tuning.
function boost_fx_on_velocity(localClientNum) //self == player
{
self endon("disable_cybercom");
self endon("death");
self endon("end_overdrive_boost_fx");
self endon("disconnect");
// Ensure the boost plays for at least a short time on activation.
self enable_boost_camera_fx(localClientNum);
//Keep track of when we might need to turn force off the boost FX
self thread overdrive_boost_fx_interrupt_handler(localclientnum);
wait GetDvarFloat("scr_overdrive_boost_fx_time", 0.75);
while (isDefined(self))
{
// Get forward direction and speed information.
v_player_velocity = self GetVelocity();
v_player_forward = Anglestoforward(self.angles);
n_dot = VectorDot(VectorNormalize(v_player_velocity), v_player_forward);
n_speed = Length(v_player_velocity);
// If we're moving forward fast enough:
if (n_speed >= GetDvarInt( "scr_overdrive_boost_speed_tol", 280 ) && n_dot > 0.8)
{
if (!isdefined(self.firstperson_fx_overdrive))
{
self enable_boost_camera_fx(localClientNum);
}
}
else
{
if (isdefined(self.firstperson_fx_overdrive))
{
self stop_boost_camera_fx(localClientNum);
}
}
{wait(.016);};
}
}
@@ -0,0 +1,103 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_overdrive",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 28, &gadget_overdrive_on, &gadget_overdrive_off );
ability_player::register_gadget_possession_callbacks( 28, &gadget_overdrive_on_give, &gadget_overdrive_on_take );
ability_player::register_gadget_flicker_callbacks( 28, &gadget_overdrive_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 28, &gadget_overdrive_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 28, &gadget_overdrive_is_flickering );
if ( !IsDefined( level.vsmgr_prio_visionset_overdrive ) )
{
level.vsmgr_prio_visionset_overdrive = 65;
}
visionset_mgr::register_info( "visionset", "overdrive", 1, level.vsmgr_prio_visionset_overdrive, 15, true, &visionset_mgr::ramp_in_out_thread_per_player, false );
callback::on_connect( &gadget_overdrive_on_connect );
clientfield::register( "toplayer", "overdrive_state", 1, 1, "int");
}
function gadget_overdrive_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_overdrive_on" );
}
function gadget_overdrive_is_flickering( slot )
{
// returns true when the gadget is flickering
}
function gadget_overdrive_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
}
function gadget_overdrive_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.overdrive))
{
self [[level.cybercom.overdrive._on_give]](slot, weapon);
}
}
function gadget_overdrive_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.overdrive))
{
self [[level.cybercom.overdrive._on_take]](slot, weapon);
}
// gadget_overdrive_off( slot, weapon );
}
//self is the player
function gadget_overdrive_on_connect()
{
// setup up stuff on player connect
}
function gadget_overdrive_on( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.overdrive))
{
// excecutes when the gadget is turned on
self thread [[level.cybercom.overdrive._on]](slot, weapon);
self flagsys::set( "gadget_overdrive_on" );
}
}
function gadget_overdrive_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_overdrive_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.overdrive))
{
self thread [[level.cybercom.overdrive._off]](slot, weapon);
}
}
@@ -0,0 +1,8 @@
// For the activate effects
// Name of the visionset file
// alias in script
// priority vs other visionsets
// number of steps when ramping in/out
// activation ramp-in time
// How long to hold after ramp-in is done and before ramping-out
// deactivation ramp-out time
@@ -0,0 +1,22 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_rapid_strike",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,101 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_rapid_strike",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 30, &gadget_rapid_strike_on, &gadget_rapid_strike_off );
ability_player::register_gadget_possession_callbacks( 30, &gadget_rapid_strike_on_give, &gadget_rapid_strike_on_take );
ability_player::register_gadget_flicker_callbacks( 30, &gadget_rapid_strike_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 30, &gadget_rapid_strike_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 30, &gadget_rapid_strike_is_flickering );
callback::on_connect( &gadget_rapid_strike_on_connect );
}
function gadget_rapid_strike_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_rapid_strike_on" );
}
function gadget_rapid_strike_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.rapid_strike))
{
return self [[level.cybercom.rapid_strike._is_flickering]](slot);
}
}
function gadget_rapid_strike_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.rapid_strike))
{
self [[level.cybercom.rapid_strike._on_flicker]](slot, weapon);
}
}
function gadget_rapid_strike_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.rapid_strike))
{
self [[level.cybercom.rapid_strike._on_give]](slot, weapon);
}
}
function gadget_rapid_strike_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.rapid_strike))
{
self [[level.cybercom.rapid_strike._on_take]](slot, weapon);
}
}
//self is the player
function gadget_rapid_strike_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.rapid_strike))
{
self [[level.cybercom.rapid_strike._on_connect]]();
}
}
function gadget_rapid_strike_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_rapid_strike_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.rapid_strike))
{
self [[level.cybercom.rapid_strike._on]](slot, weapon);
}
}
function gadget_rapid_strike_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_rapid_strike_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.rapid_strike))
{
self [[level.cybercom.rapid_strike._off]](slot, weapon);
}
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_ravage_core",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,103 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_ravage_core",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 22, &gadget_ravage_core_on, &gadget_ravage_core_off );
ability_player::register_gadget_possession_callbacks( 22, &gadget_ravage_core_on_give, &gadget_ravage_core_on_take );
ability_player::register_gadget_flicker_callbacks( 22, &gadget_ravage_core_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 22, &gadget_ravage_core_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 22, &gadget_ravage_core_is_flickering );
callback::on_connect( &gadget_ravage_core_on_connect );
}
function gadget_ravage_core_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_ravage_core_on" );
}
function gadget_ravage_core_is_flickering( slot )
{
// returns true when the gadget is flickering
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.ravage_core))
{
return self [[level.cybercom.ravage_core._is_flickering]](slot);
}
}
function gadget_ravage_core_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.ravage_core))
{
self [[level.cybercom.ravage_core._on_flicker]](slot, weapon);
}
}
function gadget_ravage_core_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.ravage_core))
{
self [[level.cybercom.ravage_core._on_give]](slot, weapon);
}
}
function gadget_ravage_core_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.ravage_core))
{
self [[level.cybercom.ravage_core._on_take]](slot, weapon);
}
}
//self is the player
function gadget_ravage_core_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.ravage_core))
{
self [[level.cybercom.ravage_core._on_connect]]();
}
}
function gadget_ravage_core_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_ravage_core_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.ravage_core))
{
self [[level.cybercom.ravage_core._on]](slot, weapon);
}
}
function gadget_ravage_core_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_ravage_core_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.ravage_core))
{
self [[level.cybercom.ravage_core._off]](slot, weapon);
}
}
@@ -0,0 +1,75 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\system_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\postfx_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
function autoexec __init__sytem__() { system::register("gadget_resurrect",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "allplayers", "resurrecting", 1, 1, "int", &player_resurrect_changed, !true, true );
clientfield::register( "toplayer", "resurrect_state", 1, 2, "int", &player_resurrect_state_changed, !true, true );
duplicate_render::set_dr_filter_offscreen( "resurrecting", 99,
"resurrecting", undefined,
2, "mc/hud_keyline_resurrect", 0 );
visionset_mgr::register_visionset_info( "resurrect", 1, 16, undefined, "mp_ability_resurrection" );
visionset_mgr::register_visionset_info( "resurrect_up", 1, 16, undefined, "mp_ability_wakeup" );
}
function player_resurrect_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
self duplicate_render::update_dr_flag( localClientNum, "resurrecting", newVal );
}
function resurrect_down_fx( localClientNum )
{
self endon ( "entityshutdown" );
self endon ( "finish_rejack" );
self thread postfx::PlayPostfxBundle( "pstfx_resurrection_close" );
wait( .5 );
self thread postfx::PlayPostfxBundle( "pstfx_resurrection_pus" );
}
function resurrect_up_fx( localClientNum )
{
self endon ( "entityshutdown" );
self notify( "finish_rejack" );
self thread postfx::PlayPostfxBundle( "pstfx_resurrection_open" );
}
function player_resurrect_state_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if( newVal == 1 )
{
self thread resurrect_down_fx( localClientNum );
}
else if( newVal == 2 )
{
self thread resurrect_up_fx( localClientNum );
}
else
{
self thread postfx::stopPostfxBundle();
}
}
@@ -0,0 +1,715 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\weapons\_smokegrenade;
#using scripts\shared\_oob;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace resurrect;
function autoexec __init__sytem__() { system::register("gadget_resurrect",&__init__,undefined,undefined); }
#precache( "fx", "player/fx_plyr_revive" );
#precache( "fx", "player/fx_plyr_revive_demat" );
#precache( "fx", "player/fx_plyr_rejack_light" );
#precache( "fx", "player/fx_plyr_rejack_smoke" );
#precache( "eventstring", "create_rejack_timer" );
function __init__()
{
clientfield::register( "allplayers", "resurrecting" , 1, 1, "int" );
clientfield::register( "toplayer", "resurrect_state" , 1, 2, "int" );
clientfield::register( "clientuimodel", "hudItems.rejack.activationWindowEntered", 1, 1, "int" );
clientfield::register( "clientuimodel", "hudItems.rejack.rejackActivated", 1, 1, "int" );
ability_player::register_gadget_activation_callbacks( 40, &gadget_resurrect_on, &gadget_resurrect_off );
ability_player::register_gadget_possession_callbacks( 40, &gadget_resurrect_on_give, &gadget_resurrect_on_take );
ability_player::register_gadget_flicker_callbacks( 40, &gadget_resurrect_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 40, &gadget_resurrect_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 40, &gadget_resurrect_is_flickering );
ability_player::register_gadget_primed_callbacks( 40, &gadget_resurrect_is_primed );
ability_player::register_gadget_ready_callbacks( 40, &gadget_resurrect_is_ready );
callback::on_connect( &gadget_resurrect_on_connect );
callback::on_spawned( &gadget_resurrect_on_spawned );
if ( !IsDefined( level.vsmgr_prio_visionset_resurrect ) )
{
level.vsmgr_prio_visionset_resurrect = 62;
}
if ( !IsDefined( level.vsmgr_prio_visionset_resurrect_up ) )
{
level.vsmgr_prio_visionset_resurrect_up = 63;
}
visionset_mgr::register_info( "visionset", "resurrect", 1, level.vsmgr_prio_visionset_resurrect, 16, true, &visionset_mgr::ramp_in_out_thread_per_player_death_shutdown, false );
visionset_mgr::register_info( "visionset", "resurrect_up", 1, level.vsmgr_prio_visionset_resurrect_up, 16, true, &visionset_mgr::ramp_in_out_thread_per_player_death_shutdown, false );
}
function gadget_resurrect_is_inuse( slot )
{
return self GadgetIsActive( slot );
}
function gadget_resurrect_is_flickering( slot )
{
return self GadgetFlickering( slot );
}
function gadget_resurrect_on_flicker( slot, weapon )
{
}
function gadget_resurrect_on_give( slot, weapon )
{
self.usedResurrect = false;
self.resurrect_weapon = weapon;
//self.overridePlayerDeadStatus = &gadget_resurrect_is_player_predead;
//self.secondaryDeathCamTime = &gadget_resurrect_secondary_deathcam_time;
}
function gadget_resurrect_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
self.overridePlayerDeadStatus = undefined;
self.resurrect_weapon = undefined;
self.secondaryDeathCamTime = undefined;
self notify("resurrect_taken");
}
//self is the player
function gadget_resurrect_on_spawned()
{
self clientfield::set_player_uimodel( "hudItems.rejack.activationWindowEntered", 0 );
self util::show_hud( 1 );
self._disable_proximity_alarms = false;
// executed when gadget is added to the players inventory
self flagsys::clear( "gadget_resurrect_ready" );
self flagsys::clear( "gadget_resurrect_pending" );
if ( self flagsys::get( "gadget_resurrect_activated" ) )
{
self thread do_resurrected_on_spawned_player_fx();
self thread resurrect_drain_power();
self flagsys::clear( "gadget_resurrect_activated" );
}
}
function resurrect_drain_power( amount )
{
if ( isdefined( self.resurrect_weapon ) )
{
slot = self GadgetGetSlot( self.resurrect_weapon );
if ( slot >= 0 && slot < 3 )
{
if ( IsDefined( amount ))
{
self GadgetPowerChange( slot, amount );
}
else
{
self GadgetStateChange( slot, self.resurrect_weapon, 3 );
}
}
}
}
//self is the player
function gadget_resurrect_on_connect()
{
// setup up stuff on player connect
}
function gadget_resurrect_on( slot, weapon )
{
// excecutes when the gadget is turned on
}
function watch_smoke_detonate()
{
self endon( "player_input_suicide" );
self endon( "player_input_revive" );
self endon( "disconnect" );
self endon( "death" );
level endon("game_ended");
while( 1 )
{
if( ( ( self IsPlayerSwimming() ) || ( self isOnGround() ) ) && !( self iswallrunning() ) && !( self istraversing() ) )
{
smoke_weapon = GetWeapon( "gadget_resurrect_smoke_grenade" );
stat_weapon = GetWeapon( "gadget_resurrect" );
smokeEffect = smokegrenade::smokeDetonate( self, stat_weapon, smoke_weapon, self.origin, 128, 5, 4 );
smokeEffect thread watch_smoke_effect_watch_suicide( self );
smokeEffect thread watch_smoke_effect_watch_resurrect( self );
smokeEffect thread watch_smoke_death( self );
return;
}
{wait(.05);};
}
}
function watch_smoke_death( player ) // self is effect
{
self endon( "death" );
player util::waittill_any_timeout( 5, "disconnect", "death" );
self delete();
}
function watch_smoke_effect_watch_suicide( player ) // self is effect
{
self endon( "death" );
player waittill ( "player_input_suicide" );
self delete();
}
function watch_smoke_effect_watch_resurrect( player ) // self is effect
{
self endon( "death" );
player waittill ( "player_input_revive" );
wait( .5 );
self delete();
}
function gadget_resurrect_is_primed( slot, weapon ) // self == player
{
if ( isdefined( self.resurrect_not_allowed_by ) )
return;
self StartResurrectViewAngleTransition();
self.lastWaterDamageTime = GetTime();
self._disable_proximity_alarms = true;
self thread watch_smoke_detonate();
self util::show_hud( 0 );
visionset_mgr::activate( "visionset", "resurrect", self, ( 1.4 ), ( 4.0 ), ( .25 ) );
self clientfield::set_to_player( "resurrect_state", 1 );
self shellshock( "resurrect", 4.0 + 1.4, false );
}
function gadget_resurrect_is_ready( slot, weapon )
{
return;
self flagsys::set( "gadget_resurrect_ready" );
self thread resurrect_breadcrumbs( slot );
self thread resurrect_watch_for_death( slot,weapon );
}
function gadget_resurrect_start( slot, weapon )
{
wait 0.1;
self GadgetSetActivateTime( slot, GetTime() );
self thread resurrect_delay( weapon );
}
function gadget_resurrect_off( slot, weapon )
{
self notify( "gadget_resurrect_off" );
// excecutes when the gadget is turned off
}
function resurrect_delay( weapon )
{
self endon ( "disconnect" );
self endon("game_ended");
self endon ( "death" );
self notify( "resurrect_delay" );
self endon( "resurrect_delay" );
}
function overrideSpawn(isPredictedSpawn)
{
if ( !self flagsys::get( "gadget_resurrect_ready" ) )
return false;
if ( !self flagsys::get( "gadget_resurrect_activated" ) )
return false;
if (!IsDefined( self.resurrect_origin ))
{
self.resurrect_origin = self.origin;
self.resurrect_angles = self.angles;
}
return true;
}
function is_jumping()
{
// checking PMF_JUMPING in code would give more accurate results
ground_ent = self GetGroundEnt();
return (!isdefined(ground_ent));
}
function player_position_valid()
{
//if ( self IsWallRunning() || self is_jumping() )
//return false;
if ( self clientfield::get_to_player( "out_of_bounds" ) )
return false;
return true;
}
function resurrect_breadcrumbs(slot)
{
self endon("disconnect");
self endon("game_ended");
self endon("resurrect_taken");
self.resurrect_slot = slot;
while(1)
{
if (IsAlive(self) && self player_position_valid() )
{
self.resurrect_origin = self.origin;
self.resurrect_angles = self.angles;
}
wait 1;
}
}
function glow_for_time( time )
{
self endon("disconnect");
self clientfield::set( "resurrecting", 1 );
wait time;
self clientfield::set( "resurrecting", 0 );
}
function wait_for_time( time, msg )
{
self endon("disconnect");
self endon("game_ended");
self endon(msg);
wait time;
self notify(msg);
}
function wait_for_activate( msg )
{
self endon("disconnect");
self endon("game_ended");
self endon(msg);
while(1)
{
if ( self OffhandSpecialButtonPressed() )
{
self flagsys::set( "gadget_resurrect_activated" );
self notify(msg);
}
{wait(.05);};
}
}
function bot_wait_for_activate( msg, time )
{
self endon("disconnect");
self endon("game_ended");
self endon(msg);
if ( !self util::is_bot() )
{
return;
}
time = int( time + 1 );
randWait = RandomInt( time );
wait randWait;
self flagsys::set( "gadget_resurrect_activated" );
self notify(msg);
}
function do_resurrect_hint_fx()
{
offset = (0,0,40);
fxOrg = spawn( "script_model", self.resurrect_origin + offset );
fxOrg SetModel( "tag_origin" );
fx = PlayFxOnTag( "player/fx_plyr_revive", fxOrg, "tag_origin" );
self waittill("resurrect_time_or_activate");
fxOrg delete();
}
function do_resurrected_on_dead_body_fx()
{
if ( isdefined( self.body ) )
{
fx = PlayFx( "player/fx_plyr_revive_demat", self.body.origin );
self.body NotSolid();
self.body Ghost();
}
}
function do_resurrected_on_spawned_player_fx()
{
playsoundatposition( "mpl_resurrect_npc", self.origin );
fx = PlayFx( "player/fx_plyr_rejack_light", self.origin );
}
function resurrect_watch_for_death( slot, weapon )
{
self endon("disconnect");
self endon("game_ended");
self waittill("death");
resurrect_time = 3;
if ( IsDefined( weapon.gadget_resurrect_duration) )
{
resurrect_time = weapon.gadget_resurrect_duration / 1000.0;
}
self.usedResurrect = false;
self flagsys::clear( "gadget_resurrect_activated" );
self flagsys::set( "gadget_resurrect_pending" );
self.resurrect_available_time = GetTime();
self thread wait_for_time(resurrect_time,"resurrect_time_or_activate");
self thread wait_for_activate("resurrect_time_or_activate");
self thread bot_wait_for_activate("resurrect_time_or_activate", resurrect_time );
self thread do_resurrect_hint_fx();
self waittill("resurrect_time_or_activate");
self flagsys::clear( "gadget_resurrect_pending" );
if ( self flagsys::get( "gadget_resurrect_activated" ) )
{
self thread do_resurrected_on_dead_body_fx();
self notify ( "end_death_delay" );
self notify ( "end_killcam" );
self.cancelKillcam = true;
self.usedResurrect = true;
self notify ( "end_death_delay" );
self notify( "force_spawn" );
if ( !( isdefined( true ) && true ) )
{
self.pers["resetMomentumOnSpawn"] = false;
}
if ( isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon, "resurrectSuccessDelay" );
}
//self thread glow_for_time( 7 );
}
}
function gadget_resurrect_delay_updateTeamStatus()
{
if ( self flagsys::get( "gadget_resurrect_ready" ) )
{
return true;
}
return false;
}
function gadget_resurrect_is_player_predead()
{
should_not_be_dead = false;
if ( self.sessionstate == "playing" && isAlive( self ) )
should_not_be_dead = true;
if ( self flagsys::get( "gadget_resurrect_pending" ) )
{
return true;
}
return should_not_be_dead;
}
function gadget_resurrect_secondary_deathcam_time()
{
if ( self flagsys::get( "gadget_resurrect_pending" ) && IsDefined(self.resurrect_available_time) )
{
resurrect_time = 3000;
weapon = self.resurrect_weapon;
if ( IsDefined(weapon.gadget_resurrect_duration) )
resurrect_time = weapon.gadget_resurrect_duration;
time_left = resurrect_time - ( GetTime() - self.resurrect_available_time );
if ( time_left > 0 )
{
return time_left / 1000.0;
}
}
return 0.0;
}
function enter_rejack_standby() // self == player
{
self endon( "disconnect" );
self endon( "death" );
level endon("game_ended");
self.rejack_activate_requested = false;
if( isDefined( level.resetPlayerScorestreaks ) )
{
[[level.resetPlayerScorestreaks]]( self );
}
self init_rejack_ui();
self thread watch_rejack_activate_requested();
self thread watch_rejack_suicide();
wait 1.4;
self thread watch_rejack_activate();
self thread watch_rejack_timeout();
self thread watch_bad_trigger_touch();
}
function rejack_suicide()
{
self notify( "heroAbility_off" );
visionset_mgr::deactivate( "visionset", "resurrect", self );
self thread remove_rejack_ui();
self util::show_hud( 1 );
player_suicide();
}
function watch_bad_trigger_touch()
{
self endon( "player_input_revive" );
self endon( "player_input_suicide" );
self endon( "disconnect" );
self endon( "death" );
level endon("game_ended");
a_killbrushes = GetEntArray( "trigger_hurt","classname" );
while( 1 )
{
a_killbrushes = GetEntArray( "trigger_hurt","classname" );
for ( i = 0; i < a_killbrushes.size; i++)
{
if ( self IsTouching( a_killbrushes[ i ] ) )
{
if ( !a_killbrushes[ i ] IsTriggerEnabled() )
{
continue;
}
self rejack_suicide();
}
}
if( self oob::IsTouchingAnyOOBTrigger() )
{
self rejack_suicide();
}
{wait(.05);};
}
}
function watch_rejack_timeout() // self == player
{
self endon( "player_input_revive" );
self endon( "player_input_suicide" );
self endon( "disconnect" );
self endon( "death" );
level endon("game_ended");
wait 4.0;
self playsound ("mpl_rejack_suicide_timeout");
self thread resurrect_drain_power( -30 );
self rejack_suicide();
}
function watch_rejack_suicide() // self == player
{
self endon( "player_input_revive" );
self endon( "disconnect" );
self endon( "death" );
level endon("game_ended");
while ( self UseButtonPressed())
{
wait 1;
}
if ( ( isdefined( self.laststand ) && self.laststand ))
{
startTime = GetTime();
while ( true )
{
if( !( self usebuttonpressed() ) )
{
startTime = GetTime();
}
if( startTime + 500 < GetTime() )
{
self rejack_suicide();
self playsound ("mpl_rejack_suicide");
return;
}
wait .01;
}
}
}
function reload_clip_on_stand()
{
weapons = self GetWeaponsListPrimaries();
for ( i = 0; i < weapons.size; i++ )
{
self ReloadWeaponAmmo( weapons[i] );
}
}
function watch_rejack_activate_requested()
{
self endon( "player_input_suicide" );
self endon( "player_input_revive" );
self endon( "disconnect" );
self endon( "death" );
level endon("game_ended");
while ( self OffhandSpecialButtonPressed())
{
{wait(.05);};
}
self.rejack_activate_requested = false;
while( !self.rejack_activate_requested )
{
if( self OffhandSpecialButtonPressed() )
{
self.rejack_activate_requested = true;
}
{wait(.05);};
}
}
function watch_rejack_activate() // self == player
{
self endon( "player_input_suicide" );
self endon( "disconnect" );
self endon( "death" );
level endon("game_ended");
if ( ( isdefined( self.laststand ) && self.laststand ))
{
while ( true )
{
{wait(.05);};
if( ( isdefined( self.rejack_activate_requested ) && self.rejack_activate_requested ) )
{
self notify( "player_input_revive" );
if( isDefined( level.start_player_health_regen ) )
{
self thread [[level.start_player_health_regen]](); // Manually restart the health regen as it gets ended because of the player killed
}
self._disable_proximity_alarms = false;
self thread do_resurrected_on_spawned_player_fx();
self thread resurrect_drain_power();
self thread rejack_ui_activate();
visionset_mgr::deactivate( "visionset", "resurrect", self );
visionset_mgr::activate( "visionset", "resurrect_up", self, ( .35 ), ( .1 ), ( .2 ) );
self clientfield::set_to_player( "resurrect_state", 2 );
self stopshellshock();
//self SetEverHadWeaponAll( false );
self reload_clip_on_stand();
level notify( "hero_gadget_activated", self );
self notify( "hero_gadget_activated" );
return;
}
}
}
}
function init_rejack_ui()
{
self clientfield::set_player_uimodel( "hudItems.rejack.activationWindowEntered", 1 );
self LUINotifyEvent( &"create_rejack_timer", 1, GetTime() + ( int( 4.0 * 1000 ) ) );
self clientfield::set_player_uimodel( "hudItems.rejack.rejackActivated", 0 );
}
function remove_rejack_ui()
{
self endon( "disconnect" );
wait 1.5;
self clientfield::set_player_uimodel( "hudItems.rejack.activationWindowEntered", 0 );
self util::show_hud( 1 );
}
function rejack_ui_activate()
{
self clientfield::set_player_uimodel( "hudItems.rejack.rejackActivated", 1 );
self thread remove_rejack_ui();
}
function player_suicide() // self == player
{
self._disable_proximity_alarms = false;
self notify( "player_input_suicide" );
self clientfield::set_to_player( "resurrect_state", 0 );
self thread resurrect_drain_power( -30 );
}
@@ -0,0 +1,47 @@
// Name of the visionset file
// alias in script
// priority vs other visionsets
// number of steps when ramping in/out
// activation ramp-in time
// How long to hold after ramp-in is done and before ramping-out
// deactivation ramp-out time
// Name of the visionset file
// alias in script
// priority vs other visionsets
// number of steps when ramping in/out
// activation ramp-in time
// How long to hold after ramp-in is done and before ramping-out
// deactivation ramp-out time
@@ -0,0 +1,52 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
Line truncated
#namespace gadget_roulette;
function autoexec __init__sytem__() { system::register("gadget_roulette",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "toplayer", "roulette_state", 11000, 2, "int", &roulette_clientfield_cb, !true, !true );
callback::on_localplayer_spawned( &on_localplayer_spawned );
}
function roulette_clientfield_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
update_roulette( localClientNum, newVal );
}
function update_roulette( localClientNum, newVal )
{
controllerModel = GetUIModelForController( localClientNum );
if ( isdefined( controllerModel ) )
{
rouletteStatusModel = GetUIModel( controllerModel, "playerAbilities.playerGadget3.rouletteStatus" );
if ( isdefined( rouletteStatusModel ) )
{
SetUIModelValue( rouletteStatusModel, newVal );
}
}
}
function on_localplayer_spawned( localClientNum )
{
roulette_state = 0;
if ( getserverhighestclientfieldversion() >= 11000 )
{
roulette_state = self clientfield::get_to_player( "roulette_state" );
}
update_roulette( localClientNum, roulette_state );
}
@@ -0,0 +1,472 @@
#using scripts\codescripts\struct;
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\weapons\_weaponobjects;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_gadgets;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\_burnplayer;
Line truncated
#namespace roulette;
function autoexec __init__sytem__() { system::register("gadget_roulette",&__init__,undefined,undefined); }
//used in LUA
//#define ROULETTE_RESPIN_TIME_SECONDS 5
function __init__()
{
clientfield::register( "toplayer", "roulette_state", 11000, 2, "int" );
ability_player::register_gadget_activation_callbacks( 43, &gadget_roulette_on_activate, &gadget_roulette_on_deactivate );
ability_player::register_gadget_possession_callbacks( 43, &gadget_roulette_on_give, &gadget_roulette_on_take );
ability_player::register_gadget_flicker_callbacks( 43, &gadget_roulette_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 43, &gadget_roulette_is_inuse );
ability_player::register_gadget_ready_callbacks( 43, &gadget_roulette_is_ready );
ability_player::register_gadget_is_flickering_callbacks( 43, &gadget_roulette_is_flickering );
ability_player::register_gadget_should_notify( 43, false );
callback::on_connect( &gadget_roulette_on_connect );
callback::on_spawned( &gadget_roulette_on_player_spawn );
if ( SessionModeIsMultiplayerGame() )
{
level.gadgetRouletteProbabilities = [];
level.gadgetRouletteProbabilities[0] = 0;
level.gadgetRouletteProbabilities[1] = 0;
level.weaponNone = getWeapon( "none" );
level.gadget_roulette = GetWeapon( "gadget_roulette" );
// Gadget roll weights first roll second roll
registerGadgetType( "gadget_flashback", 1, 1 );
registerGadgetType( "gadget_combat_efficiency", 1, 1 );
registerGadgetType( "gadget_heat_wave", 1, 1 );
registerGadgetType( "gadget_vision_pulse", 1, 1 );
registerGadgetType( "gadget_speed_burst", 1, 1 );
registerGadgetType( "gadget_camo", 1, 1 );
registerGadgetType( "gadget_armor", 1, 1 );
registerGadgetType( "gadget_resurrect", 1, 1 );
registerGadgetType( "gadget_clone", 1, 1 );
//registerGadgetType( "hero_bowlauncher", 1, 1 );
//registerGadgetType( "hero_gravityspikes", 1, 1 );
//registerGadgetType( "hero_lightninggun", 1, 1 );
//registerGadgetType( "hero_pineapplegun", 1, 1 );
//registerGadgetType( "hero_flamethrower", 1, 1 );
//registerGadgetType( "hero_minigun", 1, 1 );
//registerGadgetType( "hero_annihilator", 1, 1 );
//registerGadgetType( "hero_chemicalgelgun", 1, 1 );
//registerGadgetType( "hero_armblade", 1, 1 );
}
/#
//level thread updateDvars();
#/
}
/#
function updateDvars()
{
while(1)
{
wait(1.0);
}
}
#/
function gadget_roulette_is_inuse( slot )
{
// returns true when local script gadget state is on
return self GadgetIsActive( slot );
}
function gadget_roulette_is_flickering( slot )
{
// returns true when local script gadget state is flickering
return self GadgetFlickering( slot );
}
function gadget_roulette_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
self thread gadget_roulette_flicker( slot, weapon );
}
function gadget_roulette_on_give( slot, weapon )
{
// setup up stuff on player spawned
self clientfield::set_to_player( "roulette_state", 0 );
// executed when gadget is added to the players inventory
if ( SessionModeIsMultiplayerGame() )
{
self.isRoulette = true;
}
}
function gadget_roulette_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
/#
// for supporting dev gui
if ( level.devgui_giving_abilities === true )
{
self.isRoulette = false;
}
#/
}
//self is the player
function gadget_roulette_on_connect()
{
// setup up stuff on player connect
roulette_init_allow_spin();
}
function roulette_init_allow_spin()
{
if ( self.isRoulette === true )
{
if ( !isdefined( self.pers[#"rouletteAllowSpin"] ) )
{
self.pers[#"rouletteAllowSpin"] = true;
}
}
}
function gadget_roulette_on_player_spawn()
{
roulette_init_allow_spin();
}
function watch_entity_shutdown()
{
}
function gadget_roulette_on_activate( slot, weapon )
{
gadget_roulette_give_earned_specialist( weapon, true );
}
function gadget_roulette_is_ready( slot, weapon )
{
if ( self GadgetIsActive( slot ) )
return;
gadget_roulette_give_earned_specialist( weapon, false );
}
function gadget_roulette_give_earned_specialist( weapon, playSound )
{
self giveRandomWeapon( weapon, true );
if( playSound )
{
self playsoundtoplayer ("mpl_bm_specialist_roulette", self);
}
// self thread disable_hero_gadget_activation( GetDvarFloat( "src_roulette_activation_wait", ROULETTE_ACTIVATION_WAIT ) );
self thread watchGadgetActivated( weapon );
self thread watchRespin( weapon );
}
function disable_hero_gadget_activation( duration )
{
self endon( "death" );
self endon( "disconnect" );
self endon( "roulette_respin_activate" );
self DisableOffhandSpecial();
wait duration;
self EnableOffhandSpecial();
}
function watchRespinGadgetActivated()
{
self endon( "watchRespinGadgetActivated" );
self endon( "death" );
self endon( "disconnect" );
self waittill( "hero_gadget_activated" );
self clientfield::set_to_player( "roulette_state", 0 );
}
function watchRespin( weapon )
{
self endon( "hero_gadget_activated" );
self notify( "watchRespin" );
self endon( "watchRespin" );
if ( !isdefined( self.pers[#"rouletteAllowSpin"] ) || self.pers[#"rouletteAllowSpin"] == false )
{
return;
}
self thread watchRespinGadgetActivated();
self clientfield::set_to_player( "roulette_state", 1 );
wait GetDvarFloat( "scr_roulette_pre_respin_wait_time", 1.3 ); // wait until the "respin activated" animation is done
//respinTime = ROULETTE_RESPIN_TIME_SECONDS;
while( 1 )
{
if ( !isdefined( self ) )
break;
if ( self dpad_left_pressed() )
{
self.pers[#"rouletteWeapon"] = undefined;
self giveRandomWeapon( weapon, false );
self.pers[#"rouletteAllowSpin"] = false;
self notify( "watchRespinGadgetActivated" );
self notify( "roulette_respin_activate" );
self clientfield::set_to_player( "roulette_state", 2 );
self playsoundtoplayer ("mpl_bm_specialist_roulette", self);
self thread reset_roulette_state_to_default();
// self DisableOffhandSpecial();
// self thread failsafe_reenable_offhand_special();
// wait GetDvarFloat( "src_roulette_respin_activation_wait", ROULETTE_RESPIN_ACTIVATION_WAIT );
// if ( isdefined( self ) )
// {
// self notify( "end_failsafe_reenable_offhand_special" );
// self EnableOffhandSpecial();
//}
break;
}
{wait(.05);};
//respinTime -= SERVER_FRAME;
}
if ( isdefined( self ) )
{
self notify( "watchRespinGadgetActivated" );
}
}
function failsafe_reenable_offhand_special()
{
self endon( "end_failsafe_reenable_offhand_special" );
wait 3.0;
if ( isdefined( self ) )
{
self EnableOffhandSpecial();
}
}
function reset_roulette_state_to_default()
{
self endon( "death" );
self endon( "disconnect" );
wait( 0.50 );
self clientfield::set_to_player( "roulette_state", 0 );
}
function watchGadgetActivated( weapon )
{
self endon( "death" );
self notify( "watchGadgetActivated" );
self endon ( "watchGadgetActivated" );
self waittill( "hero_gadget_activated" );
self.pers[#"rouletteAllowSpin"] = true;
if ( isdefined( weapon ) || weapon.name != "gadget_roulette" )
{
self clientfield::set_to_player( "roulette_state", 0 );
}
}
function giveRandomWeapon( weapon, isPrimaryRoll )
{
for ( i = 0; i < 3; i++ )
{
if ( isdefined( self._gadgets_player[i] ) )
{
self TakeWeapon( self._gadgets_player[i] );
}
}
randomWeapon = weapon;
if ( isdefined( self.pers[#"rouletteWeapon"] ) )
{
randomWeapon = self.pers[#"rouletteWeapon"];
}
else if ( isdefined( self.pers[#"previousRouletteWeapon1"] ) || isdefined( self.pers[#"previousRouletteWeapon2"] ) )
{
randomWeapon = getRandomGadget( isPrimaryRoll );
while ( randomWeapon == self.pers[#"previousRouletteWeapon1"] ||
( isdefined( self.pers[#"previousRouletteWeapon2"] ) && randomWeapon == self.pers[#"previousRouletteWeapon2"] ) )
{
randomWeapon = getRandomGadget( isPrimaryRoll );
}
}
else
{
randomWeapon = getRandomGadget( isPrimaryRoll );
}
if ( isdefined( level.playGadgetReady ) && !isPrimaryRoll )
{
// The standard 'gadget ready' callbacks trigger the dialog just fine for roulette
self thread [[level.playGadgetReady]]( randomWeapon, !isPrimaryRoll );
}
self thread gadget_roulette_on_deactivate_helper( weapon );
self GiveWeapon( randomWeapon );
self.pers[#"rouletteWeapon"] = randomWeapon;
self.pers[#"previousRouletteWeapon2"] = self.pers[#"previousRouletteWeapon1"];
self.pers[#"previousRouletteWeapon1"] = randomWeapon;
}
function gadget_roulette_on_deactivate( slot, weapon )
{
thread gadget_roulette_on_deactivate_helper( weapon );
}
function gadget_roulette_on_deactivate_helper( weapon )
{
self notify( "gadget_roulette_on_deactivate_helper" );
self endon( "gadget_roulette_on_deactivate_helper" );
self waittill( "heroAbility_off", weapon_off );
if ( isdefined( weapon_off ) && ( weapon_off.name == "gadget_speed_burst" ) )
{
self waittill( "heroAbility_off", weapon_off );
}
for ( i = 0; i < 3; i++ )
{
if ( isdefined( self ) && isdefined( self._gadgets_player[i] ) )
{
self TakeWeapon( self._gadgets_player[i] );
}
}
if ( isdefined( self ) )
{
self GiveWeapon( level.gadget_roulette );
self.pers[#"rouletteWeapon"] = undefined;
}
}
function gadget_roulette_flicker( slot, weapon )
{
}
function set_gadget_status( status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Gadget Roulette: " + status + timeStr );
}
function dpad_left_pressed()
{
return self ActionSlotThreeButtonPressed();
}
function getRandomGadget( isPrimaryRoll )
{
if ( isprimaryroll )
{
category = 0;
totalCategory = 0;
}
else
{
category =1;
totalCategory = 1;
}
randomGadgetNumber = randomIntRange( 1, level.gadgetRouletteProbabilities[totalCategory] + 1 );
gadgetNames = GetArrayKeys( level.gadgetRouletteProbabilities );
selectedGadget = "";
foreach( gadget in gadgetNames )
{
randomGadgetNumber -= level.gadgetRouletteProbabilities[gadget][category];
if ( randomgadgetnumber <= 0 )
{
selectedGadget = gadget;
break;
}
}
return selectedGadget;
}
function registerGadgetType( gadgetNameString, primaryWeight, secondaryWeight )
{
gadgetWeapon = GetWeapon( gadgetNameString );
assert( isdefined( gadgetWeapon ) );
if ( gadgetWeapon == level.weaponNone)
{
assertmsg( gadgetNameString + " is not a gadget, _gadget_roulette.gsc" );
}
if ( !isdefined(level.gadgetRouletteProbabilities[gadgetWeapon]) )
{
level.gadgetRouletteProbabilities[gadgetWeapon] = [];
}
level.gadgetRouletteProbabilities[gadgetWeapon][0] = primaryWeight;
level.gadgetRouletteProbabilities[gadgetWeapon][1] = secondaryWeight;
level.gadgetRouletteProbabilities[0] += primaryWeight;
level.gadgetRouletteProbabilities[1] += secondaryWeight;
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_security_breach",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,111 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_security_breach",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 23, &gadget_security_breach_on, &gadget_security_breach_off );
ability_player::register_gadget_possession_callbacks( 23, &gadget_security_breach_on_give, &gadget_security_breach_on_take );
ability_player::register_gadget_flicker_callbacks( 23, &gadget_security_breach_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 23, &gadget_security_breach_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 23, &gadget_security_breach_is_flickering );
ability_player::register_gadget_primed_callbacks( 23, &gadget_security_breach_is_primed );
callback::on_connect( &gadget_security_breach_on_connect );
}
function gadget_security_breach_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_security_breach_on" );
}
function gadget_security_breach_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
return self [[level.cybercom.security_breach._is_flickering]](slot);
}
}
function gadget_security_breach_on_flicker( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
self [[level.cybercom.security_breach._on_flicker]](slot, weapon);
}
}
function gadget_security_breach_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
return self [[level.cybercom.security_breach._on_give]](slot,weapon);
}
}
function gadget_security_breach_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
return self [[level.cybercom.security_breach._on_take]](slot,weapon);
}
}
//self is the player
function gadget_security_breach_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
return self [[level.cybercom.security_breach._on_connect]]();
}
}
function gadget_security_breach_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_security_breach_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
return self [[level.cybercom.security_breach._on]](slot,weapon);
}
}
function gadget_security_breach_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_security_breach_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
return self [[level.cybercom.security_breach._off]](slot,weapon);
}
}
function gadget_security_breach_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.security_breach))
{
self [[level.cybercom.security_breach._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,22 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_sensory_overload",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,110 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_sensory_overload",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 32, &gadget_sensory_overload_on, &gadget_sensory_overload_off );
ability_player::register_gadget_possession_callbacks( 32, &gadget_sensory_overload_on_give, &gadget_sensory_overload_on_take );
ability_player::register_gadget_flicker_callbacks( 32, &gadget_sensory_overload_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 32, &gadget_sensory_overload_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 32, &gadget_sensory_overload_is_flickering );
ability_player::register_gadget_primed_callbacks( 32, &gadget_sensory_overload_is_primed );
callback::on_connect( &gadget_sensory_overload_on_connect );
}
function gadget_sensory_overload_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_sensory_overload_on" );
}
function gadget_sensory_overload_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
return self [[level.cybercom.sensory_overload._is_flickering]](slot);
}
}
function gadget_sensory_overload_on_flicker( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
self [[level.cybercom.sensory_overload._on_flicker]](slot, weapon);
} // // excuted when the gadget flickers
}
function gadget_sensory_overload_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
self [[level.cybercom.sensory_overload._on_give]](slot, weapon);
} // executed when gadget is added to the players inventory
}
function gadget_sensory_overload_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
self [[level.cybercom.sensory_overload._on_take]](slot, weapon);
}
}
//self is the player
function gadget_sensory_overload_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
self [[level.cybercom.sensory_overload._on_connect]]();
}
}
function gadget_sensory_overload_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_sensory_overload_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
self [[level.cybercom.sensory_overload._on]](slot, weapon);
}
}
function gadget_sensory_overload_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_sensory_overload_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
self [[level.cybercom.sensory_overload._off]](slot, weapon);
}
}
function gadget_sensory_overload_is_primed( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.sensory_overload))
{
self [[level.cybercom.sensory_overload._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,22 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_servo_shortout",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,108 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_servo_shortout",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 19, &gadget_servo_shortout_on, &gadget_servo_shortout_off );
ability_player::register_gadget_possession_callbacks( 19, &gadget_servo_shortout_on_give, &gadget_servo_shortout_on_take );
ability_player::register_gadget_flicker_callbacks( 19, &gadget_servo_shortout_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 19, &gadget_servo_shortout_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 19, &gadget_servo_shortout_is_flickering );
ability_player::register_gadget_primed_callbacks( 19, &gadget_servo_shortout_is_primed );
callback::on_connect( &gadget_servo_shortout_on_connect );
}
function gadget_servo_shortout_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_servo_shortout_on" );
}
function gadget_servo_shortout_is_flickering( slot )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
return self [[level.cybercom.servo_shortout._is_flickering]](slot);
}
return false;
}
function gadget_servo_shortout_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
self [[level.cybercom.servo_shortout._on_flicker]](slot, weapon);
}
}
function gadget_servo_shortout_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
self [[level.cybercom.servo_shortout._on_give]](slot, weapon);
}
}
function gadget_servo_shortout_on_take( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
self [[level.cybercom.servo_shortout._on_take]](slot, weapon);
}
}
//self is the player
function gadget_servo_shortout_on_connect()
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
self [[level.cybercom.servo_shortout._on_connect]]();
}
}
function gadget_servo_shortout_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_servo_shortout_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
self [[level.cybercom.servo_shortout._on]](slot, weapon);
}
}
function gadget_servo_shortout_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_servo_shortout_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
self [[level.cybercom.servo_shortout._off]](slot, weapon);
}
}
function gadget_servo_shortout_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.servo_shortout))
{
self [[level.cybercom.servo_shortout._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,105 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_shock_field",&__init__,undefined,undefined); }
#precache( "client_fx", "player/fx_plyr_shock_field_1p" );
#precache( "client_fx", "player/fx_plyr_shock_field" );
function __init__()
{
clientfield::register( "allplayers", "shock_field", 1, 1, "int", &player_shock_changed, !true, true );
level.shock_field_fx = [];
}
function is_local_player( localClientNum )
{
player_view = getlocalplayer( localClientNum );
if (!IsDefined(player_view))
return false;
sameEntity = ( self == player_view );
return sameEntity;
}
/*
function is_killcam( localClientNum )
{
player_view = getlocalplayer( localClientNum );
player_client = getnonpredictedlocalplayer( localClientNum );
killcam = ( !IS_EQUAL(player_view,player_client) );
return killcam;
}
function player_info_string( player, desc )
{
str = "Player '"+desc+"' is ";
if (!IsDefined(player))
{
str = str + "<undefined>";
}
else if ( player isplayer() )
{
name = "<unnamed>";
if (isDefined(player.name))
name = player.name;
str = str + name +"["+player GetEntityNumber()+"]";
}
else
{
str = "Entity '"+desc+"' is ";
str = str + "entity["+player GetEntityNumber()+"]";
}
return str;
}
*/
function player_shock_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
entid = getlocalplayer( localClientNum ) GetEntityNumber();
if ( newVal )
{
if ( !IsDefined( level.shock_field_fx[entid] ) )
{
fx = "player/fx_plyr_shock_field";
if ( is_local_player( localClientNum ) )
{
fx = "player/fx_plyr_shock_field_1p";
}
tag = "j_spinelower";
level.shock_field_fx[entid] = PlayFXOnTag( localClientNum, fx, self, tag );
}
}
else
{
if ( IsDefined(level.shock_field_fx[entid]) )
{
stopfx(localClientNum, level.shock_field_fx[entid]);
level.shock_field_fx[entid] = undefined;
}
}
}
@@ -0,0 +1,162 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_shock_field",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "allplayers", "shock_field" , 1, 1, "int" );
ability_player::register_gadget_activation_callbacks( 39, &gadget_shock_field_on, &gadget_shock_field_off );
ability_player::register_gadget_possession_callbacks( 39, &gadget_shock_field_on_give, &gadget_shock_field_on_take );
ability_player::register_gadget_flicker_callbacks( 39, &gadget_shock_field_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 39, &gadget_shock_field_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 39, &gadget_shock_field_is_flickering );
callback::on_connect( &gadget_shock_field_on_connect );
}
function gadget_shock_field_is_inuse( slot )
{
// returns true when the gadget is on
return self GadgetIsActive( slot );
}
function gadget_shock_field_is_flickering( slot )
{
// returns true when the gadget is flickering
}
function gadget_shock_field_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
}
function gadget_shock_field_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
self clientfield::set( "shock_field", 0 );
}
function gadget_shock_field_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
self clientfield::set( "shock_field", 0 );
}
//self is the player
function gadget_shock_field_on_connect()
{
// setup up stuff on player connect
}
function gadget_shock_field_on( slot, weapon )
{
// excecutes when the gadget is turned on
self GadgetSetActivateTime( slot, GetTime() );
self thread shock_field_think( slot, weapon );
self clientfield::set( "shock_field", 1 );
}
function gadget_shock_field_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self notify ( "shock_field_off" );
self clientfield::set( "shock_field", 0 );
}
function shock_field_think( slot, weapon )
{
self endon ( "shock_field_off" );
self notify ( "shock_field_on" );
self endon( "shock_field_on" );
while( 1 )
{
wait ( .25 );
if ( !self gadget_shock_field_is_inuse( slot ) )
{
return;
}
entities = GetDamageableEntArray( self.origin, weapon.gadget_shockfield_radius );
foreach( entity in entities )
{
if( IsPlayer( entity ) )
{
if( self GetEntityNumber() == entity GetEntityNumber() )
{
continue;
}
if( self.team == entity.team )
{
continue;
}
if ( !IsAlive( entity ) )
{
continue;
}
if ( BulletTracePassed( self.origin + ( 0, 0, 30 ), entity.origin + ( 0, 0, 30 ), true, self, undefined, false, true ) )
{
entity DoDamage( weapon.gadget_shockfield_damage, self.origin + ( 0, 0, 30 ), self, self, 0, "MOD_GRENADE_SPLASH" );
entity setdoublejumpenergy( 0 );
entity resetdoublejumprechargetime();
entity thread shock_field_zap_sound( weapon );
self thread flicker_field_fx();
shellshock_duration = .25;
if ( entity util::mayApplyScreenEffect() )
{
shellshock_duration = 0.5;
entity shellshock("proximity_grenade", shellshock_duration, false );
}
}
}
}
}
}
function shock_field_zap_sound( weapon )
{
if ( ( isdefined( self.shock_field_zap_sound ) && self.shock_field_zap_sound ) )
return;
self.shock_field_zap_sound=true;
self playsound("wpn_taser_mine_zap");
wait 1.0;
if ( IsDefined(self) )
self.shock_field_zap_sound=false;
}
function flicker_field_fx()
{
self endon ( "shock_field_off" );
self notify( "flicker_field_fx" );
self endon ( "flicker_field_fx" );
self clientfield::set( "shock_field", 0 );
wait RandomFloatRange(0.03,0.23);
if (IsDefined(self))
self clientfield::set( "shock_field", 1 );
}
@@ -0,0 +1,21 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_smokescreen",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,112 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_smokescreen",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 36, &gadget_smokescreen_on, &gadget_smokescreen_off );
ability_player::register_gadget_possession_callbacks( 36, &gadget_smokescreen_on_give, &gadget_smokescreen_on_take );
ability_player::register_gadget_flicker_callbacks( 36, &gadget_smokescreen_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 36, &gadget_smokescreen_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 36, &gadget_smokescreen_is_flickering );
ability_player::register_gadget_primed_callbacks( 36, &gadget_smokescreen_is_primed );
callback::on_connect( &gadget_smokescreen_on_connect );
}
function gadget_smokescreen_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_smokescreen_on" );
}
function gadget_smokescreen_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
return self [[level.cybercom.smokescreen._is_flickering]](slot);
}
return false;
}
function gadget_smokescreen_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
self [[level.cybercom.smokescreen._on_flicker]](slot, weapon);
}
}
function gadget_smokescreen_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
self [[level.cybercom.smokescreen._on_give]](slot, weapon);
}
}
function gadget_smokescreen_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
self [[level.cybercom.smokescreen._on_take]](slot, weapon);
}
}
//self is the player
function gadget_smokescreen_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
self [[level.cybercom.smokescreen._on_connect]]();
}
}
function gadget_smokescreen_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_smokescreen_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
self [[level.cybercom.smokescreen._on]](slot, weapon);
}
}
function gadget_smokescreen_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_smokescreen_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
self [[level.cybercom.smokescreen._off]](slot, weapon);
}
}
function gadget_smokescreen_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.smokescreen))
{
self [[level.cybercom.smokescreen._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,53 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\system_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\postfx_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
function autoexec __init__sytem__() { system::register("gadget_speed_burst",&__init__,undefined,undefined); }
function __init__()
{
callback::on_localplayer_spawned( &on_localplayer_spawned );
clientfield::register( "toplayer", "speed_burst", 1, 1, "int", &player_speed_changed, !true, true );
visionset_mgr::register_visionset_info( "speed_burst", 1, 9, undefined, "speed_burst_initialize" );
}
function on_localplayer_spawned( localClientNum )
{
if( self != GetLocalPlayer( localClientNum ) )
return;
filter::init_filter_speed_burst(self);
filter::disable_filter_speed_burst( self,3 );
}
function player_speed_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( newVal )
{
if( self == GetLocalPlayer( localClientNum ) )
{
filter::enable_filter_speed_burst( self, 3 );
}
}
else
{
if( self == GetLocalPlayer( localClientNum ) )
{
filter::disable_filter_speed_burst( self,3 );
}
}
}
@@ -0,0 +1,151 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#namespace speedburst;
function autoexec __init__sytem__() { system::register("gadget_speed_burst",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "toplayer", "speed_burst" , 1, 1, "int" );
ability_player::register_gadget_activation_callbacks( 13, &gadget_speed_burst_on, &gadget_speed_burst_off );
ability_player::register_gadget_possession_callbacks( 13, &gadget_speed_burst_on_give, &gadget_speed_burst_on_take );
ability_player::register_gadget_flicker_callbacks( 13, &gadget_speed_burst_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 13, &gadget_speed_burst_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 13, &gadget_speed_burst_is_flickering );
if ( !IsDefined( level.vsmgr_prio_visionset_speedburst ) )
{
level.vsmgr_prio_visionset_speedburst = 60;
}
visionset_mgr::register_info( "visionset", "speed_burst", 1, level.vsmgr_prio_visionset_speedburst, 9, true, &visionset_mgr::ramp_in_out_thread_per_player_death_shutdown, false );
callback::on_connect( &gadget_speed_burst_on_connect );
}
function gadget_speed_burst_is_inuse( slot )
{
// returns true when local script gadget state is on
return self flagsys::get( "gadget_speed_burst_on" );
}
function gadget_speed_burst_is_flickering( slot )
{
// returns true when local script gadget state is flickering
return self GadgetFlickering( slot );
}
function gadget_speed_burst_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
self thread gadget_speed_burst_flicker( slot, weapon );
}
function gadget_speed_burst_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
flagsys::set( "speed_burst_on" );
self clientfield::set_to_player( "speed_burst", 0 );
}
function gadget_speed_burst_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
flagsys::clear( "speed_burst_on" );
self clientfield::set_to_player( "speed_burst", 0 );
}
//self is the player
function gadget_speed_burst_on_connect()
{
// setup up stuff on player connec
}
function gadget_speed_burst_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_speed_burst_on" );
self GadgetSetActivateTime( slot, GetTime() );
self clientfield::set_to_player( "speed_burst", 1 );
visionset_mgr::activate( "visionset", "speed_burst", self, 0.4, .1, 1.35 );
self.speedburstLastOnTime = getTime();
self.speedburstOn = true;
self.speedburstKill = false;
}
function gadget_speed_burst_off( slot, weapon )
{
self notify( "gadget_speed_burst_off" );
// excecutes when the gadget is turned off
self flagsys::clear( "gadget_speed_burst_on" );
self clientfield::set_to_player( "speed_burst", 0 );
self.speedburstLastOnTime = getTime();
self.speedburstOn = false;
if ( IsAlive( self ) && ( isdefined( self.speedburstKill ) && self.speedburstKill ) && isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon );
}
self.speedburstKill = false; // _off is getting called before _on when activated
}
function gadget_speed_burst_flicker( slot, weapon )
{
self endon( "disconnect" );
if ( !self gadget_speed_burst_is_inuse( slot ) )
{
return;
}
eventTime = self._gadgets_player[slot].gadget_flickertime;
self set_gadget_status( "Flickering", eventTime );
while( 1 )
{
if ( !self GadgetFlickering( slot ) )
{
self set_gadget_status( "Normal" );
return;
}
wait( 0.5 );
}
}
function set_gadget_status( status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Vision Speed burst: " + status + timeStr );
}
@@ -0,0 +1,7 @@
// Name of the visionset file
// alias in script
// priority vs other visionsets
// number of steps when ramping in/out
// activation ramp-in time
// How long to hold after ramp-in is done and before ramping-out
// deactivation ramp-out time
@@ -0,0 +1,22 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_surge",&__init__,undefined,undefined); }
function __init__()
{
}
+111
View File
@@ -0,0 +1,111 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_surge",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 21, &gadget_surge_on, &gadget_surge_off );
ability_player::register_gadget_possession_callbacks( 21, &gadget_surge_on_give, &gadget_surge_on_take );
ability_player::register_gadget_flicker_callbacks( 21, &gadget_surge_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 21, &gadget_surge_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 21, &gadget_surge_is_flickering );
ability_player::register_gadget_primed_callbacks( 21, &gadget_surge_is_primed );
callback::on_connect( &gadget_surge_on_connect );
}
function gadget_surge_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_surge_on" );
}
function gadget_surge_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
return self [[level.cybercom.surge._is_flickering]](slot);
}
}
function gadget_surge_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
self [[level.cybercom.surge._on_flicker]](slot, weapon);
}
}
function gadget_surge_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
self [[level.cybercom.surge._on_give]](slot, weapon);
}
}
function gadget_surge_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
self [[level.cybercom.surge._on_take]](slot, weapon);
}
}
//self is the player
function gadget_surge_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
self [[level.cybercom.surge._on_connect]]();
}
}
function gadget_surge_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_surge_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
self [[level.cybercom.surge._on]](slot, weapon);
}
}
function gadget_surge_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_surge_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
self [[level.cybercom.surge._off]](slot, weapon);
}
}
function gadget_surge_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.surge))
{
self [[level.cybercom.surge._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,22 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_system_overload",&__init__,undefined,undefined); }
function __init__()
{
}
@@ -0,0 +1,111 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_system_overload",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 18, &gadget_system_overload_on, &gadget_system_overload_off );
ability_player::register_gadget_possession_callbacks( 18, &gadget_system_overload_on_give, &gadget_system_overload_on_take );
ability_player::register_gadget_flicker_callbacks( 18, &gadget_system_overload_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 18, &gadget_system_overload_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 18, &gadget_system_overload_is_flickering );
ability_player::register_gadget_primed_callbacks( 18, &gadget_system_overload_is_primed );
callback::on_connect( &gadget_system_overload_on_connect );
}
function gadget_system_overload_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_system_overload_on" );
}
function gadget_system_overload_is_flickering( slot )
{
// returns true when the gadget is flickering
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
return self [[level.cybercom.system_overload._is_flickering]](slot);
}
return false;
}
function gadget_system_overload_on_flicker( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
self [[level.cybercom.system_overload._on_flicker]](slot, weapon);
} // excuted when the gadget flickers
}
function gadget_system_overload_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
self [[level.cybercom.system_overload._on_give]](slot, weapon);
} // executed when gadget is added to the players inventory
}
function gadget_system_overload_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
self [[level.cybercom.system_overload._on_take]](slot, weapon);
}
}
//self is the player
function gadget_system_overload_on_connect()
{
// setup up stuff on player connect
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
self [[level.cybercom.system_overload._on_connect]]();
}
}
function gadget_system_overload_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_system_overload_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
self [[level.cybercom.system_overload._on]](slot, weapon);
}
}
function gadget_system_overload_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_system_overload_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
self [[level.cybercom.system_overload._off]](slot, weapon);
}
}
function gadget_system_overload_is_primed( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.system_overload))
{
self [[level.cybercom.system_overload._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,91 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
Line truncated
#namespace gadget_thief;
function autoexec __init__sytem__() { system::register("gadget_thief",&__init__,undefined,undefined); }
#precache( "client_fx", "weapon/fx_hero_blackjack_beam_source" );
#precache( "client_fx", "weapon/fx_hero_blackjack_beam_target" );
function __init__()
{
clientfield::register( "scriptmover", "gadget_thief_fx", 11000, 1, "int", &thief_clientfield_cb, !true, !true );
clientfield::register( "toplayer", "thief_state", 11000, 2, "int", &thief_ui_model_clientfield_cb, !true, !true );
clientfield::register( "toplayer", "thief_weapon_option", 11000, 4, "int", &thief_weapon_option_ui_model_clientfield_cb, !true, !true );
clientfield::register( "clientuimodel", "playerAbilities.playerGadget3.flashStart", 11000, 3, "int", undefined, !true, !true );
clientfield::register( "clientuimodel", "playerAbilities.playerGadget3.flashEnd", 11000, 3, "int", undefined, !true, !true );
level._effect["fx_hero_blackjack_beam_source"] = "weapon/fx_hero_blackjack_beam_source";
level._effect["fx_hero_blackjack_beam_target"] = "weapon/fx_hero_blackjack_beam_target";
callback::on_localplayer_spawned( &on_localplayer_spawned );
}
function thief_clientfield_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
self endon( "entityshutdown" );
playfxoncamera( localclientnum, level._effect["fx_hero_blackjack_beam_target"], (0,0,0), (1,0,0), (0,0,1) );
playfx( localclientnum, level._effect["fx_hero_blackjack_beam_source"], self.origin );
}
function thief_ui_model_clientfield_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
update_thief( localClientNum, newVal );
}
function thief_weapon_option_ui_model_clientfield_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
update_thief_weapon( localClientNum, newVal );
}
function update_thief( localClientNum, newVal )
{
controllerModel = GetUIModelForController( localClientNum );
if ( isdefined( controllerModel ) )
{
thiefStatusModel = GetUIModel( controllerModel, "playerAbilities.playerGadget3.thiefStatus" );
if ( isdefined( thiefStatusModel ) )
{
SetUIModelValue( thiefStatusModel, newVal );
}
}
}
function update_thief_weapon( localClientNum, newVal )
{
controllerModel = GetUIModelForController( localClientNum );
if ( isdefined( controllerModel ) )
{
thiefStatusModel = GetUIModel( controllerModel, "playerAbilities.playerGadget3.thiefWeaponStatus" );
if ( isdefined( thiefStatusModel ) )
{
SetUIModelValue( thiefStatusModel, newVal );
}
}
}
function on_localplayer_spawned( localClientNum )
{
thief_state = 0;
thief_weapon_option = 0;
if ( getserverhighestclientfieldversion() >= 11000 )
{
thief_state = self clientfield::get_to_player( "thief_state" );
thief_weapon_option = self clientfield::get_to_player( "thief_weapon_option" );
}
update_thief( localClientNum, thief_state );
update_thief_weapon( localClientNum, thief_weapon_option );
}
+883
View File
@@ -0,0 +1,883 @@
#using scripts\codescripts\struct;
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\killstreaks_shared;
#using scripts\shared\system_shared;
#using scripts\shared\scoreevents_shared;
#using scripts\shared\util_shared;
#using scripts\shared\weapons\_weaponobjects;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\abilities\_ability_gadgets;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\_burnplayer;
Line truncated
#namespace thief;
function autoexec __init__sytem__() { system::register("gadget_thief",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "toplayer", "thief_state", 11000, 2, "int" );
clientfield::register( "toplayer", "thief_weapon_option", 11000, 4, "int" );
ability_player::register_gadget_activation_callbacks( 44, &gadget_thief_on_activate, &gadget_thief_on_deactivate );
ability_player::register_gadget_possession_callbacks( 44, &gadget_thief_on_give, &gadget_thief_on_take );
ability_player::register_gadget_flicker_callbacks( 44, &gadget_thief_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 44, &gadget_thief_is_inuse );
ability_player::register_gadget_ready_callbacks( 44, &gadget_thief_is_ready );
ability_player::register_gadget_is_flickering_callbacks( 44, &gadget_thief_is_flickering );
clientfield::register( "scriptmover", "gadget_thief_fx", 11000, 1, "int" );
clientfield::register( "clientuimodel", "playerAbilities.playerGadget3.flashStart", 11000, 3, "int" );
clientfield::register( "clientuimodel", "playerAbilities.playerGadget3.flashEnd", 11000, 3, "int" );
callback::on_connect( &gadget_thief_on_connect );
callback::on_spawned( &gadget_thief_on_player_spawn );
setup_gadget_thief_array();
level.gadgetThiefTimeCharge = false;
level.gadgetThiefShutdownFullcharge = getDvarInt( "gadgetThiefShutdownFullCharge", 1 );
/#
level thread updateDvars();
#/
}
/#
function updateDvars()
{
while(1)
{
level.gadgetThiefTimeCharge = getDvarInt( "gadget_thief_time_charge", 0 );
wait(1.0);
}
}
#/
function setup_gadget_thief_array()
{
weapons = EnumerateWeapons( "weapon" );
level.gadgetthiefArray = [];
for ( i = 0; i < weapons.size; i++ )
{
if ( weapons[i].isGadget && weapons[i].isheroweapon == true )
{
if ( weapons[i].name != "gadget_thief" &&
weapons[i].name != "gadget_roulette" &&
weapons[i].name != "hero_bowlauncher2" &&
weapons[i].name != "hero_bowlauncher3" &&
weapons[i].name != "hero_bowlauncher4" &&
weapons[i].name != "hero_pineapple_grenade" &&
weapons[i].name != "gadget_speed_burst" &&
weapons[i].name != "hero_minigun_body3" &&
weapons[i].name != "hero_lightninggun_arc" )
{
ArrayInsert( level.gadgetthiefArray, weapons[i], 0 );
}
}
}
}
function gadget_thief_is_inuse( slot )
{
// returns true when local script gadget state is on
return self GadgetIsActive( slot );
}
function gadget_thief_is_flickering( slot )
{
// returns true when local script gadget state is flickering
return self GadgetFlickering( slot );
}
function gadget_thief_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
self thread gadget_thief_flicker( slot, weapon );
}
function gadget_thief_on_give( slot, weapon )
{
self.gadget_thief_kill_callback = &gadget_thief_kill_callback;
self.gadget_thief_slot = slot;
// executed when gadget is added to the players inventory
self thread gadget_thief_active( slot, weapon );
if ( SessionModeIsMultiplayerGame() )
{
self.isThief = true;
}
self clientfield::set_to_player( "thief_state", 0 );
currentPower = (isdefined(self gadgetPowerGet( slot ))?self gadgetPowerGet( slot ):0);
savedPower = 0;
if( isdefined( self.pers["held_gadgets_power"] ) && isdefined( self.pers[#"thiefWeapon"] ) && isdefined( self.pers["held_gadgets_power"][self.pers[#"thiefWeapon"]] ) )
{
savedPower = self.pers["held_gadgets_power"][self.pers[#"thiefWeapon"]];
}
if ( currentPower >= 100 || savedPower >= 100 )
{
self.giveStolenWeaponOnSpawn = true;
self.giveStolenWeaponSlot = slot;
}
}
function gadget_thief_kill_callback( victim, weapon )
{
assert( isDefined( self.gadget_thief_slot ) );
self thread handleThiefKill( self.gadget_thief_slot, weapon, victim );
}
function gadget_thief_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
/#
// for supporting dev gui
if ( level.devgui_giving_abilities === true )
{
self.isThief = false;
}
#/
}
//self is the player
function gadget_thief_on_connect()
{
// setup up stuff on player connect
self.pers[#"thiefAllowFlip"] = true;
/#
level.gadgetThiefTForceBeam = getDvarInt( "gadget_thief_force_beam", 0 );
if ( level.gadgetThiefTForceBeam )
{
self thread watchForAllKillsDebug();
}
#/
}
function gadget_thief_on_player_spawn()
{
if ( self.isThief === true )
{
// setup up stuff on player spawned
self thread watchHeroWeaponChanged();
if ( self.giveStolenWeaponOnSpawn === true )
{
self givePreviouslyEarnedSpecialistWeapon( self.giveStolenWeaponSlot, true );
self GadgetPowerSet( self.giveStolenWeaponSlot, 100 );
self.giveStolenWeaponOnSpawn = undefined;
self.giveStolenWeaponSlot = undefined;
}
}
}
function watch_entity_shutdown()
{
}
function gadget_thief_on_activate( slot, weapon )
{
}
function gadget_thief_is_ready( slot, weapon )
{
}
function gadget_thief_active( slot, weapon )
{
waittillframeend;
if ( isdefined( self.pers[#"thiefWeapon"] ) && weapon.name != "gadget_thief" )
{
self thread gadget_give_random_gadget( slot, weapon, self.pers[#"thiefWeaponStolenFrom"] );
}
self thread watchForHeroKill( slot );
}
function getStolenHeroWeapon( gadget )
{
if ( gadget.isheroweapon == false )
{
heroWeaponEquivalent = "";
switch( gadget.name )
{
case "gadget_flashback":
{
heroWeaponEquivalent = "hero_lightninggun";
}
break;
case "gadget_combat_efficiency":
{
heroWeaponEquivalent = "hero_annihilator";
}
break;
case "gadget_heat_wave" :
{
heroWeaponEquivalent = "hero_flamethrower";
}
break;
case "gadget_vision_pulse":
{
heroWeaponEquivalent = "hero_bowlauncher";
}
break;
case "gadget_speed_burst":
{
heroWeaponEquivalent = "hero_gravityspikes";
}
break;
case "gadget_camo":
{
heroWeaponEquivalent = "hero_armblade";
}
break;
case "gadget_armor":
{
heroWeaponEquivalent = "hero_pineapplegun";
}
break;
case "gadget_resurrect":
{
heroWeaponEquivalent = "hero_chemicalgelgun";
}
break;
case "gadget_clone":
{
heroWeaponEquivalent = "hero_minigun";
}
break;
}
if ( heroWeaponEquivalent != "" )
{
heroweapon = getweapon( heroWeaponEquivalent );
}
}
else
{
heroweapon = gadget;
}
return heroweapon;
}
function resetFlashStartAndEndAfterDelay( delay )
{
self notify( "resetFlashStartAndEnd" );
self endon ( "resetFlashStartAndEnd" );
wait delay;
self clientfield::set_player_uimodel( "playerAbilities.playerGadget3.flashStart", 0 );
self clientfield::set_player_uimodel( "playerAbilities.playerGadget3.flashEnd", 0 );
}
function getThiefPowerGain()
{
gadgetThiefKillPowerGain = getDvarFloat( "gadgetThiefKillPowerGain", 12.5 );
thiefGametypeFactor = (isdefined(GetGametypeSetting( "scoreThiefPowerGainFactor" ))?GetGametypeSetting( "scoreThiefPowerGainFactor" ):1.0);
gadgetThiefKillPowerGain *= thiefGametypeFactor;
return gadgetThiefKillPowerGain;
}
function handleThiefKill( slot, weapon, victim )
{
if ( isdefined( weapon ) && !killstreaks::is_killstreak_weapon( weapon ) && !weapon.isHeroWeapon && IsAlive( self ) )
{
if ( self gadgetIsActive( slot ) == false )
{
power = self gadgetPowerGet( slot );
gadgetThiefKillPowerGain = getThiefPowerGain();
gadgetThiefKillPowerGainWithoutMultiplier = getThiefPowerGain();
victimGadgetPower = (isdefined(victim gadgetPowerGet( 0 ))?victim gadgetPowerGet( 0 ):0);
alwaysPerformGain = false; // if we want to hear power gains even at full power, set this to true
if ( alwaysPerformGain || power < 100 )
{
if ( victimGadgetPower == 100 )
{
// aku-- removed PowerTap by commenting out for now
// gadgetThiefKillPowerGain *= getDvarFloat( "gadgetThiefKillFullPowerMultiplier", 2.0 );
// scoreevents::processScoreEvent( "kill_enemy_who_has_full_power", self );
// self playsoundtoplayer ("mpl_bm_specialist_bar_extra", self);
self playsoundtoplayer ("mpl_bm_specialist_bar_thief", self); // play "normal" earn audio
// JMCCAWLEY
// this is when you kill an enemy that has a full meter and you earn extra power
}
else
{
self playsoundtoplayer ("mpl_bm_specialist_bar_thief", self);
// JMCCAWLEY
// this is when you kill an enemy that has does not have a full meter
}
}
currentPower = power + gadgetThiefKillPowerGain;
if ( power < 80 && currentPower >= 80 && currentPower < 100 )
{
if ( self HasPerk( "specialty_overcharge" ) ) // overclock
{
currentPower = 100;
}
}
if ( currentPower >= 100 )
{
wasFullyCharged = ( power >= 100 );
self earnedSpecialistWeapon( victim, slot, wasFullyCharged );
}
// todo handle overlapping cases, delay animations when you get several in a row
self clientfield::set_player_uimodel( "playerAbilities.playerGadget3.flashStart", Int(power / gadgetThiefKillPowerGainWithoutMultiplier) );
self clientfield::set_player_uimodel( "playerAbilities.playerGadget3.flashEnd", Int(currentPower / gadgetThiefKillPowerGainWithoutMultiplier) );
self thread resetFlashStartAndEndAfterDelay( 3.0 ); // 3 seconds
self GadgetPowerSet( slot, currentPower );
}
else // the else for if ( self gadgetIsActive( slot ) == false )
{
if ( IsPlayer( victim ) && self.pers[#"thiefWeaponStolenFrom"] === victim.entNum && weapon.isHeroWeapon )
{
scoreevents::processScoreEvent( "kill_enemy_with_their_hero_weapon", self );
}
}
}
}
function earnedSpecialistWeapon( victim, slot, wasFullyCharged, stolenHeroWeapon )
{
if ( !isdefined( victim ) )
return;
heroWeapon = undefined;
victimIsBlackjack = ( ( victim.isThief === true ) || ( victim.isRoulette === true ) );
if ( victimIsBlackjack )
{
if( isDefined( stolenHeroWeapon ) )
{
heroWeapon = stolenHeroWeapon;
}
else if ( isdefined( victim.pers[#"thiefWeapon"] ) && ( victim.pers[#"thiefWeapon"].isHeroWeapon === true ) )
{
heroWeapon = victim.pers[#"thiefWeapon"];
}
}
if ( !isdefined( heroWeapon ) )
{
victimGadget = victim._gadgets_player[0];
heroWeapon = getStolenHeroWeapon( victimGadget );
}
if ( wasFullyCharged )
{
if ( isdefined( heroWeapon ) && isdefined( self.pers[#"thiefWeapon"] ) && heroWeapon != self.pers[#"thiefWeapon"] && ( !isdefined( self.pers[#"thiefWeaponOption"] ) || heroWeapon != self.pers[#"thiefWeaponOption"] ) && self.pers[#"thiefAllowFlip"] )
{
self thread giveFlipWeapon( slot, victim, heroWeapon );
}
// JMCCAWLEY
// this is when you kill an enemy and you have full power yourself.
}
else
{
self clientfield::set_to_player( "thief_state", 1 );
self clientfield::set_to_player( "thief_weapon_option", 0 );
self thread gadget_give_random_gadget( slot, heroWeapon, victim.entNum );
// self thread disable_hero_gadget_activation( GetDvarFloat( "src_thief_activation_wait", THIEF_ACTIVATION_WAIT ) );
self.pers[#"thiefWeaponOption"] = undefined;
self.thief_new_gadget_time = GetTime();
if ( isdefined( self.pers[#"thiefWeapon"] ) && ( self.pers[#"thiefWeapon"].isHeroWeapon === true ) )
{
self handleStolenScoreEvent( self.pers[#"thiefWeapon"] );
}
self playsoundtoplayer( "mpl_bm_specialist_bar_filled", self ); // no need to play this here, handled elsewhere
// JMCCAWLEY
// this is when you kill an enemy and you did not have full power and this event caused you to get full power
}
}
function giveFlipWeapon( slot, victim, heroWeapon )
{
self notify( "give_flip_weapon_singleton" );
self endon( "give_flip_weapon_singleton" );
previousGiveFlipTime = (isdefined(self.last_thief_give_flip_time)?self.last_thief_give_flip_time:0);
self.last_thief_give_flip_time = GetTime();
alreadyGivenFlipThisFrame = ( previousGiveFlipTime == self.last_thief_give_flip_time );
self.pers[#"thiefWeaponOption"] = heroWeapon;
victimBodyIndex = GetVictimBodyIndex( victim, heroWeapon );
self handleStolenScoreEvent( heroWeapon );
self notify( "thief_flip_activated" );
if ( self.last_thief_give_flip_time - previousGiveFlipTime > 99 )
self playsoundtoplayer( "mpl_bm_specialist_coin_place", self );
// self DisableOffhandSpecial();
// self thread failsafe_reenable_offhand_special();
// wait for new gadget flip animation to finish before allowing second weapon flip
elapsed_time = ( GetTime() - (isdefined(self.thief_new_gadget_time)?self.thief_new_gadget_time:0) ) * 0.001;
if ( elapsed_time < 0.75 )
wait ( 0.75 - elapsed_time );
self clientfield::set_to_player( "thief_state", 2 );
self thread watchForOptionUse( slot, victimBodyIndex, false );
}
function givePreviouslyEarnedSpecialistWeapon( slot, justSpawned )
{
if ( isdefined( self.pers[#"thiefWeapon"] ) )
{
self thread gadget_give_random_gadget( slot, self.pers[#"thiefWeapon"], self.pers[#"thiefWeaponStolenFrom"], justSpawned );
if ( isdefined( self.pers[#"thiefWeaponOption"] ) )
{
self thread watchForOptionUse( slot, self.pers[#"thief_weapon_option_body_index"], justSpawned );
}
}
}
function disable_hero_gadget_activation( duration )
{
self endon( "death" );
self endon( "disconnect" );
self endon( "thief_flip_activated" );
self DisableOffhandSpecial();
wait duration;
self EnableOffhandSpecial();
}
function failsafe_reenable_offhand_special()
{
self endon( "end_failsafe_reenable_offhand_special" );
wait 3.0;
if ( isdefined( self ) )
{
self EnableOffhandSpecial();
}
}
function handleStolenScoreEvent( heroweapon )
{
switch( heroweapon.name )
{
case "hero_minigun":
case "hero_minigun_body3":
event = "minigun_stolen";
label = "SCORE_MINIGUN_STOLEN";
break;
case "hero_flamethrower":
event = "flamethrower_stolen";
label = "SCORE_FLAMETHROWER_STOLEN";
break;
case "hero_lightninggun":
case "hero_lightninggun_arc":
event = "lightninggun_stolen";
label = "SCORE_LIGHTNINGGUN_STOLEN";
break;
case "hero_chemicalgelgun":
case "hero_firefly_swarm":
event = "gelgun_stolen";
label = "SCORE_GELGUN_STOLEN";
break;
case "hero_pineapplegun":
case "hero_pineapple_grenade":
event = "pineapple_stolen";
label = "SCORE_PINEAPPLE_STOLEN";
break;
case "hero_armblade":
event = "armblades_stolen";
label = "SCORE_ARMBLADES_STOLEN";
break;
case "hero_bowlauncher":
case "hero_bowlauncher2":
case "hero_bowlauncher3":
case "hero_bowlauncher4":
event = "bowlauncher_stolen";
label = "SCORE_BOWLAUNCHER_STOLEN";
break;
case "hero_gravityspikes":
event = "gravityspikes_stolen";
label = "SCORE_GRAVITYSPIKES_STOLEN";
break;
case "hero_annihilator":
event = "annihilator_stolen";
label = "SCORE_ANNIHILATOR_STOLEN";
break;
default:
return;
}
// note: score events with 0 score from scoreinfo.csv are considered "disabled"
// thread scoreevents::processScoreEvent( event, self );
// send as LUI notify instead
self LUINotifyEvent( &"score_event", 5, iString( label ), 0 /*score*/, 0 /*combatEfficiencyBonus*/ , 0 /*rampageBonus*/, 1 /*thief score*/ );
}
function watchForHeroKill( slot )
{
self notify( "watchForThiefKill_singleton" );
self endon ( "watchForThiefKill_singleton" );
self.gadgetThiefActive = true;
while( 1 )
{
self waittill( "hero_shutdown_gadget", heroGadget, victim );
stolenHeroWeapon = getStolenHeroWeapon( heroGadget );
performClientSideEffect = false; // disabling client side effects for now
if ( performClientSideEffect )
{
self spawnThiefBeamEffect( victim.origin );
clientSideEffect = spawn( "script_model", victim.origin );
clientSideEffect clientfield::set( "gadget_thief_fx", 1 );
clientSideEffect thread waitthendelete( 5 );
}
// KSHERWOOD
// This is when Blackjack Shuts down an Enemy to Steal their Weapon.
if ( isdefined( level.gadgetThiefShutdownFullcharge ) && level.gadgetThiefShutdownFullcharge )
{
if ( self gadgetIsActive( slot ) == false )
{
scoreevents::processScoreEvent( "thief_shutdown_enemy", self );
//self.pers[#"thiefWeaponOption"] = stolenHeroWeapon;
//DROCHE
//self thread gadget_give_random_gadget( slot, stolenHeroWeapon, victim.entNum );
power = self gadgetPowerGet( slot );
self GadgetPowerSet( slot, 100.0 );
wasFullyCharged = ( power >= 100 );
self earnedSpecialistWeapon( victim, slot, wasFullyCharged, stolenHeroWeapon );
}
}
}
}
function spawnThiefBeamEffect( origin )
{
clientSideEffect = spawn( "script_model", origin );
clientSideEffect clientfield::set( "gadget_thief_fx", 1 );
clientSideEffect thread waitthendelete( 5 );
}
/#
function watchForAllKillsDebug()
{
while( 1 )
{
self waittill( "killed_enemy_player", victim );
self spawnThiefBeamEffect( victim.origin );
clientSideEffect = spawn( "script_model", victim.origin );
clientSideEffect clientfield::set( "gadget_thief_fx", 1 );
clientSideEffect thread waitthendelete( 5 );
}
}
#/
function waitthendelete( time )
{
wait ( time );
self delete();
}
function gadget_give_random_gadget( slot, weapon, weaponStolenFromEntnum, justSpawned = false )
{
previousGadget = undefined; // script compiler complains if this is not here
for ( i = 0; i < 3; i++ )
{
if ( isdefined( self._gadgets_player[i] ) )
{
if ( !isdefined( previousGadget ) )
{
previousGadget = self._gadgets_player[i];
}
self TakeWeapon( self._gadgets_player[i] );
}
}
if( !isDefined( weapon ) )
{
weapon = array::random( level.gadgetthiefarray );
}
selectedWeapon = weapon;
/#
if ( GetDvarInt( "scr_thiefIndex", -1 ) != -1 )
{
selectedWeapon = level.gadgetthiefArray[ GetDvarInt( "scr_thiefIndex", -1 ) ];
}
#/
self GiveWeapon( selectedWeapon );
self GadgetCharging( slot, level.gadgetThiefTimeCharge );
self.gadgetThiefChargingSlot = slot;
self.pers[#"thiefWeapon"] = selectedWeapon;
self.pers[#"thiefWeaponStolenFrom"] = weaponStolenFromEntnum;
if ( !isdefined( previousGadget ) || previousGadget != selectedWeapon )
{
self notify( "thief_hero_weapon_changed", justSpawned, selectedWeapon );
}
self thread watchGadgetActivated( slot );
}
function watchForOptionUse( slot, victimBodyIndex, justSpawned )
{
self endon( "death" );
self endon( "hero_gadget_activated" );
self notify( "watchForOptionUse_thief_singleton" );
self endon ( "watchForOptionUse_thief_singleton" );
if ( self.pers[#"thiefAllowFlip"] == false )
return;
self clientfield::set_to_player( "thief_weapon_option", victimBodyIndex + 1 ); //sending this value to lua which uses 1-index
self.pers[#"thief_weapon_option_body_index"] = victimBodyIndex;
if ( !justSpawned )
{
wait 0.85; // wait until the "flip activated" animation is done
self EnableOffhandSpecial();
self notify( "end_failsafe_reenable_offhand_special" );
}
while( 1 )
{
if ( self dpad_left_pressed() )
{
self clientfield::set_to_player( "thief_state", 1 );
self clientfield::set_to_player( "thief_weapon_option", 0 );
self.pers[#"thiefWeapon"] = self.pers[#"thiefWeaponOption"];
self.pers[#"thiefWeaponOption"] = undefined;
self.pers[#"thiefAllowFlip"] = false;
self thread gadget_give_random_gadget( slot, self.pers[#"thiefWeapon"], self.pers[#"thiefWeaponStolenFrom"] );
if ( isdefined( level.playGadgetReady ) )
{
self thread [[level.playGadgetReady]]( self.pers[#"thiefWeapon"], true );
}
return;
}
{wait(.05);};
}
}
function dpad_left_pressed()
{
return self ActionSlotThreeButtonPressed();
}
function watchHeroWeaponChanged()
{
self notify( "watchHeroWeaponChanged_singleton" );
self endon ( "watchHeroWeaponChanged_singleton" );
self endon( "death" );
self endon( "disconnect" );
while( 1 )
{
self waittill( "thief_hero_weapon_changed", justSpawned, newWeapon );
if ( justSpawned )
{
if ( isdefined( newWeapon ) && isdefined( newWeapon.gadgetReadySoundPlayer ) )
{
self playsoundtoplayer( newWeapon.gadgetReadySoundPlayer, self );
}
}
else
{
self playsoundtoplayer( "mpl_bm_specialist_thief", self );
}
}
}
function watchGadgetActivated( slot )
{
self notify( "watchGadgetActivated_singleton" );
self endon ( "watchGadgetActivated_singleton" );
self waittill( "hero_gadget_activated" );
self clientfield::set_to_player( "thief_weapon_option", 0 );
self.pers[#"thiefWeapon"] = undefined;
self.pers[#"thiefWeaponOption"] = undefined;
self.pers[#"thiefAllowFlip"] = true;
self waittill( "heroAbility_off" );
power = self gadgetPowerGet( slot );
power = Int( power / getThiefPowerGain() ) * getThiefPowerGain();
self GadgetPowerSet( slot, power );
for ( i = 0; i < 3; i++ )
{
if ( isdefined( self._gadgets_player[i] ) )
{
self TakeWeapon( self._gadgets_player[i] );
}
}
self GiveWeapon( getweapon( "gadget_thief" ) );
self clientfield::set_to_player( "thief_state", 0 );
}
function gadget_thief_on_deactivate( slot, weapon )
{
self waittill( "heroAbility_off" );
for ( i = 0; i < 3; i++ )
{
if ( isdefined( self._gadgets_player[i] ) )
{
self TakeWeapon( self._gadgets_player[i] );
}
}
self GiveWeapon( weapon );
self GadgetCharging( slot, level.gadgetThiefTimeCharge );
self.gadgetThiefChargingSlot = slot;
//self.pers[#"thiefWeapon"] = undefined;
}
function gadget_thief_flicker( slot, weapon )
{
}
function set_gadget_status( status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
{
self IPrintlnBold( "Gadget thief: " + status + timeStr );
}
}
function GetVictimBodyIndex( victim, heroWeapon )
{
bodyIndex = victim GetCharacterBodyType();
if ( bodyIndex == 9 )
{
// we can't use Blackjack's body index, we need the body type associated with the weapon
// pulled from mp_character_customization gdt (thus hardcoded for now)
switch( heroWeapon.name )
{
case "hero_minigun":
case "hero_minigun_body3":
bodyIndex = 6;
break;
case "hero_flamethrower":
bodyIndex = 8;
break;
case "hero_lightninggun":
bodyIndex = 2;
break;
case "hero_chemicalgelgun":
bodyIndex = 5;
break;
case "hero_pineapplegun":
bodyIndex = 3;
break;
case "hero_armblade":
bodyIndex = 7;
break;
case "hero_bowlauncher":
case "hero_bowlauncher2":
case "hero_bowlauncher3":
case "hero_bowlauncher4":
bodyIndex = 1;
break;
case "hero_gravityspikes":
bodyIndex = 0;
break;
default:
case "hero_annihilator":
bodyIndex = 4;
break;
}
}
return bodyIndex;
}
@@ -0,0 +1,147 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\filter_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\lui_shared;
#using scripts\shared\system_shared;
#precache( "client_fx", "player/fx_plyr_ability_screen_blur_overdrive" );
function autoexec __init__sytem__() { system::register("gadget_unstoppable_force",&__init__,undefined,undefined); }
function __init__()
{
callback::on_localclient_shutdown( &on_localplayer_shutdown );
clientfield::register( "toplayer", "unstoppableforce_state", 1, 1, "int", &player_unstoppableforce_handler, !true, true);
}
function on_localplayer_shutdown(localClientNum)
{
stop_boost_camera_fx( localClientNum );
}
function player_unstoppableforce_handler(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
{
if ( !self IsLocalPlayer() || IsSpectating( localClientNum, false ) || ( (isdefined(level.localPlayers[localClientNum])) && (self GetEntityNumber() != level.localPlayers[localClientNum] GetEntityNumber())) )
{
return;
}
if( (newVal != oldval) && newVal)
{
EnableSpeedBlur( localClientNum, GetDvarFloat( "scr_unstoppableforce_amount", 0.15 ), GetDvarFloat( "scr_unstoppableforce_inner_radius", 0.6 ), GetDvarFloat( "scr_unstoppableforce_outer_radius", 1 ), GetDvarInt( "scr_unstoppableforce_velShouldScale", 1 ),GetDvarInt( "scr_unstoppableforce_velScale", 220 ));
self thread activation_flash(localClientNum);
self boost_fx_on_velocity(localClientNum);
}
else if ( (newVal != oldval) && !newval )
{
self stop_boost_camera_fx(localClientNum);
DisableSpeedBlur( localClientNum );
// Notify child threads to end.
self notify( "end_unstoppableforce_boost_fx");
}
}
// Flashes the screen white on activation.
function activation_flash(localClientNum)
{
self util::waittill_any_timeout(GetDvarFloat( "scr_unstoppableforce_activation_delay", 0.35 ), "unstoppableforce_arm_cross_end");
lui::screen_fade( GetDvarFloat("scr_unstoppableforce_flash_fade_in_time", 0.075), GetDvarFloat("scr_unstoppableforce_flash_alpha", 0.6), 0, "white" );
wait GetDvarFloat("scr_unstoppableforce_flash_fade_in_time", 0.075);
lui::screen_fade( GetDvarFloat("scr_unstoppableforce_flash_fade_out_time", 0.9), 0, GetDvarFloat("scr_unstoppableforce_flash_alpha", 0.6), "white" );
}
// Turn on the "hyperdrive" boost effects on camera
function enable_boost_camera_fx(localClientNum)
{
self.firstperson_fx_unstoppableforce = PlayFXOnCamera( localClientNum, "player/fx_plyr_ability_screen_blur_overdrive", (0,0,0), (1,0,0), (0,0,1) );
}
// Turn off the "hyperdrive" boost effects on camera
function stop_boost_camera_fx(localClientNum)
{
if (isdefined(self.firstperson_fx_unstoppableforce))
{
StopFX(localClientNum, self.firstperson_fx_unstoppableforce);
self.firstperson_fx_unstoppableforce = undefined;
}
}
// Stop FX when we die or hit a cybercom turnoff event.
function boost_fx_interrupt_handler(localClientNum)
{
self endon("end_unstoppableforce_boost_fx");
self util::waittill_any("disable_cybercom", "death");
stop_boost_camera_fx( localClientNum );
self notify( "end_unstoppableforce_boost_fx");
}
// Turn on boost FX (hyperdrive!) when we're moving forward fast enough.
// This effectively translates to sprinting forward with its current tuning.
function boost_fx_on_velocity(localClientNum) //self == player
{
self endon("disable_cybercom");
self endon("death");
self endon("end_unstoppableforce_boost_fx");
self endon("disconnect");
//Keep track of when we might need to turn force off the boost FX
self thread boost_fx_interrupt_handler(localclientnum);
while (isDefined(self))
{
// Get forward direction and speed information.
v_player_velocity = self GetVelocity();
v_player_forward = Anglestoforward(self.angles);
n_dot = VectorDot(VectorNormalize(v_player_velocity), v_player_forward);
n_speed = Length(v_player_velocity);
// If we're moving forward fast enough:
if (n_speed >= GetDvarInt( "scr_unstoppableforce_boost_speed_tol", 320 ) && n_dot > 0.8)
{
if (!isdefined(self.firstperson_fx_unstoppableforce))
{
self enable_boost_camera_fx(localClientNum);
}
}
else
{
if (isdefined(self.firstperson_fx_unstoppableforce))
{
self stop_boost_camera_fx(localClientNum);
}
}
{wait(.016);};
}
}
@@ -0,0 +1,109 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
function autoexec __init__sytem__() { system::register("gadget_unstoppable_force",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 29, &gadget_unstoppable_force_on, &gadget_unstoppable_force_off );
ability_player::register_gadget_possession_callbacks( 29, &gadget_unstoppable_force_on_give, &gadget_unstoppable_force_on_take );
ability_player::register_gadget_flicker_callbacks( 29, &gadget_unstoppable_force_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 29, &gadget_unstoppable_force_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 29, &gadget_unstoppable_force_is_flickering );
callback::on_connect( &gadget_unstoppable_force_on_connect );
clientfield::register( "toplayer", "unstoppableforce_state", 1, 1, "int");
}
function gadget_unstoppable_force_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_unstoppable_force_on" );
}
function gadget_unstoppable_force_is_flickering( slot )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
return self [[level.cybercom.unstoppable_force._is_flickering]](slot);
}
return false;
}
function gadget_unstoppable_force_on_flicker( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
self [[level.cybercom.unstoppable_force._on_flicker]](slot, weapon);
}
}
function gadget_unstoppable_force_on_give( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
self [[level.cybercom.unstoppable_force._on_give]](slot, weapon);
}
}
function gadget_unstoppable_force_on_take( slot, weapon )
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
self [[level.cybercom.unstoppable_force._on_take]](slot, weapon);
}
}
//self is the player
function gadget_unstoppable_force_on_connect()
{
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
self [[level.cybercom.unstoppable_force._on_connect]]();
}
}
function gadget_unstoppable_force_on( slot, weapon )
{
// excecutes when the gadget is turned on
self flagsys::set( "gadget_unstoppable_force_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
self [[level.cybercom.unstoppable_force._on]](slot, weapon);
}
}
function gadget_unstoppable_force_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_unstoppable_force_on" );
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
self [[level.cybercom.unstoppable_force._off]](slot, weapon);
}
}
function gadget_firefly_is_primed( slot, weapon )
{
// excecutes when the gadget is turned off`
if(isDefined(level.cybercom) && isDefined(level.cybercom.unstoppable_force))
{
self [[level.cybercom.unstoppable_force._is_primed]](slot, weapon);
}
}
@@ -0,0 +1,306 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\duplicaterender_mgr;
#using scripts\shared\filter_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_power;
#using scripts\shared\abilities\_ability_util;
Line truncated
#using scripts\shared\system_shared;
#namespace gadget_vision_pulse;
function autoexec __init__sytem__() { system::register("gadget_vision_pulse",&__init__,undefined,undefined); }
function __init__()
{
if ( !SessionModeIsCampaignGame() )
{
callback::on_localplayer_spawned( &on_localplayer_spawned );
duplicate_render::set_dr_filter_offscreen( "reveal_en", 50, "reveal_enemy", undefined, 2, "mc/hud_outline_model_z_red", 1 );
duplicate_render::set_dr_filter_offscreen( "reveal_self", 50, "reveal_self", undefined, 2, "mc/hud_outline_model_z_red_alpha", 1 );
}
clientfield::register( "toplayer", "vision_pulse_active", 1, 1, "int", &vision_pulse_changed, !true, true );
visionset_mgr::register_visionset_info( "vision_pulse", 1, 12, undefined, "vision_puls_bw" );
}
function on_localplayer_spawned( localClientNum )
{
if( self == GetLocalPlayer( localClientNum ) )
{
self.vision_pulse_owner = undefined;
filter::init_filter_vision_pulse( localClientNum );
self gadgetpulseresetreveal();
self set_reveal_self( localClientNum, false );
self set_reveal_enemy( localClientNum, false );
self thread watch_emped( localClientNum );
}
}
function watch_emped( localClientNum )
{
self endon( "entityshutdown" );
while( 1 )
{
if( self IsEMPJammed() )
{
self thread disableShader( localClientNum, 0 );
self notify ( "emp_jammed_vp" );
break;
}
{wait(.016);};
}
}
function disableShader( localClientNum, duration )
{
self endon ("startVPShader" );
self endon( "death" );
self endon( "entityshutdown" );
self notify( "disableVPShader" );
self endon( "disableVPShader" );
wait( duration );
filter::disable_filter_vision_pulse( localClientNum, 3 );
}
function watch_world_pulse_end( localClientNum )
{
self notify ( "watchworldpulseend" );
self endon ( "watchworldpulseend" );
self util::waittill_any( "entityshutdown", "death", "emp_jammed_vp" );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 0, getvisionpulsemaxradius( localClientNum ) + 1 ); // Weird thing needed by the shader
}
function do_vision_world_pulse( localClientNum )
{
self endon( "entityshutdown" );
self endon( "death" );
self notify( "startVPShader" );
self thread watch_world_pulse_end( localClientNum );
filter::enable_filter_vision_pulse( localClientNum, 3 );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 1, 1.0 );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 2, 0.08 );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 3, 0.0 );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 4, 1.0 );
startTime = GetServerTime( localClientNum );
{wait(.016);};
amount = 1.0;
irisAmount = 0.0;
pulsemaxradius = 0;
while( ( GetServerTime( localClientNum ) - starttime ) < 2000 )
{
elapsedTime = ( GetServerTime( localClientNum ) - starttime ) * 1.0;
if( elapsedTime < ( 2000 * 0.1 ) )
{
irisAmount = elapsedTime / ( 2000 * 0.1 );
}
else if( elapsedTime < ( 2000 * ( .5 + 0.1 ) ) )
{
irisAmount = 1.0 - elapsedTime / ( 2000 * .5 );
}
else
{
irisAmount = 0.0;
}
amount = 1.0 - elapsedTime / 2000;
pulseRadius = getvisionpulseradius( localClientNum );
pulseMaxRadius = getvisionpulsemaxradius( localClientNum );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 0, pulseRadius );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 3, irisAmount );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 11, pulseMaxRadius );
{wait(.016);};
}
filter::set_filter_vision_pulse_constant( localClientNum, 3, 0, pulseMaxRadius + 1 ); // Weird thing needed by the shader
self thread disableShader( localClientNum, 4000 / 1000 );
}
function vision_pulse_owner_valid( owner )
{
if( isDefined( owner ) && ( owner isPlayer() ) && isAlive( owner ) )
{
return true;
}
return false;
}
function watch_vision_pulse_owner_death( localClientNum )
{
self endon( "entityshutdown" );
self endon( "death" );
self endon( "finished_local_pulse" );
self notify ( "watch_vision_pulse_owner_death" );
self endon ( "watch_vision_pulse_owner_death" );
owner = self.vision_pulse_owner;
if( vision_pulse_owner_valid( owner ) )
{
owner util::waittill_any( "entityshutdown", "death" );
}
self notify ( "vision_pulse_owner_death" );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 7, 0 );
self thread disableShader( localClientNum, 4000 / 1000 );
self.vision_pulse_owner = undefined;
}
function do_vision_local_pulse( localClientNum )
{
self endon( "entityshutdown" );
self endon( "death" );
self endon ( "vision_pulse_owner_death" );
self notify( "startVPShader" );
self notify( "startLocalPulse" );
self endon( "startLocalPulse" );
self thread watch_vision_pulse_owner_death( localClientNum );
origin = getrevealpulseorigin( localClientNum );
//pulseMaxRadius = getrevealpulsemaxradius( localClientNum );
filter::enable_filter_vision_pulse( localClientNum, 3 );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 5, 0.4 );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 6, 0.0001 );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 8, origin[0] );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 9, origin[1] );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 7, 1 );
startTime = GetServerTime( localClientNum );
while( ( GetServerTime( localClientNum ) - starttime ) < 4000 )
{
if( (GetServerTime( localClientNum ) - starttime ) < 2000 )
{
pulseRadius = ( (GetServerTime( localClientNum ) - starttime ) / 2000) * 2000;
}
//pulseRadius = GetRevealPulseRadius( localClientNum );
filter::set_filter_vision_pulse_constant( localClientNum, 3, 10, pulseRadius );
{wait(.016);};
}
filter::set_filter_vision_pulse_constant( localClientNum, 3, 7, 0 );
self thread disableShader( localClientNum, 4000 / 1000 );
self notify ( "finished_local_pulse" );
self.vision_pulse_owner = undefined;
}
function vision_pulse_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( newVal )
{
if( self == GetLocalPlayer( localClientNum ) )
{
if ( IsDemoPlaying() && (bnewent || oldval == newval ) )
{
return;
}
self thread do_vision_world_pulse( localClientNum );
}
}
}
function do_reveal_enemy_pulse( localClientNum )
{
self endon( "entityshutdown" );
self endon( "death" );
self notify( "startEnemyPulse" );
self endon( "startEnemyPulse" );
startTime = GetServerTime( localClientNum );
currTime = startTime;
self MapShaderConstant( localclientnum, 0, "scriptVector7", 0.0, 0, 0, 0 );
while( ( currTime - starttime ) < 4000 )
{
if( ( currTime - starttime ) > ( 4000 - 500 ) )
{
value = float( ( currTime - starttime - ( 4000 - 500 ) ) / 500 );
self MapShaderConstant( localclientnum, 0, "scriptVector7", value, 0, 0, 0 );
}
{wait(.016);};
currTime = GetServerTime( localClientNum );
}
}
function set_reveal_enemy( localClientNum, on_off )
{
if( on_off )
{
self thread do_reveal_enemy_pulse( localClientNum );
}
self duplicate_render::update_dr_flag( localClientNum, "reveal_enemy", on_off );
}
function set_reveal_self( localClientNum, on_off )
{
if( on_off && ( self == GetLocalPlayer( localClientNum ) ) )
{
self thread do_vision_local_pulse( localClientNum );
}
else if( !on_off )
{
filter::set_filter_vision_pulse_constant( localClientNum, 3, 7, 0 );
}
}
function gadget_visionpulse_reveal(localClientNum, bReveal)
{
self notify( "gadget_visionpulse_changed" );
player = GetLocalPlayer( localClientNum );
//player motionpulse_enable( true );
if( !isDefined( self.visionPulseRevealSelf ) && player == self )
{
self.visionPulseRevealSelf = false;
}
if( !isDefined( self.visionPulseReveal ) )
{
self.visionPulseReveal = false;
}
if(player == self)
{
owner = self gadgetpulsegetowner( localClientNum );
if ( ( self.visionPulseRevealSelf != bReveal ) || ( isDefined( self.vision_pulse_owner ) && isDefined( owner ) && ( self.vision_pulse_owner != owner ) ) )
{
self.vision_pulse_owner = owner;
self.visionPulseRevealSelf = bReveal;
self set_reveal_self( localClientNum, bReveal );
}
}
else
{
if ( self.visionPulseReveal != bReveal )
{
self.visionPulseReveal = bReveal;
self set_reveal_enemy( localClientNum, bReveal );
}
}
}
@@ -0,0 +1,278 @@
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\visionset_mgr_shared;
#using scripts\shared\spawner_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\abilities\_ability_player;
#using scripts\shared\abilities\_ability_util;
#using scripts\shared\abilities\gadgets\_gadget_camo;
Line truncated
function autoexec __init__sytem__() { system::register("gadget_vision_pulse",&__init__,undefined,undefined); }
function __init__()
{
ability_player::register_gadget_activation_callbacks( 6, &gadget_vision_pulse_on, &gadget_vision_pulse_off );
ability_player::register_gadget_possession_callbacks( 6, &gadget_vision_pulse_on_give, &gadget_vision_pulse_on_take );
ability_player::register_gadget_flicker_callbacks( 6, &gadget_vision_pulse_on_flicker );
ability_player::register_gadget_is_inuse_callbacks( 6, &gadget_vision_pulse_is_inuse );
ability_player::register_gadget_is_flickering_callbacks( 6, &gadget_vision_pulse_is_flickering );
callback::on_connect( &gadget_vision_pulse_on_connect );
callback::on_spawned( &gadget_vision_pulse_on_spawn );
clientfield::register( "toplayer", "vision_pulse_active" , 1, 1, "int" );
if ( !IsDefined( level.vsmgr_prio_visionset_visionpulse ) )
{
level.vsmgr_prio_visionset_visionpulse = 61;
}
visionset_mgr::register_info( "visionset", "vision_pulse", 1, level.vsmgr_prio_visionset_visionpulse, 12, true, &visionset_mgr::ramp_in_out_thread_per_player_death_shutdown, false );
}
function gadget_vision_pulse_is_inuse( slot )
{
// returns true when the gadget is on
return self flagsys::get( "gadget_vision_pulse_on" );
}
function gadget_vision_pulse_is_flickering( slot )
{
// returns true when the gadget is flickering
return self GadgetFlickering( slot );
}
function gadget_vision_pulse_on_flicker( slot, weapon )
{
// excuted when the gadget flickers
self thread gadget_vision_pulse_flicker( slot, weapon );
}
function gadget_vision_pulse_on_give( slot, weapon )
{
// executed when gadget is added to the players inventory
}
function gadget_vision_pulse_on_take( slot, weapon )
{
// executed when gadget is removed from the players inventory
}
//self is the player
function gadget_vision_pulse_on_connect()
{
// setup up stuff on player connect
}
function gadget_vision_pulse_on_spawn()
{
self.visionPulseActivateTime = 0;
self.visionPulseArray = [];
self.visionPulseOrigin = undefined;
self.visionPulseOriginArray = [];
if( isDefined( self._pulse_ent ) )
{
self._pulse_ent delete();
}
}
function gadget_vision_pulse_ramp_hold_func()
{
self util::waittill_any_timeout( ( 4000 / 1000 + 1 ), "ramp_out_visionset" );
}
function gadget_vision_pulse_watch_death()
{
self notify ( "vision_pulse_watch_death" );
self endon ( "vision_pulse_watch_death" );
self endon ( "disconnect" );
self waittill ( "death" );
visionset_mgr::deactivate( "visionset", "vision_pulse", self );
if( isDefined( self._pulse_ent ) )
{
self._pulse_ent delete();
}
}
function gadget_vision_pulse_watch_emp()
{
self notify ( "vision_pulse_watch_emp" );
self endon ( "vision_pulse_watch_emp" );
self endon ( "disconnect" );
while( 1 )
{
if( self IsEMPJammed() )
{
visionset_mgr::deactivate( "visionset", "vision_pulse", self );
self notify ( "emp_vp_jammed" );
break;
}
{wait(.05);};
}
if( isDefined( self._pulse_ent ) )
{
self._pulse_ent delete();
}
}
function gadget_vision_pulse_on( slot, weapon )
{
if ( IsDefined( self._pulse_ent ) )
{
return;
}
// excecutes when the gadget is turned on
self flagsys::set( "gadget_vision_pulse_on" );
self thread gadget_vision_pulse_start( slot, weapon );
visionset_mgr::activate( "visionset", "vision_pulse", self, ( .25 ), &gadget_vision_pulse_ramp_hold_func, ( .75 ) );
self thread gadget_vision_pulse_watch_death();
self thread gadget_vision_pulse_watch_emp();
self clientfield::set_to_player( "vision_pulse_active", 1 );
}
function gadget_vision_pulse_off( slot, weapon )
{
// excecutes when the gadget is turned off`
self flagsys::clear( "gadget_vision_pulse_on" );
self clientfield::set_to_player( "vision_pulse_active", 0 );
}
function gadget_vision_pulse_start( slot, weapon )
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "emp_vp_jammed" );
wait 0.1;
if ( IsDefined( self._pulse_ent ) )
{
return;
}
self._pulse_ent = spawn( "script_model", self.origin );
self._pulse_ent SetModel( "tag_origin" );
self GadgetSetEntity( slot, self._pulse_ent );
self GadgetSetActivateTime( slot, GetTime() );
self set_gadget_vision_pulse_status( "Activated" );
//self PlaySound ( "gdt_vision_pulse" );
self.visionPulseActivateTime = getTime();
enemyArray = level.players;
gadget = GetWeapon( "gadget_vision_pulse" );
visionPulseArray = ArraySort( enemyArray, self._pulse_ent.origin, true, undefined, gadget.gadget_pulse_max_range );
self.visionPulseOrigin = self._pulse_ent.origin;
self.visionPulseArray = [];
self.visionPulseOriginArray = [];
spottedEnemy = false;
self.visionPulseSpottedEnemy = [];
self.visionPulseSpottedEnemyTime = getTime();
for ( i = 0; i < visionPulseArray.size; i++ )
{
if ( visionPulseArray[i] _gadget_camo::camo_is_inuse() == false )
{
self.visionPulseArray[self.visionPulseArray.size] = visionPulseArray[i];
self.visionPulseOriginArray[self.visionPulseOriginArray.size] = visionPulseArray[i].origin;
if ( IsAlive( visionPulseArray[i] ) && visionPulseArray[i].team != self.team )
{
spottedEnemy = true;
self.visionPulseSpottedEnemy[self.visionPulseSpottedEnemy.size] = visionPulseArray[i];
}
}
}
self wait_until_is_done( slot, self._gadgets_player[slot].gadget_pulse_duration );
if ( spottedEnemy && isdefined( level.playGadgetSuccess ) )
{
self [[ level.playGadgetSuccess ]]( weapon );
}
else
{
self playsoundtoplayer( "gdt_vision_pulse_no_hits", self );
self notify( "ramp_out_visionset" );
}
self set_gadget_vision_pulse_status( "Done" );
self._pulse_ent delete();
}
function wait_until_is_done( slot, timePulse )
{
startTime = GetTime();
while ( 1 )
{
wait 0.25;
currentTime = GetTime();
if ( currentTime > startTime + timePulse )
{
return;
}
}
}
function gadget_vision_pulse_flicker( slot, weapon )
{
self endon( "disconnect" );
time = GetTime();
if ( !self gadget_vision_pulse_is_inuse( slot ) )
{
return;
}
eventTime = self._gadgets_player[slot].gadget_flickertime;
self set_gadget_vision_pulse_status( "^1" + "Flickering.", eventTime );
while( 1 )
{
if ( !self GadgetFlickering( slot ) )
{
set_gadget_vision_pulse_status( "^2" + "Normal" );
return;
}
wait( 0.25 );
}
}
function set_gadget_vision_pulse_status( status, time )
{
timeStr = "";
if ( IsDefined( time ) )
{
timeStr = "^3" + ", time: " + time;
}
if ( GetDvarInt( "scr_cpower_debug_prints" ) > 0 )
self IPrintlnBold( "Vision Pulse:" + status + timeStr );
}
@@ -0,0 +1,51 @@
// no alpha to differentiate from view model in shader
// SCRIPT VECTOR USAGE
// scriptVector0.x : pulse position in the world (1.0 near, 0.0 far)
// scriptVector0.y : pulse width (percentage of value in material)
// scriptVector0.z : pulse edge width
// scriptVector0.w : iris appearance and character glow fade
// scriptVector1.x : highlight enemeies (0: no, 1: yes)
// scriptVector1.y : viewmodel pulse width
// scriptVector1.z : viewmodel pulse edge width
// scriptVector1.w : viewmodel pulse max radius
// scriptVector2.xy: viewmodel pulse origin
// scriptVector2.z : viewmodel pulse position
// scriptVector2.w : max distance to pulse.
// Must be smaller than VISION_PULSE_REVEAL_TIME
// How far from 0 ( start ) - 1 ( end ) it takes for it to ramp in all the way
// How far from VISION_PULSE_FADE_RAMP_IN ( start ) - 1 ( end ) it takes for it to ramp out all the way
// Name of the visionset file
// alias in script
// priority vs other visionsets
// number of steps when ramping in/out
// activation ramp-in time
// How long to hold after ramp-in is done and before ramping-out
// deactivation ramp-out time
// Ramp in + ramp out + ramp hold == VISION_PULSE_DURATION + VISION_PULSE_REVEAL_TIME