aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut
diff options
context:
space:
mode:
authorConnie Price <contact@connieprice.co.uk>2022-01-20 05:56:07 +0000
committerBarichello <artur@barichello.me>2022-01-20 17:30:02 -0300
commitf63ca08e4d820192b9a753d1badbe48e9671aae7 (patch)
treef604db9a169c9076d9d528319a39df6c775853f7 /Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut
parent8036197f7d7b74b3a9b88465106874e1a2edf48d (diff)
downloadNorthstarMods-f63ca08e4d820192b9a753d1badbe48e9671aae7.tar.gz
NorthstarMods-f63ca08e4d820192b9a753d1badbe48e9671aae7.zip
GunGame PlaylistVar Enhancements
- Define GunGame weapons using playlist vars: e.g. `+setplaylistvaroverrides scorelimit 4 gg_weapon_0 -1|mp_weapon_r97|pas_run_and_gun gg_weapon_1 -1|mp_titanweapon_xo16_vanguard|arc_rounds gg_weapon_2 -1|mp_weapon_car|pas_run_and_gun gg_weapon_3 1|mp_weapon_grenade_sonar|pas_power_cell,amped_tacticals` - Now that any custom weapon lists can be synchronised using playlist vars, server callback icon handling has been removed, and icons are now handled purely clientside. - Cleaned up default weapons. Approximate structure of custom weapon list: `+setplaylistvaroverrides scorelimit <weaponCount> gg_weapon_<index> <offhandSlotOr-1>|<weaponClassName>|<weaponMods>`
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut26
1 files changed, 25 insertions, 1 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 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