138 lines
12 KiB
Plaintext
138 lines
12 KiB
Plaintext
#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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 );
|
|
}
|
|
}
|
|
|