Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/Cheat.js
Show All 18 Lines | function Cheat(input) | ||||
case "addresource": | case "addresource": | ||||
cmpPlayer.AddResource(input.text, input.parameter); | cmpPlayer.AddResource(input.text, input.parameter); | ||||
return; | return; | ||||
case "revealmap": | case "revealmap": | ||||
var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); | var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); | ||||
cmpRangeManager.SetLosRevealAll(-1, true); | cmpRangeManager.SetLosRevealAll(-1, true); | ||||
return; | return; | ||||
case "maxpopulation": | case "maxpopulation": | ||||
cmpPlayer.SetPopulationBonuses(500); | cmpPlayer.SetPopulationBonuses((cmpPlayerManager.GetMaxWorldPopulation() || cmpPlayer.GetMaxPopulation()) + 500); | ||||
return; | return; | ||||
case "changemaxpopulation": | case "changemaxpopulation": | ||||
cmpPlayer.SetMaxPopulation(500); | { | ||||
let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | |||||
cmpModifiersManager.AddModifiers("cheat/maxpopulation", { | |||||
"Player/MaxPopulation": [{ "affects": ["Player"], "add": 500 }], | |||||
}, playerEnt); | |||||
return; | return; | ||||
} | |||||
case "convertunit": | case "convertunit": | ||||
for (let ent of input.selected) | for (let ent of input.selected) | ||||
{ | { | ||||
let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); | let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); | ||||
if (cmpOwnership) | if (cmpOwnership) | ||||
cmpOwnership.SetOwner(cmpPlayer.GetPlayerID()); | cmpOwnership.SetOwner(cmpPlayer.GetPlayerID()); | ||||
} | } | ||||
return; | return; | ||||
Show All 24 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": | ||||
{ | |||||
let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | ||||
if (cmpModifiersManager.HasAnyModifier("cheat/fastactions", playerEnt)) | if (cmpModifiersManager.HasAnyModifier("cheat/fastactions", playerEnt)) | ||||
cmpModifiersManager.RemoveAllModifiers("cheat/fastactions", playerEnt); | cmpModifiersManager.RemoveAllModifiers("cheat/fastactions", playerEnt); | ||||
else | else | ||||
cmpModifiersManager.AddModifiers("cheat/fastactions", { | cmpModifiersManager.AddModifiers("cheat/fastactions", { | ||||
"Cost/BuildTime": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }], | "Cost/BuildTime": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }], | ||||
"ResourceGatherer/BaseSpeed": [{ "affects": [["Structure"], ["Unit"]], "multiply": 1000 }], | "ResourceGatherer/BaseSpeed": [{ "affects": [["Structure"], ["Unit"]], "multiply": 1000 }], | ||||
"Pack/Time": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }], | "Pack/Time": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }], | ||||
"Upgrade/Time": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }], | "Upgrade/Time": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }], | ||||
"ProductionQueue/TechCostMultiplier/time": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }] | "ProductionQueue/TechCostMultiplier/time": [{ "affects": [["Structure"], ["Unit"]], "multiply": 0.01 }] | ||||
}, playerEnt); | }, 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; | ||||
if (!cmpTechnologyManager.IsTechnologyResearched("phase_town")) | if (!cmpTechnologyManager.IsTechnologyResearched("phase_town")) | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator