62 lines
2.4 KiB
C#
62 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine.Scripting;
|
|
|
|
#nullable disable
|
|
[Preserve]
|
|
public class ConsoleCmdKillAllRebirth : ConsoleCmdAbstract
|
|
{
|
|
[PublicizedFrom(EAccessModifier.Protected)]
|
|
public override string[] getCommands()
|
|
{
|
|
return new string[1] { "killallr" };
|
|
}
|
|
|
|
[PublicizedFrom(EAccessModifier.Protected)]
|
|
public override string getDescription() => "Kill all entities";
|
|
|
|
[PublicizedFrom(EAccessModifier.Protected)]
|
|
public override string getHelp()
|
|
{
|
|
return "Kills all matching entities (but never players)\nUsage:\n killall (all enemies)\n killall alive (all EntityAlive types except vehicles and turrets)\n killall all (all types)";
|
|
}
|
|
|
|
public override void Execute(List<string> _params, CommandSenderInfo _senderInfo)
|
|
{
|
|
bool flag1 = _params.Count > 0 && _params[0].EqualsCaseInsensitive("alive");
|
|
bool flag2 = _params.Count > 0 && _params[0].EqualsCaseInsensitive("all");
|
|
List<Entity> entityList = new List<Entity>((IEnumerable<Entity>)GameManager.Instance.World.Entities.list);
|
|
for (int index = 0; index < entityList.Count; ++index)
|
|
{
|
|
Entity entity = entityList[index];
|
|
if (entity != null && !(entity is EntityPlayer))
|
|
{
|
|
if (!flag2)
|
|
{
|
|
if (entity is EntityAlive)
|
|
{
|
|
if (flag1)
|
|
{
|
|
switch (entity)
|
|
{
|
|
case EntityVehicle _:
|
|
case EntityTurret _:
|
|
break;
|
|
default:
|
|
goto label_7;
|
|
}
|
|
}
|
|
if (!EntityClass.list[entity.entityClass].bIsEnemyEntity)
|
|
continue;
|
|
}
|
|
else
|
|
continue;
|
|
}
|
|
label_7:
|
|
Log.Out("KILLALLR entity: " + entity.EntityClass.entityClassName);
|
|
entity.DamageEntity(new DamageSource(EnumDamageSource.Internal, EnumDamageTypes.Suicide), 99999, false);
|
|
//SingletonMonoBehaviour<SdtdConsole>.Instance.Output("Gave " + 99999.ToString() + " damage to entity " + entity.GetDebugName());
|
|
}
|
|
}
|
|
}
|
|
}
|