-
Notifications
You must be signed in to change notification settings - Fork 2
Functionality
As of 23rd September 2020 the mod has been restructured into the CBA addon structure, some function names may have been changed or replaced by CBA macros. Thanks to Steam User @Brazzer for his effort in transitioning the mod into this more reliable structure.
The scripts used to create the crash landing effects are applied to all objects which inherit from the "Helicopter" or "Plane" base classes after their initialization. Only the subclass "ParachuteBase" is excluded.
For this purpose the fnc_setup.sqf file is compiled and then used as FSCL_fnc_setup.
It adds those variables and eventhandler to the object:
-
FSCL_state, float variable used to save received damage -
FSCL_effects, boolean variable used to indicate the activation of different effects - "HandleDamage" Event Handler, which calls the FSCL_fnc_handleCrashDamage function
Upon receiving damage it is first checked wether the aircraft would be destroyed. As long as the structural damage (displayed as HULL in-game) remains below the threshold defined by FSCL_damageTreshold all damage is applied as usual. Once the damage threshold is reached all access structural damage is saved in the FSCL_state variable for the aircraft. Once FSCL_state reaches the threshold defined by FSCL_stateThreshold the aircraft receives structural damage again and is destroyed. All damage other then structural is unaffected.
Once the first damage threshold is passed additional effects are triggered, this includes visual particle effects and settings the vehicle captive.
Damage Handling is done via the fnc_handleCrashDamage.sqf file which is compiled as the functions FSCL_fnc_handleCrashDamage.
It performs following actions:
- if lethal damage would be applied to the structure
- increase
FSCL_stateinstead - set
FSCL_effectstotrue - if
FSCL_captiveSystemistruespawnFSCL_fnc_activateCaptive - if
FSCL_ejectionSystemistruespawnFSCL_fnc_impactEjection - spawn
FSCL_fnc_resetDamage - remote execute
FSCL_fnc_effects
- increase
- if damage is not lethal or directed at hit points other then structural, apply damage as usual
Visual effects include a burning engine and tail rotor (when applicable). They stop 10 seconds after the aircraft is destroyed, below 2 meters height or the FSCL_effects variable is set to false.
Effects are scripted in the fnc_effects.sqf file, compiled as the FSCL_fnc_effects function.
To prevent enemies from shooting at crashing aircraft it is possible to activate the Captive System using the FSCL_captiveSystem variable. If active the function will save the captive state of all crew members and the aircraft in their FSCL_captiveState variable, then set them to captive. Once the aircraft is destroyed, below 2 meters or someone exits the captive state is reset to the saved values.
Additonally this systems forces AI crew members to remain inside the aircraft if it is a helicopter until it is below 2 meters (or destroyed).
The Captive System is scripted in the fnc_activateCaptive.sqf file, compiled into the FSCL_fnc_activateCaptive function.
It performs following actions:
- save captive state for every crew and the aircraft in their
FSCL_captiveStatevariable - set crew and aircraft to captive
- reset captive state once conditions are met
- add "GetOutMan" event handler to performs captive reset and prevent AI from ejecting mid air
- save event handler id in the
FSCL_captiveEventHandlervariable - if aircraft is on the ground or crew is a player, allow them to eject, reset captive, delete this event handler
- else force crew into vehicle again if aircraft is a helicopter
- save event handler id in the
The reset damage functionality checkes wether the aircraft was repaired after taking damage, by saving the damage value once it is called and waiting until the damage value drops below the saved value. If this occurs the FSCL_effects variable is set to false and the captive state is resetted.
This is done by the fnc_resetDamage.sqf script, compiles as FSCL_fnc_resetDamage.
Passengers are ejected, when aircraft hits the ground, depending on the ejection propability settings and the G-force threshold. Upon ejection they are redered unconscious for 2 seconds to enable a ragdoll effect. Be aware that the G-force calculation is simplyfied and just calculates the accelaration of the aircraft, not the G-forces along an specific axis.
This is done by the fnc_impactEjection.sqf script, compiles as FSCL_fnc_impactEjection.