Merge pull request #61 from BClark09/master

3 commits enabling map made custom weapons in ZS
This commit is contained in:
William Moodhe / JetBoom 2014-12-15 17:14:25 -05:00
commit 6ead5452f7
3 changed files with 68 additions and 13 deletions

View file

@ -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

View file

@ -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

View file

@ -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." []