bugfix for power outage on KI core

This commit is contained in:
PreLeyZero 2022-05-30 00:42:17 +02:00
parent 94663f6f78
commit c02dce9248
2 changed files with 27 additions and 0 deletions

View file

@ -1,3 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.0.25
Date: ??.??.????
Bugfixes:
- fixed bug where KI core would still transmit modules when power was cut
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 1.0.24 Version: 1.0.24
Date: 27.5.2022 Date: 27.5.2022

View file

@ -419,6 +419,13 @@ function el_ki_core_working()
local oldactive = global.ki.core[i].active local oldactive = global.ki.core[i].active
global.ki.core[i].active = global.ki.core[i].entity.is_crafting() global.ki.core[i].active = global.ki.core[i].entity.is_crafting()
if global.ki.core[i].active then
if global.ki.core[i].entity.energy < global.ki.core[i].entity.prototype.energy_usage then
global.ki.core[i].active = false
global.ki.dirty = true
end
end
if not oldactive == global.ki.core[i].active then if not oldactive == global.ki.core[i].active then
global.ki.dirty = true global.ki.dirty = true
end end
@ -432,6 +439,13 @@ function el_ki_buffer1_working()
local oldactive = global.ki.buffer1[i].active local oldactive = global.ki.buffer1[i].active
global.ki.buffer1[i].active = global.ki.buffer1[i].entity.is_crafting() global.ki.buffer1[i].active = global.ki.buffer1[i].entity.is_crafting()
if global.ki.buffer1[i].active then
if global.ki.buffer1[i].entity.energy < global.ki.buffer1[i].entity.prototype.energy_usage then
global.ki.buffer1[i].active = false
global.ki.dirty = true
end
end
if not oldactive == global.ki.buffer1[i].active then if not oldactive == global.ki.buffer1[i].active then
global.ki.dirty = true global.ki.dirty = true
end end
@ -457,6 +471,13 @@ function el_ki_buffer2_working()
local oldactive = global.ki.buffer2[i].active local oldactive = global.ki.buffer2[i].active
global.ki.buffer2[i].active = global.ki.buffer2[i].entity.is_crafting() global.ki.buffer2[i].active = global.ki.buffer2[i].entity.is_crafting()
if global.ki.buffer2[i].active then
if global.ki.buffer2[i].entity.energy < global.ki.buffer2[i].entity.prototype.energy_usage then
global.ki.buffer2[i].active = false
global.ki.dirty = true
end
end
if not oldactive == global.ki.buffer2[i].active then if not oldactive == global.ki.buffer2[i].active then
global.ki.dirty = true global.ki.dirty = true
end end