Fixed/Included changes in previous commit

+Added Empty keyvalue for giving ammo-less weapons
This commit is contained in:
Ben 2015-01-01 16:38:11 +00:00
parent 4a1e79c8bf
commit 1baf4af3e4
3 changed files with 49 additions and 9 deletions

View file

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

View file

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

View file

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