Merge pull request #107 from BClark09/master
Added Failed/Passed Outputs when picking up items
This commit is contained in:
commit
5235f35271
3 changed files with 36 additions and 6 deletions
|
@ -63,6 +63,7 @@ function ENT:GiveToActivator(activator, caller)
|
|||
end
|
||||
|
||||
if not hasweapon and not self.Forced then
|
||||
self:Input("OnPickupFailed", activator)
|
||||
activator:CenterNotify(COLOR_RED, translate.ClientGet(activator, "nothing_for_this_ammo"))
|
||||
return
|
||||
end
|
||||
|
@ -73,11 +74,14 @@ function ENT:GiveToActivator(activator, caller)
|
|||
if self.PlacedInMap and not self.IgnorePickupCount then
|
||||
activator.AmmoPickups = (activator.AmmoPickups or 0) + 1
|
||||
end
|
||||
|
||||
self:Input("OnPickupPassed", activator, caller)
|
||||
if not self.NeverRemove then self:RemoveNextFrame() end
|
||||
else
|
||||
self:Input("OnPickupFailed", activator)
|
||||
activator:CenterNotify(COLOR_RED, translate.ClientGet(activator, "you_decide_to_leave_some"))
|
||||
end
|
||||
else
|
||||
self:Input("OnPickupFailed", activator)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -93,6 +97,8 @@ function ENT:KeyValue(key, value)
|
|||
self.NeverRemove = tonumber(value) == 1
|
||||
elseif key == "ignoreuse" then
|
||||
self.IgnoreUse = tonumber(value) == 1
|
||||
elseif string.sub(key, 1, 2) == "on" then
|
||||
self:AddOnOutput(key, value)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -113,6 +119,8 @@ function ENT:AcceptInput(name, activator, caller, arg)
|
|||
return true
|
||||
elseif name == "setammotype" then
|
||||
self:SetAmmoType(arg)
|
||||
elseif string.sub(name, 1, 2) == "on" then
|
||||
self:FireOutput(name, activator, caller, args)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -68,10 +68,17 @@ function ENT:GiveToActivator(activator, caller)
|
|||
or activator:Team() ~= TEAM_HUMAN
|
||||
or self.Removing
|
||||
or (activator:KeyDown(GAMEMODE.UtilityKey) and not self.Forced)
|
||||
or self.NoPickupsTime and CurTime() < self.NoPickupsTime and self.NoPickupsOwner ~= activator then return end
|
||||
or self.NoPickupsTime and CurTime() < self.NoPickupsTime and self.NoPickupsOwner ~= activator then
|
||||
|
||||
self:Input("OnPickupFailed", activator)
|
||||
return
|
||||
end
|
||||
|
||||
local weptype = self:GetWeaponType()
|
||||
if not weptype then return end
|
||||
if not weptype then
|
||||
self:Input("OnPickupFailed", activator)
|
||||
return
|
||||
end
|
||||
|
||||
if activator:HasWeapon(weptype) and (self.Forced or not GAMEMODE.MaxWeaponPickups) then
|
||||
local wep = activator:GetWeapon(weptype)
|
||||
|
@ -84,9 +91,9 @@ function ENT:GiveToActivator(activator, caller)
|
|||
|
||||
local stored = weapons.GetStored(weptype)
|
||||
if stored and stored.AmmoIfHas then
|
||||
self:Input("OnPickupPassed", activator)
|
||||
if not self.NeverRemove then self:RemoveNextFrame() end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
@ -102,10 +109,13 @@ function ENT:GiveToActivator(activator, caller)
|
|||
if self.PlacedInMap and not self.IgnorePickupCount then
|
||||
activator.WeaponPickups = (activator.WeaponPickups or 0) + 1
|
||||
end
|
||||
|
||||
self:Input("OnPickupPassed", activator)
|
||||
if not self.NeverRemove then self:RemoveNextFrame() end
|
||||
else
|
||||
self:Input("OnPickupFailed", activator)
|
||||
end
|
||||
else
|
||||
self:Input("OnPickupFailed", activator)
|
||||
activator:CenterNotify(COLOR_RED, translate.ClientGet(activator, "you_decide_to_leave_some"))
|
||||
end
|
||||
end
|
||||
|
@ -122,6 +132,8 @@ function ENT:KeyValue(key, value)
|
|||
self.IgnoreUse = tonumber(value) == 1
|
||||
elseif key == "empty" then
|
||||
self.Empty = tonumber(value) == 1
|
||||
elseif string.sub(key, 1, 2) == "on" then
|
||||
self:AddOnOutput(key, value)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -145,6 +157,8 @@ function ENT:AcceptInput(name, activator, caller, arg)
|
|||
return true
|
||||
elseif name == "setempty" then
|
||||
self.Empty = tonumber(arg) == 1
|
||||
elseif string.sub(name, 1, 2) == "on" then
|
||||
self:FireOutput(name, activator, caller, args)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -495,6 +495,10 @@
|
|||
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."
|
||||
|
||||
// Outputs
|
||||
output OnPickupPassed(void) : "Called when the ammo is given to the player."
|
||||
output OnPickupFailed(void) : "Called when the ammo is not given to the player"
|
||||
]
|
||||
|
||||
@PointClass studio("models/weapons/w_irifle.mdl") base(Targetname, Parentname, Angles) = prop_weapon : "ZS: Game Specific Weapon."
|
||||
|
@ -529,6 +533,10 @@
|
|||
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."
|
||||
|
||||
// Outputs
|
||||
output OnPickupPassed(void) : "Called when the weapon is given to the player."
|
||||
output OnPickupFailed(void) : "Called when the weapon is not given to the player"
|
||||
]
|
||||
|
||||
@PointClass base(Targetname, Parentname) sphere( range ) = point_worldhint : "ZS: Allows you to create 3D hints and information tags."
|
||||
|
@ -759,7 +767,7 @@
|
|||
"Ammo Type: SMG.\n"+
|
||||
"This is a stationary turret that is placed similarly to aegis boards. Once placed, they will seek zombies and fire when one crosses its laser sight, focusing on the head. However, turrets can be extremely vulnerable to zombies as its firing power isn't good enough to take down zombies on its own and doesn't have much health. " []
|
||||
|
||||
@PointClass base(Weapon) studio("models/items/item_item_crate.mdl") = weapon_zs_acrate :
|
||||
@PointClass base(Weapon) studio("models/items/item_item_crate.mdl") = weapon_zs_arsenalcrate :
|
||||
"The Arsenal Crate is a major part of the humans' survival. At wave break, this allows humans to purchase other weapons at 20% off. When a player purchases an item from this, the owner gets paid 10% commission price. Arsenal Crates can be destroyed by zombie attacks. " []
|
||||
|
||||
@PointClass base(Weapon) studio("models/props_combine/combine_mine01.mdl") = weapon_zs_messagebeacon :
|
||||
|
|
Loading…
Reference in a new issue