Fixed Player Inventory Search

This commit is contained in:
Cooldude2606
2018-03-07 20:02:11 +00:00
parent 8dee2510fa
commit 2c6d52357d
3 changed files with 15 additions and 9 deletions

View File

@@ -49,6 +49,7 @@ end
function search_player(player) function search_player(player)
for category,items in pairs(_root_tree) do for category,items in pairs(_root_tree) do
if category ~= 'low_items' or not Ranking.get_rank(player).allowed('admin-items') then
for _,_inventory in pairs(inventorys) do for _,_inventory in pairs(inventorys) do
local inventory = player.get_inventory(_inventory) local inventory = player.get_inventory(_inventory)
if inventory then if inventory then
@@ -59,6 +60,7 @@ function search_player(player)
end end
end end
end end
end
end end
Event.register({defines.events.on_player_main_inventory_changed,defines.events.on_player_quickbar_inventory_changed},function(event) Event.register({defines.events.on_player_main_inventory_changed,defines.events.on_player_quickbar_inventory_changed},function(event)
@@ -71,6 +73,7 @@ Event.register(defines.events.on_tick,function(event)
local players = game.connected_players local players = game.connected_players
if #players == 0 then return end if #players == 0 then return end
local player = players[math.random(#players)] local player = players[math.random(#players)]
if Ranking.get_rank(player).allowed('all-items') then return end
search_player(player) search_player(player)
end end
end) end)

View File

@@ -53,7 +53,9 @@ groups['Root']:edit('allow',false,{
['clear-player']=true, ['clear-player']=true,
['announcements']=true, ['announcements']=true,
['warp-list']=true, ['warp-list']=true,
['polls']=true ['polls']=true,
['admin-items']=true,
['all-items']=true
}) })
groups['Admin']:edit('allow',false,{ groups['Admin']:edit('allow',false,{
['player-list']=true, ['player-list']=true,
@@ -154,7 +156,8 @@ ranks['Developer']:edit('allow',false,{
ranks['Admin']:edit('allow',false,{ ranks['Admin']:edit('allow',false,{
['game-settings']=true, ['game-settings']=true,
['always-warp']=true ['always-warp']=true,
['admin-items']=true
}) })
ranks['Mod']:edit('allow',false,{ ranks['Mod']:edit('allow',false,{
['go-to']=true, ['go-to']=true,

View File

@@ -14,7 +14,7 @@ Event.register(defines.events.on_entity_damaged, function(event)
if global.player_health[index] == nil then global.player_health[index] = health end if global.player_health[index] == nil then global.player_health[index] = health end
if global.player_health[index] ~= health then if global.player_health[index] ~= health then
if health < global.player_health[index] then if health < global.player_health[index] then
local text = health..' (-'..event.final_damage_amount..')' local text = health..' (-'..math.floor(event.final_damage_amount)..')'
if health > 200 then if health > 200 then
player.surface.create_entity{name="flying-text", color={b = 0.2, r= 0.1, g = 1, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}} player.surface.create_entity{name="flying-text", color={b = 0.2, r= 0.1, g = 1, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}}
elseif health > 100 then elseif health > 100 then