Update documentation

master
Aftermoth 2016-05-01 18:52:42 +12:00
parent 47a967c485
commit 0afafd2332
1 changed files with 19 additions and 16 deletions

View File

@ -5,39 +5,42 @@ If no such spaces are found, the drop is "entombed," and remains subject to lift
Lift physics holds a drop for one second before moving it upwards by one node every step, and does not seek other escape routes.
Droplift does not distinguish between differently shaped node boxes, only what their 'walkable' setting is.
This makes it easy to manually entomb drops using common node types like slabs and glass panes.
This makes it easy to manually entomb drops using simple node types like slabs and glass panes.
Entombed/free status is preserved across game reloads rather than retested.
Entombed/free status is preserved across game reloads rather than retested. For example, a drop resting on a slab will remain at rest.
All drop velocities are zeroed on reload. This is to prevent buried drops from being sunk below their current floor.
All drop velocities are zeroed on reload. This prevents buried drops from being sunk below their current floor.
-------
* API *
-------
In general, drops are expected to spawn in non-obstructing nodes, like 'air.'
Therefore droplift ignores newly spawned drops, and only checks them when they are newly buried.
Therefore droplift ignores newly spawned drops, and only checks them upon burial.
----
If you want droplift to handle drops spawned inside obstructing nodes, use:
droplift.invoke(dropObject, entomb)
entomb = <boolean> Bypass initial escape phase and use only lift physics, otherwise follow normal burial behaviour.
droplift.invoke(dropObject, sync)
sync in [ false | 0 | seconds ]:
** Drops that are already being lifted should not be called again with invoke. **
That would produce multiple unsyncronized handlers for the same object. It will speed things up, but it might also go wrong.
* false: As for burial above. If however the drop is already entombed, a failed escape will not alter the existing process.
* 0: As for false, but skipping the escape phase.
* seconds (float): This is the time since calling invoke that the next lift will schedule its subsequent lift. If the drop is not already entombed, it proceeds as for 0 above.
...However,
If you want to force an entombed drop to break free, AND you're sure it has an escape space, you can:
I.e. a lift must occur AFTER the call and BEFORE the target time so it can schedule its NEXT lift to occur at that time, otherwise the sync request is ignored. The initial standing period before the first lift cannot be modified.
dropEntity.is_entombed = false
droplift.invoke(dropObject, false)
Drops remain "entombed" while there is an outstanding sync time, regardless of whether they are actually buried, but will only receive calls while buried.
Sync info is not preserved across reloads.
----
To disable lift physics on a drop, use:
dropEntity.is_entombed = nil
If nothing weird happens, the handlers will be cleared from the newly freed drop.
But if that's what you need, it may be preferable to refine the code accordingly.