Skip to content
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

Fix 3 problems with plSubWorldMsg. #1485

Merged
merged 3 commits into from
Sep 18, 2023
Merged

Conversation

Hoikas
Copy link
Member

@Hoikas Hoikas commented Sep 16, 2023

The impetus for this change is that Korman's new Change Subworld message node can cause all players in the Age to change to that subworld. The rationale here is that changing subworlds modifies a player's avatarPhysical SDL. So, really, we probably only want to be sending plSubWorldMsg to the local player from a Responder. Responders are primarily a zero-code artist logic tool, so they shouldn't have to care about that level of SDL detail. Further, there is precedent for major avatar/player related actions to be rejected from non-local sources. Namely, all camera messages are restricted in the same way in Responders.

As a bonus, I fixed a memory leak that wouldn't be detected by asan and fixed a logic error with the subworld SDL synch.

The messages in Responder commands are reused, so it's important to
clear out the receivers each iteration of the Responder command.
Otherwise, we are basically leaking memory in a way that asan won't
detect.
From TPotS to MOUL, the avatar's physics related SDLs were removed from
the avatar state descriptor and stashed into the avatarPhysical
descriptor. So, when a subworld change happens, we need to syncrhonize
avatarPhysical, not avatar.
This is the most controversial change. The onus for this is a report
that, when using Korman's Change Subworld Message node, when a player
uses an activator that sends this message in a responder, all players
change to that subworld. This is objectively incorrect. The code is
currently written to send `plSubWorldMsg` to the local player. Unfortunately,
there is currently no way to prevent a responder running on remote
clients when its clickable is used without redirecting through some kind
of hack Python script.

The rationale here is that changing subworlds modifies a player's
avatarPhysical SDL. So, really, we probably only want to be sending
`plSubWorldMsg` to the local player from a Responder. Responders are
primarily a zero-code artist logic tool, so they shouldn't have to care
about that level of SDL detail. Further, there is precedent for major
avatar/player related actions to be rejected from non-local sources.
Namely, all camera messages are restricted in the same way in
Responders.

The alternate to this change would be to send the `plSubWorldMsg` to the
player who triggered the responder i.e. `fPlayerKey`. We will need to
validate all existing (read: Cyan) Responders to see which approach they
expect.
@Hoikas
Copy link
Member Author

Hoikas commented Sep 17, 2023

Update: I checked all of Cyan's responders, and none of them send subworld messages, so there is no danger of this breaking Cyan content.

@Hoikas Hoikas merged commit dedae35 into H-uru:master Sep 18, 2023
@Hoikas Hoikas deleted the subworld_msg_problem branch September 18, 2023 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants