diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-24 20:32:34 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-24 20:32:34 -0400 |
| commit | 233e478e40d72a091f70f18dc6846066a4f52016 (patch) | |
| tree | cf34be714088889731736c81bd44e198c792625a /gamemode/server | |
| parent | 61bc16dae5a1b61bcd237d9f0be36125829d95b1 (diff) | |
| download | artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.gz artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.bz2 artery-233e478e40d72a091f70f18dc6846066a4f52016.zip | |
Fix all linter warnings
Diffstat (limited to 'gamemode/server')
| -rw-r--r-- | gamemode/server/heatmap.lua | 48 | ||||
| -rw-r--r-- | gamemode/server/sv_config.lua | 38 | ||||
| -rw-r--r-- | gamemode/server/sv_mapchange.lua | 10 | ||||
| -rw-r--r-- | gamemode/server/sv_mapconfig.lua | 136 |
4 files changed, 115 insertions, 117 deletions
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) |
