Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/autostart/autostart.js
class AutoStart | class AutoStart | ||||
{ | { | ||||
constructor(initData) | constructor(cmdLineArgs) | ||||
{ | { | ||||
this.playerAssignments = { | |||||
"local": { | |||||
"player": +cmdLineArgs?.['autostart-player'] ?? 1, | |||||
"name": "anonymous", | |||||
}, | |||||
}; | |||||
this.settings = new GameSettings().init(); | this.settings = new GameSettings().init(); | ||||
this.settings.fromInitAttributes(initData.attribs); | |||||
this.playerAssignments = initData.playerAssignments; | // Enable cheats in SP | ||||
this.settings.cheats.setEnabled(true); | |||||
this.settings.launchGame(this.playerAssignments, initData.storeReplay); | parseCmdLineArgs(this.settings, cmdLineArgs); | ||||
phosit: I'd like the syntax to be like this: `this.settintgs = new Settintgs(cmdLineOrgs… | |||||
if ('autostart-nonvisual' in cmdLineArgs) | |||||
this.settings.triggerScripts.customScripts.add("scripts/NonVisualTrigger.js"); | |||||
this.settings.launchGame(this.playerAssignments, !cmdLineArgs['autostart-disable-replay']); | |||||
phositUnsubmitted Not Done Inline ActionsThis seem to be simmilar why detect them differently? prop in object vs object[prop] phosit: This seem to be simmilar why detect them differently? `prop in object` vs `object[prop]` | |||||
wraitiiAuthorUnsubmitted Done Inline ActionsThere's actually a difference, one is true for undefined but exists and the other not. In this case I think I'm actually using the more appropriate checks in each place. wraitii: There's actually a difference, one is true for `undefined but exists` and the other not. In… | |||||
phositUnsubmitted Not Done Inline ActionsSo for --autostart-nonvisual=false will result in true, because it exists. You might add a comment explaining that. phosit: So for `--autostart-nonvisual=false` will result in `true`, because it exists.
`--autostart… | |||||
this.onLaunch(); | this.onLaunch(); | ||||
} | } | ||||
onTick() | onTick() | ||||
{ | { | ||||
} | } | ||||
/** | /** | ||||
Show All 10 Lines |
Wildfire Games · Phabricator
I'd like the syntax to be like this: this.settintgs = new Settintgs(cmdLineOrgs, {"enableCheats": true})