1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00

Merge pull request #211 from Quadrum1/patch-3

Fix serious error
This commit is contained in:
Gerkiz 2022-01-24 22:43:41 +01:00 committed by GitHub
commit ffda7393b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,8 +86,11 @@ local function increment(t, v)
t[#t + 1] = (v or 1)
end
-- Removes the first 100 entries of a table
local function overflow(t)
table.remove(t, 1)
for _=1,100,1 do
table.remove(t, 1)
end
end
local function get_entities(item_name, entities)
@ -443,6 +446,13 @@ local function on_entity_died(event)
return
end
end
if not this.friendly_fire_history then
this.friendly_fire_history = {}
end
if #this.friendly_fire_history > this.limit then
overflow(this.friendly_fire_history)
end
local t = abs(floor((game.tick) / 60))
t = FancyTime.short_fancy_time(t)
local str = '[' .. t .. '] '