diff options
Diffstat (limited to 'gamemode/itemsystem/items/bow.lua')
| -rw-r--r-- | gamemode/itemsystem/items/bow.lua | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gamemode/itemsystem/items/bow.lua b/gamemode/itemsystem/items/bow.lua index 8ecee8e..d87e446 100644 --- a/gamemode/itemsystem/items/bow.lua +++ b/gamemode/itemsystem/items/bow.lua @@ -41,19 +41,36 @@ ITEM.Recipe = { ITEM.CD = 1
+local arrow = {}
+arrow["model"] = "models/mixerman3d/other/arrow.mdl"
+arrow["speed"] = 13000
+arrow["drop"] = 50
+arrow["init"] = function(fb) end
+arrow["onhit"] = function (self,data,phys)
+ if(data.HitEntity and data.HitEntity.TakeDamage) then
+ data.HitEntity:TakeDamage(25)
+ end
+ self:Remove()
+end
+
function ITEM:OnPrimary(pl,tr)
if (CLIENT) then return end
if (!pl:HasItem("Arrow",1)) then return end
local aim = pl:GetAimVector()
- local D = ents.Create("ws_arrow")
- D:SetPos(pl:GetShootPos()+aim*20)
+ local D = ents.Create("ws_projectile")
+ if(arrow.speed) then D.speed = arrow.speed end
+ if(arrow.model) then D.model = arrow.model end
+ if(arrow.drop) then D.drop = arrow.drop end
+ if(arrow.init) then D.init = arrow.init end
+ if(arrow.onhit) then D.onhit = arrow.onhit end
+
+ D:SetPos(pl:GetShootPos()+aim*50)
D:SetOwner(pl)
D:SetAngles(aim:Angle())
D:Spawn()
pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110))
- D:GetPhysicsObject():ApplyForceCenter(aim * 10000)
pl:RemoveItem("Arrow",1)
end
|
