2023-04-13 17:30:38 +02:00

53 lines
12 KiB
Plaintext

#using scripts\codescripts\struct;
#using scripts\shared\clientfield_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\visionset_mgr_shared;
#using_animtree( "mp_autoturret" );
#namespace autoturret;
function autoexec __init__sytem__() { system::register("autoturret",&__init__,undefined,undefined); }
function __init__()
{
clientfield::register( "vehicle", "auto_turret_open", 1, 1, "int", &turret_open, !true, !true );
clientfield::register( "scriptmover", "auto_turret_init", 1, 1, "int", &turret_init_anim, !true, !true );
clientfield::register( "scriptmover", "auto_turret_close", 1, 1, "int", &turret_close_anim, !true, !true );
visionset_mgr::register_visionset_info( "turret_visionset", 1, 16, undefined, "mp_vehicles_turret" );
}
function turret_init_anim( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( !newVal )
return;
self UseAnimTree( #animtree );
self SetAnimRestart( %o_turret_sentry_close, 1.0, 0.0, 1.0 );
self SetAnimTime( %o_turret_sentry_close, 1.0 );
}
function turret_open( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( !newVal )
return;
self UseAnimTree( #animtree );
self SetAnimRestart( %o_turret_sentry_deploy, 1.0, 0.0, 1.0 );
}
function turret_close_anim( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
{
if ( !newVal )
return;
self UseAnimTree( #animtree );
self SetAnimRestart( %o_turret_sentry_close, 1.0, 0.0, 1.0 );
}