Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nonfreegithub opened this issue Dec 6, 2023 · 4 comments
Labels
Discussion Enhancement New feature or request

Comments

@nonfreegithub
Copy link
Contributor

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
Copy link
Member

S-S-X commented Dec 6, 2023

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
Copy link
Contributor Author

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
Copy link
Member

S-S-X commented Dec 6, 2023

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
Copy link
Member

S-S-X commented Dec 6, 2023

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:

function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
if send_function == nil then
send_function = technic.send_items
end
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local pos1 = vector.new(pos)
local x_velocity = 0
local z_velocity = 0
-- Output is on the left side of the furnace
if node.param2 == 3 then pos1.z = pos1.z - 1 z_velocity = -1 end
if node.param2 == 2 then pos1.x = pos1.x - 1 x_velocity = -1 end
if node.param2 == 1 then pos1.z = pos1.z + 1 z_velocity = 1 end
if node.param2 == 0 then pos1.x = pos1.x + 1 x_velocity = 1 end
local output_tube_connected = false
local node1 = minetest.get_node(pos1)
if minetest.get_item_group(node1.name, "tubedevice") > 0 then
output_tube_connected = true
end
local tube_time = meta:get_int("tube_time") + tube_upgrade
if tube_time >= 2 then
tube_time = 0
if output_tube_connected then
send_function(pos, x_velocity, z_velocity)
end
end
meta:set_int("tube_time", tube_time)
end

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants