157 lines
11 KiB
Plaintext
157 lines
11 KiB
Plaintext
#using scripts\codescripts\struct;
|
|
|
|
#using scripts\shared\clientfield_shared;
|
|
#using scripts\shared\util_shared;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//0.15
|
|
//0.15
|
|
|
|
|
|
#precache( "client_fx", "ui/fx_stockpile_drop_marker" );
|
|
|
|
|
|
#precache( "client_fx", "ui/fx_stockpile_player_marker" );
|
|
|
|
function main()
|
|
{
|
|
clientfield::register( "scriptmover", "taco_flag", 12000, 2, "int", &taco_flag_changed, false, false );
|
|
clientfield::register( "allplayers", "taco_carry", 12000, 1, "int", &taco_carry_changed, false, false );
|
|
// TODO: If we add quantity with the carry indicator, remove the clientuimodel field and set it on the UI model from the carried value
|
|
}
|
|
|
|
// Drop Effects
|
|
//========================================
|
|
|
|
function taco_flag_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
|
|
{
|
|
self notify( "stopbounce" );
|
|
|
|
if ( isdefined( self.effectAnchor ) )
|
|
{
|
|
self.effectAnchor Unlink();
|
|
self.effectAnchor.origin = self.origin;
|
|
}
|
|
|
|
self kill_drop_fx( localClientNum );
|
|
|
|
if ( newVal != 0 )
|
|
{
|
|
if ( !isdefined( self.effectAnchor ) )
|
|
{
|
|
self.effectAnchor = Spawn( localClientNum, self.origin, "script_model" );
|
|
self.effectAnchor SetModel( "tag_origin" );
|
|
|
|
self thread drop_shutdown_cleanup( localClientNum );
|
|
}
|
|
|
|
self.tacoFx = PlayFXOnTag( localClientNum, "ui/fx_stockpile_drop_marker", self.effectAnchor, "tag_origin" );
|
|
|
|
SetFxTeam( localClientNum, self.tacoFx, self.team );
|
|
}
|
|
|
|
if ( newVal == 1 )
|
|
{
|
|
self.effectAnchor LinkTo( self );
|
|
}
|
|
else if ( newVal == 2 )
|
|
{
|
|
self thread bounce_effect( localClientNum );
|
|
}
|
|
}
|
|
|
|
function drop_shutdown_cleanup( localClientNum )
|
|
{
|
|
self waittill( "entityshutdown" );
|
|
|
|
self kill_drop_fx( localClientNum );
|
|
|
|
self.effectAnchor Delete();
|
|
self.effectAnchor = undefined;
|
|
}
|
|
|
|
function kill_drop_fx( localClientNum )
|
|
{
|
|
if ( isdefined( self.tacoFx ) )
|
|
{
|
|
KillFx( localClientNum, self.tacoFx );
|
|
self.tacoFx = undefined;
|
|
}
|
|
}
|
|
|
|
function bounce_effect( localClientNum )
|
|
{
|
|
self endon( "stopbounce" );
|
|
self endon( "entityshutdown" );
|
|
|
|
topPos = self.origin + (0,0,12);
|
|
bottomPos = self.origin;
|
|
|
|
while( true )
|
|
{
|
|
self.effectAnchor MoveTo( topPos, 0.5, 0, 0 );
|
|
|
|
self.effectAnchor waittill( "movedone" );
|
|
|
|
self.effectAnchor MoveTo( bottomPos, 0.5, 0, 0 );
|
|
|
|
self.effectAnchor waittill( "movedone" );
|
|
}
|
|
}
|
|
|
|
// Carry Effects
|
|
//========================================
|
|
|
|
function taco_carry_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
|
|
{
|
|
self kill_carry_fx( localClientNum );
|
|
|
|
// Don't play effects on the local player as the trail can get in their eyes
|
|
if ( newVal && GetLocalPlayer( localClientNum ) != self )
|
|
{
|
|
if ( !isdefined( self.effectAnchor ) )
|
|
{
|
|
self util::waittill_dobj( localClientNum );
|
|
|
|
neckPos = self GetTagOrigin( "j_neck" );
|
|
neckAngles = self GetTagAngles( "j_neck" );
|
|
|
|
self.effectAnchor = Spawn( localClientNum, neckPos, "script_model" );
|
|
self.effectAnchor SetModel( "tag_origin" );
|
|
|
|
self.effectAnchor.angles = neckAngles;
|
|
|
|
self.effectAnchor LinkTo( self, "j_neck" );
|
|
|
|
self thread carry_shutdown_cleanup( localClientNum );
|
|
}
|
|
|
|
self.carryFx = PlayFxOnTag( localClientNum, "ui/fx_stockpile_player_marker", self.effectAnchor, "tag_origin" );
|
|
SetFxTeam( localClientNum, self.carryFx, self.team );
|
|
}
|
|
}
|
|
|
|
function carry_shutdown_cleanup( localClientNum )
|
|
{
|
|
self waittill( "entityshutdown" );
|
|
|
|
self kill_carry_fx( localClientNum );
|
|
|
|
self.effectAnchor Delete();
|
|
self.effectAnchor = undefined;
|
|
}
|
|
|
|
function kill_carry_fx( localClientNum )
|
|
{
|
|
if ( isdefined( self.carryFx ) )
|
|
{
|
|
KillFx( localClientNum, self.carryFx );
|
|
self.carryFx = undefined;
|
|
}
|
|
} |