ACE3/addons/explosives/functions/fnc_onIncapacitated.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

57 lines
1.9 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Garth 'L-H' de Wet
* Detonates all attached deadman's switched triggered explosives.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* Handled by CBA
*
* Public: No
*/
//NOTE: Extended_Killed_EventHandlers runs only where _unit is local
params ["_unit"];
TRACE_1("params",_unit);
if (_unit == ace_player) then {
// close cellphone if open
findDisplay 8855 closeDisplay 0;
};
// Exit if no item
if !("ACE_DeadManSwitch" in (_unit call EFUNC(common,uniqueItems))) exitWith {};
private _range = getNumber (configFile >> "CfgWeapons" >> "ACE_DeadManSwitch" >> QGVAR(range));
private _deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives);
TRACE_2("placed",_deadman,_range);
{
[_unit, _range, _x, "ACE_DeadManSwitch"] call FUNC(detonateExplosive);
} forEach _deadman;
//Handle deadman connected to explosive in inventory
private _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""];
if (_connectedInventoryExplosive != "") then {
if (!(_connectedInventoryExplosive in (magazines _unit))) exitWith {};
//Remove mag and reset variable
_unit removeMagazine _connectedInventoryExplosive;
_unit setVariable [QGVAR(deadmanInvExplosive), "", true];
private _ammo = getText (configFile >> "CfgMagazines" >> _connectedInventoryExplosive >> "ammo");
TRACE_2("deadman inventory",_connectedInventoryExplosive,_ammo);
private _magazineTrigger = configFile >> "CfgMagazines" >> _connectedInventoryExplosive >> "ACE_Triggers" >> "DeadmanSwitch";
if (isText (_magazineTrigger >> "ammo")) then {
_ammo = getText (_magazineTrigger >> "ammo");
};
private _explosive = createVehicle [_ammo, (getPos _unit), [], 0, "NONE"];
_explosive setPosASL (getPosASL _unit);
[_unit, -1, [_explosive, 0.5], "ACE_DeadManSwitch"] call FUNC(detonateExplosive); //Explode, ignoring range, with a 0.5 second delay
};