Fix merge, cbaEvents, macros, cleanup

This commit is contained in:
PabstMirror 2017-05-18 11:13:31 -05:00
parent 46c041e6bc
commit b192be0b70
33 changed files with 77 additions and 115 deletions

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT> (optional)
* 1: target <OBJECT><OPTIONAL>
*
* Return Value:
* The return value <BOOL>

View File

@ -5,7 +5,7 @@
* Arguments:
* 0: loaded Object <OBJECT>
* 1: Object <OBJECT>
* 2: Unloader (player) <OBJECT> (optional)
* 2: Unloader (player) <OPTIONAL><OBJECT>
*
* Return Value:
* Can be unloaded <BOOL>

View File

@ -11,6 +11,10 @@
* Return Value:
* None
*
* Example:
* [["Test: %1", 123], 1.5] call ace_common_fnc_displayTextStructured
* ["wow", 1, ace_player, 3] call ace_common_fnc_displayTextStructured
*
* Public: Yes
*/
#include "script_component.hpp"

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
/*
* Author: ?
* Dumps an array to the RPT, showing the depth of each element.
@ -43,49 +42,3 @@ if (IS_ARRAY(_var)) then {
} else {
diag_log text format ["%1%2", _pad, _var];
};
=======
/*
* Author: ?
* Dumps an array to the RPT, showing the depth of each element.
*
* Arguments:
* 0: Array to be dumped <ARRAY>
* 1: Depth <NUMBER> (optional)
*
* Return Value:
* None
*
* Example:
* [[0, [1,2], [[3]]]] call ace_common_fnc_dumpArray
*
* Public: No
*/
#include "script_component.hpp"
params ["_var", ["_depth", 0, [0]]];
private _pad = "";
for "_i" from 0 to _depth do {
_pad = _pad + toString [9];
};
_depth = _depth + 1;
if (IS_ARRAY(_var)) then {
if (_var isEqualTo []) then {
diag_log text format ["%1[],", _pad];
} else {
diag_log text format ["%1[", _pad];
{
[_x, _depth] call FUNC(dumpArray);
false
} count _var;
diag_log text format ["%1],", _pad];
};
} else {
diag_log text format ["%1%2", _pad, _var];
};
>>>>>>> 8e004741b92ed4a0b92a15d76645485071a0a8e7

View File

@ -6,9 +6,9 @@
* Arguments:
* 0: Source Vehicle <OBJECT>
* 1: Cargo Classname <STRING>
* 2: Unloader (player) <OBJECT> (optional)
* 3: Max Distance (meters) <NUMBER> (optional)
* 4: Check Vehicle is Stable <BOOL> (optional)
* 2: Unloader (player) <OBJECT><OPTIONAL>
* 3: Max Distance (meters) <NUMBER><OPTIONAL>
* 4: Check Vehicle is Stable <BOOL><OPTIONAL>
*
* Return Value:
* Unload PositionAGL (Can Be [] if no valid pos found) <ARRAY>

View File

@ -4,8 +4,8 @@
* Bitwise AND Logic (a single false in a mask will make it false)
*
* Arguments:
* 0: Source ID <STRING> (optional)
* 1: Show Hud Bool Array (8 to set, empty to remove) <ARRAY> (optional)
* 0: Source ID <STRING><OPTIONAL>
* 1: Show Hud Bool Array (8 to set, empty to remove) <ARRAY><OPTIONAL>
* - [hud, info, radar, compass, direction, menu, group, cursors]
* - hud: Boolean - show scripted HUD (same as normal showHUD true/false)
* - info: Boolean - show vehicle + soldier info (hides weapon info from the HUD as well)

View File

@ -5,7 +5,7 @@
* Arguments:
* 0: unit to unload <OBJECT>
* 1: Vehicle <OBJECT>
* 2: Unloader (player) <OBJECT> (optional)
* 2: Unloader (player) <OBJECT><OPTIONAL>
*
* Return Value:
* Returns true if succesfully unloaded person <BOOL>

View File

@ -7,7 +7,7 @@
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
* 2: classnamess <ARRAY>
* 3: Do Not Drop Ammo <BOOL> (optional)
* 3: Do Not Drop Ammo <BOOL><OPTIONAL>
*
* Return Value:
* Nothing

View File

