Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gamesettings/attributes/PlayerAI.js
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | for (let i = 0; i < this.values.length; ++i) | ||||
this.set(+i, { | this.set(+i, { | ||||
"bot": pData[i].AI, | "bot": pData[i].AI, | ||||
"difficulty": pData[i].AIDiff || +Engine.ConfigDB_GetValue("user", "gui.gamesetup.aidifficulty"), | "difficulty": pData[i].AIDiff || +Engine.ConfigDB_GetValue("user", "gui.gamesetup.aidifficulty"), | ||||
"behavior": pData[i].AIBehavior || Engine.ConfigDB_GetValue("user", "gui.gamesetup.aibehavior"), | "behavior": pData[i].AIBehavior || Engine.ConfigDB_GetValue("user", "gui.gamesetup.aibehavior"), | ||||
}); | }); | ||||
} | } | ||||
} | } | ||||
fromCmdLineArgs(cmdLineArgs) | |||||
{ | |||||
for (let i = 0; i < this.values.length; ++i) | |||||
if (cmdLineArgs.getPlayer('ai', i + 1)) | |||||
this.set(i, { | |||||
"bot": cmdLineArgs.getPlayer('ai', i + 1), | |||||
"difficulty": cmdLineArgs.getPlayer("aidiff") || 3, | |||||
"behavior": cmdLineArgs.getPlayer("aibehavior") || "balanced", | |||||
}); | |||||
} | |||||
_resize(nb) | _resize(nb) | ||||
{ | { | ||||
while (this.values.length > nb) | while (this.values.length > nb) | ||||
this.values.pop(); | this.values.pop(); | ||||
while (this.values.length < nb) | while (this.values.length < nb) | ||||
this.values.push(undefined); | this.values.push(undefined); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator