mt-mods / technic

Technic mod for Minetest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

nonfreegithub opened this issue · comments

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

commented

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.

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

commented

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.

commented

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.