From 698b6eedf1d6d2806c77895775bcf8245ce02229 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 4 Jan 2016 13:26:04 -0500 Subject: Added building snap --- gamemode/itemsystem/items/campfire.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gamemode/itemsystem/items/campfire.lua') diff --git a/gamemode/itemsystem/items/campfire.lua b/gamemode/itemsystem/items/campfire.lua index 5cc4987..f6ec4e6 100644 --- a/gamemode/itemsystem/items/campfire.lua +++ b/gamemode/itemsystem/items/campfire.lua @@ -68,7 +68,13 @@ function ITEM:OnPrimary(pl,tr) if (tr.Hit and tr.HitWorld) then local drop = ents.Create("ws_campfire") drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) - drop:SetPos(tr.HitPos) + local Pos = tr.HitPos + if(GM:KeyPress(pl,IN_SPEED)) then + Pos.x = Pos.x - (Pos.x%20) + Pos.y = Pos.y - (Pos.y%20) + Pos.z = Pos.z - (Pos.z%20) + end + drop:SetPos(Pos) drop:Spawn() drop:Activate() -- cgit v1.2.3-70-g09d2