Tweaks
5 months ago
2.0
1.39K

b Can only upgrade cranes but not downgrade

6 months ago

Both when using Update Planner's drag selection and when specifying inserters upgrading only goes up but not down.

5 months ago

Hello i think i know what is causing the problem, i'll try to fix this soon ill update the code if it works.

5 months ago
(updated 5 months ago)

I think i misunderstood the problem, the upgrade planner should work but you must choose the correct version of the crane/s to downgrade (same hand capacity) or choose ALL the variants just to be sure, sadly i don't think its possible to avoid this.

For example to downgrade any MK02 to a MK01, in the "FROM" column you would add every variant of the MK02, in the "TO" column you can select any variant of the MK01 it doesn't matter.

If you can check this planner should work:

0eNrFkt0KwjAMRt8l1xPc/NsKPomIBBel2Ka1y0QZfXdTQa/1yrvkBJJD+CYY4zlhT4fokJkSmAkGErF8HkrtMUZKWu4mOKXgC5NHJDBALFYeUAGjL/0xIdPMXxpF1xFdGRrgkDw6RcfgIyaUoDdgC7kCCV9sqxX50I+ODs56K2DmHzC4IEVtr8ss93TXYa6+Fx3rf6ouf1L961fb/GqE1PWdmNk7MRXcNCE2MJjVuumWXbda15tF27Q5PwH9WMoB

The problem is caused by the many entities generated for each crane, ie: MK02, MK02u1 and MK02u2. When upgrading there is no problem because each entity has its next_upgrade field set correctly.

5 months ago

Okay, I see. Found a couple of other minor bugs but they all related to this multiple entities quirk.

I'll add your fix as a required dependency in the following days.

5 months ago

Yes its kind of a hacky solution to be honest but there is really no proper way to implement the capacity upgrades, the ideal solution would be that the factorio devs add support to customize the capacity bonus effect in the InserterPrototype, maybe posting a feature request for future versions.
If you want to incorporate the code into your mod feel free to use it, no need to add this mod as dependency (unless you prefer to).
Are the bugs you found related to the upgrade planner only?

5 months ago

Yes its kind of a hacky solution to be honest but there is really no proper way to implement the capacity upgrades

Yeah, I know all about it, technology effect types are all hardcoded and are a sole reason I had to resort to boosting the speed initially.

If you want to incorporate the code into your mod feel free to use it, no need to add this mod as dependency (unless you prefer to).

I prefer not to take credit for other people's work so unless you'll go MIA for months while there's some game breaking bug or something I'd've liked to keep it this way.

Are the bugs you found related to the upgrade planner only?

They're related to having to have several entities of the same crane but they're all minor.

Also don't sweat it about having a cluttered upgrade planner. In 1.1 Nullius had its buildings' flipped liquid inputs implemented in the same way by creating a separate flipped entity which you had to additionally pick and specify in all planners so it's very much an acceptable inconvenience.

5 months ago
(updated 5 months ago)

Also please remove your dependency on the main mod so I could add a dependency on yours to mine

5 months ago

Here's a pretty notable bug tho, when upgrading/downgrading entities in sandbox mod, you sometimes get entities with wacky parameters. Here's a clip of me downgrading a 3x1 MK2 crane into 3x1 MK1 with MK1 crane having a handsize of 7 instead of 3.

5 months ago
(updated 5 months ago)

Hello, ok i'll remove the dependency.
About the bug, i managed to reproduce it using that mod, the problem is when in sandbox mode it creates entities via script when you copy/paste or upgrade, etc. I've added handling of the script_raised_built() event and the planner problem seems fixed.
However if you create a blueprint or copy a ghost of a wrong version of the entity, it will probably build the wrong one (in sandbox only), the issue is the mod does not seem to be generating events when it builds ghosts, ill have to take a deeper look into the code to see if i can fix this.
A possible bug case would be if for example you create blueprints containing cranes on a save that have +1 inserter capacity researched then, if you pasted that blueprint inside a sandbox on a new game it will create cranes with handsize 5 instead of 3.

Im uploading the updated code with the planner fix for the sandbox mod and removing the dependency, if you can check the bug if you can still reproduce it in another way. I'll study the sandbox mod to see if i can somehow fix the ghost building issue.

5 months ago

I think i've fixed the bugs while using the sandbox mod, just uploaded the new version check when you can.

5 months ago

Also please remove your dependency on the main mod so I could add a dependency on yours to mine


I have removed pycranes as a dependency but i think it may cause problems when you add this as a dependency for pycranes.
For this mod to work the crane entities must be fully created, if you add this as dependency it will run before you complete the entity creation process, even if im using data-final-fixes.lua it wont help because you also are using it, and dependencies load first. Anything that your data-final-fixes.lua does to the crane entities will NOT be present on the copies this mod will create!

More about this:
https://lua-api.factorio.com/latest/auxiliary/data-lifecycle.html

[deleted message]
5 months ago
(updated 5 months ago)

i think it may cause problems when you add this as a dependency for pycranes

You're right, I shouldn't've asked for that. Sorry, please revert to having a dependency (and I'll add mine to be the one that doesn't affect load order from my side, I forgot you can do that).

However if you create a blueprint or copy a ghost of a wrong version of the entity, it will probably build the wrong one (in sandbox only), the issue is the mod does not seem to be generating events when it builds ghosts, ill have to take a deeper look into the code to see if i can fix this.

Even if you won't be able to, I think this is a very fringe case that won't happen unless a player goes out of his way to do so, so all fine.

Thx for fixing the sandbox upgrading, that action you do perform quite frequently.

5 months ago

Ok im adding the the dependency again.
After playing around with the sandbox mod i discovered a few more bugs, i fixed most (hopefully) there is one corner case i'm going to fix in the next days when i get some time that is when you enable all techs in sandbox, and then you disable all techs, the cranes don't get auto downgraded (only those inside the sandbox), but its an easy fix i hope, the other bugs should now be fixed: upgrade/downgrade with planner and copy paste of ghost/blueprint should always place always correct versions despite what is in the blueprint/planner.
In theory now the mod can handle different forces correctly since that's what the sandbox mod uses to allow the unlock techs feature, so PvP should work or mods that create other forces.
I've uploaded version 1.0.4 with the changes.

5 months ago
(updated 5 months ago)

Sounds great, I'm updating my mod with a dependency on yours. Thanks for your work and the contribution.

New response