Skip to content

Make it so location saves correctly for rooms added by World Edits#278

Open
FrivolousBorks wants to merge 6 commits intoAlexofp:devfrom
FrivolousBorks:world-edit-saves
Open

Make it so location saves correctly for rooms added by World Edits#278
FrivolousBorks wants to merge 6 commits intoAlexofp:devfrom
FrivolousBorks:world-edit-saves

Conversation

@FrivolousBorks
Copy link

Let's try this one more time.

I noticed that saving in a room that was added by a World Edit always caused the player's location to get reset. Separately, I noticed that saving during a scene that happened to take place in an added room caused the camera to have a moment.

I have fixed these problems. The player's location is now checked after World Edits are applied, and the camera aim is saved at the start of scenes.

I also fixed a softlock that happens when loading a save that's in the middle of a scene that doesn't exist. It made testing this annoying.

image image

return result

func runScene(id, _args = [], parentSceneUniqueID = -1):
GM.world.lastAimedRoomID = GM.pc.getLocation()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable already gets set in aimCamera(). Do we need this call here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally it's unneeded because the camera is aimed at the player's location by the WorldScene when it runs. In cases where another scene is running though, the camera is never set, which leads to the fun camera state in the pictures above. To fix it, the camera has to be aimed somewhere.

The obvious solution is to have the variable default to the PC's location when the world loads, because that would mean that the existing aimCamera call in its loadData would sort it out. Unfortunately that doesn't work because of world edits though. The world needs to exist for world edits to be applied, but sometimes the room the PC is in won't exist until a world edit is applied. It's a miserable catch-22. :(

This leaves us with only a few solutions. I went with the decision to set the variable in runScene because the only alternative I can think of is putting aimCamera(GM.pc.getLocation()) when scenes run. That has potential problems (if you run FightScene or GenericSexScene it'll reset the camera to the PC's location instead of where the scene takes place...) though, so I just didn't do it.

I'm open to alternative suggestions because I be but a humble dog, but I think this is probably the least invasive solution that doesn't create new problems for us. It makes sure the camera's intended location round-trips without relying upon the world being loaded, which is the important part.

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