-
Notifications
You must be signed in to change notification settings - Fork 54
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
own implementation of isRoomAvailable #437
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,12 +125,10 @@ module.exports.getRoomScore = function (toRoom, fromRoom, opts = {}) { | |
} | ||
|
||
// Our own implementation of depricated function | ||
module.exports.isRoomAvailable = function(roomName) { | ||
if (!global.homeRoomStatus) { | ||
global.homeRoomStatus = Game.map.getRoomStatus(_.values(Game.spawns)[0].room.name).status; | ||
} | ||
module.exports.isRoomAvailable = function (roomName) { | ||
den-kozlov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const homeRoomStatus = Game.map.getRoomStatus(_.values(Game.spawns)[0].room.name).status | ||
den-kozlov marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line throws an exception when there are no spawns left. The empire is only dead when all creeps are dead too. I'd check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So there's no point in checking spawns then. The check can be done against creeps object as they are in the same zone. This can be replaced with 'normal' constant, but it will hurt people using Novice and Respawn zones. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right after spawning there are no creeps yet though 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No guarantee of a spawn either if using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An observer could have been used to observe a room outside the zone |
||
// Inside novice areas the only rooms available are novice rooms. | ||
// Same goes with respawn areas. | ||
// Home room can't be closed, so this case is also coverd. | ||
return homeRoomStatus === Game.map.getRoomStatus(roomName).status | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.