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

only check for new instance when entering from a different area #4

Open
wants to merge 1 commit into
base: instancing
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions player-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ function getRoom(state, player, nextRoomId) {
let nextRoom = null;
if (state.AreaFactory.isInstanced(nextAreaName)) {
const instanceId = player.name;
B.sayAt(player, `Entering instanced area: ${nextAreaName}`);
if (player.area != nextAreaName ){
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the spacing here is a bit off, and it is best practice to use !== (though I am not sure this would cause issues unless the area names were undefined/null/0/''...

Copy link
Author

Choose a reason for hiding this comment

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

Whats the best way for me to edit the pull request? do I just need to submit another one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, you can edit it using GitHub's UI, or you can use Git to pull down the branch, edit it locally, and then push it to the same remote branch.

B.sayAt(player, `Entering instanced area: ${nextAreaName}`);

if (!state.AreaManager.getArea(nextAreaName, instanceId)) {
B.sayAt(player, `No instance exists, creating...`);
state.AreaFactory.createInstance(state, nextAreaName, instanceId);
B.sayAt(player, `done.`);
if (!state.AreaManager.getArea(nextAreaName, instanceId)) {
B.sayAt(player, `No instance exists, creating...`);
state.AreaFactory.createInstance(state, nextAreaName, instanceId);
B.sayAt(player, `done.`);
}
}

nextRoom = state.RoomManager.getRoom(nextRoomId, instanceId);
Expand Down