From 1baf4af3e41fe5ee1f8319341c9a3f565aa3b643 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 1 Jan 2015 16:38:11 +0000 Subject: [PATCH] Fixed/Included changes in previous commit +Added Empty keyvalue for giving ammo-less weapons --- .../entities/entities/prop_ammo/init.lua | 2 +- .../entities/entities/prop_weapon/init.lua | 9 +++- gamemodes/zombiesurvival/zombiesurvival.fgd | 47 ++++++++++++++++--- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua index e622cbe..e7a1ab7 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua @@ -109,7 +109,7 @@ function ENT:AcceptInput(name, activator, caller, arg) self.IgnorePickupCount = tonumber(arg) == 1 return true elseif name == "setignoreuse" then - self.IgnoreUse = tonumber(value) == 1 + self.IgnoreUse = tonumber(arg) == 1 return true elseif name == "setammotype" then self:SetAmmoType(arg) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua index 85c8f92..8152211 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua @@ -12,6 +12,7 @@ function ENT:Initialize() self.Forced = self.Forced or false self.NeverRemove = self.NeverRemove or false self.IgnoreUse = self.IgnoreUse or false + self.Empty = self.Empty or false local weptab = weapons.GetStored(self:GetWeaponType()) if weptab and not weptab.BoxPhysicsMax then @@ -91,7 +92,7 @@ function ENT:GiveToActivator(activator, caller) end if not self.PlacedInMap or not GAMEMODE.MaxWeaponPickups or (activator.WeaponPickups or 0) < GAMEMODE.MaxWeaponPickups or team.NumPlayers(TEAM_HUMAN) <= 1 then - local wep = self.PlacedInMap and activator:Give(weptype) or activator:GiveEmptyWeapon(weptype) + local wep = (self.PlacedInMap and not self.Empty) and activator:Give(weptype) or activator:GiveEmptyWeapon(weptype) if wep and wep:IsValid() and wep:GetOwner():IsValid() then if self:GetShouldRemoveAmmo() then wep:SetClip1(self:GetClip1()) @@ -119,6 +120,8 @@ function ENT:KeyValue(key, value) self.NeverRemove = tonumber(value) == 1 elseif key == "ignoreuse" then self.IgnoreUse = tonumber(value) == 1 + elseif key == "empty" then + self.Empty = tonumber(value) == 1 end end @@ -135,11 +138,13 @@ function ENT:AcceptInput(name, activator, caller, arg) self.IgnorePickupCount = tonumber(arg) == 1 return true elseif name == "setignoreuse" then - self.IgnoreUse = tonumber(value) == 1 + self.IgnoreUse = tonumber(arg) == 1 return true elseif name == "setweapontype" then self:SetWeaponType(arg) return true + elseif name == "setempty" then + self.Empty = tonumber(arg) == 1 end end diff --git a/gamemodes/zombiesurvival/zombiesurvival.fgd b/gamemodes/zombiesurvival/zombiesurvival.fgd index 89e0a51..980e596 100644 --- a/gamemodes/zombiesurvival/zombiesurvival.fgd +++ b/gamemodes/zombiesurvival/zombiesurvival.fgd @@ -473,12 +473,6 @@ "thumper" : "Turrets" ] amount(integer) : "Amount" : 0 : "Amount of ammo that collecting this item gives" -] - -@PointClass studio("models/weapons/w_irifle.mdl") base(Targetname, Parentname, Angles) = prop_weapon : "ZS: Game Specific Weapon." -[ - // Keys - weapontype(string) : "Weapon Type" : "weapon_zs_m4" : "Weapon type this entity becomes" neverremove(choices) : "Never Remove" : 0 : "Never remove when used or damage, for repeated uses." = [ 0 : "No" @@ -489,11 +483,52 @@ 0 : "No" 1 : "Yes" ] + ignoreuse(choices) : "Ignore Use" : 0 : "Set to disable being able to pickup via use key" = + [ + 0 : "No" + 1 : "Yes" + ] + + // Inputs + input givetoactivator(void) : "Forces the ammo onto the activator." + input setneverremove(integer) : "Set to make infinite uses." + input setignorepickupcount(integer) : "Set to ignore any max pickup counter." + input setignoreuse(integer) : "Set to disable being able to pickup via use key" + input setammotype(string) : "Set to change the ammo type of this entity." +] + +@PointClass studio("models/weapons/w_irifle.mdl") base(Targetname, Parentname, Angles) = prop_weapon : "ZS: Game Specific Weapon." +[ + // Keys + weapontype(string) : "Weapon Type" : "weapon_zs_m4" : "Weapon type this entity becomes" + empty(choices) : "Empty" : 0 : "Set to empty the weapon of any default ammo" = + [ + 0 : "No" + 1 : "Yes" + ] + neverremove(choices) : "Never Remove" : 0 : "Never remove when used or damage, for repeated uses." = + [ + 0 : "No" + 1 : "Yes" + ] + ignorepickupcount(choices) : "Ignore Pickup Counter" : 0 : "Set to ignore a maxpickupcounter, if any." = + [ + 0 : "No" + 1 : "Yes" + ] + ignoreuse(choices) : "Ignore Use" : 0 : "Set to disable being able to pickup via use key" = + [ + 0 : "No" + 1 : "Yes" + ] // Inputs input givetoactivator(void) : "Forces the weapon onto the activator." input setneverremove(integer) : "Set to make infinite uses." input setignorepickupcount(integer) : "Set to ignore any max pickup counter." + input setignoreuse(integer) : "Set to disable being able to pickup via use key" + input setweapontype(string) : "Set to change the weapon type of this entity." + input setempty(string) : "Set to empty the weapon of any default ammo." ] @PointClass base(Targetname, Parentname) sphere( range ) = point_worldhint : "ZS: Allows you to create 3D hints and information tags."