Event listener for Pre-Interaction type events.
Pre-Interaction type events can occur between any two Interactors (whether they be Shapes, Bodys, Compounds or a mix thereof).
Construct a new PreListener.
The options arguments are typed Dynamic, and are permitted to be either an
OptionType or one of:
CbType, CbTypeList, Array<CbType>, flash.Vector<CbType>
In which case the input CbType's will be used to construct an OptionType
whose included types will be the set of CbTypes supplied.
The interaction type to listen for.
The OptionType to match first Interactor against, passing null will equate to an empty OptionType.
The OptionType to match second Interactor against, passing null will equate to an empty OptionType.
The callback handler for this listener.
The precedence of this listener used to sort the order of callbacks in the case of more than one suitable BodyListener existing for the same event on the same Body. (default 0)
If true, then the listener will be marked as having a pure handler. (default false)
The newly constructed InteractionListener
If handler is null.
If either option is not of the expected Type.
The specific type of interaction that is to be listened for.
If we specify that we only want to listen for a fluid type interaction, then this listener will operate so that any other interactions for the same pair of objects is ignored.
Mark this listener as having a pure callback handler.
A pure callback handler is one which under no circumstances will change its behaviour. In such a (favourable) instance, marking the callback as pure will allow Nape to permit objects in interaction to go to sleep even if the handler returns an IGNORE_ONCE/ACCEPT_ONCE PreFlag.
zpp_inner_zn:ZPP_InteractionListener = null
Callback handler for this listener.
This callback handler returns a possibly null PreFlag object.
Passing null is equivalent to telling nape 'ignore me' so that whatever existing decision has been made regarding the interaction is not modified. Otherwise returning a non-null PreFlag will change the current decision about what to do with the interaction.
Returning ACCEPT/IGNORE inform nape to take control over all subsequent interaction between the two objects until they seperate. Returning these will mean that the pre listener will not be invoked again until the objects seperate, and then begin to interact afresh.
Returning #_ONCE, the objects will only be effected for a single step, and the following step should they still be candidates for interaction, this handler will be invoked again.
In the case of a #_ONCE, PreFlag; Nape will 'not' permit the two objects to go to sleep as Nape cannot know if this callback handler will suddenly changes its mind.
If this handler is a 'pure' function, then you may mark it as such and Nape will keep you to your word and permit the objects to sleep.