forked from Mirrors/openclonk
parent
1f34a2bbef
commit
037d167de8
|
@ -47,6 +47,7 @@ global func FxIntIntroStart(object target, proplist effect)
|
|||
effect.Pilot->SetDir(DIR_Left);
|
||||
effect.Pilot->SetObjectLayer(effect.Pilot);
|
||||
effect.Dialog = effect.Pilot->SetDialogue("Pilot");
|
||||
effect.Dialog->SetInteraction(false);
|
||||
|
||||
effect.Plane->FaceRight();
|
||||
effect.Plane->StartInstantFlight(90, 15);
|
||||
|
@ -106,10 +107,11 @@ global func FxIntIntroTimer(object target, proplist effect, int time)
|
|||
if(effect.Time == 500)
|
||||
for(var i = 0; i < GetPlayerCount(); ++i)
|
||||
GetCursor(GetPlayerByIndex(i))->CloseMenu();
|
||||
|
||||
|
||||
if(effect.Time >= 830)
|
||||
{
|
||||
effect.Pilot->SetCommand("MoveTo", effect.Pilot, 120 - effect.Pilot->GetX(), 860 - effect.Pilot->GetY());
|
||||
effect.Dialog->SetInteraction(true);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ MsgIntro1=Wow, it's very turbulent here...
|
|||
MsgIntro2=Have a look at that lava lake!
|
||||
MsgIntro3=Come on old girl, hang in there...
|
||||
MsgIntro4=Uh oh...
|
||||
MsgIntro5=Quick! The ejecter seats!
|
||||
MsgIntro5=Quick! The ejection seats!
|
||||
|
||||
# NPC Pilot
|
||||
NamePilot=Pilot
|
||||
|
|
|
@ -4,6 +4,4 @@ Version=5,2,0,1
|
|||
Category=C4D_StaticBack
|
||||
Width=8
|
||||
Height=20
|
||||
Offset=-4,-10
|
||||
|
||||
|
||||
Offset=-4,-10
|
|
@ -10,6 +10,7 @@ local dlg_name;
|
|||
local dlg_info;
|
||||
local dlg_progress;
|
||||
local dlg_status;
|
||||
local dlg_interact;
|
||||
|
||||
static const DLG_Status_Active = 0;
|
||||
static const DLG_Status_Stop = 1;
|
||||
|
@ -50,9 +51,10 @@ protected func Initialize()
|
|||
{
|
||||
// Dialogue progress to one.
|
||||
dlg_progress = 1;
|
||||
|
||||
// Dialogue allows interaction by default.
|
||||
dlg_interact = true;
|
||||
// Dialogue is active by default.
|
||||
dlg_status = DLG_Status_Active;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -85,8 +87,12 @@ private func UpdateDialogue()
|
|||
public func SetDialogueInfo()
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public func SetInteraction(bool allow)
|
||||
{
|
||||
dlg_interact = allow;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -105,7 +111,7 @@ public func SetDialogueStatus(int status)
|
|||
/*-- Interaction --*/
|
||||
|
||||
// Players can talk to NPC via the interaction bar.
|
||||
public func IsInteractable() { return true; }
|
||||
public func IsInteractable() { return dlg_interact; }
|
||||
|
||||
// Adapt appearance in the interaction bar.
|
||||
public func GetInteractionMetaInfo(object clonk)
|
||||
|
@ -119,6 +125,10 @@ public func GetInteractionMetaInfo(object clonk)
|
|||
// Called on player interaction.
|
||||
public func Interact(object clonk)
|
||||
{
|
||||
// Should not happen: not active -> stop interaction
|
||||
if (!dlg_interact)
|
||||
return true;
|
||||
|
||||
// Currently in a dialogue: abort that dialogue.
|
||||
if (InDialogue(clonk))
|
||||
clonk->CloseMenu();
|
||||
|
@ -147,9 +157,7 @@ public func Interact(object clonk)
|
|||
var progress = dlg_progress;
|
||||
dlg_progress++;
|
||||
// Then call relevant functions.
|
||||
Call(Format("Dlg_%s_%d", dlg_name, progress), clonk);
|
||||
|
||||
|
||||
Call(Format("Dlg_%s_%d", dlg_name, progress), clonk);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -176,11 +184,11 @@ private func MessageBox(string message, object clonk, object talker)
|
|||
|
||||
// Add NPC portrait.
|
||||
//var portrait = Format("%i", talker->GetID()); //, Dialogue, talker->GetColor(), "1");
|
||||
clonk->AddMenuItem("", "", Dialogue, nil, nil, nil, C4MN_Add_ImgObject, talker); //TextSpec);
|
||||
clonk->AddMenuItem("", "MenuOK", Dialogue, nil, clonk, nil, C4MN_Add_ImgObject, talker); //TextSpec);
|
||||
|
||||
// Add NPC message.
|
||||
var msg = Format("<c %x>%s:</c> %s", talker->GetColor(), talker->GetName(), message);
|
||||
clonk->AddMenuItem(msg, "", nil, nil, nil, nil, C4MN_Add_ForceNoDesc);
|
||||
clonk->AddMenuItem(msg, "MenuOK", nil, nil, clonk, nil, C4MN_Add_ForceNoDesc);
|
||||
|
||||
// Add answers.
|
||||
//for (var i = 0; i < GetLength(message.Answers); i++)
|
||||
|
@ -203,6 +211,13 @@ private func MessageBox(string message, object clonk, object talker)
|
|||
return;
|
||||
}
|
||||
|
||||
public func MenuOK(proplist menu_id, object clonk)
|
||||
{
|
||||
// prevent the menu from closing when pressing MenuOK
|
||||
if (dlg_interact)
|
||||
Interact(clonk);
|
||||
}
|
||||
|
||||
local ActMap = {
|
||||
Dialogue = {
|
||||
Prototype = Action,
|
||||
|
|
Loading…
Reference in New Issue