Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gamesettings/attributes/Ceasefire.js
Show All 13 Lines | GameSettings.prototype.Attributes.Ceasefire = class Ceasefire extends GameSetting | ||||
fromInitAttributes(attribs) | fromInitAttributes(attribs) | ||||
{ | { | ||||
if (!this.getLegacySetting(attribs, "Ceasefire")) | if (!this.getLegacySetting(attribs, "Ceasefire")) | ||||
this.value = 0; | this.value = 0; | ||||
else | else | ||||
this.value = +this.getLegacySetting(attribs, "Ceasefire"); | this.value = +this.getLegacySetting(attribs, "Ceasefire"); | ||||
} | } | ||||
fromCmdLineArgs(cmdLineArgs) | |||||
{ | |||||
if (cmdLineArgs['autostart-ceasefire']) | |||||
this.setValue(+cmdLineArgs['autostart-ceasefire']); | |||||
} | |||||
onMapChange() | onMapChange() | ||||
{ | { | ||||
if (this.settings.map.type != "scenario") | if (this.settings.map.type != "scenario") | ||||
return; | return; | ||||
if (!this.getMapSetting("Ceasefire")) | if (!this.getMapSetting("Ceasefire")) | ||||
this.value = 0; | this.value = 0; | ||||
else | else | ||||
this.value = +this.getMapSetting("Ceasefire"); | this.value = +this.getMapSetting("Ceasefire"); | ||||
} | } | ||||
setValue(val) | setValue(val) | ||||
{ | { | ||||
this.value = Math.round(val); | this.value = Math.round(val); | ||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator