53 lines
9.1 KiB
Plaintext
53 lines
9.1 KiB
Plaintext
#using scripts\codescripts\struct;
|
|
|
|
#using scripts\shared\callbacks_shared;
|
|
#using scripts\shared\clientfield_shared;
|
|
#using scripts\shared\system_shared;
|
|
#using scripts\shared\util_shared;
|
|
|
|
|
|
|
|
|
|
|
|
#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 );
|
|
}
|
|
|