-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Crash if calling minetest.pointed_thing_to_face_pos and pointed_thing.above and pointed_thing.below are equal #6643
Comments
Was reported again (see below), should be an easy fix, if they're the same return a certain fixed position on the face.
|
@MarkuBu |
If you stand inside jungle grass you can't place nodes at all because you are inside the hitbox and you point to this hitbox and not to the node the crosshair points to. All you can do is check above and below if they are equal. Off topic: I think anyway that the hitbox of jungle grass is too big. Every time you walk through a jungle and try to punch or dig something you often hit jungle grass first. Will open an issue soon |
To be honest I can't confirm this bug. I placed jungle grass, step inside and try to place a slab somewhere. Nothing happened. |
How can I stand in a full node in a regular game? As long as "noclip" is disabled or you "glitch" into a node somehow However, best would be to add a check if above and below are equal. I won't try to find a solution to make such a rare and uncommon situation work. |
minetest/minetest.conf.example Lines 19 to 22 in f1d2bc0
Players can crash servers by turning this setting off and placing the nodes to get this condition. Is that important enough to fix it? |
I already posted a solution. Check if above and below are equal. If yes, return and do nothing. I'm not at home and can try it myself And I didn't develop this function. The original function was from HybridDog, if I'm not wrong. I just adopted it to make it work for this situation |
Two suggestions to solve this issue:
If you return vector.new() a slab or stair will be placed on top of the node the player currently stands in. The jungle grass or whatever node is on top will be replaced instead of return a new vector yo can return
In this case only the place sound is played, but nothing else happened. |
Still crashing, will fix. |
PR #7342 |
#7342 merged. |
Tested in MT 0.4.16.
Just call
minetest.pointed_thing_to_face_pos
with apointed_thing
oftype="node"
, andabove
andbelow
having equal positions.There will be crash with this error:
ERROR: /usr/share/minetest/builtin/common/misc_helpers.lua:717: Attempt to perform arithmetic on a nil value
Example:
minetest.pointed_thing_to_face_pos(player, {type="node", above={x=0,y=0,z=0}, below={x=0,y=0,z=0})
How can
above
andbelow
have the same positions, you ask? Easy: Just place a node when your head is inside a non-walkable
andbuildable_to
node (e.g. jungle grass). Then you will get apointed_thing
in which bothabove
andbelow
have equal positions. At least in theon_place
function of the item you place.In Minetest Game 0.4.16, you can reproduce this if you stand inside jungle grass, fly and noclip a bit down (so you are inside the same node), then place a slab inside that jungle grass.
The text was updated successfully, but these errors were encountered: