diff options
author | Connie Price <contact@connieprice.co.uk> | 2022-01-21 03:23:48 +0000 |
---|---|---|
committer | Connie Price <contact@connieprice.co.uk> | 2022-01-21 03:23:48 +0000 |
commit | 72aa12e04b0e01f33fd3d89db10992aeaa7dfcd0 (patch) | |
tree | e3e7c1156ab024c06014eaf831084d8f78f742cf /Northstar.Custom/mod/scripts/vscripts/gamemodes | |
parent | 9af8162f96fa7ad0dd1a503b1d29ae924bfbdc0e (diff) | |
download | NorthstarMods-72aa12e04b0e01f33fd3d89db10992aeaa7dfcd0.tar.gz NorthstarMods-72aa12e04b0e01f33fd3d89db10992aeaa7dfcd0.zip |
Some extra earn meter cleanup.
- Fixed `sh_gg_earn_meter.gnut` when used in multiple gamemodes.
- Removed some unnecessary functions from `cl_gg_earn_meter.gnut`.
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes')
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut | 23 | ||||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut | 22 |
2 files changed, 13 insertions, 32 deletions
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 92f7be61..f28e8cbd 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 @@ -1,6 +1,5 @@ global function Cl_GGEarnMeter_Init global function Cl_GGEarnMeter_RegisterNetwork -global function ServerCallback_GGEarnMeter_SetWeaponIcon const float FILL_ANIM_DURATION = 0.2 @@ -81,26 +80,4 @@ void function Cl_GGEarnMeter_TrackWeaponIcon() WaitFrame() } -} - -void function ServerCallback_GGEarnMeter_SetWeaponIcon( int damageSourceId ) -{ - asset weaponImage - - if ( damageSourceId > -1 ) - { - if ( !DamageSourceIDHasString(damageSourceId) ) - { - return - } - - weaponImage = GetItemImage( DamageSourceIDToString( damageSourceId ) ) - } - else - { - weaponImage = RandomFloat( 1 ) > 0.1 ? $"rui/menu/boosts/boost_icon_random" : $"rui/faction/faction_logo_mrvn" - } - - RuiSetImage( file.earnMeterRui, "goalBuildingIcon", weaponImage ) - RuiSetImage( file.earnMeterRui, "goalReadyIcon", weaponImage ) }
\ No newline at end of file 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 a1dbb75a..2eba4eee 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 @@ -2,25 +2,29 @@ global function Sh_GGEarnMeter_Init struct { - string gamemode = "" + bool callbackAdded = false + array<string> gamemodes } file void function Sh_GGEarnMeter_Init(string gamemode) { - file.gamemode = gamemode + file.gamemodes.append(gamemode) - AddCallback_OnRegisteringCustomNetworkVars( RegisterSharedNetwork ) + if ( !file.callbackAdded ) + { + file.callbackAdded = true + AddCallback_OnRegisteringCustomNetworkVars( RegisterSharedNetwork ) + } } void function RegisterSharedNetwork() { - if ( GAMETYPE != file.gamemode ) - return + if ( !( file.gamemodes.contains(GAMETYPE) ) ) + return RegisterNetworkedVariable( "gunGameLevelPercentage", SNDC_PLAYER_EXCLUSIVE, SNVT_FLOAT_RANGE, 0.0, 0.0, 1.0 ) - Remote_RegisterFunction( "ServerCallback_GGEarnMeter_SetWeaponIcon" ) - #if CLIENT - Cl_GGEarnMeter_RegisterNetwork() - #endif + #if CLIENT + Cl_GGEarnMeter_RegisterNetwork() + #endif }
\ No newline at end of file |