who isn't sick of converting the freaking scripts? this negates the need

This commit is contained in:
DarthArgus
2015-11-24 09:27:45 -06:00
parent 2e64106bc8
commit bbee2d328c
11077 changed files with 2604347 additions and 3425075 deletions
@@ -0,0 +1,32 @@
package script.space.command;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.space_utils;
import script.library.ship_ai;
import script.library.space_combat;
import script.library.utils;
public class player_cmd_bomber_strike_target extends script.base_script
{
public player_cmd_bomber_strike_target()
{
}
public int OnDestroy(obj_id self) throws InterruptedException
{
debugServerConsoleMsg(null, "ONdESTROY - tie bomber");
dictionary outparams = new dictionary();
outparams.put("deadTargetId", self);
if (hasObjVar(self, "targetedByPlayerObjId"))
{
space_utils.notifyObject(getObjIdObjVar(self, "targetedByPlayerObjId"), "bomberStrikeTargetDestroyed", outparams);
}
return SCRIPT_CONTINUE;
}
}
@@ -1,28 +0,0 @@
include library.space_utils;
include library.ship_ai;
include library.space_combat;
include library.utils;
// ======================================================================
// This script goes on all craft that are currently the target of a player-called bomber strike. We also store the obj_id of the player that called the command.
// When the targets are all destroyed, the bomber strike package will depart the area.
// If all of the bombers are destroyed, the script will be removed from any surviving targets.
trigger OnDestroy()
{
debugServerConsoleMsg( null, "ONdESTROY - tie bomber");
dictionary outparams = new dictionary();
outparams.put( "deadTargetId", self );
if ( hasObjVar(self, "targetedByPlayerObjId" ))
space_utils.notifyObject( getObjIdObjVar(self, "targetedByPlayerObjId"), "bomberStrikeTargetDestroyed", outparams ); //tell the player that called the strike that we got exploded
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,72 @@
package script.space.command;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.space_utils;
import script.library.ship_ai;
import script.library.space_combat;
import script.library.utils;
public class player_cmd_pirate extends script.base_script
{
public player_cmd_pirate()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
dictionary outparams = new dictionary();
messageTo(self, "pirateTimeout", outparams, 1200.0f, false);
return SCRIPT_CONTINUE;
}
public int OnDestroy(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "evacuate"))
{
debugServerConsoleMsg(null, "ONdESTROY - evacuating tie bomber unit just destructed. obj_id was: " + self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg(null, "ONdESTROY - space pirate");
dictionary outparams = new dictionary();
outparams.put("deadPirateId", self);
if (hasObjVar(self, "commanderPlayer"))
{
space_utils.notifyObject(getObjIdObjVar(self, "commanderPlayer"), "pirateUnitDestroyed", outparams);
}
return SCRIPT_CONTINUE;
}
public int OnSpaceUnitMoveToComplete(obj_id self) throws InterruptedException
{
debugServerConsoleMsg(null, "ONsPACEuNITmOVEtOcOMPLETE - space pirate script");
int squadId = ship_ai.unitGetSquadId(self);
obj_id[] squaddyList = null;
if (ship_ai.isSquadIdValid(squadId))
{
squaddyList = ship_ai.squadGetUnitList(squadId);
}
else
{
return SCRIPT_CONTINUE;
}
for (int i = 0; i < squaddyList.length; i++)
{
space_combat.destroyObjectHyperspace(squaddyList[i]);
}
return SCRIPT_CONTINUE;
}
public int pirateTimeout(obj_id self, dictionary params) throws InterruptedException
{
if (!isIdValid(self))
{
debugServerConsoleMsg(null, "+++ pirateTimeout . obj_id of the ship passed into the bomber strike timeout function doesn't come back as valid. What the hey?!?.");
return SCRIPT_CONTINUE;
}
space_combat.destroyObjectHyperspace(self);
return SCRIPT_CONTINUE;
}
}
@@ -1,70 +0,0 @@
include library.space_utils;
include library.ship_ai;
include library.space_combat;
include library.utils;
// ======================================================================
trigger OnAttach()
{
dictionary outparams = new dictionary();
messageTo( self, "pirateTimeout", outparams, 1200.0f, false ); //This command is a fail-safe cleanup to make sure the bombers don't stick around too long.
return SCRIPT_CONTINUE;
}
trigger OnDestroy()
{
if ( hasObjVar(self, "evacuate" ))
{
debugServerConsoleMsg( null, "ONdESTROY - evacuating tie bomber unit just destructed. obj_id was: "+self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg( null, "ONdESTROY - space pirate");
dictionary outparams = new dictionary();
outparams.put( "deadPirateId", self );
if ( hasObjVar(self, "commanderPlayer" ))
space_utils.notifyObject( getObjIdObjVar(self, "commanderPlayer"), "pirateUnitDestroyed", outparams ); //tell the player that called the strike that we got exploded
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnSpaceUnitMoveToComplete() //This should primarily only trigger when the bombers get to their escape point, after they've decided to bug out
{
debugServerConsoleMsg( null, "ONsPACEuNITmOVEtOcOMPLETE - space pirate script");
int squadId = ship_ai.unitGetSquadId(self);
obj_id[] squaddyList = null;
if ( ship_ai.isSquadIdValid(squadId) )
squaddyList = ship_ai.squadGetUnitList(squadId);
else
return SCRIPT_CONTINUE;
for(int i = 0; i<squaddyList.length; i++) //hyperspace out the bombers
{
space_combat.destroyObjectHyperspace(squaddyList[i]);
}
return SCRIPT_CONTINUE;
}
messageHandler pirateTimeout()
{
if ( !isIdValid(self) )
{
debugServerConsoleMsg( null, "+++ pirateTimeout . obj_id of the ship passed into the bomber strike timeout function doesn't come back as valid. What the hey?!?." );
return SCRIPT_CONTINUE;
}
space_combat.destroyObjectHyperspace(self);
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,227 @@
package script.space.command;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.utils;
import script.library.space_utils;
import script.library.space_crafting;
import script.library.ship_ai;
import script.library.xp;
import script.library.space_combat;
import java.lang.Math;
import script.library.space_pilot_command;
import script.library.space_transition;
public class player_cmd_repair_reload_ship extends script.base_script
{
public player_cmd_repair_reload_ship()
{
}
public static final int DROID_VOCALIZE_REACT_CHANCE = 2;
public static final int SHIP_DAMAGED_SKILLMOD_PENALTY_TIME = 10;
public static final string_id SID_REPAIRSHIP_STOP_MOVING = new string_id("space/space_pilot_command", "repairship_stop_moving");
public static final string_id SID_NO_RESPONSE_RECEIVED_ASSIST = new string_id("space/space_pilot_command", "no_response_received_assist");
public int OnSpaceUnitDocked(obj_id self, obj_id dockTarget) throws InterruptedException
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitDocked ---- Just Entered");
obj_id objPilot = getPilotId(dockTarget);
if (!isIdValid(objPilot))
{
return SCRIPT_CONTINUE;
}
playClientEffectObj(objPilot, "clienteffect/space_command/shp_dock_harddock.cef", dockTarget, "");
if (getShipHasWings(dockTarget))
{
clearCondition(dockTarget, CONDITION_WINGS_OPENED);
}
dictionary outparams = new dictionary();
outparams.put("pilot", objPilot);
outparams.put("ship", dockTarget);
messageTo(self, "repairSFX", outparams, 2.0f, false);
obj_id closestStation = getObjIdObjVar(self, "closestStation");
String command_type = getStringObjVar(self, "command_type");
if (command_type.equals("repair"))
{
space_crafting.doStationToShipRepairs(objPilot, closestStation, space_pilot_command.IN_SPACE_REPAIR_STD_REPAIR_PERCENTAGE, space_pilot_command.IN_SPACE_REPAIR_DECAY);
}
else if (command_type.equals("reload"))
{
space_pilot_command.doStationToShipReload(objPilot, closestStation);
}
else if (command_type.equals("repairAndReload"))
{
space_crafting.doStationToShipRepairs(objPilot, closestStation, space_pilot_command.IN_SPACE_REPAIR_STD_REPAIR_PERCENTAGE, space_pilot_command.IN_SPACE_REPAIR_DECAY);
space_pilot_command.doStationToShipReload(objPilot, closestStation);
}
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_reactor, true);
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_engine, true);
space_pilot_command.repairCompleteDepart(self);
return SCRIPT_CONTINUE;
}
public int OnSpaceUnitUnDocked(obj_id self, obj_id dockTarget, boolean dockSuccessful) throws InterruptedException
{
obj_id objPilot = getPilotId(dockTarget);
if (!isIdValid(objPilot))
{
return SCRIPT_CONTINUE;
}
playClientEffectObj(objPilot, "clienteffect/space_command/shp_dock_release.cef", dockTarget, "");
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_reactor, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_reactor, dockTarget);
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_engine, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_engine, dockTarget);
playClientEffectObj(objPilot, "clienteffect/space_command/sys_comm_rebel.cef", dockTarget, "");
return SCRIPT_CONTINUE;
}
public int OnSpaceUnitStartUnDock(obj_id self, obj_id dockTarget) throws InterruptedException
{
obj_id objPilot = getPilotId(dockTarget);
if (!isIdValid(objPilot))
{
return SCRIPT_CONTINUE;
}
playClientEffectObj(objPilot, "clienteffect/space_command/shp_dock_release.cef", dockTarget, "");
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_reactor, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_reactor, dockTarget);
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_engine, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_engine, dockTarget);
playClientEffectObj(objPilot, "clienteffect/space_command/sys_comm_rebel.cef", dockTarget, "");
return SCRIPT_CONTINUE;
}
public int OnShipWasHit(obj_id self, obj_id objAttacker, int intWeaponIndex, boolean isMissile, int missileType, int intTargetedComponent, boolean fromPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
{
if (!utils.hasLocalVar(self, "cmd.repair"))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- No command local var on repair/reload ship.");
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- Probable screwed-up instance. Bugging out!");
}
if (utils.hasLocalVar(self, "cmd.repair.buggingOut"))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- I'm hit again!. Already bugging out!");
return SCRIPT_CONTINUE;
}
if (hasObjVar(self, "cmd.repair.commander"))
{
obj_id commander = getObjIdObjVar(self, "cmd.repair.commander");
if (isIdValid(commander))
{
string_id strSpam = new string_id("space/space_pilot_command", "spacerepair_attack");
sendSystemMessage(commander, strSpam);
}
}
space_pilot_command.repairEvac(self);
return SCRIPT_CONTINUE;
}
public int OnSpaceUnitMoveToComplete(obj_id self) throws InterruptedException
{
obj_id commander = getObjIdObjVar(self, "cmd.repair.commander");
obj_id ship = space_transition.getContainingShip(commander);
if (!isIdValid(ship))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - ship obj_id isn't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
if (!isIdValid(commander))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - commander obj_id isn't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
if (utils.hasLocalVar(self, "cmd.repair.buggingOut"))
{
utils.removeLocalVar(commander, "cmd.repair.otw");
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- Bugging out! Arrived at destination! Destroying myself w/ hyperspace effect!");
space_combat.destroyObjectHyperspace(self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - repair/resupply ship has reached rendezvous and will now supply estimate");
if (!utils.hasLocalVar(self, "cmd.repair.command_type") || !hasObjVar(self, "cmd.repair.commander") || !utils.hasLocalVar(self, "cmd.repair.station"))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - repair/resupply ship has reached rendezvous but doesn't know what action to do. Evac!");
space_pilot_command.repairEvac(self);
}
obj_id closestStation = utils.getObjIdLocalVar(self, "cmd.repair.station");
String command_type = utils.getStringLocalVar(self, "cmd.repair.command_type");
float currentSpeed = getShipCurrentSpeed(ship);
if (currentSpeed > 1.0f)
{
sendSystemMessage(self, SID_REPAIRSHIP_STOP_MOVING);
return SCRIPT_CONTINUE;
}
if (command_type.equals("repair"))
{
space_pilot_command.inSpaceRepairComponentsEstimate(ship, commander, closestStation);
}
else if (command_type.equals("reload"))
{
space_pilot_command.inSpaceReloadLaunchersEstimate(ship, commander, closestStation);
}
else if (command_type.equals("repairAndReload"))
{
space_pilot_command.inSpaceRepairReloadComponentsEstimate(ship, commander, closestStation);
}
return SCRIPT_CONTINUE;
}
public int repairReplyTimeout(obj_id self, dictionary params) throws InterruptedException
{
obj_id commander = getObjIdObjVar(self, "cmd.repair.commander");
if (!isIdValid(commander))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.repairReplyTimeout - commander obj_id isn't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
sendSystemMessage(self, SID_NO_RESPONSE_RECEIVED_ASSIST);
space_pilot_command.repairCompleteDepart(self);
return SCRIPT_CONTINUE;
}
public int dockTargetMovementCheck(obj_id self, dictionary params) throws InterruptedException
{
if (utils.hasLocalVar(self, "cmd.repair.buggingOut"))
{
return SCRIPT_CONTINUE;
}
obj_id pilot = params.getObjId("pilot");
obj_id ship = params.getObjId("ship");
if (!isIdValid(pilot) || !isIdValid(ship))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.dockTargetMovementCheck - pilot or ship obj_id aren't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
float currentSpeed = getShipCurrentSpeed(ship);
if (currentSpeed > 1.0f)
{
string_id strSpam = new string_id("space/space_interaction", "cant_be_moving");
sendSystemMessage(pilot, strSpam);
space_pilot_command.repairEvac(self);
}
else
{
dictionary outparams = new dictionary();
outparams.put("pilot", pilot);
outparams.put("ship", ship);
messageTo(self, "dockTargetMovementCheck", outparams, 2.0f, false);
}
return SCRIPT_CONTINUE;
}
public int repairSFX(obj_id self, dictionary params) throws InterruptedException
{
obj_id pilot = params.getObjId("pilot");
obj_id ship = params.getObjId("ship");
if (!isIdValid(pilot) || !isIdValid(ship))
{
debugServerConsoleMsg(null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.repairSFX - pilot or ship obj_id aren't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
playClientEffectObj(pilot, "clienteffect/space_command/shp_dock_repair_group.cef", ship, "");
if (hasObjVar(self, "reload"))
{
playClientEffectObj(pilot, "clienteffect/space_command/shp_dock_release.cef", ship, "");
}
return SCRIPT_CONTINUE;
}
}
@@ -1,297 +0,0 @@
// this is the repair and reload ship script, placed on ships by pilot commands and abilities in JTL
include library.utils;
include library.space_utils;
include library.space_crafting;
include library.ship_ai;
include library.xp;
include library.space_combat;
include java.lang.Math;
include library.space_pilot_command;
include library.space_transition;
const int DROID_VOCALIZE_REACT_CHANCE = 2; //The lower the number, the less the chance. Valid range is 1 - 10
const int SHIP_DAMAGED_SKILLMOD_PENALTY_TIME = 10; //The number of seconds a ship will have a skillmod localvar on it after being hit
const string_id SID_REPAIRSHIP_STOP_MOVING = new string_id("space/space_pilot_command", "repairship_stop_moving");
const string_id SID_NO_RESPONSE_RECEIVED_ASSIST = new string_id("space/space_pilot_command", "no_response_received_assist");
/*
trigger OnAttach()
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnAttach - Just Entered!");
obj_id commander = getObjIdObjVar(self, "cmd.repair.commander");
if( !isIdValid(commander))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnAttach - commander obj_id isn't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
playClientEffectObj(commander, "clienteffect/space_command/shp_dock_repair_loop.cef", self, "");
return SCRIPT_CONTINUE;
}
*/
trigger OnSpaceUnitDocked(obj_id dockTarget)
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitDocked ---- Just Entered");
obj_id objPilot = getPilotId(dockTarget);
if(!isIdValid(objPilot))
return SCRIPT_CONTINUE;
playClientEffectObj(objPilot, "clienteffect/space_command/shp_dock_harddock.cef", dockTarget, "");
if (getShipHasWings(dockTarget)) //Close Ships wings, if it has them
clearCondition(dockTarget, CONDITION_WINGS_OPENED);
dictionary outparams = new dictionary();
outparams.put( "pilot", objPilot );
outparams.put( "ship", dockTarget );
messageTo( self, "repairSFX", outparams, 2.0f, false );
obj_id closestStation = getObjIdObjVar(self, "closestStation");
string command_type = getStringObjVar(self, "command_type");
if ( command_type == "repair" )
{
//repair, but at 10% more decay than stations
//debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitDocked ---- firing space_crafting.doStationToShipRepairs");
//debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitDocked ---- sending values - objPilot=:"+objPilot+" closestStation=:"+closestStation+" space_pilot_command.IN_SPACE_REPAIR_STD_REPAIR_PERCENTAGE=:"+space_pilot_command.IN_SPACE_REPAIR_STD_REPAIR_PERCENTAGE+" space_pilot_command.IN_SPACE_REPAIR_DECAY=:"+space_pilot_command.IN_SPACE_REPAIR_DECAY);
space_crafting.doStationToShipRepairs(objPilot, closestStation, space_pilot_command.IN_SPACE_REPAIR_STD_REPAIR_PERCENTAGE, space_pilot_command.IN_SPACE_REPAIR_DECAY);
}
else if ( command_type == "reload" )
{
//repair, but at 10% more decay
space_pilot_command.doStationToShipReload(objPilot, closestStation);
}
else if ( command_type == "repairAndReload" )
{
//repair, but at 10% more decay
space_crafting.doStationToShipRepairs(objPilot, closestStation, space_pilot_command.IN_SPACE_REPAIR_STD_REPAIR_PERCENTAGE, space_pilot_command.IN_SPACE_REPAIR_DECAY);
space_pilot_command.doStationToShipReload(objPilot, closestStation);
}
//shut down the docked ship
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_reactor, true);
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_engine, true);
space_pilot_command.repairCompleteDepart(self);
return SCRIPT_CONTINUE;
}
trigger OnSpaceUnitUnDocked(obj_id dockTarget, boolean dockSuccessful)
{
obj_id objPilot = getPilotId(dockTarget);
if(!isIdValid(objPilot))
return SCRIPT_CONTINUE;
playClientEffectObj(objPilot, "clienteffect/space_command/shp_dock_release.cef", dockTarget, "");
// After the ship undocks, re-light the ship's systems
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_reactor, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_reactor, dockTarget);
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_engine, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_engine, dockTarget);
playClientEffectObj(objPilot, "clienteffect/space_command/sys_comm_rebel.cef", dockTarget, "");
return SCRIPT_CONTINUE;
}
trigger OnSpaceUnitStartUnDock(obj_id dockTarget) //UNCOMMENT OUT WHEN THIS TRIGGER GOES IN
{
obj_id objPilot = getPilotId(dockTarget);
if(!isIdValid(objPilot))
return SCRIPT_CONTINUE;
playClientEffectObj(objPilot, "clienteffect/space_command/shp_dock_release.cef", dockTarget, "");
// After the ship undocks, re-light the ship's systems
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_reactor, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_reactor, dockTarget);
space_utils.setComponentDisabled(dockTarget, ship_chassis_slot_type.SCST_engine, false);
space_combat.recalculateEfficiency(ship_chassis_slot_type.SCST_engine, dockTarget);
playClientEffectObj(objPilot, "clienteffect/space_command/sys_comm_rebel.cef", dockTarget, "");
return SCRIPT_CONTINUE;
}
trigger OnShipWasHit (obj_id objAttacker, int intWeaponIndex, boolean isMissile, int missileType, int intTargetedComponent, boolean fromPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o)
{
if(!utils.hasLocalVar(self, "cmd.repair"))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- No command local var on repair/reload ship.");
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- Probable screwed-up instance. Bugging out!");
}
if(utils.hasLocalVar(self, "cmd.repair.buggingOut"))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- I'm hit again!. Already bugging out!");
return SCRIPT_CONTINUE;
}
if(hasObjVar(self, "cmd.repair.commander"))
{
obj_id commander = getObjIdObjVar(self, "cmd.repair.commander");
if(isIdValid(commander))
{
//LOCALIZE THIS
//sendSystemMessageTestingOnly(commander, "We're under attack! Bugging out!");
string_id strSpam = new string_id("space/space_pilot_command", "spacerepair_attack");
sendSystemMessage(commander, strSpam);
}
}
space_pilot_command.repairEvac(self);
return SCRIPT_CONTINUE;
}
trigger OnSpaceUnitMoveToComplete() //Trigger when the repair/reload ship has reached it's rendezvous point
{
//VITAL DATA INITIALIZATION
obj_id commander = getObjIdObjVar(self, "cmd.repair.commander");
obj_id ship = space_transition.getContainingShip (commander);
if ( !isIdValid(ship))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - ship obj_id isn't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
if( !isIdValid(commander))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - commander obj_id isn't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
if(utils.hasLocalVar(self, "cmd.repair.buggingOut")) //SHIP HAS ARRIVED AT HYPERSPACE-OUT POINT
{
utils.removeLocalVar(commander, "cmd.repair.otw");
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnShipWasHit ---- Bugging out! Arrived at destination! Destroying myself w/ hyperspace effect!");
space_combat.destroyObjectHyperspace(self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - repair/resupply ship has reached rendezvous and will now supply estimate");
if(!utils.hasLocalVar(self, "cmd.repair.command_type") || !hasObjVar(self, "cmd.repair.commander") || !utils.hasLocalVar(self, "cmd.repair.station"))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.OnSpaceUnitMoveToComplete - repair/resupply ship has reached rendezvous but doesn't know what action to do. Evac!");
space_pilot_command.repairEvac(self);
}
obj_id closestStation = utils.getObjIdLocalVar(self, "cmd.repair.station");
string command_type = utils.getStringLocalVar(self, "cmd.repair.command_type");
float currentSpeed = getShipCurrentSpeed(ship); //MOVING TARGET CHECK. CAN'T DOCK WITH A MOVING TARGET
if ( currentSpeed > 1.0f )
{
sendSystemMessage(self, SID_REPAIRSHIP_STOP_MOVING);
//string_id strSpam = new string_id("space/space_pilot_command", "repairship_player_moving");
//sendSystemMessage(commander, strSpam);
//space_pilot_command.repairCompleteDepart(self);
return SCRIPT_CONTINUE;
}
if ( command_type == "repair" ) //LOOKS GOOD. ESTIMATE HOW MUCH THIS IS GOING TO COST THE PLAYER
space_pilot_command.inSpaceRepairComponentsEstimate(ship, commander, closestStation);
else if ( command_type == "reload" )
space_pilot_command.inSpaceReloadLaunchersEstimate(ship, commander, closestStation);
else if ( command_type == "repairAndReload" )
space_pilot_command.inSpaceRepairReloadComponentsEstimate(ship, commander, closestStation);
return SCRIPT_CONTINUE;
}
messageHandler repairReplyTimeout()
{
obj_id commander = getObjIdObjVar(self, "cmd.repair.commander");
if( !isIdValid(commander))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.repairReplyTimeout - commander obj_id isn't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
sendSystemMessage(self, SID_NO_RESPONSE_RECEIVED_ASSIST);
//string_id strSpam = new string_id("space/space_pilot_command", "repairship_player_moving");
//sendSystemMessage(commander, strSpam);
space_pilot_command.repairCompleteDepart(self);
return SCRIPT_CONTINUE;
}
messageHandler dockTargetMovementCheck()
{
if (utils.hasLocalVar(self, "cmd.repair.buggingOut"))
return SCRIPT_CONTINUE;
obj_id pilot = params.getObjId( "pilot");
obj_id ship = params.getObjId( "ship");
if( !isIdValid(pilot) || !isIdValid(ship))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.dockTargetMovementCheck - pilot or ship obj_id aren't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
float currentSpeed = getShipCurrentSpeed(ship);
if ( currentSpeed > 1.0f )
{
//sendSystemMessageTestingOnly(self, "Unable to call in the repair vessel. You are currently moving, and you must be stopped before the repair ship can find and assist you.");
string_id strSpam = new string_id("space/space_interaction", "cant_be_moving");
sendSystemMessage(pilot, strSpam);
space_pilot_command.repairEvac(self);
}
else
{
dictionary outparams = new dictionary();
outparams.put( "pilot", pilot );
outparams.put( "ship", ship );
messageTo( self, "dockTargetMovementCheck", outparams, 2.0f, false );
}
return SCRIPT_CONTINUE;
}
messageHandler repairSFX()
{
obj_id pilot = params.getObjId( "pilot");
obj_id ship = params.getObjId( "ship");
if( !isIdValid(pilot) || !isIdValid(ship))
{
debugServerConsoleMsg( null, "PLAYER_CMD_REPAIR_RELOAD_SHIP.repairSFX - pilot or ship obj_id aren't valid. BALLS! YEEargh!!!");
return SCRIPT_CONTINUE;
}
playClientEffectObj(pilot, "clienteffect/space_command/shp_dock_repair_group.cef", ship, "");
if ( hasObjVar(self,"reload"))
playClientEffectObj(pilot, "clienteffect/space_command/shp_dock_release.cef", ship, "");
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,72 @@
package script.space.command;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.space_utils;
import script.library.ship_ai;
import script.library.space_combat;
import script.library.utils;
public class player_cmd_tie_bomber extends script.base_script
{
public player_cmd_tie_bomber()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
dictionary outparams = new dictionary();
messageTo(self, "bomberStrikeTimeout", outparams, 1200.0f, false);
return SCRIPT_CONTINUE;
}
public int OnDestroy(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "evacuate"))
{
debugServerConsoleMsg(null, "ONdESTROY - evacuating tie bomber unit just destructed. obj_id was: " + self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg(null, "ONdESTROY - tie bomber");
if (hasObjVar(self, "commanderPlayer"))
{
dictionary outparams = new dictionary();
outparams.put("deadBomberId", self);
space_utils.notifyObject(getObjIdObjVar(self, "commanderPlayer"), "bomberStrikeUnitDestroyed", outparams);
}
return SCRIPT_CONTINUE;
}
public int OnSpaceUnitMoveToComplete(obj_id self) throws InterruptedException
{
debugServerConsoleMsg(null, "ONsPACEuNITmOVEtOcOMPLETE - tie bomber script");
int squadId = ship_ai.unitGetSquadId(self);
obj_id[] squaddyList = null;
if (ship_ai.isSquadIdValid(squadId))
{
squaddyList = ship_ai.squadGetUnitList(squadId);
}
else
{
return SCRIPT_CONTINUE;
}
for (int i = 0; i < squaddyList.length; i++)
{
space_combat.destroyObjectHyperspace(squaddyList[i]);
}
return SCRIPT_CONTINUE;
}
public int bomberStrikeTimeout(obj_id self, dictionary params) throws InterruptedException
{
if (!isIdValid(self))
{
debugServerConsoleMsg(null, "+++ bomberStrikeTimeout . obj_id of the ship passed into the bomber strike timeout function doesn't come back as valid. What the hey?!?.");
return SCRIPT_CONTINUE;
}
space_combat.destroyObjectHyperspace(self);
return SCRIPT_CONTINUE;
}
}
@@ -1,101 +0,0 @@
include library.space_utils;
include library.ship_ai;
include library.space_combat;
include library.utils;
// ======================================================================
trigger OnAttach()
{
dictionary outparams = new dictionary();
messageTo( self, "bomberStrikeTimeout", outparams, 1200.0f, false ); //This command is a fail-safe cleanup to make sure the bombers don't stick around too long.
return SCRIPT_CONTINUE;
}
trigger OnDestroy()
{
if ( hasObjVar(self, "evacuate" ))
{
debugServerConsoleMsg( null, "ONdESTROY - evacuating tie bomber unit just destructed. obj_id was: "+self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg( null, "ONdESTROY - tie bomber");
if ( hasObjVar(self, "commanderPlayer" ))
{
dictionary outparams = new dictionary();
outparams.put( "deadBomberId", self );
/* ESCORT FIGHTERS ARE NOW BUILT INTO THE PRIMARY SQUAD, AND ARE NO LONGER SEPERATE
int currentEscortSquadSize = utils.getIntLocalVar (self, "crrntEscrtSqdSz");
if ( currentEscortSquadSize > 0 )
outparams.put( "escortSquadId", utils.getIntLocalVar (self, "escortSquadId"));
else
outparams.put( "escortSquadId", -1 );
*/
space_utils.notifyObject( getObjIdObjVar(self, "commanderPlayer"), "bomberStrikeUnitDestroyed", outparams ); //tell the player that called the strike that we got exploded
}
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnSpaceUnitMoveToComplete() //This should primarily only trigger when the bombers get to their escape point, after they've decided to bug out
{
debugServerConsoleMsg( null, "ONsPACEuNITmOVEtOcOMPLETE - tie bomber script");
int squadId = ship_ai.unitGetSquadId(self);
obj_id[] squaddyList = null;
if ( ship_ai.isSquadIdValid(squadId) )
squaddyList = ship_ai.squadGetUnitList(squadId);
else
return SCRIPT_CONTINUE;
for(int i = 0; i<squaddyList.length; i++) //hyperspace out the bombers
{
/* -- ESCORT FIGHTERS ARE NOW BUILT INTO THE BOMBER'S SQUAD AND NOT A SEPARATE SQUAD
if ( utils.hasLocalVar(squaddyList[i], "escortSquadId" )) //hyperspace out the escort fighters
{
int currentEscortSquadSize = utils.getIntLocalVar (squaddyList[i], "crrntEscrtSqdSz");
if ( currentEscortSquadSize > 0 )
{
int escortSquadId = utils.getIntLocalVar (squaddyList[i], "escortSquadId");
obj_id[] escortSquaddyList = ship_ai.squadGetUnitList(escortSquadId);
for(int j = 0; j<escortSquaddyList.length; j++)
{
space_combat.destroyObjectHyperspace(escortSquaddyList[j]);
}
}
}
*/
space_combat.destroyObjectHyperspace(squaddyList[i]);
}
return SCRIPT_CONTINUE;
}
messageHandler bomberStrikeTimeout()
{
if ( !isIdValid(self) )
{
debugServerConsoleMsg( null, "+++ bomberStrikeTimeout . obj_id of the ship passed into the bomber strike timeout function doesn't come back as valid. What the hey?!?." );
return SCRIPT_CONTINUE;
}
space_combat.destroyObjectHyperspace(self);
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,56 @@
package script.space.command;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.space_utils;
import script.library.ship_ai;
import script.library.space_combat;
import script.library.utils;
public class player_cmd_tie_bomber_escort extends script.base_script
{
public player_cmd_tie_bomber_escort()
{
}
public int OnDestroy(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "evacuate"))
{
debugServerConsoleMsg(null, "ONdESTROY - evacuating tie bomber ESCORT unit just destructed. obj_id was: " + self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg(null, "ONdESTROY - tie bomber escort");
dictionary outparams = new dictionary();
outparams.put("deadFighterId", self);
if (hasObjVar(self, "commanderPlayer"))
{
space_utils.notifyObject(getObjIdObjVar(self, "commanderPlayer"), "bomberStrikeEscortUnitDestroyed", outparams);
}
return SCRIPT_CONTINUE;
}
public int OnSpaceUnitMoveToComplete(obj_id self) throws InterruptedException
{
debugServerConsoleMsg(null, "ONsPACEuNITmOVEtOcOMPLETE - tie bomber escort script");
int squadId = ship_ai.unitGetSquadId(self);
obj_id[] squaddyList = null;
if (ship_ai.isSquadIdValid(squadId))
{
squaddyList = ship_ai.squadGetUnitList(squadId);
}
else
{
return SCRIPT_CONTINUE;
}
for (int i = 0; i < squaddyList.length; i++)
{
space_combat.destroyObjectHyperspace(squaddyList[i]);
}
return SCRIPT_CONTINUE;
}
}
@@ -1,58 +0,0 @@
include library.space_utils;
include library.ship_ai;
include library.space_combat;
include library.utils;
// ======================================================================
/*
trigger OnAttach()
{
if(!setupEscort( self ))
escape(self);
return SCRIPT_CONTINUE;
}
*/
trigger OnDestroy()
{
if ( hasObjVar(self, "evacuate" ))
{
debugServerConsoleMsg( null, "ONdESTROY - evacuating tie bomber ESCORT unit just destructed. obj_id was: "+self);
return SCRIPT_CONTINUE;
}
debugServerConsoleMsg( null, "ONdESTROY - tie bomber escort");
dictionary outparams = new dictionary();
outparams.put( "deadFighterId", self );
if ( hasObjVar(self, "commanderPlayer" ))
space_utils.notifyObject( getObjIdObjVar(self, "commanderPlayer"), "bomberStrikeEscortUnitDestroyed", outparams ); //tell the player that called the strike that we got exploded
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnSpaceUnitMoveToComplete() //This should primarily only trigger when the bombers get to their escape point, after they've decided to bug out
{
debugServerConsoleMsg( null, "ONsPACEuNITmOVEtOcOMPLETE - tie bomber escort script");
int squadId = ship_ai.unitGetSquadId(self);
obj_id[] squaddyList = null;
if ( ship_ai.isSquadIdValid(squadId) )
squaddyList = ship_ai.squadGetUnitList(squadId);
else
return SCRIPT_CONTINUE;
for(int i = 0; i<squaddyList.length; i++) //hyperspace out the bombers
{
space_combat.destroyObjectHyperspace(squaddyList[i]);
}
return SCRIPT_CONTINUE;
}