This commit is contained in:
juanjp600
2017-12-03 11:59:34 -03:00
5 changed files with 100 additions and 103 deletions
@@ -722,12 +722,30 @@ namespace Barotrauma
}
}));
commands.Add(new Command("kill", "kill [character]: Immediately kills the specified character.", (string[] args) =>
{
Character killedCharacter = null;
if (args.Length == 0)
{
killedCharacter = Character.Controlled;
}
else
{
killedCharacter = FindMatchingCharacter(args);
}
if (killedCharacter != null)
{
killedCharacter.AddDamage(CauseOfDeath.Damage, killedCharacter.MaxHealth * 2, null);
}
}));
commands.Add(new Command("killmonsters", "killmonsters: Immediately kills all AI-controlled enemies in the level.", (string[] args) =>
{
foreach (Character c in Character.CharacterList)
{
if (!(c.AIController is EnemyAIController)) continue;
c.AddDamage(CauseOfDeath.Damage, 10000.0f, null);
c.AddDamage(CauseOfDeath.Damage, c.MaxHealth * 2, null);
}
}));
@@ -73,14 +73,14 @@ namespace Barotrauma
{
base.Init();
monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server));
monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server), false);
if (GameSettings.VerboseLogging)
{
DebugConsole.NewMessage("Initialized MonsterEvent (" + monsters[0]?.SpeciesName + " x" + monsters.Length + ")", Color.White);
}
}
private Character[] SpawnMonsters(int amount)
private Character[] SpawnMonsters(int amount, bool createNetworkEvent)
{
if (disallowed) return null;
@@ -101,7 +101,7 @@ namespace Barotrauma
{
spawnPos.X += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server);
spawnPos.Y += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server);
monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null, true, false);
monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null, true, createNetworkEvent);
}
return monsters;
@@ -127,7 +127,7 @@ namespace Barotrauma
{
if (monsters[i] == null || monsters[i].Removed || monsters[i].IsDead)
{
monsters[i] = SpawnMonsters(1)[0];
monsters[i] = SpawnMonsters(1, true)[0];
}
}
}