From 3e23a89326945a13612b3c400181d2ad5f60a95a Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 15 Dec 2014 18:55:23 +0000 Subject: [PATCH 1/3] Added logic_stripweapons entity Specific entity to remove a weapon that targets a player activator holds: --keys-- keepfists: If yes, the stripallweapons input strips all weapons but fists --Inputs-- stripweapon: Strips a single weapon as mentioned in arguments stripallweapons: Strips all weapons the activator has setkeepfists: If 1 the stripallweapons inputs strip all weapons but fists --- .../entities/logic_stripweapons/init.lua | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua diff --git a/gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua b/gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua new file mode 100644 index 0000000..c92c4c1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/logic_stripweapons/init.lua @@ -0,0 +1,36 @@ +ENT.Type = "point" + +function ENT:Initialize() + self.KeepFists = self.KeepFists or 1 +end + +function ENT:AcceptInput(name, activator, caller, args) + name = string.lower(name) + if name == "stripweapon" then + if activator:IsPlayer() and activator:Alive() and activator:Team() == TEAM_HUMAN then + activator:StripWeapon(args) + end + elseif name == "stripallweapons" then + if activator:IsPlayer() and activator:Alive() and activator:Team() == TEAM_HUMAN then + if tonumber(self.KeepFists) == 1 then + local weps = activator:GetWeapons() + for k, v in pairs(weps) do + local weaponclass = v:GetClass() + if weaponclass ~= "weapon_zs_fists" then activator:StripWeapon(weaponclass) end + end + else + activator:StripWeapons(args) + end + end + elseif name == "setkeepfists" then + self.KeepFists = tonumber(args) + end +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "keepfists" then + self.KeepFists = tonumber(value) + end +end + \ No newline at end of file From 1f401dba4ecdda5f2f9f428e0a1e6477a74744c2 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 15 Dec 2014 18:58:10 +0000 Subject: [PATCH 2/3] enabled use of weapon_map_base in default ZS Prevented weapon_map_base from being deleted so that people could use it as a tool for creating map made custom weapons in non-ze game types. --- gamemodes/zombiesurvival/gamemode/init.lua | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/init.lua b/gamemodes/zombiesurvival/gamemode/init.lua index bc97206..68e15fb 100644 --- a/gamemodes/zombiesurvival/gamemode/init.lua +++ b/gamemodes/zombiesurvival/gamemode/init.lua @@ -596,19 +596,21 @@ end function GM:ReplaceMapWeapons() for _, ent in pairs(ents.FindByClass("weapon_*")) do - if string.sub(ent:GetClass(), 1, 10) == "weapon_zs_" then - local wep = ents.Create("prop_weapon") - if wep:IsValid() then - wep:SetPos(ent:GetPos()) - wep:SetAngles(ent:GetAngles()) - wep:SetWeaponType(ent:GetClass()) - wep:SetShouldRemoveAmmo(false) - wep:Spawn() - wep.IsPreplaced = true + local wepclass = ent:GetClass() + if wepclass ~= "weapon_map_base" then + if string.sub(wepclass, 1, 10) == "weapon_zs_" then + local wep = ents.Create("prop_weapon") + if wep:IsValid() then + wep:SetPos(ent:GetPos()) + wep:SetAngles(ent:GetAngles()) + wep:SetWeaponType(ent:GetClass()) + wep:SetShouldRemoveAmmo(false) + wep:Spawn() + wep.IsPreplaced = true + end end + ent:Remove() end - - ent:Remove() end end From 10126eced6023273e1fc4358cf2386e9db6d83ee Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 15 Dec 2014 18:59:53 +0000 Subject: [PATCH 3/3] Various additions to FGD + Added logic_stripweapons + Added weapon_map_base + Gave prop_nail "angles" keyvalue --- gamemodes/zombiesurvival/zombiesurvival.fgd | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gamemodes/zombiesurvival/zombiesurvival.fgd b/gamemodes/zombiesurvival/zombiesurvival.fgd index 84cf2ca..ec5cc58 100644 --- a/gamemodes/zombiesurvival/zombiesurvival.fgd +++ b/gamemodes/zombiesurvival/zombiesurvival.fgd @@ -1,5 +1,5 @@ ////////////////////////////////////////////////////////////////////////////////// -// NoXiousNet Zombie Survival FGD - Last Edit by Benjy (9th December 2014) // +// NoXiousNet Zombie Survival FGD - Last Edit by Benjy (15th December 2014) // // If there are any bugs with this file, or any additions that need to be made // // make a post at: http://www.noxiousnet.com/forums/index.php?topic=14910 // ////////////////////////////////////////////////////////////////////////////////// @@ -404,7 +404,7 @@ output OnClassUnlocked(void) : "Called when the class we're watching's class is unlocked by the game. This output isn't called if the class is unlocked by any logic_classunlock entities, only by the game." ] -@PointClass studio("models/crossbow_bolt.mdl") base(Targetname) = prop_nail : "ZS: Allows you to manually place nails." +@PointClass studio("models/crossbow_bolt.mdl") base(Targetname,Angles) = prop_nail : "ZS: Allows you to manually place nails." [ // Keys healthoverride(integer) : "Health Override" : 210 : "Sets the nail's maximum health to a specific number." @@ -604,10 +604,27 @@ output OnDisplayed(void) : "Called when the message has successfully displayed." ] +@PointClass base(Targetname) = logic_stripweapons : "ZS: Allows the map to strip all or specific weapons by classname" +[ + // Keys + keepfists(choices) : "Keep Fists" : 1 : "If yes, the stripallweapons input strips all weapons but fists" = + [ + 0 : "No" + 1 : "Yes" + ] + + // Inputs + input stripweapon(string) : "Strips a single weapon as mentioned in arguments" + input stripallweapons(string) : "Strips all the weapons the activator has, keeps fists if flag is true" + input setkeepfists(integer) : "If 1 the next stripallweapons inputs strip all weapons but fists" +] + /////////////////////////////////////////////////////////////////////////////////// // Gamemode - Worth Weapons + Items /////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// +@PointClass base(Weapon) = weapon_map_base : "Used for creating parentable map made weapons" [] + @PointClass base(Weapon) studio("models/weapons/w_pistol.mdl") = weapon_zs_owens: "Ammo Type: Pistol.\n"+ "A late starting pistol to be added to the game, has the highest damage potential of a starting pistol. It shoots 2 shots which together deal 16 damage. Its primary downside is that it has a lower accuracy than the peashooter and that crouching and using iron sights doesn't improve its accuracy unlike the battleaxe. Since its addition into the game it has been the favorite starting pistol among players up until the ammo nerf and updates of autumn 2009." []