ChoGGi / SurvivingMars_CheatMods

Collection of mods for the game Surviving Mars
Other
69 stars 47 forks source link

Disable Drone Maintenance mod - obj.RequestMaintenance() does not always work #15

Closed mk-fg closed 5 years ago

mk-fg commented 5 years ago

Hi,

Playing with another "disable drone maintenance" mod, found a bug, which should exist here as well.

It happens when you disable maintenance when drone is underway to repair building, in which case:

Then, re-enabling maintenance anytime later will run obj:RequestMaintenance() (both from AccumulateMaintenancePoints() and explicitly in this mod), but RequestMaintenance() has if self.maintenance_phase == false then ... end in it, so won't do anything when maintenance_phase is already set to "demand" (which I think is done to prevent any duplicate requests).

So building stuck with no maintenance requests and maintenance_phase = "demand" will never get fixed - a state which this mod can produce.

Specific fix that I used in a similar mod: https://github.com/mk-fg/games/commit/5dbe69d26db025490f6af163608c7dc0d0396263 Though I'm sure it can be done in other ways, and obj:ResetMaintenanceRequests() there is probably redundant.

Cheers!

ChoGGi commented 5 years ago

Thanks