Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesettings/attributes/Seeds.js
GameSettings.prototype.Attributes.Seeds = class Seeds extends GameSetting | GameSettings.prototype.Attributes.Seeds = class Seeds extends GameSetting | ||||
{ | { | ||||
init() | init() | ||||
{ | { | ||||
// TODO remove this assignment, this shouldn't be in persistmatchsettings. | |||||
this.seed = 0; | this.seed = 0; | ||||
this.AIseed = 0; | this.AIseed = 0; | ||||
} | } | ||||
toInitAttributes(attribs) | toInitAttributes(attribs) | ||||
{ | { | ||||
// Seed is used for map generation and simulation. | // Seed is used for map generation and simulation. | ||||
attribs.settings.Seed = this.seed; | attribs.settings.Seed = this.seed; | ||||
attribs.settings.AISeed = this.AIseed; | attribs.settings.AISeed = this.AIseed; | ||||
} | } | ||||
fromInitAttributes(attribs) | |||||
{ | |||||
// Seed is used for map generation and simulation. | |||||
if (this.getLegacySetting(attribs, "Seed") !== undefined) | |||||
this.seed = this.getLegacySetting(attribs, "Seed"); | |||||
if (this.getLegacySetting(attribs, "AISeed") !== undefined) | |||||
this.AIseed = this.getLegacySetting(attribs, "AISeed"); | |||||
} | |||||
pickRandomItems() | pickRandomItems() | ||||
{ | { | ||||
if (this.seed && this.AIseed) | |||||
return false; | |||||
this.seed = randIntExclusive(0, Math.pow(2, 32)); | this.seed = randIntExclusive(0, Math.pow(2, 32)); | ||||
this.AIseed = randIntExclusive(0, Math.pow(2, 32)); | this.AIseed = randIntExclusive(0, Math.pow(2, 32)); | ||||
return true; | |||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator