--- new

function __initialise_Dock()
__system_Dock_array = {};
__system_Dock_current = 0;
__system_Dock_flag = 0;
_param = "";

_tab_sid = {
	{"Kfni","KFNI_AllowChange","ans00","ans000",700000,"New Empire"},
	{"Vks","VKS_AllowChange","ans01","ans001",650000,"MSF"},
	{"Triada","Triada_AllowChange","ans02","ans002",850000,"Triada"},
	{"Uss","USS_AllowChange","ans03","ans003",800000,"USS"},
	{"Inoco","InoCo_AllowChange","ans04","ans004",900000,"InoCo"},
	{"Hunter","Hunter_AllowChange","ans07","ans007",600000,"Border Sector"},
	{"Guard","Merc_AllowChange","ans08","ans008",750000,"mercenaries"},
	{"Trade","Trade_AllowChange","ans09","ans009",950000,"FTU"}};

DialogList_Rep={"DialogC1","DialogC2","DialogC3","DialogC4","DialogC5","DialogC6","DialogC7","DialogC8"};
end;

function _Dock_exclude()
__system_Dock_flag = 1;
end;

function _Dock_include()
__system_Dock_flag = 0;
end;

function ChangeFuncDocking(func,_station)
------	local table = {func,xyz_station,param,distance,param2};
local val={};
local oldfunc="";
for i, val in __system_Dock_array do
	if (_station.id == val[5].id) then
		oldfunc=val[1];
		__system_Dock_array[i][1] = func;
		local tr_in = getglobal("trigger_dock_in_"..i);
		local tr_out = getglobal("trigger_dock_out_"..i);
		local tr_wait = getglobal("trigger_dock_wait_"..i);
		tr_in:Activate();
		tr_out:Activate(FALSE);
		tr_wait:Activate(FALSE);
	end;
end;
return oldfunc;
end;

function StopDocking(_station)
local val={};
for i, val in __system_Dock_array do
	if (_station.id == val[5].id) then
		local tr_in = getglobal("trigger_dock_in_"..i);
		local tr_out = getglobal("trigger_dock_out_"..i);
		local tr_wait = getglobal("trigger_dock_wait_"..i);
		tr_in:Activate(FALSE);
		tr_out:Activate(FALSE);
		tr_wait:Activate(FALSE);
	end;
  end;
end;

function StartDocking(_station)
local val={};
for i, val in __system_Dock_array do
	if (_station.id == val[5].id) then
		local tr_in = getglobal("trigger_dock_in_"..i);
		local tr_out = getglobal("trigger_dock_out_"..i);
		local tr_wait = getglobal("trigger_dock_wait_"..i);
		tr_in:Activate();
		tr_out:Activate(FALSE);
		tr_wait:Activate(FALSE);
	end;
  end;
end;

function CreateDocking(func,xyz_station,ship,distance,param,param2)

	local tr_in = NewTrigger("inside",__TRUE_Condition,__Dock_Action,ship,xyz_station,distance);
	local tr_out = NewTrigger("outside",__TRUE_Condition,__UnDock_Action,ship,xyz_station,distance+10,FALSE);
	local tr_wait = NewTrigger("timer",__TRUE_Condition,__Wait_Action,5,"","",FALSE);
	tr_in:AssotiateTrigger(tr_wait);
	tr_out:AssotiateTrigger(tr_in);
	tr_wait:AssotiateTrigger(tr_out);

	local table = {func,xyz_station,param,distance,param2};
	local count = getn(__system_Dock_array);
	count = count + 1;
--LOG("Create Dock "..count..", func = "..func);
	setglobal("trigger_dock_in_"..count, tr_in);
	setglobal("trigger_dock_out_"..count, tr_out);
	setglobal("trigger_dock_wait_"..count, tr_wait);
	__system_Dock_array[count] = table;

end;

-------------------------------------------------------------
function __TRUE_Condition()
	return TRUE;
end;

-------------------------------------------------------------
function __Dock_Action()
	local triggerContext = GetTriggerContext();
	local assotiatedTriggerId = triggerContext:GetAssotiatedData();
	if (assotiatedTriggerId)
	then
		local anotherTrigger = GetTriggerContext(assotiatedTriggerId);
		anotherTrigger:Activate();
	end;
end;

-------------------------------------------------------------
function __UnDock_Action()
	local triggerContext = GetTriggerContext();
	local assotiatedTriggerId = triggerContext:GetAssotiatedData();
	if (assotiatedTriggerId)
	then
		local anotherTrigger = GetTriggerContext(assotiatedTriggerId);
		anotherTrigger:Activate();
	end;
end;

-------------------------------------------------------------
function __Wait_Action()
	local triggerContext = GetTriggerContext();
	local assotiatedTriggerId = triggerContext:GetAssotiatedData();

        -- обновление старых савок
        if (GetQuestLabel("__ShopCorrect")~="true") then
                CorrectOldShop();
        end;
        -- основная процедура
	if(MovieIsPlaying()==0.0) and (__system_Dock_flag == 0) then
		if (assotiatedTriggerId) then
			local anotherTrigger = GetTriggerContext(assotiatedTriggerId);
			anotherTrigger:Activate();
		local xpos = mothership:GetPosition();
		local N = 0;
		local val={};
		for i, val in __system_Dock_array do
			local trig=getglobal("trigger_dock_wait_"..i);
			if (triggerContext.id == trig.id) then N=i; end;
		end;
		__system_Dock_current=N;
		if (N>0) then
		local func = __system_Dock_array[N][1];
		local param = __system_Dock_array[N][3];
		local st = __system_Dock_array[N][5];

		if (func ~= "") and (st ~= NIL) and (st:IsAlive()) then 
			m_func = getglobal(func);
			m_func(param);
		end;
		end;
	end;

	else	
	triggerContext:Activate();
	end;
end;

-------------TradeStation ------------------------------------------------

function CreateTradeStationDocking(_TradeStation,ship,param1)
if (_TradeStation) then
	local xyz_st = _TradeStation:GetDockingPosition();
	local param = param1 or "";
	local param2 = _TradeStation;
	CreateDocking("__TradeStation_Action",xyz_st,ship,5,param,param2);
end;
end;

function __TradeStation_Action(param)
	if (param == "") then
		_param = GetCurrentLocation();
	else
		_param = param;
	end;
	ShowMsgBox("#UI_TradeStationWndCaption", "#UI_TradeStationDockRequest", __TradeStationDock_Ok, __TradeStationDock_Cancel);
end;

function __TradeStationDock_Ok()
	local MothershipPilot = mothership:GetPilot();
	local MothershipFlight = MothershipPilot:GetFlight();
	MothershipFlight:Stop();
	UpdateTradeSystem(FALSE);
	TradeStationDlg(_param);
end;

function __TradeStationDock_Cancel()
end;

-------------PatrolStation ------------------------------------------------

function CreatePatrolStationDocking(__PatrolStation,ship,radius,param1)
local rd = radius or 110;
	if (__PatrolStation) then
		local xyz_st = __PatrolStation:GetPosition();
		local param = param1 or "";
		local param2 = __PatrolStation;
		
		CreateDocking("__PSDock_Action",xyz_st,ship,rd,param,param2);
	end;
end;

function __PSDock_Action(param)
	if (param == "") then
		_param = GetCurrentLocation();
	else
		_param = param;
	end;
	ShowMsgBox("#UI_PatrolStationWndCaption", "#UI_PatrolStationDockRequest", __PatrolStationDock_Ok, __PatrolStationDock_Cancel);
end;

function __PatrolStationDock_Ok()
	InitExpForSaved(_param);
	
	local curloc=GetLocationTeam(_param);
--	LOG(curloc);
	if (curloc=="Neutral") then
		PatrolStationDlg("DialogSystem");
	elseif (curloc=="Triada") then
		PatrolStationDlg("TriadaDispetcher");
	elseif (curloc=="Inoco") then
		PatrolStationDlg("InocoDispetcher");
	elseif (curloc=="Uss") then
		PatrolStationDlg("USSDispetcher");
	elseif (curloc=="Kfni") then
		PatrolStationDlg("DispetcherKFNI");
	elseif (curloc=="Vks") then
		PatrolStationDlg();
	else 
		PatrolStationDlg();
	end;
	
	ExpForSaved();
end;

function __PatrolStationDock_Cancel()
end;

-------------------------------------------------------------
-- Станция Технического Обслуживания
-------------------------------------------------------------
-- 1 - прошивки 1 поколения
-- 2 - прошивки 1-2 поколения
-- 3 - неполные прошивки 2-3 поколения
-- 4 - прошивки 2-3 поколения
-- CreateRepairStationDocking(R_Station,mothership,110,2);

function CreateRepairStationDocking(_R_Station,ship,radius,tip)
local rd = radius or 110;
local tip1 = tip or 0;
if (_R_Station) then
	local xyz_st = _R_Station:GetPosition();
	local param = tostring(tip1);
	local param2 = _R_Station;
