diff options
author | Connie Price <contact@connieprice.co.uk> | 2022-01-14 03:22:00 +0000 |
---|---|---|
committer | Barichello <artur@barichello.me> | 2022-01-15 12:47:51 -0300 |
commit | 60ed8aadc819cb21341ee33abcee8824d00e0cbd (patch) | |
tree | 8baa4da34aafc19c28a8ea2a65ff721c37ed7b69 /Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut | |
parent | 2694687ed68d6609cc9a0bf2e7ff4b99d0bb1e43 (diff) | |
download | NorthstarMods-60ed8aadc819cb21341ee33abcee8824d00e0cbd.tar.gz NorthstarMods-60ed8aadc819cb21341ee33abcee8824d00e0cbd.zip |
Added a percentage meter to gungame, that also displays the next weapon!
- New gungame meter, by default acts exactly like before, just adds some visual flair.
- Support for varying reward percentages for Kills, Assists and Executions so to let server owners mix up their gungames a bit more.
- Actual assist support, by default providing no points, but the option is now there.
- Replaced the Archer with a primary enabled melee, finally no more Archer blocking half the screen.
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut')
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut | 56 |
1 files changed, 56 insertions, 0 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 new file mode 100644 index 000000000..1d4e73b73 --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut @@ -0,0 +1,56 @@ +global function Sv_GGEarnMeter_SetWeaponIcon +global function Sv_GGEarnMeter_SetFinalIcon +global function Sv_GGEarnMeter_SetPercentage +global function Sv_GGEarnMeter_AddPercentage +global function AddCallback_GGEarnMeterFull + +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) ) + + thread CheckPercentage( player ) +} + +void function Sv_GGEarnMeter_AddPercentage( entity player, float percentage ) +{ + Sv_GGEarnMeter_SetPercentage(player, player.GetPlayerNetFloat( "gunGameLevelPercentage") + percentage) +} + +void function AddCallback_GGEarnMeterFull( bool functionref( entity ) callbackFunc ) +{ + Assert( !file.onGGEarnMeterFullCallbacks.contains( callbackFunc ), "Already added " + FunctionToString( callbackFunc ) + " with AddCallback_GGEarnMeterFull" ) + + file.onGGEarnMeterFullCallbacks.append( callbackFunc ) +} + +void function CheckPercentage( entity player ) +{ + float percentage = player.GetPlayerNetFloat( "gunGameLevelPercentage") + + if ( percentage < 1.0 ) + return + + wait 0.2 + + bool lastWeapon = false + foreach ( callbackFunc in file.onGGEarnMeterFullCallbacks ) + lastWeapon = callbackFunc( player ) + + if ( !lastWeapon ) + Sv_GGEarnMeter_SetPercentage(player, 0.0) +}
\ No newline at end of file |