From 233e478e40d72a091f70f18dc6846066a4f52016 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 24 Aug 2017 20:32:34 -0400 Subject: Fix all linter warnings --- gamemode/core/npc/cl_npcmap.lua | 124 ++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 57 deletions(-) (limited to 'gamemode/core/npc/cl_npcmap.lua') 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) -- cgit v1.2.3-70-g09d2