mt-mods / technic

Technic mod for Minetest
18 stars 25 forks source link

Any Machine base containing a control logic unit ejects items randomly from the left or right #336

Closed nonfreegithub closed 11 months ago

nonfreegithub commented 11 months ago

These should always eject items from the right side.

The machine that contains the control logic unit, ejects on the right side, if you close the game and enter again, it now ejects on the left, or not, it is random.

It is a problem for the construction of pipeworks tube systems, which fail when the side from which the items are ejected is reversed.

screenshot_20231206_182656

S-S-X commented 11 months ago

Machines do not eject randomly, direction depends on machine orientation and probably wont be changed anytime soon because doing that would break a lot of stuff.

nonfreegithub commented 11 months ago

Machines do not eject randomly, direction depends on machine orientation

This should be like this, but it's not, that's why I'm reporting this bug, because it's random.

My machine was ejecting from the right, so I set up my tubes, after exiting the game and re-entering, now my machine is ejecting from the left, and my entire construction has been broken

S-S-X commented 11 months ago

This should be like this, but it's not, that's why I'm reporting this bug, because it's random.

Machines do not eject randomly, direction depends on machine orientation and probably wont be changed anytime soon because doing that would break a lot of stuff.

It is bit complicated and confusing at first but still it is 100% predictable. It is true it changes relative direction but that does not make it random, it is 100% predictable even while a bit annoying.

It would be nice to improve this behavior but I don't think separate configuration for direction really makes sense (even while it could be a tiny bit better in some edge cases). But then also if it would get fixed then probably explicit direction configuration for machines or different behavior for newly placed machines would be required.

Different behavior for newly placed machines however makes it confusing for players who do know how it works and know how to calculate output direction based on orientation. For this it would probably help if there would be explicit machine specific configuration.

There's many ways to make it better but current behavior is not random and cannot be blindly updated because doing so would break a lot of existing factories, some backwards compatible way to make it simpler would be needed.

S-S-X commented 11 months ago

We could fairly easily add metadata direction setting for new machines and make output relative to machine orientation without doing confusing relative direction swap when machine is rotated, best case it would also add support for upward + downward directions while at it, meta value check and output direction selection should then be done here: https://github.com/mt-mods/technic/blob/f1b99282e889e9a483c76af95ee3370b6d2b2d04/technic/machines/register/common.lua#L87-L117

Machines would also require one time metadata write when placed, that way old machines would keep swapping relative direction of output and keep old factories running but newly placed machines would get new behavior.

On top of that, if needed, it would be fairly easy to later add an configuration input for machine formspec to actually allow selecting output direction. There it should allow at most 5 directions: left, right, back, top, bottom but not front. Some machines, at least battery box, are already using top slot for special stuff but I don't think none of them are actually using top for output, only for special input.