mt-mods / technic

Technic mod for Minetest
18 stars 25 forks source link

Use game/mod-provided screwdriver handlers if present #368

Open Emojigit opened 4 months ago

Emojigit commented 4 months ago

This PR ports the screwdriver code from Minetest Game. In their code, nodes can provide their handler to accept, reject, or do custom rotations. This change prevents weird rotations on nodes, e.g. battery box facing upwards.

For environments without a screwdriver mod, the old behavior is kept.

Note that some servers are using (abusing) the old behavior to trick man-made apple leaves to grow fruits. With this new change, it is no longer possible.

To do

This PR is ready for review.

How to test

  1. Use the Sonic Screwdriver in Minetest Game with the debug screen on.
    1. You can't modify the param2 of non-rotational nodes.
    2. You can't make machines face up.
  2. Use the Sonic Screwdriver in VoxelLibre/Mineclonia.
    1. You can't make Technic machines face up.
    2. You can right-click on slabs to alternate between the top and bottom slabs.
    3. You can make furnaces face up due to the lack of on_rotate handler.
S-S-X commented 4 months ago

Better way to handle this would probably be making machines compatible with mtg screwdriver and then disabling sonic screwdriver on server. I mean sonic screwdriver is mostly used because of the fact it does not have many checks.

But still probably best to wait for more comments, this is a bit complicated topic.

OgelGames commented 4 months ago

Being "broken" is the main point of difference of the sonic screwdriver, if it behaves almost the same as the default screwdriver, then it's just an expensive screwdriver.

I get that not all players/servers agree with the broken behavior of the sonic screwdriver and would like it fixed, but like other "feature-bugs" in technic, it's been around too long to simply get rid of it.

There's more discussion in #267 about it, but I think a setting like enable_feature_bugs (defaulting to disabled) would be good to add, to let users decide if they want the old functionality or have the bugs fixed.