--------------------------------------------------------------------------------
  local rad = tostring(radius);
  SetQuestLabel("m_st_type", param);
  SetQuestLabel("m_st_radius", rad);
--------------------------------------------------------------------------------
	CreateDocking("RStation_Action",xyz_st,ship,rd,param,param2);
end;
end;

function RStation_Action(param)
	SetNormalTimeMode();
	if (param == "1") then
		ShowMsgBox("#UI_StationR_confirm", "#UI_StationR_dock", OnStationStart1, OnStationCancel);
	elseif (param == "2") then
		ShowMsgBox("#UI_StationR_confirm", "#UI_StationR_dock", OnStationStart2, OnStationCancel);
	elseif (param == "3") then
		ShowMsgBox("#UI_StationR_confirm", "#UI_StationR_dock", OnStationStart3, OnStationCancel);
	elseif (param == "4") then
		ShowMsgBox("#UI_StationR_confirm", "#UI_StationR_dock", OnStationStart4, OnStationCancel);
	else
		ShowMsgBox("#UI_StationR_confirm", "#UI_StationC_nodock", OnStationCancel);
	end;
end;

function OnStationCancel()
end;

function OnStationStart1()
	StartTradeDialog("DialogR1");
end;

function OnStationStart2()
	StartTradeDialog("DialogR2");
end;

function OnStationStart3()
	StartTradeDialog("DialogR3");
end;

function OnStationStart4()
	StartTradeDialog("DialogR4");
end;

function _temp_attach(nameAI)
local _tab_AI = {
--------------------------------------------------------------------------------
  {"_BKT",300000},
--------------------------------------------------------------------------------
	{"_Engine1",32000},
	{"_System1",45000},
	{"_Weapon1",65000},
	{"_Engine2",69000},
	{"_System2",95000},
	{"_Weapon2",115000},
	{"_Engine3",300000},
	{"_System3",360000},
	{"_Weapon3",450000}};

  local costAI = 0;
	for i, sh in _tab_AI do
		if (sh[1] == nameAI) then costAI=sh[2]; end;
	end;
  if (costAI == 0) then return FALSE; end;
--------------------------------------------------------------------------------
  if (nameAI == "_BKT") then
    SetQuestLabel("BasePilot_BKT",1);
  else
    SetQuestLabel("BasePilot_BKT",0);
  end;
--------------------------------------------------------------------------------

  local N=GetPlayerCredits();
  if (N>=costAI) then
	AttachNewBaseAI(nameAI);
	SubPlayerCredits(costAI);
	OutputToScreenLog("#UI_TradeStationOkChip",7);
  else	OutputToScreenLog("#UI_TradeStationNotChip",7);
  end;
end;

function DialogR_fin0()
local N=GetPlayerCredits();
  if (N>=1000) then
	RepairBase();
	SubPlayerCredits(1000);
	OutputToScreenLog("#UI_TradeStationOkRepair",7);
  else	OutputToScreenLog("#UI_TradeStationNotRepair",7);
  end;
end;

function DialogR_chip1()
	_temp_attach("_Engine1");
end;

function DialogR_chip2()
	_temp_attach("_System1");
end;

function DialogR_chip3()
	_temp_attach("_Weapon1");
end;

function DialogR_chip4()
	_temp_attach("_Engine2");
end;

function DialogR_chip5()
	_temp_attach("_System2");
end;

function DialogR_chip6()
	_temp_attach("_Weapon2");
end;

function DialogR_chip7()
	_temp_attach("_Engine3");
end;

function DialogR_chip8()
	_temp_attach("_System3");
end;

function DialogR_chip9()
	_temp_attach("_Weapon3");
end;
--------------------------------------------------------------------------------
function DialogR_chip10()
	_temp_attach("_BKT");
end;
--------------------------------------------------------------------------------
function DialogSp_intuition()
  OutputToScreenLog("#UI_Special_Intuition_message",12);
end;


-------------------------------------------------------------
-- Станция по смене репутации
-------------------------------------------------------------
-- 1 - Дебрис 1 (шахтеры) - станция «Шахтерский рай» - DUTY FREE
-- 2 - ХТ-20 (Шмыга) - военная станция «Камчатка»
-- 3 - Приен (механики) - завод «КосмоДрайв»
-- 4 - Элио (Карл) - станция "Вектор-3"
-- 5 - Пандора (Эйлон) - станция «Хамиш» - DUTY FREE
-- 6 - ХВ-13 (Раста) - станция "Джа Растафари"
-- 7 - Элинор (ТРРАХ) - Штаб-квартира ТРРАХ
-- 8 - Даллед (Кузьмич) - Мастерская "У Кузьмича"
-- CreateRelationStationDocking(CStation,mothership,110,1);