@ -9,7 +9,7 @@
* 3: Magazine class <STRING>
* 4: Config of trigger <STRING>
* 5: Variables required for the trigger type <ARRAY>
* 6: Explosive placeholder <OBJECT> (optional)
* 6: Explosive placeholder <OBJECT> <OPTIONAL>
*
* Return Value:
* Placed explosive <OBJECT>

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Args <ARRAY>
* -----0: Just update volume (skip ringing/recovery) <BOOL> (optional)
* -----0: Just update volume (skip ringing/recovery) <BOOL><OPTIONAL>
*
* Return Value:
* None

View File

@ -9,12 +9,12 @@
* 2: Icon <STRING>
* 3: Statement <CODE>
* 4: Condition <CODE>
* 5: Insert children code <CODE> (optional)
* 6: Action parameters <ANY> (optional)
* 7: Position (Position array, Position code or Selection Name) <ARRAY>, <CODE> or <STRING> (optional)
* 8: Distance <NUMBER> (optional)
* 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (optional)
* 10: Modifier function <CODE> (optional)
* 5: Insert children code <CODE> (Optional)
* 6: Action parameters <ANY> (Optional)
* 7: Position (Position array, Position code or Selection Name) <ARRAY>, <CODE> or <STRING> (Optional)
* 8: Distance <NUMBER> (Optional)
* 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (Optional)
* 10: Modifier function <CODE> (Optional)
*
* Return Value:
* Action <ARRAY>

View File

@ -5,7 +5,7 @@
* Arguments:
* 0: UUID (from laserOn) <STRING>
*
* Return Value:
* Return value:
* None
*
* Example:

View File

@ -3,7 +3,7 @@
* Changes the display mode of the microDAGR
*
* Arguments:
* 0: Display Mode to show the microDAGR in <NUMBER> (optional)
* 0: Display Mode to show the microDAGR in <NUMBER><OPTIONAL>
*
* Return Value:
* None

View File

@ -6,7 +6,7 @@
* 0: static <OBJECT>
* 1: unit <OBJECT>
* 2: time to load <NUMBER>
* 3: magazineClassOptional <STRING> (optional)
* 3: magazineClassOptional <OPTIONAL><STRING>
*
* Return Value:
* None

View File

@ -6,7 +6,7 @@
displayName = CSTRING(Rearm); \
distance = REARM_ACTION_DISTANCE; \
condition = QUOTE(_this call FUNC(canRearm)); \
statement = QUOTE(_player call FUNC(rearm)); \
statement = QUOTE(_this call FUNC(rearm)); \
exceptions[] = {"isNotInside"}; \
icon = QPATHTOF(ui\icon_rearm_interact.paa); \
}; \

View File

@ -1,6 +1,6 @@
#include "script_component.hpp"
["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler;
["ace_unconscious", LINKFUNC(handleUnconscious)] call CBA_fnc_addEventHandler;
["vehicle", {
params ["_unit"];
[_unit] call FUNC(dropAmmo);
@ -10,9 +10,9 @@ if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}];
};
[QGVAR(makeDummyEH), FUNC(makeDummy)] call CBA_fnc_addEventHandler;
[QGVAR(rearmEntireVehicleSuccessLocalEH), FUNC(rearmEntireVehicleSuccessLocal)] call CBA_fnc_addEventHandler;
[QGVAR(rearmSuccessLocalEH), FUNC(rearmSuccessLocal)] call CBA_fnc_addEventHandler;
[QGVAR(makeDummyEH), LINKFUNC(makeDummy)] call CBA_fnc_addEventHandler;
[QGVAR(rearmEntireVehicleSuccessLocalEH), LINKFUNC(rearmEntireVehicleSuccessLocal)] call CBA_fnc_addEventHandler;
[QGVAR(rearmSuccessLocalEH), LINKFUNC(rearmSuccessLocal)] call CBA_fnc_addEventHandler;
#ifdef DEBUG_MODE_FULL

View File

