Changeset View
Standalone View
binaries/data/mods/public/simulation/helpers/Cheat.js
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | if (!cmpProductionQueue) | ||||
}); | }); | ||||
return; | return; | ||||
} | } | ||||
for (let i = 0; i < Math.min(input.parameter, cmpPlayer.GetMaxPopulation() - cmpPlayer.GetPopulationCount()); ++i) | for (let i = 0; i < Math.min(input.parameter, cmpPlayer.GetMaxPopulation() - cmpPlayer.GetPopulationCount()); ++i) | ||||
cmpProductionQueue.SpawnUnits(input.templates[i % input.templates.length], 1, null); | cmpProductionQueue.SpawnUnits(input.templates[i % input.templates.length], 1, null); | ||||
return; | return; | ||||
case "fastactions": | case "fastactions": | ||||
cmpPlayer.SetCheatTimeMultiplier((cmpPlayer.GetCheatTimeMultiplier() == 1) ? 0.01 : 1); | let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | ||||
if (!cmpModifiersManager) | |||||
Stan: Do you need to check for system entities ? | |||||
wraitiiAuthorUnsubmitted Done Inline ActionsGenerally we assume no, so I'll remove this. wraitii: Generally we assume no, so I'll remove this. | |||||
return; | return; | ||||
Not Done Inline ActionsNewline maybe ? No strong feelings. Stan: Newline maybe ? No strong feelings. | |||||
case "changespeed": | |||||
Not Done Inline ActionsThe linter had something to say on this. leper: The linter had something to say on this. | |||||
cmpPlayer.SetCheatTimeMultiplier(input.parameter); | if (cmpModifiersManager.HasAnyModifier("cheat/fastactions", playerEnt)) | ||||
Done Inline Actionswill fix™ wraitii: will fix™ | |||||
cmpModifiersManager.RemoveAllModifiers("cheat/fastactions", playerEnt); | |||||
else | |||||
cmpModifiersManager.AddModifiers("cheat/fastactions", { | |||||
"Cost/BuildTime": { "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }, | |||||
"ResourceGatherer/BaseSpeed": { "affects": [["Structure"], ["Unit"]], "multiply": 1000 }, | |||||
"Pack/Time": { "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }, | |||||
"Upgrade/Time": { "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }, | |||||
Not Done Inline ActionsWe do tend to merge }); on one line. And having this whole thing in a file would most likely be nicer to extend for modders, and we do already have cheat json files which could contain this. Or since we are moving to files already Auras suddenly seem quite close to what is wanted. leper: We do tend to merge `});` on one line.
And having this whole thing in a file would most likely… | |||||
Not Done Inline ActionsWell that's sort of the whole point. We could, I suppose, just adapt Auras so that everything is an aura instead of a modification, including technology effects, but I don't think that's the ideal solution over having a specific component for that (and auras can't currently be modded in from map files that easily iirc). wraitii: Well that's sort of the whole point. We could, I suppose, just adapt Auras so that everything… | |||||
Not Done Inline ActionsStill the point about this belonging into some sort of file still stands. leper: Still the point about this belonging into some sort of file still stands. | |||||
Done Inline ActionsPoint considered : currently the data transmitted for cheats is hardcoded in the GUI (haven't bothered finding why just yet), making this a bigger breaking change than I intend with this diff, so it'll have to come later. Similarly, AI handicap could be put in a JSON file, but not done yet. wraitii: Point considered : currently the data transmitted for cheats is hardcoded in the GUI (haven't… | |||||
"ProductionQueue/TechCostMultiplier/time": { "affects": [["Structure"], ["Unit"]], "multiply": 0.01 } | |||||
}, playerEnt); | |||||
return; | return; | ||||
case "changephase": | case "changephase": | ||||
var cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager); | var cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager); | ||||
if (!cmpTechnologyManager) | if (!cmpTechnologyManager) | ||||
return; | return; | ||||
// store the phase we want in the next input parameter | // store the phase we want in the next input parameter | ||||
var parameter; | var parameter; | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
Do you need to check for system entities ?