Introduction
The fire extinguisher system simulates the spraying of water or similar liquid to douse and extinguish a fire. This may take the form of an attachment (eg a fire hose held by an avatar) or of a prim on a vehicle or other linkset (eg a water cannon on a fire tender).
Construction
The scripted prim for the fire extinguisher should be clickable to start and stop the flow. It should contain the following in prim contents:
The <water object> is a fully transparent 0.1m sphere, containing the <fire extinguisher water> script. This is used as a projectile, to detect collisions between the "water" and the "burning" object. It should be set to physical.
Certain prims in the target object should contain the script "Extinguishable fire and smoke". This generates particle smoke and/or animated flame textures, and responds to the presence of the water object by turning off these effects.
Configuration
1. Extinguisher configuration
Configuration is by means of the Extinguisher config notecard. This has the usual layout of name/value pairs in INI-style format, with "//" comments.
The following values are supported:
2. Target object configuration
Each flame/smoke prim in the target object should have its own "Extinguishable fire and smoke" script with an associated "Fire/smoke config" notecard. This card contains the following data in the usual format:
Operation
In operation, particles are created to simulate the appearance of water streaming. Meanwhile, objects are rezzed at WaterObjectFrequency intervals at velocities between WaterObjectVelocityMin and WaterObjectVelocityMax. In the case of an attached extinguisher, the objects are rezzed at AttachPosition relative to the avatar's centre and are projected in the direction indicated by AttachDirection.
Being physical and only partly buoyant, the objects describe a parabolic arc; the velocity parameters can be used to tune the shape of the arc to (roughly) match that of the particles. Absolute accuracy in this is neither necessary nor possible.
In fact, collision is not used because of the difficulties inherent in collision detection in OpenSim at this time. Instead, the "Extinguishable fire and smoke" uses llSensorRepeat() to detect the presence of water objects and count the number of unique objects. When that number reaches the specified SensorHits value, the smoke and/or fire is turned off. Since the name of the object is known, and the range limited, the sensor is very "cheap".
Caveats
One technical shortcoming is that it is not possible for a script in an attachment to know its global rotation or position. This is why the Attach* values are needed.
The client-side Z rotation of an avatar often does not match the server-side rotation. The only way to make them match is to animate the avatar with certain built-in weapons animations which would not be appropriate for holding a fire extinguisher. For this reason, the particles (client-side) and objects (server-side) may be emitted at slightly different Z rotations. In partice, because the water particles spread left and right, this is not especially noticeable.