ServerEntityWithEntranceController (To be completed)
The ServerEntityWithEntranceController directly extends ServerDBDependentController, and is used for developing entities with entrances/exits (e.g Houses or Businesses) much faster.
Extending the ServerEntityWithEntranceController
Even though the automated scripts create classes which extend the ServerController by default, it might be helpful to know that a newly-generated resource looks exactly like this:
// server.controller.ts
@FiveMController()
export class Server extends ServerController {
}
The FiveMController()
is an important decorator which also accepts an (optional) configuration object. At the moment, the configuration object provides the following properties:
Property | Description |
---|---|
translationFile | Specifies a translation file for your server controller. Please see the Localization Guide for learning how you can easily add multiple languages to your scripts. |
An example of how you could make use of the configuration object can be seen below:
// server.controller.ts
@FiveMController({ translationFile: i18n })
export class Server extends ServerController {
constructor() {
super();
console.log(this.translate('hello')); // Logs 'Hello!' or 'Hallo!' based on the player's language
}
}
export const i18n = {
en: {
hello: 'Hello!',
},
ger: {
hello: 'Hallo!',
},
};