summaryrefslogtreecommitdiff
path: root/lua/autorun/zone_huntingground.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-08-17 18:07:25 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-08-17 18:07:25 -0400
commitebf3d362d51b6881f80c4dd05c976c6707427515 (patch)
tree7675788c28a87da5c1178c79240643967f99be82 /lua/autorun/zone_huntingground.lua
parent449ad69c3d672161f981ceb1d0ba71426f00c881 (diff)
downloadartery_editor-ebf3d362d51b6881f80c4dd05c976c6707427515.tar.gz
artery_editor-ebf3d362d51b6881f80c4dd05c976c6707427515.tar.bz2
artery_editor-ebf3d362d51b6881f80c4dd05c976c6707427515.zip
Fixed a glitch
Fixed a problem that errorerd when sents aren't loaded by the time zone_huntingground.lua runs
Diffstat (limited to 'lua/autorun/zone_huntingground.lua')
-rw-r--r--lua/autorun/zone_huntingground.lua27
1 files changed, 19 insertions, 8 deletions
diff --git a/lua/autorun/zone_huntingground.lua b/lua/autorun/zone_huntingground.lua
index cc494a1..b16efce 100644
--- a/lua/autorun/zone_huntingground.lua
+++ b/lua/autorun/zone_huntingground.lua
@@ -33,15 +33,19 @@ local monsters = {
"npc_tunneler_queen",
}
]]
-local monsters = scripted_ents.GetList()
-local sub = {}
-for k,v in pairs(monsters) do
- if k:find("npc_") then
- sub[#sub+1] = k
+local monsters
+local function find_monsters()
+ if monsters == nil then
+ monsters = scripted_ents.GetList()
+ local sub = {}
+ for k,v in pairs(monsters) do
+ if k:find("npc_") then
+ sub[#sub+1] = k
+ end
+ end
+ monsters = sub
end
end
-monsters = sub
-
-- Use this hook to let a player change a zone after making it or with the edit tool.
-- class is zone.class, zone is the zone's full table, DPanel is a panel to parent your things to, zoneID is the zone's ID, DFrame is the whole frame.
-- Return your preferred width and height for the panel and the frame will size to it.
@@ -73,7 +77,7 @@ hook.Add("ShowZoneOptions","artery_huntingground",function(zone,class,DPanel,zon
monsterlb:SizeToContents()
local freqlb = vgui.Create("DLabel",headerbar)
freqlb:Dock(RIGHT)
- freqlb:SetText("Spawn frequency (0-100)")
+ freqlb:SetText("Spawn frequency (0-100) : Health")
freqlb:SetDark(true)
freqlb:SizeToContents()
@@ -140,6 +144,12 @@ hook.Add("ShowZoneOptions","artery_huntingground",function(zone,class,DPanel,zon
zone.npctbl[name] = tonumber(frequency:GetValue())
synctbl()
end
+
+ local health = vgui.Create('DTextEntry',thisbar)
+ health:SetText(100)
+ health:SetNumeric(true)
+ health:Dock(RIGHT)
+ health:SizeToContents()
end
print("Before drawing npctbl was")
@@ -152,6 +162,7 @@ hook.Add("ShowZoneOptions","artery_huntingground",function(zone,class,DPanel,zon
newpanelbut:SetText("+")
newpanelbut:Dock(BOTTOM)
newpanelbut.DoClick = function()
+ if not monsters[1] then find_monsters() end
mkrow(monsters[1],0)
end