1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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_edit_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)
|