mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Some things
Made params nicer, replaced some forEach and used params in XEH_respawn
This commit is contained in:
parent
29cd940fd0
commit
d0509830e3
@ -1,14 +1,12 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit"];
|
||||
|
||||
_unit = _this select 0;
|
||||
params ["_unit"];
|
||||
|
||||
if !(local _unit) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRearm), nil];
|
||||
_unit setVariable [QGVAR(carriedMagazine), nil];
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
private _dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if !(isNull _dummy) then {
|
||||
detach _dummy;
|
||||
deleteVehicle _dummy;
|
||||
|
@ -17,7 +17,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_magazineClass", "", [""]], ["_partial", false, [false]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_magazineClass", "", [""]],
|
||||
["_partial", false, [false]]
|
||||
];
|
||||
|
||||
if (isNull _truck ||
|
||||
{_magazineClass isEqualTo ""} ||
|
||||
|
@ -15,7 +15,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]]
|
||||
];
|
||||
|
||||
private _vehicles = nearestObjects [_truck, ["AllVehicles"], 20];
|
||||
if (count _vehicles < 2) exitWith {false}; // Rearming needs at least 2 vehicles
|
||||
@ -63,8 +65,10 @@ private _vehicleActions = [];
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _magazines;
|
||||
} forEach REARM_TURRET_PATHS;
|
||||
false
|
||||
} count _magazines;
|
||||
false
|
||||
} count REARM_TURRET_PATHS;
|
||||
};
|
||||
if (_needToAdd && !(_vehicle getVariable [QGVAR(disabled), false])) then {
|
||||
private _icon = getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "Icon");
|
||||
@ -91,6 +95,7 @@ private _vehicleActions = [];
|
||||
_vehicleActions pushBack [_action, _actions, _truck];
|
||||
};
|
||||
};
|
||||
} forEach _vehicles;
|
||||
false
|
||||
} count _vehicles;
|
||||
|
||||
_vehicleActions
|
||||
|
@ -20,7 +20,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_vehicle", objNull, [objNull, ""]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_vehicle", objNull, [objNull, ""]]
|
||||
];
|
||||
|
||||
if (isNull _truck ||
|
||||
{typeName _vehicle == "OBJECT" && {isNull _vehicle}}) exitWith {};
|
||||
@ -32,11 +35,13 @@ if (typeName _vehicle == "OBJECT") then {
|
||||
if (typeName _vehicle == "STRING") then {
|
||||
_string = _vehicle;
|
||||
};
|
||||
if (_string == "") exitWith {[]};
|
||||
if (_string == "") exitWith {};
|
||||
{
|
||||
private _turretPath = _x;
|
||||
private _magazines = [_string, _turretPath] call FUNC(getConfigMagazines);
|
||||
{
|
||||
[_truck, _x] call FUNC(addMagazineToSupply);
|
||||
} forEach _magazines;
|
||||
} forEach REARM_TURRET_PATHS;
|
||||
false
|
||||
} count _magazines;
|
||||
false
|
||||
} count REARM_TURRET_PATHS;
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
!(isNull _unit ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_vehicle", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_vehicle distance _unit > REARM_ACTION_DISTANCE} || {_vehicle getVariable [QGVAR(disabled), false]}) exitWith {false};
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_vehicle", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
!(isNull _unit ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
!(isNull _unit ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
!(isNull _unit ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_magazineClass", "", [""]]];
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_magazineClass", "", [""]]
|
||||
];
|
||||
|
||||
private _ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo");
|
||||
private _dummyName = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy));
|
||||
|
@ -17,5 +17,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_vehicle", objNull, [objNull]], ["_disable", true, [true]]];
|
||||
params [
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_disable", true, [true]]
|
||||
];
|
||||
|
||||
_vehicle setVariable [QGVAR(disabled), _disable, true];
|
||||
|
@ -17,7 +17,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_delete", false, [false]], ["_unholster", true, [true]]];
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_delete", false, [false]],
|
||||
["_unholster", true, [true]]
|
||||
];
|
||||
|
||||
private _dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if !(isNull _dummy) then {
|
||||
|
@ -17,7 +17,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_magazineClass", "", [""]]];
|
||||
params [
|
||||
["_magazineClass", "", [""]]
|
||||
];
|
||||
|
||||
if (_magazineClass isEqualTo "") exitWith {[8, 2]};
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_cfgString", "", [""]], ["_turretPath", [], [[]]]];
|
||||
params [
|
||||
["_cfgString", "", [""]],
|
||||
["_turretPath", [], [[]]]
|
||||
];
|
||||
|
||||
if (_cfgString == "") exitWith {[]};
|
||||
|
||||
|
@ -17,7 +17,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_vehicle", objNull, [objNull]], ["_turretPath", [], [[]]], ["_magazineClass", "", [""]]];
|
||||
params [
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_turretPath", [], [[]]],
|
||||
["_magazineClass", "", [""]]
|
||||
];
|
||||
|
||||
if (isNull _vehicle) exitWith {0};
|
||||
|
||||
|
@ -13,13 +13,16 @@
|
||||
* 2: Number of current magazines in turret path <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [tank, "mag"] call ace_rearm_fnc_getNeedRearmMagazines
|
||||
* [tank, "500Rnd_127x99_mag_Tracer_Red"] call ace_rearm_fnc_getNeedRearmMagazines
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_vehicle", "_magazineClass"];
|
||||
params [
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_magazineClass", "", [""]]
|
||||
];
|
||||
|
||||
private _return = [false, [], 0];
|
||||
{
|
||||
@ -38,6 +41,7 @@ private _return = [false, [], 0];
|
||||
};
|
||||
|
||||
if (_return select 0) exitWith {};
|
||||
} forEach REARM_TURRET_PATHS;
|
||||
false
|
||||
} count REARM_TURRET_PATHS;
|
||||
|
||||
_return
|
||||
|
@ -15,7 +15,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]]
|
||||
];
|
||||
|
||||
private _supply = _truck getVariable QGVAR(currentSupply);
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_vehicle", objNull, [objNull]], ["_turretPath", [], [[]]]];
|
||||
params [
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_turretPath", [], [[]]]
|
||||
];
|
||||
|
||||
if (isNull _vehicle) exitWith {[]};
|
||||
|
||||
|
@ -16,10 +16,12 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_dummy", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_dummy", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
REARM_HOLSTER_WEAPON
|
||||
[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
[
|
||||
5,
|
||||
@ -29,7 +31,7 @@ REARM_HOLSTER_WEAPON
|
||||
params ["_args"];
|
||||
_args params ["_dummy", "_unit"];
|
||||
[_dummy, _unit] call FUNC(pickUpAmmo);
|
||||
|
||||
[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set);
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
|
@ -15,7 +15,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_isUnconscious", false, [false]]];
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_isUnconscious", false, [false]]
|
||||
];
|
||||
|
||||
if (!local _unit || {!_isUnconscious}) exitWith {};
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_magazineClass", "", [""]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_magazineClass", "", [""]]
|
||||
];
|
||||
|
||||
if (isNull _truck ||
|
||||
{_magazineClass isEqualTo ""}) exitWith {false};
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_magazineClass", "", [""]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_magazineClass", "", [""]]
|
||||
];
|
||||
|
||||
if (isNull _truck ||
|
||||
{_magazineClass isEqualTo ""}) exitWith {false};
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_obj", objNull, [objNull]], ["_dirAndUp", [[1,0,0],[0,0,1]], [[]]]];
|
||||
params [
|
||||
["_obj", objNull, [objNull]],
|
||||
["_dirAndUp", [[1,0,0],[0,0,1]], [[]]]
|
||||
];
|
||||
|
||||
_obj setVectorDirAndUp _dirAndUp;
|
||||
_obj allowDamage false;
|
||||
|
@ -17,7 +17,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_logic", "", ["_activated", false, [false]]];
|
||||
params [
|
||||
"_logic",
|
||||
"",
|
||||
["_activated", false, [false]]
|
||||
];
|
||||
|
||||
if (!_activated) exitWith {};
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_dummy", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_dummy", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
private _attachedDummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if !(isNull _attachedDummy) exitWith {};
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (GVAR(supply) == 0) exitWith {};
|
||||
|
||||
@ -57,7 +60,8 @@ if (GVAR(supply) == 1) then {
|
||||
_numChars = _numChars max (count _line);
|
||||
_text = format ["%1<br/>%2", _text, _line];
|
||||
_supply = _supply + 0.5;
|
||||
} forEach _magazines;
|
||||
false
|
||||
} count _magazines;
|
||||
};
|
||||
if (_supply > 1.5) then {
|
||||
["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingAmmo), _text], _supply, _unit, (_numChars/2.9)]] call EFUNC(common,targetEvent);
|
||||
|
@ -15,7 +15,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
private _attachedDummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if (isNull _attachedDummy) exitwith {false};
|
||||
|
@ -17,7 +17,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], "", ["_vehicle", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
"",
|
||||
["_vehicle", objNull, [objNull]]
|
||||
];
|
||||
|
||||
[
|
||||
10,
|
||||
|
@ -18,7 +18,10 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_args"];
|
||||
_args params [["_truck", objNull, [objNull]], ["_vehicle", objNull, [objNull]]];
|
||||
_args params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_vehicle", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (isServer) then {
|
||||
{
|
||||
@ -28,6 +31,7 @@ if (isServer) then {
|
||||
} else {
|
||||
[QGVAR(rearmEntireVehicleSuccessLocalEH), _turretOwnerID, [_truck, _vehicle, _x]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
false
|
||||
} count REARM_TURRET_PATHS;
|
||||
} else {
|
||||
[QGVAR(rearmEntireVehicleSuccessLocalEH), _this] call EFUNC(common,serverEvent);
|
||||
|
@ -17,7 +17,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_vehicle", objNull, [objNull]], ["_turretPath", [], [[]]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_turretPath", [], [[]]]
|
||||
];
|
||||
|
||||
private _magazines = [_vehicle, _turretPath] call FUNC(getVehicleMagazines);
|
||||
if (isNil "_magazines") exitWith {};
|
||||
@ -58,4 +62,5 @@ if (isNil "_magazines") exitWith {};
|
||||
_vehicle setMagazineTurretAmmo [_magazine, _maxRounds, _turretPath];
|
||||
};
|
||||
};
|
||||
} foreach _magazines;
|
||||
false
|
||||
} count _magazines;
|
||||
|
@ -21,7 +21,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]];
|
||||
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];
|
||||
|
@ -21,7 +21,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]];
|
||||
params [
|
||||
["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]
|
||||
];
|
||||
_args params ["_vehicle", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"];
|
||||
|
||||
private _rounds = getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count");
|
||||
|
@ -17,7 +17,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_magazineClass", "", [""]], ["_numRounds", -1, [0]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_magazineClass", "", [""]],
|
||||
["_numRounds", -1, [0]]
|
||||
];
|
||||
|
||||
if (isNull _truck ||
|
||||
{_magazineClass isEqualTo ""}) exitWith {false};
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_supply", 0, [0]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_supply", 0, [0]]
|
||||
];
|
||||
|
||||
if (isNull _truck) exitWith {};
|
||||
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
private _attachedDummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if (isNull _attachedDummy) exitwith {};
|
||||
|
@ -19,7 +19,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_truck", objNull, [objNull]], ["_unit", objNull, [objNull]], ["_args", ["", objNull], [[]]]];
|
||||
params [
|
||||
["_truck", objNull, [objNull]],
|
||||
["_unit", objNull, [objNull]],
|
||||
["_args", ["", objNull], [[]]]
|
||||
];
|
||||
_args params ["_magazineClass", "_vehicle"];
|
||||
|
||||
([_magazineClass] call FUNC(getCaliber)) params ["_cal", "_idx"];
|
||||
|
@ -18,7 +18,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_args", [objNull, "", objNull], [[]], 3]];
|
||||
params [
|
||||
["_args", [objNull, "", objNull], [[]], 3]
|
||||
];
|
||||
_args params ["_unit", "_magazineClass", "_truck"];
|
||||
|
||||
private _success = true;
|
||||
|
Loading…
Reference in New Issue
Block a user