function CreateRelationStationDocking(_C_Station,ship,radius,tip)
local rd = radius or 110;
local tip1 = tip or 0;
if (_C_Station) then
	local xyz_st = _C_Station:GetPosition();
	local param = tostring(tip1);
	local param2 = _C_Station;
	CreateDocking("CStation_Action",xyz_st,ship,rd,param,param2);
end;
end;

function CStation_Action(param)
local tip=tonumber(param);
 if (tip > 0) and (tip <= getn(DialogList_Rep)) then 
	SetNormalTimeMode();
	_param = param;
	ShowMsgBox("#UI_StationC_confirm", "#UI_StationC_dock", OnCStationStart, OnCStationCancel);
 else
	local StationSpeaker = CreatePilot("None");
	StationSpeaker:Message("#L_Dnone_other_msg",12);
 end;
end;

function OnCStationCancel()
end;

function OnCStationStart()
	local tip=tonumber(_param);
--SLOG("tip="..tip);
	StartTradeDialog(DialogList_Rep[tip],"OnCStationStart_Init");
end;

function OnCStationStart_Init()
--	_x={"Kfni","KFNI_AllowChange","ans00","ans000",700000,"КФНИ"},
  for k, _x in _tab_sid do
    if (GetTeamRelation(_x[1],PLAYER_TEAM) == RELATION_WAR) then
	if (GetQuestLabel(_x[2]) == "yes") then 
		HideAnswer(_x[4]);
	else
		HideAnswer(_x[3]);
	end;
    else
	HideAnswer(_x[3]);
	HideAnswer(_x[4]);
    end;
  end;
end;

function _temp_change(nameAI)
  local N=GetPlayerCredits();
  local moneyAI = 0;
  local hide1 = "";
  local hide2 = "";
  local textAI = "";
  for i, _x in _tab_sid do
	if (_x[1] == nameAI) then
	hide1 = _x[3];
	hide2 = _x[4];
	moneyAI = _x[5];
	textAI = _x[6];
	end;
  end;
  local tip=tonumber(_param);
  if (tip == 1) or (tip == 5) then moneyAI=0; end;
  if (N >= moneyAI) then
	HideAnswer(hide1);
	HideAnswer(hide2);

	--SLOG("Денег хватило, меняем репку для "..nameAI.." за "..moneyAI);
--вот эта группа в полосатых купальниках более не требуется, но пока пусть полежит - до окончательного решения - Guest
--	if (nameAI == "Merc") then
--		--SetInitTeamRelation(PLAYER_TEAM, "Recruits", RELATION_NEUTRAL);
--		--SetInitTeamRelation(PLAYER_TEAM, "Merc", RELATION_NEUTRAL);
--		SetInitTeamRelation(PLAYER_TEAM, "Guard", RELATION_NEUTRAL);
---		local ChanTeam = CreateTeam("Guard");
---		local ChanGroup = ChanTeam:CreateGroup("GuardGroup_1");
---		SetGroupRelation(ChanGroup,PLAYER_GROUP,RELATION_NEUTRAL);

	SetInitTeamRelation(PLAYER_TEAM, nameAI, RELATION_NEUTRAL);
		--дополнение: надо занейтралить ещё и группы. 
		--Финт: создаём группу, идентичную натуральной, нейтралим.
		--Group_1
		--SLOG("CreateTeam("..nameAI..")");
	local ChanTeam = CreateTeam(nameAI);
	local ChanGroup = ChanTeam:CreateGroup(nameAI.."Group_1");
	SetGroupRelation(ChanGroup,PLAYER_GROUP,RELATION_NEUTRAL);
	--патруль нейтралим по-любому
	SetInitTeamRelation(PLAYER_TEAM, "Patrol", RELATION_NEUTRAL);
	SubPlayerCredits(moneyAI);
	local str1 = CombineStr("#UI_CStationOk", textAI);
	OutputToScreenLog(str1,7);
  else	
	--SLOG("Денег не хватило, не меняем репку для "..nameAI);
	OutputToScreenLog("#UI_CStationNot",7);
  end;
end;

function DialogC_fin()
end;

function DialogC_Vks()
	_temp_change("Vks");
end;

