summaryrefslogtreecommitdiff
path: root/gamemode/structuresystem/loadstructures.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-06-20 15:33:39 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-06-20 15:33:39 -0400
commite879c365577b0cc51c48bace7cd5fb52cdc26eaa (patch)
tree822a52cf38efd6815f2b7483cf6369e68c3dab23 /gamemode/structuresystem/loadstructures.lua
parentf797cbe348dd52b51da4cd4812cfa291d1434095 (diff)
downloadgmstranded-e879c365577b0cc51c48bace7cd5fb52cdc26eaa.tar.gz
gmstranded-e879c365577b0cc51c48bace7cd5fb52cdc26eaa.tar.bz2
gmstranded-e879c365577b0cc51c48bace7cd5fb52cdc26eaa.zip
Re-syncing last updated copyHEADmaster
Diffstat (limited to 'gamemode/structuresystem/loadstructures.lua')
-rw-r--r--gamemode/structuresystem/loadstructures.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/gamemode/structuresystem/loadstructures.lua b/gamemode/structuresystem/loadstructures.lua
index 858d976..820f055 100644
--- a/gamemode/structuresystem/loadstructures.lua
+++ b/gamemode/structuresystem/loadstructures.lua
@@ -8,27 +8,29 @@ function registerStructure(tbl)
GMS.Structures[tbl.Name] = tbl
end
-concommand.Add("gms_spawnstructure",function(ply,cmd,args)
- if !ply:IsDeveloper() then return end
- assert(args[1] != "","Failed to find structure name")
- assert(GMS.Structures[args[1]] != nil, "Structure \"" .. args[1] .. "\" does not exist!")
+function SpawnStructure(structname, ply)
+ assert(structname != "","Failed to find structure name")
+ assert(GMS.Structures[structname] != nil, "Structure \"" .. structname .. "\" does not exist!")
local tr = ply:GetEyeTrace()
local e = ents.Create("gms_generic_structure")
- local tbl = GMS.Structures[args[1]]
+ local tbl = GMS.Structures[structname]
if tbl.uniquedata then
tbl = table.Copy(tbl)
GMS.UniqueStructures[e:EntIndex()] = tbl
end
for k,v in pairs(tbl) do
- print("Setting " .. k .. " to")
- print(v)
e[k] = v
end
e:Spawn()
e:SetPos(tr.HitPos)
SPropProtection.PlayerMakePropOwner( ply, e )
--e:SetNWString("Owner",ply:Nick())
+end
+
+concommand.Add("gms_spawnstructure",function(ply,cmd,args)
+ if !ply:IsDeveloper() then return end
+ SpawnStructure(args[1],ply)
end)