Piston-breakable nodes don't fill up the push limit, items properly drop #3813
No reviewers
Labels
No Label
#P1 CRITICAL
#P2: HIGH
#P3: elevated
#P4 priority: medium
#P6: low
#Review
annoying
API
bug
code quality
combat
commands
compatibility
configurability
contribution inside
controls
core feature
creative mode
delayed for engine release
documentation
duplicate
enhancement
environment
gameplay
graphics
ground content conflict
GUI/HUD
help wanted
incomplete feature
invalid / won't fix
items
looking for contributor
mapgen
meta
mineclone2+
Minecraft >= 1.13
Minecraft >= 1.17
missing feature
mobile
mobs
mod support
model needed
multiplayer
Needs adoption
needs discussion
needs engine change
needs more information
needs research
nodes
non-Minecraft feature
non-mob entities
performance
player
possible close
redstone
release notes
schematics
Skyblock
sounds
Testing / Retest
tools
translation
unconfirmed
mcl5
mcla
Media missing
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: VoxeLibre/VoxeLibre#3813
Loading…
Reference in New Issue
No description provided.
Delete Branch "seventeenthShulker/MineClone2:piston_digs_properly"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Scenario 1
Details (outdated)
By keeping track of nodes with
dig_by_piston
separately from those which don't,mesecon.mvps_get_stack
does not add piston-breakable nodes to the counter that stops anything over 12 blocks from moving. This way, Scenario 1 becomes possible (a piston moving 8 slime blocks into 8 sugar canes), as it is in Minecraft. The function still aborts when it reaches more than 12 'regular' solid nodes, since if nothing is going to move, nothing will break.There are some minetest-side issues with
dig_node
, since it expects a player. Thehandle_node_drops
wrapper was a good fit for this problem, and simulates the drops unless the block is not in thedig_by_piston
group.I also noticed that only one bamboo node (
bamboo
) could be piston-broken, and NOTbamboo_1
,bamboo_2
orbamboo_3
. This is because they were not added to thedig_by_piston
group like the original node.I reckon there are performance tweaks that could be made, although I do not notice any difference on my machine.
Testing
Probably needs quite a bit of testing to make absolutely sure there is no duplication.
dig_by_piston
properly workP.S.
Empty shulker boxes only drop in Survival Mode. This seems to be because they do not drop anything in Creative Mode.
Whoops it didn't rebase..
e781bf7c31
to42714bbbe1
42714bbbe1
tocdc1544aff
Found issues:
Sifting through all nodes in the
dig_by_piston
group, I discovered some nodes used to drop double, but only when in direct contact with the piston pushing them.Duplication was because of the
mesecon.mergetable
function from mesecons/utils outputting a table of length 2, when the inputs were of length 0 and 1 respectively. This is because if thedest
table is shorter than thesource
table, some entries insource
appear duplicated in the output. This was causing two calls to the bit that drops stuff, for the same node.I don't know what other effects changing the original function will have, or if there is a reason for this weirdness, so I added an
mesecon.join_table
function to utils, which properly combines the two inputs. Another approach would have been to verify that#dest
>=#source
, but I didn't want to rely onmergetable
as it is now.Additionally:
Double tall flowers
do not drop anything, as they arewere set asbuildable_to
unlike regular flowers. Looking at https://minecraft.fandom.com/wiki/Tag#Blocks, underreplaceable
, double tall flowers are not listed.This should be changed, unless they are still replaceable in Minecraft despite not being in the tag.Weeping and Twisting Vines are not supposed to be
buildable_to
; removing this allows pistons to drop items when broken, but messes up the vertical placement logic. So I am leaving them alone.I found what is likely the cause of 'random' nodes not dropping. From minetest's API docs, at https://minetest.gitlab.io/minetest/minetest-namespace-reference/#environment-access:
Since no player is taking the action, maybe it assumes the 'player' is using their hand, so it drops nothing for most nodes?. I then found
handle_node_drops
(line 246) in https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ENTITIES/mcl_item_entity/init.lua. This is an override of the default minetest logic for determining whether a node can drop item(s), that specifically "allows digger to be nil". I am looking into whether re-using this could be a more elegant fix than hacking together a fake dig_node.If this thing is working now, as it seems to be, it hopefully also fixes #3547, and I have no idea how to work with protected areas but I'm fairly certain #1598 will not be affected as it doesn't know who activated the piston, nor does it pass that information on.
This is out of scope for this PR:
After the more difficult part of determining the player behind the push/pull interaction, someone could try passing the player into
handle_node_drops
(mods/ITEMS/REDSTONE/mesecons_mvps/init.lua, line 288) as a third argument.I wrote the bamboo that way, because of how it breaks, and the fact that it can drop two items on a specific random chance. (And, well, it was easier and more accurate to do it that way, than with minetest's drop_table.)
The variants are copies of the original node, and the group should have propagated, like the other groups. Where it might be an issue is in the actual piston code (because I had to add it to there, too, to make it pushable.)
Shulker Boxes should always drop in survival, regardless of contents. And, should be pushable unless open. Creative mode, iirc, pistons should cause them to drop. It's only when broken by the player, does it destroy the item in creative. However, I can see that being an issue, as the engine interferes based on gameplay type (dig node). So, for pistons, may have to write a special dig / destroy/ etc.
They were all manually set after shallow copying (
table.copy
) the table, just some were missing thedig_by_piston
. There is a recursive 'deep copy' utility function atmods/ITEMS/REDSTONE/mesecons/util.lua
, but it isn't used outside of REDSTONE (module reasons?) and it creates an entirely new table. In other parts of thespaghetti bowlcodebase, I have seentable.copy
used to copygroups
between nodes, this might be a good separate change request?Yep, there might need to be an override or something for empty shulker boxes. It might be better if the
on_destruct
checked if the 'player' inventory already has (an empty shulker box) before deciding to drop/give one. (Currently it just checks if your inventory is empty...) Something like:Also, I don't know how to check if the box is open. Barrels have a 'blockstate' for open/closed. Currently pushing open shulker boxes just closes the formspec and breaks the box.
But I might leave shulker boxes alone because the PR is getting a bit broad.
TBH, the Bamboo module was a nightmare to keep track of, especially while doing other requests for everyone and helping out in both discord and in here. I'm happy that it's readable, and it put bamboo into the game before Mojang/Microsoft had it.
The shulkers... completely different issue, and I advise knocking out one issue at a time. Losing track of scope makes things a nightmare for everyone... reviewers, testers, YOU... lol.
Also, you should copy the image back to your computer or clipboard, and upload/paste it into the original comment. (if it's on your clipboard, you can Ctrl-V or Shift-INS it in.)
That way, it's there 3 yrs from now, and some poor
suckerDev trying to figure things out has it for reference.WIP: Piston-breakable nodes no longer fill up the push limit, and items properly dropto WIP: Piston-breakable nodes no longer fill up the push limit, items properly dropWIP: Piston-breakable nodes no longer fill up the push limit, items properly dropto WIP: Piston-breakable nodes don't fill up the push limit, items properly dropShould be protection-sensitive now. Examples of when an action is not permitted (ticked boxes completed):
Even if part of a connected (by slime or honey) series of blocks is outside a protected area, pushing/pulling will not occur.
If someone else's piston was already there before it was protected by you, it will not push unless it only affects nodes outside the protected area, but it can retract if it was extended in the first place.
This is all assuming the placer of the piston does not match the owner of the protected node(s).
If the owners match, pistons work like normal.
ab88ec4219
to23bff89cfa
WIP: Piston-breakable nodes don't fill up the push limit, items properly dropto Piston-breakable nodes don't fill up the push limit, items properly drop23bff89cfa
to0ebaefefc3
Um forgot to rebase cleanly the first time...
Picked this up again and fixed a conflict as there were no further bugs discovered on my end. Hence, no longer in WIP.
Signs are destroyed by pistons and don't drop anything.
Cactus is destroyed by piston putting a block next to it (as it should), but doesn't drop anything.
Walls don't update their orientation when moved by pistons, or when neighboring blocks are moved by pistons. In the same time, fences and bars (and glass panes) work correctly.
@ -560,3 +571,3 @@
mesecon.register_mvps_unsticky("mcl_cake:cake_6")
mesecon.register_mvps_unsticky("mcl_cake:cake")
-- Carpet
-- Carpet - pullable in MC but breaks when pulled downwards. At the moment, it just cannot be pulled.
While you are at it, could you make it so that it is pullable in any direction but upwards?
Crying obsidian and lodestone are pushable by pistons. They shouldn't be.
Piston-breakable nodes don't fill up the push limit, items properly dropto [WIP] Piston-breakable nodes don't fill up the push limit, items properly dropCan confirm, and this is only when a block is being pushed into a sign.
Could not reproduce (drops as expected) - any particular block?
More complicated. Panes and bars will sometimes refuse to connect, but will usually connect if they are pushed/pulled next to another pane/bar with an edge pointing the same direction.
Turns out walls and panes/bars don't use the
connected
nodebox type like fences do. This might be because they were added before late 2015 when this became a thing https://github.com/minetest/minetest/pull/3503. Fences were updated at some point to use theconnected
type, but I don't know if this is why only fences reconnect on move. I can't find anything telling fences to check adjacent blocks, so it might be a Minetest thing.6806e5f627
to86942970db
Now nothing can be pushed into a sign... it is normal Java behavior. Similarly to bedrock, we have no reason to do that. But can we? Absolutely. Accepted behavior.
For cactus, try with a single cactus block. It seems it is destroyed also when placing a block next to it, so not related to this PR.
For walls, great catch! Not only fences, but panes also use the "connected" nodebox from what I've seen, and I've seen both work correctly with pistons. So walls need to be updated. Not for this PR either. I created an issue for that already.
Now, the only thing remaining is that carpet behavior. Do you think you can implement it? Or you would like it to stay the way it is?
Cacti are weird in MC. If an item drop touches them, the item drop is destroyed. Also, if a block is placed next to a cactus, the cactus breaks. Kinda just sounding it out, for myself... As, I
am confused herewas confused here.gotcha. That's probably an update issue. (I recognize that this is not related to this PR.)
(I hope the images uploaded in the right order)
So, it turns out removing the carpet nodes from the
mesecon.register_mvps_unsticky
block resulted in what seems like ideal behavior.First image; lever starts as off.
Second image; lever is now on.
Third image: lever is now off.
Pulling carpet down will break the carpet since it is no longer supported (for a split second) by any supporting block.
Pulling/pushing it onto a supporting block (even a lever or another carpet) does not break it (as expected).
Trying to pull it up off the ground will break it (expected, probably)
Also, carpet placement doesn't check if the position is unsupported, so if you spam carpets on the side of a pillar they immediately drop. Separate issue, anyway.
This is likely not possible in MC, but should probably be a feature anyway since we (currently) don't have an issue with carpet duping. The same arrangement with a horizontal piston is also stable.
Are you going to make any further changes to this PR? Why is this still WIP?
No, that should be it, as long as there aren't any more blocks I've missed. Will remove the WIP.
[WIP] Piston-breakable nodes don't fill up the push limit, items properly dropto Piston-breakable nodes don't fill up the push limit, items properly drop3675652c0c
to00cfca5947
I'm approving this, can't formally approve due to Mesehub not working properly again.