Skip to content

Commit b7eb755

Browse files
Merge pull request #398 from SWG-Source/space-battle-fix-and-refinement
Fix for space battles
2 parents 29e01a1 + 82cc310 commit b7eb755

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

sku.0/sys.server/compiled/game/script/systems/gcw/space/battle_spawner.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,14 @@ else if(pilotNames.length == 0){
392392
}
393393
public static obj_id createUnit(obj_id centralObject, String unitName, float radius) throws InterruptedException
394394
{
395-
return space_create.createShip(
395+
396+
obj_id ship = space_create.createShip(
396397
unitName,
397-
space_utils.getRandomPositionInSphere(getTransform_o2p(centralObject), 100.0f, radius, true)
398-
);
398+
space_utils.getRandomPositionInSphere(getTransform_o2p(centralObject), 100.0f, radius, true));
399+
400+
setObjVar(ship, "motherShip", centralObject);
401+
402+
return ship;
399403
}
400404
public int capitalShipDestroyed(obj_id self, dictionary params) {
401405
if(!battleIsActive(self)) return SCRIPT_CONTINUE;
@@ -532,7 +536,8 @@ public List<obj_id> processShip(obj_var_list qualifiedShips, int playerCeiling,
532536

533537
spaceLog( "In processShip... now processing " + playerCount + " VALID players on board ship " + ship + " (i.e. not ejected, still on board ship, etc).");
534538
for(obj_id player : currentShipMembers){
535-
if(!factions.isImperialorImperialHelper(player) && !factions.isRebelorRebelHelper(player)) continue;
539+
if (!space_flags.isImperialHelperPilot(player) && !space_flags.isImperialPilot(player) && !space_flags.isRebelHelperPilot(player) && !space_flags.isRebelPilot(player)) continue;
540+
536541
spaceLog( "In processShip... now processing player " + player + ".");
537542
// make sure the player haven't been given anything yet.
538543
if(pointAwardedPlayers.contains(player)){
@@ -546,10 +551,12 @@ public List<obj_id> processShip(obj_var_list qualifiedShips, int playerCeiling,
546551
}
547552
return pointAwardedPlayers;
548553
}
554+
549555
public void handlePlayerAwards(obj_id player, String attackingFaction, boolean imperialsWon, String shipType, String battleType, String battleId, float pointAdjustmentValue) throws InterruptedException {
550556
spaceLog( "In handlePlayerAwards... now awarding GCW points.");
551-
boolean playerIsImperial = factions.isImperialorImperialHelper(player);
552-
boolean playerWasAttacking = (playerIsImperial && attackingFaction.equals("imperial")) || (factions.isRebelorRebelHelper(player) && attackingFaction.equals("rebel"));
557+
boolean playerIsImperial = space_flags.isImperialHelperPilot(player) || space_flags.isImperialPilot(player) ;
558+
boolean playerIsRebel = space_flags.isRebelHelperPilot(player) || space_flags.isRebelPilot(player) ;
559+
boolean playerWasAttacking = (playerIsImperial && attackingFaction.equals("imperial")) || (playerIsRebel && attackingFaction.equals("rebel"));
553560
boolean playerWon = (playerIsImperial && imperialsWon) ||
554561
(!playerIsImperial && !imperialsWon);
555562

@@ -570,7 +577,7 @@ public void handlePlayerAwards(obj_id player, String attackingFaction, boolean i
570577
);
571578

572579
// tell player they've won/lost
573-
sendSystemMessage(
580+
sendConsoleMessage(
574581
player,
575582
constructFinishedBattleMessage(
576583
playerWasAttacking,
@@ -581,8 +588,7 @@ public void handlePlayerAwards(obj_id player, String attackingFaction, boolean i
581588
attackingFaction,
582589
playerIsImperial ? "Imperial" : "Rebel",
583590
awardedTokens
584-
),
585-
null
591+
)
586592
);
587593

588594

@@ -596,6 +602,7 @@ public void handlePlayerAwards(obj_id player, String attackingFaction, boolean i
596602
}
597603

598604
}
605+
599606
public boolean awardGcwTokens(obj_id player, int quantity, String factionType) throws InterruptedException{
600607
obj_id inventory = getObjectInSlot(player, "inventory");
601608
if (isIdValid(inventory)) {

0 commit comments

Comments
 (0)