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/core/npc/sv_huntingspawner.lua | |
| parent | 61bc16dae5a1b61bcd237d9f0be36125829d95b1 (diff) | |
| download | artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.gz artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.bz2 artery-233e478e40d72a091f70f18dc6846066a4f52016.zip | |
Fix all linter warnings
Diffstat (limited to 'gamemode/core/npc/sv_huntingspawner.lua')
| -rw-r--r-- | gamemode/core/npc/sv_huntingspawner.lua | 20 |
1 files changed, 9 insertions, 11 deletions
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) |
