Fixed A Few Bugs

This commit is contained in:
Cooldude2606
2018-01-28 00:05:18 +00:00
parent 10ab2601a5
commit da0836b6d7
2 changed files with 7 additions and 4 deletions

View File

@@ -209,5 +209,6 @@ end)
function Admin.bring(player,by_player)
local player = Game.get_player(player)
local _player = Game.get_player(by_player)
if not player or not _player then return end
player.teleport(_player.surface.find_non_colliding_position('player',_player.position,32,1),_player.surface)
end

View File

@@ -49,16 +49,18 @@ function search_player(player)
for category,items in pairs(_root_tree) do
for _,_inventory in pairs(inventorys) do
local inventory = player.get_inventory(_inventory)
for _,item in pairs(items) do
local found = inventory.remove(item)
if found > 0 then take_action(player,item,category) end
if inventory then
for _,item in pairs(items) do
local found = inventory.remove(item)
if found > 0 then take_action(player,item,category) end
end
end
end
end
end
Event.register(defines.events.on_tick,function(event)
if (game.tick%1800) == 0 then
if (game.tick%900) == 0 then
local players = game.connected_players
if #players == 0 then return end
local player = players[math.random(#players)]