summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/autorun/town.lua6
-rw-r--r--lua/autorun/zone_huntingground.lua23
-rw-r--r--lua/autorun/zone_output.lua66
-rw-r--r--lua/autorun/zone_town.lua13
-rw-r--r--vim.s70
5 files changed, 149 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
diff --git a/vim.s b/vim.s
new file mode 100644
index 0000000..a3c4166
--- /dev/null
+++ b/vim.s
@@ -0,0 +1,70 @@
+let SessionLoad = 1
+let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
+let v:this_session=expand("<sfile>:p")
+silent only
+cd C:\Program\ Files\ (x86)\Steam\steamapps\common\GarrysMod\garrysmod\addons\artery_editor
+if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
+ let s:wipebuf = bufnr('%')
+endif
+set shortmess=aoO
+badd +0 lua\autorun\town.lua
+argglobal
+silent! argdel *
+edit lua\autorun\town.lua
+set splitbelow splitright
+wincmd _ | wincmd |
+vsplit
+1wincmd h
+wincmd w
+set nosplitbelow
+set nosplitright
+wincmd t
+set winminheight=1 winminwidth=1 winheight=1 winwidth=1
+exe 'vert 1resize ' . ((&columns * 31 + 56) / 112)
+exe 'vert 2resize ' . ((&columns * 80 + 56) / 112)
+argglobal
+enew
+file NERD_tree_1
+setlocal fdm=manual
+setlocal fde=0
+setlocal fmr={{{,}}}
+setlocal fdi=#
+setlocal fdl=0
+setlocal fml=1
+setlocal fdn=20
+setlocal nofen
+wincmd w
+argglobal
+setlocal fdm=manual
+setlocal fde=0
+setlocal fmr={{{,}}}
+setlocal fdi=#
+setlocal fdl=0
+setlocal fml=1
+setlocal fdn=20
+setlocal fen
+silent! normal! zE
+let s:l = 9 - ((8 * winheight(0) + 13) / 26)
+if s:l < 1 | let s:l = 1 | endif
+exe s:l
+normal! zt
+9
+normal! 0
+wincmd w
+2wincmd w
+exe 'vert 1resize ' . ((&columns * 31 + 56) / 112)
+exe 'vert 2resize ' . ((&columns * 80 + 56) / 112)
+tabnext 1
+if exists('s:wipebuf') && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
+ silent exe 'bwipe ' . s:wipebuf
+endif
+unlet! s:wipebuf
+set winheight=1 winwidth=20 winminheight=1 winminwidth=1 shortmess=filnxtToO
+let s:sx = expand("<sfile>:p:r")."x.vim"
+if file_readable(s:sx)
+ exe "source " . fnameescape(s:sx)
+endif
+let &so = s:so_save | let &siso = s:siso_save
+doautoall SessionLoadPost
+unlet SessionLoad
+" vim: set ft=vim :