GCW Space Battle Fix

This commit is contained in:
RezecNoble
2024-10-08 20:32:07 -04:00
parent 67528cf65e
commit e71af28262

View File

@@ -81,7 +81,7 @@ public class battle_spawner extends script.base_class {
public float customPveBattleModifier = DEFAULT_PVE_TOKEN_MULTIPLIER;
public float customPvpBattleModifier = DEFAULT_PVP_TOKEN_MULTIPLIER;
public float customPvePointModifier = DEFAULT_PVE_POINT_MULTIPLIER;
public float customPvpPointModifier = DEFAULT_PVE_POINT_MULTIPLIER;
public float customPvpPointModifier = DEFAULT_PVP_POINT_MULTIPLIER;
public float customWinTokenModifier = DEFAULT_WIN_TOKEN_MULTIPLIER;
public float customLossTokenModifier = DEFAULT_WIN_TOKEN_MULTIPLIER;
public float customWinPointModifier = DEFAULT_WIN_POINT_MULTIPLIER;
@@ -127,6 +127,20 @@ public class battle_spawner extends script.base_class {
if(battleIsActive(self)) return SCRIPT_CONTINUE;
location spaceLocation = getLocation(self);
// double check and despawn old ships
obj_id old_attackingShip = getObjIdObjVar(self, "attackingShip");
obj_id old_defendingShip = getObjIdObjVar(self, "defendingShip");
if(isValidId(old_attackingShip))
{
detachAllScripts(old_attackingShip);
destroyObjectHyperspace(old_attackingShip);
}
if(isValidId(old_defendingShip))
{
detachAllScripts(old_defendingShip);
destroyObjectHyperspace(old_defendingShip);
}
spaceLog( "In startSpaceGCWBattle... beginning battle creation.");
obj_id controller = params.getObjId("controller");
removeObjVar(controller, "space_gcw." + spaceLocation.area + ".nextBattleStart");
@@ -708,6 +722,12 @@ public class battle_spawner extends script.base_class {
detachAllScripts(attackingShip);
destroyObjectHyperspace(attackingShip);
}
if(isValidId(defendingShip)){
detachAllScripts(defendingShip);
spaceLog( "In cleanup... despawning defending capital ship...");
destroyObjectHyperspace(defendingShip);
}
// set obj vars on controller for next battle
obj_id controller = params.getObjId("controller");