mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Manny things
Added dummy objects Added carrying Added dropping Added storing Added more progress bars ...
This commit is contained in:
parent
dd1917464d
commit
9162789579
@ -96,7 +96,7 @@ class CfgAmmo {
|
||||
|
||||
class GrenadeBase;
|
||||
class G_40mm_HE : GrenadeBase {
|
||||
GVAR(caliber) = 40;
|
||||
GVAR(caliber) = 39;
|
||||
};
|
||||
|
||||
class ShellBase;
|
||||
@ -154,7 +154,7 @@ class CfgAmmo {
|
||||
};
|
||||
|
||||
class CMflareAmmo : BulletBase {
|
||||
GVAR(caliber) = 40;
|
||||
GVAR(caliber) = 39;
|
||||
};
|
||||
|
||||
class SubmunitionBase;
|
||||
|
@ -4,6 +4,15 @@ class Extended_PreInit_EventHandlers {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class Extended_Init_EventHandlers {
|
||||
class GVAR(defaultCarriedObject) { // TODO check if we need to add all subclasses
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DEFUNC(cargo,initObject));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
|
@ -12,16 +12,33 @@
|
||||
}; \
|
||||
};
|
||||
|
||||
#define MACRO_REARM_PICKUPAMMO \
|
||||
#define MACRO_REARM_TRUCK_ACTIONS \
|
||||
class ACE_Actions : ACE_Actions { \
|
||||
class ACE_MainActions : ACE_MainActions { \
|
||||
class GVAR(PickUpAmmo) { \
|
||||
displayName = CSTRING(PickUpAmmo); \
|
||||
class GVAR(Rearm) { \
|
||||
displayName = CSTRING(Rearm); \
|
||||
distance = REARM_ACTION_DISTANCE; \
|
||||
condition = QUOTE(_this call FUNC(canPickUpAmmo)); \
|
||||
insertChildren = QUOTE(_target call FUNC(addRearmActions)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
condition = "true"; \
|
||||
statement = ""; \
|
||||
showDisabled = 0; \
|
||||
priority = 2; \
|
||||
icon = PATHTOF(ui\icon_rearm_interact.paa); \
|
||||
class GVAR(TakeAmmo) { \
|
||||
displayName = CSTRING(TakeAmmo); \
|
||||
distance = REARM_ACTION_DISTANCE; \
|
||||
condition = QUOTE(_this call FUNC(canTakeAmmo)); \
|
||||
insertChildren = QUOTE(_target call FUNC(addRearmActions)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_rearm_interact.paa); \
|
||||
}; \
|
||||
class GVAR(StoreAmmo) { \
|
||||
displayName = CSTRING(StoreAmmo); \
|
||||
distance = REARM_ACTION_DISTANCE; \
|
||||
condition = QUOTE(_this call FUNC(canStoreAmmo)); \
|
||||
statement = QUOTE(_this call FUNC(storeAmmo)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_rearm_interact.paa); \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
};
|
||||
@ -100,18 +117,18 @@ class CfgVehicles {
|
||||
class Truck_03_base_F : Truck_F {};
|
||||
class O_Truck_03_ammo_F : Truck_03_base_F {
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
MACRO_REARM_TRUCK_ACTIONS
|
||||
};
|
||||
|
||||
class Truck_02_base_F : Truck_F {};
|
||||
class Truck_02_Ammo_base_F : Truck_02_base_F {};
|
||||
class I_Truck_02_ammo_F : Truck_02_Ammo_base_F {
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
MACRO_REARM_TRUCK_ACTIONS
|
||||
};
|
||||
class O_Truck_02_Ammo_F : Truck_02_Ammo_base_F {
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
MACRO_REARM_TRUCK_ACTIONS
|
||||
};
|
||||
|
||||
class Truck_01_base_F : Truck_F {};
|
||||
@ -119,7 +136,7 @@ class CfgVehicles {
|
||||
class B_Truck_01_mover_F : B_Truck_01_transport_F {};
|
||||
class B_Truck_01_ammo_F : B_Truck_01_mover_F {
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
MACRO_REARM_TRUCK_ACTIONS
|
||||
};
|
||||
|
||||
class Helicopter_Base_F : Helicopter {};
|
||||
@ -127,14 +144,14 @@ class CfgVehicles {
|
||||
class Heli_Transport_04_base_F : Helicopter_Base_H {};
|
||||
class O_Heli_Transport_04_ammo_F : Heli_Transport_04_base_F {
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
MACRO_REARM_TRUCK_ACTIONS
|
||||
};
|
||||
|
||||
class Land_Pod_Heli_Transport_04_base_F : StaticWeapon {};
|
||||
class Land_Pod_Heli_Transport_04_base_F : StaticWeapon {};
|
||||
class Land_Pod_Heli_Transport_04_ammo_F : Land_Pod_Heli_Transport_04_base_F {
|
||||
XEH_ENABLED;
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
MACRO_REARM_TRUCK_ACTIONS
|
||||
};
|
||||
|
||||
class ReammoBox_F;
|
||||
@ -152,7 +169,7 @@ class CfgVehicles {
|
||||
class B_Slingload_01_Ammo_F : Slingload_01_Base_F {
|
||||
XEH_ENABLED;
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
MACRO_REARM_TRUCK_ACTIONS
|
||||
};
|
||||
|
||||
|
||||
@ -163,8 +180,27 @@ class CfgVehicles {
|
||||
displayName = QGVAR(dummy_obj);
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
// TODO add pickup code
|
||||
model = "\A3\Weapons_F\AmmoBoxes\AmmoBox_F.p3d";
|
||||
EGVAR(cargo,size) = 1;
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
displayName = CSTRING(Rearm);
|
||||
distance = REARM_ACTION_DISTANCE;
|
||||
condition = "true";
|
||||
statement = "";
|
||||
showDisabled = 0;
|
||||
priority = 2;
|
||||
icon = PATHTOF(ui\icon_rearm_interact.paa);
|
||||
class GVAR(PickUpAmmo) {
|
||||
displayName = CSTRING(PickUpAmmo);
|
||||
distance = REARM_ACTION_DISTANCE;
|
||||
condition = QUOTE(_this call FUNC(canTakeAmmo));
|
||||
statement = QUOTE(_this call FUNC(grabAmmo));
|
||||
exceptions[] = {"isNotInside"};
|
||||
icon = PATHTOF(ui\icon_rearm_interact.paa);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class GVAR(Bo_GBU12_LGB) : GVAR(defaultCarriedObject) {
|
||||
model = "\A3\Weapons_F\Ammo\Bomb_01_F.p3d";
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["medical_onUnconscious", {_this call FUNC(handleOnUnconscious)}] call EFUNC(common,addEventHandler);
|
||||
["playerVehicleChanged", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}] call EFUNC(common,addEventHandler);
|
||||
|
@ -3,22 +3,28 @@
|
||||
ADDON = false;
|
||||
|
||||
PREP(addRearmActions);
|
||||
PREP(canPickupAmmo);
|
||||
PREP(canRearm);
|
||||
PREP(canStoreAmmo);
|
||||
PREP(canTakeAmmo);
|
||||
PREP(createDummy);
|
||||
PREP(dropAmmo);
|
||||
PREP(getConfigMagazines);
|
||||
PREP(getMaxMagazines);
|
||||
PREP(getNeedRearmMagazines);
|
||||
PREP(grabAmmo);
|
||||
PREP(handleKilled);
|
||||
PREP(handleUnconscious);
|
||||
PREP(makeDummy);
|
||||
PREP(moduleRearmSettings);
|
||||
PREP(pickUpAmmo);
|
||||
PREP(pickUpSuccess);
|
||||
PREP(rearm);
|
||||
PREP(rearmEntireVehicle);
|
||||
PREP(rearmEntireVehicleSuccess);
|
||||
PREP(rearmEntireVehicleSuccessLocal);
|
||||
PREP(rearmSuccess);
|
||||
PREP(rearmSuccessLocal);
|
||||
PREP(storeAmmo);
|
||||
PREP(takeAmmo);
|
||||
PREP(takeSuccess);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -18,7 +18,7 @@
|
||||
private ["_vehicleActions", "_actions", "_action", "_vehicles", "_vehicle", "_needToAdd", "_magazineHelper", "_turretPath", "_magazines", "_magazine", "_icon", "_cnt"];
|
||||
params ["_target"];
|
||||
|
||||
_vehicles = nearestObjects [_target, ["AllVehicles"], 20]; // FIXME remove players
|
||||
_vehicles = nearestObjects [_target, ["AllVehicles"], 20];
|
||||
if (count _vehicles < 2) exitWith {false}; // Rearming needs at least 2 vehicles
|
||||
|
||||
_vehicleActions = [];
|
||||
@ -44,7 +44,7 @@ _vehicleActions = [];
|
||||
_action = [_magazine,
|
||||
getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"),
|
||||
getText(configFile >> "CfgMagazines" >> _magazine >> "picture"),
|
||||
{_this call FUNC(pickUpAmmo)},
|
||||
{_this call FUNC(takeAmmo)},
|
||||
{true},
|
||||
{},
|
||||
[_magazine, _vehicle]] call EFUNC(interact_menu,createAction);
|
||||
@ -56,7 +56,7 @@ _vehicleActions = [];
|
||||
_action = [_magazine,
|
||||
getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"),
|
||||
getText(configFile >> "CfgMagazines" >> _magazine >> "picture"),
|
||||
{_this call FUNC(pickUpAmmo)},
|
||||
{_this call FUNC(takeAmmo)},
|
||||
{true},
|
||||
{},
|
||||
[_magazine, _vehicle]] call EFUNC(interact_menu,createAction);
|
||||
|
25
addons/rearm/functions/fnc_canStoreAmmo.sqf
Normal file
25
addons/rearm/functions/fnc_canStoreAmmo.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Check if a unit can store ammo in an ammo truck.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Target <OBJECT>
|
||||
* 1: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Store Ammo <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, tank] call ace_rearm_fnc_canStoreAmmo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_target", "_unit"];
|
||||
|
||||
!(isNull _unit ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
{!local _unit} ||
|
||||
{(_target distance _unit) > REARM_ACTION_DISTANCE} ||
|
||||
{isNull (_unit getVariable [QGVAR(dummy), objNull])})
|
@ -10,7 +10,7 @@
|
||||
* Can Pick Up Ammo <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, tank] call ace_rearm_fnc_canPickUpAmmo
|
||||
* [player, tank] call ace_rearm_fnc_canTakeAmmo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -18,4 +18,8 @@
|
||||
|
||||
params ["_target", "_unit"];
|
||||
|
||||
!(isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REARM_ACTION_DISTANCE})
|
||||
!(isNull _unit ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
{!local _unit} ||
|
||||
{(_target distance _unit) > REARM_ACTION_DISTANCE} ||
|
||||
{!isNull (_unit getVariable [QGVAR(dummy), objNull])})
|
33
addons/rearm/functions/fnc_createDummy.sqf
Normal file
33
addons/rearm/functions/fnc_createDummy.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Creates a carryable ammunition dummy object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Magazine Classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Created Dummy <OBJECT>
|
||||
*
|
||||
* Example:
|
||||
* ["500Rnd_127x99_mag_Tracer_Red"] call ace_rearm_fnc_createDummy
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_dummyName", "_dummy"];
|
||||
params ["_unit", "_magazineClass"];
|
||||
|
||||
_ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo");
|
||||
_dummyName = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy));
|
||||
_dummy = objNull;
|
||||
if !(_dummyName == "") then {
|
||||
_dummy = _dummyName createVehicle (position _unit);
|
||||
} else {
|
||||
_dummy = QGVAR(defaultCarriedObject) createVehicle (position _unit);
|
||||
};
|
||||
_dummy allowDamage false;
|
||||
_dummy setVariable [QGVAR(magazineClass), _magazineClass, true];
|
||||
|
||||
_dummy
|
43
addons/rearm/functions/fnc_dropAmmo.sqf
Normal file
43
addons/rearm/functions/fnc_dropAmmo.sqf
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Drops a magazine, optionally deletes it and optionally unholsters the wepaon.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Delete dummy object <BOOL> (optional)
|
||||
* 2: Unholster Weapon <BOOL> (optional)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, true, true] call ace_rearm_fnc_dropAmmo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_dummy", "_actionID"];
|
||||
params ["_unit", ["_delete", false], ["_unholster", true]];
|
||||
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if !(isNull _dummy) then {
|
||||
detach _dummy;
|
||||
if (_delete) then {
|
||||
deleteVehicle _dummy;
|
||||
} else {
|
||||
_dummy setVelocity [0,0,-0.1];
|
||||
};
|
||||
_unit setVariable [QGVAR(dummy), objNull];
|
||||
//_unit setVariable [QEGVAR(dragging,isCarrying), false, true]; // breaks things, since it hides interact menu on _target
|
||||
};
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
_unit setVariable [QGVAR(ReleaseActionID), nil];
|
||||
};
|
||||
[_unit, QGVAR(vehRearm), false] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
if (_unholster) then {
|
||||
REARM_UNHOLSTER_WEAPON
|
||||
};
|
@ -10,7 +10,7 @@
|
||||
* Magazine classes in TurretPath <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [vehicle, [0]] call ace_rearm_fnc_getMaxMagazines
|
||||
* [vehicle, [0]] call ace_rearm_fnc_getConfigMagazines
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_count", "_cfg"];
|
||||
params ["_target", "_turretPath", "_magazine"];
|
||||
params ["_target", "_turretPath", "_magazineClass"];
|
||||
|
||||
if (isNull _target) exitWith {0};
|
||||
|
||||
_count = {_x == _magazine} count ([_target, _turretPath] call FUNC(getConfigMagazines));
|
||||
_count = {_x == _magazineClass} count ([_target, _turretPath] call FUNC(getConfigMagazines));
|
||||
_count
|
||||
|
55
addons/rearm/functions/fnc_grabAmmo.sqf
Normal file
55
addons/rearm/functions/fnc_grabAmmo.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Grabs an dummy ammo.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Ammo Dummy <OBJECT>
|
||||
* 1: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, dummy] call ace_rearm_fnc_grabAmmo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_dummy", "_unit"];
|
||||
|
||||
REARM_HOLSTER_WEAPON
|
||||
[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
[
|
||||
5,
|
||||
[_dummy, _unit],
|
||||
{
|
||||
private ["_actionID"];
|
||||
params ["_args"];
|
||||
_args params ["_dummy", "_unit"];
|
||||
[_dummy, _unit] call FUNC(pickUpAmmo);
|
||||
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
_unit setVariable [QGVAR(ReleaseActionID), nil];
|
||||
};
|
||||
_actionID = _unit addAction [
|
||||
format ["<t color='#FF0000'>%1</t>",
|
||||
localize ELSTRING(dragging,Drop)],
|
||||
'(_this select 0) call FUNC(dropAmmo)',
|
||||
nil,
|
||||
20,
|
||||
false,
|
||||
true,
|
||||
"",
|
||||
'!isNull (_target getVariable [QGVAR(dummy), objNull])'
|
||||
];
|
||||
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
|
||||
},
|
||||
"",
|
||||
localize LSTRING(GrabAction),
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
@ -20,4 +20,4 @@ params ["_unit"];
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRearm), nil];
|
||||
_unit setVariable [QGVAR(carriedMagazine), nil];
|
||||
[_unit, false, false] call FUNC(dropAmmo);
|
||||
|
@ -20,12 +20,4 @@ params ["_unit", "_isUnconscious"];
|
||||
|
||||
if (!local _unit || {!_isUnconscious}) exitWith {};
|
||||
|
||||
private "_dummy";
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
|
||||
if (!isNull _dummy) then {
|
||||
_dummy setVariable [QGVAR(carriedMagazine), _unit getVariable QGVAR(carriedMagazine)];
|
||||
detach _dummy;
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(dummy), nil];
|
||||
[_unit, false, false] call FUNC(dropAmmo);
|
||||
|
@ -19,4 +19,5 @@
|
||||
params ["_obj", "_dirAndUp"];
|
||||
|
||||
_obj setVectorDirAndUp _dirAndUp;
|
||||
_obj allowDamage false;
|
||||
player disableCollisionWith _obj;
|
||||
|
@ -1,62 +1,30 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Starts progress bar for picking up a specific kind of magazine from an ammo truck.
|
||||
* Starts progress bar for picking up a specific kind of magazine from the ground.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Ammo Truck <OBJECT>
|
||||
* 0: Ammo Dummy <OBJECT>
|
||||
* 1: Unit <OBJECT>
|
||||
* 2: Params <ARRAY>
|
||||
* 0: Magazine <STRING>
|
||||
* 1: Vehicle to be armed <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [ammo_truck, player, ["500Rnd_127x99_mag_Tracer_Red", tank]] call ace_rearm_fnc_pickUpAmmo
|
||||
* [target, player] call ace_rearm_fnc_pickUpAmmo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_tmpCal", "_cal", "_idx"];
|
||||
private ["_magazineClass"];
|
||||
params ["_target", "_unit"];
|
||||
|
||||
params ["_target", "_unit", "_args"]; // _target is for future possible finite ammo
|
||||
_args params ["_magazine", "_vehicle"];
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if !(isNull _dummy) exitWith {};
|
||||
|
||||
_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
_tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_caliber");
|
||||
_cal = 8;
|
||||
if (_tmpCal > 0) then {
|
||||
_cal = _tmpCal;
|
||||
} else {
|
||||
_tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(caliber));
|
||||
if (_tmpCal > 0) then {
|
||||
_cal = _tmpCal;
|
||||
} else {
|
||||
diag_log format ["[ACE] ERROR: Undefined Ammo [%1 : %2]", _ammo, inheritsFrom (configFile >> "CfgAmmo" >> _ammo)];
|
||||
if (_ammo isKindOf "BulletBase") then {
|
||||
_cal = 8;
|
||||
} else {
|
||||
_cal = 100;
|
||||
};
|
||||
};
|
||||
};
|
||||
_cal = round _cal;
|
||||
_idx = REARM_CALIBERS find _cal;
|
||||
if (_idx == -1 ) then {
|
||||
_idx = 2;
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRearm), currentWeapon _unit];
|
||||
_unit action ["SwitchWeapon", _unit, _unit, 99];
|
||||
|
||||
[
|
||||
(REARM_DURATION_PICKUP select _idx),
|
||||
[_unit, _magazine],
|
||||
FUNC(pickUpSuccess),
|
||||
"",
|
||||
format [localize LSTRING(PickUpAction), getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")],
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
||||
_target attachTo [_unit, [0,0.7,0], "pelvis"];
|
||||
{
|
||||
[[_target, [[-1,0,0],[0,0,1]]], QFUNC(makeDummy), _x] call EFUNC(common,execRemoteFnc);
|
||||
} count (position _unit nearObjects ["CAManBase", 100]);
|
||||
_unit setVariable [QGVAR(dummy), _target];
|
||||
//_unit setVariable [QEGVAR(dragging,isCarrying), true, true]; // breaks things, since it hides interact menu on _target
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Picks up a magazine.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Params <ARRAY>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Magazine <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[player, "500Rnd_127x99_mag_Tracer_Red"]] call ace_rearm_fnc_pickUpSuccess
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_dummyName", "_dummy", "_actionID"];
|
||||
params ["_args"];
|
||||
_args params ["_unit", "_magazine"];
|
||||
|
||||
[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
if !(isNull _dummy) then {
|
||||
detach _dummy;
|
||||
deleteVehicle _dummy;
|
||||
_unit setVariable [QGVAR(dummy), objNull];
|
||||
};
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
};
|
||||
|
||||
_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
_dummyName = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy));
|
||||
_dummy = objNull;
|
||||
if !(_dummyName == "") then {
|
||||
_dummy = _dummyName createVehicle (position _unit);
|
||||
} else {
|
||||
_dummy = QGVAR(defaultCarriedObject) createVehicle (position _unit);
|
||||
};
|
||||
_dummy allowDamage false;
|
||||
_dummy attachTo [_unit, [0,0.5,0], "pelvis"];
|
||||
{
|
||||
[[_dummy, [[-1,0,0],[0,0,1]]], QUOTE(DFUNC(makeDummy)), _x] call EFUNC(common,execRemoteFnc);
|
||||
} count (position _unit nearObjects ["CAManBase", 100]);
|
||||
_dummy setVariable [QGVAR(magazineClass), _magazine, true];
|
||||
_unit setVariable [QGVAR(dummy), _dummy];
|
||||
|
||||
_actionID = _unit addAction [
|
||||
format ["<t color='#FF0000'>%1</t>", localize ELSTRING(dragging,Drop)],
|
||||
'detach ((_this select 0) getVariable QGVAR(dummy)); (_this select 0) setVariable [QGVAR(dummy), objNull]; [(_this select 0), QGVAR(vehRearm), false] call EFUNC(common,setForceWalkStatus);', // TODO Move to func + unholster
|
||||
nil,
|
||||
20,
|
||||
false,
|
||||
true,
|
||||
"",
|
||||
'!isNull (_target getVariable [QGVAR(dummy), objNull])'
|
||||
];
|
||||
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
|
@ -34,7 +34,7 @@ if (_turretPath isEqualTo [-1]) then {
|
||||
TRACE_7("Rearmed Turret",_vehicle,_turretPath,_currentMagazines,_maxMagazines,_currentRounds,_maxRounds,_magazine);
|
||||
|
||||
if (_turretPath isEqualTo [-1] && _currentMagazines == 0) then {
|
||||
// On driver, the an empty magazine is still there, but is not returned by magazinesTurret
|
||||
// On driver, the empty magazine is still there, but is not returned by magazinesTurret
|
||||
_currentMagazines = _currentMagazines + 1;
|
||||
};
|
||||
if (_currentMagazines < _maxMagazines) then {
|
||||
|
@ -28,25 +28,17 @@ _args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazineClas
|
||||
//hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5", _target, _turretPath, _numMagazines, _magazineClass, _numRounds];
|
||||
|
||||
if (local _unit) then {
|
||||
[_unit, QGVAR(vehRearm), false] call EFUNC(common,setForceWalkStatus);
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if !(isNull _dummy) then {
|
||||
detach _dummy;
|
||||
deleteVehicle _dummy;
|
||||
};
|
||||
_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm);
|
||||
_unit selectWeapon _weaponSelect;
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRearm), nil];
|
||||
[_unit, true, true] call FUNC(dropAmmo);
|
||||
};
|
||||
|
||||
if (isServer) then {
|
||||
_turretOwnerID = _target turretOwner _turretPath;
|
||||
if (_turretOwnerID == 0) then {
|
||||
[_this, QUOTE(DFUNC(rearmSuccessLocal)), _target] call EFUNC(common,execRemoteFnc);
|
||||
[_this, QFUNC(rearmSuccessLocal), _target] call EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
EGVAR(common,remoteFnc) = [_this, QFUNC(rearmSuccessLocal), 0];
|
||||
_turretOwnerID publicVariableClient QEGVAR(common,remoteFnc);
|
||||
};
|
||||
} else {
|
||||
[_this, QUOTE(DFUNC(rearmSuccess)), 1] call EFUNC(common,execRemoteFnc);
|
||||
[_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ private ["_rounds", "_currentRounds", "_maxMagazines", "_dummy", "_weaponSelect"
|
||||
params ["_args"];
|
||||
_args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"];
|
||||
|
||||
//hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5", _target, _turretPath, _numMagazines, _magazineClass, _numRounds];
|
||||
//hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5\nUnit: %6", _target, _turretPath, _numMagazines, _magazineClass, _numRounds, _unit];
|
||||
|
||||
_rounds = getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count");
|
||||
_currentRounds = 0;
|
||||
|
34
addons/rearm/functions/fnc_storeAmmo.sqf
Normal file
34
addons/rearm/functions/fnc_storeAmmo.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Stores ammo in an ammo truck.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Target <OBJECT>
|
||||
* 1: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, dummy] call ace_rearm_fnc_storeAmmo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_dummy";
|
||||
params ["_target", "_unit"];
|
||||
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if (isNull _dummy) exitwith {};
|
||||
|
||||
|
||||
[
|
||||
5,
|
||||
_unit,
|
||||
{params ["_unit"]; [_unit, true, true] call FUNC(dropAmmo)},
|
||||
"",
|
||||
format [localize LSTRING(StoreAmmoAction), getText(configFile >> "CfgMagazines" >> (_dummy getVariable QGVAR(magazineClass)) >> "displayName"), getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")],
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
61
addons/rearm/functions/fnc_takeAmmo.sqf
Normal file
61
addons/rearm/functions/fnc_takeAmmo.sqf
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Starts progress bar for picking up a specific kind of magazine from an ammo truck.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Ammo Truck <OBJECT>
|
||||
* 1: Unit <OBJECT>
|
||||
* 2: Params <ARRAY>
|
||||
* 0: Magazine Classname <STRING>
|
||||
* 1: Vehicle to be armed <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [ammo_truck, player, ["500Rnd_127x99_mag_Tracer_Red", tank]] call ace_rearm_fnc_takeAmmo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_tmpCal", "_cal", "_idx"];
|
||||
|
||||
params ["_target", "_unit", "_args"];
|
||||
_args params ["_magazineClass", "_vehicle"];
|
||||
|
||||
_ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo");
|
||||
_tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_caliber");
|
||||
_cal = 8;
|
||||
if (_tmpCal > 0) then {
|
||||
_cal = _tmpCal;
|
||||
} else {
|
||||
_tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(caliber));
|
||||
if (_tmpCal > 0) then {
|
||||
_cal = _tmpCal;
|
||||
} else {
|
||||
diag_log format ["[ACE] ERROR: Undefined Ammo [%1 : %2]", _ammo, inheritsFrom (configFile >> "CfgAmmo" >> _ammo)];
|
||||
if (_ammo isKindOf "BulletBase") then {
|
||||
_cal = 8;
|
||||
} else {
|
||||
_cal = 100;
|
||||
};
|
||||
};
|
||||
};
|
||||
_cal = round _cal;
|
||||
_idx = REARM_CALIBERS find _cal;
|
||||
if (_idx == -1 ) then {
|
||||
_idx = 2;
|
||||
};
|
||||
|
||||
REARM_HOLSTER_WEAPON
|
||||
|
||||
[
|
||||
(REARM_DURATION_TAKE select _idx),
|
||||
[_unit, _magazineClass, _target],
|
||||
FUNC(takeSuccess),
|
||||
"",
|
||||
format [localize LSTRING(TakeAction), getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")],
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
40
addons/rearm/functions/fnc_takeSuccess.sqf
Normal file
40
addons/rearm/functions/fnc_takeSuccess.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Takes a magazine from an ammo truck.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Params <ARRAY>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Magazine Classname <STRING>
|
||||
* 2: Ammo Truck <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[player, "500Rnd_127x99_mag_Tracer_Red"]] call ace_rearm_fnc_takeSuccess
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_dummyName", "_dummy", "_actionID"];
|
||||
params ["_args"];
|
||||
_args params ["_unit", "_magazineClass", "_target"]; // _target is for future possible finite ammo
|
||||
|
||||
[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus);
|
||||
_dummy = [_unit, _magazineClass] call FUNC(createDummy);
|
||||
[_dummy, _unit] call FUNC(pickUpAmmo);
|
||||
|
||||
_actionID = _unit addAction [
|
||||
format ["<t color='#FF0000'>%1</t>",
|
||||
localize ELSTRING(dragging,Drop)],
|
||||
'(_this select 0) call FUNC(dropAmmo)',
|
||||
nil,
|
||||
20,
|
||||
false,
|
||||
true,
|
||||
"",
|
||||
'!isNull (_target getVariable [QGVAR(dummy), objNull])'
|
||||
];
|
||||
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
|
@ -15,7 +15,17 @@
|
||||
#define REARM_ACTION_DISTANCE 7
|
||||
#define REARM_TURRET_PATHS [[-1], [0], [0,0], [0,1], [1], [2], [0,2]]
|
||||
|
||||
#define REARM_CALIBERS [ 6, 7, 8, 13, 19, 20, 25, 30, 35, 40, 60, 70, 80, 82, 100, 105, 120, 122, 125, 155, 230, 250]
|
||||
#define REARM_DURATION_PICKUP [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 13, 10]
|
||||
#define REARM_DURATION_REARM [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 7, 7, 7, 8, 10, 10, 10, 10, 27, 20]
|
||||
#define REARM_COUNT [500, 500, 400, 100, 50, 50, 40, 25, 34, 10, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
#define REARM_CALIBERS [ 6, 7, 8, 13, 19, 20, 25, 30, 35, 39, 40, 60, 70, 80, 82, 100, 105, 120, 122, 125, 155, 230, 250]
|
||||
#define REARM_DURATION_TAKE [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 13, 10]
|
||||
#define REARM_DURATION_REARM [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 7, 7, 7, 8, 10, 10, 10, 10, 27, 20]
|
||||
#define REARM_COUNT [500, 500, 400, 100, 50, 50, 40, 25, 34, 24, 10, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
|
||||
|
||||
#define REARM_HOLSTER_WEAPON \
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRearm), currentWeapon _unit]; \
|
||||
_unit action ["SwitchWeapon", _unit, _unit, 99];
|
||||
|
||||
#define REARM_UNHOLSTER_WEAPON \
|
||||
_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm); \
|
||||
_unit selectWeapon _weaponSelect; \
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
|
||||
|
@ -40,13 +40,29 @@
|
||||
<English>Rearming %1 ...</English>
|
||||
<German>Munitioniere %1 auf ...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Rearm_PickUpAction">
|
||||
<Key ID="STR_ACE_Rearm_TakeAction">
|
||||
<English>Taking %1 for %2 ...</English>
|
||||
<German>Nehme %1 für %2 ...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Rearm_TakeAmmo">
|
||||
<English>Take ammo</English>
|
||||
<German>Munition nehmen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Rearm_PickUpAmmo">
|
||||
<English>Pick up ammo</English>
|
||||
<German>Munition nehmen</German>
|
||||
<German>Munition aufnehmen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Rearm_StoreAmmo">
|
||||
<English>Store ammo</English>
|
||||
<German>Munition verstauen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Rearm_StoreAmmoAction">
|
||||
<English>Storing %1 in %2 ...</English>
|
||||
<German>Verstaue %1 in %2 ...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Rearm_GrabAction">
|
||||
<English>Picking up ammo ...</English>
|
||||
<German>Nehme Munition ...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Rearm_Hint_RearmedTriple">
|
||||
<English>Rearmed %1 rounds of %2 on %3</English>
|
||||
|
Loading…
Reference in New Issue
Block a user