Skip to content

Conversation

@IntegratedQuantum
Copy link
Member

I'm open for better name suggestions.

I considered merging this into the decay callback, but I think it makes more sense as a separate thing since it only looks at direct connections.

In the future this could be extended to include carpet and signs.
@careeoki should lanterns and signs break when their support block is broken?

this is a first step towards #2330 and already demonstrates that this makes it more flexible, since now the addon author can decide how a block behaves when neighbor blocks are broken, instead of depending on the rotation mode code.

fixes #1103

@Argmaster Argmaster self-requested a review January 2, 2026 16:17
newBlock.data = @as(u5, @bitCast(data));
if(newBlock.data == 0) newBlock.typ = 0;
} else {
std.log.err("Expected {s} to have cubyz:decayable or cubyz:branch as rotation", .{params.block.id()});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not acceptable IMO.
This shouldn't be hardcoded.
This behavior is specific to a rotation mode, so it should call into rotation mode and determine output data there.

.absorbedLight = 0x010101,
.collide = false,
.rotation = "cubyz:torch",
.onUpdate = .{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you intend to add support requirement to foliage of all sorts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that's reasonable. For now I'm just preserving status quo though, by giving all torch-rotated blocks this property.


var newBlock: Block = params.block;

if(params.block.mode() == main.rotation.getByID("cubyz:torch")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a obvious VTable call material.
Otherwise you will have a wall of if statements for everything that require support checks.
After some thinking, I come to a conclusion that calling into rotation vtable, as I wanted at first, may not be a good idea, so I guess I will have to let it slide for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other reason I kept it outside the VTable is because mods can't put stuff into the VTable either.

It might be worth investigating the usage of a tagged union (with empty fields), which would allow anyone to add new functions to the interface implicitly using an inline switch with @hasDecl.

@IntegratedQuantum IntegratedQuantum merged commit c8b82bf into PixelGuys:master Jan 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Torches don't drop in survival when their support block is broken.

2 participants