------------------------------------------------------------
--     2008 Elite Games Team (R) All Rights Reserved      --
--             "STAR WOLVES 2: CIVIL WAR"                 --
------------------------------------------------------------

------------------------------------------------------------
--   Auto-built function-file created by "MapBuilder2"    --
------------------------------------------------------------
--      "MapBuilder2" v.2.6 Elite Games Team              --
------------------------------------------------------------
mothership=GetPlayerMotherShip();
----------------------------------------------------------------
--LABELS
----------------------------------------------------------------

NP_PORTAL_L = GetNavPointByLabel("NP_PORTAL_L");
NP_PORTAL_R = GetNavPointByLabel("NP_PORTAL_R");
NP_PORTAL_U = GetNavPointByLabel("NP_PORTAL_U");
NP_TRADE_STATION = GetNavPointByLabel("NP_TRADE_STATION");
np_STO = GetNavPointByLabel("xyz_STO");
np_mine = GetNavPointByLabel("xyz_mine");
np_pir = GetNavPointByLabel("xyz_pir");
PORTAL_L = GetObjectByLabel("PORTAL_L");

PORTAL_R = GetObjectByLabel("PORTAL_R");

PORTAL_U = GetObjectByLabel("PORTAL_U");

STO_Station = GetObjectByLabel("STO_Station");
MINE = GetObjectByLabel("MINE");
PIR = GetObjectByLabel("PIR");
TRADE_STATION = GetObjectByLabel("TRADE_STATION");


----------------------------------------------------------------
--PORTAL Condition
----------------------------------------------------------------

function PORTAL_L_Condition()
   return PORTAL_L:IsEnabled();
end;

function PORTAL_R_Condition()
   return PORTAL_R:IsEnabled();
end;

function PORTAL_U_Condition()
   return PORTAL_U:IsEnabled();
end;



----------------------------------------------------------------
--PORTAL Action
----------------------------------------------------------------



function PORTAL_L_Action()
   dest_location = "xt11";
   ShowMsgBox("#M_teleport_confirm", "#M_teleport_to_xt11", OnPortalStart_PORTAL_L, OnPortalCancel);
end;

function PORTAL_R_Action()
   dest_location = "xt26";
   ShowMsgBox("#M_teleport_confirm", "#M_teleport_to_xt26", OnPortalStart_PORTAL_R, OnPortalCancel);
end;

function PORTAL_U_Action()
   dest_location = "xt24";
   ShowMsgBox("#M_teleport_confirm", "#M_teleport_to_xt24", OnPortalStart_PORTAL_U, OnPortalCancel);
end;



----------------------------------------------------------------
--PORTAL OnPortalStart
----------------------------------------------------------------

function OnPortalStart_PORTAL_L()
   SetNormalTimeMode();
   PORTAL_L:Start(9, 0);
   mothership:PlayFX("Portal Out.shfx");
   Teleporter:Activate();
end;

function OnPortalStart_PORTAL_R()
   SetNormalTimeMode();
   PORTAL_R:Start(9, 0);
   mothership:PlayFX("Portal Out.shfx");
   Teleporter:Activate();
end;

function OnPortalStart_PORTAL_U()
   SetNormalTimeMode();
   PORTAL_U:Start(9, 0);
   mothership:PlayFX("Portal Out.shfx");
   Teleporter:Activate();
end;



----------------------------------------------------------------
--PORTAL Another
----------------------------------------------------------------

function PortalsActivate_Action()
	  ActivatePortalTriggers();
end;

function OnPortalCancel()
  	PortalsActivateTrigger:Activate();
end;

function TeleporterAction()
SetInitTeamRelation("Pirates",PLAYER_TEAM,GetGroupRelation(PiratesGroup_1,PLAYER_GROUP));
   TeleportToLocation(dest_location);
end;

function ActivatePortalTriggers()
PortalTrigger_PORTAL_L:Activate();
PortalTrigger_PORTAL_R:Activate();
PortalTrigger_PORTAL_U:Activate();
end;





----------------------------------------------------------------
--В данную (IN SYSTEM UNUSUAL) секцию писать только то, что не обрабатывает Mapbilder2
--IN SYSTEM UNUSUAL START
----------------------------------------------------------------
----------------------------------------------------------------
--IN SYSTEM UNUSUAL END
----------------------------------------------------------------


-- END auto-build text --
