Fix crash when blowing up an unknown node #38
Labels
No Label
blocker
bug
code quality
confirmed
critical
discussion
high priority
incompatibility
incomplete feature
invalid
low priority
missing feauture
needs testing
packet spam
performance
project
regression
translations
unconfirmed
in review
ready for review
No Milestone
No project
No Assignees
4 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Mineclonia/Mineclonia#38
Loading…
Reference in New Issue
No description provided.
Delete Branch "mcl_explosions"
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?
The problem is that unknown nodes do not have a blast resistance which leads to a crash. This solves that by giving them a blast resistance of zero.
I think it can be discussed how unknown nodes should behave when it comes to explosions.
One alternative would be to make unknown nodes have a blast resistance of zero but not be removed after an explosion. But I do not think making a more complicated solution just to handle unknown nodes differently from other nodes would be the justified. This is because they should be very rare and only occur after errors when updating mods. I think just assigning them a blast resistance (either zero or indestructible) is the best solution.
Overall I think giving them a blast resistance of zero makes sense since that is the default value for all other nodes without a defined blast resistance. This makes them somewhat vulnerable to creeper explosions though.
@ryvnf: Do you have any suggestions how I could test this? I found now way to create an unknown node via commands so I've no clue how I could provoke the crash.
This is what I used for testing. Place it in the
mods/unknown/init.lua
and enable it for the testing world. It should then show up in the creative inventory. Place one or more node of it in the world. Then log out and disable the mod to make it become an unknown node.@ryvnf Would that snippet actually cause the crash if blown up? It looks like it specifies
_mcl_blast_resistance
in the item spec.@e That was for testing my enchanting changes. It will only crash if it actually becomes an unknown node and for that to happen the mod needs to be disabled after placing the node.
I agree. i guess any more complicated solution would not pass the "solution fits in head" test.
I agree, “can be blown up” is the default and it is what I would expect, too.
I would appreciate a comment in the code that this prevents crashing on unknown nodes, because otherwise to future developers it might look like some bug fix that might not be necessary anymore.
39216ded3a
to31341ca57b
Made a comment to clarify that the
or 0
is to set the blast resistance of unknown nodes to 0.Test successfull. I created an unknown block according to the instructions @ryvnf gave.
Please find attached the debug-log for the crash.
Fix successful
Details and debug.log excerpt for crash can be found here: #38 (comment)
The comment is good. Let me double-check that I can reproduce what @n_to did really quick, maybe I notice something else (probably not though).
I tested this using the pontoons mod for unknown nodes.
It crashed when exploding several unknown pontoon nodes using TNT without this patch.
It did not crash when exploding several unknown pontoon nodes using TNT with this patch.