-
Notifications
You must be signed in to change notification settings - Fork 188
Dynamite! #1309
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
Dynamite! #1309
Conversation
Ray based explosions
|
Question: would a pile of dynamite increase its range, or its power? |
New dynamite textures, remove dynamite block model
|
Both, preferably as emergent behavior. I would prefer to avoid dynamite blocks flying around like in minecraft tho. With #1261 we can make dynamite explosion damage blocks it can not break, so consecutive explosions would break blocks damaged by previous ones. As for range, I would like to count how many TNT blocks are touching and merge their explosion strength and range as an optimization. That said current tag based system (
|
|
Resolved conflicts with network refactor. |
c768923 to
8158a14
Compare
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preliminary review, I haven't looked at the actual explosion logic yet.
| @@ -0,0 +1,12 @@ | |||
| .{ | |||
| .tags = .{.canBeIgnited, .explosionMedium}, | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the explosion radius be specifiable as a separate property or something? I'm sure we can spare a u8 per block type for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is wasteful and not a sustainable model. This property will be used by 2 blocks in base game (maybe 5 if you let us be creative). And it is completely irrelevant to performance. Will you add a field for every property that makes sense for 3 blocks? And what if a modification wants to add one of those? Instead we could have a sparse set of hash maps string to zon and just solve that problem in generic way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I think it's only a matter of time until addon creators want to make nuclear explosions with this.
Either way this can be done in the future if you want.
Do some of the changes quantum asked for
apply formatting fix
|
Future improvements:
|
| defer main.stackAllocator.free(name); | ||
| textInput = TextInput.init(.{0, 0}, 128, 22, name, .{.callback = &createWorld}, .{}); | ||
|
|
||
| const widgetWidth = 160; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We call them components, not widgets
| if(!main.server.world.?.allowExplosives) return; | ||
| doExplode(pos); | ||
| } | ||
| fn doExplode(pos: Vec3i) void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not believe this belongs in the network code. Maybe the server world would be a more appropiate place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I think they should be block entities and this code should be inside / next to onInteract, tho it is a big change and big redesign. This also would mean we are back to believing whatever client says, unless we introduce server side onInteract.
IMO we should consider it though because it would be an example of block entity with such interaction and some attached metadata (explosion radius).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you could just propagate it as a block entity data change, then you can check on the server side, if the gamerule is set.
Implementing it as a state change could also allow adding a short delay and some fuse particles before detonating.
|
Closing until it's a priority to integrate similar stuff into engine. |







Description
This pull request introduces sulfur based explosives:
Dynamite stick is crafted from 2 sulfur and 2 coal
It can be placed like torch and can be ignited with torch. Explosion is instant and does not harm player.
Dynamite block can be crafted with 16 dynamite sticks
It has significantly higher block damage and damage radius
Explosions are done with ray casting and take resistance and health of block they break into account to reduce the radius of the explosion. Blocks marked as air and fluid are not destroyed.
Links
Depends on: #1313
Related to: #849