AnimationManager Class
Utility class for setting animation markers and querying animation length.
Method Index
- _unfoldAnims(anim, fn, ...)
- getAnimLength(anim)
- setAnimLength(anim, length)
- setMarkerRaw(anim, fn, arg1, arg2, ...)
- setPatientMarker(anim, ...)
- setStaffMarker(anim, ...)
Member Index
- anim_length_cache
- anims
function AnimationManager:AnimationManager(anims)
Parameters:
| Name | Type | Description |
|---|---|---|
| anims | ? | ? |
Declared on: line 905 of Lua/graphics.lua.
function AnimationManager:_unfoldAnims(anim, fn, ...)
Unfold tables containing animation numbers.
Parameters:
| Name | Type | Description |
|---|---|---|
| anim | ? | ? |
| fn | ? | ? |
| ... | ? | ? |
Declared on: line 1004 of Lua/graphics.lua.
function AnimationManager:getAnimLength(anim)
Parameters:
| Name | Type | Description |
|---|---|---|
| anim | ? | ? |
Declared on: line 915 of Lua/graphics.lua.
function AnimationManager:setAnimLength(anim, length)
For overriding animations which have builtin repeats or excess frames
Parameters:
| Name | Type | Description |
|---|---|---|
| anim | ? | ? |
| length | ? | ? |
Declared on: line 910 of Lua/graphics.lua.
function AnimationManager:setMarkerRaw(anim, fn, arg1, arg2, ...)
Parameters:
| Name | Type | Description |
|---|---|---|
| anim | ? | ? |
| fn | ? | ? |
| arg1 | ? | ? |
| arg2 | ? | ? |
| ... | ? | ? |
Declared on: line 1017 of Lua/graphics.lua.
function AnimationManager:setPatientMarker(anim, ...)
A marker position can be used to indicate the position of en entity in the
frame of an animation relative to the position of drawing the animation.
The marker position is used to display a humanoid in the circular area of its
window. It is also used to position mood icons or smoke of a machine above
the entity.
There are two marker positions associated with each frame of an animation.
The primary marker is reserved for patients and machines. The secondary
marker is used for staff and other officials such as VIPs and inspectors.
Markers are set as part of the animation definitions of entities with code like
-- Sets the primary markers of all frames of an animation:
local anim_mgr = TheApp.animation_manager
anim_mgr:setPatientMarker(...)
-- Sets the secondary markers of all frames of an animation:
local anim_mgr = TheApp.animation_manager
anim_mgr:setStaffMarker(...)
Markers can be set using a variety of different arguments:
* set{Patient/Staff}Marker(anim_number, position)
* set{Patient/Staff}Marker(anim_number, {position1, position2, ..., positionN})
* set{Patient/Staff}Marker(anim_number, start_position, end_position)
* set{Patient/Staff}Marker(anim_number, keyframe_1, keyframe_1_position, keyframe_2, ...)
The 'position' should be a table; An {x, y} pair for a tile position or
{x, y, "px"} for a pixel position. In both cases the position should be the
humanoid centre at floor level, with the centre of the (0, 0) tile being the
origin in both cases.
The first variant of set{Patient,Staff}Marker sets the same marker for each frame.
The second variant of has a unique position for each frame. 'nil' can be used to
repeat the previous position.
The third variant does linear interpolation of the two positions between the first
frame and the last frame.
The fourth variant does linear interpolation between keyframes, and then the final
position for frames after the last keyframe. The keyframe arguments should be
0-based integers, as in the animation viewer.
To set the markers for multiple animations at once, the anim_number argument
can be a table, in which case the marker is set for all values in the table.
Alternatively, the values function (defined in utility.lua) can be used in
conjection with a for loop to set markers for multiple things.
The AnimView program can be used to easily obtain position information in frames.
--
Define the centre of a patient at floor level in an animation.
Parameters:
| Name | Type | Description |
|---|---|---|
| anim | ? | ? |
| ... | ? | ? |
Declared on: line 930 of Lua/graphics.lua.
function AnimationManager:setStaffMarker(anim, ...)
Define the centre of a staff member at floor level in an animation.
Parameters:
| Name | Type | Description |
|---|---|---|
| anim | ? | ? |
| ... | ? | ? |
Declared on: line 984 of Lua/graphics.lua.