Skip to content

SCP 914 teleport to Unspecified zone causes falling through the floor, offset is never applied #4

Description

@reid-sutherland

FYI There is a bug in Common-Utils/Common Utilities/EventHandlers/MapHandlers.cs line 243 in the ChoosePosition() method.

The code in question:
Vector3 pos2 = room2?.Position ?? Vector3.zero + (Vector3.up * 1.5f) + offset;
What it should be:
Vector3 pos2 = (room2?.Position ?? Vector3.zero) + (Vector3.up * 1.5f) + offset;

it should match the previous position calculation above it:
Vector3 pos1 = (room1?.Position ?? Vector3.zero) + (Vector3.up * 1.5f);

The lack of parentheses around the null-coalescing operator is making it so that when using (for example) zone: Unspecified and room: Lcz914, the offset and the Vector3.up (that prevents you from spawning in the floor) are not added since the room is defined. They should be getting added no matter what.

The resulting behavior is that when using zone: Unspecified in scp914_teleport_chances: in the yaml config, you always spawn falling through the floor.

Sorry for not doing a real issue format or a real PR, i see there is a 3-month old issue and PR already so I figured i would just fork and fix it myself

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions