Basically i don't know why but this line of code consumes more update time than the others 3k lines
This part of code only gets if you have less health
Code: Select all
if event.tick % 180 then
for _,v in ipairs(game.players) do
local healthless = (game.entityprototypes[v.character.name].maxhealth - v.character.health) -- <---- here
if healthless > 0 then
-- ...
end
glob.cursed[v.name].aux.lasthp = v.character.health or 100
end
end
Code: Select all
local healthless = (100 - v.character.health)

Both are in a new map and just beginning
Before this if set game.speed = 10, I has decreased fps.
Now i can set game.speed = 50 without problems.
It is a big change only with a line, i used the same line in event.tick%30 too without problems, i don't know why.
If you need, here is all the mod, the problem is in the line 777 of control.lua