params, cleanup

This commit is contained in:
PabstMirror 2015-08-15 14:35:33 -05:00
parent 4d8a9ae890
commit fc6cd34d33
32 changed files with 160 additions and 86 deletions

View File

@ -15,8 +15,9 @@
*/
#include "script_component.hpp"
//When getting knocked out in medical, trigger deadman explosives:
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
if (isServer) then {
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
["medical_onUnconscious", {
params ["_unit", "_isUnconscious"];
if (!_isUnconscious) exitWith {};

View File

@ -18,7 +18,8 @@
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra);
params ["_unit", "_explosive", "_magazineClass", "_extra"];
TRACE_4("params",_unit,_explosive,_magazineClass,_extra);
private["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];

View File

@ -17,8 +17,12 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_explosive", "_magazineClass"];
TRACE_3("params",_unit,_explosive,_magazineClass);
private ["_clacker", "_config", "_requiredItems", "_hasRequired", "_detonators"];
EXPLODE_3_PVT(_this,_unit,_explosive,_magazineClass);
// Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1);

View File

@ -15,10 +15,13 @@
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detonator"];
TRACE_2("params",_unit,_detonator);
private ["_result", "_item", "_children", "_range", "_required"];
EXPLODE_2_PVT(_this,_unit,_detonator);
_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");
_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");
_result = [_unit] call FUNC(getPlacedExplosives);
_children = [];
@ -44,6 +47,6 @@ _children = [];
];
};
};
} foreach _result;
} forEach _result;
_children

View File

@ -1,6 +1,6 @@
/*
* Author: Garth 'L-H' de Wet and CAA-Picard
*
* Adds sub actions for all explosive magazines (from insertChildren)
*
* Arguments:
* 0: Unit <OBJECT>
@ -11,9 +11,11 @@
* Public: No
*/
#include "script_component.hpp"
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
EXPLODE_1_PVT(_this,_unit);
params ["_unit"];
TRACE_1("params",_unit);
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
_mags = magazines _unit;
_list = [];
@ -41,7 +43,7 @@ _children = [];
[
[
format ["Explosive_%1", _forEachIndex],
format [_name + " (%1)", _itemCount select _foreachIndex],
format [_name + " (%1)", _itemCount select _forEachIndex],
getText(_x >> "picture"),
{_this call FUNC(setupExplosive);},
{true},
@ -51,6 +53,6 @@ _children = [];
[],
_unit
];
} foreach _list;
} forEach _list;
_children

View File

@ -15,13 +15,16 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_name", "_code"];
TRACE_2("params",_name,_code);
private ["_speedDial", "_found"];
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
_found = false;
EXPLODE_2_PVT(_this,_name,_code);
if ((_code) == "") ExitWith {
if ((_code) == "") exitWith {
[_name] call FUNC(removeFromSpeedDial);
};
{
@ -29,7 +32,7 @@ if ((_code) == "") ExitWith {
_speedDial set [_foreachindex, _this];
_found = true;
};
} foreach _speedDial;
} forEach _speedDial;
if (!_found) then {
_speedDial pushBack _this;
};

View File

@ -14,8 +14,12 @@
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_children", "_config", "_detonators"];
_unit = _this select 0;
params ["_unit"];
TRACE_1("params",_unit);
private ["_children", "_config", "_detonators"];
_detonators = [_unit] call FUNC(getDetonators);
_children = [];
{
@ -34,6 +38,6 @@ _children = [];
[],
ACE_Player
];
} foreach _detonators;
} forEach _detonators;
_children

View File

@ -15,8 +15,11 @@
* Public: No
*/
#include "script_component.hpp"
params ["_magazine", "_explosive"];
TRACE_2("params",_magazine,_explosive);
private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers", "_isAttached"];
EXPLODE_2_PVT(_this,_magazine,_explosive);
_isAttached = !isNull (attachedTo _explosive);
_detonators = [ACE_player] call FUNC(getDetonators);
@ -51,6 +54,6 @@ _children = [];
ACE_Player
];
};
} foreach _triggerTypes;
} forEach _triggerTypes;
_children

View File

