mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
113 lines
2.8 KiB
Plaintext
113 lines
2.8 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// shipoperations_falcon.script
|
|
//
|
|
// Copyright 2004 Sony Online Entertainment
|
|
//
|
|
// ======================================================================
|
|
|
|
include library.utils;
|
|
include library.space_transition;
|
|
include library.space_utils;
|
|
|
|
// ======================================================================
|
|
|
|
const string_id SID_OPERATIONS = new string_id("space/space_interaction", "operations");
|
|
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
obj_id ship = space_transition.getContainingShip(self);
|
|
if (isIdValid(ship))
|
|
{
|
|
utils.setScriptVar(ship, "objOperationsChair", self);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach()
|
|
{
|
|
obj_id ship = space_transition.getContainingShip(self);
|
|
if (isIdValid(ship))
|
|
{
|
|
utils.setScriptVar(ship, "objOperationsChair", self);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
obj_id objShip = space_transition.getContainingShip(player);
|
|
|
|
if (space_utils.playerCanControlShipSlot(objShip, player, true))
|
|
{
|
|
mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_OPERATIONS);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if (item == menu_info_types.SERVER_MENU1)
|
|
{
|
|
obj_id objShip = space_transition.getContainingShip(player);
|
|
obj_id objOwner = getOwner(objShip);
|
|
|
|
int intOwnerFaction = space_transition.getPlayerSpaceFaction(objOwner);
|
|
int intMyFaction = space_transition.getPlayerSpaceFaction(player);
|
|
|
|
if((isGCWFaction(intOwnerFaction)||(isGCWFaction(intMyFaction))))
|
|
{
|
|
if(intOwnerFaction!=intMyFaction)
|
|
{
|
|
if(isGCWFaction(intOwnerFaction))
|
|
{
|
|
intMyFaction = pvpGetAlignedFaction(player);
|
|
if(intOwnerFaction!=intMyFaction)
|
|
{
|
|
string_id strSpam = new string_id("space/space_interaction", "wrong_faction");
|
|
sendSystemMessage(player, strSpam);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string_id strSpam = new string_id("space/space_interaction", "wrong_faction");
|
|
sendSystemMessage(player, strSpam);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (space_utils.playerCanControlShipSlot(objShip, player, false))
|
|
{
|
|
if (equip(player, self, "ship_operations_pob"))
|
|
{
|
|
space_transition.grantDroidCommands(player);
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|
|
|
|
boolean isGCWFaction(int intFaction)
|
|
{
|
|
if(intFaction==##"imperial")
|
|
{
|
|
return true;
|
|
}
|
|
if(intFaction==##"rebel")
|
|
{
|
|
return true;
|
|
}
|
|
return false; //jeffmade me do this..
|
|
} |