forked from Mirrorlandia_minetest/minetest
CollisionMoveSimple: Collide with 'ignore' nodes
This commit is contained in:
parent
359a940dde
commit
6c9df2ffa7
@ -279,7 +279,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||||||
bool is_position_valid;
|
bool is_position_valid;
|
||||||
MapNode n = map->getNodeNoEx(p, &is_position_valid);
|
MapNode n = map->getNodeNoEx(p, &is_position_valid);
|
||||||
|
|
||||||
if (is_position_valid) {
|
if (is_position_valid && n.getContent() != CONTENT_IGNORE) {
|
||||||
// Object collides into walkable nodes
|
// Object collides into walkable nodes
|
||||||
|
|
||||||
any_position_valid = true;
|
any_position_valid = true;
|
||||||
@ -327,7 +327,8 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||||||
cinfo.emplace_back(false, false, n_bouncy_value, p, box);
|
cinfo.emplace_back(false, false, n_bouncy_value, p, box);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Collide with unloaded nodes
|
// Collide with unloaded nodes (position invalid) and loaded
|
||||||
|
// CONTENT_IGNORE nodes (position valid)
|
||||||
aabb3f box = getNodeBox(p, BS);
|
aabb3f box = getNodeBox(p, BS);
|
||||||
cinfo.emplace_back(true, false, 0, p, box);
|
cinfo.emplace_back(true, false, 0, p, box);
|
||||||
}
|
}
|
||||||
@ -335,6 +336,8 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||||||
|
|
||||||
// Do not move if world has not loaded yet, since custom node boxes
|
// Do not move if world has not loaded yet, since custom node boxes
|
||||||
// are not available for collision detection.
|
// are not available for collision detection.
|
||||||
|
// This also intentionally occurs in the case of the object being positioned
|
||||||
|
// solely on loaded CONTENT_IGNORE nodes, no matter where they come from.
|
||||||
if (!any_position_valid) {
|
if (!any_position_valid) {
|
||||||
*speed_f = v3f(0, 0, 0);
|
*speed_f = v3f(0, 0, 0);
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user