@ -4,6 +4,7 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 0: Target <OBJECT>
*
* Return Value:
* Able to defuse <BOOL>
@ -14,8 +15,12 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
private ["_isSpecialist"];
EXPLODE_2_PVT(_this,_unit,_target);
if (isNull(_target getVariable [QGVAR(Explosive),objNull])) exitWith {
deleteVehicle _target;
false

View File

@ -14,7 +14,7 @@
* Public: Yes
*/
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
[_unit] call FUNC(hasPlacedExplosives) and {count ([_unit] call FUNC(getDetonators)) > 0}
params ["_unit"];
([_unit] call FUNC(hasPlacedExplosives)) && {(count ([_unit] call FUNC(getDetonators))) > 0}

View File

@ -15,9 +15,12 @@
* Public: Yes
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_explosive);
if (GVAR(ExplodeOnDefuse) && (random 1.0) < getNumber(ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse")) exitWith {
params ["_unit", "_explosive"];
TRACE_2("params",_unit,_explosive);
if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse"))}) exitWith {
TRACE_1("exploding on defuse",_explosive);
[_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive);
};

View File

@ -19,12 +19,16 @@
* Public: Yes
*/
#include "script_component.hpp"
private ["_result", "_ignoreRange", "_helpers", "_pos"];
EXPLODE_3_PVT(_this,_unit,_range,_item);
params ["_unit", "_range", "_item"];
TRACE_3("params",_unit,_range,_item);
private ["_result", "_ignoreRange", "_pos"];
_ignoreRange = (_range == -1);
_result = true;
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false};
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false};
if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
private ["_exp", "_previousExp"];
@ -40,11 +44,11 @@ if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhe
};
};
[{
private ["_explosive"];
_explosive = _this;
params ["_explosive"];
TRACE_1("exploding",_explosive);
if (!isNull _explosive) then {
_explosive setDamage 1;
};
}, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute);
}, [_item select 0], (_item select 1)] call EFUNC(common,waitAndExecute);
_result

View File

@ -15,8 +15,12 @@
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_code"];
TRACE_2("params",_unit,_code);
private ["_arr", "_ran", "_i"];
EXPLODE_2_PVT(_this,_unit,_code);
if (_unit getVariable [QGVAR(Dialing),false]) exitWith {};
if !(alive _unit) exitWith {};
_unit setVariable [QGVAR(Dialing), true, true];
@ -36,7 +40,7 @@ if (_unit == ace_player) then {
[{
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75];
(_this select 0) setVariable [QGVAR(Dialing), false, true];
}, [_unit,_explosive select 0], 0.25 * (count _arr - 4), 0] call EFUNC(common,waitAndExecute);
}, [_unit,_explosive select 0], 0.25 * (count _arr - 4)] call EFUNC(common,waitAndExecute);
[_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer);
};
};

View File

@ -17,7 +17,10 @@
* Public: No
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code);
params ["_args", "_pfID"];
_args params ["_unit", "_i", "_arr", "_code"];
if ((_i mod 4) == 0) then {
playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit modelToWorldVisual [0,0.2,2]), 15,1,2.5];
};
@ -27,7 +30,7 @@ private "_explosive";
_explosive = [_code] call FUNC(getSpeedDialExplosive);
if (_i >= (count _arr + 2)) then {
[_this select 1] call CALLSTACK(cba_fnc_removePerFrameHandler);
[_pfID] call CALLSTACK(cba_fnc_removePerFrameHandler);
if ((count _explosive) > 0) then {
[_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive);
};
@ -41,4 +44,4 @@ if (_i == (count _arr)) then {
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75];
};
};
(_this select 0) set [1, _i + 1];
_args set [1, _i + 1];

View File

@ -16,8 +16,11 @@
#include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_detonators);
private ["_unit", "_items", "_result", "_config"];
_unit = _this select 0;
params ["_unit"];
TRACE_1("params",_unit);
private ["_items", "_result", "_config"];
_items = (items _unit);
_result = [];

View File

