Change volumes back to shapes by default not colliders (broke mod puzzles with volumes on held items)

This commit is contained in:
xen-42 2025-04-19 19:17:53 -04:00
parent e38884037b
commit 6ee8f16cc4
2 changed files with 15 additions and 3 deletions

View File

@ -42,19 +42,30 @@ namespace NewHorizons.Builder.Props
{ {
// Explicitly add either a shape or collider if specified // Explicitly add either a shape or collider if specified
if (info.useShape.Value) if (info.useShape.Value)
{
return AddShape(go, info); return AddShape(go, info);
}
else else
{
return AddCollider(go, info);
}
}
else
{
// Prefer shapes over colliders if no preference is specified and not using collision
// This is required for backwards compat (previously it defaulted to shapes)
// A common-ish puzzle is to put an insulating volume on a held item. Held items disabled all colliders when held, but don't disable shapes.
// Changing the default from shapes to colliders broke these puzzles
if (info.hasCollision)
{
return AddCollider(go, info); return AddCollider(go, info);
} }
else else
{ {
// Prefer colliders over shapes if no preference is specified
if (info.type is ShapeType.Sphere or ShapeType.Box or ShapeType.Capsule)
return AddCollider(go, info);
else
return AddShape(go, info); return AddShape(go, info);
} }
} }
}
public static Shape AddShape(GameObject go, ShapeInfo info) public static Shape AddShape(GameObject go, ShapeInfo info)
{ {

View File

@ -64,7 +64,8 @@ namespace NewHorizons.External.Modules.Props
public bool hasCollision = false; public bool hasCollision = false;
/// <summary> /// <summary>
/// Whether to explicitly use a shape instead of a collider. Shapes do not support collision and are less performant, but support a wider set of shapes and are required by some components. Omit this unless you explicitly want to use a sphere, box, or capsule shape instead of a collider. /// Whether to explicitly use a shape instead of a collider. Shapes do not support collision and are less performant, but support a wider set of shapes and are required by some components.
/// Defaults to using a shape, unless hasCollision is true where it defaults to using a collider.
/// </summary> /// </summary>
public bool? useShape; public bool? useShape;
} }