From 0ceb38e8a1f26716fe4756c1cfbdbbedd1fae5f1 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 28 Dec 2016 18:46:17 -0600 Subject: Fixed some stuff --- gamemode/itemsystem/items/rock.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'gamemode/itemsystem/items/rock.lua') diff --git a/gamemode/itemsystem/items/rock.lua b/gamemode/itemsystem/items/rock.lua index 5ee7e09..ee41e40 100644 --- a/gamemode/itemsystem/items/rock.lua +++ b/gamemode/itemsystem/items/rock.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Rock" ITEM.Class = "weapon" ITEM.Desc = "A rock.\nIt is somewhat jagged." @@ -21,20 +21,20 @@ ITEM.CD = .4 function ITEM:OnPrimary(pl,tr) if (CLIENT) then return end - + if (tr.Hit) then if (IsValid(tr.Entity)) then local ent = tr.Entity local class = ent:GetClass() - + if (class == "player" or class:find("npc_") or class == "ws_pigeon" or class == "ws_prop") then ent:TakeDamage(self.Damage,pl) - + if (class == "ws_prop") then pl:EmitSound(Sound("physics/wood/wood_plank_impact_hard"..math.random(1,3)..".wav"),100,math.random(90,110)) else pl:EmitSound(Sound("physics/flesh/flesh_impact_hard"..math.random(1,6)..".wav"),100,math.random(90,110)) end elseif (ent:IsTree()) then if (math.random(1,35)/10 < 1) then pl:AddItem("Sap",1) end - + pl:EmitSound(Sound("physics/concrete/rock_impact_hard"..math.random(1,6)..".wav"),100,math.random(90,110)) else pl:EmitSound(Sound("physics/surfaces/sand_impact_bullet"..math.random(1,4)..".wav"),100,math.random(90,110)) @@ -50,11 +50,12 @@ end function ITEM:OnSecondary(pl,tr) if (CLIENT) then return end if (!pl:HasItem(self.Name)) then return end - + local drop = SpawnWSItem(self.Name,pl:GetShootPos()+pl:GetAimVector()*20) drop:GetPhysicsObject():ApplyForceCenter(pl:GetAimVector() * 200) - + pl:RemoveItem(self.Name,1) - + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(40,60)) end +RegisterItem(ITEM) -- cgit v1.2.3-70-g09d2