private void ScrambleMove(PlayerModel clone, int where, bool logOnly)
{
int toSquad = 0;
int toTeam = where;
// Move to available squad
if (!IsKnownPlayer(clone.Name)) return; // might have left
String xt = ExtractTag(clone);
String name = clone.Name;
if (!String.IsNullOrEmpty(xt)) name = "[" + xt + "]" + name;
toSquad = clone.ScrambledSquad;
if (toSquad < 0 || toSquad > (SQUAD_NAMES.Length - 1)) {
ConsoleDebug("ScrambleMove: why is ^b" + name + "^n scrambled to squad " + toSquad + "?");
return;
}
if (toSquad == 0) {
ConsoleDebug("ScrambleMove: why is ^b" + name + "^n scrambled to squad 0?");
return;
}
if (clone.Team == toTeam && clone.Squad == toSquad) {
ConsoleDebug("ScrambleMove: skipping scramble move of ^b" + clone.FullName + "^n, already in right team and squad");
return;
}
// Do the move
if (!EnableLoggingOnlyMode && !logOnly) {
DebugScrambler("^1^bMOVE^n^0 ^b" + clone.FullName + "^n to " + GetTeamName(toTeam) + " team, squad " + GetSquadName(toSquad));
ServerCommand("admin.movePlayer", clone.Name, toTeam.ToString(), toSquad.ToString(), "false");
Thread.Sleep(60);
} else {
DebugScrambler("^9(SIMULATED) ^1^bMOVE^n^0 ^b" + clone.FullName + "^n to " + GetTeamName(toTeam) + " team, squad " + GetSquadName(toSquad));
}
// For debugging and since this is a clone model, update Team & Squad to reflect move
clone.Team = toTeam;
clone.Squad = toSquad;
}