@ -18,8 +18,11 @@
#include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_allExplosives,_deadmanExplosives);
private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"];
_unit = _this select 0;
params ["_unit"];
TRACE_1("params",_unit);
private ["_clackerList", "_adjustedList", "_list", "_filter"];
_filter = nil;
if (count _this > 1) then {
_filter = ConfigFile >> "ACE_Triggers" >> (_this select 1);
@ -30,14 +33,14 @@ _clackerList = _unit getVariable [QGVAR(Clackers), []];
_list = [];
{
if (isNull (_x select 0)) then {
_clackerList set [_foreachIndex, "X"];
_clackerList set [_forEachIndex, "X"];
_adjustedList = true;
} else {
if (isNil "_filter" || {(ConfigFile >> "ACE_Triggers" >> (_x select 4)) == _filter}) then {
_list pushBack _x;
};
};
} foreach _clackerList;
} forEach _clackerList;
if (_adjustedList) then {
_clackerList = _clackerList - ["X"];
if (count _clackerList == 0) then {

View File

@ -14,8 +14,12 @@
* Public: Yes
*/
#include "script_component.hpp"
EXPLODE_1_PVT(_this,_code);
params ["_code"];
TRACE_1("params",_code);
private ["_explosive"];
if (isNil QGVAR(CellphoneIEDs)) exitWith {[]};
_explosive = [];
{
@ -24,4 +28,5 @@ _explosive = [];
};
false
} count GVAR(CellphoneIEDs);
_explosive

View File

@ -9,16 +9,18 @@
* The unit has explosives <BOOL>
*
* Example:
* _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives;
* hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives;
*
* Public: Yes
*/
#include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_hasExplosives);
private ["_unit", "_result", "_magazines"];
params ["_unit"];
TRACE_1("params",_unit);
private ["_result", "_magazines"];
_result = false;
_unit = _this select 0;
_magazines = magazines _unit;
{
if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "ACE_Placeable") == 1) exitWith {

View File

@ -16,7 +16,8 @@
*/
#include "script_component.hpp"
PARAMS_1(_interactionType);
params ["_interactionType"];
TRACE_1("params",_interactionType);
//Ignore self-interaction menu
if (_interactionType != 0) exitWith {};
@ -26,8 +27,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {};
[{
PARAMS_2(_args,_pfID);
EXPLODE_3_PVT(_args,_setPosition,_addedDefuseHelpers,_minesHelped);
params ["_args", "_pfID"];
_args params ["_setPosition", "_addedDefuseHelpers", "_minesHelped"];
if (!EGVAR(interact_menu,keyDown)) then {
TRACE_1("Cleaning Defuse Helpers",(count _addedDefuseHelpers));

View File

@ -14,20 +14,13 @@
* Public: No
*/
#include "script_component.hpp"
if !(isServer) exitWith {};
private["_activated", "_logic"];
params ["_logic"];
_logic = _this select 0;
_activated = _this select 2;
if !(_activated) exitWith {};
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"]
call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"]
call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"]
call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"] call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"] call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"] call EFUNC(Common,readSettingFromModule);
diag_log text "[ACE]: Explosive Module Initialized.";

View File

@ -15,11 +15,13 @@
*/
#include "script_component.hpp"
PARAMS_1(_unit); //Extended_Killed_EventHandlers runs only where _unit is local
//NOTE: Extended_Killed_EventHandlers runs only where _unit is local
params ["_unit"];
TRACE_1("params",_unit);
private ["_deadman"];
_deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives);
{
[_unit, -1, _x, true] call FUNC(detonateExplosive);
} foreach _deadman;
} forEach _deadman;

View File

@ -17,8 +17,11 @@
* Public: No
*/
#include "script_component.hpp"
params ["_receiver", "_giver", "_item"];
TRACE_3("params",_receiver,_giver,_item);
private ["_config", "_detonators"];
PARAMS_3(_receiver,_giver,_item);
if (_receiver != ace_player) exitWith {};

View File

@ -15,7 +15,10 @@
* Public: No
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_explosive,_mag);
params ["_explosive", "_mag"];
TRACE_2("params",_explosive,_mag);
createDialog "RscACE_SelectTimeUI";
sliderSetRange [8845, 5, 900]; // 5seconds - 15minutes
sliderSetPosition [8845, 30];

View File

@ -21,9 +21,11 @@
* Public: Yes
*/
#include "script_component.hpp"
private ["_ammo", "_explosive", "_attachedTo", "_expPos", "_magazineTrigger"];
EXPLODE_6_PVT(_this,_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars);
DEFAULT_PARAM(6,_setupPlaceholderObject,objNull);
params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]];
TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject);
private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger"];
_unit playActionNow "PutDown";

