aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-04 13:54:27 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-04 13:54:27 -0500
commitf40fadc72117be3ea8b5368aeef2a8649762d82d (patch)
tree32b569051a830f1ac25a797701c32993094583c1
parent698b6eedf1d6d2806c77895775bcf8245ce02229 (diff)
downloadwintersurvival2-f40fadc72117be3ea8b5368aeef2a8649762d82d.tar.gz
wintersurvival2-f40fadc72117be3ea8b5368aeef2a8649762d82d.tar.bz2
wintersurvival2-f40fadc72117be3ea8b5368aeef2a8649762d82d.zip
Added angle snapping
-rw-r--r--gamemode/itemsystem/items/alter.lua9
-rw-r--r--gamemode/itemsystem/items/campfire.lua9
-rw-r--r--gamemode/itemsystem/items/fence.lua8
-rw-r--r--gamemode/itemsystem/items/floor.lua8
-rw-r--r--gamemode/itemsystem/items/infuser.lua8
-rw-r--r--gamemode/itemsystem/items/ramp.lua8
-rw-r--r--gamemode/itemsystem/items/researchtable.lua8
-rw-r--r--gamemode/itemsystem/items/shack.lua5
-rw-r--r--gamemode/itemsystem/items/tent.lua3
-rw-r--r--gamemode/shared/player_ghost.lua1
10 files changed, 43 insertions, 24 deletions
diff --git a/gamemode/itemsystem/items/alter.lua b/gamemode/itemsystem/items/alter.lua
index b60d30b..891f15c 100644
--- a/gamemode/itemsystem/items/alter.lua
+++ b/gamemode/itemsystem/items/alter.lua
@@ -1,7 +1,7 @@
ITEM.Name = "Alter"
ITEM.Class = "structure"
-ITEM.Desc = "This allows you to sacrifice your soul for a player."
+ITEM.Desc = "This allows you to sacrifice your soul for a player.\nHold down shift to snap"
ITEM.Model = "models/props_c17/gravestone003a.mdl"
ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_crow.png")
ITEM.Recipe = {
@@ -51,13 +51,16 @@ function ITEM:OnPrimary(pl,tr)
if (tr.Hit) then
local drop = ents.Create("ws_alter")
- 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(Angle(0,Aim,0))
drop:SetPos(Pos)
drop:Spawn()
drop:Activate()
diff --git a/gamemode/itemsystem/items/campfire.lua b/gamemode/itemsystem/items/campfire.lua
index f6ec4e6..4e35932 100644
--- a/gamemode/itemsystem/items/campfire.lua
+++ b/gamemode/itemsystem/items/campfire.lua
@@ -1,7 +1,7 @@
ITEM.Name = "Campfire"
ITEM.Class = "structure"
-ITEM.Desc = "Ready to be lit. Some assembly required."
+ITEM.Desc = "Ready to be lit. Some assembly required.\nHold down shift to snap"
ITEM.Model = "models/props_debris/wood_board07a.mdl"
ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_campfire")
ITEM.Recipe = {
@@ -67,13 +67,16 @@ 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))
+ 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()
diff --git a/gamemode/itemsystem/items/fence.lua b/gamemode/itemsystem/items/fence.lua
index d472aaa..8616a09 100644
--- a/gamemode/itemsystem/items/fence.lua
+++ b/gamemode/itemsystem/items/fence.lua
@@ -1,7 +1,7 @@
ITEM.Name = "Fence"
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 = {
@@ -44,13 +44,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,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()
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()
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()
diff --git a/gamemode/itemsystem/items/ramp.lua b/gamemode/itemsystem/items/ramp.lua
index 9d6fd2b..2954399 100644
--- a/gamemode/itemsystem/items/ramp.lua
+++ b/gamemode/itemsystem/items/ramp.lua
@@ -1,7 +1,7 @@
ITEM.Name = "Ramp"
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,45))
+ 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()
diff --git a/gamemode/itemsystem/items/researchtable.lua b/gamemode/itemsystem/items/researchtable.lua
index b347828..9f00251 100644
--- a/gamemode/itemsystem/items/researchtable.lua
+++ b/gamemode/itemsystem/items/researchtable.lua
@@ -1,6 +1,6 @@
ITEM.Name = "Research Table"
ITEM.Class = "structure"
-ITEM.Desc = "A table to find recepies\nPlace 10 wood, sap, and rock in the table to discover a new recipe."
+ITEM.Desc = "A table to find recepies\nHold down shift to snap"
ITEM.Model = "models/props_junk/wood_crate001a.mdl"
ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png")
ITEM.Recipe = {
@@ -40,13 +40,15 @@ function ITEM:OnPrimary(pl,tr)
if (tr.Hit) then
local drop = ents.Create("ws_researchtable")
- 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()
diff --git a/gamemode/itemsystem/items/shack.lua b/gamemode/itemsystem/items/shack.lua
index 9090fb3..96790d6 100644
--- a/gamemode/itemsystem/items/shack.lua
+++ b/gamemode/itemsystem/items/shack.lua
@@ -1,7 +1,7 @@
ITEM.Name = "Shack"
ITEM.Class = "structure"
-ITEM.Desc = "An actual building... how convenient."
+ITEM.Desc = "An actual building... how convenient.\nHold down shift to snap"
ITEM.Model = "models/props_debris/wood_board07a.mdl"
ITEM.Icon = Material("settlement/icon_shack")
ITEM.Recipe = {
@@ -83,10 +83,11 @@ function ITEM:OnPrimary(pl,tr)
local Ang = 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
for k,v in pairs(self.Ghost) do
diff --git a/gamemode/itemsystem/items/tent.lua b/gamemode/itemsystem/items/tent.lua
index 3cbb207..846d6eb 100644
--- a/gamemode/itemsystem/items/tent.lua
+++ b/gamemode/itemsystem/items/tent.lua
@@ -50,10 +50,11 @@ function ITEM:OnPrimary(pl,tr)
if (tr.Hit) then
local Ang = 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
for k,v in pairs(self.Ghost) do
diff --git a/gamemode/shared/player_ghost.lua b/gamemode/shared/player_ghost.lua
index d2eade8..7cf11d0 100644
--- a/gamemode/shared/player_ghost.lua
+++ b/gamemode/shared/player_ghost.lua
@@ -58,6 +58,7 @@ else
Pos.x = Pos.x - (Pos.x%20)
Pos.y = Pos.y - (Pos.y%20)
Pos.z = Pos.z - (Pos.z%20)
+ Aim.yaw = Aim.yaw - (Aim.yaw%15)
end
for k,v in pairs(pl.GhostItem.Ghost) do