From 1d538e1c900a2a0a8155c32688019d6034c0f322 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 16 Nov 2014 02:41:28 +0000 Subject: [PATCH 1/3] Created inert weapon base for hammer made weapons Weapons using this base: - Cannot be selected from the player's HUD - Cannot be dropped or seen in-game - Switch to "weapon_zs_fists" if switched to forcefully --- .../weapons/weapon_map_base/cl_init.lua | 8 +++ .../entities/weapons/weapon_map_base/init.lua | 10 ++++ .../weapons/weapon_map_base/shared.lua | 55 +++++++++++++++++++ gamemodes/zombiesurvival/zombiesurvival.fgd | 2 +- 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua create mode 100644 gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua create mode 100644 gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua new file mode 100644 index 0000000..e44c5ce --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua @@ -0,0 +1,8 @@ +include('shared.lua') + +SWEP.Slot = -1 +SWEP.SlotPos = -1 +SWEP.DrawAmmo = false +SWEP.DrawCrosshair = true +SWEP.DrawWeaponInfoBox = false + diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua new file mode 100644 index 0000000..f8905eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua @@ -0,0 +1,10 @@ +AddCSLuaFile("cl_init.lua") +AddCSLuaFile("shared.lua") + +include("shared.lua") + +function SWEP:OnDrop() + if self:IsValid() then + self.Weapon:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua new file mode 100644 index 0000000..0dd3377 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua @@ -0,0 +1,55 @@ +SWEP.Name = "Item" + +SWEP.AnimPrefix = "none" +SWEP.HoldType = "normal" + +SWEP.Spawnable = true +SWEP.AdminSpawnable = true + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "None" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "None" + +SWEP.DrawCrosshair = false +SWEP.Primary.Sound = Sound("") + +SWEP.WorldModel = "" + +SWEP.WalkSpeed = SPEED_NORMAL + +function SWEP:Initialize() +end + +function SWEP:SetWeaponHoldType() +end + +function SWEP:PrimaryAttack() +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end + +function SWEP:Deploy() + if SERVER then + self.Owner:SelectWeapon("weapon_zs_fists") + end + return true +end + +function SWEP:CanPrimaryAttack() + return false +end + +function SWEP:CanSecondaryAttack() + return false +end + diff --git a/gamemodes/zombiesurvival/zombiesurvival.fgd b/gamemodes/zombiesurvival/zombiesurvival.fgd index 86ada9b..645442b 100644 --- a/gamemodes/zombiesurvival/zombiesurvival.fgd +++ b/gamemodes/zombiesurvival/zombiesurvival.fgd @@ -23,7 +23,7 @@ // Inputs input enable(void) : "Enable the entity." input disable(void) : "Disable the entity." - input toggle(void) : "Toggle the entity." + input seton(integer) : "Enable or Disable the entity." ] @SolidClass base(Targetname) = trigger_zombieclass : "ZS: You can directly control the changing of classes with this." From b83b5c56d57bed6986bcc620399de8cf29bc56f2 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 16 Nov 2014 02:42:34 +0000 Subject: [PATCH 2/3] Added support for hammer made weapons in ZE - Restricted each player to using only one of these special weapons per round. --- .../zombiesurvival/gamemode/sh_globals.lua | 6 ++++++ .../gamemode/sh_zombieescape.lua | 20 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/sh_globals.lua b/gamemodes/zombiesurvival/gamemode/sh_globals.lua index f639d99..79ebbff 100644 --- a/gamemodes/zombiesurvival/gamemode/sh_globals.lua +++ b/gamemodes/zombiesurvival/gamemode/sh_globals.lua @@ -92,6 +92,12 @@ ZE_KNOCKBACKSCALE = 0.1 MASK_HOVER = bit.bor(CONTENTS_OPAQUE, CONTENTS_GRATE, CONTENTS_HITBOX, CONTENTS_DEBRIS, CONTENTS_SOLID, CONTENTS_WATER, CONTENTS_SLIME, CONTENTS_WINDOW, CONTENTS_LADDER, CONTENTS_PLAYERCLIP, CONTENTS_MOVEABLE, CONTENTS_DETAIL, CONTENTS_TRANSLUCENT) +CSSWEAPONS = {"weapon_knife","weapon_glock","weapon_usp","weapon_p228","weapon_deagle", + "weapon_elite","weapon_fiveseven","weapon_m3","weapon_xm1014","weapon_galil", + "weapon_ak47","weapon_scout","weapon_sg552","weapon_awp","weapon_g3sg1", + "weapon_famas","weapon_m4a1","weapon_aug","weapon_sg550","weapon_mac10", + "weapon_tmp","weapon_mp5navy","weapon_ump45","weapon_p90","weapon_m249"} + GM.BarricadeHealthMin = 50 GM.BarricadeHealthMax = 1100 GM.BarricadeHealthMassFactor = 3 diff --git a/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua b/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua index 1f1569e..0354c16 100644 --- a/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua +++ b/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua @@ -76,10 +76,24 @@ end end hook.Add("Initialize", "RegisterDummyEntities", function() - scripted_ents.Register(ENT, "weapon_elite") - scripted_ents.Register(ENT, "weapon_knife") - scripted_ents.Register(ENT, "weapon_deagle") scripted_ents.Register(ENT, "ammo_50ae") scripted_ents.Register(ENT, "ammo_556mm_box") scripted_ents.Register(ENT, "player_weaponstrip") + + --CSS Weapons for ZE map parenting + for i, weapon in pairs(CSSWEAPONS) do + weapons.Register({Base = "weapon_map_base"},weapon) + end +end) + +hook.Add( "PlayerCanPickupWeapon", "RestrictMapWeapons", function( ply, wep ) + + local weps = ply:GetWeapons() + + --Only allow one special weapon per player + for k, v in pairs(weps) do + if table.HasValue( CSSWEAPONS, v:GetClass() ) or v:GetClass()=="weapon_map_base" then return false end + end + + return true end) From 74035790dc5b4b93a9486f7c173e72c03ddd15c8 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 16 Nov 2014 04:54:53 +0000 Subject: [PATCH 3/3] Moved CSSWEAPONS from global to local There's no reason to have it in globals if it's only used in one place --- gamemodes/zombiesurvival/gamemode/sh_globals.lua | 6 ------ gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/sh_globals.lua b/gamemodes/zombiesurvival/gamemode/sh_globals.lua index 79ebbff..f639d99 100644 --- a/gamemodes/zombiesurvival/gamemode/sh_globals.lua +++ b/gamemodes/zombiesurvival/gamemode/sh_globals.lua @@ -92,12 +92,6 @@ ZE_KNOCKBACKSCALE = 0.1 MASK_HOVER = bit.bor(CONTENTS_OPAQUE, CONTENTS_GRATE, CONTENTS_HITBOX, CONTENTS_DEBRIS, CONTENTS_SOLID, CONTENTS_WATER, CONTENTS_SLIME, CONTENTS_WINDOW, CONTENTS_LADDER, CONTENTS_PLAYERCLIP, CONTENTS_MOVEABLE, CONTENTS_DETAIL, CONTENTS_TRANSLUCENT) -CSSWEAPONS = {"weapon_knife","weapon_glock","weapon_usp","weapon_p228","weapon_deagle", - "weapon_elite","weapon_fiveseven","weapon_m3","weapon_xm1014","weapon_galil", - "weapon_ak47","weapon_scout","weapon_sg552","weapon_awp","weapon_g3sg1", - "weapon_famas","weapon_m4a1","weapon_aug","weapon_sg550","weapon_mac10", - "weapon_tmp","weapon_mp5navy","weapon_ump45","weapon_p90","weapon_m249"} - GM.BarricadeHealthMin = 50 GM.BarricadeHealthMax = 1100 GM.BarricadeHealthMassFactor = 3 diff --git a/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua b/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua index 0354c16..c04e240 100644 --- a/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua +++ b/gamemodes/zombiesurvival/gamemode/sh_zombieescape.lua @@ -8,6 +8,12 @@ GM.ZE_TimeLimit = 60 * 16 GM.DefaultZombieClass = GM.ZombieClasses["Super Zombie"].Index +local CSSWEAPONS = {"weapon_knife","weapon_glock","weapon_usp","weapon_p228","weapon_deagle", + "weapon_elite","weapon_fiveseven","weapon_m3","weapon_xm1014","weapon_galil", + "weapon_ak47","weapon_scout","weapon_sg552","weapon_awp","weapon_g3sg1", + "weapon_famas","weapon_m4a1","weapon_aug","weapon_sg550","weapon_mac10", + "weapon_tmp","weapon_mp5navy","weapon_ump45","weapon_p90","weapon_m249"} + function GM:Move(pl, move) if pl:Team() == TEAM_HUMAN then if pl:GetBarricadeGhosting() then