aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core
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/core
parent61bc16dae5a1b61bcd237d9f0be36125829d95b1 (diff)
downloadartery-233e478e40d72a091f70f18dc6846066a4f52016.tar.gz
artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.bz2
artery-233e478e40d72a091f70f18dc6846066a4f52016.zip
Fix all linter warnings
Diffstat (limited to 'gamemode/core')
-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
15 files changed, 171 insertions, 177 deletions
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)