Previously, this behaviour was available only for sensors
that were not connected to any active state, which was
forcing the game designer to duplicate sensors in some
cases.
For example the Always sensors used to initialize the
states needed to be duplicated for each state. With this
patch, a single Always sensor with Level option enabled
will suffice to initialize all the states.
A Python controller can determine which sensor did trigger
with the new SCA_ISensor::isTriggered() function.
Notes:
- When a sensor with level option enabled is connected
to multiple controllers, only those of newly activated
states will be triggered. The controllers of already
activated states will receive no trigger, unless the
sensor internal state toggled, in which case all the
controllers are triggered as always.
- The old isPositive() function returns the internal
state of the sensor, positive or negative; the new
isTriggered() function returns 1 only for sensors
that generated an event in the current frame.
Introduction of a new Delay sensor that can be used to
generate positive and negative triggers at precise time,
expressed in number of frames.
The delay parameter defines the length of the initial
OFF period. A positive trigger is generated at the end
of this period. The duration parameter defines the
length of the ON period following the OFF period.
A negative trigger is generated at the end of the ON period.
If duration is 0, the sensor stays ON and there is no
negative trigger.
The sensor runs the OFF-ON cycle once unless the repeat
option is set: the OFF-ON cycle repeats indefinately
(or the OFF cycle if duration is 0).
The new generic SCA_ISensor::reset() Python function
can be used at any time to restart the sensor: the
current cycle is interrupted and no trigger is generated.