aboutsummaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/core/inventory/inventory.lua4
-rw-r--r--gamemode/core/inventory/item.lua5
-rw-r--r--gamemode/core/inventory/sv_invtracker.lua28
-rw-r--r--gamemode/core/pac/sv_pac.lua17
-rw-r--r--gamemode/itemsystem/armor/balaclava.lua81
-rw-r--r--gamemode/itemsystem/foodstuffs/ratmeat.lua47
-rw-r--r--gamemode/itemsystem/foodstuffs/watermelon.lua62
-rw-r--r--gamemode/itemsystem/item_common.lua75
-rw-r--r--gamemode/itemsystem/quest/rougebadge.lua39
-rw-r--r--gamemode/itemsystem/quest/rougebook.lua69
-rw-r--r--gamemode/itemsystem/quest/togglechip.lua25
-rw-r--r--gamemode/itemsystem/scrapgun.lua61
-rw-r--r--gamemode/itemsystem/utility/flashlight.lua89
-rw-r--r--gamemode/itemsystem/weapons/knuckledclaw.lua164
-rw-r--r--gamemode/itemsystem/weapons/rustyaxe.lua272
-rw-r--r--gamemode/itemsystem/weapons/scraphammer.lua203
-rw-r--r--gamemode/itemsystem/weapons/seratedknife.lua200
-rw-r--r--gamemode/itemsystem/weapons_common.lua71
-rw-r--r--gamemode/server/heatmap.lua139
-rw-r--r--gamemode/server/sv_config.lua22
-rw-r--r--gamemode/server/sv_mapchange.lua154
-rw-r--r--gamemode/server/sv_mapconfig.lua68
-rw-r--r--gamemode/server/sv_pac.lua9
-rw-r--r--gamemode/server/sv_systems.lua21
-rw-r--r--gamemode/server/systems/health.lua12
-rw-r--r--gamemode/shared/inventory.lua399
-rw-r--r--gamemode/shared/inventory_common.lua193
-rw-r--r--gamemode/shared/loaditems.lua61
-rw-r--r--gamemode/shared/loadnpcs.lua39
-rw-r--r--gamemode/shared/loadprayers.lua123
-rw-r--r--gamemode/shared/log.lua48
-rw-r--r--gamemode/shared/prayersystem/prayers/lesserevasion.lua66
-rw-r--r--gamemode/shared/prayersystem/prayers/ninelives.lua50
-rw-r--r--gamemode/shared/prayersystem/prayers/notdarkrp.lua77
-rw-r--r--gamemode/shared/prayersystem/prayers/preditorinstinct.lua68
-rw-r--r--gamemode/shared/prayersystem/prayers/thickskin.lua60
-rw-r--r--gamemode/shared/questsystem/examplequest.lua14
-rw-r--r--gamemode/shared/questsystem/subterr_generator.lua25
-rw-r--r--gamemode/shared/sh_setup.lua168
-rw-r--r--gamemode/shared/shop.lua175
40 files changed, 63 insertions, 3440 deletions
diff --git a/gamemode/core/inventory/inventory.lua b/gamemode/core/inventory/inventory.lua
index 5ff4c10..b96d168 100644
--- a/gamemode/core/inventory/inventory.lua
+++ b/gamemode/core/inventory/inventory.lua
@@ -46,6 +46,7 @@
]]
local inv = {}
+local log = nrequire("log.lua")
--Creates a partial copy of a table(tables are copied, functions are not)
local function TableCopy(tbl)
@@ -122,7 +123,7 @@ function inv.RegisterInventory(tbl)
--assert(inventories[tbl.Name] == nil,
-- string.format("Attempted to register 2 inventories with the same name: %q", tbl.Name))
if inventories[tbl.Name] ~= nil then
- MsgC(Color(255,255,0),"Registering 2 inventories with the same name:" .. tbl.Name)
+ log.warn(string.format("Registered 2 inventories with the same name %q, overwriteing",tbl.Name))
end
assert((tbl.AddObserver == nil and tbl.RemoveObserver == nil) or
(tbl.AddObserver ~= nil and tbl.RemoveObserver ~= nil),
@@ -131,6 +132,7 @@ function inv.RegisterInventory(tbl)
SetDefaultObservers(tbl)
end
inventories[tbl.Name] = tbl
+ log.info("Registered inventory: " .. tbl.Name)
--print("Registered inventory: " .. tbl.Name)
end
diff --git a/gamemode/core/inventory/item.lua b/gamemode/core/inventory/item.lua
index a598fc2..80e2a88 100644
--- a/gamemode/core/inventory/item.lua
+++ b/gamemode/core/inventory/item.lua
@@ -18,6 +18,7 @@
Items may also have methods from one or more interfaces registered with RegisterInterface
]]
+local log = nrequire("log.lua")
local itm = {}
local required_fields = {
"Name","Serialize","DeSerialize"
@@ -30,9 +31,9 @@ function itm.RegisterItem(tbl)
end
--assert(items[tbl.Name] == nil, string.format("Attempted to register 2 items with the same name %q",tbl.Name))
if items[tbl.Name] ~= nil then
- MsgC(Color(255,255,0),"WARNING: attemtpted to register 2 items with the same name " .. tbl.Name .. "\n")
+ log.warn(string.format("Attempted to register 2 items with the same name: %q, overwriteing previous",tbl.Name))
else
- MsgC(Color(0,255,0),"Registered Item " .. tbl.Name .. "\n")
+ log.info(string.format("Registered item %s",tbl.Name))
end
items[tbl.Name] = tbl
--print("Registered item: " .. tbl.Name)
diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua
index ab39e41..537d61d 100644
--- a/gamemode/core/inventory/sv_invtracker.lua
+++ b/gamemode/core/inventory/sv_invtracker.lua
@@ -4,6 +4,7 @@
local inv = nrequire("inventory/inventory.lua")
local itm = nrequire("item.lua")
+local log = nrequire("log.lua")
local track = {}
for k,v in pairs({
@@ -33,30 +34,23 @@ end)
topos ::table
]]
net.Receive("art_RequestInvMove",function(len,ply)
- print("ply",ply,"requested inv move")
--Read the data from the net message
local froment,toent = net.ReadEntity(),net.ReadEntity()
local frominvid,toinvid = net.ReadUInt(32),net.ReadUInt(32)
local frompos,topos = net.ReadTable(),net.ReadTable()
+ log.debug(string.format("ply %q requested inventory move from (%q,%d) to (%q,%d)",tostring(ply),tostring(froment),frominvid,tostring(toent),toinvid))
--Make sure the player is not stealing!
assert(not (froment:IsPlayer() and toent:IsPlayer() and froment ~= toent), "Tried to move item between players!")
- print("froment",froment)
- print("froment.data:",froment.data)
- print("froment.data.inventories",froment.data.inventories)
- PrintTable(froment.data.inventories)
- print("invid:",froment.data.inventories[frominvid])
+ --Make sure the entity from has that inventory
assert(froment.data ~= nil and froment.data.inventories ~= nil and froment.data.inventories[frominvid] ~= nil, "From entity did not have that inventory!")
- print("toent",toent)
- print("toent.data",toent.data)
- print("toent.data.inventories",toent.data.inventories)
- PrintTable(toent.data.inventories)
- print("toinvid",toinvid)
- print("toent.data.inventories[invid]",toent.data.inventories[toinvid])
+ --Make sure the entity to has that inventory
assert(toent.data ~= nil and toent.data.inventories ~= nil and toent.data.inventories[toinvid] ~= nil, "To entity did not have that inventory!")
local frominv = froment.data.inventories[frominvid]
local toinv = toent.data.inventories[toinvid]
local item = frominv:Get(frompos)
+ --Make sure the frominv has an item at that pos
assert(item ~= nil, "Could not find an item at that position!")
+ --Make sure it can fit in toinv
assert(toinv:CanFitIn(topos,item), "Could not fit the item in that position!")
--If we've gotten here without error, we're all good! Move the item!
frominv:Remove(frompos)
@@ -245,11 +239,11 @@ function track.SendPlayerData(ply)
net.Send(ply)
end
-concommand.Add("artery_SendMeData",function(ply,cmd,args)
- track.ClearInventories(ply)
- track.GiveInventoryTo(ply,"Equipment")
- track.SendPlayerData(ply)
-end)
+-- concommand.Add("artery_SendMeData",function(ply,cmd,args)
+-- track.ClearInventories(ply)
+-- track.GiveInventoryTo(ply,"Equipment")
+-- track.SendPlayerData(ply)
+-- end)
concommand.Add("artery_ShowMyInventories",function(ply,cmd,args)
PrintTable(ply.data.inventories)
diff --git a/gamemode/core/pac/sv_pac.lua b/gamemode/core/pac/sv_pac.lua
index e9492e9..229b258 100644
--- a/gamemode/core/pac/sv_pac.lua
+++ b/gamemode/core/pac/sv_pac.lua
@@ -26,7 +26,7 @@
"artery_requestpac",
"artery_downloadpac"
]]
-
+local log = nrequire("log.lua")
local p3 = {}
local nwstrings = {
@@ -45,9 +45,14 @@ end
hook.Add("PrePACConfigApply", "stoppacs", function(ply, outfit_data)
if not ply:IsAdmin() then
return false, "You don't have permission to do that!"
- end
+ end
end)
+hook.Add( "PrePACEditorOpen", "stoppaceditor", function( ply )
+ return ply:IsSuperAdmin(), "This is accessable only to superadmins"
+end )
+
+
local pacsources = {
["data/artery/pacs/"] = "GAME"
}
@@ -80,7 +85,7 @@ end)
local appliedpacs = {}
function p3.ApplyPac(what, name)
- print("Applying pac", name, "to",what)
+ log.debug(string.format("Applying pac %q to %q",name,tostring(what)))
assert(pachashes[name],string.format("Tried to apply pac %s which didn't have a hash. Pac hashes are:%s",name,table.ToString(pachashes,"pachashes",true)))
appliedpacs[what] = appliedpacs[what] or {}
appliedpacs[what][name] = pachashes[name]
@@ -96,7 +101,7 @@ function p3.ApplyPac(what, name)
end
function p3.RemovePac(what, name)
- print("Removeing pac",what,"from",name)
+ log.debug(string.format("Removeing pac %q from %q",name,tostring(what)))
assert(appliedpacs[what][name],"Attempted to remove a pac that an entity is not wearing!")
appliedpacs[what][name] = nil
if #appliedpacs[what] == 0 then
@@ -170,10 +175,10 @@ end
net.Receive("artery_requestpac",function(ln,ply)
local pac_name = net.ReadString()
-
+ log.debug(string.format("Player %q requested pac %q",tostring(ply),pac_name))
--Double check that we're not executing a directory traversal attack https://www.owasp.org/index.php/Path_Traversal
if string.find(pac_name,"..",1,true) then
- Report(string.format("Directory traversal attack attempted by %s:%s using artery_requestpac string %q",ply:Nick(),ply:SteamID64(),pac_name))
+ log.report(string.format("Directory traversal attack attempted by %s:%s using artery_requestpac string %q",ply:Nick(),ply:SteamID64(),pac_name))
end
local pac_txt = cacheload(pac_name)
diff --git a/gamemode/itemsystem/armor/balaclava.lua b/gamemode/itemsystem/armor/balaclava.lua
deleted file mode 100644
index dead873..0000000
--- a/gamemode/itemsystem/armor/balaclava.lua
+++ /dev/null
@@ -1,81 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Balaclava"
---
--- --Optional, a tooltip to display
--- item.Tooltip = "Something to cover your face"
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to Serialize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- options["drop"] = ART.DropItem(self)
--- return options
--- end
---
--- function item.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- function item.DoOnEquipPanel(dimagebutton)
--- print("called with panel:",panel)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
--- end
---
--- --[[
--- function item.Paint(self,width,height)
--- --print("painting with values",self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
---
--- function item.PaintEquiped(self,width,height)
--- --print("painting with values",self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
--- ]]
---
--- --Required, the shape of this item.
--- item.Shape = {
--- {true,true},
--- {true,true},
--- }
---
--- --Optional, If this item can be equiped in any player slots, put them here.
--- item.Equipable = "Head"
---
--- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
--- item.onEquip = function(self,who)
--- print("onEquip",who)
--- if CLIENT then print("onEquip client!") end
--- if SERVER then
--- PrintTable(pac)
--- ART.ApplyPAC(who,"balaclava")
--- end
--- end
---
--- --Optional, if we should do something speical on unequip(like setting animations back to normal)
--- item.onUnEquip = function(self,who)
--- ART.RemovePAC(who,"balaclava")
--- end
---
--- print("Hello from balaclava.lua")
--- --Don't forget to register the item!
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/foodstuffs/ratmeat.lua b/gamemode/itemsystem/foodstuffs/ratmeat.lua
deleted file mode 100644
index 12fc890..0000000
--- a/gamemode/itemsystem/foodstuffs/ratmeat.lua
+++ /dev/null
@@ -1,47 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Rat Meat"
---
--- --Optional, a tooltip to display when hovered over
--- item.Tooltip = "Disgusting, disease-ridden meat."
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- return options
--- end
---
--- --Optional. Something run once when this item is drawn in a backpack
--- function item.DoOnPanel(dimagebutton)
--- --dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- --Required, the shape of this item in a backpack.
--- item.Shape = {
--- {true}
--- }
---
--- item.onDropped = function(self, ent)
--- ART.ApplyPAC(ent,"ratmeat")
--- end
--- --Don't forget to register the item!
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/foodstuffs/watermelon.lua b/gamemode/itemsystem/foodstuffs/watermelon.lua
deleted file mode 100644
index 00828dc..0000000
--- a/gamemode/itemsystem/foodstuffs/watermelon.lua
+++ /dev/null
@@ -1,62 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
--- local pac
--- if SERVER then
--- pac = nrequire("core/pac/sv_pac.lua")
--- end
---
--- --Required, a name, all item names must be unique
--- item.Name = "Watermelon"
---
--- --Optional, a tooltip to display when hovered over
--- item.Tooltip = "Where do they grow these in an apocolyptic wasteland???"
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
--- if SERVER then
--- util.AddNetworkString("eat_watermelon")
--- net.Receive("eat_watermelon", function(len,ply)
--- local row,col,bp = ply:HasItem("Watermelon")
--- if row and col and bp then
--- ply:RemoveItemAt(bp,row,col)
--- end
--- end)
--- end
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- function item.GetOptions(self)
--- local options = {}
--- options["eat"] = function()
--- net.Start("eat_watermelon")
--- net.SendToServer()
--- end
--- return options
--- end
---
--- --Required, the shape of this item in a backpack.
--- item.Shape = {
--- {true,true,true},
--- {true,true,true},
--- {true,true,true},
--- }
---
--- item.onDropped = function(self, ent)
--- if SERVER then
--- pac.ApplyPac(ent,"Watermelon")
--- end
--- end
---
--- print("Hello from exampleitem.lua")
--- --Don't forget to register the item!
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/item_common.lua b/gamemode/itemsystem/item_common.lua
deleted file mode 100644
index acfc3e5..0000000
--- a/gamemode/itemsystem/item_common.lua
+++ /dev/null
@@ -1,75 +0,0 @@
-if CLIENT then
- ART.DropItem = function(item)
- print("Trying to drop item, Item was ")
- PrintTable(item)
- return function()
- local data = item:Serialize()
- net.Start("dropitem")
- net.WriteString(item.Name)
- net.WriteUInt(#data,32)
- net.WriteData(data,#data)
- net.SendToServer()
- end
- end
-
-else
- util.AddNetworkString("dropitem")
-
- function gencompareto(item)
- --Two items are equal if their Serialize()s are the same.
- local tserialize = item:Serialize()
- return function(otheritem)
- local oserialize = otheritem:Serialize()
- return tserialize == oserialize
- end
- end
-
- function ART.CreateDroppedItem(itemtbl, where)
- local e = ents.Create("art_droppeditem")
- e.Model = "models/props_junk/Rock001a.mdl"
- e.Item = itemtbl
- e:SetPos(where)
- e:Spawn()
- end
-
- net.Receive("dropitem",function(len,ply)
- local itemtype = net.ReadString()
- local itemdatalen = net.ReadUInt(32)
- local itemdata = net.ReadData(itemdatalen)
- local itemtbl = ART.GetItemByName(itemtype)
- local item = itemtbl:DeSerialize(itemdata)
-
- print("I want to drop:")
- PrintTable(item)
- print("Do I have one?")
- local row,col,n = ply:HasItem(gencompareto(item))
- print("row",row,"col",col,"n",n)
- --To find out where to drop the item, go out from player's view, then down.
- local pes = ply:GetPos() + Vector(0,0,64)
- local pee = ply:GetForward() * 50 + Vector(0,0,64) + ply:GetPos()
- local tr1d = {
- ["start"] = pes,
- ["endpos"] = pee,
- ["filter"] = ply,
- }
- local tr1r = util.TraceLine(tr1d)
- local fes
- if tr1r.hit then --Use where it hit and go down
- fes = tr1r.HitPos
- else --Use the spot 50 units in front of us
- fes = pee
- end
- local tr2d = {
- ["start"] = fes,
- ["endpos"] = fes + Vector(0,0,-64),
- }
- local tr2r = util.TraceLine(tr2d)
- local itempos = tr2r.HitPos
- print("Dropping item at",itempos)
- if row and col and n then
- print("DropItem is",ART.DropItem)
- ART.CreateDroppedItem(item,itempos)
- ply:RemoveItemAt(n,row,col)
- end
- end)
-end
diff --git a/gamemode/itemsystem/quest/rougebadge.lua b/gamemode/itemsystem/quest/rougebadge.lua
deleted file mode 100644
index 2b7d0a0..0000000
--- a/gamemode/itemsystem/quest/rougebadge.lua
+++ /dev/null
@@ -1,39 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Rouge Newbie Badge"
---
--- --Optional, a tooltip to display when hovered over
--- item.Tooltip = "A tiny peice of metal, kinda looks like a dagger."
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- return options
--- end
---
--- --Required, the shape of this item in a backpack.
--- item.Shape = {
--- {true}
--- }
---
---
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/quest/rougebook.lua b/gamemode/itemsystem/quest/rougebook.lua
deleted file mode 100644
index 302f919..0000000
--- a/gamemode/itemsystem/quest/rougebook.lua
+++ /dev/null
@@ -1,69 +0,0 @@
--- --[[
--- A quest item for the prayer book quest
--- ]]
--- do return end
--- local item = {}
---
--- item.Name = "Orders of the Silent Circle"
---
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- item.Shape = {
--- {true,true},
--- {true,true},
--- }
---
--- local rougeadvice = {
--- "He who refuses to trim his beard will find himself in a hairy situation.",
--- "You'll get tired defending from a man in a car",
--- "You'll get exhaused attacking a man in a car.",
--- "Sex is not the answer, it is the question. And the answer is 'yes'.",
--- "The 'Darkest Hour' is when you can't find the matches.",
--- "If you eat beans before church, you will sit in your own pew.",
--- "He who seeks challenges will be puzzeled.",
--- "He who fishes in another man's well is likely to catch crabs.",
--- "Enjoy masturbation, it's sex with someone you love.",
--- }
---
--- local lhint = 1
---
--- function item.GetOptions(self)
--- local options = {}
--- options["Read"] = function()
--- local readframe = vgui.Create( "DFrame" )
--- readframe:SetPos( ScrW()/2 - 100, ScrH()/2 - 100)
--- readframe:SetSize(200,200)
--- readframe:SetTitle("Orders of the Silent Circle")
--- readframe:MakePopup()
---
---
--- local readpanel = vgui.Create( "DPanel", readframe )
--- readpanel:SetPos( 5, 30 )
--- readpanel:SetSize( 190, 170 )
--- function readpanel:Paint(w,h) end
---
---
--- local readtext = vgui.Create( "DLabel", readpanel )
--- readtext:SetPos( 40, 40 )
--- readtext:SetText(rougeadvice[lhint])
--- readtext:SetDark()
--- readtext:Dock(FILL)
--- readtext:SetWrap(true)
--- lhint = (lhint % #rougeadvice) + 1
--- end
--- return options
--- end
---
--- item.onDropped = function(self, ent)
--- ART.ApplyPAC(ent,"book1")
--- end
---
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/quest/togglechip.lua b/gamemode/itemsystem/quest/togglechip.lua
deleted file mode 100644
index d6dae50..0000000
--- a/gamemode/itemsystem/quest/togglechip.lua
+++ /dev/null
@@ -1,25 +0,0 @@
--- --[[
--- A toggle chip (quest item) for subterr_generator quest
--- ]]
--- do return end
--- local item = {}
---
--- item.Name = "Toggle Chip"
---
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- item.Shape = {
--- {true,true},
--- {true,true},
--- }
---
--- print("Hello from togglechip.lua")
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/scrapgun.lua b/gamemode/itemsystem/scrapgun.lua
deleted file mode 100644
index 0f58e79..0000000
--- a/gamemode/itemsystem/scrapgun.lua
+++ /dev/null
@@ -1,61 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Scrap gun"
---
--- --Optional, a tooltip to display
--- item.Tooltip = "A gun made from bits of scrap"
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- return options
--- end
---
--- --Required, the shape of this item.
--- item.Shape = {
--- {true,true},
--- {true},
--- }
---
--- --Optional, If this item can be equiped in any player slots, put them here.
--- item.Equipable = "Left"
---
--- --Optional, what to do when the player clicks, and this item is in the slot in inventory
--- item.onClick = function(self,owner)
--- print("pew pew!")
--- end
---
--- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
--- item.onEquip = function(self,who)
--- print("onEquip",who)
--- if CLIENT then print("onEquip client!") end
--- if SERVER then
--- PrintTable(pac)
--- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
--- --who:AttachPACPart(outfit)
--- --print("onEquip server!")
--- end
--- end
---
--- print("Hello from scrapgun.lua")
--- --Don't forget to register the item!
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/utility/flashlight.lua b/gamemode/itemsystem/utility/flashlight.lua
deleted file mode 100644
index 35c6679..0000000
--- a/gamemode/itemsystem/utility/flashlight.lua
+++ /dev/null
@@ -1,89 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Flashlight"
---
--- --Optional, a tooltip to display when hovered over
--- item.Tooltip = "An old axe, probably good for fighting."
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- return options
--- end
---
--- --Optional. Something run once when this item is drawn in a backpack
--- function item.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- --Optional. Something run once when this item is drawn in an equiped slot
--- function item.DoOnEquipPanel(dimagebutton)
--- print("called with panel:",panel)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
--- end
---
--- --Optional. Called continuously, use if you need the item to display different stuff at different tiems in the backpack.
--- function item.Paint(self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
---
--- --Optional. Called continuously, use if you need the item to display different stuff at different tiems when equiped.
--- function item.PaintEquiped(self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
---
--- --Required, the shape of this item in a backpack.
--- item.Shape = {
--- {true,true},
--- }
---
--- --Optional, If this item can be equiped in any player slots, put them here.
--- item.Equipable = "Left"
---
--- --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right
--- local lastontime = {}
--- item.onClick = function(self,owner)
--- if CLIENT then return end
--- if lastontime[owner] then return end
--- lastontime[owner] = true
--- timer.Simple(5,function()
--- lastontime[owner] = nil
--- end)
--- owner:Flashlight( not owner:FlashlightIsOn() )
--- end
---
--- --Optional, if we should do something special on equip(like draw the PAC for this weapon). See ART.ApplyPAC in /gamemode/shared/sh_pac.lua
--- item.onEquip = function(self,who)
--- if CLIENT then return end
--- who:AllowFlashlight(true)
--- end
---
--- --Optional, if we should do something speical on unequip(like setting PAC back to normal). Sett ART.RemovePAC in /gamemode/shared/sh_pac.lua
--- item.onUnEquip = function(self,who)
--- if CLIENT then return end
--- who:Flashlight(false)
--- who:AllowFlashlight(false)
--- end
---
---
--- --Don't forget to register the item!
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons/knuckledclaw.lua b/gamemode/itemsystem/weapons/knuckledclaw.lua
deleted file mode 100644
index 1c2b8f6..0000000
--- a/gamemode/itemsystem/weapons/knuckledclaw.lua
+++ /dev/null
@@ -1,164 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Knuckled Claws"
---
--- --Optional, a tooltip to display
--- item.Tooltip = "Bits of scrap put togeather to resembel a hammer"
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- return options
--- end
---
--- function item.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- function item.DoOnEquipPanel(dimagebutton)
--- print("called with panel:",panel)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
--- end
---
--- --[[
--- function item.Paint(self,width,height)
--- --print("painting with values",self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
---
--- function item.PaintEquiped(self,width,height)
--- --print("painting with values",self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
--- ]]
---
--- --Required, the shape of this item.
--- item.Shape = {
--- {true,true},
--- }
---
--- --Optional, If this item can be equiped in any player slots, put them here.
--- item.Equipable = "Right"
---
---
---
--- --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right
--- item.lastSwing = {}
--- item.onClick = function(self,owner)
--- item.lastSwing[owner] = item.lastSwing[owner] or 0
--- if item.lastSwing[owner] > CurTime() then
--- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
--- return end
--- item.lastSwing[owner] = CurTime()+1.25
--- local fow,rig,up = owner:GetForward(),owner:GetRight(),owner:GetUp()
--- local movementtbl = {
--- ["forward"] = function()
--- owner:SetLuaAnimation("fist_swing_up")
--- timer.Simple(1.75,function()
--- owner:StopLuaAnimation("fist_swing_up")
--- end)
--- local hits = ART.swingarc(owner,{
--- 0.5,0.57,0.65,0.73
--- },{
--- fow*20 + up*90,
--- fow*45 + up*70,
--- fow*35 + up*45,
--- fow*20 + up*30,
--- },function(tr)
--- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
--- end
--- print("Hit",tr.Entity)
--- end)
--- end,
--- ["backward"] = function()
--- owner:SetLuaAnimation("fist_swing_down")
--- timer.Simple(1.75,function()
--- owner:StopLuaAnimation("fist_swing_down")
--- end)
--- local hits = ART.swingarc(owner,{
--- 0.5,0.57,0.65,0.73
--- },{
--- fow*15 + up*30,
--- fow*35 + up*45,
--- fow*25 + up*70,
--- fow*15 + up*90,
--- },function(tr)
--- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
--- end
--- print("Hit",tr.Entity)
--- end)
--- end,
--- ["left"] = function()
--- owner:SetLuaAnimation("fist_swing_left")
--- timer.Simple(2,function()
--- owner:StopLuaAnimation("fist_swing_left")
--- end)
--- local hits = ART.swingarc(owner,{
--- 0.5,0.57,0.65,0.73
--- },{
--- rig*-30 + up*59,
--- rig*-10 + fow*30 + up*55,
--- rig*10 + fow*30 + up*54,
--- rig*30 + up*50,
--- },function(tr)
--- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
--- end
--- print("Hit",tr.Entity)
--- end)
--- end,
--- ["right"] = function()
---
--- end,
--- }
--- movementtbl[ART.playermovedir(owner)]()
--- end
---
--- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
--- item.onEquip = function(self,who)
--- print("onEquip",who)
--- if CLIENT then print("onEquip client!") end
--- if SERVER then
--- PrintTable(pac)
--- who:GetActiveWeapon():SetHoldType("fist")
--- ART.ApplyPAC(who,"knuckledclaws")
--- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
--- --who:AttachPACPart(outfit)
--- --print("onEquip server!")
--- end
--- end
---
--- --Optional, if we should do something speical on unequip(like setting animations back to normal)
--- item.onUnEquip = function(self,who)
--- who:GetActiveWeapon():SetHoldType("normal")
--- ART.RemovePAC(who,"knuckledclaws")
--- end
---
--- item.onDropped = function(self, ent)
--- ART.ApplyPAC(ent,"knuckledclaws")
--- end
---
--- print("Hello from scrapgun.lua")
--- --Don't forget to register the item!
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons/rustyaxe.lua b/gamemode/itemsystem/weapons/rustyaxe.lua
deleted file mode 100644
index cd8004e..0000000
--- a/gamemode/itemsystem/weapons/rustyaxe.lua
+++ /dev/null
@@ -1,272 +0,0 @@
--- --[[
--- An axe that you can swing around!
--- ]]
--- do return end
--- local pac,swi
--- if SERVER then
--- pac = nrequire("core/pac/sv_pac.lua")
--- swi = nrequire("core/combat/sv_weaponswing.lua")
--- end
--- local reg = nrequire("core/inventory/item.lua")
--- local com = nrequire("core/inventory/common/weapons.lua")
--- local itm = nrequire("core/inventory/common/items.lua")
---
---
---
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Rusty Axe"
---
--- --Optional, a tooltip to display
--- item.Tooltip = "An old axe, probably good for fighting."
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- options["Drop"] = ART.DropItem(self)
--- return options
--- end
---
--- function item.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- function item.DoOnEquipPanel(dimagebutton)
--- print("called with panel:",panel)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
--- end
---
--- --Required, the shape of this item.
--- item.Shape = {
--- {true,true},
--- {true},
--- {true},
--- }
---
--- --Optional, If this item can be equiped in any player slots, put them here.
--- item.Equipable = "Right Hand"
---
--- item.attacks = {
--- ["forward"] = {
--- time = 2.33,
--- anim = "axe_swing_up",
--- },
--- ["left"] = {
--- time = 2.33,
--- anim = "axe_swing_left",
--- },
--- ["left"] = {
--- time = 2.33,
--- anim = "axe_swing_right",
--- },
--- }
---
--- --The path garrysmod/data/artery/pacs/<pacname>.txt must be a pac file
--- item.pacname = "rustyaxe"
---
--- if SERVER then
--- --Before makeSwingable is called, an item needs a .Name field and a .attacks field and a .pacname field
--- --swi.makeSwingable(item)
--- end
--- --[[
--- local swingdata = {
--- ["fwd"] = {
--- {0.011,Vector(-25,-3,-11)},
--- {0.020,Vector(-25,-1,-3)},
--- {0.031,Vector(-21,0,7)},
--- {0.040,Vector(-13,-1,16)},
--- {0.051,Vector(0,-5,22)},
--- {0.060,Vector(17,-12,19)},
--- {0.069,Vector(27,-18,11)},
--- {0.077,Vector(31,-22,2)},
--- {0.087,Vector(32,-26,-6)},
--- {0.098,Vector(32,-28,-12)},
--- {0.107,Vector(31,-29,-16)},
--- {0.117,Vector(31,-29,-17)},
--- {0.128,Vector(31,-29,-16)},
--- {0.141,Vector(31,-29,-16)},
--- },
--- ["lft"] = {
--- {0.009,Vector(-34,-25,3)},
--- {0.021,Vector(-29,-33,3)},
--- {0.031,Vector(-21,-41,2)},
--- {0.042,Vector(-9,-47,0)},
--- {0.053,Vector(5,-48,-2)},
--- {0.064,Vector(20,-44,-6)},
--- {0.075,Vector(31,-34,-10)},
--- {0.086,Vector(37,-24,-15)},
--- {0.095,Vector(39,-16,-17)},
--- {0.106,Vector(39,-10,-19)},
--- {0.116,Vector(39,-8,-20)},
--- {0.126,Vector(39,-8,-19)},
--- {0.134,Vector(39,-9,-19)},
--- {0.146,Vector(39,-10,-18)},
--- },
--- ["rig"] = {
--- {0.021,Vector(-2,9,11)},
--- {0.031,Vector(5,10,10)},
--- {0.042,Vector(12,8,9)},
--- {0.053,Vector(19,4,6)},
--- {0.062,Vector(26,-4,2)},
--- {0.072,Vector(29,-12,-4)},
--- {0.083,Vector(29,-21,-12)},
--- {0.093,Vector(25,-27,-18)},
--- {0.102,Vector(22,-30,-22)},
--- {0.113,Vector(20,-31,-25)},
--- {0.123,Vector(19,-32,-25)},
--- {0.133,Vector(19,-32,-25)},
--- },
--- }
---
--- local attacks = {
--- ["forward"] = {
--- time = 2.33,
--- anim = "axe_swing_up",
--- }
--- }
---
--- --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right
--- item.lastSwing = {}
--- item.onClick = function(self,owner)
--- item.lastSwing[owner] = item.lastSwing[owner] or 0
--- if item.lastSwing[owner] > CurTime() then
--- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
--- return end
--- item.lastSwing[owner] = CurTime() + 1.33
--- local movementtbl = {
--- ["forward"] = function()
--- --Do the animation
--- owner:SetLuaAnimation("axe_swing_up")
--- timer.Simple(2.33,function()
--- owner:StopLuaAnimation("axe_swing_up")
--- end)
--- --Do the traces
--- local times,pos = {},{}
--- for k,v in ipairs(swingdata["fwd"]) do
--- times[k] = 1 + v[1]
--- pos[k] = Vector(v[2])
--- pos[k]:Rotate(owner:GetAimVector():Angle())
--- end
--- --What to do when our weapon hits
--- com.swingarc(owner,times,pos,function(tr)
--- print("Calling the swingarc function")
--- if not tr.Hit then return end
--- print("We hit something!")
--- print("takedamage is",tr.Entity.TakeDamage)
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "forward" then
--- ART.ApplyEffect(owner,"weapon_blocked")
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- print("I hit a ", tr.Entity)
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end)
---
--- end,
--- ["backward"] = function()
---
--- end,
--- ["left"] = function()
--- owner:SetLuaAnimation("axe_swing_left")
--- timer.Simple(2.33,function()
--- owner:StopLuaAnimation("axe_swing_left")
--- end)
--- timer.Simple(1,function()
--- ART.TraceWeapon = true
--- end)
--- timer.Simple(1.33,function()
--- ART.TraceWeapon = false
--- end)
---
--- local times,pos = {},{}
--- for k,v in ipairs(swingdata["lft"]) do
--- times[k] = 1 + v[1]
--- pos[k] = Vector(v[2])
--- pos[k]:Rotate(owner:GetAimVector():Angle())
--- end
--- if pos[1] == nil then return end
--- com.swingarc(owner,times,pos,function(tr)
--- if not tr.Hit then return end
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "left" then
--- ART.ApplyEffect(owner,"weapon_blocked")
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end)
--- end,
--- ["right"] = function()
--- owner:SetLuaAnimation("axe_swing_right")
--- timer.Simple(2.33,function()
--- owner:StopLuaAnimation("axe_swing_right")
--- end)
--- timer.Simple(1,function()
--- ART.TraceWeapon = true
--- end)
--- timer.Simple(1.33,function()
--- ART.TraceWeapon = false
--- end)
---
--- local times,pos = {},{}
--- for k,v in ipairs(swingdata["rig"]) do
--- times[k] = 1 + v[1]
--- pos[k] = Vector(v[2])
--- pos[k]:Rotate(owner:GetAimVector():Angle())
--- end
--- if pos[1] == nil then return end
--- com.swingarc(owner,times,pos,function(tr)
--- if not tr.Hit then return end
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "right" then
--- ART.ApplyEffect(owner,"weapon_blocked")
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end)
--- end,
--- }
--- print("At time of doing playermovedir, com is", com)
--- movementtbl[com.playermovedir(owner)]()
--- end
--- ]]
---
---
--- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
--- item.onEquip = function(self,who)
--- print("onEquip",who)
--- if CLIENT then print("onEquip client!") end
--- if SERVER then
--- print("pac is", pac)
--- PrintTable(pac)
--- who:GetActiveWeapon():SetHoldType("melee")
--- pac.ApplyPac(who,"rustyaxe")
--- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
--- --who:AttachPACPart(outfit)
--- --print("onEquip server!")
--- end
--- end
---
--- --Optional, if we should do something speical on unequip(like setting animations back to normal)
--- item.onUnEquip = function(self,who)
--- print("Unequiping axe")
--- who:GetActiveWeapon():SetHoldType("normal")
--- if SERVER then pac.RemovePac(who,"rustyaxe") end
--- end
---
--- item.onDropped = function(self, ent)
--- if SERVER then pac.ApplyPac(ent,"rustyaxe") end
--- end
---
--- print("Hello from rustyaxe.lua")
--- --Don't forget to register the item!
--- reg.RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons/scraphammer.lua b/gamemode/itemsystem/weapons/scraphammer.lua
deleted file mode 100644
index f281799..0000000
--- a/gamemode/itemsystem/weapons/scraphammer.lua
+++ /dev/null
@@ -1,203 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local com = nrequire("core/inventory/common/weapons.lua")
--- local itm = nrequire("core/inventory/common/items.lua")
--- local reg = nrequire("core/inventory/item.lua")
--- local pac,eff
--- if SERVER then
--- pac = nrequire("core/pac/sv_pac.lua")
--- else
--- eff = nrequire("core/clienteffects/blocked.lua")
--- end
---
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Scrap Hammer"
---
--- --Optional, a tooltip to display
--- item.Tooltip = "Bits of scrap put togeather to resemble a hammer"
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toast"] = function() print("You pressed toast!") end
--- options["Drop"] = itm.DropItem(self)
--- return options
--- end
---
--- function item.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- function item.DoOnEquipPanel(dimagebutton)
--- print("called with panel:",panel)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
--- end
---
--- --Required, the shape of this item.
--- item.Shape = {
--- {true,true,true},
--- {false,true},
--- {false,true},
--- }
---
--- --Optional, If this item can be equiped in any player slots, put them here.
--- item.Equipable = "Right Hand"
---
--- local swingdata = {
--- ["fwd"] = {
--- {0.007,Vector(-27,1,9)},
--- {0.014,Vector(-20,3,16)},
--- {0.020,Vector(-11,6,22)},
--- {0.027,Vector(0,7,26)},
--- {0.032,Vector(15,7,25)},
--- {0.039,Vector(28,6,21)},
--- {0.045,Vector(38,4,14)},
--- {0.052,Vector(46,0,3)},
--- {0.059,Vector(50,-3,-6)},
--- {0.065,Vector(52,-6,-15)},
--- {0.072,Vector(52,-8,-22)},
--- {0.078,Vector(51,-10,-28)},
--- {0.084,Vector(50,-11,-31)},
--- {0.091,Vector(50,-11,-32)},
--- {0.097,Vector(50,-11,-32)}
--- },
--- ["lft"] = {
--- {0.007,Vector(-6,24,2)},
--- {0.014,Vector(-1,26,2)},
--- {0.020,Vector(5,28,1)},
--- {0.027,Vector(12,28,-1)},
--- {0.035,Vector(19,27,-4)},
--- {0.042,Vector(27,24,-7)},
--- {0.048,Vector(37,17,-13)},
--- {0.055,Vector(42,12,-17)},
--- {0.061,Vector(45,5,-20)},
--- {0.068,Vector(48,-2,-23)},
--- {0.075,Vector(49,-8,-25)},
--- {0.084,Vector(49,-14,-26)},
--- {0.091,Vector(49,-19,-27)},
--- {0.097,Vector(48,-22,-27)},
--- {0.104,Vector(48,-25,-27)},
--- {0.110,Vector(48,-26,-27)},
--- {0.117,Vector(48,-27,-27)},
--- {0.123,Vector(48,-26,-27)},
--- {0.131,Vector(48,-26,-27)}
--- },
--- ["rig"] = {
--- {0.009,Vector(-3,25,2)},
--- {0.017,Vector(3,27,1)},
--- {0.025,Vector(11,28,-1)},
--- {0.032,Vector(20,27,-4)},
--- {0.040,Vector(28,24,-7)},
--- {0.051,Vector(36,19,-12)},
--- {0.059,Vector(42,11,-17)},
--- {0.067,Vector(47,2,-22)},
--- {0.075,Vector(49,-5,-25)},
--- {0.083,Vector(49,-13,-27)},
--- {0.090,Vector(49,-19,-28)},
--- {0.098,Vector(48,-24,-28)},
--- {0.106,Vector(48,-27,-28)},
--- {0.114,Vector(48,-28,-28)},
--- {0.121,Vector(48,-27,-28)},
--- {0.129,Vector(48,-27,-27)}
--- },
--- }
---
--- local attacks = {
--- forward = {
--- anim = "hammer_swing_up",
--- animtime = 2.33,
--- data = swingdata["fwd"],
--- dammage = 5
--- },
--- left = {
--- anim = "hammer_swing_left",
--- animtime = 2.33,
--- data = swingdata["lft"],
--- dammage = 5
--- },
--- right = {
--- anim = "hammer_swing_right",
--- animtime = 2.33,
--- data = swingdata["rig"],
--- dammage = 5
--- }
--- }
---
--- --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right
--- item.lastSwing = {}
--- item.onClick = function(self,owner)
--- --Make sure we can swing (off cooldown)
--- item.lastSwing[owner] = item.lastSwing[owner] or 0
--- if item.lastSwing[owner] > CurTime() then return end
--- item.lastSwing[owner] = CurTime()+1.33
---
--- --[[
--- local movementtbl = {}
--- for k,v in pairs(attacks) do
--- movementtbl[k] = function()
--- owner:SetLuaAnimation(v.anim)
--- timer.Simple(v.animtime,function()
--- owner:StopLuaAnimation(v.anim)
--- end)
--- local times, pos = {},{}
--- for i,j in pairs(v.data) do
--- times[i] = 1 + j[1]
--- pos[i] = Vector(j[2])
--- pos[i]:Rotate(owner:GetAimVector():Angle())
--- end
--- if pos[1] == nil then return end
--- com.swingarc(owner,times,pos,function(tr)
--- if not tr.Hit then return end
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == k then
--- eff()
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- tr.Entity:TakeDamage(v.dammage,owner,owner:GetActiveWeapon())
--- end
--- end)
--- end
--- end
--- ]]
--- local movementtbl = com.createattackstable(attacks)
---
--- --Do the attack
--- movementtbl[com.playermovedir(owner)]()
--- end
---
--- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
--- item.onEquip = function(self,who)
--- print("woo! i'm being used!")
--- if SERVER then
--- who:GetActiveWeapon():SetHoldType("melee2")
--- pac.ApplyPac(who,"scraphammer")
--- end
--- end
---
--- --Optional, if we should do something speical on unequip(like setting animations back to normal)
--- item.onUnEquip = function(self,who)
--- print("aw, I'm being put away :(")
--- who:GetActiveWeapon():SetHoldType("normal")
--- pac.RemovePac(who,"scraphammer")
--- end
---
--- item.onDropped = function(self, ent)
--- pac.ApplyPac(ent,"scraphammer")
--- end
---
--- print("Hello from scraphammer.lua")
--- --Don't forget to register the item!
--- reg.RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons/seratedknife.lua b/gamemode/itemsystem/weapons/seratedknife.lua
deleted file mode 100644
index b2e353c..0000000
--- a/gamemode/itemsystem/weapons/seratedknife.lua
+++ /dev/null
@@ -1,200 +0,0 @@
--- --[[
--- An example item
--- ]]
--- do return end
--- local item = {}
---
--- --Required, a name, all item names must be unique
--- item.Name = "Serated Knife"
---
--- --Optional, a tooltip to display
--- item.Tooltip = "Bits of scrap put togeather to resembel a hammer"
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- item.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- item.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
--- function item.GetOptions(self)
--- local options = {}
--- options["test"] = function() print("You pressed test!") end
--- options["toste"] = function() print("You pressed toste!") end
--- options["Drop"] = ART.DropItem(self)
--- return options
--- end
---
--- function item.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- function item.DoOnEquipPanel(dimagebutton)
--- print("called with panel:",panel)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
--- end
---
--- --[[
--- function item.Paint(self,width,height)
--- --print("painting with values",self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
---
--- function item.PaintEquiped(self,width,height)
--- --print("painting with values",self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
--- ]]
---
--- --Required, the shape of this item.
--- item.Shape = {
--- {true,true},
--- }
---
--- --Optional, If this item can be equiped in any player slots, put them here.
--- item.Equipable = "Right"
---
--- local function attacktrace(tr,owner)
--- if not tr.Hit then return end
--- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end
---
---
--- --Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right
--- item.lastSwing = {}
--- local animationtime = 1.833333
--- item.onClick = function(self,owner)
--- item.lastSwing[owner] = item.lastSwing[owner] or 0
--- if item.lastSwing[owner] > CurTime() then
--- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
--- return end
--- item.lastSwing[owner] = CurTime()+animationtime
--- local fow,rig,up = owner:GetForward(),owner:GetRight(),owner:GetUp()
--- local movementtbl = {
--- ["forward"] = function()
--- owner:SetLuaAnimation("knife_swing_up")
--- timer.Simple(animationtime,function()
--- owner:StopLuaAnimation("knife_swing_up")
--- end)
--- local hits = ART.swingarc(owner,{
--- 0.5,0.611,0.722,0.833
--- },{
--- fow*20 + up*90,
--- fow*45 + up*70,
--- fow*35 + up*45,
--- fow*20 + up*30,
--- },function(tr)
--- if not tr.Hit then return end
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "forward" then
--- print("Entity blocked!")
--- ART.ApplyEffect(owner,"weapon_blocked")
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- print("Got past blocking, it was",tr.Entity.Blocking)
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end)
--- end,
--- ["backward"] = function()
--- owner:SetLuaAnimation("knife_swing_down")
--- timer.Simple(animationtime,function()
--- owner:StopLuaAnimation("knife_swing_down")
--- end)
--- local hits = ART.swingarc(owner,{
--- 0.5,0.611,0.722,0.833
--- },{
--- fow*15 + up*30,
--- fow*35 + up*45,
--- fow*25 + up*70,
--- fow*15 + up*90,
--- },function(tr)
--- if not tr.Hit then return end
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "backward" then
--- print("Entity blocked!")
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- print("Got past blocking, it was",tr.Entity.Blocking)
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end)
--- end,
--- ["left"] = function()
--- owner:SetLuaAnimation("knife_swing_left")
--- timer.Simple(animationtime,function()
--- owner:StopLuaAnimation("knife_swing_left")
--- end)
--- local hits = ART.swingarc(owner,{
--- 0.5,0.611,0.722,0.833
--- },{
--- rig*30 + up*59,
--- rig*10 + fow*30 + up*55,
--- rig*-10 + fow*30 + up*54,
--- rig*-30 + up*50,
--- },function(tr)
--- if not tr.Hit then return end
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "left" then
--- print("Entity blocked!")
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- print("Got past blocking, it was",tr.Entity.Blocking)
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end)
--- end,
--- ["right"] = function()
--- owner:SetLuaAnimation("knife_swing_right")
--- timer.Simple(animationtime,function()
--- owner:StopLuaAnimation("knife_swing_right")
--- end)
--- local hits = ART.swingarc(owner,{
--- 0.5,0.611,0.722,0.833
--- },{
--- rig*-30 + up*59,
--- rig*-10 + fow*30 + up*55,
--- rig*10 + fow*30 + up*54,
--- rig*30 + up*50,
--- },function(tr)
--- if not tr.Hit then return end
--- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "right" then
--- print("Entity blocked!")
--- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
--- print("Got past blocking, it was",tr.Entity.Blocking)
--- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
--- end
--- end)
--- end,
--- }
--- movementtbl[ART.playermovedir(owner)]()
--- end
---
--- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
--- item.onEquip = function(self,who)
--- print("onEquip",who)
--- if CLIENT then print("onEquip client!") end
--- if SERVER then
--- PrintTable(pac)
--- who:GetActiveWeapon():SetHoldType("knife")
--- ART.ApplyPAC(who,"seratedknife")
--- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
--- --who:AttachPACPart(outfit)
--- --print("onEquip server!")
--- end
--- end
---
--- --Optional, if we should do something speical on unequip(like setting animations back to normal)
--- item.onUnEquip = function(self,who)
--- who:GetActiveWeapon():SetHoldType("normal")
--- ART.RemovePAC(who,"seratedknife")
--- end
---
--- item.onDropped = function(self, ent)
--- ART.ApplyPAC(ent,"seratedknife")
--- end
---
--- --Don't forget to register the item!
--- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons_common.lua b/gamemode/itemsystem/weapons_common.lua
deleted file mode 100644
index 3c3e6ca..0000000
--- a/gamemode/itemsystem/weapons_common.lua
+++ /dev/null
@@ -1,71 +0,0 @@
--- --This file has been moved to core/inventory/common/weapons.lua
--- do return end
--- ART = ART or {}
---
--- --- Finds the direction a player is moveing.
--- -- @param player The player to find the move direction of
--- -- @return The string "forward", "backward", "right", or "left"
--- function ART.playermovedir(player)
--- local vel = player:GetVelocity():GetNormalized()
--- vel.z = 0
--- local swings = {
--- {player:GetForward(),"forward"},
--- {-player:GetForward(),"backward"},
--- {player:GetRight(),"right"},
--- {-player:GetRight(),"left"}
--- }
--- table.sort(swings,function(a,b)
--- return vel:Dot(a[1]) > vel:Dot(b[1])
--- end)
--- return swings[1][2]
--- end
---
---
--- local positionset = {}
--- --- The arc swing of a weapon.
--- -- Finds anything that a weapon should hit in it's swing, and calls a function on it.
--- -- @param player The player that's swinging the weapon
--- -- @param tiems A table of times that the trace calculations should be done at, this table needs to be the same length as the positions table
--- -- @param positions The position offsets from the player that swung that should be the start/end points of the arc
--- -- @param onhit A function to call on any entities that were hit in the swing of the weapon.
--- function ART.swingarc(player,times,positions,onhit)
--- local positionpoints = {}
--- table.insert(positionset,positionpoints)
--- for k,v in ipairs(times) do
--- timer.Simple(v,function()
--- ART.TraceWeapon = true
--- ART.TraceStart = CurTime()
--- print("positions[k]",positions[k],"playerpos",player:GetPos(),"add",Vector(0,0,64))
--- local weaponpos = positions[k] + player:GetPos() + Vector(0,0,64)
--- table.insert(positionpoints,weaponpos)
--- if #positionpoints > 1 then
--- --print("Trace from ", positionpoints[#positionpoints-1], " to ", positionpoints[#positionpoints])
--- local tr = util.TraceLine({
--- start = positionpoints[#positionpoints-1],
--- endpos = positionpoints[#positionpoints],
--- })
--- onhit(tr)
--- end
--- end)
--- end
--- timer.Simple(times[#times],function()
--- print("Inserted swing, drawn positions are now:")
--- PrintTable(positionset)
--- ART.TraceWeapon = false
--- end)
--- end
---
--- hook.Add( "HUDPaint", "weaponswings", function()
--- cam.Start3D() -- Start the 3D function so we can draw onto the screen.
--- for k,v in pairs(positionset) do
--- for i = 1,#v-1 do
--- render.DrawLine( v[i], v[i+1], Color(255,0,0,255), false )
--- render.DrawLine( v[i], v[i]+Vector(0,0,20),Color(0,255,0,255),false)
--- end
--- end
--- --render.SetMaterial( material ) -- Tell render what material we want, in this case the flash from the gravgun
--- --render.DrawSprite( pos, 16, 16, white ) -- Draw the sprite in the middle of the map, at 16x16 in it's original colour with full alpha.
--- cam.End3D()
--- end )
---
--- return wcommon
diff --git a/gamemode/server/heatmap.lua b/gamemode/server/heatmap.lua
deleted file mode 100644
index 1e95590..0000000
--- a/gamemode/server/heatmap.lua
+++ /dev/null
@@ -1,139 +0,0 @@
---[[
- Some helper methods for useing heatmaps
-]]
-do return end
-print("Hello from heatmap.lua!")
-local prs = pairs
-local tblins,tbldel = table.insert, table.remove
-local pow,sqrt,max = math.pow, math.sqrt, math.max
-
-heatmap = {}
-
--- local function VectorDistance(vec1,vec2)
--- if vec1.Distance then return vec1:Distance(vec2)
--- else
--- local dist = 0
--- for k,v in prs(vec1) do
--- local add = pow(vec1[k]-vec2[k],2)
--- dist = dist + add
--- end
--- dist = sqrt(dist)
--- return dist
--- end
--- end
-
-local function VectorLength(vec)
- if vec.Length then return vec:Length()
- else
- local len = 0
- for k,v in prs do
- local add = pow(v,2)
- len = len + add
- end
- len = sqrt(len)
- return len
- end
-end
-
-
-local function RegisterEffect(self, func, position)
- local stbl = {position,func}
- tblins(self.heatpoints,#self.heatpoints + 1,stbl)
-end
-
-local function CalculateFor(self, position)
- local sh = self.heatpoints[1]
- local total = sh[2](sh[1]-position,self.curtime)
- for k = 2,#self.heatpoints do
- sh = self.heatpoints[k]
- total, shouldremove = total + sh[2](sh[1]-position,self.curtime)
- if shouldremove then tbldel(k) end
- end
- return total
-end
-
---- Creates a heat map to keep track of effects.
--- Effects must be structured as a function that takes a vector (position from origin of effect) and number(time) and returns a value
--- @return a heatmap object
-function heatmap.CreateHeatMap()
- local tbl = {}
- tbl.heatpoints = {}
- tbl.curtime = 0
- tbl.RegisterEffect = RegisterEffect
- tbl.CalculateFor = CalculateFor
- return tbl
-end
-
-function heatmap.UniformInfiniteForever(field)
- return function(vector, time)
- return field, false
- end
-end
-
-function heatmap.UniformInfiniteLinearDecay(field,decayrate)
- return function(vector,time)
- return heatmap.UniformInfiniteForever(field) - (time * decayrate), false
- end
-end
-
-function heatmap.UniformInfiniteLinearDecayGrounded(field,decayrate)
- local removetime = field / decayrate
- return function(vector,time)
- return max(heatmap.UniformInfiniteLinearDecay(field,decayrate),0), time < removetime
- end
-end
-
-function heatmap.LinearInfiniteForever(field)
- return function(vector, time)
- return field - VectorLength(vector), false
- end
-end
-
-function heatmap.LinearInfiniteForeverGrounded(field)
- return function(vector,time)
- return max(heatmap.LinearInfiniteForever(field),0), false
- end
-end
-
-function heatmap.LinearInfiniteLinearDecay(field,decayrate)
- return function(vector, time)
- return field - VectorLength(vector) - (time * decayrate), false
- end
-end
-
-function heatmap.LinearInfiniteLinearDecayGrounded(field,decayrate)
- local removetime = field / decayrate
- return function(vector, time)
- return max(field-VectorLength(vector) - (time * decayrate),0), time < removetime
- end
-end
-
-function heatmap.ParabolicInfiniteForever(field, power)
- return function(vector, time)
- return field - pow(VectorLength(vector),power) / pow(100,power), false
- end
-end
-
-function heatmap.ParabolicInfiniteForeverGrounded(field, power)
- return function(vector, time)
- local pre = heatmap.ParabolicInfiniteForever(field, power)
- --print("pre is:")
- --print(pre)
- return max(pre,0), false
- end
-end
-
-function heatmap.ParabolicInfiniteLinearDecay(field,power,decayrate)
- return function(vector, time)
- return heatmap.ParabolicInfiniteForever(field, power) - (time * decayrate), false
- end
-end
-
-function heatmap.ParabolicInfiniteLinearDecayGrounded(field,power,decayrate)
- local removetime = field / decayrate
- return function(vector,time)
- return max(heatmap.ParabolicInfiniteLinearDecay(field,power,decayrate),0), time < removetime
- end
-end
-
-return heatmap
diff --git a/gamemode/server/sv_config.lua b/gamemode/server/sv_config.lua
deleted file mode 100644
index 8ce6e6c..0000000
--- a/gamemode/server/sv_config.lua
+++ /dev/null
@@ -1,22 +0,0 @@
---[[
- Some things that I might want to configure
-]]
-do return end
--- ART.defaults = {}
--- ART.defaults.starting_inventory = '{"Backpacks":[[[[false,false,false,false,false],[false,false,false,false,false],[false,false,false,false,false],[false,false,false,false,false],[false,false,false,false,false]],[5,5],"Rucksack"]],"Credits":0,"Equiped":{"Gloves":false,"Left":false,"Boots":false,"Legs":false,"Right":false,"Body":false,"Head":false},"Prayers":{"Noob Help":true}}'
--- ART.defaults.starting_skills = "[]"
--- ART.defaults.starting_quests = "[]"
--- ART.defaults.starting_prayers = "[]" --This dosen't actually do anything, remove it at some point.
---
--- ART.defaults.starting_position = "185 310 524"
--- ART.defaults.starting_world = "0.0.0.0:27015"
--- ART.config = {}
--- ART.config.server_world = game.GetIPAddress()
---
--- local mysqlconfig = file.Read("artery/mysql.txt")
--- for _,line in pairs(string.Explode("\n",mysqlconfig,false)) do
--- --print(line)
--- local key, value = unpack(string.Explode("=",line,false))
--- --print("setting",key,"to",value)
--- ART.config[key] = value
--- end
diff --git a/gamemode/server/sv_mapchange.lua b/gamemode/server/sv_mapchange.lua
deleted file mode 100644
index 895b086..0000000
--- a/gamemode/server/sv_mapchange.lua
+++ /dev/null
@@ -1,154 +0,0 @@
---[[
- A script to move the player to a different map
-]]
-do return end
--- local fn = nrequire("utility/fn.lua")
--- local q = nrequire("core/database/queries.lua")
--- nrequire("sv_mysqlite.lua")
--- local mapname = game.GetMap()
--- local mapareasstr = file.Read("artery/maps/" .. mapname .. "/mapareas.txt")
-
---[=[
-local dontupdatedisconnect = {}
-
-hook.Add("InitPostEntity", "LoadMapChangePoints", function()
- local transfers = string.Explode("\r?\n\r?\n",mapareasstr,true)
- for k,v in pairs(transfers) do
- local parts = string.Explode("\r?\n",v,true)
- local vectortxt = string.Explode(" ",parts[1],false)
- local svec = Vector(vectortxt[1],vectortxt[2],vectortxt[3])
- local name = parts[2]
- local server = parts[3]
- local model = parts[4]
- local tvt = string.Explode(" ",parts[5],false)
-
- local sch = ents.Create("art_serverchanger")
- sch.Model = model
- sch.Pos = svec
- sch.OnHit = function(self, coldata,collider)
- print("Coldata")
- PrintTable(coldata)
- print("collider",collider)
- if coldata.HitEntity:IsPlayer() then
- dontupdatedisconnect[coldata.HitEntity] = true
- local qc = table.concat({[[
- UPDATE playerdata SET MetaData="]],
- tvt[1]," ",
- tvt[2]," ",
- tvt[3]," ",
- [[" WHERE SteamID="]],
- coldata.HitEntity:SteamID64(),
- '"'})
- local query = [[
- UPDATE playerdata SET PlayerData='%s',MetaData='%s' WHERE SteamID=%.0f
- ]]
- local pdat = util.TableToJSON(coldata.HitEntity.data)
- local pmet = util.TableToJSON({
- lastserver = server,
- lastlocation = parts[5]
- })
- print("pdat is", pdat)
- print("pmet is", pmet)
- local fquery = q.s_fmt(query,pdat,pmet,coldata.HitEntity:SteamID64())
- print("fquery was", fquery)
- print("Running query:",qc)
- MySQLite.query(fquery,function(data)
- coldata.HitEntity:ConCommand("connect " .. server)
- end,function(err,sql)
- print("Query error:")
- print("Query",sql)
- print("Error",err)
- end)
- end
- end
- sch:Spawn()
- print("Loading mapchange area",svec)
- end
-end)
-]=]
-
--- local function SavePlayerData(ply)
--- local query
--- local pdat = q.serialize_player(ply)
--- if dontupdatedisconnect[ply] then
--- dontupdatedisconnect[ply] = nil
--- query = [[
--- UPDATE playerdata SET PlayerData='%s' WHERE SteamID=%.0f
--- ]]
--- query = q.s_fmt(query,pdat,ply:SteamID64())
--- else
--- query = [[
--- UPDATE playerdata SET PlayerData='%s' MetaData='%s' WHERE SteamID=%.0f
--- ]]
--- local pmet = util.TableToJSON({
--- lastserver = game.GetIPAddress(),
--- lastlocation = ply:GetPos()
--- })
--- query = q.s_fmt(query,pdat,pmet,ply:SteamID64())
--- end
--- MySQLite.query(query,function(data)
---
--- end,function(err,sql)
--- print("Query error:")
--- print("Query",sql)
--- print("Error",err)
--- end)
--- end
-
---[=[
-hook.Add("PlayerDisconnected","SavePlayerData",function(ply)
- local qc
- if dontupdatedisconnect[ply] then
- dontupdatedisconnect[ply] = nil
- qc = table.concat({
- [[UPDATE artery.playerdata SET
- Inventory="]],
- util.TableToJSON(ply.Inventory),
- [[",
- Skills="]],
- util.TableToJSON(ply.Skills),
- [[",
- Quests="]],
- util.TableToJSON(ply.Quests),
- [["
- WHERE SteamID = "]],
- ply:SteamID64(),
- [[";]]
- })
- else
- local pp = ply:GetPos()
- qc = table.concat({
- [[UPDATE artery.playerdata SET
- Inventory="]],
- util.TableToJSON(ply.Inventory),
- [[",
- Skills="]],
- util.TableToJSON(ply.Skills),
- [[",
- Quests="]],
- util.TableToJSON(ply.Quests),
- [[",
- WorldPosition="]],
- pp[1]," ",pp[2]," ",pp[3],
- [[",
- World="]],
- game.GetIPAddress(),
- [["
- WHERE SteamID = "]],
- ply:SteamID64(),
- [[";]]
- })
- end
- local q = ART.database:query(qc)
- function q:onSuccess(data)
- print("Saveing player data successful")
- PrintTable(data)
- end
- function q:onError(err, sql)
- print("Saveing player data errored!")
- print("Query",sql)
- error(err)
- end
- q:start()
-end)
-]=]
diff --git a/gamemode/server/sv_mapconfig.lua b/gamemode/server/sv_mapconfig.lua
deleted file mode 100644
index d697ea9..0000000
--- a/gamemode/server/sv_mapconfig.lua
+++ /dev/null
@@ -1,68 +0,0 @@
--- --Loads map config form a file
--- do return end
--- function ART.CreateTownie(tbl)
--- local npcent = ents.Create("npc_townie")
--- for k,v in pairs(tbl) do
--- npcent[k] = v
--- end
--- npcent:Spawn()
--- end
---
--- function ART.CreateNavNode(tbl)
--- local nodeent = ents.Create("info_townienode")
--- assert(tbl ~= nil, "Tried to create a nil navnode")
--- for k,v in pairs(tbl) do
--- nodeent[k] = v
--- end
--- nodeent:Spawn()
--- end
---
--- local removeents = {
--- "npc_townie",
--- -- "art_chest",
--- "info_townienode",
--- "npc_shop",
--- }
---
--- for k,v in pairs(removeents) do
--- local eot = ents.FindByClass(v)
--- for i,j in pairs(eot) do
--- j:Remove()
--- end
--- end
---
--- local mapfields = {
--- "navnodes",
--- "npcs",
--- -- "chests",
--- }
---
--- local function loadMap()
--- for k,v in ipairs(mapfields) do
--- local mapname = game.GetMap()
--- local fpath = string.format("artery/maps/%s/%s/*", mapname, v)
--- local files,dirs = file.Find(fpath,"DATA")
--- for i,j in pairs(files) do
--- if string.GetExtensionFromFilename(j) ~= "lua" then continue end
--- local itempath = string.format("artery/maps/%s/%s/%s", mapname, v, j)
--- local itemtxt = file.Read(itempath, "DATA")
--- assert(itemtxt ~= nil, "Found a file, but it looks like it can't be compiled:" .. itempath)
--- CompileString(itemtxt,itempath)()
--- end
--- end
--- end
---
--- hook.Add( "InitPostEntity", "artery_spawnmapnpcs", function()
--- loadMap()
--- end )
---
--- concommand.Add("artery_reloadmap", function(ply,cmd,args)
--- if not ply:IsAdmin() then return end
--- for k,v in pairs(removeents) do
--- local eot = ents.FindByClass(v)
--- for i,j in pairs(eot) do
--- j:Remove()
--- end
--- end
--- loadMap()
--- end)
diff --git a/gamemode/server/sv_pac.lua b/gamemode/server/sv_pac.lua
deleted file mode 100644
index fc436f4..0000000
--- a/gamemode/server/sv_pac.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-hook.Add("PrePACConfigApply", "donators only", function(ply, outfit_data)
- if not ply:IsSuperAdmin() then
- return false, "give us money!"
- end
-end)
-
-hook.Add( "PrePACEditorOpen", "RestrictToSuperadmin", function( ply )
- return ply:IsSuperAdmin(), "This is accessable only to superadmins"
-end )
diff --git a/gamemode/server/sv_systems.lua b/gamemode/server/sv_systems.lua
deleted file mode 100644
index ad1b901..0000000
--- a/gamemode/server/sv_systems.lua
+++ /dev/null
@@ -1,21 +0,0 @@
---[[
- Calculates various needs for the player, displayed in /gamemode/client/cl_systems.lua
- Each need has a min and a max (ex health, stamina ect.)
-
- Provides:
- ART.RegisterSystem(string_name, table_system)
- Registers the system with all players. Two systems may not share the same name.
-]]
-
-local pmeta = FindMetaTable("Player")
-
-pmeta.Systems = {}
-
-function ART.RegisterSystem(tbl)
- assert(tbl.Name ~= nil,"Attempted to register a system with a nil name")
- pmeta.Systems[name] = tbl
-end
-
-concommand.Add("DisplaySystems",function()
- PrintTable(pmeta.Systems)
-end)
diff --git a/gamemode/server/systems/health.lua b/gamemode/server/systems/health.lua
deleted file mode 100644
index 7ead999..0000000
--- a/gamemode/server/systems/health.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-
-local SYSTEM = {}
-
-SYSTEM.onthink = function(ply)
-
-end
-
-SYSTEM.ontakedamage = function(ply)
-
-end
-
-return SYSTEM
diff --git a/gamemode/shared/inventory.lua b/gamemode/shared/inventory.lua
deleted file mode 100644
index b89deac..0000000
--- a/gamemode/shared/inventory.lua
+++ /dev/null
@@ -1,399 +0,0 @@
--- do return end
---
--- --[[
--- Various functions to work with inventories
--- player:GetCredits()
--- player:SetCredits(number credits)
---
--- concommands:
--- artery_showinventory
--- artery_setcredits [playername=admin] numcredits
--- ]]
--- --- Various functions to deal with inventories.
--- -- @module Player
--- local pmeta = FindMetaTable("Player")
--- local emeta = FindMetaTable("Entity")
--- local invfuncs = include("inventory_common.lua")
---
--- --A 2d array of the inventory.
--- pmeta.Inventory = pmeta.Inventory or {}
---
--- --Money
--- pmeta.Inventory.Credits = pmeta.Inventory.Credits or 0
--- --each backpack has 1:a tbl containing items or false, 2: a tbl {width,height} and 3:name
--- pmeta.Inventory.Backpacks = pmeta.Inventory.Backpacks or {}
---
--- --Eqiped stuff at base, player has 1=Head, 2=Body, 3=Legs, 4=Boots, 5=Gloves, 6=Left Hand, 7=Right Hand
--- pmeta.Inventory.Equiped = pmeta.Inventory.Equiped or {}
--- local equipedslots = {
--- "Head","Body","Legs","Boots","Gloves","Left","Right"
--- }
--- for _,v in pairs(equipedslots) do
--- pmeta.Inventory.Equiped[v] = pmeta.Inventory.Equiped[v] or false
--- end
---
--- if SERVER then
--- --- Gets a player's credits.
--- -- Gets the number of credits a player has
--- -- @return The number of credits for this player
--- function pmeta:GetCredits()
--- return self.Inventory.Credits
--- end
---
--- util.AddNetworkString( "art_synch_credits" )
--- local function SynchCredits(ply)
--- net.Start("art_synch_credits")
--- net.WriteUInt(ply.Inventory.Credits,32)
--- net.Send(ply)
--- end
---
--- --- Sets a player's credits.
--- -- Sets the number of credits this player has. Credits are synchronized after every set
--- -- @param num The number of credits to set on the player
--- function pmeta:SetCredits(num)
--- assert(type(num) == "number","Attempted to set credits to something other than a number:" .. type(num))
--- self.Inventory.Credits = num
--- SynchCredits(self)
--- end
---
--- end
---
--- if CLIENT then
--- net.Receive("art_synch_credits",function()
--- ART.Credits = net.ReadUInt(32)
--- print("I updated my credits! now:", ART.Credits)
--- end)
--- end
---
--- --- Puts an item in the inventory.
--- -- Puts an item in an inventory, overwriteing all other items it might be overlapping, you should check to make sure you're not over writeing something first.
--- -- @param backpack the backpack number this item should be placed in
--- -- @param x the column in the backpack this item should be placed in
--- -- @param y the row in the backpack this item should be placed in
--- -- @param item the item to place in the backpack.
--- -- @see Player.FindSpotForItem
--- function pmeta:PutInvItem(backpack,x,y,item)
--- invfuncs.PutItemInBackpack(self.Inventory.Backpacks[backpack],x,y,item)
--- end
---
--- --- Finds a spot for an item.
--- -- Finds a backpack, row, and column for an item in a player's inventory.
--- -- @param item The item to try and fit into the backpack.
--- -- @return row The row where a spot was found
--- -- @return col The column where a spot was found
--- -- @return n The backpack number where a spot was found
--- function pmeta:FindSpotForItem(item)
--- for n,v in pairs(self.Inventory.Backpacks) do
--- for row = 1,v[2][2] do
--- for col = 1,v[2][1] do
--- if self:CanFitInBackpack(v,row,col,item) then
--- return row,col,n
--- end
--- end
--- end
--- end
--- end
---
--- local function DefaultCompare(item, itemname)
--- return item.Name == itemname
--- end
---
--- --- Checks if the player has an item.
--- -- Check to see if the player has an item. Supply the name of the item, or supply a function that takes 2 items, and returns true if they are equial. If any of the returns are nil, then all the the returns will be nil, and the item could not be found.
--- -- @param nameorcomparitor The item name as a string, or a function that returns true when given an item that you want.
--- -- @return row The row the items was found in
--- -- @return col The column the item was found in
--- -- @return n The backpack number the item was found in.
--- function pmeta:HasItem(nameorcomparitor)
--- local comparitor
--- if type(nameorcomparitor) == "string" then
--- comparitor = function(t) return t.Name == nameorcomparitor end
--- else
--- comparitor = nameorcomparitor
--- end
--- for n,v in pairs(self.Inventory.Backpacks) do
--- for row = 1,v[2][2] do
--- for col = 1,v[2][1] do
--- local itemin = v[1][row][col]
--- if (type(itemin) ~= "boolean") and comparitor(itemin) then
--- return row,col,n
--- end
--- end
--- end
--- end
--- end
---
--- --- Removes an item.
--- -- Remoes an item in the backpack of the player
--- -- @param backpack The backpack to remove the item from
--- -- @param row The row in the backpack the item is located at
--- -- @param col The column in the backpack the item is located at
--- function pmeta:RemoveItemAt(backpack,row,col)
--- local item = self.Inventory.Backpacks[backpack][1][row][col]
--- for k = 1,#item.Shape do
--- for i = 1,#(item.Shape[k]) do
--- self.Inventory.Backpacks[backpack][1][row + k - 1][col + i - 1] = false
--- end
--- end
--- self:SynchronizeInventory()
--- end
---
--- --- Gives an item to a player.
--- -- Gives an item to the player in the next avaliable slot the item can fit in
--- -- @param item The item to give the player
--- function pmeta:GiveItem(item)
--- local x,y,b = self:FindSpotForItem(item)
--- print("putting in ",x,y,b)
--- if x and y and b then
--- self:PutInvItem(b,x,y,item)
--- self:SynchronizeInventory()
--- return true
--- else
--- return false
--- end
--- end
---
--- --- Check if an item can fit in a position in a backpack
--- -- Check if an item can fit in a specific position in a specific backpack
--- -- @param backpack The backpack to try to fit the item in
--- -- @param x The row to try to fit the item in
--- -- @param y The column to try to fit the item in
--- -- @return bool If the item can fit in the backpack
--- function pmeta:CanFitInBackpack(backpack,x,y,item)
--- return invfuncs.CanFitInBackpack(backpack,x,y,item)
--- end
---
--- if SERVER then
--- util.AddNetworkString("synchinventory")
--- util.AddNetworkString("moveitem")
--- util.AddNetworkString("equipitem")
--- util.AddNetworkString("unequipitem")
--- util.AddNetworkString("buyitem")
--- end
---
--- --- Unequips an item.
--- -- Unequips an item, and puts it in the specified backpack (makes sure that it's possible first)
--- -- @param equipslot The equipment slot the item is in right now
--- -- @param backpack The destination backpack to put the item into
--- -- @param row The row in the backpack to put the item
--- -- @param col The column in the backpack to put the item
--- function pmeta:UnEquip(equipslot, backpack, row, col)
--- local item = self.Inventory.Equiped[equipslot]
--- local tobackpack = self.Inventory.Backpacks[backpack]
--- print("Unequiping into backpack", tobackpack)
--- if self:CanFitInBackpack(
--- tobackpack,
--- row,
--- col,
--- item
--- ) then
--- self.Inventory.Equiped[equipslot] = false
--- self:PutInvItem(backpack,row,col,item)
--- if item.onUnEquip ~= nil then
--- item:onUnEquip(self)
--- end
--- self:SynchronizeInventory()
--- else
--- error("Could not fit item in backpack, client might be de-synchronized")
--- end
--- end
---
--- net.Receive("unequipitem",function(len,ply)
--- local itemslot = net.ReadString()
--- local tobackpack = net.ReadUInt(16)
--- local row = net.ReadUInt(16)
--- local col = net.ReadUInt(16)
---
--- ply:UnEquip(itemslot,tobackpack,row,col)
--- end)
---
--- --- Equips an item
--- -- Moves an item from a backpack to an equiped slot, makes sure the item can be equiped in that slot first
--- -- @param frombackpack The backpack to take the item from
--- -- @param fromrow The row to take the item from
--- -- @param fromcol The column to take the item from
--- -- @param toslo The equipment slot to put the item into
--- function pmeta:EquipItem(frombackpack, fromrow, fromcol, toslot)
--- local item = self.Inventory.Backpacks[frombackpack][1][fromrow][fromcol]
--- if item.Equipable ~= nil and item.Equipable == toslot then
--- --Remove from the backpack
--- for k = 1,#item.Shape do
--- for i = 1,#item.Shape[k] do
--- if k == 1 and i == 1 then continue end
--- self.Inventory.Backpacks[frombackpack][1][fromrow + k - 1][fromcol + i - 1] = false
--- end
--- end
--- self.Inventory.Backpacks[frombackpack][1][fromrow][fromcol] = false
--- self.Inventory.Equiped[toslot] = item
--- if item.onEquip ~= nil then
--- item:onEquip(self)
--- end
--- self:SynchronizeInventory()
--- end
--- end
---
--- net.Receive("equipitem",function(len,ply)
--- local backpacknum = net.ReadUInt(16)
--- local fromrow = net.ReadUInt(16)
--- local fromcol = net.ReadUInt(16)
--- local equippos = net.ReadString()
--- ply:EquipItem(backpacknum,fromrow,fromcol,equippos)
--- end)
---
--- net.Receive("buyitem",function(len,ply)
--- local itemname = net.ReadString()
--- local backpack = net.ReadUInt(8)
--- local j = net.ReadUInt(8)
--- local i = net.ReadUInt(8)
--- local item = ART.GetItemByName(itemname)
--- local nearshops = ents.FindInSphere( ply:GetPos(), 100 )
--- local cost
--- for k,v in pairs(nearshops) do
--- if v:GetClass() ~= "npc_shop" then goto nextent end
--- print("Checking if ", v, " has a ", itemname)
--- print("Shop items were")
--- PrintTable(v.shopitems)
--- for i,j in pairs(v.shopitems) do
--- if j[1] == itemname then
--- cost = j[2]
--- goto itemfound
--- end
--- end
--- ::nextent::
--- end
--- ::itemfound::
--- if cost == nil then
--- ply:ChatPrint("Could not find a shop selling that!")
--- return false
--- end
--- print("Found item, cost was ", cost,"type",type(cost))
--- local playercreds = ply:GetCredits()
--- print("player credits:",playercreds,"type:",type(playercreds))
--- local tbp = ply.Inventory.Backpacks[backpack]
--- local canfit = invfuncs.CanFitInBackpack(tbp,j,i,item)
--- print("Can fit?",canfit)
--- if playercreds < cost then
--- ply:ChatPrint("You don't have enough credits to buy that!")
--- return false
--- end
--- if not canfit then
--- ply:ChatPrint("You can't put that into your packpack there!")
--- return false
--- end
--- ply:SetCredits(playercreds - cost)
--- invfuncs.PutItemInBackpack(tbp,j,i,item)
--- ply:SynchronizeInventory()
--- return true
--- end)
---
--- net.Receive("moveitem",function(len,ply)
--- local froment = net.ReadEntity()
--- local toent = net.ReadEntity()
---
--- local frombackpack = net.ReadUInt(16)
--- local tobackpack = net.ReadUInt(16)
---
--- local frompos = {net.ReadUInt(16),net.ReadUInt(16)}
--- local topos = {net.ReadUInt(16),net.ReadUInt(16)}
---
--- if froment:IsPlayer() and toent:IsPlayer() and (froment ~= toent) then--Just don't allow stealing between players, anything else is fine
--- ply:PrintMessage( HUD_PRINTCENTER, "You can't steal from this person!" )
--- return
--- end
--- local item = froment.Inventory.Backpacks[frombackpack][1][frompos[1]][frompos[2]]
---
--- --Set the shape it was at to false
--- for k = 1,#item.Shape do
--- for i = 1,#(item.Shape[k]) do
--- if k == 1 and i == 1 then continue end
--- froment.Inventory.Backpacks[frombackpack][1][frompos[1] + k - 1][frompos[2] + i - 1] = false
--- end
--- end
--- froment.Inventory.Backpacks[frombackpack][1][frompos[1]][frompos[2]] = false
--- --now check if it can fit in the backpack
--- if invfuncs.CanFitInBackpack(toent.Inventory.Backpacks[tobackpack],topos[1],topos[2],item) then
--- invfuncs.PutItemInBackpack(toent.Inventory.Backpacks[tobackpack],topos[1],topos[2],item)
--- else
--- invfuncs.PutItemInBackpack(froment.Inventory.Backpacks[frombackpack],frompos[1],frompos[2],item)
--- end
--- froment:SynchronizeInventory()
--- toent:SynchronizeInventory()
--- end)
---
--- --- Networks a player's inventory
--- -- Makes sure the client's version of the inventory matches up to the server's version, this should be called after manipulateing the client's inventory in any way.
--- function pmeta:SynchronizeInventory()
--- net.Start("synchinventory")
--- net.WriteEntity(self)
--- net.WriteFloat(#self.Inventory.Backpacks)
--- for k,v in pairs(self.Inventory.Backpacks) do
--- invfuncs.SerializeBackpack(v)
--- end
--- for k,v in pairs(equipedslots) do
--- if self.Inventory.Equiped and self.Inventory.Equiped[v] ~= false then
--- net.WriteString(v)
--- local data = self.Inventory.Equiped[v]:Serialize()
--- net.WriteString(self.Inventory.Equiped[v].Name)
--- net.WriteUInt(#data,32)
--- net.WriteData(data,#data)
--- end
--- end
--- net.WriteString("END_EQUIPED")
--- net.Send(self)
--- end
--- if CLIENT then
--- net.Receive("synchinventory",function(len,ply)
--- if LocalPlayer().invdisplays == nil then
--- LocalPlayer().invdisplays = {}
--- end
--- local what = net.ReadEntity()
--- what.Inventory.Backpacks = {}
--- local numbackpacks = net.ReadFloat()
--- for k = 1,numbackpacks do
--- local tbackpack = invfuncs.DeSerializeBackpack()
--- table.insert(what.Inventory.Backpacks,tbackpack)
--- end
--- local neq = net.ReadString()
--- local updated_slots = {}
--- while neq ~= "END_EQUIPED" do
--- local itemslot = neq
--- local itemname = net.ReadString()
--- local itemdata = net.ReadData(net.ReadUInt(32))
--- local item = ART.GetItemByName(itemname):DeSerialize(itemdata)
--- what.Inventory.Equiped[itemslot] = item
--- updated_slots[itemslot] = true
--- neq = net.ReadString()
--- end
--- if what.Inventory.Equiped ~= nil then
--- for k,v in pairs(equipedslots) do
--- if updated_slots[v] then continue end
--- what.Inventory.Equiped[v] = false
--- end
--- end
--- ART.RefreshDisplays()
--- end)
--- end
---
--- concommand.Add("artery_showinventory",function(ply,cmd,args)
--- PrintTable(ply.Inventory)
--- PrintTable(ply.ClientInventory)
--- end)
---
--- concommand.Add("artery_setcredits",function(ply,cmd,args)
--- if not (ply:IsValid() and ply:IsAdmin()) then return end
--- local e
--- local i = false
--- for k,v in pairs(player.GetAll()) do
--- if v:Nick() == args[1] then
--- e = v
--- i = true
--- break
--- end
--- end
--- e = e or ply
--- e:SetCredits(tonumber(args[i and 2 or 1]))
--- end)
---
--- hook.Add( "PlayerSpawn", "artery_disable_sprint", function(ply)
--- ply:SetRunSpeed(ply:GetWalkSpeed())
--- end )
diff --git a/gamemode/shared/inventory_common.lua b/gamemode/shared/inventory_common.lua
deleted file mode 100644
index c5b8fc3..0000000
--- a/gamemode/shared/inventory_common.lua
+++ /dev/null
@@ -1,193 +0,0 @@
--- --[[
--- Some functions that are needed multiple places in the code, to deal with player inventories.
--- ]]
--- do return end
--- print("Hello from inventory_common.lua")
--- local invfuncs = {}
---
--- --Forcibly put an item in a backpack, you should check to make sure there's room first
--- invfuncs.PutItemInBackpack = function(backpack,x,y,item)
--- backpack[1][x][y] = item
--- for k = 1,#item.Shape do
--- for i = 1,#(item.Shape[k]) do
--- if k == 1 and i == 1 then continue end
--- backpack[1][x + k - 1][y + i - 1] = item.Shape[k][i]
--- end
--- end
--- end
---
--- --Writes a backpack to the net stream
--- invfuncs.SerializeBackpack = function(backpack)
--- net.WriteString(backpack[3]) --Name
--- net.WriteUInt(backpack[2][1],16) --width
--- net.WriteUInt(backpack[2][2],16) --height
--- for k,v in pairs(backpack[1]) do
--- for i,j in pairs(v) do
--- if type(j) ~= "table" then continue end
--- net.WriteString(j.Name)
--- net.WriteUInt(k,16)
--- net.WriteUInt(i,16)
--- local data = j:Serialize()
--- net.WriteUInt(#data,32)
--- net.WriteData(data,#data)
--- end
--- end
--- net.WriteString("END_ITEMS")
--- end
---
--- --Loads a backpack from the net stream
--- invfuncs.DeSerializeBackpack = function()
--- local backpackname = net.ReadString()
--- local width = net.ReadUInt(16)
--- local height = net.ReadUInt(16)
--- --Build the backpack
--- local tb = {}
--- tb[1] = {}
--- tb[2] = {width,height}
--- tb[3] = backpackname
--- for x = 1,width do
--- tb[1][x] = {}
--- for y = 1,height do
--- tb[1][x][y] = false
--- end
--- end
---
--- local nitemname = net.ReadString()
--- while nitemname ~= "END_ITEMS" do
--- local xpos = net.ReadUInt(16)
--- local ypos = net.ReadUInt(16)
--- local data = net.ReadData(net.ReadUInt(32))
--- local nitem = ART.GetItemByName(nitemname):DeSerialize(data)
--- invfuncs.PutItemInBackpack(tb,xpos,ypos,nitem)
--- nitemname = net.ReadString()
--- end
---
--- return tb
---
--- end
---
--- --Checks to see if an item can fit in the backpack at a certain position
--- invfuncs.CanFitInBackpack = function(backpack,x,y,item)
--- for k,v in pairs(item.Shape) do
--- for i,j in pairs(v) do
--- if not j then continue end
--- if backpack[1][x + k - 1] == nil then
--- return false
--- end
--- if backpack[1][x + k - 1][y + i - 1] or backpack[1][x + k - 1][y + i - 1] == nil then
--- return false
--- end
--- end
--- end
--- return true
--- end
---
--- --Creates a new backpack, this is NOT called when players join the server, even new ones.
--- invfuncs.CreateBackpack = function(name,width,height)
--- local backpack = {}
--- backpack[1] = {}
--- backpack[2] = {width,height}
--- backpack[3] = name
--- for i = 1,width do --the width of the backpack.
--- backpack[1][i] = {}
--- end
--- for k,v in pairs(backpack[1]) do
--- for i = 1,height do --the height of the backpack.
--- backpack[1][k][i] = false
--- end
--- end
--- return backpack
--- end
---
--- --Draws a backpack on the dpanel, client side only
--- invfuncs.DrawBackpackOnDPanel = function(dp, backpack, backpacknum, tent)
--- local width = ScrW()
--- local height = ScrH()
--- local slotsize = math.Round(width / 32)
--- local backgrid = vgui.Create( "DGrid", dp )
--- backgrid:SetPos( 10, 30 )
--- backgrid:SetCols( backpack[2][1] )
--- backgrid:SetColWide( backpack[2][2] )
--- backgrid:Dock(FILL)
--- for i = 1,#(backpack[1]) do
--- for j = 1,#(backpack[1][i]) do
--- local item = backpack[1][j][i]
--- if type(backpack[1][j][i]) == "table" then
--- local itemwidth = 0
--- for _,l in pairs(item.Shape) do
--- itemwidth = math.Max(itemwidth,#l)
--- end
--- local itemheight = #item.Shape
--- local invicon = vgui.Create( "DButton", dp )
--- invicon:SetSize(slotsize * itemwidth, slotsize * itemheight)
--- invicon:SetPos(slotsize * (i - 1), slotsize * (j - 1))
--- invicon:SetText(item.Name)
--- if item.Tooltip then
--- invicon:SetTooltip(item.Tooltip)
--- end
--- --invicon.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,100,0)) end
--- invicon.DoClick = function()
--- if not item.GetOptions then return end
--- local menu = vgui.Create("DMenu")
--- createMenuFor(menu,item:GetOptions())
--- menu:Open()
--- end
--- invicon.Item = item
--- invicon.invpos = {j,i}
--- invicon.ent = tent
--- invicon.backpacknum = backpacknum
--- invicon:Droppable("Inventory")
--- elseif not backpack[1][j][i] then
--- local emptyslot = vgui.Create("DPanel", dp)
--- emptyslot:SetSize(slotsize,slotsize)
--- emptyslot:SetPos(slotsize * (i - 1), slotsize * (j - 1))
--- --emptyslot.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,0,100)) end
--- emptyslot:Receiver( "Inventory", function( receiver, tableOfDroppedPanels, isDropped, menuIndex, mouseX, mouseY )
--- if not isDropped then return end
--- local icon = tableOfDroppedPanels[1]
--- local item = icon.Item
--- local curpos = icon.invpos
--- --Set the shape it was at to false
--- if not icon.wasequiped and icon.ent == tent then
--- assert(curpos ~= nil, "print curpos was nil when not equiped")
--- for k = 1,#item.Shape do
--- for l = 1,#(item.Shape[k]) do
--- if k == 1 and l == 1 then continue end
--- backpack[1][curpos[1] + k - 1][curpos[2] + l - 1] = false
--- end
--- end
--- backpack[1][curpos[1]][curpos[2]] = false
--- end
--- if invfuncs.CanFitInBackpack(backpack,j,i,item) then
--- local fromtbl = icon.invpos
--- local wasequiped = icon.wasequiped
--- if wasequiped then
--- net.Start("unequipitem")
--- net.WriteString(wasequiped)
--- net.WriteUInt(backpacknum,16)
--- net.WriteUInt(i,16)
--- net.WriteUInt(j,16)
--- net.SendToServer()
--- else
--- net.Start("moveitem")
--- net.WriteEntity(icon.ent) -- from ent
--- net.WriteEntity(tent) -- to ent
--- net.WriteUInt(icon.backpacknum,16) -- from backpack number
--- net.WriteUInt(backpacknum,16) -- to backpack number
--- net.WriteUInt(fromtbl[1],16) -- From position
--- net.WriteUInt(fromtbl[2],16)
--- net.WriteUInt(j,16) -- To position
--- net.WriteUInt(i,16)
--- net.SendToServer()
--- if item.onEquip ~= nil then
--- item:onEquip(LocalPlayer())
--- end
--- end
--- end
--- end, {} )
--- end
--- end
--- end
--- end
--- ART.invfuncs = invfuncs
--- return invfuncs
diff --git a/gamemode/shared/loaditems.lua b/gamemode/shared/loaditems.lua
deleted file mode 100644
index dba80e8..0000000
--- a/gamemode/shared/loaditems.lua
+++ /dev/null
@@ -1,61 +0,0 @@
--- do return end
--- --[=[
--- --[[
--- This file loads in all the items
--- ]]
--- local concmd = include("concommands.lua")
--- --local autolua = include("../autolua.lua")
--- print("Hello from LoadItems.lua!")
--- ART.Items = {}
--- local requiredfields = {
--- "Name",
--- "Shape",
--- "Serialize",
--- "DeSerialize",
--- }
--- local defaultfields = {
--- ["Serialize"] = function(self) return "" end,
--- ["DeSerialize"] = function(self,string) return self end,
--- ["Shape"] = {{true}},
--- }
--- function ART.RegisterItem(tbl)
--- --print("Registering item:" .. tbl.Name)
--- for k,v in pairs(requiredfields) do
--- assert(tbl[v] ~= nil, "Attempted to register an item without field:" .. v)
--- end
--- assert(ART.Items[tbl.Name] == nil, "Attempted to register 2 items with the same name!")
--- for k,v in pairs(defaultfields) do
--- if tbl[k] == nil then
--- tbl[k] = v
--- end
--- end
--- ART.Items[tbl.Name] = tbl
--- --print("Art is now:")
--- --PrintTable(ART)
--- end
---
--- --autolua.AddLuaSHFolder("/shared/itemsystem")
---
--- function ART.GiveItem(player,name)
--- assert(ART.Items[name] ~= nil, "Attempted to give a nil item!")
--- player:GiveItem(ART.Items[name])
--- player:SynchronizeInventory()
--- end
---
--- function ART.GetItemByName(name)
--- assert(ART.Items[name] ~= nil,"Attempted to get a nil item:" .. name)
--- return ART.Items[name]
--- end
---
--- concommand.Add("artery_printitems",function(ply,cmd,args)
--- if not ply:IsAdmin() then return end
--- print("Items table:")
--- PrintTable(ART.Items)
--- end)
---
--- concommand.Add("artery_giveitem",function(ply,cmd,args)
--- if not ply:IsAdmin() then return end
--- print("Trying to give an item:" .. args[1])
--- ART.GiveItem(ply,args[1])
--- end, concmd.AutocompleteFunction(table.GetKeys(ART.Items)), "Give an item to the specified player, or yourself if no player is specified.")
--- ]=]
diff --git a/gamemode/shared/loadnpcs.lua b/gamemode/shared/loadnpcs.lua
deleted file mode 100644
index de411df..0000000
--- a/gamemode/shared/loadnpcs.lua
+++ /dev/null
@@ -1,39 +0,0 @@
--- do return end
--- local f = include("concommands.lua")
---
--- ART = ART or {}
---
--- local npcs = {}
--- local autocompletef
---
--- function ART.RegisterNPC(npc)
--- assert(npc ~= nil, "Attempted to register a nil npc")
--- assert(npc.Name ~= nil, "Attempted to register an npc without a name")
--- npcs[npc.Name] = npc
--- autocompletef = f.AutocompleteFunction(npcs)
--- end
---
--- function ART.CreateNPCByName(npcname, pos)
--- print("Createing a " ,npcname ," at ", pos)
--- local npctbl = npcs[npcname]
--- local npc = ents.Create("npc_huntable")
--- npc:SetPos(pos)
--- for k,v in pairs(npctbl) do
--- npc[k] = v
--- end
--- npc:Spawn()
--- return npc
--- end
---
---
--- if SERVER then
--- autocompletef = nil
--- else
--- autocompletef = f.AutocompleteFunction(npcs)
--- end
--- concommand.Add("artery_makenpc",function(ply,cmd,args)
--- if not ply:IsAdmin() then return end
--- local n = args[1]
--- ART.CreateNPCByName(n,ply:GetEyeTrace().HitPos)
--- end,
--- autocompletef)
diff --git a/gamemode/shared/loadprayers.lua b/gamemode/shared/loadprayers.lua
deleted file mode 100644
index 551ab1b..0000000
--- a/gamemode/shared/loadprayers.lua
+++ /dev/null
@@ -1,123 +0,0 @@
--- --[[
--- This file loads in all the prayers
--- ]]
--- do return end
--- local concmd = include("concommands.lua")
--- --local autolua = include("../autolua.lua")
--- print("Hello from LoadItems.lua!")
--- ART.Prayer = {}
--- local requiredfields = {
--- "Name",
--- "Pray",
--- }
--- local defaultfields = {
--- ["Serialize"] = function(self) return "" end,
--- ["DeSerialize"] = function(self,string) return self end,
--- ["Shape"] = {{true}},
--- }
---
--- --- Adds the given prayer table to the global list of prayers.
--- -- Make sure that you do not accidentally register the same prayer twice, all prayers MUST have unique names
--- -- @param tbl The prayer to reigster
--- function ART.RegisterPrayer(tbl)
--- --print("Registering item:" .. tbl.Name)
--- for k,v in pairs(requiredfields) do
--- assert(tbl[v] ~= nil, "Attempted to register an prayer without field:" .. v)
--- end
--- assert(ART.Prayer[tbl.Name] == nil, "Attempted to register 2 Prayers with the same name!")
--- for k,v in pairs(defaultfields) do
--- if tbl[k] == nil then
--- tbl[k] = v
--- end
--- end
--- ART.Prayer[tbl.Name] = tbl
--- --print("Art is now:")
--- --PrintTable(ART)
--- end
---
--- --autolua.AddLuaSHFolder("/shared/itemsystem")
---
--- local meta = FindMetaTable("Player")
---
---
--- if SERVER then
--- meta.Inventory.Prayers = {}
---
--- -- TODO:Make prayers limited or something
--- function meta:HasPrayer(prayername)
--- return self.Inventory.Prayers[prayername]
--- end
---
--- function meta:RemovePrayer(prayername)
--- self.Inventory.Prayers[prayername] = nil
--- self:SynchPrayers()
--- end
---
--- function ART.RemovePrayer(player,prayername)
--- player:RemovePrayer(prayername)
--- end
---
--- function meta:GivePrayer(prayername)
--- print("Prayers are:")
--- PrintTable(ART.Prayer)
--- assert(ART.Prayer[prayername] ~= nil, "Attempted to give a nil prayer \"" .. prayername .. "\"")
--- self.Inventory.Prayers[prayername] = true
--- self:SynchPrayers()
--- end
---
--- function ART.GivePrayer(player,prayername)
--- player:GivePrayer(prayername)
--- end
---
--- util.AddNetworkString( "art_synch_prayers" )
--- util.AddNetworkString( "equiphelpprayer" )
---
--- function meta:SynchPrayers()
--- print("Sending " .. table.Count(self.Inventory.Prayers) .. " prayers:")
--- PrintTable(self.Inventory.Prayers)
--- net.Start("art_synch_prayers")
--- net.WriteUInt(table.Count(self.Inventory.Prayers),16)
--- for k,v in pairs(self.Inventory.Prayers) do
--- print("Writeing " .. k)
--- net.WriteString(k)
--- end
--- net.Send(self)
--- end
--- end
---
--- concommand.Add("artery_giveprayer",function(ply,cmd,args)
--- if not ply:IsAdmin() then return end
--- ply:GivePrayer(args[1])
--- end, concmd.AutocompleteFunction(table.GetKeys(ART.Prayer)), "Give an instance of a prayer to yourself")
---
--- if CLIENT then
--- ART.MyPrayer = {}
--- net.Receive("art_synch_prayers",function()
--- ART.MyPrayer = {}
--- for k = 1,net.ReadUInt(16) do
--- local pstr = net.ReadString()
--- print("Reading prayer " .. pstr)
--- ART.MyPrayer[pstr] = true
--- end
--- print("Recived prayers:")
--- PrintTable(ART.MyPrayer)
--- ART.RefreshDisplays()
--- end)
--- end
---
--- function ART.GetPrayerByName(name)
--- assert(ART.Prayer[name] ~= nil,"Attempted to get a nil prayer:" .. name)
--- return ART.Prayer[name]
--- end
---
--- concommand.Add("artery_printprayers",function(ply,cmd,args)
--- if not ply:IsAdmin() then return end
--- print("Items table:")
--- PrintTable(ART.Prayer)
--- end)
---
--- concommand.Add("artery_giveprayer",function(ply,cmd,args)
--- if not ply:IsAdmin() then return end
--- print("Trying to give an prayer:" .. args[1])
--- ART.GivePrayer(ply,args[1])
--- end, concmd.AutocompleteFunction(table.GetKeys(ART.Prayer)), "Give an item to the specified player, or yourself if no player is specified.")
diff --git a/gamemode/shared/log.lua b/gamemode/shared/log.lua
index 1ede67f..ad5da46 100644
--- a/gamemode/shared/log.lua
+++ b/gamemode/shared/log.lua
@@ -4,20 +4,42 @@ local col = nrequire("colortheme.lua")
local log = {}
log.debug = fn.compose(
- fn.curry(
- MsgC,
- col.console.cyan),
- fn.curry(
- string.format,
- "[DEBUG] %s"))
+ fn.curry(
+ MsgC,
+ col.console.cyan
+ ),
+ fn.curry(
+ string.format,
+ "[DEBUG] %s"
+ )
+)
+
+log.info = fn.compose(
+ fn.curry(
+ MsgC,
+ col.console.blue
+ ),
+ fn.curry(
+ string.format,
+ "[INFO] %s"
+ )
+)
log.warn = fn.compose(
- fn.curry(
- MsgC,
- col.console.yellow),
- debug.traceback,
- fn.curry(
- ErrorNoHalt,
- "[WARNING]"))
+ fn.curry(
+ MsgC,
+ col.console.yellow
+ ),
+ debug.traceback,
+ fn.curry(
+ ErrorNoHalt,
+ "[WARNING]"
+ )
+)
+
+log.report = fn.curry(
+ file.Append,
+ "artery/report_log.txt"
+)
return log
diff --git a/gamemode/shared/prayersystem/prayers/lesserevasion.lua b/gamemode/shared/prayersystem/prayers/lesserevasion.lua
deleted file mode 100644
index 040189e..0000000
--- a/gamemode/shared/prayersystem/prayers/lesserevasion.lua
+++ /dev/null
@@ -1,66 +0,0 @@
--- do return end
--- --[[
--- An example item
--- ]]
--- print("Hello from lesser evasion.lua")
--- local prayer = {}
---
--- --Required, a name, all prayer names must be unique
--- prayer.Name = "Lesser Evasion"
---
--- --Optional, a tooltip to display when hovered over
--- prayer.Tooltip = "A prayer to the rouge god to allow you to quickly dodge to the left or right"
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- local prayedplayers = {}
--- local prayedplayerstime = {}
--- if SERVER then
--- util.AddNetworkString("art_prayer_lesserevasion")
--- net.Receive("art_prayer_lesserevasion",function(ln,ply)
--- if ply:HasPrayer(prayer.Name) and (prayedplayers[ply] == nil or CurTime() > prayedplayerstime[ply] + 5) then
--- prayedplayers[ply] = true
--- prayedplayerstime[ply] = CurTime()
--- end
--- end)
--- end
---
---
--- local lastprayer = CurTime()
--- prayer.Pray = function(self)
--- if SERVER then return end
--- if CurTime() > lastprayer + 0 then
--- net.Start("art_prayer_lesserevasion")
--- net.SendToServer()
--- lastprayer = CurTime()
--- end
--- end
---
---
--- hook.Add( "SetupMove", "artery_prayer_lesserevasion", function( ply, mv, cmd )
--- if prayedplayers[ply] and not ply:OnGround() then
--- local mdir = ART.playermovedir(ply)
--- if mdir == "left" or mdir == "right" then
--- local noup = mv:GetVelocity()
--- noup.z = 0
--- local pow = 600 - noup:Length()
--- mv:SetVelocity((noup * pow) + Vector(0, 0, 20))
--- prayedplayers[ply] = false
--- end
--- end
--- end )
---
--- function prayer.DisplayHelp(panel)
--- local helptxt = vgui.Create("DLabel",panel)
--- helptxt:SetWrap(true)
--- helptxt:SetText("Your reflexes quicken, allowing you to dodge eto the left or right every 5 seconds. Start moveing left or right, then jump")
--- helptxt:SetSize(ScrW() / 4,ScrH() / 8)
--- helptxt:SetDark(true)
--- end
---
--- --Optional. Something run once when this item is drawn in a backpack
--- function prayer.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "prayericons/lesserevasion.png")
--- end
---
---
--- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/ninelives.lua b/gamemode/shared/prayersystem/prayers/ninelives.lua
deleted file mode 100644
index 707e8b6..0000000
--- a/gamemode/shared/prayersystem/prayers/ninelives.lua
+++ /dev/null
@@ -1,50 +0,0 @@
--- do return end
--- --[[
--- An example prayer
--- ]]
--- local prayer = {}
---
--- --Required, a name, all item names must be unique
--- prayer.Name = "Nine Lives"
---
--- --Optional, a tooltip to display when hovered over
--- prayer.Tooltip = "A prayer to the rouge god to prevent fall dammage for the next 9 falls that you would have taken dammage, or for 5 minutes, whichever comes first."
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- local prayedplayers = {}
--- if SERVER then
--- util.AddNetworkString("art_prayer_ninelives")
--- net.Receive("art_prayer_ninelives",function(ln,ply)
--- if ply:HasPrayer("Nine Lives") then
--- prayedplayers[ply] = 9
--- timer.Simple(60 * 5,function()
--- prayedplayers[ply] = nil
--- end)
--- end
--- end)
--- end
---
---
--- local lastprayer = CurTime()
--- prayer.Pray = function(self)
--- if SERVER then return end
--- if CurTime() > lastprayer + 0 then
--- net.Start("art_prayer_ninelives")
--- net.SendToServer()
--- lastprayer = CurTime()
--- end
--- end
---
--- hook.Add( "EntityTakeDamage" , "artery_ninelives" , function(ent,info)
--- if info:GetDamageType() == DMG_FALL and prayedplayers[ent] ~= nil and prayedplayers[ent] > 0 then
--- info:SetDamage(0)
--- end
--- end)
---
--- --Optional. Something run once when this item is drawn in a backpack
--- function prayer.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "prayericons/ninelives.png")
--- end
---
---
--- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/notdarkrp.lua b/gamemode/shared/prayersystem/prayers/notdarkrp.lua
deleted file mode 100644
index a7a5761..0000000
--- a/gamemode/shared/prayersystem/prayers/notdarkrp.lua
+++ /dev/null
@@ -1,77 +0,0 @@
--- do return end
--- --[[
--- A default prayer given to new players who try to press f4
--- ]]
--- local prayer = {}
---
--- --Required, a name, all prayer names must be unique
--- prayer.Name = "Noob Help"
---
--- --Optional, a tooltip to display when hovered over
--- prayer.Tooltip = "Hello, and welcome to Artery, Enjoy your stay"
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
---
--- local lastpray = CurTime()
---
--- function prayer.Pray(self)
--- if SERVER then return end
--- if CurTime() > lastpray + 5 then
--- local helppanel = vgui.Create("DFrame")
--- helppanel:SetSize(ScrW()/3,ScrH())
--- helppanel:Center()
--- helppanel:MakePopup()
--- helppanel:SetText("Help")
---
--- lastpray = CurTime()
--- end
--- end
---
--- if SERVER then
--- util.AddNetworkString( "art_prayer_darkrphelp" )
---
--- net.Receive( "art_prayer_darkrphelp", function(ln,ply)
--- print("Prayer received")
--- if ply:HasPrayer("Noob Help") then
--- ply:RemovePrayer("Noob Help")
--- ply:SetCredits(ply:GetCredits() + 100)
--- else
--- print("You don't have that prayer!")
--- end
--- end)
--- end
---
--- function prayer.DisplayHelp(panel)
--- print("Help displayed")
--- local dll = vgui.Create( "DListLayout", panel)
--- dll:Dock(FILL)
--- local helptxt = vgui.Create("DLabel")
--- helptxt:SetWrap(true)
--- helptxt:SetText("Welcome to Artery! Since you don't really need this help anymore, you can click below to redeem it for 100 credits!")
--- helptxt:SetSize(ScrW()/4,ScrH()/8)
--- helptxt:SetDark(true)
--- dll:Add(helptxt)
--- local redeembutton = vgui.Create("DButton")
--- dll:Add(redeembutton)
--- redeembutton:Dock(BOTTOM)
--- --helptxt:Dock(TOP)
--- redeembutton:SetText("Redeem")
--- redeembutton.DoClick = function(self)
--- print("You clicked redeem!")
--- net.Start("art_prayer_darkrphelp")
--- net.SendToServer()
--- end
--- end
---
--- --Optional. Something run once when this item is drawn in a backpack
--- function prayer.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
--- end
---
--- --Optional. Called continuously, use if you need the item to display different stuff at different tiems
--- function prayer.Paint(self,width,height)
--- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
--- end
---
--- print("Hello from prayersystem/prayers/lesserevasion.lua")
--- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua
deleted file mode 100644
index b056f74..0000000
--- a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua
+++ /dev/null
@@ -1,68 +0,0 @@
--- do return end
--- --[[
--- An example item
--- ]]
--- local prayer = {}
---
--- --Required, a name, all item names must be unique
--- prayer.Name = "Preditor Instinct"
---
--- --Optional, a tooltip to display when hovered over
--- prayer.Tooltip = "A prayer to the rouge god to grant you 30% movement when chaseing a wounded target"
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- local prayedplayers = {}
--- if SERVER then
--- util.AddNetworkString("art_prayer_preditorinstinct")
--- net.Receive("art_prayer_preditorinstinct",function(ln,ply)
--- if ply:HasItem(item.Name) then
--- prayedplayers[ply] = true
--- timer.Simple(60,function()
--- prayedplayers[ply] = nil
--- end)
--- end
--- end)
--- end
---
--- local lastprayer = CurTime()
--- prayer.Pray = function(self)
--- if SERVER then return end
--- if CurTime() > lastprayer + 0 then
--- net.Start("art_prayer_preditorinstinct")
--- net.SendToServer()
--- lastprayer = CurTime()
--- end
--- end
--- --called continuously to buff players
--- local buffedplayers = {}
--- local function buffplayers()
--- for k,v in pairs(prayedplayers) do
--- if buffedplayers[k] ~= nil then continue end
--- --Find nearby wounded players or npcs
--- print("Checking if ", k, "should be buffed")
--- local wents = ents.FindInSphere(k:GetPos()+Vector(0,0,64),500)
--- for i,j in pairs(wents) do
--- print("Checking if ",j, "has taken dammage")
--- if k ~= j and j:Health() < j:GetMaxHealth() then
--- print("I buffed a player",k, "because ", j ,"has taken dammage")
--- k:SetWalkSpeed(k:GetWalkSpeed()*1.3)
--- buffedplayers[k] = true
--- timer.Simple(60,function()
--- k:SetWalkSpeed(k:GetWalkSpeed()*(1/1.3))
--- buffedplayers[k] = nil
--- end)
--- goto nextply
--- end
--- end
--- ::nextply::
--- end
--- timer.Simple(2,buffplayers)
--- end
--- buffplayers()
---
--- --Optional. Something run once when this item is drawn in a backpack
--- function prayer.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "prayericons/preditorinstinct.png")
--- end
---
--- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/thickskin.lua b/gamemode/shared/prayersystem/prayers/thickskin.lua
deleted file mode 100644
index 817cb44..0000000
--- a/gamemode/shared/prayersystem/prayers/thickskin.lua
+++ /dev/null
@@ -1,60 +0,0 @@
--- do return end
--- --[[
--- An example prayer
--- ]]
--- local prayer = {}
---
--- --Required, a name, all item names must be unique
--- prayer.Name = "Thick Skin"
---
--- --Optional, a tooltip to display when hovered over
--- prayer.Tooltip = "A prayer to the warrior god to grant you 20% resistance to all dammage"
---
--- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
--- prayer.Serialize = function(self)
--- print("Trying to serailize!")
--- return ""
--- end
---
--- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
--- prayer.DeSerialize = function(self,string)
--- print("Trying to deserialize!")
--- return self
--- end
---
--- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
--- local prayedplayers = {}
--- if SERVER then
--- util.AddNetworkString("art_prayer_thickskin")
--- net.Receive("art_prayer_thickskin",function(ln,ply)
--- if ply:HasItem("Thick Skin") then
--- prayedplayers[ply] = true
--- timer.Simple(120,function()
--- prayedplayers[ply] = nil
--- end)
--- end
--- end)
--- end
---
--- local lastprayer = CurTime()
--- prayer.Pray = function(self)
--- if SERVER then return end
--- if CurTime() > lastprayer + 0 then
--- net.Start("art_prayer_thickskin")
--- net.SendToServer()
--- lastprayer = CurTime()
--- end
--- end
--- hook.Add( "EntityTakeDamage" , "artery_thickskin" , function(ent,info)
--- if prayedplayers[ent] then
--- info:SetDamage(info:GetDamage()*0.8)
--- end
--- end)
---
--- --Optional. Something run once when this item is drawn in a backpack
--- function prayer.DoOnPanel(dimagebutton)
--- dimagebutton:SetImage( "prayericons/thickskin.png")
--- end
---
---
--- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/questsystem/examplequest.lua b/gamemode/shared/questsystem/examplequest.lua
deleted file mode 100644
index 21c8a7e..0000000
--- a/gamemode/shared/questsystem/examplequest.lua
+++ /dev/null
@@ -1,14 +0,0 @@
--- do return end
--- if SERVER then return end
--- local quest = {}
---
--- quest.Name = "Example Quest"
---
--- --[[
--- Given a DPanel, draw some text that the player can use when going through quests.
--- ]]
--- function quest.DrawQuestInfo(panel, status)
---
--- end
---
--- ART.RegisterQuest(quest)
diff --git a/gamemode/shared/questsystem/subterr_generator.lua b/gamemode/shared/questsystem/subterr_generator.lua
deleted file mode 100644
index 67a1f55..0000000
--- a/gamemode/shared/questsystem/subterr_generator.lua
+++ /dev/null
@@ -1,25 +0,0 @@
--- do return end
--- if SERVER then return end
--- local quest = {}
---
--- quest.Name = "Subterr_generator"
---
--- local questtext = {
--- [1] = "Visit the Tinkerer to see if he has a replacement Toggle Chip",
--- [2] = "V̶i̶s̶i̶t̶ ̶t̶h̶e̶ ̶T̶i̶n̶k̶e̶r̶e̶r̶ ̶t̶o̶ ̶s̶e̶e̶ ̶i̶f̶ ̶h̶e̶ ̶h̶a̶s̶ ̶a̶ ̶r̶e̶p̶l̶a̶c̶e̶m̶e̶n̶t̶ ̶T̶o̶g̶g̶l̶e̶ ̶C̶h̶i̶p̶\n\nGet the toggle chip back to Tom",
--- [3] = "V̶i̶s̶i̶t̶ ̶t̶h̶e̶ ̶T̶i̶n̶k̶e̶r̶e̶r̶ ̶t̶o̶ ̶s̶e̶e̶ ̶i̶f̶ ̶h̶e̶ ̶h̶a̶s̶ ̶a̶ ̶r̶e̶p̶l̶a̶c̶e̶m̶e̶n̶t̶ ̶T̶o̶g̶g̶l̶e̶ ̶C̶h̶i̶p̶\nG̶e̶t̶ ̶t̶h̶e̶ ̶t̶o̶g̶g̶l̶e̶ ̶c̶h̶i̶p̶ ̶b̶a̶c̶k̶ ̶t̶o̶ ̶T̶o̶m̶\nLooks like the generator is working again!\n(QUEST COMPLETE)"
--- }
---
--- quest.DrawQuestInfo = function(panel,status)
--- print("Drawing quest info!")
--- local label = vgui.Create( "DLabel", panel )
--- --label:Dock(FILL)
--- --label:Dock(BOTTOM)
--- label:SetSize((ScrW() / 4) - 20,(ScrH() / 2) - 50)
--- --label.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Color(0,160,167)) end
--- label:SetWrap(true)
--- label:SetText( questtext[status] )
--- label:SetDark()
--- end
---
--- ART.RegisterQuest(quest)
diff --git a/gamemode/shared/sh_setup.lua b/gamemode/shared/sh_setup.lua
deleted file mode 100644
index fabfdcf..0000000
--- a/gamemode/shared/sh_setup.lua
+++ /dev/null
@@ -1,168 +0,0 @@
--- do return end
--- --[=[
--- --[[
--- Some values that need to be setup by the server owner
--- ]]
---
--- local aes = include("aes.lua")
--- local ECBMode = include("lockbox/ecb.lua")
--- local ZeroPadding = include("lockbox/padding.lua")
--- local Array = include("lockbox/array.lua")
--- local Stream = include("lockbox/stream.lua")
--- print("sh_setup included aes successfully")
---
--- local valuesneeded = {
--- ["mysql DB host"] = "String",
--- ["mysql DB dbname"] = "String",
--- ["mysql DB uname"] = "String",
--- ["mysql DB pass"] = "String",
--- ["mysql should encrypt pass"] = "Bool",
--- ["mysql encrypt password"] = "String",
--- ["world default server ip:port"] = "String",
--- }
---
--- ART.Config = ART.Config or {}
---
--- if SERVER then
--- util.AddNetworkString( "ART_CONFIG_WRITE" )
--- local function ReadConfig(encryptkey)
--- encryptkey = encryptkey or ""
--- local ftext = file.Read("artery/config.txt", "DATA")
--- if ftext == nil then
--- print("Failed to read Config file, if this is a new setup, use art_setup to get started.")
--- return
--- end
--- local tbl = string.Explode("\n",ftext,false)
--- local strtbl = {}
--- for k,v in pairs(tbl) do
--- local ltext = v:Explode(":",false)
--- strtbl[ltext[1]] = ltext[2]
--- end
--- for k,v in pairs(valuesneeded) do
--- local tfunc = "to" .. v:lower()
--- ART.Config[k] = _G[tfunc](strtbl[k])
--- end
--- if ART.Config["mysql should encrypt pass"] then
--- if encryptkey == "" then
--- print("Failed to retrive MySQL database password, please enter it with the \"artery_dbpasswordkey\" command.")
--- return
--- end
--- ART.Config["mysql DB pass"] = aes.decrypt(lockstream.fromString(encryptkey),lockstream.fromString(ART.Config["mysql DB pass"]))
--- end
--- end
---
--- ReadConfig()
---
--- net.Receive( "ART_CONFIG_MYSQLPASS", function(len,ply)
--- if not ply:IsAdmin() then
--- return
--- end
--- end)
---
--- net.Receive( "ART_CONFIG_WRITE", function(len,ply)
--- print("Received write signal")
--- if not ply:IsAdmin() then return end
--- print("You're an admin!")
--- for k,v in pairs(valuesneeded) do
--- local ftype = "Read" .. v
--- ART.Config[k] = net[ftype]()
--- end
--- if ART.Config["mysql should encrypt pass"] then
--- local key = ART.Config["mysql encrypt password"]
--- local block = ART.Config["mysql DB pass"]
--- local akey = Array.fromString(key)
--- local ablock = Array.fromString(block)
--- local skey = Stream.fromString(key)
--- local sblock = Stream.fromString(block)
--- --print("sblock:" .. sblock)
--- --print("skey:" .. skey)
--- local cipher = ECBMode.Cipher().setKey(akey).setBlockCipher(aes).setPadding(ZeroPadding)
--- local ciphertxt = cipher.init().update(sblock).finish().asHex()
--- local decipher = ECBMode.Decipher().setKey(akey).setBlockCipher(aes).setPadding(ZeroPadding)
--- local deciphertxt = decipher.init().update(Stream.fromHex(ciphertxt)).finish().asHex()
--- print("Cyphertext of " .. block .. " is " .. ciphertxt)
--- print("Deciphertext of " .. ciphertxt .. " is " .. deciphertxt)
--- ART.Config["mysql DB pass"] = ciphertxt
--- end
--- local ftext = {}
--- for k,v in pairs(ART.Config) do
--- ftext[#ftext + 1] = k .. "=" .. tostring(v)
--- end
--- local wtext = table.concat(ftext,"\n")
--- print("Writeing:" .. wtext)
--- file.Write("artery/config.txt",wtext)
--- end)
---
--- net.Receive( "ART_CONFIG_REQUEST", function(len,ply)
--- if not ply:IsAdmin() then return end
--- for k,v in pairs(valuesneeded) do
--- local ftype = "Write" .. v
--- print("Calling " .. ftype .. " on " .. tostring(tbl[k]))
--- net[ftype](tbl[k])
--- end
--- end)
--- end
---
--- print("Got to before concommands were added")
---
--- concommand.Add("artery_dbpasswordkey",function()
--- if CLIENT then return end
---
--- end, nil, "Sets the encryption key for the mysql database password")
---
--- if CLIENT then
--- print("Got to before setup command")
---
--- concommand.Add("artery_setup", function(ply,cmd,args)
--- print("setup called")
--- if SERVER then return end
--- print("Got past server gaurd")
--- local width = ScrW()
--- local height = ScrH()
--- local configpanel = vgui.Create( "DFrame" )
--- configpanel:SetPos( 0, height/8 )
--- configpanel:SetSize( width/4, (height/4)*3 )
--- configpanel:SetTitle( "Artery Settings" )
--- configpanel:SetDraggable( true )
--- configpanel:MakePopup()
--- local scrollpanel = vgui.Create( "DScrollPanel", configpanel )
--- scrollpanel:Dock(FILL)
--- local entries = {}
--- for k,v in pairs(valuesneeded) do
--- local settinglabel = vgui.Create( "DLabel", scrollpanel )
--- settinglabel:Dock(TOP)
--- settinglabel:SetText( k )
--- scrollpanel:AddItem(settinglabel)
--- local settingentry
--- if v == "String" then
--- settingentry = vgui.Create( "DTextEntry", scrollpanel )
--- settingentry:SetSize(width/10,18)
--- settingentry:Dock(TOP)
--- elseif v == "Bool" then
--- settingentry = vgui.Create( "DCheckBox", holder)
--- settingentry:Dock(TOP)
--- --settingentry:SetSize(18,18)
--- end
--- scrollpanel:AddItem(settingentry)
--- entries[k] = settingentry
--- end
--- local savebutton = vgui.Create( "DButton",scrollpanel )
--- savebutton.DoClick = function()
--- net.Start( "ART_CONFIG_WRITE")
--- for k,v in pairs(valuesneeded) do
--- local nfunc = "Write"..v
--- local value = nil
--- if v == "String" then value = entries[k]:GetValue()
--- elseif v == "Bool" then value = entries[k]:GetChecked() end
--- assert(value ~= nil, "Didn't know setting type:" .. v .. " for " .. k)
--- print("Doing " .. nfunc .. " on " .. tostring(value))
--- net[nfunc](value)
--- end
--- net.SendToServer()
--- end
--- savebutton:SetText("Save config")
--- savebutton:Dock(TOP)
--- scrollpanel:AddItem(savebutton)
--- end)
--- end
--- ]=]
diff --git a/gamemode/shared/shop.lua b/gamemode/shared/shop.lua
deleted file mode 100644
index ecb8e71..0000000
--- a/gamemode/shared/shop.lua
+++ /dev/null
@@ -1,175 +0,0 @@
--- do return end
--- --[[
--- Displays shop npc's interfaces
---
--- public functions:
--- (sv)ART.OpenShop(shoptbl, ply) :: nil
--- (sv)ART.CreateShop(npctbl) :: nil
--- net messages:
--- art_openshop
--- ]]
---
--- local ivf = include("inventory_common.lua")
--- ART = ART or {}
---
--- if SERVER then
--- for k,v in pairs({
--- "art_openshop",
--- "art_buyitem",
--- "art_sellitem",
--- }) do
--- util.AddNetworkString(v)
--- end
---
--- function ART.OpenShop(tbl, ply)
--- print("Called openshop!")
--- print("tbl was")
--- PrintTable(tbl)
--- if CLIENT then return end
--- net.Start("art_openshop")
--- net.WriteTable(tbl)
--- net.Send(ply)
--- end
---
--- function ART.CreateShop(npc)
--- print("Createing shop npc")
--- local npcent = ents.Create("npc_shop")
--- for k,v in pairs(npc) do
--- npcent[k] = v
--- end
--- npcent:Spawn()
--- print("Called spawn")
--- end
---
--- end
---
--- if SERVER then return end
--- local w,h = ScrW(),ScrH()
--- local function DrawShopItemOnDPanel(dp,itemtbl,cost)
--- --An item is a string, and int cost
---
--- local shape = itemtbl.Shape
--- local twidth,theight = 0,#shape
--- for k=1,#shape do
--- twidth = math.max(twidth,#shape[k])
--- end
---
--- local slotsize = math.Round(w / 32)
--- local backgrid = vgui.Create( "DGrid", dp )
--- backgrid:SetPos( 10, 30 )
--- backgrid:SetCols( twidth )
--- backgrid:SetColWide( theight )
--- backgrid:Dock(LEFT)
---
--- local shopicon = vgui.Create( "DImageButton", dp )
--- shopicon:SetSize(slotsize * twidth, slotsize * theight)
--- shopicon:SetPos(0,0)
--- shopicon:SetText(itemtbl.Name)
--- if itemtbl.Tooltip then
--- shopicon:SetTooltip(itemtbl.Tooltip)
--- end
--- if itemtbl.Paint then
--- shopicon.Paint = itemtbl.Paint
--- end
--- if itemtbl.DoOnPanel then
--- itemtbl.DoOnPanel(shopicon)
--- end
--- shopicon.Paint = function(self, w, h)
--- surface.SetDrawColor( 0, 0, 0, 255 )
--- surface.DrawOutlinedRect( 0, 0, w, h)
--- end
--- shopicon.DoClick = function()
--- print("You cliked me!")
--- end
--- shopicon.Item = itemtbl
--- shopicon.Cost = cost
--- shopicon:Droppable("Inventory")
--- shopicon.ondropped = function(back,j,i,item)
--- print("ondropped was called!")
--- print("back",back,"j",j,"i",i,"item",item)
--- PrintTable(item)
--- net.Start("buyitem")
--- net.WriteString(item.Name)
--- net.WriteUInt(back,8)
--- net.WriteUInt(j,8)
--- net.WriteUInt(i,8)
--- net.SendToServer()
--- end
---
--- print("Displaying shape:")
--- PrintTable(shape)
--- for k = 1, twidth do
--- for i = 1, theight do
--- if not shape[k][i] then
--- print("Found false spot:",k,i)
--- local emptyslot = vgui.Create("DPanel", dp)
--- emptyslot:SetSize(slotsize,slotsize)
--- emptyslot:SetPos(slotsize * (i - 1) + 2, slotsize * (k - 1) + 2)
--- end
--- end
--- end
---
--- end
---
--- local slotsize = math.Round(w / 32)
---
--- local function DrawShopOnDPanel(dp,items)
--- --This gets pretty involved, lets try to not make it a clusterfuck.
--- dp.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(100,0,0)) end
--- print("dp",dp)
--- local scrollpanel = vgui.Create( "DScrollPanel",dp )
--- print("scollpanel",scrollpanel)
--- scrollpanel.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,0,100)) end
--- scrollpanel:Dock(FILL)
--- for k,v in pairs(items) do
--- local itemtbl = ART.GetItemByName(v[1])
--- local invpanel = vgui.Create( "DPanel", scollpanel)
--- invpanel.Paint = function(self, w, h)
--- draw.RoundedBox(4, 1,1,w-4,h-4,Color(50,50,50))
--- draw.RoundedBox(4, 2,2,w-5,h-5,Color(100,100,100))
--- end
--- print("invpanel",invpanel)
--- DrawShopItemOnDPanel(invpanel,itemtbl,v[2])
--- scrollpanel:AddItem(invpanel)
--- invpanel:Dock(TOP)
--- local x,_ = invpanel:GetSize()
--- print("item is",v)
--- PrintTable(v)
--- invpanel:SetSize(x,slotsize*(#itemtbl.Shape) + 4)
--- invpanel:Dock(TOP)
---
--- end
---
--- end
---
--- local shopwindow,shoppanel
---
--- local function createshopwindow()
--- print("Createing shopwindow")
--- shopwindow = vgui.Create( "DFrame" )
--- shopwindow:SetPos( w - (w / 4), 0 )
--- shopwindow:SetSize( w / 4, h )
--- shopwindow:SetTitle( "Unset shop" )
--- shopwindow:SetDraggable( true )
--- shopwindow.OnClose = function(self)
--- self:SetVisible(false)
--- print("After onclose, shopwindow was",shopwindow)
--- end
--- shopwindow:SetVisible(false)
---
--- shoppanel = vgui.Create( "DPanel",shopwindow)
--- shoppanel:SetPos( 10, 30 ) -- Set the position of the panel
--- shoppanel:Dock(FILL)
--- end
--- createshopwindow()
---
--- net.Receive("art_openshop",function()
--- print("shopwindows was ",shopwindow)
--- if not shopwindow:IsValid() then createshopwindow() end
--- assert(shopwindow,"Shopwindow was not created, even after re-createing!")
--- ShowInventory()
--- shopwindow:SetVisible(true)
--- local stock = net.ReadTable()
--- DrawShopOnDPanel(shoppanel,stock)
--- shopwindow:MakePopup()
--- end)