From 9f2eb4f09f2cdbcac7118e9791d0ed12be421fc4 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sun, 6 Sep 2026 17:24:07 +0200 Subject: [PATCH] Restore HL2DM coop spawn loadout --- gamemode/shared.lua | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/gamemode/shared.lua b/gamemode/shared.lua index 0c76634..c851bd5 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -86,11 +86,36 @@ function GM:IsSpawnpointSuitable(ply, spawnpointent, bMakeSuitable) return true end -function GM:PlayerLoadout(ply) - if (not striponspawn) then - ply:Give("weapon_fists") - end -end +local hl2dmLoadout +if SERVER then + hl2dmLoadout = CreateConVar( + "gc_hl2dmloadout", + "1", + FCVAR_ARCHIVE, + "Give the standard HL2 Deathmatch spawn weapons expected by legacy coop maps" + ) +end + +function GM:PlayerLoadout(ply) + if striponspawn then return end + + ply:Give("weapon_fists") + if not hl2dmLoadout or not hl2dmLoadout:GetBool() then return end + + -- Legacy HL2DM coop maps commonly place ammo for these weapons but rely on + -- CHL2MP_Player::GiveDefaultItems to supply the weapons themselves. + ply:Give("weapon_crowbar") + ply:Give("weapon_pistol") + ply:Give("weapon_smg1") + ply:Give("weapon_frag") + ply:Give("weapon_physcannon") + + ply:GiveAmmo(255, "Pistol", true) + ply:GiveAmmo(45, "SMG1", true) + ply:GiveAmmo(1, "Grenade", true) + ply:GiveAmmo(6, "Buckshot", true) + ply:GiveAmmo(6, "357", true) +end hook.Add( "SpawnMenuOpen", "DisallowSpawnMenu", function () return LocalPlayer():IsAdmin()