Added item return to spawn for corpes

This commit is contained in:
Cooldude2606
2019-03-25 20:22:18 +00:00
parent 03dfcb46a7
commit 15bc0e033b
3 changed files with 16 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ local Event = require 'utils.event'
local Game = require 'utils.game'
local Global = require 'utils.global'
local config = require 'config.death_logger'
local format_time = ext_require('expcore.common','format_time')
local format_time,move_items = ext_require('expcore.common','format_time','move_items')
local deaths = {
archive={} -- deaths moved here after body is gone
@@ -78,6 +78,14 @@ if config.show_map_markers then
end)
end
if config.auto_collect_bodies then
Event.add(defines.events.on_character_corpse_expired,function(event)
local corpse = event.corpse
local items = corpse.get_inventory(defines.inventory.character_corpse).get_contents()
move_items(items,corpse.surface,{x=0,y=0})
end)
end
-- this is so other modules can access the logs
return function()
return deaths