Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gamesettings/attributes/PlayerTeam.js
Show All 27 Lines | fromInitAttributes(attribs) | ||||
if (!this.getLegacySetting(attribs, "PlayerData")) | if (!this.getLegacySetting(attribs, "PlayerData")) | ||||
return; | return; | ||||
const pData = this.getLegacySetting(attribs, "PlayerData"); | const pData = this.getLegacySetting(attribs, "PlayerData"); | ||||
for (let i = 0; i < this.values.length; ++i) | for (let i = 0; i < this.values.length; ++i) | ||||
if (pData[i] && pData[i].Team !== undefined) | if (pData[i] && pData[i].Team !== undefined) | ||||
this.setValue(i, pData[i].Team); | this.setValue(i, pData[i].Team); | ||||
} | } | ||||
fromCmdLineArgs(cmdLineArgs) | |||||
{ | |||||
for (let i = 0; i < this.values.length; ++i) | |||||
if (cmdLineArgs.getPlayer('team', i + 1)) | |||||
this.setValue(i, cmdLineArgs.getPlayer('team', i + 1)); | |||||
} | |||||
_resize(nb) | _resize(nb) | ||||
{ | { | ||||
while (this.values.length > nb) | while (this.values.length > nb) | ||||
{ | { | ||||
this.values.pop(); | this.values.pop(); | ||||
this.locked.pop(); | this.locked.pop(); | ||||
} | } | ||||
while (this.values.length < nb) | while (this.values.length < nb) | ||||
Show All 37 Lines |
Wildfire Games · Phabricator