removed primary_ammo_empty
removed secondary_ammo_empty

added primary_ammo_equals
added secondary_ammo_equals
added primary_ammo_above
added secondary_ammo_above

added in_vehicle
added model_equals
added model_find


git-svn-id: http://gmodcapsadmin.googlecode.com/svn/trunk/addons/pac3@42 047d434e-d786-fb00-e516-99c5e643cd71
This commit is contained in:
CapsAdmin 2012-06-05 06:43:41 +00:00
parent e236134d0f
commit 4655354025

View File

@ -27,21 +27,39 @@ PART.Events =
return true
end
end,
primary_ammo_empty = function(owner)
primary_ammo_equals = function(owner, self)
local num = tonumber(self.Arguments) or 0
local wep = owner.GetActiveWeapon and owner:GetActiveWeapon() or NULL
if wep:IsValid() and wep:Clip1() == 0 then
if wep:IsValid() and wep:Clip1() == num then
return true
end
end,
secondary_ammo_empty = function(owner)
secondary_ammo_equals = function(owner, self)
local num = tonumber(self.Arguments) or 0
local wep = owner.GetActiveWeapon and owner:GetActiveWeapon() or NULL
if wep:IsValid() and wep:Clip2() == 0 then
if wep:IsValid() and wep:Clip2() == num then
return true
end
end,
primary_ammo_above = function(owner, self)
local num = tonumber(self.Arguments) or 0
local wep = owner.GetActiveWeapon and owner:GetActiveWeapon() or NULL
if wep:IsValid() and wep:Clip1() > num then
return true
end
end,
secondary_ammo_above = function(owner, self)
local num = tonumber(self.Arguments) or 0
local wep = owner.GetActiveWeapon and owner:GetActiveWeapon() or NULL
if wep:IsValid() and wep:Clip2() > num then
return true
end
end,
on_ground = function(owner)
if owner:IsPlayer() and owner:IsOnGround() then
return true
@ -55,6 +73,38 @@ PART.Events =
return true
end
end,
in_vehicle = function(owner, self)
local ent = owner:GetVehicle()
if ent:IsValid() then
if self.Arguments ~= "" then
local class = ent:GetClass()
if pac.PatternCache[class..self.Arguments] or class:find(self.Arguments) then
pac.PatternCache[class..self.Arguments] = true
return true
end
return false
end
return true
end
end,
model_equals = function(owner, self)
return owner:GetModel() == self.Arguments
end,
model_find = function(owner, self)
if self.Arguments ~= "" then
local str = owner:GetModel()
if pac.PatternCache[str..self.Arguments] or str:find(self.Arguments) then
pac.PatternCache[str..self.Arguments] = true
return true
end
end
end,
}
function PART:GetOwner()