diff options
Diffstat (limited to 'lua/autorun')
| -rw-r--r-- | lua/autorun/town.lua | 6 | ||||
| -rw-r--r-- | lua/autorun/zone_huntingground.lua | 23 | ||||
| -rw-r--r-- | lua/autorun/zone_output.lua | 66 | ||||
| -rw-r--r-- | lua/autorun/zone_town.lua | 13 |
4 files changed, 79 insertions, 29 deletions
diff --git a/lua/autorun/town.lua b/lua/autorun/town.lua index 0d36f41..a6f6e87 100644 --- a/lua/autorun/town.lua +++ b/lua/autorun/town.lua @@ -88,6 +88,11 @@ local fakes = { e:SetPos(pos) e:Spawn() end + }, + ["core/inventory/inventory.lua"] = { + CreateInventory = function(name) + return {} + end } } fakes["core/npc/sv_npcsystem.lua"] = fakes["sv_npcsystem.lua"] @@ -149,4 +154,5 @@ concommand.Add("artery_loadtownies",function(ply,cmd,args) if not ply:IsAdmin() then return end loadtownies() end) + hook.Add("InitPostEntity","load_lua",loadtownies) diff --git a/lua/autorun/zone_huntingground.lua b/lua/autorun/zone_huntingground.lua index b2b76e0..23d9ab1 100644 --- a/lua/autorun/zone_huntingground.lua +++ b/lua/autorun/zone_huntingground.lua @@ -10,29 +10,6 @@ hook.Add("OnZoneCreated","artery_huntingground",function(zone,class,zoneID) end end) ---[[ -local monsters = { - --Skyrim - "npc_draugr_wight", - "npc_draugr", - "npc_draugr_deathlord", - "npc_draugr_overlord", - "npc_draugr_scourge", - "npc_draugr_wight", - "npc_draugr_restless", - "npc_scrib", - "npc_falmer", - "npc_falmer_gloomlurker", - "npc_falmer_nightprowler", - "npc_falmer_shadowmaster", - "npc_falmer_skulker", - "npc_mudcrab", - "npc_deathclaw", - --Fallout - "npc_tunneler", - "npc_tunneler_queen", -} -]] local monsters local function find_monsters() if monsters == nil then diff --git a/lua/autorun/zone_output.lua b/lua/autorun/zone_output.lua new file mode 100644 index 0000000..d887386 --- /dev/null +++ b/lua/autorun/zone_output.lua @@ -0,0 +1,66 @@ +--[[ + A hunting ground zone will occasionally spawn a monster near a player that will go attack the player +]] +zones.RegisterClass("artery_outpost",Color(0,255,0)) + +--Use this to set default properties. Only called on server. +hook.Add("OnZoneCreated","artery_outpost",function(zone,class,zoneID) + if class == "artery_artery_outpost" then + zone.datatbl = {} + end +end) + +-- 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. +hook.Add("ShowZoneOptions","artery_outpost",function(zone,class,DPanel,zoneID,DFrame) + if class == "artery_town" then + local w,h = 500, 400 + + local scroll = vgui.Create( "DScrollPanel",DPanel) + scroll:Dock(FILL) + + function synctbl() + net.Start("artery_outpost_settbl") + net.WriteFloat(zoneID) + net.WriteTable(zone.datatbl) + net.SendToServer() + end + + print("Displaying table, my table is") + PrintTable(zone.datatbl) + + local monsterlb = vgui.Create("DLabel",DPanel) + monsterlb:Dock(TOP) + monsterlb:SetText("Town name:") + monsterlb:SetDark(true) + monsterlb:SizeToContents() + local groundsname = vgui.Create("DTextEntry",DPanel) + groundsname:SetText(zone.datatbl.Name or "") + groundsname:Dock(TOP) + groundsname.OnEnter = function() + zone.datatbl.Name = groundsname:GetValue() + synctbl() + end + + return w, h -- Specify the width and height for the DPanel container. The frame will resize accordingly. + + end +end) + +if SERVER then + util.AddNetworkString("artery_town_settbl") + net.Receive("artery_town_settbl",function(len,ply) + print("Server change received!") + local id, new = net.ReadFloat(), net.ReadTable() + print("New table is:") + PrintTable(new) + if not ply:IsAdmin() then return end + local zone = zones.List[id] + zone.datatbl = new + if new.Name then + zone.Name = new.Name + end + zones.Sync() + end) +end diff --git a/lua/autorun/zone_town.lua b/lua/autorun/zone_town.lua index abfc65b..c2cf653 100644 --- a/lua/autorun/zone_town.lua +++ b/lua/autorun/zone_town.lua @@ -6,7 +6,7 @@ zones.RegisterClass("artery_town",Color(0,255,0)) --Use this to set default properties. Only called on server. hook.Add("OnZoneCreated","artery_town",function(zone,class,zoneID) if class == "artery_town" then - zone.npctbl = {} + zone.datatbl = {} end end) @@ -23,12 +23,12 @@ hook.Add("ShowZoneOptions","artery_town",function(zone,class,DPanel,zoneID,DFram function synctbl() net.Start("artery_town_settbl") net.WriteFloat(zoneID) - net.WriteTable(zone.npctbl) + net.WriteTable(zone.datatbl) net.SendToServer() end print("Displaying table, my table is") - PrintTable(zone.npctbl) + PrintTable(zone.datatbl) local monsterlb = vgui.Create("DLabel",DPanel) monsterlb:Dock(TOP) @@ -36,10 +36,10 @@ hook.Add("ShowZoneOptions","artery_town",function(zone,class,DPanel,zoneID,DFram monsterlb:SetDark(true) monsterlb:SizeToContents() local groundsname = vgui.Create("DTextEntry",DPanel) - groundsname:SetText(zone.npctbl.Name or "") + groundsname:SetText(zone.datatbl.Name or "") groundsname:Dock(TOP) groundsname.OnEnter = function() - zone.npctbl.Name = groundsname:GetValue() + zone.datatbl.Name = groundsname:GetValue() synctbl() end @@ -56,7 +56,8 @@ if SERVER then print("New table is:") PrintTable(new) if not ply:IsAdmin() then return end - zones.List[id].npctbl = new + local zone = zones.List[id] + zone.datatbl = new if new.Name then zone.Name = new.Name end |
