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/infuser.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gamemode/itemsystem/items/infuser.lua') diff --git a/gamemode/itemsystem/items/infuser.lua b/gamemode/itemsystem/items/infuser.lua index 260e8fd..701a548 100644 --- a/gamemode/itemsystem/items/infuser.lua +++ b/gamemode/itemsystem/items/infuser.lua @@ -1,6 +1,6 @@ ITEM.Name = "Infuser" ITEM.Class = "structure" -ITEM.Desc = "Cast enchantments\nPlace runes nearby to boost magical power and have different effects" +ITEM.Desc = "Cast enchantments\nPlace runes nearby to boost magical power and have different effects\nHold down shift to snap" ITEM.Model = "models/props_junk/wood_crate002a.mdl" ITEM.Icon = Material("settlement/icon_researchtable") ITEM.Recipe = { @@ -42,13 +42,15 @@ function ITEM:OnPrimary(pl,tr) if (tr.Hit) then local drop = ents.Create("ws_infuser") - drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) + 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