allow setting the rotation of an created object in editor user actions

directional-lights
Maikel de Vries 2016-10-16 19:56:41 +02:00
parent 2163e27661
commit 0d6a8497fc
3 changed files with 11 additions and 4 deletions

View File

@ -112,7 +112,7 @@ func Definition(def)
TargetPlayers = new Evaluator.PlayerList { EditorHelp="$SoundTargetPlayersHelp$" },
SourceObject = new Evaluator.Object { Name="$SoundSourceObject$", EditorHelp="$SoundSourceObjectHelp$", EmptyName="$Global$" }
} } );
AddEvaluator("Action", "$Object$", "$CreateObject$", "$CreateObjectHelp$", "create_object", [def, def.EvalAct_CreateObject], { SpeedX={Function="int_constant", Value=0},SpeedY={Function="int_constant", Value=0} }, { Type="proplist", Display="{{ID}}", EditorProps = {
AddEvaluator("Action", "$Object$", "$CreateObject$", "$CreateObjectHelp$", "create_object", [def, def.EvalAct_CreateObject], { SpeedX={Function="int_constant", Value=0},SpeedY={Function="int_constant", Value=0},Rotation={Function="int_constant", Value=0} }, { Type="proplist", Display="{{ID}}", EditorProps = {
ID = new Evaluator.Definition { EditorHelp="$CreateObjectDefinitionHelp$", Priority=100 },
Position = new Evaluator.Position { EditorHelp="$CreateObjectPositionHelp$" },
CreateAbove = { Name="$CreateObjectCreationOffset$", EditorHelp="$CreateObjectCreationOffsetHelp$", Type="enum", Options=[
@ -122,7 +122,8 @@ func Definition(def)
Owner = new Evaluator.Player { Name="$Owner$", EditorHelp="$CreateObjectOwnerHelp$" },
Container = new Evaluator.Object { Name="$Container$", EditorHelp="$CreateObjectContainerHelp$" },
SpeedX = new Evaluator.Integer { Name="$SpeedX$", EditorHelp="$CreateObjectSpeedXHelp$" },
SpeedY = new Evaluator.Integer { Name="$SpeedY$", EditorHelp="$CreateObjectSpeedYHelp$" }
SpeedY = new Evaluator.Integer { Name="$SpeedY$", EditorHelp="$CreateObjectSpeedYHelp$" },
Rotation = new Evaluator.Integer { Name="$Rotation$", EditorHelp="$CreateObjectRotationHelp$" }
} } );
AddEvaluator("Action", "$Object$", "$CastObjects$", "$CastObjectsHelp$", "cast_objects", [def, def.EvalAct_CastObjects], { Amount={Function="int_constant", Value=8},Speed={Function="int_constant", Value=20},AngleDeviation={Function="int_constant", Value=360} }, { Type="proplist", Display="{{Amount}}x{{ID}}", EditorProps = {
ID = new Evaluator.Definition { EditorHelp="$CastObjectsDefinitionHelp$", Priority=100 },
@ -972,13 +973,15 @@ private func EvalAct_CreateObject(proplist props, proplist context)
var position = EvaluatePosition(props.Position, context);
var speed_x = EvaluateValue("Integer", props.SpeedX, context);
var speed_y = EvaluateValue("Integer", props.SpeedY, context);
var rotation = EvaluateValue("Integer", props.Rotation, context);
if (props.CreateAbove)
obj = Global->CreateObjectAbove(create_id, position[0], position[1], owner);
else
obj = Global->CreateObject(create_id, position[0], position[1], owner);
// Default speed
// Default speed and rotation
if (obj) obj->SetXDir(speed_x);
if (obj) obj->SetYDir(speed_y);
if (obj) obj->SetR(rotation);
}
// Remember object for later access
context.last_created_object = obj;

View File

@ -88,6 +88,8 @@ SpeedX=Geschwindigkeit X
CreateObjectSpeedXHelp=Horizontale Geschwindigkeit des neuen Objektes in 1/10 Pixeln pro Frame.
SpeedY=Geschwindigkeit Y
CreateObjectSpeedYHelp=Vertikale Geschwindigkeit des neuen Objektes in 1/10 Pixeln pro Frame.
Rotation=Drehung
CreateObjectRotationHelp=Drehung des Objektes in Grad.
LastCreatedObject=Zuletzt erstelltes Objekt
LastCreatedObjectHelp=Das Objekt, das in diesem Kontext zuletzt mit der 'Objekt erstellen'-Aktion erstellt wurde.
RemoveObject=Objekt entfernen

View File

@ -87,7 +87,9 @@ CreateObjectContainerHelp=If specified, the object will be created in the conten
SpeedX=Speed X
CreateObjectSpeedXHelp=Horizontal speed of the new object in 1/10th pixels per frame.
SpeedY=Speed Y
CreateObjectSpeedYHelp=Vertikal speed of the new object in 1/10th pixels per frame.
CreateObjectSpeedYHelp=Vertical speed of the new object in 1/10th pixels per frame.
Rotation=Rotation
CreateObjectRotationHelp=Rotation of the object in degrees.
LastCreatedObject=Last created object
LastCreatedObjectHelp=The object, which has been last created using a 'create object' action in this context.
RemoveObject=Remove object