Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesettings/attributes/CircularMap.js
/** | /** | ||||
* This doesn't have a GUI setting. | * This doesn't have a GUI setting. | ||||
*/ | */ | ||||
GameSettings.prototype.Attributes.CircularMap = class CircularMap extends GameSetting | GameSettings.prototype.Attributes.CircularMap = class CircularMap extends GameSetting | ||||
{ | { | ||||
init() | init() | ||||
{ | { | ||||
this.value = undefined; | this.value = undefined; | ||||
this.settings.map.watch(() => this.onMapChange(), ["map"]); | this.settings.map.watch(() => this.onMapChange(), ["map"]); | ||||
} | } | ||||
toInitAttributes(attribs) | toInitAttributes(attribs) | ||||
{ | { | ||||
if (this.value) | if (this.value !== undefined) | ||||
attribs.settings.CircularMap = this.value; | attribs.settings.CircularMap = this.value; | ||||
bb: Notice that capitalization is not consistent in this object. | |||||
} | } | ||||
/** | fromInitAttributes(attribs) | ||||
* Exceptionally, this setting has no Deserialize: it's entirely determined by the map | { | ||||
*/ | this.value = !!this.getLegacySetting(attribs, "CircularMap"); | ||||
} | |||||
Done Inline ActionsDon't like the fact we call the same function twice here, should store it. Is done everywhere like this already. bb: Don't like the fact we call the same function twice here, should store it. Is done everywhere… | |||||
onMapChange() | onMapChange() | ||||
{ | { | ||||
this.value = this.getMapSetting("CircularMap") || false; | this.value = this.getMapSetting("CircularMap") || false; | ||||
} | } | ||||
setValue(val) | setValue(val) | ||||
{ | { | ||||
this.value = val; | this.value = val; | ||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator
Notice that capitalization is not consistent in this object.