From f63ca08e4d820192b9a753d1badbe48e9671aae7 Mon Sep 17 00:00:00 2001 From: Connie Price Date: Thu, 20 Jan 2022 05:56:07 +0000 Subject: 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 gg_weapon_ ||` --- .../scripts/vscripts/gamemodes/cl_gamemode_gg.gnut | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut') diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut index 6f4e015ec..d077e557f 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut @@ -1,5 +1,9 @@ global function ClGamemodeGG_Init +struct { + int lastScore = -1 +} file + void function ClGamemodeGG_Init() { // add ffa gamestate asset @@ -24,5 +28,32 @@ void function ClGamemodeGG_Init() RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_IMC ) RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_MILITIA ) - Cl_GGEarnMeter_Init() + Cl_GGEarnMeter_Init(ClGamemodeGG_GetWeaponIcon, ClGamemodeGG_ShouldChangeWeaponIcon) +} + +asset function ClGamemodeGG_GetWeaponIcon() +{ + int weaponIndex = GameRules_GetTeamScore( GetLocalViewPlayer().GetTeam() ) + 1 + + array weapons = GetGunGameWeapons() + + if ( weaponIndex >= weapons.len() ) + return RandomFloat( 1 ) > 0.1 ? $"rui/menu/boosts/boost_icon_random" : $"rui/faction/faction_logo_mrvn" + + GunGameWeapon nextWeapon = weapons[ weaponIndex ] + return GetWeaponInfoFileKeyFieldAsset_WithMods_Global( nextWeapon.weapon, nextWeapon.mods, "hud_icon" ) +} + +// Because of our easter egg we have to include the optional test function so that we don't get a flickering icon. +bool function ClGamemodeGG_ShouldChangeWeaponIcon() +{ + int currentScore = GameRules_GetTeamScore( GetLocalViewPlayer().GetTeam() ) + + if ( file.lastScore != currentScore ) + { + file.lastScore = currentScore + return true + } + + return false } \ No newline at end of file -- cgit v1.2.3