View File

@ -14,13 +14,15 @@
* Public: Yes
*/
#include "script_component.hpp"
private "_speedDial";
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
{
if ((_x select 0) == (_this select 0)) exitWith {
_speedDial set [_foreachIndex, "x"];
_speedDial set [_forEachIndex, "x"];
_speedDial = _speedDial - ["x"];
ace_player setVariable [QGVAR(SpeedDial),_speedDial];
};
} foreach _speedDial;
} forEach _speedDial;

View File

@ -16,9 +16,12 @@
* Public: No
*/
#include "script_component.hpp"
params ["_explosive", "_magazine", "_trigger"];
TRACE_3("params",_explosive,_magazine,_trigger);
private ["_config"];
EXPLODE_3_PVT(_this,_explosive,_magazine,_trigger);
_config = ConfigFile >> "ACE_Triggers" >> _trigger;
// If the onSetup function returns true, it is handled elsewhere

View File

@ -17,7 +17,8 @@
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_explosive,_direction,_pitch);
params ["_explosive", "_direction", "_pitch"];
TRACE_3("params",_explosive,_direction,_pitch);
if (isNull (attachedTo _explosive)) then {
_explosive setDir _direction;

View File

@ -15,7 +15,9 @@
* Public: No
*/
#include "script_component.hpp"
private ["_speedDial", "_amount"];
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
_amount = if((_this select 0))then{1}else{-1};

View File

@ -21,7 +21,8 @@
#define PLACE_RANGE_MAX 1
#define PLACE_RANGE_MIN 0.025
PARAMS_3(_vehicle,_unit,_magClassname);
params ["_vehicle", "_unit", "_magClassname"];
TRACE_3("params",_vehicle,_unit,_magClassname);
private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"];
@ -58,8 +59,8 @@ GVAR(TweakedAngle) = 0;
[{
BEGIN_COUNTER(pfeh);
PARAMS_2(_args,_pfID);
EXPLODE_4_PVT(_args,_unit,_magClassname,_setupObjectClass,_isAttachable);
params ["_args", "_pfID"];
_args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"];
private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"];

View File

@ -15,14 +15,17 @@
* Public: Yes
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_target);
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
private["_actionToPlay", "_defuseTime", "_isEOD"];
_target = attachedTo (_target);
_fnc_DefuseTime = {
EXPLODE_2_PVT(_this,_specialist,_target);
params ["_specialist", "_target"];
TRACE_2("defuseTime",_specialist,_target);
private ["_defuseTime"];
_defuseTime = 5;
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then {
@ -48,11 +51,12 @@ if (ACE_player != _unit) then {
_unit disableAI "TARGET";
_defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime;
[{
PARAMS_2(_unit,_target);
params ["_unit", "_target"];
TRACE_2("defuse finished",_unit,_target);
[_unit, _target] call FUNC(defuseExplosive);
_unit enableAI "MOVE";
_unit enableAI "TARGET";
}, [_unit, _target], _defuseTime, 0] call EFUNC(common,waitAndExecute);
}, [_unit, _target], _defuseTime] call EFUNC(common,waitAndExecute);
};
} else {
_unit playActionNow _actionToPlay;

View File

@ -16,12 +16,13 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_explosive,_delay);
params ["_explosive", "_delay"];
TRACE_2("params",_explosive,_delay);
[{
private ["_explosive"];
_explosive = _this;
params ["_explosive"];
TRACE_1("Explosive Going Boom",_explosive);
if (!isNull _explosive) then {
[_explosive, -1, [_explosive, 0]] call FUNC(detonateExplosive);
};
}, _explosive, _delay, 0] call EFUNC(common,waitAndExecute);
}, [_explosive], _delay] call EFUNC(common,waitAndExecute);

View File

@ -15,10 +15,13 @@
*/
#include "script_component.hpp"
params ["_magazineClassname"];
TRACE_1("params",_magazineClassname);
private["_result", "_config", "_count", "_index"];
_result = [];
_config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "ACE_Triggers" >> "SupportedTriggers");
_config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers");
_count = count _config;
for "_index" from 0 to (_count - 1) do {