FlightLogic ​
Inherits: Resource
How an entity moves while a Flight effect holds it in the air. This base class is the floating flight: the entity moves the way it swims, in 3D, straight where the keys, the camera or its path say, and hangs where it is when it gives no input. Make your own by extending this class and overriding shape_velocity (a momentum flight, a glide, a wobble): the logic gets the velocity the entity asked for in every physics frame, just before it is moved, and changes entity.velocity. Choose it in the Flight logic field of the Flight effect. A script that extends FlightLogic in the folder data_classes/effects/status_and_control/flight_logic/ is found by the Flight effect editor and its exported variables appear there.
Description ​
Every entity that flies gets its own copy of the logic, so it may keep a state in its variables.
Variables ​
Entity | entity | |
MovementClaim | claim |
Methods ​
Dictionary | get_field_descriptions() |
String | get_flight_type_name() |
String | get_flight_type_description() |
void | begin( p_entity: Entity, p_claim: MovementClaim ) |
void | shape_velocity( _delta: float ) |
void | end() |
Variable descriptions ​
Entity entity ​
The entity this copy of the logic flies (set by begin)
MovementClaim claim ​
The claim on the movement of the entity (speed, vertical speed ...), so the logic can read what the effect asked for
Method descriptions ​
Dictionary get_field_descriptions() ​
The sentences the editor shows as tooltips: {name of an exported variable: text}. A logic of your own adds its variables (call super and merge)
String get_flight_type_name() ​
What this logic is called in the editor list
String get_flight_type_description() ​
A sentence about how this logic moves the entity, for the editor
void begin( p_entity: Entity, p_claim: MovementClaim ) ​
The entity took off. Override to set up a state
void shape_velocity( _delta: float ) ​
Every physics frame while the entity flies, just before it is moved: entity.velocity holds the velocity it asked for (the keys, the camera, its path, hovering). Change it here to give the flight a feel of its own (keep part of the last velocity for momentum, add a glide). Does nothing here: the entity floats as it asked.
void end() ​
The flight ended (the effect ran out, was dispelled, or the entity was told to land). Override to clean up