diff options
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter')
3 files changed, 27 insertions, 15 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut index 1d4e73b73..2da60753e 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut @@ -1,5 +1,3 @@ -global function Sv_GGEarnMeter_SetWeaponIcon -global function Sv_GGEarnMeter_SetFinalIcon global function Sv_GGEarnMeter_SetPercentage global function Sv_GGEarnMeter_AddPercentage global function AddCallback_GGEarnMeterFull @@ -9,16 +7,6 @@ struct array< bool functionref( entity ) > onGGEarnMeterFullCallbacks } file -void function Sv_GGEarnMeter_SetWeaponIcon( entity player, string weaponReference ) -{ - Remote_CallFunction_Replay( player, "ServerCallback_GGEarnMeter_SetWeaponIcon", eDamageSourceId[weaponReference] ) -} - -void function Sv_GGEarnMeter_SetFinalIcon( entity player ) -{ - Remote_CallFunction_Replay( player, "ServerCallback_GGEarnMeter_SetWeaponIcon", -1 ) -} - void function Sv_GGEarnMeter_SetPercentage( entity player, float percentage ) { player.SetPlayerNetFloat( "gunGameLevelPercentage", clamp(percentage, 0.0, 1.0) ) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut index d6369b0cf..92f7be612 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut @@ -14,11 +14,16 @@ struct EarnChangeData struct { EarnChangeData lastEarnedData var earnMeterRui + asset functionref() getIconFunction + bool functionref() testIconFunction } file -void function Cl_GGEarnMeter_Init() +void function Cl_GGEarnMeter_Init( asset functionref() getIconFunction, bool functionref() testIconFunction = null ) { AddCallback_OnClientScriptInit( CreateGGEarnMeterUI ) + + file.getIconFunction = getIconFunction + file.testIconFunction = testIconFunction } void function CreateGGEarnMeterUI( entity player ) @@ -31,6 +36,8 @@ void function CreateGGEarnMeterUI( entity player ) RuiSetInt( file.earnMeterRui, "meterMode", 5 ) RuiTrackFloat( file.earnMeterRui, "earnedFrac", player, RUI_TRACK_SCRIPT_NETWORK_VAR, GetNetworkedVariableIndex( "gunGameLevelPercentage" ) ) + + thread Cl_GGEarnMeter_TrackWeaponIcon() } void function Cl_GGEarnMeter_RegisterNetwork() @@ -59,6 +66,23 @@ float function Cl_GGEarnMeter_GetCurrentMeterValue( EarnChangeData earnData ) return earnData.endValue - (delta * EaseIn( GraphCapped( elapsedTime, 0.0, FILL_ANIM_DURATION, 1.0, 0.0 ) ) ) } +void function Cl_GGEarnMeter_TrackWeaponIcon() +{ + int lastScore = -1 + while ( IsValid( file.earnMeterRui ) ) + { + if ( file.testIconFunction == null || file.testIconFunction() ) + { + asset weaponImage = file.getIconFunction() + + RuiSetImage( file.earnMeterRui, "goalBuildingIcon", weaponImage ) + RuiSetImage( file.earnMeterRui, "goalReadyIcon", weaponImage ) + } + + WaitFrame() + } +} + void function ServerCallback_GGEarnMeter_SetWeaponIcon( int damageSourceId ) { asset weaponImage diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut index d3e506ce5..a1dbb75a4 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut @@ -1,8 +1,8 @@ global function Sh_GGEarnMeter_Init -struct +struct { - string gamemode = "" + string gamemode = "" } file void function Sh_GGEarnMeter_Init(string gamemode) |