Skip to content

Commit

Permalink
1 - Add flag into level object to force spawn into default level (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
YglesEyes authored Oct 12, 2022
1 parent 8bee421 commit d1e66e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/server/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ Meteor.users.find({ 'status.online': true }).observeChanges({
if (diffInMinutes < respawnDelay) return;

const levelId = user.profile.levelId || defaultLevelId;
const currentLevel = Levels.findOne(levelId);
let currentLevel = Levels.findOne(levelId);

if (currentLevel.disabled === true) {
currentLevel = Levels.findOne(defaultLevelId);
}

const spawnPosition = levelSpawnPosition(currentLevel);
Meteor.users.update(user._id, { $set: { 'profile.x': spawnPosition.x, 'profile.y': spawnPosition.y } });
Expand Down

0 comments on commit d1e66e3

Please sign in to comment.