Maintenance Madness

by Arcitos

Adds a complete new game mechanic: Maintenance! Create a sophisticated spare parts logistics and bring your mall to its absolute limits! UPS-friendly and MP-tested - Now with a fancy GUI!

Tweaks
3 years ago
0.17 - 0.18
16

b [Fixed] Idle Maintenance breaks for burner miners

4 years ago

(I added some logging)

182.941 Script @MaintenanceMadness/control.lua:1034: {
age = 32.725000000000009,
id = 1763
}
182.941 Script @MaintenanceMadness/control.lua:1035: {
ageing = 32.725000000000009,
bonusCyclesRemaining = 0,
entity = {
self = "userdata: 0x000001684e76e150"
},
producedItems = 0,
status = "operating"
}
182.941 Script @__MaintenanceMadness
/control.lua:1040: "burner-mining-drill"
182.941 Script @MaintenanceMadness/control.lua:1041: "mining-drill"
182.941 Script @MaintenanceMadness/control.lua:1051: ID: 1763 | Age: 32.725
182.941 Error MainLoop.cpp:1183: Exception at tick 2265267: The mod Maintenance Madness caused a non-recoverable error.
Please report this error to the mod author.

Error while running event MaintenanceMadness::on_tick (ID 0)
Entity is not crafting-machine.
stack traceback:
MaintenanceMadness/control.lua:1052: in function <MaintenanceMadness/control.lua:1022>
stack traceback:
[C]: in function 'index'
__MaintenanceMadness
/control.lua:1052: in function <MaintenanceMadness/control.lua:1022>

4 years ago

Quick (and I believe correct) patch :

--- a/control.lua
+++ "b/MaintenanceMadness_0.9.3\control.lua"
@@ -1031,12 +1031,14 @@ function(event)
for , element in ipairs(global.eventScheduleMRO[event.tick].elements) do
--game.print(
.." ,"..element.id.." ,"..element.age)
local entityData = global.monitoredEntities[element.id]
- --log(serpent.block(element, {maxlevel= 2}))
- --log(serpent.block(entityData, {maxlevel= 3}))
+ -- log(serpent.block(element, {maxlevel= 2}))
+ -- log(serpent.block(entityData, {maxlevel= 3}))
if entityData ~= nil and entityData.entity and entityData.entity.valid then
local realEntity = entityData.entity
local entityName = entityData.surrogatedEntityName or realEntity.name
local status = entityData.status
+ -- log(serpent.block(realEntity.name, {maxlevel= 2}))
+ -- log(serpent.block(realEntity.type, {maxlevel= 2}))
if not global.entitiesWithMROenabled[entityName].active then
-- Stop maintenance for this entity
stopMaintenanceCycle(element.id)
@@ -1044,7 +1046,7 @@ function(event)
end

                            -- Handle idle crafting machines. At first, check if this machine is operating. Then check, if this is a crafting machine
  • if status == "operating" and entityData.producedItems ~= nil then
  • if status == "operating" and entityData.type == "crafting-machine" then
    -- Check if this machine has finished at least one product since the last maintenance event.
    log("ID: "..tostring(element.id).." | Age: "..tostring(element.age))
    log("Produced items: "..tostring(realEntity.products_finished).." | Machine inactive: "..tostring(entityData.producedItems >= realEntity.products_finished))
4 years ago

Ughh... I'm sorry - Fix is on the way.

4 years ago

I found the issue. I'll release the next version at circa 6 pm CET, i'm just to tired to get everything polished right now ;)

4 years ago

No worries, I made a local patch so it's not bothering me. Take your time!

4 years ago

Ok, the fix is online, it took a bit longer, because in the way i discovered another bug ^^

4 years ago

Such is software development :) Thanks!

New response