aboutsummaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-08-24 20:32:34 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-08-24 20:32:34 -0400
commit233e478e40d72a091f70f18dc6846066a4f52016 (patch)
treecf34be714088889731736c81bd44e198c792625a /gamemode
parent61bc16dae5a1b61bcd237d9f0be36125829d95b1 (diff)
downloadartery-233e478e40d72a091f70f18dc6846066a4f52016.tar.gz
artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.bz2
artery-233e478e40d72a091f70f18dc6846066a4f52016.zip
Fix all linter warnings
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/autolua.lua2
-rw-r--r--gamemode/client/cl_inventory.lua8
-rw-r--r--gamemode/client/cl_weaponswitch.lua2
-rw-r--r--gamemode/client/hud/cl_svgtest.lua92
-rw-r--r--gamemode/client/qpanels/inventory.lua388
-rw-r--r--gamemode/client/qpanels/prayers.lua340
-rw-r--r--gamemode/client/qpanels/quests.lua62
-rw-r--r--gamemode/client/qpanels/skills.lua20
-rw-r--r--gamemode/client/qtabs/cl_qinventory.lua4
-rw-r--r--gamemode/config/sv_newplayer.lua2
-rw-r--r--gamemode/core/combat/cl_damage.lua39
-rw-r--r--gamemode/core/combat/cl_weaponswing.lua5
-rw-r--r--gamemode/core/combat/sv_weaponswing.lua30
-rw-r--r--gamemode/core/database/sv_setup.lua26
-rw-r--r--gamemode/core/dataloader/sv_loadglobals.lua12
-rw-r--r--gamemode/core/inventory/common/items.lua20
-rw-r--r--gamemode/core/inventory/common/weapons.lua4
-rw-r--r--gamemode/core/inventory/sv_invtracker.lua18
-rw-r--r--gamemode/core/npc/cl_npcmap.lua124
-rw-r--r--gamemode/core/npc/cl_shop.lua2
-rw-r--r--gamemode/core/npc/sv_huntingspawner.lua20
-rw-r--r--gamemode/core/npc/sv_npcsystem.lua24
-rw-r--r--gamemode/core/npc/sv_shop.lua18
-rw-r--r--gamemode/core/pac/cl_pac.lua4
-rw-r--r--gamemode/core/pac/sv_pac.lua2
-rw-r--r--gamemode/inventorysystem/cl_common.lua4
-rw-r--r--gamemode/inventorysystem/equipment/cl_equipment.lua2
-rw-r--r--gamemode/inventorysystem/equipment/sh_equipment.lua4
-rw-r--r--gamemode/inventorysystem/shapedinventory/sh_shaped.lua2
-rw-r--r--gamemode/itemsystem/armor/balaclava.lua162
-rw-r--r--gamemode/itemsystem/foodstuffs/ratmeat.lua94
-rw-r--r--gamemode/itemsystem/foodstuffs/watermelon.lua124
-rw-r--r--gamemode/itemsystem/item_common.lua5
-rw-r--r--gamemode/itemsystem/quest/rougebadge.lua78
-rw-r--r--gamemode/itemsystem/quest/rougebook.lua138
-rw-r--r--gamemode/itemsystem/quest/togglechip.lua50
-rw-r--r--gamemode/itemsystem/scrapgun.lua122
-rw-r--r--gamemode/itemsystem/utility/flashlight.lua178
-rw-r--r--gamemode/itemsystem/weapons/knuckledclaw.lua328
-rw-r--r--gamemode/itemsystem/weapons/rustyaxe.lua544
-rw-r--r--gamemode/itemsystem/weapons/scraphammer.lua406
-rw-r--r--gamemode/itemsystem/weapons/seratedknife.lua400
-rw-r--r--gamemode/itemsystem/weapons_common.lua142
-rw-r--r--gamemode/npcsystem/sv_zombie.lua30
-rw-r--r--gamemode/nrequire.lua10
-rw-r--r--gamemode/server/heatmap.lua48
-rw-r--r--gamemode/server/sv_config.lua38
-rw-r--r--gamemode/server/sv_mapchange.lua10
-rw-r--r--gamemode/server/sv_mapconfig.lua136
-rw-r--r--gamemode/shared/inventory.lua798
-rw-r--r--gamemode/shared/inventory_common.lua386
-rw-r--r--gamemode/shared/loaditems.lua122
-rw-r--r--gamemode/shared/loadnpcs.lua78
-rw-r--r--gamemode/shared/loadprayers.lua246
-rw-r--r--gamemode/shared/prayersystem/prayers/lesserevasion.lua132
-rw-r--r--gamemode/shared/prayersystem/prayers/ninelives.lua100
-rw-r--r--gamemode/shared/prayersystem/prayers/notdarkrp.lua154
-rw-r--r--gamemode/shared/prayersystem/prayers/preditorinstinct.lua136
-rw-r--r--gamemode/shared/prayersystem/prayers/thickskin.lua120
-rw-r--r--gamemode/shared/questsystem/examplequest.lua28
-rw-r--r--gamemode/shared/questsystem/subterr_generator.lua50
-rw-r--r--gamemode/shared/sh_setup.lua336
-rw-r--r--gamemode/shared/shop.lua350
-rw-r--r--gamemode/shared/sparkel.lua9
-rw-r--r--gamemode/utility/fuzzel.lua4
-rw-r--r--gamemode/utility/mapfuncs.lua4
-rw-r--r--gamemode/utility/stream.lua14
67 files changed, 3692 insertions, 3698 deletions
diff --git a/gamemode/autolua.lua b/gamemode/autolua.lua
index c17ae3b..e38a107 100644
--- a/gamemode/autolua.lua
+++ b/gamemode/autolua.lua
@@ -33,7 +33,7 @@ end
auto.AddMixedFolder = function(dir,recursive)
ExecuteOnFolder(dir,recursive,function(f)
- print("Doing file"..f)
+ print("Doing file" .. f)
if f:find("/cl_%w+%.lua$") then
print("found cl")
if SERVER then AddCSLuaFile(f) else include(f) end
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua
index c5725dc..92eae94 100644
--- a/gamemode/client/cl_inventory.lua
+++ b/gamemode/client/cl_inventory.lua
@@ -71,15 +71,15 @@ local function BuildInventory()
droppanel:Hide()
return
end
-
+
creditslabel = vgui.Create("DLabel",qframe)
creditslabel:SetText(credits)
creditslabel:SetPos(150,5)
-
+
local creditstext = vgui.Create("DLabel",qframe)
creditstext:SetText("Credits:")
creditstext:SetPos(100,5)
-
+
inv.tabsheet = vgui.Create("DPropertySheet",qframe)
inv.tabsheet:Dock(FILL)
@@ -112,7 +112,7 @@ function inv.ShowInventory()
local froment = panels[1].info.owner
local fromid = panels[1].info.id
local frompos = panels[1].info.pos
- local frominv = panels[1].info.inv
+ --local frominv = panels[1].info.inv
itm.DropItem(froment,fromid,frompos)
end,{})
end
diff --git a/gamemode/client/cl_weaponswitch.lua b/gamemode/client/cl_weaponswitch.lua
index 085a0b3..2f681c9 100644
--- a/gamemode/client/cl_weaponswitch.lua
+++ b/gamemode/client/cl_weaponswitch.lua
@@ -5,5 +5,5 @@ function gm:PlayerSwitchWeapon( ply, oldWeapon, newWeapon )
end
hook.Add( "HUDShouldDraw", "HideWeaponSelHUD", function( name )
- if name == "CHudWeaponSelection" then return false end
+ if name == "CHudWeaponSelection" then return false end
end )
diff --git a/gamemode/client/hud/cl_svgtest.lua b/gamemode/client/hud/cl_svgtest.lua
index baeb698..9a55c8c 100644
--- a/gamemode/client/hud/cl_svgtest.lua
+++ b/gamemode/client/hud/cl_svgtest.lua
@@ -1,46 +1,46 @@
-do return end
-local svg = nrequire("cl_svg.lua")
-local mats = {}
-local matstrs = {}
-for i = 2,10 do
- for _,t in pairs({"clubs","diamonds","hearts","spades"}) do
- matstrs[#matstrs + 1] = string.format( "materials/svg/aussiesim/cards/svg/000000/transparent/card-%d-%s.svg",i,t)
- end
-end
-
-for k,v in pairs(matstrs) do
- mats[k] = file.Read(v,"GAME")
-end
-local truemats = {}
-for k,v in pairs(matstrs) do
- truemats[k] = svg.MaterialFromSVG(v)
-end
---local parsed = xmlparser:parse(matstr)
-local htmls = {}
-local nx = ScrW()/64
-local ny = ScrH()/64
-for x = 1,nx do
- for y = 1,ny do
- local thtml = vgui.Create("DSprite") --svg.SvgOnDpanel("materials/svg/aussiesim/cards/svg/000000/transparent/card-2-clubs.svg")
- thtml:SetSize(64,64)
- thtml:SetPos(x * 64,y * 64)
- htmls[y * nx + x] = thtml
- end
-end
-
-hook.Add("HUDPaint","paint_svg",function()
- --local randommat = table.Random(matstrs)
- --html:RunJavascript( string.format("document.body.innerHTML = 'HTML changed from Lua using JavaScript!';"" )
- --[[
- for k,v in pairs(htmls) do
- v:UpdateImage(randommat)
- end
- ]]
-
- for k,v in pairs(htmls) do
- local randommat = table.Random(truemats)
- if randommat.material then
- v:SetMaterial(randommat.material)
- end
- end
-end)
+-- do return end
+-- local svg = nrequire("cl_svg.lua")
+-- local mats = {}
+-- local matstrs = {}
+-- for i = 2,10 do
+-- for _,t in pairs({"clubs","diamonds","hearts","spades"}) do
+-- matstrs[#matstrs + 1] = string.format( "materials/svg/aussiesim/cards/svg/000000/transparent/card-%d-%s.svg",i,t)
+-- end
+-- end
+--
+-- for k,v in pairs(matstrs) do
+-- mats[k] = file.Read(v,"GAME")
+-- end
+-- local truemats = {}
+-- for k,v in pairs(matstrs) do
+-- truemats[k] = svg.MaterialFromSVG(v)
+-- end
+-- --local parsed = xmlparser:parse(matstr)
+-- local htmls = {}
+-- local nx = ScrW()/64
+-- local ny = ScrH()/64
+-- for x = 1,nx do
+-- for y = 1,ny do
+-- local thtml = vgui.Create("DSprite") --svg.SvgOnDpanel("materials/svg/aussiesim/cards/svg/000000/transparent/card-2-clubs.svg")
+-- thtml:SetSize(64,64)
+-- thtml:SetPos(x * 64,y * 64)
+-- htmls[y * nx + x] = thtml
+-- end
+-- end
+--
+-- hook.Add("HUDPaint","paint_svg",function()
+-- --local randommat = table.Random(matstrs)
+-- --html:RunJavascript( string.format("document.body.innerHTML = 'HTML changed from Lua using JavaScript!';"" )
+-- --[[
+-- for k,v in pairs(htmls) do
+-- v:UpdateImage(randommat)
+-- end
+-- ]]
+--
+-- for k,v in pairs(htmls) do
+-- local randommat = table.Random(truemats)
+-- if randommat.material then
+-- v:SetMaterial(randommat.material)
+-- end
+-- end
+-- end)
diff --git a/gamemode/client/qpanels/inventory.lua b/gamemode/client/qpanels/inventory.lua
index b93fd7f..4dc5075 100644
--- a/gamemode/client/qpanels/inventory.lua
+++ b/gamemode/client/qpanels/inventory.lua
@@ -1,194 +1,194 @@
-do return end
-local invfuncs
-invfuncs = ART.invfuncs
---invfuncs = include("../gamemodes/artery/gamemode/shared/inventory_common.lua")
---invfuncs = include("../shared/inventory_common.lua")
-assert(invfuncs ~= nil, "Dependency failed")
-
-local function createMenuFor(menu, tbl)
- for k,v in pairs(tbl) do
- if isfunction(v) then --This is a dead-end, add the menu
- local thisoption = menu:AddOption(k,v)
- else --Otherwise it should be a table, recursively call to create
- local submenu = menu:AddSubMenu(k)
- createMenuFor(submenu,v)
- end
- end
-end
-
-local function DrawBackpackOnDPanel(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( "DImageButton", 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
- if item.Paint then
- invicon.Paint = item.Paint
- end
- if item.DoOnPanel then
- item.DoOnPanel(invicon)
- 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
- local ondropped = icon.ondropped
- if ondropped then
- ondropped(backpacknum,j,i,item)
- elseif 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
-
-local invsheetfunc = function()
- local width = ScrW()
- local height = ScrH()
-
-
- local invsheet = vgui.Create( "DPanel" )
-
- invsheet.Paint = function( self, w, h ) end
-
- --Display gear
- local slotsize = math.Round(width / 32)
- local displaypos = {
- ["Head"] = {(width / 8) - slotsize, 25},
- ["Body"] = {(width / 8) - slotsize, slotsize + 26},
- ["Legs"] = {(width / 8) - slotsize, (slotsize * 2) + 27},
- ["Boots"] = {(width / 8) - slotsize, (slotsize * 3) + 28},
- ["Gloves"] = {(width / 8) + (slotsize), (slotsize * 2) + 27},
- ["Left"] = {(width / 8) - (1.5 * slotsize), (slotsize * 4) + 29},
- ["Right"] = {(width / 8) - (0.5 * slotsize), (slotsize * 4) + 29}
- }
- for k,v in pairs (LocalPlayer().Inventory.Equiped) do
- if v == false then
- local eqslot = vgui.Create( "DPanel", invsheet )
- eqslot:SetSize( slotsize, slotsize )
- eqslot:SetPos(displaypos[k][1],displaypos[k][2])
- eqslot:Receiver( "Inventory", function( receiver, tableOfDroppedPanels, isDropped, menuIndex, mouseX, mouseY )
- if not isDropped then return end
- print("Attempting to equip")
- local icon = tableOfDroppedPanels[1]
- local item = icon.Item
- if item.Equipable == k then
- net.Start("equipitem")
- net.WriteUInt(icon.backpacknum,16) -- Backpack number
- local fromtbl = icon.invpos
- net.WriteUInt(fromtbl[1],16) -- From position
- net.WriteUInt(fromtbl[2],16)
- net.WriteString(k)
- net.SendToServer()
- end
- end, {} )
- else
- local eqslot = vgui.Create("DImageButton",invsheet)
- eqslot:SetSize(slotsize,slotsize)
- eqslot:SetPos(displaypos[k][1],displaypos[k][2])
- if v.PaintEquiped then
- eqslot.Paint = v.PaintEquiped
- end
- if v.DoOnEquipPanel then
- v.DoOnEquipPanel(eqslot)
- end
- eqslot:Droppable("Inventory")
- eqslot.Item = v
- eqslot.wasequiped = k
- end
- end
- local moneylabel = vgui.Create("DLabel",invsheet)
- moneylabel:SetPos(0,0)
- moneylabel:SetSize(width/5,18)
- moneylabel:SetText(string.format("Credits:%7d", ART.Credits or 0))
- print("Displaying credits:" .. string.format("Credits:%7d", ART.Credits or 0))
-
- local backpacksheet = vgui.Create( "DPropertySheet", invsheet )
- backpacksheet:SetPos(0,slotsize * 6)
- backpacksheet:SetSize((width / 4) - 26, height - (slotsize * 6) - 70)
- for k,v in pairs(LocalPlayer().Inventory.Backpacks) do
- local tbacksheet = vgui.Create( "DPanel", backpacksheet )
- tbacksheet.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 157, 160, 167 ) ) end
- backpacksheet:AddSheet( v[3], tbacksheet, "icon16/cross.png" )
-
- DrawBackpackOnDPanel(tbacksheet,v,k,LocalPlayer())
- end
-
- return "Inventory", invsheet, "icon16/cross.png"
-end
-
-
-ART.RegisterInventorySheet(invsheetfunc)
+-- do return end
+-- local invfuncs
+-- invfuncs = ART.invfuncs
+-- --invfuncs = include("../gamemodes/artery/gamemode/shared/inventory_common.lua")
+-- --invfuncs = include("../shared/inventory_common.lua")
+-- assert(invfuncs ~= nil, "Dependency failed")
+--
+-- local function createMenuFor(menu, tbl)
+-- for k,v in pairs(tbl) do
+-- if isfunction(v) then --This is a dead-end, add the menu
+-- local thisoption = menu:AddOption(k,v)
+-- else --Otherwise it should be a table, recursively call to create
+-- local submenu = menu:AddSubMenu(k)
+-- createMenuFor(submenu,v)
+-- end
+-- end
+-- end
+--
+-- local function DrawBackpackOnDPanel(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( "DImageButton", 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
+-- if item.Paint then
+-- invicon.Paint = item.Paint
+-- end
+-- if item.DoOnPanel then
+-- item.DoOnPanel(invicon)
+-- 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
+-- local ondropped = icon.ondropped
+-- if ondropped then
+-- ondropped(backpacknum,j,i,item)
+-- elseif 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
+--
+-- local invsheetfunc = function()
+-- local width = ScrW()
+-- local height = ScrH()
+--
+--
+-- local invsheet = vgui.Create( "DPanel" )
+--
+-- invsheet.Paint = function( self, w, h ) end
+--
+-- --Display gear
+-- local slotsize = math.Round(width / 32)
+-- local displaypos = {
+-- ["Head"] = {(width / 8) - slotsize, 25},
+-- ["Body"] = {(width / 8) - slotsize, slotsize + 26},
+-- ["Legs"] = {(width / 8) - slotsize, (slotsize * 2) + 27},
+-- ["Boots"] = {(width / 8) - slotsize, (slotsize * 3) + 28},
+-- ["Gloves"] = {(width / 8) + (slotsize), (slotsize * 2) + 27},
+-- ["Left"] = {(width / 8) - (1.5 * slotsize), (slotsize * 4) + 29},
+-- ["Right"] = {(width / 8) - (0.5 * slotsize), (slotsize * 4) + 29}
+-- }
+-- for k,v in pairs (LocalPlayer().Inventory.Equiped) do
+-- if v == false then
+-- local eqslot = vgui.Create( "DPanel", invsheet )
+-- eqslot:SetSize( slotsize, slotsize )
+-- eqslot:SetPos(displaypos[k][1],displaypos[k][2])
+-- eqslot:Receiver( "Inventory", function( receiver, tableOfDroppedPanels, isDropped, menuIndex, mouseX, mouseY )
+-- if not isDropped then return end
+-- print("Attempting to equip")
+-- local icon = tableOfDroppedPanels[1]
+-- local item = icon.Item
+-- if item.Equipable == k then
+-- net.Start("equipitem")
+-- net.WriteUInt(icon.backpacknum,16) -- Backpack number
+-- local fromtbl = icon.invpos
+-- net.WriteUInt(fromtbl[1],16) -- From position
+-- net.WriteUInt(fromtbl[2],16)
+-- net.WriteString(k)
+-- net.SendToServer()
+-- end
+-- end, {} )
+-- else
+-- local eqslot = vgui.Create("DImageButton",invsheet)
+-- eqslot:SetSize(slotsize,slotsize)
+-- eqslot:SetPos(displaypos[k][1],displaypos[k][2])
+-- if v.PaintEquiped then
+-- eqslot.Paint = v.PaintEquiped
+-- end
+-- if v.DoOnEquipPanel then
+-- v.DoOnEquipPanel(eqslot)
+-- end
+-- eqslot:Droppable("Inventory")
+-- eqslot.Item = v
+-- eqslot.wasequiped = k
+-- end
+-- end
+-- local moneylabel = vgui.Create("DLabel",invsheet)
+-- moneylabel:SetPos(0,0)
+-- moneylabel:SetSize(width/5,18)
+-- moneylabel:SetText(string.format("Credits:%7d", ART.Credits or 0))
+-- print("Displaying credits:" .. string.format("Credits:%7d", ART.Credits or 0))
+--
+-- local backpacksheet = vgui.Create( "DPropertySheet", invsheet )
+-- backpacksheet:SetPos(0,slotsize * 6)
+-- backpacksheet:SetSize((width / 4) - 26, height - (slotsize * 6) - 70)
+-- for k,v in pairs(LocalPlayer().Inventory.Backpacks) do
+-- local tbacksheet = vgui.Create( "DPanel", backpacksheet )
+-- tbacksheet.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 157, 160, 167 ) ) end
+-- backpacksheet:AddSheet( v[3], tbacksheet, "icon16/cross.png" )
+--
+-- DrawBackpackOnDPanel(tbacksheet,v,k,LocalPlayer())
+-- end
+--
+-- return "Inventory", invsheet, "icon16/cross.png"
+-- end
+--
+--
+-- ART.RegisterInventorySheet(invsheetfunc)
diff --git a/gamemode/client/qpanels/prayers.lua b/gamemode/client/qpanels/prayers.lua
index cdcb742..674d5d8 100644
--- a/gamemode/client/qpanels/prayers.lua
+++ b/gamemode/client/qpanels/prayers.lua
@@ -1,170 +1,170 @@
-do return end
-local refreshboundprayers
-local infopart
-local prayersheet
-
-local function displaydefaulthelp(panel)
- local ll = vgui.Create("DLabel",panel)
- ll:Dock(FILL)
- ll:SetWrap(true)
- ll:SetDark(true)
- ll:SetText("Oh no! It looks like this dosen't have any help text yet!")
-end
-
-local function createprayericon(parrent,prayer,equiped,place)
-
- local width = ScrW()
- local height = ScrH()
-
- local ret = vgui.Create("DButton",parrent)
- ret:SetText(prayer)
- ret:SetWrap(true)
- ret:SetSize(64,64)
- local prayertbl = ART.GetPrayerByName(prayer)
- assert(prayertbl ~= nil, "Could not find an appropriate prayer!")
- if prayertbl.Paint then
- ret.Paint = prayertbl.Paint
- end
- if prayertbl.DoOnPanel then
- prayertbl.DoOnPanel(ret)
- end
- if equiped then
- ret.DoClick = function(self)
- self:Remove()
- ART.PrayerEquiped[place] = false
- refreshboundprayers()
- infopart:Remove()
- infopart = vgui.Create("DPanel")
- infopart:SetSize( (width / 4) - 10, height / 3)
- infopart:SetPos(0, height * 2 / 3)
- prayersheet:Add(infopart)
- end
- else
- ret:Droppable("PrayerBind")
- ret.PrayerName = prayer
- ret:SetSize(64,64)
- ret.DoClick = function(self)
- infopart:Remove()
- infopart = vgui.Create("DPanel")
- infopart:SetSize( (width / 4) - 10, height / 3)
- prayersheet:Add(infopart)
- local rettbl = ART.GetPrayerByName(prayer)
- if rettbl.DisplayHelp ~= nil then
- rettbl.DisplayHelp(infopart)
- else
- displaydefaulthelp(infopart)
- end
- end
- end
- return ret
-end
-
-local function createreceiver(parrent,num)
- local prayerbut = vgui.Create( "DPanel", parrent )
- local prayerlabel = vgui.Create("DLabel",prayerbut)
- prayerlabel:SetText( "F" .. num )
- prayerlabel.Paint = function( self, w, h ) end
- prayerlabel:SetWrap(true)
- prayerlabel:SetDark(true)
- prayerlabel:Dock(FILL)
- prayerbut:Dock(FILL)
- prayerbut:Receiver( "PrayerBind", function( self, tableOfDroppedPanels, isDropped, menuIndex, mouseX, mouseY )
- if not isDropped then return end
- local pname = tableOfDroppedPanels[1].PrayerName
- print("Prayer name:")
- print(pname)
- ART.PrayerEquiped[num] = pname
- print("Prayer bound to " .. num)
- prayerbut:Remove()
- createprayericon(parrent,pname,true,num)
- end)
-end
-
-local function displayboundprayers(panel)
-
- local width = ScrW()
- local height = ScrH()
-
- local prayerbindgrid = nil
-
- refreshboundprayers = function()
-
- if prayerbindgrid ~= nil then prayerbindgrid:Remove() end
-
- prayerbindgrid = vgui.Create("DGrid")
- prayerbindgrid:SetPos(height * (2 / 3),5)
- prayerbindgrid:SetSize((width / 4) - 20, height / 3)
- prayerbindgrid:SetColWide(64)
- prayerbindgrid:SetRowHeight(64)
- function prayerbindgrid:Paint(w,h)
- draw.RoundedBox( 8, 0, 0, w, h, Color( 0, 255, 0 ) )
- end
-
- for k,v in pairs(ART.PrayerEquiped) do
- local but = vgui.Create( "DPanel", prayerbindgrid )
- but:SetSize(64, 64)
- if v ~= false then
- createprayericon(but,v,true,k)
- else
- createreceiver(but,k)
- end
- prayerbindgrid:AddItem(but)
- end
- panel:Add(prayerbindgrid)
- end
- refreshboundprayers()
-end
-
-ART.RegisterInventorySheet(function()
-
- local width = ScrW()
- local height = ScrH()
-
- prayersheet = vgui.Create( "DListLayout")
-
- local prayergridscroll = vgui.Create("DScrollPanel")
- prayergridscroll:SetSize( (width / 4) - 20, height / 3 )
- prayergridscroll:SetPos( 5, 5 )
- prayersheet:Add(prayergridscroll)
- local prayergrid = vgui.Create( "DGrid", prayergridscroll )
- prayergrid:SetPos( 5 , 5 )
- prayergrid:Dock(FILL)
-
- prayergrid:SetCols( (width / 4) / 64 )
- prayergrid:SetColWide( 64 )
- prayergrid:SetRowHeight(64)
- prayergridscroll:AddItem(prayergrid)
-
- for k,v in pairs(ART.MyPrayer) do
- print("Displaying prayer:" .. k)
- print("Type:" .. type(k))
- if k == "" then
- ART.MyPrayer[k] = nil
- end
- local but = createprayericon(prayergrid,k,false,nil)
- prayergrid:AddItem(but)
- end
-
- displayboundprayers(prayersheet)
-
- infopart = vgui.Create("DPanel")
- infopart:SetSize( (width / 4) - 10, height / 3)
- infopart:SetPos(0, height * 2 / 3)
- prayersheet:Add(infopart)
-
- return "Prayers", prayersheet, "icon16/tick.png"
-end)
-
-hook.Add("Think","art_prayer_keybinds",function()
- local mapping = {
- KEY_F1,
- KEY_F2,
- KEY_F3,
- KEY_F4,
- }
- for k,v in pairs(mapping) do
- if input.IsKeyDown(v) and ART.PrayerEquiped[k] then
- ART.GetPrayerByName(ART.PrayerEquiped[k]).Pray()
- end
- end
-end)
+-- do return end
+-- local refreshboundprayers
+-- local infopart
+-- local prayersheet
+--
+-- local function displaydefaulthelp(panel)
+-- local ll = vgui.Create("DLabel",panel)
+-- ll:Dock(FILL)
+-- ll:SetWrap(true)
+-- ll:SetDark(true)
+-- ll:SetText("Oh no! It looks like this dosen't have any help text yet!")
+-- end
+--
+-- local function createprayericon(parrent,prayer,equiped,place)
+--
+-- local width = ScrW()
+-- local height = ScrH()
+--
+-- local ret = vgui.Create("DButton",parrent)
+-- ret:SetText(prayer)
+-- ret:SetWrap(true)
+-- ret:SetSize(64,64)
+-- local prayertbl = ART.GetPrayerByName(prayer)
+-- assert(prayertbl ~= nil, "Could not find an appropriate prayer!")
+-- if prayertbl.Paint then
+-- ret.Paint = prayertbl.Paint
+-- end
+-- if prayertbl.DoOnPanel then
+-- prayertbl.DoOnPanel(ret)
+-- end
+-- if equiped then
+-- ret.DoClick = function(self)
+-- self:Remove()
+-- ART.PrayerEquiped[place] = false
+-- refreshboundprayers()
+-- infopart:Remove()
+-- infopart = vgui.Create("DPanel")
+-- infopart:SetSize( (width / 4) - 10, height / 3)
+-- infopart:SetPos(0, height * 2 / 3)
+-- prayersheet:Add(infopart)
+-- end
+-- else
+-- ret:Droppable("PrayerBind")
+-- ret.PrayerName = prayer
+-- ret:SetSize(64,64)
+-- ret.DoClick = function(self)
+-- infopart:Remove()
+-- infopart = vgui.Create("DPanel")
+-- infopart:SetSize( (width / 4) - 10, height / 3)
+-- prayersheet:Add(infopart)
+-- local rettbl = ART.GetPrayerByName(prayer)
+-- if rettbl.DisplayHelp ~= nil then
+-- rettbl.DisplayHelp(infopart)
+-- else
+-- displaydefaulthelp(infopart)
+-- end
+-- end
+-- end
+-- return ret
+-- end
+--
+-- local function createreceiver(parrent,num)
+-- local prayerbut = vgui.Create( "DPanel", parrent )
+-- local prayerlabel = vgui.Create("DLabel",prayerbut)
+-- prayerlabel:SetText( "F" .. num )
+-- prayerlabel.Paint = function( self, w, h ) end
+-- prayerlabel:SetWrap(true)
+-- prayerlabel:SetDark(true)
+-- prayerlabel:Dock(FILL)
+-- prayerbut:Dock(FILL)
+-- prayerbut:Receiver( "PrayerBind", function( self, tableOfDroppedPanels, isDropped, menuIndex, mouseX, mouseY )
+-- if not isDropped then return end
+-- local pname = tableOfDroppedPanels[1].PrayerName
+-- print("Prayer name:")
+-- print(pname)
+-- ART.PrayerEquiped[num] = pname
+-- print("Prayer bound to " .. num)
+-- prayerbut:Remove()
+-- createprayericon(parrent,pname,true,num)
+-- end)
+-- end
+--
+-- local function displayboundprayers(panel)
+--
+-- local width = ScrW()
+-- local height = ScrH()
+--
+-- local prayerbindgrid = nil
+--
+-- refreshboundprayers = function()
+--
+-- if prayerbindgrid ~= nil then prayerbindgrid:Remove() end
+--
+-- prayerbindgrid = vgui.Create("DGrid")
+-- prayerbindgrid:SetPos(height * (2 / 3),5)
+-- prayerbindgrid:SetSize((width / 4) - 20, height / 3)
+-- prayerbindgrid:SetColWide(64)
+-- prayerbindgrid:SetRowHeight(64)
+-- function prayerbindgrid:Paint(w,h)
+-- draw.RoundedBox( 8, 0, 0, w, h, Color( 0, 255, 0 ) )
+-- end
+--
+-- for k,v in pairs(ART.PrayerEquiped) do
+-- local but = vgui.Create( "DPanel", prayerbindgrid )
+-- but:SetSize(64, 64)
+-- if v ~= false then
+-- createprayericon(but,v,true,k)
+-- else
+-- createreceiver(but,k)
+-- end
+-- prayerbindgrid:AddItem(but)
+-- end
+-- panel:Add(prayerbindgrid)
+-- end
+-- refreshboundprayers()
+-- end
+--
+-- ART.RegisterInventorySheet(function()
+--
+-- local width = ScrW()
+-- local height = ScrH()
+--
+-- prayersheet = vgui.Create( "DListLayout")
+--
+-- local prayergridscroll = vgui.Create("DScrollPanel")
+-- prayergridscroll:SetSize( (width / 4) - 20, height / 3 )
+-- prayergridscroll:SetPos( 5, 5 )
+-- prayersheet:Add(prayergridscroll)
+-- local prayergrid = vgui.Create( "DGrid", prayergridscroll )
+-- prayergrid:SetPos( 5 , 5 )
+-- prayergrid:Dock(FILL)
+--
+-- prayergrid:SetCols( (width / 4) / 64 )
+-- prayergrid:SetColWide( 64 )
+-- prayergrid:SetRowHeight(64)
+-- prayergridscroll:AddItem(prayergrid)
+--
+-- for k,v in pairs(ART.MyPrayer) do
+-- print("Displaying prayer:" .. k)
+-- print("Type:" .. type(k))
+-- if k == "" then
+-- ART.MyPrayer[k] = nil
+-- end
+-- local but = createprayericon(prayergrid,k,false,nil)
+-- prayergrid:AddItem(but)
+-- end
+--
+-- displayboundprayers(prayersheet)
+--
+-- infopart = vgui.Create("DPanel")
+-- infopart:SetSize( (width / 4) - 10, height / 3)
+-- infopart:SetPos(0, height * 2 / 3)
+-- prayersheet:Add(infopart)
+--
+-- return "Prayers", prayersheet, "icon16/tick.png"
+-- end)
+--
+-- hook.Add("Think","art_prayer_keybinds",function()
+-- local mapping = {
+-- KEY_F1,
+-- KEY_F2,
+-- KEY_F3,
+-- KEY_F4,
+-- }
+-- for k,v in pairs(mapping) do
+-- if input.IsKeyDown(v) and ART.PrayerEquiped[k] then
+-- ART.GetPrayerByName(ART.PrayerEquiped[k]).Pray()
+-- end
+-- end
+-- end)
diff --git a/gamemode/client/qpanels/quests.lua b/gamemode/client/qpanels/quests.lua
index 015fc97..eda9e31 100644
--- a/gamemode/client/qpanels/quests.lua
+++ b/gamemode/client/qpanels/quests.lua
@@ -1,31 +1,31 @@
-do return end
-
-ART.RegisterInventorySheet(function()
-
- local width = ScrW()
- local height = ScrH()
-
- local questsheet = vgui.Create( "DPanel")
- questsheet.Paint = function(self,w,h) end
-
- --Display quests
- local questselector = vgui.Create( "DScrollPanel", questsheet )
- questselector:SetSize((width / 4) - 20, (height / 2) - 40)
- questselector:SetPos(0,0)
- local questinfo = vgui.Create("DScrollPanel", questsheet)
- questinfo:SetSize(width / 4, height / 2)
- questinfo:SetPos(0,height / 2)
- for k,v in pairs(LocalPlayer().Quests or {}) do
- print("Displaying quest:" .. k)
- local questbutton = vgui.Create( "DButton" , questselector )
- questbutton:Dock(TOP)
- questbutton:SetText(k)
- questbutton.DoClick = function()
- print("At point of clicking, art is:")
- PrintTable(ART)
- ART.GetQuest(k).DrawQuestInfo(questinfo,v)
- end
- end
-
- return "Quests", questsheet, "icon16/house.png"
-end)
+-- do return end
+--
+-- ART.RegisterInventorySheet(function()
+--
+-- local width = ScrW()
+-- local height = ScrH()
+--
+-- local questsheet = vgui.Create( "DPanel")
+-- questsheet.Paint = function(self,w,h) end
+--
+-- --Display quests
+-- local questselector = vgui.Create( "DScrollPanel", questsheet )
+-- questselector:SetSize((width / 4) - 20, (height / 2) - 40)
+-- questselector:SetPos(0,0)
+-- local questinfo = vgui.Create("DScrollPanel", questsheet)
+-- questinfo:SetSize(width / 4, height / 2)
+-- questinfo:SetPos(0,height / 2)
+-- for k,v in pairs(LocalPlayer().Quests or {}) do
+-- print("Displaying quest:" .. k)
+-- local questbutton = vgui.Create( "DButton" , questselector )
+-- questbutton:Dock(TOP)
+-- questbutton:SetText(k)
+-- questbutton.DoClick = function()
+-- print("At point of clicking, art is:")
+-- PrintTable(ART)
+-- ART.GetQuest(k).DrawQuestInfo(questinfo,v)
+-- end
+-- end
+--
+-- return "Quests", questsheet, "icon16/house.png"
+-- end)
diff --git a/gamemode/client/qpanels/skills.lua b/gamemode/client/qpanels/skills.lua
index 6d71442..1904445 100644
--- a/gamemode/client/qpanels/skills.lua
+++ b/gamemode/client/qpanels/skills.lua
@@ -1,10 +1,10 @@
-do return end
-
-
-ART.RegisterInventorySheet(function()
-
- local skillsheet = vgui.Create( "DPanel" )
- skillsheet.Paint = function( self, w, h ) end
-
- return "Skills", skillsheet, "icon16/tick.png"
-end)
+-- do return end
+--
+--
+-- ART.RegisterInventorySheet(function()
+--
+-- local skillsheet = vgui.Create( "DPanel" )
+-- skillsheet.Paint = function( self, w, h ) end
+--
+-- return "Skills", skillsheet, "icon16/tick.png"
+-- end)
diff --git a/gamemode/client/qtabs/cl_qinventory.lua b/gamemode/client/qtabs/cl_qinventory.lua
index 2ae70a2..9f2eebe 100644
--- a/gamemode/client/qtabs/cl_qinventory.lua
+++ b/gamemode/client/qtabs/cl_qinventory.lua
@@ -15,8 +15,8 @@ q.known_inventories = known_inventories
local drawfloatinginventory = function(id, inventory)
--print("Drawing a floating inventory!")
local frame = vgui.Create("DFrame")
- frame:SetPos( ScrW() - (ScrW()/4), 0 )
- frame:SetSize( ScrW()/4, ScrH()/4 )
+ frame:SetPos( ScrW() - (ScrW() / 4), 0 )
+ frame:SetSize( ScrW() / 4, ScrH() / 4 )
frame:SetTitle( inventory.Name )
frame:SetDraggable( true )
local panel = vgui.Create("DPanel",frame)
diff --git a/gamemode/config/sv_newplayer.lua b/gamemode/config/sv_newplayer.lua
index 09638eb..2a2f7d3 100644
--- a/gamemode/config/sv_newplayer.lua
+++ b/gamemode/config/sv_newplayer.lua
@@ -1,6 +1,6 @@
local np = {}
local inv = nrequire("inventory/inventory.lua")
-local itm = nrequire("inventory/item.lua")
+--local itm = nrequire("inventory/item.lua")
np.newdata = function()
return {
diff --git a/gamemode/core/combat/cl_damage.lua b/gamemode/core/combat/cl_damage.lua
index fee8175..5059588 100644
--- a/gamemode/core/combat/cl_damage.lua
+++ b/gamemode/core/combat/cl_damage.lua
@@ -1,18 +1,12 @@
--Displays numbers for damage
-local drawables = {
- [1] = {
- starttime = CurTime(),
- ammt = 5,
- startpos = LocalPlayer():GetEyeTrace().HitPos
- }
-}
+local drawables = {}
net.Receive("art_damage_ent",function()
print("Notified of damage")
local who = net.ReadEntity()
local dmg = net.ReadDouble()
-
+
--A random vector in the entity
local aa,bb = who:WorldSpaceAABB()
local mr = math.random
@@ -22,48 +16,47 @@ net.Receive("art_damage_ent",function()
ammt = dmg,
startpos = Vector(rx,ry,rz)
}
-
+
--Max 255 drawables at once
- drawables[#drawables+1 % 255] = drawinfo
+ drawables[(#drawables + 1) % 255] = drawinfo
end)
hook.Add( "PostDrawOpaqueRenderables", "art_damage_draw", function()
local trace = LocalPlayer():GetEyeTrace()
local angle = trace.HitNormal:Angle()
-
+
local lpp,sp = LocalPlayer():GetPos(),trace.HitPos
local to = lpp - sp
local matang = to:Angle()
-
+
matang.r = 90
- matang.y = matang.y+90
+ matang.y = matang.y + 90
matang.p = 0
render.DrawLine( trace.HitPos, trace.HitPos + 8 * angle:Forward(), Color( 255, 0, 0 ), true )
render.DrawLine( trace.HitPos, trace.HitPos + 8 * -angle:Right(), Color( 0, 255, 0 ), true )
render.DrawLine( trace.HitPos, trace.HitPos + 8 * angle:Up(), Color( 0, 0, 255 ), true )
-
+
surface.SetFont( "Trebuchet24" )
- local lpp = LocalPlayer():GetPos()
for k,v in pairs(drawables) do
local ct = CurTime()
local delta = ct - v.starttime
- local alpha = 255 * (math.log(v.ammt) - (delta/2))
+ local alpha = 255 * (math.log(v.ammt) - (delta / 2))
if alpha < 1 then
drawables[k] = nil
continue
end
local lam = math.log(v.ammt)
- local lad = (20/lam)
+ local lad = 20 / lam
local opx = math.sin(delta) * lad
local opy = math.cos(delta) * lad
- local dpos = v.startpos + Vector(opx,opy,delta*100*(1/v.ammt)+20)
- local matang = (lpp - dpos):Angle()
- matang.r = 90
- matang.y = matang.y + 90
- matang.p = 0
+ local dpos = v.startpos + Vector(opx,opy,delta * 100 * (1 / v.ammt) + 20)
+ local nmatang = (lpp - dpos):Angle()
+ nmatang.r = 90
+ nmatang.y = nmatang.y + 90
+ nmatang.p = 0
surface.SetTextColor( 255, 255, 255, alpha )
- cam.Start3D2D( dpos, matang, lam )
+ cam.Start3D2D( dpos, nmatang, lam )
surface.SetTextPos(0,0)
surface.DrawText(tostring(v.ammt))
cam.End3D2D()
diff --git a/gamemode/core/combat/cl_weaponswing.lua b/gamemode/core/combat/cl_weaponswing.lua
index 11557e5..ec5b954 100644
--- a/gamemode/core/combat/cl_weaponswing.lua
+++ b/gamemode/core/combat/cl_weaponswing.lua
@@ -1,5 +1,4 @@
local CLIENT_PAC_DIR = "artery/client/pacs"
-local itm = nrequire("item.lua")
local stt = nrequire("cl_state.lua")
local ball
function finddmgpoint(name)
@@ -65,13 +64,13 @@ net.Receive("artery_doanimation",function()
print("Doing animation:",animname,animtime,echoname)
who:SetupBones()
who:SetLuaAnimation(animname)
- stt.invopen=true
+ stt.invopen = true
timer.Simple(waittime,function()
tracking = true
end)
timer.Simple(animtime,function()
tracking = false
- stt.invopen=false
+ stt.invopen = false
print("Stopping animation",animname)
who:StopLuaAnimation(animname)
net.Start("artery_notifyserverofswing")
diff --git a/gamemode/core/combat/sv_weaponswing.lua b/gamemode/core/combat/sv_weaponswing.lua
index f754000..ea43f0b 100644
--- a/gamemode/core/combat/sv_weaponswing.lua
+++ b/gamemode/core/combat/sv_weaponswing.lua
@@ -1,14 +1,14 @@
--[[
This file tells you what weapons need their swings recalculated
]]
-local itm = nrequire("core/inventory/item.lua")
-local inv = nrequire("core/inventory/inventory.lua")
+-- local itm = nrequire("core/inventory/item.lua")
+-- local inv = nrequire("core/inventory/inventory.lua")
local wep = nrequire("core/inventory/common/weapons.lua")
local ws = {}
--Cache swing hits, if we used one once, we'll probably use it again soon
-local swingcache_size = 30
-local swingcache = {} --Swing arc cache
+-- local swingcache_size = 30
+-- local swingcache = {} --Swing arc cache
--A table of all the items that are swingable
local swingable = {}
@@ -25,18 +25,18 @@ net.Receive("artery_notifyserverofswing",function()
local weapon = net.ReadString()
local anim = net.ReadString()
local data = net.ReadTable()
-
+
print("Got swing data for ",weapon,anim)
PrintTable(data)
-
+
--Get the data that already exists for this weapon
local olddata = file.Read("artery/dynamic/swingdata/" .. weapon .. ".txt","DATA")
if olddata == nil then olddata = {}
else olddata = util.JSONToTable(util.Decompress(olddata)) end
-
+
--Add our new data
olddata[anim] = data
-
+
--And save back
file.Write("artery/dynamic/swingdata/" .. weapon .. ".txt",util.Compress(util.TableToJSON(olddata)))
end)
@@ -86,10 +86,8 @@ function ws.doSwing(weapon,ply,callback)
for k,v in pairs(hitthings) do
callback(v)
end
- if #hitthings == 0 then
- if weapon.onMiss then
- weapon:onMiss(ply)
- end
+ if #hitthings == 0 and weapon.onMiss then
+ weapon:onMiss(ply)
end
end)
end
@@ -100,7 +98,7 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args)
local e = ply
e:SetAngles(Angle(0,0,0))
e:SetEyeAngles(Angle(0,0,0))
-
+
--Add everything in swingables to a queue to be recorded
for k,v in pairs(swingable) do
for i,j in pairs(v.attacks) do
@@ -115,7 +113,7 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args)
recordqueue[#recordqueue + 1] = tn
end
end
-
+
--Create timers for everything
local timefromnow = 0
for k,v in ipairs(recordqueue) do
@@ -123,7 +121,7 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args)
print("timefromnow 1 is",timefromnow)
--Put the item into the inventory
local tfunc = function(nowtime)
- local whentoremove = nowtime + 1 + v[3] + 1
+ --local whentoremove = nowtime + 1 + v[3] + 1
timer.Simple(nowtime,function()
print("timefromnow 2 is",nowtime)
local einv = e.data.inventories[1]
@@ -178,7 +176,7 @@ concommand.Add("artery_checkSwingable",function(ply,cmd,args)
end
nitms = nitms + 1
end
-
+
print("Scanned ",nitms,"swingable items, could not find data for:\n\t",table.concat(noswingdata,"\n\t"))
end)
diff --git a/gamemode/core/database/sv_setup.lua b/gamemode/core/database/sv_setup.lua
index 32a4177..756fb20 100644
--- a/gamemode/core/database/sv_setup.lua
+++ b/gamemode/core/database/sv_setup.lua
@@ -71,8 +71,8 @@ function sql.GetPlayerData(ply)
return
end
local _,_,x,y,z = string.find(mtbl.lastlocation,"([-%d%.]+) ([-%d%.]+) ([-%d%.]+)")
- local vec = {x,y,z}
- for k,v in pairs(vec) do vec[k] = tonumber(v) end
+ local vec = {x,y,z}
+ for k,v in pairs(vec) do vec[k] = tonumber(v) end
ply:SetPos(Vector(unpack(vec)))
q.deserialize_player(ply,plyd)
end
@@ -106,17 +106,17 @@ function sql.CreatePlayerTable(ply)
end
function sql.SendPlayerToInstance(ply,ls,ll)
- local s64 = ply:SteamID64()
- local plydata = q.serialize_player(ply)
- local plymeta = util.TableToJSON({
- lastserver = ls,
- lastlocation = ll
- })
- local q_str = q.s_fmt(save_player_query,plymeta,plydata,s64)
- local q_suc = function(res,li)
- --print("Successfully saved player data")
- end
- MySQLite.query(q_str,q_suc,q_fai)
+local s64 = ply:SteamID64()
+local plydata = q.serialize_player(ply)
+local plymeta = util.TableToJSON({
+ lastserver = ls,
+ lastlocation = ll
+})
+local q_str = q.s_fmt(save_player_query,plymeta,plydata,s64)
+local q_suc = function(res,li)
+ --print("Successfully saved player data")
+end
+MySQLite.query(q_str,q_suc,q_fai)
end
concommand.Add("DoQuery",function(ply,cmd,args)
diff --git a/gamemode/core/dataloader/sv_loadglobals.lua b/gamemode/core/dataloader/sv_loadglobals.lua
index 85bbc5f..31e2c56 100644
--- a/gamemode/core/dataloader/sv_loadglobals.lua
+++ b/gamemode/core/dataloader/sv_loadglobals.lua
@@ -22,18 +22,18 @@ util.AddNetworkString("artery_requestcsfile")
util.AddNetworkString("artery_respondfile")
local toload = {}
local function loadglobals()
- ExecuteOnFolder("global",true,function(f)
+ ExecuteOnFolder("global",true,function(f)
local filetxt = file.Read(f,"GAME")
local filename = string.GetFileFromFilename(f)
if string.find(filename,"^cl_") then
toload[f] = filetxt
elseif string.find(filename,"^sv_") then
CompileString(filetxt,f)()
- else
+ else
toload[f] = filetxt
CompileString(filetxt,f)()
end
- end)
+ end)
end
local function load_cs_files(ply)
@@ -61,9 +61,9 @@ net.Receive("artery_requestcsfile",function(ln,ply)
end)
concommand.Add("artery_reloadglobals",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- loadglobals()
- for k,v in pairs(player.GetAll()) do
+ if not ply:IsAdmin() then return end
+ loadglobals()
+ for k,v in pairs(player.GetAll()) do
load_cs_files(v)
end
end)
diff --git a/gamemode/core/inventory/common/items.lua b/gamemode/core/inventory/common/items.lua
index 95a507c..868d940 100644
--- a/gamemode/core/inventory/common/items.lua
+++ b/gamemode/core/inventory/common/items.lua
@@ -1,18 +1,14 @@
local items = {}
-local function drop_provided(ent,invid,frompos)
- assert(CLIENT,"requested to drop an item when we are not the client!")
- net.Start("art_RequestInvDrop")
- net.WriteEntity(ent)
- net.WriteUInt(invid,32)
- net.WriteTable(frompos)
- net.SendToServer()
-end
-
-local function drop_self(tbl)
-
-end
+-- local function drop_provided(ent,invid,frompos)
+-- assert(CLIENT,"requested to drop an item when we are not the client!")
+-- net.Start("art_RequestInvDrop")
+-- net.WriteEntity(ent)
+-- net.WriteUInt(invid,32)
+-- net.WriteTable(frompos)
+-- net.SendToServer()
+-- end
--Client requests the item be droped from the ent, invid, and inv position
function items.DropItem(ent_or_tbl,invid,frompos)
diff --git a/gamemode/core/inventory/common/weapons.lua b/gamemode/core/inventory/common/weapons.lua
index 9e6eead..0a86f00 100644
--- a/gamemode/core/inventory/common/weapons.lua
+++ b/gamemode/core/inventory/common/weapons.lua
@@ -89,14 +89,14 @@ function com.createattackstable(tbl_attackdata,attacker)
end)
end
end
-
+
--Empty functions for attacks not defined
for k,v in pairs({"left","right","forward","backward"}) do
if movementtbl[k] == nil then
movementtbl[k] = function() end
end
end
-
+
return movementtbl
end
diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua
index bb5aba6..ab39e41 100644
--- a/gamemode/core/inventory/sv_invtracker.lua
+++ b/gamemode/core/inventory/sv_invtracker.lua
@@ -86,7 +86,7 @@ net.Receive("art_RequestInvDrop",function(len,ply)
local frominv = froment.data.inventories[frominvid]
local item = frominv:Get(frompos)
frominv:Remove(frompos)
-
+
local placetodrop
--Find somewhere to drop this
local tr = ply:GetEyeTrace()
@@ -95,8 +95,8 @@ net.Receive("art_RequestInvDrop",function(len,ply)
placetodrop = tr.HitPos
else
local tr2 = util.TraceLine({
- start = (tr.Normal*200) + tr.StartPos,
- endpos = ((tr.Normal*200) + tr.StartPos) + Vector(-2000),
+ start = (tr.Normal * 200) + tr.StartPos,
+ endpos = ((tr.Normal * 200) + tr.StartPos) + Vector(-2000),
})
placetodrop = tr2.HitPos
end
@@ -138,15 +138,15 @@ function track.MakeInventoryObserver(ply,invid)
return observer
end
-function track.NotifyPlayerOfInventory(ply,inv)
- local initaldat = inv:Serialize()
+function track.NotifyPlayerOfInventory(ply,tinv)
+ local initaldat = tinv:Serialize()
net.Start("art_ObserveInventory")
- net.WriteUInt(inv.id,32)
- net.WriteString(inv.Name)
+ net.WriteUInt(tinv.id,32)
+ net.WriteString(tinv.Name)
net.WriteUInt(#initaldat,32)
net.WriteData(initaldat,#initaldat)
- print("Before sending, inv owner is", inv.Owner, "and type is",inv.Name)
- net.WriteEntity(inv.Owner)
+ print("Before sending, inv owner is", tinv.Owner, "and type is",tinv.Name)
+ net.WriteEntity(tinv.Owner)
net.Send(ply)
end
diff --git a/gamemode/core/npc/cl_npcmap.lua b/gamemode/core/npc/cl_npcmap.lua
index ea7293e..ddbd3cd 100644
--- a/gamemode/core/npc/cl_npcmap.lua
+++ b/gamemode/core/npc/cl_npcmap.lua
@@ -17,11 +17,11 @@ local mapicons = --[[mapicons or]] {
["global"] = {
["isleaf"] = false,
["border"] = { {-10000,-10000},
- {-10000,10000},
- {10000,10000},
- {10000,-10000}
- },
- }
+ {-10000,10000},
+ {10000,10000},
+ {10000,-10000}
+ },
+}
}
hook.Add( "HUDPaint", "paintsprites", function()
@@ -56,29 +56,37 @@ end )
hook.Add("Initialize","loadmapicons",function()
LocalPlayer().MapIcons = LocalPlayer().MapIcons or {}
local mapname = game.GetMap()
- if not file.Exists("artery/client/"..mapname,"DATA") then
- file.CreateDir("artery/client/"..mapname)
+ if not file.Exists("artery/client/" .. mapname,"DATA") then
+ file.CreateDir("artery/client/" .. mapname)
end
- local mapiconstxt = file.Read("artery/client/"..mapname.."/known.txt")
- if not mapiconstxt then return end --File does not exist!
+ local mapiconstxt = file.Read("artery/client/" .. mapname .. "/known.txt")
+ if not mapiconstxt then return end --File does not exist!
for k,v in pairs(string.Explode("\r?\n",mapiconstxt,true)) do
local isleaf = tobool(v[1])
local ttbl = string.Explode(",",v)
- if isleaf then
- local subarea = ttbl[2]
- local material = ttbl[3]
- local pos = Vector(ttbl[4],ttbl[5],ttbl[6])
- else
- local name = v[2]
+ if not isleaf then
+ --local name = v[2]
local boundry = {}
for i = 3, #ttbl, 3 do
- boundry[#boundry+1] = ttbl[i],ttbl[i + 1],ttbl[i + 2]
+ boundry[#boundry + 1] = ttbl[i],ttbl[i + 1],ttbl[i + 2]
end
end
+ -- if isleaf then
+ -- local subarea = ttbl[2]
+ -- local material = ttbl[3]
+ -- local pos = Vector(ttbl[4],ttbl[5],ttbl[6])
+ -- else
+ -- local name = v[2]
+ -- local boundry = {}
+ -- for i = 3, #ttbl, 3 do
+ -- boundry[#boundry+1] = ttbl[i],ttbl[i + 1],ttbl[i + 2]
+ -- end
+ -- end
end
end)
+
--When the player disconnects (or changes levels) save the npcmap
--Add an icon to the map
@@ -86,19 +94,21 @@ local function addmapicon(material, subarea, position)
print("adding map icon, material:",material,"subarea:",subarea,"bordertbl:",bordertbl)
print("mat",material,"subarea",subarea,"position",position)
local parts = string.Explode(":",subarea)
- print("parts:",parts)
- PrintTable(parts)
+ -- print("parts:",parts)
+ -- PrintTable(parts)
local cursor = mapicons
for k,v in pairs(parts) do
- print("Traverseing down tree:",k,v)
- print("cursor was")
- PrintTable(cursor)
- if cursor[v] == nil then cursor[v] = {} end
+ -- print("Traverseing down tree:",k,v)
+ -- print("cursor was")
+ -- PrintTable(cursor)
+ if cursor[v] == nil then
+ cursor[v] = {}
+ end
cursor = cursor[v]
- print("cursor is")
- PrintTable(cursor)
+ -- print("cursor is")
+ -- PrintTable(cursor)
end
- if cursor.isleaf and v.pos == position then return end
+ if cursor.isleaf and cursor.pos == position then return end
cursor.icons = cursor.icons or {}
for k,v in pairs(cursor.icons) do
if v.pos == position then return end --This position already has an icon!
@@ -111,37 +121,37 @@ local function addmapicon(material, subarea, position)
assert(type(cursor) == "table","Attempted to add subarea that dosen't exist:" .. subarea)
end
-local function addmaparea(material, subarea, bordertbl)
- print("adding map area, material:",material,"subarea:",subarea,"bordertbl:",bordertbl)
- local parts = string.Explode(":",subarea)
- print("parts:",parts)
- PrintTable(parts)
- local cursor = mapicons
- if #parts > 1 then
- for k,v in pairs(parts) do
- print("Traverseing down tree:",k,v)
- cursor = cursor[v]
- end
- end
-
- print("Cursor is",cursor)
- if cursor ~= nil then
- cursor[subarea] = {
- ["isleaf"] = false,
- ["material"] = "",
- ["border"] = bordertbl,
- ["subparts"] = {}
- }
- else
- print("Error, cursor was nil!")
- end
-end
+-- local function addmaparea(material, subarea, bordertbl)
+-- print("adding map area, material:",material,"subarea:",subarea,"bordertbl:",bordertbl)
+-- local parts = string.Explode(":",subarea)
+-- print("parts:",parts)
+-- PrintTable(parts)
+-- local cursor = mapicons
+-- if #parts > 1 then
+-- for k,v in pairs(parts) do
+-- print("Traverseing down tree:",k,v)
+-- cursor = cursor[v]
+-- end
+-- end
+--
+-- print("Cursor is",cursor)
+-- if cursor ~= nil then
+-- cursor[subarea] = {
+-- ["isleaf"] = false,
+-- ["material"] = "",
+-- ["border"] = bordertbl,
+-- ["subparts"] = {}
+-- }
+-- else
+-- print("Error, cursor was nil!")
+-- end
+-- end
--[[
addmaparea("","global",{
- {-10000,-10000},
- {-10000,10000},
- {10000,10000},
- {10000,-10000}
+{-10000,-10000},
+{-10000,10000},
+{10000,10000},
+{10000,-10000}
})
]]
@@ -157,7 +167,7 @@ end)
net.Receive("addmaparea",function()
print("got receive for map area")
- local matstr = net.ReadString()
- local subarea = net.ReadString()
- local boarders = net.ReadTable()
+ -- local matstr = net.ReadString()
+ -- local subarea = net.ReadString()
+ -- local boarders = net.ReadTable()
end)
diff --git a/gamemode/core/npc/cl_shop.lua b/gamemode/core/npc/cl_shop.lua
index c2c71bc..de8ec23 100644
--- a/gamemode/core/npc/cl_shop.lua
+++ b/gamemode/core/npc/cl_shop.lua
@@ -61,7 +61,7 @@ local function DrawShopItemOnDPanel(dp,itemtbl,cost)
end
end
end
-
+
local buybutton = vgui.Create("DButton",dp)
buybutton:Dock(RIGHT)
buybutton:SetText("Buy\n(" .. cost .. ")")
diff --git a/gamemode/core/npc/sv_huntingspawner.lua b/gamemode/core/npc/sv_huntingspawner.lua
index d13ec36..f6bf827 100644
--- a/gamemode/core/npc/sv_huntingspawner.lua
+++ b/gamemode/core/npc/sv_huntingspawner.lua
@@ -4,10 +4,9 @@
local track = nrequire("core/inventory/sv_invtracker.lua")
local itm = nrequire("core/inventory/item.lua")
local o = {}
-local playerhunted = {}
local huntablenodes = {}
function o.CreateSpawnNode(tbl)
- huntablenodes[#huntablenodes+1] = tbl
+ huntablenodes[#huntablenodes + 1] = tbl
local e = ents.Create("info_huntablespawn")
e:SetPos(tbl.Position)
e:Spawn()
@@ -33,13 +32,13 @@ local function SpawnMonsterFor(ply,zone)
break
end
end
-
+
if npctype == nil then
print(ply,"got lucky this time...")
return
end
--print("I will spawn a ",npctype,"to attack ",ply,"!")
-
+
--Find a place for the npc to spawn that's out of sight!
local potentialspots = ents.FindInSphere( ply:GetPos(), 4000 )
for k,v in pairs(potentialspots) do
@@ -54,17 +53,17 @@ local function SpawnMonsterFor(ply,zone)
})
if tr.Hit and tr.Entity == ply then
potentialspots[k] = nil
- print("Player could see this point")
+ --print("Player could see this point")
end
end
end
-
+
local a = {}
- for k,v in pairs(potentialspots) do a[#a+1] = v end
-
+ for k,v in pairs(potentialspots) do a[#a + 1] = v end
+
--Choose a random spot!
local spawnpos = a[math.random(1,#a)]
-
+
--print("I want to spawn a monster at", spawnpos)
if spawnpos == nil then
--print("Couldn't find a spot to spawn an NPC around",ply,"at",ply:GetPos(),"make sure there are enough info_huntablespawn entities around in little corners and stuff")
@@ -108,12 +107,11 @@ hook.Add("OnNPCKilled","droplootforexnpcs",function(npc,attacker,inflictor)
local rng = math.random(0, 100)
local itemname = v[1]
local itemchance = v[2]
- local heightoffset = 10
if rng < itemchance then
local drop = itm.GetItemByName(itemname)
print("Createing a drop of",drop)
- track.CreateDroppedItem(drop, npc:GetPos()+Vector(math.random(20),math.random(20),20))
+ track.CreateDroppedItem(drop, npc:GetPos() + Vector(math.random(20),math.random(20),20))
end
end
end)
diff --git a/gamemode/core/npc/sv_npcsystem.lua b/gamemode/core/npc/sv_npcsystem.lua
index 1051c64..d5182d7 100644
--- a/gamemode/core/npc/sv_npcsystem.lua
+++ b/gamemode/core/npc/sv_npcsystem.lua
@@ -68,18 +68,18 @@ for k, v in pairs(removeents) do
end
local function ExecuteOnFolder(dir, recursive, func)
- local path = ""
- local fpath = table.concat({path,dir,"/*"})
- local files, directories = file.Find(fpath,"DATA")
- for k,v in pairs(files) do
- local callpath = table.concat({path,dir,"/",v})
- func(callpath)
- end
- if not recursive then return end
- for k,v in pairs(directories) do
- local npath = table.concat({dir,"/",v})
- ExecuteOnFolder(npath,true,func)
- end
+ local path = ""
+ local fpath = table.concat({path,dir,"/*"})
+ local files, directories = file.Find(fpath,"DATA")
+ for k,v in pairs(files) do
+ local callpath = table.concat({path,dir,"/",v})
+ func(callpath)
+ end
+ if not recursive then return end
+ for k,v in pairs(directories) do
+ local npath = table.concat({dir,"/",v})
+ ExecuteOnFolder(npath,true,func)
+ end
end
local function loadMap()
diff --git a/gamemode/core/npc/sv_shop.lua b/gamemode/core/npc/sv_shop.lua
index 2825996..c0e2153 100644
--- a/gamemode/core/npc/sv_shop.lua
+++ b/gamemode/core/npc/sv_shop.lua
@@ -36,20 +36,20 @@ end
net.Receive("art_buyitem",function(len,ply)
local itemname = net.ReadString()
-
+
--Find the shop near the player
local es = ents.FindInSphere(ply:GetPos(),500)
- local shop
+ local tshop
for k,v in pairs(es) do
if IsValid(v) and v:GetClass() == "npc_shop" then
- shop = v
+ tshop = v
break
end
end
- print("Shop was", shop)
- print("Items:", shop.shopitems)
- PrintTable(shop.shopitems)
-
+ print("Shop was", tshop)
+ print("Items:", tshop.shopitems)
+ PrintTable(tshop.shopitems)
+
--Find the price of the item we want to buy
local price
for k,v in pairs(shop.shopitems) do
@@ -58,9 +58,9 @@ net.Receive("art_buyitem",function(len,ply)
break
end
end
-
+
--Make sure we have enough credits to buy it
- if ply:GetCredits() < price then
+ if ply:GetCredits() < price then
print(ply, " didn't have enough credits to buy a ", itemname, "(" .. price .. ")")
else
xpcall(function()
diff --git a/gamemode/core/pac/cl_pac.lua b/gamemode/core/pac/cl_pac.lua
index 7e149ae..fc55eb1 100644
--- a/gamemode/core/pac/cl_pac.lua
+++ b/gamemode/core/pac/cl_pac.lua
@@ -65,8 +65,8 @@ end
net.Receive("artery_downloadpac",function()
local pac_name = net.ReadString()
local pac_txt = net.ReadString()
- local pac_hash = net.ReadUInt(32)
- local filepath = string.format(CLIENT_PAC_DIR .."/%s.txt",pac_name)
+ --local pac_hash = net.ReadUInt(32)
+ local filepath = string.format(CLIENT_PAC_DIR .. "/%s.txt",pac_name)
file.Write(filepath,pac_txt)
end)
diff --git a/gamemode/core/pac/sv_pac.lua b/gamemode/core/pac/sv_pac.lua
index 6b60340..e9492e9 100644
--- a/gamemode/core/pac/sv_pac.lua
+++ b/gamemode/core/pac/sv_pac.lua
@@ -59,7 +59,7 @@ end
local pachashes = {}
local function loadhashes()
for path,part in pairs(pacsources) do
- local files,_ = file.Find(path.."*",part)
+ local files,_ = file.Find(path .. "*",part)
for _,v in ipairs(files) do
local filepath = string.format("%s%s",path,v)
local filetext = file.Read(filepath,part)
diff --git a/gamemode/inventorysystem/cl_common.lua b/gamemode/inventorysystem/cl_common.lua
index 361cf3c..505c5d9 100644
--- a/gamemode/inventorysystem/cl_common.lua
+++ b/gamemode/inventorysystem/cl_common.lua
@@ -42,7 +42,7 @@ function com.generatereceiver()
PrintTable(self.info.pos)
print("frominv",frominv)
print("toinv",toinv)
-
+
--Do nothing if we don't actually want to move anything anywhere
local posequal = true
if (froment ~= toent) or (fromid ~= toid) or (frominv ~= toinv) then posequal = false end
@@ -55,7 +55,7 @@ function com.generatereceiver()
end
end
if posequal then return end
-
+
local item = frominv:Get(frompos)
print("item was", item)
--Fake remove the item, in case the position we want to move it to overlaps with where it is now.
diff --git a/gamemode/inventorysystem/equipment/cl_equipment.lua b/gamemode/inventorysystem/equipment/cl_equipment.lua
index ca03bf6..8d06594 100644
--- a/gamemode/inventorysystem/equipment/cl_equipment.lua
+++ b/gamemode/inventorysystem/equipment/cl_equipment.lua
@@ -147,7 +147,7 @@ inv.DrawOnDPanel = function(self,panel)
end
prox[k] = pn
end
-
+
prox.Put = function(self,position,item)
assert(self[position[1]] ~= nil, "Tried to put an item into an unknown slot! Slot:" .. position[1])
if item.GetOptions then
diff --git a/gamemode/inventorysystem/equipment/sh_equipment.lua b/gamemode/inventorysystem/equipment/sh_equipment.lua
index 7095363..5bea682 100644
--- a/gamemode/inventorysystem/equipment/sh_equipment.lua
+++ b/gamemode/inventorysystem/equipment/sh_equipment.lua
@@ -2,9 +2,9 @@
A simple inventory that holds 1 item
]]
local itm = nrequire("item.lua")
-local ste = nrequire("utility/stream.lua")
+--local ste = nrequire("utility/stream.lua")
local inventory = nrequire("inventory/inventory.lua")
-local col = nrequire("config/colortheme.lua")
+--local col = nrequire("config/colortheme.lua")
local slots = {
"Head",
"Shoulders",
diff --git a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
index bb35d2d..76d322d 100644
--- a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
+++ b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
@@ -114,7 +114,7 @@ function inv:Serialize()
for k,v in pairs(self.tracker) do
if type(v) == "table" then
local row = math.ceil(k / self.width)
- local col = (k % self.width)
+ local col = k % self.width
ret[v.Name] = {{row,col},v:Serialize()}
end
end
diff --git a/gamemode/itemsystem/armor/balaclava.lua b/gamemode/itemsystem/armor/balaclava.lua
index 0bd16c7..dead873 100644
--- a/gamemode/itemsystem/armor/balaclava.lua
+++ b/gamemode/itemsystem/armor/balaclava.lua
@@ -1,81 +1,81 @@
---[[
- 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)
+-- --[[
+-- 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
index e8d9575..12fc890 100644
--- a/gamemode/itemsystem/foodstuffs/ratmeat.lua
+++ b/gamemode/itemsystem/foodstuffs/ratmeat.lua
@@ -1,47 +1,47 @@
---[[
- 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)
+-- --[[
+-- 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
index d3dfd56..00828dc 100644
--- a/gamemode/itemsystem/foodstuffs/watermelon.lua
+++ b/gamemode/itemsystem/foodstuffs/watermelon.lua
@@ -1,62 +1,62 @@
---[[
- 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)
+-- --[[
+-- 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
index b4b7cce..acfc3e5 100644
--- a/gamemode/itemsystem/item_common.lua
+++ b/gamemode/itemsystem/item_common.lua
@@ -1,6 +1,5 @@
if CLIENT then
ART.DropItem = function(item)
- local i = item
print("Trying to drop item, Item was ")
PrintTable(item)
return function()
@@ -46,8 +45,8 @@ else
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 pes = ply:GetPos() + Vector(0,0,64)
+ local pee = ply:GetForward() * 50 + Vector(0,0,64) + ply:GetPos()
local tr1d = {
["start"] = pes,
["endpos"] = pee,
diff --git a/gamemode/itemsystem/quest/rougebadge.lua b/gamemode/itemsystem/quest/rougebadge.lua
index df5a149..2b7d0a0 100644
--- a/gamemode/itemsystem/quest/rougebadge.lua
+++ b/gamemode/itemsystem/quest/rougebadge.lua
@@ -1,39 +1,39 @@
---[[
- 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)
+-- --[[
+-- 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
index 409948a..302f919 100644
--- a/gamemode/itemsystem/quest/rougebook.lua
+++ b/gamemode/itemsystem/quest/rougebook.lua
@@ -1,69 +1,69 @@
---[[
- 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)
+-- --[[
+-- 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
index 52e69aa..d6dae50 100644
--- a/gamemode/itemsystem/quest/togglechip.lua
+++ b/gamemode/itemsystem/quest/togglechip.lua
@@ -1,25 +1,25 @@
---[[
- 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)
+-- --[[
+-- 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
index ea3d67f..0f58e79 100644
--- a/gamemode/itemsystem/scrapgun.lua
+++ b/gamemode/itemsystem/scrapgun.lua
@@ -1,61 +1,61 @@
---[[
- 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)
+-- --[[
+-- 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
index 6b0a40c..35c6679 100644
--- a/gamemode/itemsystem/utility/flashlight.lua
+++ b/gamemode/itemsystem/utility/flashlight.lua
@@ -1,89 +1,89 @@
---[[
- 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)
+-- --[[
+-- 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
index c738f2e..1c2b8f6 100644
--- a/gamemode/itemsystem/weapons/knuckledclaw.lua
+++ b/gamemode/itemsystem/weapons/knuckledclaw.lua
@@ -1,164 +1,164 @@
---[[
- 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)
+-- --[[
+-- 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
index 930a736..cd8004e 100644
--- a/gamemode/itemsystem/weapons/rustyaxe.lua
+++ b/gamemode/itemsystem/weapons/rustyaxe.lua
@@ -1,272 +1,272 @@
---[[
- 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)
+-- --[[
+-- 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
index 2534907..f281799 100644
--- a/gamemode/itemsystem/weapons/scraphammer.lua
+++ b/gamemode/itemsystem/weapons/scraphammer.lua
@@ -1,203 +1,203 @@
---[[
- 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)
+-- --[[
+-- 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
index 738beb6..b2e353c 100644
--- a/gamemode/itemsystem/weapons/seratedknife.lua
+++ b/gamemode/itemsystem/weapons/seratedknife.lua
@@ -1,200 +1,200 @@
---[[
- 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)
+-- --[[
+-- 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
index f31b18f..3c3e6ca 100644
--- a/gamemode/itemsystem/weapons_common.lua
+++ b/gamemode/itemsystem/weapons_common.lua
@@ -1,71 +1,71 @@
---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
+-- --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/npcsystem/sv_zombie.lua b/gamemode/npcsystem/sv_zombie.lua
index 7f7e496..a612e92 100644
--- a/gamemode/npcsystem/sv_zombie.lua
+++ b/gamemode/npcsystem/sv_zombie.lua
@@ -1,5 +1,5 @@
local n = nrequire("sv_npcsystem.lua")
-local ncom = nrequire("sv_common.lua")
+--local ncom = nrequire("sv_common.lua")
local NPC = {}
NPC.Name = "Zombie"
NPC.Desc = "The living dead, argh!"
@@ -70,7 +70,7 @@ local doattack = function(self,ply)
self.lastattack = CurTime()
self:StartActivity(ACT_MELEE_ATTACK1)
timer.Simple(1,function() --It looks like you're hit about 1/2s after animation start
- if (not IsValid(self)) or( not IsValid(ply)) then return end --Make sure we're both still alive!
+ if (not IsValid(self)) or ( not IsValid(ply)) then return end --Make sure we're both still alive!
local sp,pp = self:GetPos(),ply:GetPos()
local cross = sp:Cross(pp)
local fppj = cross:GetNormalized():Dot(self:GetForward())
@@ -86,7 +86,7 @@ local doattack = function(self,ply)
print("tr.hit was",tr.Hit,"entity was",tr.Entity)
end
else
- print('Player was not in front, or distance too great')
+ print("Player was not in front, or distance too great")
print(fppj)
print(sp:Distance(pp))
end
@@ -95,7 +95,7 @@ end
--At least 1 check function must return greater than -1
local checkrun = function(self,ply)
- local isnearby = (1000 - ply:GetPos():Distance(self:GetPos()))/1000 --Zombies work on smell or something, idk, line of sight is hard to do cheaply
+ local isnearby = (1000 - ply:GetPos():Distance(self:GetPos())) / 1000 --Zombies work on smell or something, idk, line of sight is hard to do cheaply
--But we want attack priority to override this, so only return a max of 1
return isnearby
end
@@ -147,15 +147,15 @@ function NPC:Act(deltat)
end
--What to replace ENT:OnStuck with
-function NPC:Stuck()
- --Find out what we're stuck on
- local tr = util.TraceLine({
- start = self:GetPos() + Vector(0,0,50), --Start at about waist height
- endpos =( self:GetForward()*50) + self:GetPos() + Vector(0,0,50),
- filter = self
- })
-
-end
+-- function NPC:Stuck()
+-- --Find out what we're stuck on
+-- -- local tr = util.TraceLine({
+-- -- start = self:GetPos() + Vector(0,0,50), --Start at about waist height
+-- -- endpos =( self:GetForward() * 50) + self:GetPos() + Vector(0,0,50),
+-- -- filter = self
+-- -- })
+--
+-- end
--These are just here to tell the editors/develoeprs what functions are available.. dont un-comment them out, as this could affect all the items.
@@ -163,7 +163,7 @@ function NPC:OnSpawn()
self.lastattack = CurTime()
self.lastwalk = CurTime()
end
-/*
+--[[
--If we need to do more than just reduce health on dammage
function NPC:OnDammage(ammount)
end
@@ -182,6 +182,6 @@ end
--Called when the npc is attacking anything with any attack
function NPC:OnAttack(target)
end
-*/
+--]]
n.RegisterNPC(NPC)
diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua
index 5e8d1a6..1ec4fb7 100644
--- a/gamemode/nrequire.lua
+++ b/gamemode/nrequire.lua
@@ -137,7 +137,7 @@ end
local pathstack = {}
-local coroutines = {}
+--local coroutines = {}
--[[
Returns the table returned by executing a file. The table is cached after is is loaded, so calling nrequire() on a file twice will only run it once.
]]
@@ -150,14 +150,14 @@ function nrequire(req)
for k,v in pairs(pathstack) do
assert(v ~= tpath,string.format("Circular dependancy detected:\n\t%s\n\t\t|\n\t\tV\n\t%s",table.concat(pathstack,"\n\t\t|\n\t\tV\n\t"),v))
end
-
+
--Override print so it's easy to see what file is printing what
--local tab_rep = {}
--for k = 1, #pathstack do tab_rep[k] = "\t" end
--print(string.format("%sIncluding %q",table.concat(tab_rep),tpath))
--local oldprint = print
--print = function(...) oldprint(" ",unpack({...})) end
-
+
--Deal with bookkeeping dealing with circular dependancies, and include
pathstack[#pathstack + 1] = tpath
reqtbl[tpath] = include(tpath)
@@ -170,7 +170,7 @@ function nrequire(req)
coroutine.resume(co)
]]
pathstack[#pathstack] = nil
-
+
--[[
--Try to resume everyone else waiting on something
for k,v in pairs(coroutines) do
@@ -178,7 +178,7 @@ function nrequire(req)
coroutine.resume(v)
end
]]
-
+
--Undo the crazy print
--print = oldprint
--print(string.format("%sIncluded %q",table.concat(tab_rep),tpath))
diff --git a/gamemode/server/heatmap.lua b/gamemode/server/heatmap.lua
index 2e8c1b3..1e95590 100644
--- a/gamemode/server/heatmap.lua
+++ b/gamemode/server/heatmap.lua
@@ -4,25 +4,23 @@
do return end
print("Hello from heatmap.lua!")
local prs = pairs
-local iprs = ipairs
-local prnt = print
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 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()
@@ -40,16 +38,16 @@ end
local function RegisterEffect(self, func, position)
local stbl = {position,func}
- tblins(self.heatpoints,#self.heatpoints+1,stbl)
+ 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
+ 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
+ if shouldremove then tbldel(k) end
end
return total
end
@@ -74,12 +72,12 @@ end
function heatmap.UniformInfiniteLinearDecay(field,decayrate)
return function(vector,time)
- return heatmap.UniformInfiniteForever(field)-(time*decayrate), false
+ return heatmap.UniformInfiniteForever(field) - (time * decayrate), false
end
end
function heatmap.UniformInfiniteLinearDecayGrounded(field,decayrate)
- local removetime = field/decayrate
+ local removetime = field / decayrate
return function(vector,time)
return max(heatmap.UniformInfiniteLinearDecay(field,decayrate),0), time < removetime
end
@@ -99,20 +97,20 @@ end
function heatmap.LinearInfiniteLinearDecay(field,decayrate)
return function(vector, time)
- return field - VectorLength(vector) - (time*decayrate), false
+ return field - VectorLength(vector) - (time * decayrate), false
end
end
function heatmap.LinearInfiniteLinearDecayGrounded(field,decayrate)
- local removetime = field/decayrate
+ local removetime = field / decayrate
return function(vector, time)
- return max(field-VectorLength(vector) - (time*decayrate),0), time < removetime
+ 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
+ return field - pow(VectorLength(vector),power) / pow(100,power), false
end
end
@@ -127,12 +125,12 @@ end
function heatmap.ParabolicInfiniteLinearDecay(field,power,decayrate)
return function(vector, time)
- return heatmap.ParabolicInfiniteForever(field, power) - (time*decayrate), false
+ return heatmap.ParabolicInfiniteForever(field, power) - (time * decayrate), false
end
end
function heatmap.ParabolicInfiniteLinearDecayGrounded(field,power,decayrate)
- local removetime = field/decayrate
+ local removetime = field / decayrate
return function(vector,time)
return max(heatmap.ParabolicInfiniteLinearDecay(field,power,decayrate),0), time < removetime
end
diff --git a/gamemode/server/sv_config.lua b/gamemode/server/sv_config.lua
index 82f1061..8ce6e6c 100644
--- a/gamemode/server/sv_config.lua
+++ b/gamemode/server/sv_config.lua
@@ -1,22 +1,22 @@
--[[
Some things that I might want to configure
]]
-
-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
+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
index f83fd72..895b086 100644
--- a/gamemode/server/sv_mapchange.lua
+++ b/gamemode/server/sv_mapchange.lua
@@ -2,11 +2,11 @@
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 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 = {}
diff --git a/gamemode/server/sv_mapconfig.lua b/gamemode/server/sv_mapconfig.lua
index 23999bb..d697ea9 100644
--- a/gamemode/server/sv_mapconfig.lua
+++ b/gamemode/server/sv_mapconfig.lua
@@ -1,68 +1,68 @@
---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)
+-- --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/shared/inventory.lua b/gamemode/shared/inventory.lua
index f06d053..b89deac 100644
--- a/gamemode/shared/inventory.lua
+++ b/gamemode/shared/inventory.lua
@@ -1,399 +1,399 @@
-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 )
+-- 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
index c5553fe..c5b8fc3 100644
--- a/gamemode/shared/inventory_common.lua
+++ b/gamemode/shared/inventory_common.lua
@@ -1,193 +1,193 @@
---[[
- 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
+-- --[[
+-- 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
index 9975bb3..dba80e8 100644
--- a/gamemode/shared/loaditems.lua
+++ b/gamemode/shared/loaditems.lua
@@ -1,61 +1,61 @@
-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.")
-]=]
+-- 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
index 2906597..de411df 100644
--- a/gamemode/shared/loadnpcs.lua
+++ b/gamemode/shared/loadnpcs.lua
@@ -1,39 +1,39 @@
-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)
+-- 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
index 01d538c..551ab1b 100644
--- a/gamemode/shared/loadprayers.lua
+++ b/gamemode/shared/loadprayers.lua
@@ -1,123 +1,123 @@
---[[
- 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.")
+-- --[[
+-- 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/prayersystem/prayers/lesserevasion.lua b/gamemode/shared/prayersystem/prayers/lesserevasion.lua
index 15077d3..040189e 100644
--- a/gamemode/shared/prayersystem/prayers/lesserevasion.lua
+++ b/gamemode/shared/prayersystem/prayers/lesserevasion.lua
@@ -1,66 +1,66 @@
-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)
+-- 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
index 44b3099..707e8b6 100644
--- a/gamemode/shared/prayersystem/prayers/ninelives.lua
+++ b/gamemode/shared/prayersystem/prayers/ninelives.lua
@@ -1,50 +1,50 @@
-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)
+-- 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
index 426500b..a7a5761 100644
--- a/gamemode/shared/prayersystem/prayers/notdarkrp.lua
+++ b/gamemode/shared/prayersystem/prayers/notdarkrp.lua
@@ -1,77 +1,77 @@
-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)
+-- 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
index e317dd5..b056f74 100644
--- a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua
+++ b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua
@@ -1,68 +1,68 @@
-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)
+-- 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
index 71f1612..817cb44 100644
--- a/gamemode/shared/prayersystem/prayers/thickskin.lua
+++ b/gamemode/shared/prayersystem/prayers/thickskin.lua
@@ -1,60 +1,60 @@
-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)
+-- 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
index 6473044..21c8a7e 100644
--- a/gamemode/shared/questsystem/examplequest.lua
+++ b/gamemode/shared/questsystem/examplequest.lua
@@ -1,14 +1,14 @@
-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)
+-- 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
index f946a7a..67a1f55 100644
--- a/gamemode/shared/questsystem/subterr_generator.lua
+++ b/gamemode/shared/questsystem/subterr_generator.lua
@@ -1,25 +1,25 @@
-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)
+-- 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
index 66fb829..fabfdcf 100644
--- a/gamemode/shared/sh_setup.lua
+++ b/gamemode/shared/sh_setup.lua
@@ -1,168 +1,168 @@
-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
-]=]
+-- 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
index 679035f..ecb8e71 100644
--- a/gamemode/shared/shop.lua
+++ b/gamemode/shared/shop.lua
@@ -1,175 +1,175 @@
-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)
+-- 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)
diff --git a/gamemode/shared/sparkel.lua b/gamemode/shared/sparkel.lua
index 5882aac..c839059 100644
--- a/gamemode/shared/sparkel.lua
+++ b/gamemode/shared/sparkel.lua
@@ -1,5 +1,6 @@
-function sparkel(...)
+
+local function sparkel(...)
local arg = {...}
local looparg = type(arg[1]) == "string" and string.Explode(" ",arg[1],false) or arg
--One pass to find the high and low point
@@ -9,9 +10,11 @@ function sparkel(...)
max = max > v and max or v
min = min < v and min or v
end
- local scale = (max-min)/7
+ local scale = (max-min) / 7
for k,v in pairs(looparg) do
- Msg(utf8.char(9600+(1+(v/scale))))
+ Msg(utf8.char(9600 + ( 1 + (v / scale))))
end
Msg("\n")
end
+
+return sparkel
diff --git a/gamemode/utility/fuzzel.lua b/gamemode/utility/fuzzel.lua
index 6aad45f..56fdaa2 100644
--- a/gamemode/utility/fuzzel.lua
+++ b/gamemode/utility/fuzzel.lua
@@ -117,7 +117,7 @@ local fuzzel = {}
--A clever way to allow the minifier to minify function names, this basically just assigns variables with their string equivalent.
local da, le, di, ra, fu, fi, so, ex, ha, au = "Damerau", "Levenshtein", "Distance", "Ratio", "Fuzzy", "Find", "Sort", "_extended", "Hamming", "Autocomplete"
-local LevenshteinDistance_extended,LevenshteinDistance,LevenshteinRatio,DamerauLevenshteinDistance_extended,DamerauLevenshteinDistance,DamerauLevenshteinRatio,FuzzyFindDistance,FuzzyFindRatio,FuzzySortDistance,FuzzySortRatio,HammingDistance,HammingRatio,FuzzyAutocompleteDistance,FuzzyAutocompleteRatio = le..di..ex,le..di,le..ra,da..le..di..ex,da..le..di,da..le..ra,fu..fi..di,fu..fi..ra,fu..so..di,fu..so..ra,ha..di,ha..ra,fu..au..di,fu..au..ra
+local LevenshteinDistance_extended,LevenshteinDistance,LevenshteinRatio,DamerauLevenshteinDistance_extended,DamerauLevenshteinDistance,DamerauLevenshteinRatio,FuzzyFindDistance,FuzzyFindRatio,FuzzySortDistance,FuzzySortRatio,HammingDistance,HammingRatio,FuzzyAutocompleteDistance,FuzzyAutocompleteRatio = le .. di .. ex,le .. di,le .. ra,da .. le .. di .. ex,da .. le .. di,da .. le .. ra,fu .. fi .. di,fu .. fi .. ra,fu .. so .. di,fu .. so .. ra,ha .. di,ha .. ra,fu .. au .. di,fu .. au .. ra
local function genericDistance( stringa, stringb, addcost, subcost, delcost, ...)
local arg = {...}
@@ -193,7 +193,7 @@ fuzzel.dlr = fuzzel[DamerauLevenshteinRatio]
fuzzel[HammingDistance] = function(stringa,stringb)
local len,dist = strlen(stringa),0
- asrt(len == strlen(stringb), ha.." "..di.." cannot be calculated on two strings of different lengths:\"" .. stringa .. "\" \"" .. stringb .. "\"")
+ asrt(len == strlen(stringb), ha .. " " .. di .. " cannot be calculated on two strings of different lengths:\"" .. stringa .. "\" \"" .. stringb .. "\"")
for i = 1,len do
dist = dist + ((chrat(stringa,i) ~= chrat(stringb,i)) and 1 or 0)
end
diff --git a/gamemode/utility/mapfuncs.lua b/gamemode/utility/mapfuncs.lua
index 579da5f..4066863 100644
--- a/gamemode/utility/mapfuncs.lua
+++ b/gamemode/utility/mapfuncs.lua
@@ -6,7 +6,7 @@ end
function f.take(tbl,num)
local ntbl = {}
- for i=1,num do
+ for i = 1,num do
ntbl[i] = tbl[i]
end
return ntbl
@@ -15,7 +15,7 @@ end
function f.takeRight(tbl,num)
local ntbl = {}
for i = #tbl - num, #tbl do
- ntbl[#ntbl+1] = tbl[i]
+ ntbl[#ntbl + 1] = tbl[i]
end
return ntbl
end
diff --git a/gamemode/utility/stream.lua b/gamemode/utility/stream.lua
index 75beb4c..6d6d5a7 100644
--- a/gamemode/utility/stream.lua
+++ b/gamemode/utility/stream.lua
@@ -15,8 +15,8 @@ local ss = {}
local function WriteString(self,string)
local buflen = #self.buf
- for i=1,#string do
- self.buf[buflen+i] = string.byte(string,i)
+ for i = 1,#string do
+ self.buf[buflen + i] = string.byte(string,i)
end
self.buf[#self.buf + 1] = 0
end
@@ -29,8 +29,8 @@ local function WriteInt(self,num,bytes)
pack[i] = (num & byte) >> (i-1)*8
byte = 255 << i*8
]]
- self.buf[buflen + i] = bit.rshift(bit.band(num,byte),(i-1)*8)
- byte = bit.lshift(255,i*8)
+ self.buf[buflen + i] = bit.rshift(bit.band(num,byte),(i - 1) * 8)
+ byte = bit.lshift(255,i * 8)
end
end
@@ -40,13 +40,13 @@ local function ReadInt(self,len)
tbl[i] = self.buf[i]
end
for i = 1, #self.buf do
- self.buf[i] = self.buf[i+len]
+ self.buf[i] = self.buf[i + len]
end
local byte = 1
local num = 0
for i = 1, #tbl do
num = num + (tbl[i] * byte)
- byte = 2 ^ (i*8)
+ byte = 2 ^ (i * 8)
end
return num
end
@@ -59,7 +59,7 @@ local function ReadString(self)
strlen = strlen + 1
end
for i = 1,strlen do
- self.buf[i] = self.buf[i+strlen]
+ self.buf[i] = self.buf[i + strlen]
end
return table.concat(str)
end