local ITEM = {} ITEM.Name = "Bow" ITEM.Class = "weapon" ITEM.Desc = "A primitive bow made from vine, sap, and wood." ITEM.Model = "models/props_debris/wood_board02a.mdl" ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_bow") ITEM.HoldType = "smg" ITEM.Structure = { { Bone = "ValveBiped.Bip01_L_Hand", Model = "models/props_debris/wood_board02a.mdl", Size = Vector(.5,.5,.35), Pos = Vector(-1,-6,9), Ang = Angle(-30,-65,180), }, { Bone = "ValveBiped.Bip01_L_Hand", Model = "models/props_debris/wood_board02a.mdl", Size = Vector(.5,.5,.35), Pos = Vector(-1,-6,-9), Ang = Angle(30,-65,180), }, { Bone = "ValveBiped.Bip01_L_Hand", Model = "models/props_debris/wood_board02a.mdl", Size = Vector(.05,.05,.51), Pos = Vector(-3.3,-9.5,0), Ang = Angle(0,-65,180), }, } ITEM.Recipe = { Resources = { ["Plank"] = 2, ["Rope"] = 1, ["Sap"] = 1, }, Tools = {}, } ITEM.CD = 1 local arrow = {} arrow["model"] = "models/mixerman3d/other/arrow.mdl" arrow["speed"] = 1300 arrow["drop"] = 50 arrow["init"] = function(fb) end arrow["onhit"] = function (self,data,phys) --print("Arrow hit ") PrintTable(data.HitEntity) if(data.Entity and data.Entity.TakeDamage) then data.HitEntity:TakeDamage(25) end if(not data.HitNonWorld) then SpawnWSItem("Arrow",data.HitPos) 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_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)) pl:RemoveItem("Arrow",1) end RegisterItem(ITEM)