aboutsummaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/items/bow.lua
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-02-13 22:18:15 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-02-13 22:18:15 -0500
commit8b5c09544b34d31408cf8ed141e9d2e0d090e869 (patch)
treeb567b564cdc290057248570afaa96990cc28ad2a /gamemode/itemsystem/items/bow.lua
parentf9df323cf660cbe40eab897f5fe5af891ba2b66a (diff)
downloadwintersurvival2-8b5c09544b34d31408cf8ed141e9d2e0d090e869.tar.gz
wintersurvival2-8b5c09544b34d31408cf8ed141e9d2e0d090e869.tar.bz2
wintersurvival2-8b5c09544b34d31408cf8ed141e9d2e0d090e869.zip
Arrows from bow changed to projectile
Diffstat (limited to 'gamemode/itemsystem/items/bow.lua')
-rw-r--r--gamemode/itemsystem/items/bow.lua23
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