From daa59a7835c350a09dcb207c714acf57828137f3 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 7 Aug 2017 18:22:29 -0400 Subject: Inital Commit --- lua/entities/info_edit_townienode/init.lua | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 lua/entities/info_edit_townienode/init.lua (limited to 'lua/entities/info_edit_townienode/init.lua') diff --git a/lua/entities/info_edit_townienode/init.lua b/lua/entities/info_edit_townienode/init.lua new file mode 100644 index 0000000..e4702da --- /dev/null +++ b/lua/entities/info_edit_townienode/init.lua @@ -0,0 +1,54 @@ +if engine.ActiveGamemode() ~= "sandbox" then return end + +AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside +AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent. + +include('shared.lua') + +ENT.default_data = { + Model = "models/humans/Group02/Male_03.mdl", + NavNodes = {}, + Pos = nil +} + +ENT.edit_data = { + Size = HULL_TINY, + Type = "navnode", + Model = "models/editor/ground_node.mdl", + get_default_code = function(who) + local default_navnode = [[ + + + + +local node = { + ["Name"] = "%s", --@tagname + ["Position"] = Vector(%f, %f, %f), --@tagpos + ["OnReached"] = function(npc) + + end, + ["IsDone"] = function(npc) + + end, +} +nrequire("sv_npcsystem.lua").CreateNavNode(node) + ]] + local pos = who:GetPos() + local name = "Default Node" + return string.format(default_navnode,name,pos.x,pos.y,pos.z) + end +} +local init = ENT.Initalize +function ENT:Initalize() + print("In towniespawn's initalize") + init(self) +end + +function ENT:OnSave() + print("Node's OnSave was called") + local newtxt = file.Read(self.File,"DATA") + print("new text was",newtxt) + local newname = newtxt:match("%[\"Name\"%] = \"(.-)\", %-%-@tagname") + print("new name is,",newname) + self.Name = newname +end -- cgit v1.2.3-70-g09d2