1
0
forked from 0ad/0ad

Allow cheats to convert units to arbitrary players.

This allows the "wololo" cheat to switch units to an arbitrarily defined
player. If no player is specified, it defaults to the player entering
the cheat.
The player manager will warn when using a wrong player number.

Patch by: @Nullus
Differential revision: https://code.wildfiregames.com/D4479
Comments by: @Stan
This was SVN commit r26328.
This commit is contained in:
Freagarach 2022-02-09 15:49:26 +00:00
parent 9417a345d1
commit 93b22c5f86
3 changed files with 6 additions and 2 deletions

View File

@ -194,6 +194,7 @@
{ "nick": "NoMonkey", "name": "John Mena" },
{ "nick": "norsnor" },
{ "nick": "notpete", "name": "Rich Cross" },
{ "nick": "Nullus" },
{ "nick": "nwtour" },
{ "nick": "odoaker", "name": "Ágoston Sipos" },
{ "nick": "Offensive ePeen", "name": "Jared Ryan Bills" },

View File

@ -1,6 +1,8 @@
{
"Name": "wololo",
"Data": {
"Action": "convertunit"
"Action": "convertunit",
"DefaultParameter": -1,
"isNumeric": true
}
}

View File

@ -35,11 +35,12 @@ function Cheat(input)
return;
}
case "convertunit":
const playerID = (input.parameter > 1 && QueryPlayerIDInterface(input.parameter) || cmpPlayer).GetPlayerID();
for (let ent of input.selected)
{
let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership);
if (cmpOwnership)
cmpOwnership.SetOwner(cmpPlayer.GetPlayerID());
cmpOwnership.SetOwner(playerID);
}
return;
case "killunits":