Changeset View
Standalone View
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(500); | ||||
Silier: this needs to changed as well, it ought to reach same number as changemaxpopulation else… | |||||
Done Inline ActionsBut that is the case currently when playing with a civ with +10% pop-cap also? Freagarach: But that is the case currently when playing with a civ with +10% pop-cap also? | |||||
Done Inline ActionsSetting max population to 500 works because 300 is ceiling now. With current changes below, max would be 800 for normal settings and 1100 for world population. Yes this cheat itself has some flaw that could be fixed but please do not create more. Silier: Setting max population to 500 works because 300 is ceiling now.
That does not work for world… | |||||
Done Inline ActionsAh you meant TARDIS! Now I get it :) Freagarach: Ah you meant `TARDIS`! Now I get it :) | |||||
return; | return; | ||||
Done Inline Actionsdoes not undefined + 500 produce nan ? Silier: does not `undefined + 500` produce `nan` ? | |||||
Done Inline ActionsIt does. Stan: It does. | |||||
case "changemaxpopulation": | case "changemaxpopulation": | ||||
cmpPlayer.SetMaxPopulation(500); | var cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | ||||
SilierUnsubmitted Done Inline Actionslet Silier: let | |||||
cmpModifiersManager.AddModifiers("cheat/maxpopulation", { | |||||
"Player/MaxPopulation": [{ "affects": ["Player"], "add": 500 }], | |||||
}, playerEnt); | |||||
Done Inline ActionsI am just thinking, if it would not make sense to use Silier: I am just thinking, if it would not make sense to use
`"replace": 600.`
So it does not skyrock… | |||||
Done Inline ActionsWould changing it to e.g. ×2 instead work? Nescio: Would changing it to e.g. ×2 instead work? | |||||
Done Inline Actionsnot really for max population under 250, it would not reach 500 and I would avoid changing input of cheats to lesser effect. Silier: not really for max population under 250, it would not reach 500 and I would avoid changing… | |||||
Done Inline ActionsReplacing won't work if you have a pop-cap larger than 600 by default. Freagarach: Replacing won't work if you have a pop-cap larger than 600 by default. | |||||
Done Inline ActionsCan't you just query it ? and then use math.min / max? Stan: Can't you just query it ? and then use math.min / max? | |||||
Done Inline ActionsBut then what is the benefit of the cheat if it uses the already available population limit? Freagarach: But then what is the benefit of the cheat if it uses the already available population limit? | |||||
Done Inline ActionsI meant something like math.max(current, 500) + 200 ? Stan: I meant something like math.max(current, 500) + 200 ? | |||||
Done Inline ActionsIt *is* a cheat, so it is not too bad, IMHO, to add a lot ^^ Freagarach: It *is* a cheat, so it is not too bad, IMHO, to add a lot ^^
`Math.max(current + 200, 500)` you… | |||||
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()); | ||||
} | } | ||||
Show All 25 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); | var cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | ||||
SilierUnsubmitted Done Inline Actionswhy change to var ? Silier: why change to var ? | |||||
Done Inline Actionscould you move brackets under case ? https://trac.wildfiregames.com/wiki/Coding_Conventions Silier: could you move brackets under `case` ? https://trac.wildfiregames.com/wiki/Coding_Conventions | |||||
Done Inline Actions-\t Freagarach: -`\t` | |||||
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 }], | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |
this needs to changed as well, it ought to reach same number as changemaxpopulation else population limit will return lower number among pop bonus and max pop