Changeset View
Changeset View
Standalone 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 cmpModManager = Engine.QueryInterface(playerEnt, IID_ModifiersManager); | ||||
if (!cmpModManager) | |||||
return; | |||||
if (cmpModManager.HasAnyGlobalModifierWithID("cheat/fastactions")) | |||||
{ | |||||
warn("here"); | |||||
cmpModManager.RemoveGlobalModifiers("cheat/fastactions") | |||||
} | |||||
else | |||||
cmpModManager.AddGlobalModifiers("cheat/fastactions", 1000, { | |||||
"Cost/BuildTime" : {"affects": [["Structure"], ["Unit"]], "multiply": 0.01}, | |||||
"ResourceGatherer/BaseSpeed" : {"affects": [["Structure"], ["Unit"]], "multiply": 1000.0}, | |||||
"Pack/Time" : {"affects": [["Structure"], ["Unit"]], "multiply": 0.01}, | |||||
"Upgrade/Time" : {"affects": [["Structure"], ["Unit"]], "multiply": 0.01}, | |||||
"ProductionQueue/TechCostMultiplier/time" : {"affects": [["Structure"], ["Unit"]], "multiply": 0.01} | |||||
} | |||||
); | |||||
return; | return; | ||||
case "changespeed": | case "changespeed": | ||||
cmpPlayer.SetCheatTimeMultiplier(input.parameter); | cmpPlayer.SetCheatTimeMultiplier(input.parameter); | ||||
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; | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator