Add user actions to SpinWheel up and down events

qteditor
Sven Eberhardt 2016-07-06 01:04:45 -04:00
parent d3be591d8d
commit d717e41902
3 changed files with 19 additions and 0 deletions

View File

@ -28,6 +28,8 @@ public func ControlUp(object clonk)
SetAction("SpinLeft");
Sound("Structures::StoneGate::Chain");
}
// Action last; it may delete the door/clonk/etc.
UserAction->EvaluateAction(up_action, this, clonk);
}
public func ControlDown(object clonk)
@ -45,12 +47,22 @@ public func ControlDown(object clonk)
SetAction("SpinRight");
Sound("Structures::StoneGate::Chain");
}
// Action last; it may delete the door/clonk/etc.
UserAction->EvaluateAction(down_action, this, clonk);
}
public func SaveScenarioObject(props)
{
if (!inherited(props, ...)) return false;
if (targetdoor) props->AddCall("Target", this, "SetStoneDoor", targetdoor);
if (up_action || down_action) props->AddCall("Action", this, "SetActions", up_action, down_action);
return true;
}
public func SetActions(new_up_action, new_down_action)
{
up_action = new_up_action;
down_action = new_down_action;
return true;
}
@ -97,11 +109,14 @@ local EditCursorCommands = ["ControlUp()", "ControlDown()", "ConnectNearestDoor(
local Plane = 200;
local Components = {Wood = 3, Metal = 1};
local EditorProp_targetdoor = { Name="$Target$", Type="object", Filter="IsSwitchTarget" };
local up_action, down_action; // Custom editor-selected actions on switch handling
func Definition(def)
{
SetProperty("PictureTransformation", Trans_Mul(Trans_Scale(800), Trans_Translate(0,0,0),Trans_Rotate(-20,1,0,0),Trans_Rotate(-30,0,1,0)), def);
SetProperty("MeshTransformation", Trans_Rotate(-13,0,1,0), def);
def.EditorProp_up_action = new UserAction.Prop { Name="$UpAction$" };
def.EditorProp_down_action = new UserAction.Prop { Name="$DownAction$" };
}

View File

@ -1,3 +1,5 @@
Name=Winde
Description=Öffne oder schließe die verbundene Burgtür mit [Hoch] oder [Runter].
Target=Ziel
UpAction=Aktion 'Hoch'
DownAction=Aktion 'Runter'

View File

@ -1,3 +1,5 @@
Name=Spin Wheel
Description=Open and close connected castle door with [Up] and [Down] respectively.
Target=Target
UpAction='Up' action
DownAction='Down' action