Skip to content

Conversation

@y21
Copy link
Contributor

@y21 y21 commented Dec 17, 2018

This is a semi-fix for #37, which change the structure of the Base.gamemodes object. That property no longer exists and instead we have to use Base.rooms, which is an array of rooms. When the server restarts, there's only one room: FFA. Its ID is ffa (case-sensitive). Rooms can be pushed to the array, but there is no way to interact with it.
To access member properties of it we use ES6' Array function find and pass a callback function to it, which searches for an object in that array where its ID equals to ffa.
For object references in arrays you can use the [] operator and get the index with Array.prototype.findIndex.

@y21 y21 added backend Relates to the backend needs testing labels Dec 17, 2018
@y21 y21 self-assigned this Dec 17, 2018
@y21 y21 merged commit b12a22d into master Dec 17, 2018
@y21 y21 added enhancement New feature or request and removed needs testing labels Dec 17, 2018
@y21 y21 deleted the rooms branch December 17, 2018 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Relates to the backend enhancement New feature or request

1 participant