From 8b5c09544b34d31408cf8ed141e9d2e0d090e869 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 13 Feb 2016 22:18:15 -0500 Subject: Arrows from bow changed to projectile --- gamemode/itemsystem/items/bow.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'gamemode/itemsystem/items/bow.lua') 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 -- cgit v1.2.3-70-g09d2