From cda70b47f13623d086188f686c005a017ccc5b25 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 24 Aug 2017 18:08:43 -0400 Subject: Vairious updates --- lua/entities/info_edit_huntablespawn/init.lua | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lua/entities/info_edit_huntablespawn/init.lua (limited to 'lua/entities/info_edit_huntablespawn/init.lua') diff --git a/lua/entities/info_edit_huntablespawn/init.lua b/lua/entities/info_edit_huntablespawn/init.lua new file mode 100644 index 0000000..777355f --- /dev/null +++ b/lua/entities/info_edit_huntablespawn/init.lua @@ -0,0 +1,41 @@ +if engine.ActiveGamemode() ~= "sandbox" then return end + +--[[ + This entity gives townies things to do +]] +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include("shared.lua") + +function ENT:Initialize() + self:SetModel("models/props_junk/watermelon01.mdl") + self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics, + self:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics + self:SetSolid( SOLID_VPHYSICS ) -- Toolbox + --self:SetNoDraw(true) + --self:SetPos(self.Position) +end + +local function save_huntable_spawns() + local all = ents.FindByClass("info_huntablespawn") + local buf = [[local h = nrequire("sv_huntingspawner.lua") + +]] + local codetemplate = "h.CreateSpawnNode({Position = Vector(%d,%d,%d)})" + for k,v in pairs(all) do + local p = v:GetPos() + all[k] = string.format(codetemplate,p.x,p.y,p.z) + end + buf = buf .. table.concat(all,"\n") + local filepath = string.format("artery/maps/%s/huntable_nodes.txt",game.GetMap()) + print("Writeing file",filepath) + file.Write(filepath,buf) +end + +hook.Add("ShutDown","art_save_huntablespawns",function() + save_huntable_spawns() +end) +concommand.Add("artery_save_huntable_spawns",function(ply,cmd,args) + save_huntable_spawns() +end) -- cgit v1.2.3-70-g09d2