function DialogC_Kfni()
	_temp_change("Kfni");
end;

function DialogC_Uss()
	_temp_change("Uss");
end;

function DialogC_Triada()
	_temp_change("Triada");
end;

function DialogC_Inoco()
	_temp_change("Inoco");
end;

function DialogC_Hunter()
	_temp_change("Hunter");
end;

function DialogC_Merc()
	_temp_change("Guard");
end;

function DialogC_Trade()
	_temp_change("Trade");
end;

--халява
function DialogC_Vks0()
	_temp_change("Vks");
end;

function DialogC_Kfni0()
	_temp_change("Kfni");
end;

function DialogC_Uss0()
	_temp_change("Uss");
end;

function DialogC_Triada0()
	_temp_change("Triada");
end;

function DialogC_Inoco0()
	_temp_change("Inoco");
end;

function DialogC_Hunter0()
	_temp_change("Hunter");
end;

function DialogC_Merc0()
	_temp_change("Guard");
end;

function DialogC_Trade0()
	_temp_change("Trade");
end;

-------------------------------------------------------------
-- Станция контрабандистов
-------------------------------------------------------------
-- CreatePirateStationDocking(PirateStation,mothership,110,"pirate2");

function CreatePirateStationDocking(__PirateStation,ship,radius,param1,boolUseRadius)
	local boolUse = boolUseRadius or FALSE;
	--Guest: переделка посадки а-ля обычная торговка
	local rd = radius or 110;
	--стандартный радиус зацепления - 5 вершков от точки дока
	if boolUse==FALSE then rd = 5; end;

	if (__PirateStation) then
		--Guest: переделка посадки а-ля обычная торговка
		local xyz_st = Vector3(0,0,0);
		--SLOG("xyz_st = "..xyz_st.x..","..xyz_st.y..","..xyz_st.z);
		if (boolUse==FALSE) then
			xyz_st = __PirateStation:GetDockingPosition();
		else
			xyz_st = __PirateStation:GetPosition();
		end;
		--SLOG("xyz_st = "..xyz_st.x..","..xyz_st.y..","..xyz_st.z);
		local param = param1 or "";
		local param2 = __PirateStation;
		CreateDocking("__PirDock_Action",xyz_st,ship,rd,param,param2);
	end;
end;

function __PirDock_Action(param)
	if (param == "") then
		local cnt = getn(ShopList_Kontraband);
		_param = ShopList_Kontraband[RAND(cnt)+1];
	else
		_param = param;
	end;
	ShowMsgBox("#UI_StationC_confirm", "#UI_StationC_dock", __PirStationDock_Ok, __PirStationDock_Cancel);
end;

function __PirStationDock_Ok()
	UpdateTradeSystem(FALSE);
	SetTraderFlag(TRUE);
	TradeStationDlg(_param);
end;

function __PirStationDock_Cancel()
end;

-------------------------------------------------------------
-- Предупреждающий буй
-------------------------------------------------------------
function CreateBeacon(_portal,ship,param1)
	if (_portal) then
		local xyz_st = _portal:GetPosition();
		local param = param1 or "";
		local param2 = _portal;
		CreateDocking("__Beacon_Action",xyz_st,ship,60,param,param2);
	end;
end;

function __Beacon_Action(param)
	local _tab_dlg_pilots = {
		{"Neutral","DialogSystem"},
		{"Vks","DispetcherVKS"},
		{"Kfni","DispetcherKFNI"},
		{"Uss","USSDispetcher"},
		{"Triada","TriadaDispetcher"},
		{"Inoco","InocoDispetcher"},
		{"Rebel","DispetcherRebel"},
		{"None","None"},
		{"Uft","DispetcherUFT"},
		{"Pirate","PirateTough"}};

	--дефолты
	local _tmp_pilot = "DialogSystem";

	if (param == "") then
		_param = GetCurrentLocation();
	else
		_param = param;
	end;
	--ищем в таблице соответствие ключу
	local val={};
	for i, val in _tab_dlg_pilots do
		if (val[1] == _param) then 
			_tmp_pilot = val[2]; 
		end;
	end;

	--тормозим время
	SetNormalTimeMode();

	BeaconSpeaker = CreatePilot(_tmp_pilot);
	BeaconSpeaker:Message("#L_Dnone_beacon_msg", 10);
end;

