From c938d041633104340f866a5906f6dbaffaf1f459 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Tue, 18 Oct 2016 18:22:54 -0400 Subject: Bugfixes in spells and misc linting --- gamemode/itemsystem/items/magicwood.lua | 51 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'gamemode/itemsystem/items/magicwood.lua') diff --git a/gamemode/itemsystem/items/magicwood.lua b/gamemode/itemsystem/items/magicwood.lua index 00c1605..a871c72 100644 --- a/gamemode/itemsystem/items/magicwood.lua +++ b/gamemode/itemsystem/items/magicwood.lua @@ -1,25 +1,24 @@ - -ITEM.Name = "Magic Wood" -ITEM.Class = "weapon" -ITEM.Desc = "Some magically infused wood" -ITEM.Model = "models/props_debris/wood_board02a.mdl" -ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_magicwood.png") +ITEM.Name = "Magic Wood" +ITEM.Class = "weapon" +ITEM.Desc = "Some magically infused wood" +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_magicwood.png") ITEM.Structure = { { Bone = "ValveBiped.Bip01_R_Hand", Model = "models/props_debris/wood_board02a.mdl", - Size = Vector(.5,.5,.5), - Pos = Vector(3,-1.5,-12), - Ang = Angle(0,0,0), - }, + Size = Vector(.5, .5, .5), + Pos = Vector(3, -1.5, -12), + Ang = Angle(0, 0, 0) + } } ITEM.Damage = 2 ITEM.Range = 60 ITEM.CD = 1.0 -function ITEM:OnPrimary(pl,tr) +function ITEM:OnPrimary(pl, tr) if (CLIENT) then return end if (tr.Hit) then @@ -28,31 +27,31 @@ function ITEM:OnPrimary(pl,tr) 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) + 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 + 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:GetModel():find("tree")) then - pl:EmitSound(Sound("physics/concrete/rock_impact_hard"..math.random(1,6)..".wav"),100,math.random(90,110)) + 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)) + pl:EmitSound(Sound("physics/surfaces/sand_impact_bullet" .. math.random(1, 4) .. ".wav"), 100, math.random(90, 110)) end else - pl:EmitSound(Sound("physics/surfaces/sand_impact_bullet"..math.random(1,4)..".wav"),100,math.random(90,110)) + pl:EmitSound(Sound("physics/surfaces/sand_impact_bullet" .. math.random(1, 4) .. ".wav"), 100, math.random(90, 110)) end else - pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"), 100, math.random(90, 110)) end end -function ITEM:OnSecondary(pl,tr) +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) + if (not 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)) + pl:RemoveItem(self.Name, 1) + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"), 100, math.random(40, 60)) end -- cgit v1.2.3-70-g09d2