Skip to content

Commit

Permalink
Kill the Queen on a Surrender
Browse files Browse the repository at this point in the history
- Adds destruction of all units (including the Queen) when a team surrenders
  • Loading branch information
data-bomb committed May 21, 2024
1 parent 41b07fb commit 090433f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Si_SurrenderCommand/Si_SurrenderCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You should have received a copy of the GNU General Public License
using UnityEngine;
using System.Collections.Generic;

[assembly: MelonInfo(typeof(SurrenderCommand), "Surrender Command", "1.2.4", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(SurrenderCommand), "Surrender Command", "1.2.5", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand Down Expand Up @@ -125,8 +125,26 @@ public static void Command_Surrender(Player? callerPlayer, String args)
// destroy all structures on team that's surrendering
for (int i = 0; i < SurrenderTeam.Structures.Count; i++)
{
if (SurrenderTeam.Structures[i] == null)
{
MelonLogger.Warning("Found null structure during surrender command.");
continue;
}

SurrenderTeam.Structures[i].DamageManager.SetHealth01(0.0f);
}

// and destroy all units (especially the queen)
for (int i = 0; i < SurrenderTeam.Units.Count; i++)
{
if (SurrenderTeam.Units[i] == null)
{
MelonLogger.Warning("Found null unit during surrender command.");
continue;
}

SurrenderTeam.Units[i].DamageManager.SetHealth01(0.0f);
}
}
}
}

0 comments on commit 090433f

Please sign in to comment.