diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties index bc24986..adb8303 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties @@ -239,3 +239,6 @@ beatrun.infection.infectedby=has infected beatrun.infection.award=You were awarded 200 XP for surviving! beatrun.infection.awardinfected=You were awarded 100 XP for spawning as an infected! beatrun.infection.end=The game has ended!\nSurvivors: %s\nRestarting in 15s + +# Server ConVars +beatrun.randomloadouts.helptext=Toggles random MW Base loadouts in Deathmatch and DataTheft diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties index e1ba9c5..1ab595b 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties @@ -239,3 +239,6 @@ beatrun.infection.infectedby=заразил beatrun.infection.award=Вы получили 200 XP за выживание! beatrun.infection.awardinfected=Вы получили 100 XP за спавн заражённым! beatrun.infection.end=Игра окончена!\nВыжившие: %s\nПерезапуск через 15 сек + +# Server ConVars +beatrun.randomloadouts.helptext=Переключает случайные наборы оружия MW Base в Deathmatch и DataTheft diff --git a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua index 64fc743..8865ca7 100644 --- a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua +++ b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua @@ -122,13 +122,25 @@ end function PLAYER:Loadout() if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then - for _, v in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do - local wep = self.Player:Give(v) + if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then + for i = 0, 1 do + local randomSWEP = getRandomMGBaseWeapon() + local w = self.Player:Give(randomSWEP.ClassName) - timer.Simple(1, function() - if wep:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, wep:GetPrimaryAmmoType(), true) end - if wep:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, wep:GetSecondaryAmmoType(), true) end - end) + timer.Simple(1, function() + if w:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end + if w:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end + end) + end + else + for _, v in ipairs(BEATRUN_GAMEMODES_LOADOUTS[math.random(#BEATRUN_GAMEMODES_LOADOUTS)]) do + local w = self.Player:Give(v) + + timer.Simple(1, function() + if w:GetPrimaryAmmoType() ~= -1 then self.Player:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end + if w:GetSecondaryAmmoType() ~= -1 then self.Player:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end + end) + end end else self.Player:RemoveAllAmmo() diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/0_Helpers.lua b/beatrun/gamemodes/beatrun/gamemode/sh/0_Helpers.lua index b23ee15..1da2a05 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/0_Helpers.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/0_Helpers.lua @@ -1,7 +1,9 @@ local vmatrixmeta = FindMetaTable("VMatrix") local playermeta = FindMetaTable("Player") -CLoadout = {} +BEATRUN_GAMEMODES_LOADOUTS = { + {"weapon_357", "weapon_ar2"} +} local mtmp = { {0, 0, 0, 0}, diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua b/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua index dba0d78..346613c 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua @@ -1,7 +1,3 @@ -DATATHEFT_LOADOUTS = { - {"weapon_357", "weapon_ar2"} -} - if SERVER then util.AddNetworkString("DataTheft_Start") util.AddNetworkString("DataTheft_Sync") @@ -13,18 +9,29 @@ if SERVER then net.Broadcast() for _, v in ipairs(player.GetAll()) do - v:DataTheft_Bank() - - v:SetNW2Int("DataCubes", 0) - v:SetNW2Int("DataBanked", 0) - if v:GetMoveType() == MOVETYPE_NOCLIP then v:SetMoveType(MOVETYPE_WALK) v:Spawn() + end + + if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then + for i = 0, 1 do + local randomSWEP = getRandomMGBaseWeapon() + local w = v:Give(randomSWEP.ClassName) + + timer.Simple(1, function() + if w:GetPrimaryAmmoType() ~= -1 then v:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end + if w:GetSecondaryAmmoType() ~= -1 then v:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end + end) + end else - for l, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do - local wep = v:Give(b) - v:GiveAmmo(9999, wep:GetPrimaryAmmoType()) + for _, b in ipairs(BEATRUN_GAMEMODES_LOADOUTS[math.random(#BEATRUN_GAMEMODES_LOADOUTS)]) do + local w = v:Give(b) + + timer.Simple(1, function() + if w:GetPrimaryAmmoType() ~= -1 then v:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end + if w:GetSecondaryAmmoType() ~= -1 then v:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end + end) end end end diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua index f72f05b..e655cb2 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua @@ -2,6 +2,20 @@ if SERVER then util.AddNetworkString("Deathmatch_Start") util.AddNetworkString("Deathmatch_Sync") + CreateConVar("Beatrun_RandomMWLoadouts", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}, "#beatrun.randomloadouts.helptext") + + function getRandomMGBaseWeapon() + local allWep = weapons.GetList() + local wepIndex = math.random(#allWep) + local wep = allWep[wepIndex] + + if wep.Base == "mg_base" then + return wep + else + return getRandomMGBaseWeapon() + end + end + function Beatrun_StartDeathmatch() SetGlobalBool("GM_DEATHMATCH", true) @@ -12,11 +26,26 @@ if SERVER then if v:GetMoveType() == MOVETYPE_NOCLIP then v:SetMoveType(MOVETYPE_WALK) v:Spawn() - else - for _, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do - local wep = v:Give(b) + end - v:GiveAmmo(9999, wep:GetPrimaryAmmoType() or "Pistol", true) + if GetConVar("Beatrun_RandomMWLoadouts"):GetBool() then + for i = 0, 1 do + local randomSWEP = getRandomMGBaseWeapon() + local w = v:Give(randomSWEP.ClassName) + + timer.Simple(1, function() + if w:GetPrimaryAmmoType() ~= -1 then v:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end + if w:GetSecondaryAmmoType() ~= -1 then v:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end + end) + end + else + for _, b in ipairs(BEATRUN_GAMEMODES_LOADOUTS[math.random(#BEATRUN_GAMEMODES_LOADOUTS)]) do + local w = v:Give(b) + + timer.Simple(1, function() + if w:GetPrimaryAmmoType() ~= -1 then v:GiveAmmo(10000, w:GetPrimaryAmmoType(), true) end + if w:GetSecondaryAmmoType() ~= -1 then v:GiveAmmo(5, w:GetSecondaryAmmoType(), true) end + end) end end end diff --git a/beatrun/gamemodes/beatrun/gamemode/shared.lua b/beatrun/gamemodes/beatrun/gamemode/shared.lua index ae0b2a6..79c9f8b 100644 --- a/beatrun/gamemodes/beatrun/gamemode/shared.lua +++ b/beatrun/gamemodes/beatrun/gamemode/shared.lua @@ -1,4 +1,4 @@ -VERSIONGLOBAL = "v1.0?" +VERSIONGLOBAL = "v1.0.1" DeriveGamemode("sandbox")