aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut
diff options
context:
space:
mode:
authorBarichello <artur@barichello.me>2022-01-03 14:25:13 -0300
committerGitHub <noreply@github.com>2022-01-03 14:25:13 -0300
commit2e34d7e7d16815fd648d3ff5c4d1f9f64d10cf9b (patch)
treed14337ae6d17ea8d166de099b30db6a6b1f0cd6a /Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut
parent4e011f61d4c0350705f914891b69b49de5b8fffc (diff)
parent8f3f0cfc089f0388862865e4758a130201aca1ce (diff)
downloadNorthstarMods-2e34d7e7d16815fd648d3ff5c4d1f9f64d10cf9b.tar.gz
NorthstarMods-2e34d7e7d16815fd648d3ff5c4d1f9f64d10cf9b.zip
Merge pull request #56 from x3Karma/main
Add One in the Chamber and The Hidden to available playlists
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut95
1 files changed, 95 insertions, 0 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut
new file mode 100644
index 00000000..bbd669cd
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut
@@ -0,0 +1,95 @@
+global function GamemodeChamber_Init
+
+void function GamemodeChamber_Init()
+{
+ SetSpawnpointGamemodeOverride( FFA )
+
+ SetShouldUseRoundWinningKillReplay( true )
+ SetLoadoutGracePeriodEnabled( false ) // prevent modifying loadouts with grace period
+ SetWeaponDropsEnabled( false )
+ Riff_ForceTitanAvailability( eTitanAvailability.Never )
+ Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
+ ClassicMP_ForceDisableEpilogue( true )
+
+ AddCallback_OnClientConnected( ChamberInitPlayer )
+ AddCallback_OnPlayerKilled( ChamberOnPlayerKilled )
+ AddCallback_OnPlayerRespawned( UpdateLoadout )
+
+}
+
+void function ChamberInitPlayer( entity player )
+{
+ UpdateLoadout( player )
+}
+
+void function ChamberOnPlayerKilled( entity victim, entity attacker, var damageInfo )
+{
+ if ( !victim.IsPlayer() || GetGameState() != eGameState.Playing || attacker == victim)
+ return
+
+ if ( attacker.IsPlayer() )
+ {
+ attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 )
+ AddTeamScore( attacker.GetTeam(), 1 )
+ if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.human_execution )
+ {
+ string message = victim.GetPlayerName() + " got executed."
+ foreach ( entity player in GetPlayerArray() )
+ SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 )
+
+ foreach ( entity weapon in attacker.GetMainWeapons() )
+ {
+ weapon.SetWeaponPrimaryAmmoCount(0)
+ int clip = weapon.GetWeaponPrimaryClipCount() + 4
+ if (weapon.GetWeaponPrimaryClipCountMax() < clip)
+ weapon.SetWeaponPrimaryClipCount(weapon.GetWeaponPrimaryClipCountMax())
+ else
+ weapon.SetWeaponPrimaryClipCount(weapon.GetWeaponPrimaryClipCount() + 4)
+ }
+ } else
+ {
+ foreach ( entity weapon in attacker.GetMainWeapons() )
+ {
+ weapon.SetWeaponPrimaryAmmoCount(0)
+ int clip = weapon.GetWeaponPrimaryClipCount() + 1
+ if (weapon.GetWeaponPrimaryClipCountMax() < clip)
+ weapon.SetWeaponPrimaryClipCount(weapon.GetWeaponPrimaryClipCountMax())
+ else
+ weapon.SetWeaponPrimaryClipCount(weapon.GetWeaponPrimaryClipCount() + 1)
+ }
+ }
+ SetRoundWinningKillReplayAttacker(attacker)
+ }
+}
+
+void function UpdateLoadout( entity player )
+{
+ if (IsAlive(player) && player != null)
+ {
+
+ // set loadout
+ foreach ( entity weapon in player.GetMainWeapons() )
+ player.TakeWeaponNow( weapon.GetWeaponClassName() )
+
+ foreach ( entity weapon in player.GetOffhandWeapons() )
+ player.TakeWeaponNow( weapon.GetWeaponClassName() )
+
+ array<string> mods = ["one_in_the_chamber"]
+ player.GiveWeapon( "mp_weapon_wingman", mods)
+ player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE )
+
+ thread SetAmmo( player )
+ }
+}
+
+void function SetAmmo( entity player )
+{
+ foreach ( entity weapon in player.GetMainWeapons() )
+ {
+ weapon.SetWeaponPrimaryAmmoCount(0)
+ weapon.SetWeaponPrimaryClipCount(1)
+ }
+ WaitFrame()
+ if ( IsValid( player ) )
+ PlayerEarnMeter_SetMode( player, eEarnMeterMode.DISABLED )
+}