-------------UnusedStation ------------------------------------------------
--Типы диалогов:
--"0" или без параметра --станция на реконструкции, прилетайте позже
--"1" --на станции нет свободных мест (всякие жилые\гостиницы\центры беженцев)
--"2" --торговый комплекс в связи с блокадой закрыт
--"3" --закрыто в связи с военным положением (для районов повышенного бодания)
--"3adm" --бюрократы на обеде, заявки не принимают
--"4" --частная территория (для станций корпораций - отдельные подвиды, достаточно добавить окончание uss, tri, ino)
--"5" --??? (в эфире тишина и невнятные шорохи, всех зохавал Ктулху)
--"5other" --Cтанция закрыта для посещения посторонними лицами
--"pirate" --Чо те надо? Иди отсюда!
--"свой вариант" -- конкретный диалог
--Пример использования: 
-- CreateNoneStationDocking(TRADE,mothership,120,"DialogNone_pirate");

function CreateNoneStationDocking(_NoneStation,ship,radius,tip)
  local rd = radius or 110;
  local param = tip or "0";
  if (_NoneStation) then
    local xyz_st = _NoneStation:GetPosition();
    local param2 = _NoneStation;
    CreateDocking("_NoneStation_Action",xyz_st,ship,rd,param,param2);
  end;
end;

function _NoneStation_Action(param)
	local _tab_dlg = {
		{"0","DialogNone_univ"},
		{"1","DialogNone_live"},
		{"2","DialogNone_closed"},
		{"3","DialogNone_war_closed"},
		{"3_vks","DialogNone_war_closed_VKS"},
		{"3adm","DialogNone_adm_closed"},
		{"4","DialogNone_private"},
		{"4uss","DialogNone_private_uss"},
		{"4tri","DialogNone_private_tri"},
		{"4ino","DialogNone_private_ino"},
		{"4rebel","DialogNone_private_rebel"},
		{"5","DialogNone_other"},
		{"5other","DialogNone_other_closed"},
		{"pirate","DialogNone_pirate"}};

	local _tab_dlg_pilots = {
		{"0","#L_Dnone_univ_msg","DialogSystem"},
		{"1","#L_Dnone_live_msg","DialogSystem"},
		{"2","#L_Dnone_closed_msg","DialogSystem"},
		{"3","#L_Dnone_war_closed_msg","DialogSystem"},
		{"3_vks","#L_Dnone_war_closed_VKS_msg","DispetcherVKS"},
		{"3adm","#L_Dnone_adm_closed_msg","DialogSystem"},
		{"4","#L_Dnone_private_msg","DialogSystem"},
		{"4uss","#L_Dnone_private_uss_msg","USSDispetcher"},
		{"4tri","#L_Dnone_private_tri_msg","TriadaDispetcher"},
		{"4ino","#L_Dnone_private_ino_msg","InocoDispetcher"},
		{"4rebel","#L_Dnone_private_rebel_msg","DispetcherRebel"},
		{"5","#L_Dnone_other_msg","None"},
		{"5other","#L_Dnone_other_closed_msg","DialogSystem"},
		{"pirate","#L_Dnone_pirate_msg","PirateTough"}};

	--дефолты
	local _tmp_dlg = "";
	local _tmp_pilot = "DialogSystem";

	--ищем в таблице соответствие ключу
	local val={};
	for i, val in _tab_dlg_pilots do
		if (val[1] == param) then 
			_tmp_dlg = val[2]; 
			_tmp_pilot = val[3]; 
		end;
	end;

	--SLOG("_NoneStation_Action() param = "..param);
	--SLOG("_NoneStation_Action() _tmp_dlg = ".._tmp_dlg);
	--SLOG("_NoneStation_Action() _tmp_pilot = ".._tmp_pilot);

	--создать морду для будущего вопля
	StationSpeaker = CreatePilot(_tmp_pilot);

	--тормозим время (а оно надо?)
	SetNormalTimeMode();
	
	--если нашли по ключу - воплим. Если не нашли - воплим, что написано в ключе
--------------------------------------------------------------------------------	
	if (param == "GW") then
		ShowMsgBox("#UI_StationGW_confirm", "#UI_StationGW_dock", OnStationStartGW, OnStationCancel);
--------------------------------------------------------------------------------		
	elseif (_tmp_dlg ~= "") then
		StationSpeaker:Message(_tmp_dlg,15);
	else
		StationSpeaker:Message(param,15);
	end;

	
  --было: активный диалог
  --if (_tmp_dlg ~= "") then
  --	StartTradeDialog(_tmp_dlg);
  --else
  --	StartTradeDialog(param);
  --end;

end;

-------------END ------------------------------------------------

__initialise_Dock();