@ -27,10 +27,11 @@ if (isNull _truck ||
{_magazineClass isEqualTo ""} ||
{GVAR(supply) == 0}) exitWith {};
([_magazineClass] call FUNC(getCaliber)) params ["_cal", "_idx"];
// With limited supply, we add the caliber to the supply count
if (GVAR(supply) == 1) then {
private _supply = [_truck] call FUNC(getSupplyCount);
([_magazineClass] call FUNC(getCaliber)) params ["_cal", "_idx"];
if (!_partial || {GVAR(level) == 1}) then {
[_truck, _supply + _cal] call FUNC(setSupplyCount);
} else {

View File

@ -35,7 +35,7 @@ private _vehicleActions = [];
private _magazines = [_vehicle, _turretPath] call FUNC(getVehicleMagazines);
{
private _magazine = _x;
_currentMagazines = { _x == _magazine } count (_vehicle magazinesTurret _turretPath);
private _currentMagazines = { _x == _magazine } count (_vehicle magazinesTurret _turretPath);
if ((_currentMagazines < ([_vehicle, _turretPath, _magazine] call FUNC(getMaxMagazines))) && !(_magazine in _magazineHelper)) then {
_action = [_magazine,
getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"),

View File

@ -27,7 +27,7 @@ if (isNull _truck ||
private _string = [_vehicle, typeOf _vehicle] select (_vehicle isEqualType objNull);
if (_string == "") exitWith {
ACE_ERRORFORMAT("_string is empty in ace_rearm_fnc_addVehicleMagazinesToSupply");
ERROR_1("_string [%1] is empty in ace_rearm_fnc_addVehicleMagazinesToSupply",_string);
};
{
private _turretPath = _x;

View File

@ -22,7 +22,7 @@ params [
];
!(isNull _unit ||
{!alive _target} ||
{!alive _truck} ||
{!(_unit isKindOf "CAManBase")} ||
{!local _unit} ||
{(_truck distance _unit) > REARM_ACTION_DISTANCE} ||

View File

@ -22,7 +22,7 @@ params [
];
!(isNull _unit ||
{!alive _target} ||
{!alive _truck} ||
{!(_unit isKindOf "CAManBase")} ||
{!local _unit} ||
{(_truck distance _unit) > REARM_ACTION_DISTANCE} ||

View File

@ -21,7 +21,7 @@ params [
["_unit", objNull, [objNull]]
];
REARM_HOLSTER_WEAPON
REARM_HOLSTER_WEAPON;
[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set);
[

View File

@ -28,5 +28,4 @@ if (!_activated) exitWith {};
[_logic, QGVAR(level), "level"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(supply), "supply"] call EFUNC(common,readSettingFromModule);
diag_log text format ["[ACE]: Rearm Module Initialized on level: %1", GVAR(level)];
diag_log text format ["[ACE]: Rearm Module Initialized on supply: %1", GVAR(supply)];
INFO_2("Module Initialized [level: %1][supply: %2]", GVAR(level), GVAR(supply));

View File

@ -25,7 +25,9 @@ private _attachedDummy = _unit getVariable [QGVAR(dummy), objNull];
if !(isNull _attachedDummy) exitWith {};
_dummy attachTo [_unit, [0,1,0], "pelvis"];
{
[QGVAR(makeDummyEH), _x, [_dummy, [[-1,0,0],[0,0,1]]]] call CBA_fnc_targetEvent;
} count (position _unit nearObjects ["CAManBase", 100]);
private _nearUnits = _unit nearObjects ["CAManBase", 100];
// disableCollisionWith damage with the nearby units:
[QGVAR(makeDummyEH), [_dummy, [[-1,0,0],[0,0,1]]], _nearUnits] call CBA_fnc_targetEvent;
_unit setVariable [QGVAR(dummy), _dummy];

View File

@ -31,9 +31,9 @@ if (GVAR(supply) == 1) then {
params ["_args"];
_args params [["_unit", objNull, [objNull]], ["_truck", objNull, [objNull]], ["_supplyCount", 0, [0]]];
if (_supplyCount > 0 ) then {
["displayTextStructured", _unit, [[LSTRING(Hint_RemainingSupplyPoints), _supplyCount], 2, _unit]] call EFUNC(common,objectEvent);
[[LSTRING(Hint_RemainingSupplyPoints), _supplyCount], 2, _unit] call EFUNC(common,displayTextStructured);
} else {
["displayTextStructured", _unit, [LSTRING(Hint_EmptySupplyPoints), 2, _unit]] call EFUNC(common,objectEvent);
[LSTRING(Hint_EmptySupplyPoints), 2, _unit] call EFUNC(common,displayTextStructured);
};
true
},
@ -64,9 +64,9 @@ if (GVAR(supply) == 1) then {
} count _magazines;
};
if (_supply > 1.5) then {
["displayTextStructured", _unit, [[LSTRING(Hint_RemainingAmmo), _text], _supply, _unit, (_numChars/2.9)]] call EFUNC(common,objectEvent);
[[LSTRING(Hint_RemainingAmmo), _text], _supply, _unit, (_numChars/2.9)] call EFUNC(common,displayTextStructured);
} else {
["displayTextStructured", _unit, [LSTRING(Hint_Empty), 2, _unit]] call EFUNC(common,objectEvent);
[LSTRING(Hint_Empty), 2, _unit] call EFUNC(common,displayTextStructured);
};
true
},

View File

@ -3,19 +3,21 @@
* Starts progress bar for rearming a vehicle.
*
* Arguments:
* 0: Unit <OBJECT>
* 0: Target Vehicle <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ace_rearm_fnc_rearm
* [tank, player] call ace_rearm_fnc_rearm
*
* Public: No
*/
#include "script_component.hpp"
params [
["_target", objNull, [objNull]],
["_unit", objNull, [objNull]]
];

View File

@ -25,14 +25,14 @@ _args params [
if (isServer) then {
{
_turretOwnerID = _vehicle turretOwner _x;
private _turretOwnerID = _vehicle turretOwner _x;
if (_turretOwnerID == 0) then {
[QGVAR(rearmEntireVehicleSuccessLocalEH), _truck, [_truck, _vehicle, _x]] call EFUNC(common,objectEvent);
[QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _truck] call CBA_fnc_targetEvent;
} else {
[QGVAR(rearmEntireVehicleSuccessLocalEH), _turretOwnerID, [_truck, _vehicle, _x]] call EFUNC(common,targetEvent);
[QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _turretOwnerID] call CBA_fnc_ownerEvent;
};
false
} count REARM_TURRET_PATHS;
} else {
[QGVAR(rearmEntireVehicleSuccessLocalEH), _this] call EFUNC(common,serverEvent);
[QGVAR(rearmEntireVehicleSuccessLocalEH), _this] call CBA_fnc_serverEvent;
};

View File

@ -25,8 +25,7 @@ params [
["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]
];
_args params ["_vehicle", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"];
//hint format ["Vehicle: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5", _vehicle, _turretPath, _numMagazines, _magazineClass, _numRounds];
TRACE_6("rearmSuccess",_vehicle,_unit,_turretPath,_numMagazines,_magazineClass,_numRounds);
if (local _unit) then {
[_unit, true, true] call FUNC(dropAmmo);
@ -35,9 +34,9 @@ if (local _unit) then {
if (isServer) then {
private _turretOwnerID = _vehicle turretOwner _turretPath;
if (_turretOwnerID == 0) then {
[QGVAR(rearmSuccessLocalEH), _vehicle, _this] call EFUNC(common,objectEvent);
[QGVAR(rearmSuccessLocalEH), _this, [_vehicle]] call CBA_fnc_targetEvent;
} else {
[QGVAR(rearmSuccessLocalEH), _turretOwnerID, _this] call EFUNC(common,targetEvent);
[QGVAR(rearmSuccessLocalEH), _this, _turretOwnerID] call CBA_fnc_ownerEvent;
};
} else {
[QGVAR(rearmSuccessLocalEH), _this] call EFUNC(common,serverEvent);

View File

@ -15,7 +15,7 @@
* None
*
* Example:
* [[vehicle, player, [-1], 2, "5000Rnd_762x51_Belt", 500]] call ace_rearm_fnc_rearmSuccess
* [[vehicle, player, [-1], 2, "5000Rnd_762x51_Belt", 500]] call ace_rearm_fnc_rearmSuccessLocal
*
* Public: No
*/
@ -25,6 +25,7 @@ params [
["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]
];
_args params ["_vehicle", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"];
TRACE_6("rearmSuccessLocal",_vehicle,_unit,_turretPath,_numMagazines,_magazineClass,_numRounds);
private _rounds = getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count");
private _currentRounds = 0;
@ -40,15 +41,15 @@ if (_maxMagazines == 1) then {
if (GVAR(level) == 1) then {
// Fill magazine completely
_vehicle setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath];
["displayTextStructured", _unit, [[LSTRING(Hint_RearmedTriple), _rounds,
[QEGVAR(common,displayTextStructured), [[LSTRING(Hint_RearmedTriple), _rounds,
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit]] call EFUNC(common,objectEvent);
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit], [_unit]] call CBA_fnc_targetEvent;
} else {
// Fill only at most _numRounds
_vehicle setMagazineTurretAmmo [_magazineClass, ((_vehicle magazineTurretAmmo [_magazineClass, _turretPath]) + _numRounds) min _rounds, _turretPath];
["displayTextStructured", _unit, [[LSTRING(Hint_RearmedTriple), _numRounds,
[QEGVAR(common,displayTextStructured), [[LSTRING(Hint_RearmedTriple), _numRounds,
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit]] call EFUNC(common,objectEvent);
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit], [_unit]] call CBA_fnc_targetEvent;
};
} else {
for "_idx" from 1 to (_maxMagazines+1) do {
@ -69,9 +70,9 @@ if (_maxMagazines == 1) then {
} else {
_vehicle setMagazineTurretAmmo [_magazineClass, _currentRounds + _numRounds, _turretPath];
};
["displayTextStructured", _unit, [[LSTRING(Hint_RearmedTriple), _numRounds,
[QEGVAR(common,displayTextStructured), [[LSTRING(Hint_RearmedTriple), _numRounds,
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit]] call EFUNC(common,objectEvent);
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit], [_unit]] call CBA_fnc_targetEvent;
} else {
// Fill current magazine completely and fill next magazine partially
_vehicle setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath];
@ -79,9 +80,9 @@ if (_maxMagazines == 1) then {
_vehicle addMagazineTurret [_magazineClass, _turretPath];
_vehicle setMagazineTurretAmmo [_magazineClass, _currentRounds, _turretPath];
};
["displayTextStructured", _unit, [[LSTRING(Hint_RearmedTriple), _rounds,
[QEGVAR(common,displayTextStructured), [[LSTRING(Hint_RearmedTriple), _rounds,
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit]] call EFUNC(common,objectEvent);
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], 3, _unit], [_unit]] call CBA_fnc_targetEvent;
};
};
_vehicle removeMagazineTurret [_magazineClass, _turretPath];

View File

@ -28,7 +28,7 @@ _args params ["_magazineClass", "_vehicle"];
([_magazineClass] call FUNC(getCaliber)) params ["_cal", "_idx"];
REARM_HOLSTER_WEAPON
REARM_HOLSTER_WEAPON;
[
(REARM_DURATION_TAKE select _idx),

View File

@ -28,12 +28,13 @@
#define REARM_HOLSTER_WEAPON \
_unit setVariable [QGVAR(selectedWeaponOnRearm), currentWeapon _unit]; \
TRACE_2("REARM_HOLSTER_WEAPON",_unit,currentWeapon _unit); \
_unit action ["SwitchWeapon", _unit, _unit, 299];
#define REARM_UNHOLSTER_WEAPON \
_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm); \
TRACE_2("REARM_UNHOLSTER_WEAPON",_unit,_weaponSelect); \
if (!isNil "_weaponSelect") then { \
TRACE_2("REARM_UNHOLSTER_WEAPON",_unit,_weaponSelect); \
_unit selectWeapon _weaponSelect; \
_unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; \
};

View File

@ -20,7 +20,7 @@ params ["_unit", "_item"];
TRACE_2("params",_unit,_item);
if ([_unit, _item] call EFUNC(common,hasItem)) exitWith {
[QGVAR(useItem), _unit, [_unit, _item]] call EFUNC(common,objectEvent);
["ace_useItem", [_unit, _item], _unit] call CBA_fnc_targetEvent;
[true, _unit];
};

View File

@ -4,12 +4,12 @@
*
* Arguments:
* 0: Display
* 1: Toogle compass <BOOL> (optional)
* 2: Toogle help <BOOL> (optional)
* 3: Toogle interface <BOOL> (optional)
* 4: Toogle map <BOOL> (optional)
* 5: Toogle toolbar <BOOL> (optional)
* 6: Toogle unit list <BOOL> (optional)
* 1: Toogle compass <BOOL> <OPTIONAL>
* 2: Toogle help <BOOL> <OPTIONAL>
* 3: Toogle interface <BOOL> <OPTIONAL>
* 4: Toogle map <BOOL> <OPTIONAL>
* 5: Toogle toolbar <BOOL> <OPTIONAL>
* 6: Toogle unit list <BOOL> <OPTIONAL>
*
* Return Value:
* None <NIL>