From 1d538e1c900a2a0a8155c32688019d6034c0f322 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 16 Nov 2014 02:41:28 +0000 Subject: [PATCH] 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."