ACE3/addons/interaction/functions/fnc_canFlip.sqf
Dystopian 3feafc449f Interaction - Add Flip and Push actions to Quad Bike, Kart and Static Weapons (#6019)
* Add Flip and Push actions to Quad Bike

* Add actions to karts and static weapons

* Move magic number to macro

* Ditch here is

* Move condition to function
2018-02-26 12:23:47 -06:00

26 lines
620 B
Plaintext

/*
* Author: Dystopian
* Checks if vehicle can be flipped.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* Can Flip <BOOL>
*
* Example:
* [cursorObject] call ace_interaction_fnc_canFlip
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
// most suitable mass for all vanilla, CUP and RHS statics ATM (ZU-23 suits, D-30 and M119 don't suit)
#define FLIP_MAX_STATICWEAPON_MASS 2000
1 < (vectorUp _vehicle) vectorDistance (surfaceNormal getPosATL _vehicle)
&& {0 == {alive _x} count crew _vehicle || {isAutonomous _vehicle}}
&& {getMass _vehicle <= FLIP_MAX_STATICWEAPON_MASS}