summaryrefslogtreecommitdiff
path: root/lua/entities/info_edit_huntablespawn
diff options
context:
space:
mode:
Diffstat (limited to 'lua/entities/info_edit_huntablespawn')
-rw-r--r--lua/entities/info_edit_huntablespawn/cl_init.lua71
-rw-r--r--lua/entities/info_edit_huntablespawn/init.lua41
-rw-r--r--lua/entities/info_edit_huntablespawn/shared.lua13
3 files changed, 125 insertions, 0 deletions
diff --git a/lua/entities/info_edit_huntablespawn/cl_init.lua b/lua/entities/info_edit_huntablespawn/cl_init.lua
new file mode 100644
index 0000000..6a96b80
--- /dev/null
+++ b/lua/entities/info_edit_huntablespawn/cl_init.lua
@@ -0,0 +1,71 @@
+if engine.ActiveGamemode() ~= "sandbox" then return end
+
+include('shared.lua')
+
+ENT.RenderGroup = RENDERGROUP_BOTH
+
+/*---------------------------------------------------------
+ Name: Draw
+ Desc: Draw it!
+---------------------------------------------------------*/
+function ENT:Draw()
+ --self:DrawModel()
+ render.SetColorMaterial()
+ render.DrawSphere( self:GetPos(), 10, 30, 30, Color( 255, 0, 0, 100 ) )
+
+end
+
+/*---------------------------------------------------------
+ Name: DrawTranslucent
+ Desc: Draw translucent
+---------------------------------------------------------*/
+function ENT:DrawTranslucent()
+
+ // This is here just to make it backwards compatible.
+ // You shouldn't really be drawing your model here unless it's translucent
+
+ --self:Draw()
+
+end
+
+/*---------------------------------------------------------
+ Name: BuildBonePositions
+ Desc:
+---------------------------------------------------------*/
+function ENT:BuildBonePositions( NumBones, NumPhysBones )
+
+ // You can use this section to position the bones of
+ // any animated model using self:SetBonePosition( BoneNum, Pos, Angle )
+
+ // This will override any animation data and isn't meant as a
+ // replacement for animations. We're using this to position the limbs
+ // of ragdolls.
+
+end
+
+
+
+/*---------------------------------------------------------
+ Name: SetRagdollBones
+ Desc:
+---------------------------------------------------------*/
+function ENT:SetRagdollBones( bIn )
+
+ // If this is set to true then the engine will call
+ // DoRagdollBone (below) for each ragdoll bone.
+ // It will then automatically fill in the rest of the bones
+
+ self.m_bRagdollSetup = bIn
+
+end
+
+
+/*---------------------------------------------------------
+ Name: DoRagdollBone
+ Desc:
+---------------------------------------------------------*/
+function ENT:DoRagdollBone( PhysBoneNum, BoneNum )
+
+ // self:SetBonePosition( BoneNum, Pos, Angle )
+
+end
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)
diff --git a/lua/entities/info_edit_huntablespawn/shared.lua b/lua/entities/info_edit_huntablespawn/shared.lua
new file mode 100644
index 0000000..09c731f
--- /dev/null
+++ b/lua/entities/info_edit_huntablespawn/shared.lua
@@ -0,0 +1,13 @@
+if engine.ActiveGamemode() ~= "sandbox" then return end
+
+ENT.Type = "anim"
+ENT.Base = "base_entity"
+
+ENT.PrintName= "Huntable Spawn"
+ENT.Author= "Apickx"
+ENT.Contact= "cogarr.net"
+ENT.Purpose= "Set a point that npc's can spawn at"
+ENT.Instructions= "Put a few of these down out of sight"
+ENT.Spawnable = true
+ENT.AdminSpawnable = false
+ENT.Category = "Artery"