From f40fadc72117be3ea8b5368aeef2a8649762d82d Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 4 Jan 2016 13:54:27 -0500 Subject: Added angle snapping --- gamemode/itemsystem/items/floor.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gamemode/itemsystem/items/floor.lua') diff --git a/gamemode/itemsystem/items/floor.lua b/gamemode/itemsystem/items/floor.lua index 82eb3ec..0e7cd8a 100644 --- a/gamemode/itemsystem/items/floor.lua +++ b/gamemode/itemsystem/items/floor.lua @@ -1,7 +1,7 @@ ITEM.Name = "Floor" ITEM.Class = "structure" -ITEM.Desc = "Some basic wood structure for setting up camps." +ITEM.Desc = "Some basic wood structure for setting up camps.\nHold down shift to snap" ITEM.Model = "models/props_debris/wood_board07a.mdl" ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_fence") ITEM.Recipe = { @@ -45,13 +45,15 @@ function ITEM:OnPrimary(pl,tr) if (tr.Hit) then local drop = ents.Create("ws_prop") drop:SetModel("models/props_wasteland/wood_fence02a.mdl") - drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,90)) + local Aim = Angle(0,pl:GetAimVector():Angle().y+90,0) local Pos = tr.HitPos - if(GM:KeyPress(pl,IN_SPEED)) then + if(pl:KeyDown(IN_SPEED)) then Pos.x = Pos.x - (Pos.x%20) Pos.y = Pos.y - (Pos.y%20) Pos.z = Pos.z - (Pos.z%20) + Ang.yaw = Ang.yaw - (Ang.yaw%15) end + drop:SetAngles(Aim) drop:SetPos(Pos) drop:Spawn() drop:Activate() -- cgit v1.2.3-70-g09d2