Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesettings/attributes/Daytime.js
Show All 39 Lines | setValue(val) | ||||
else | else | ||||
this.value = undefined; | this.value = undefined; | ||||
} | } | ||||
pickRandomItems() | pickRandomItems() | ||||
{ | { | ||||
// If the map is random, we need to wait until it is selected. | // If the map is random, we need to wait until it is selected. | ||||
if (this.settings.map.map === "random") | if (this.settings.map.map === "random") | ||||
return true; | return { "picked": false, "hasValue": false }; | ||||
if (this.value !== "random") | if (this.value !== "random") | ||||
return false; | return { "picked": false, "hasValue": true }; | ||||
this.value = pickRandom(this.data).Id; | this.value = pickRandom(this.data).Id; | ||||
return true; | return { "picked": true, "hasValue": true }; | ||||
} | } | ||||
/** | /** | ||||
* Helper function to ensure this.data and this.value | * Helper function to ensure this.data and this.value | ||||
* are assigned in the correct order to prevent | * are assigned in the correct order to prevent | ||||
* crashes in the renderer. | * crashes in the renderer. | ||||
* @param {object} data - The day time option data. | * @param {object} data - The day time option data. | ||||
* @param {string} value - The option's key. | * @param {string} value - The option's key. | ||||
*/ | */ | ||||
setDataValueHelper(data, value) | setDataValueHelper(data, value) | ||||
{ | { | ||||
this.data = data; | this.data = data; | ||||
this.value = value; | this.value = value; | ||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator