mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Preliminary carrying and dropping of carried ammo
Could not use ace_dragging since it block interact menu
This commit is contained in:
parent
a37608b9b1
commit
dd1917464d
@ -122,9 +122,10 @@ class CfgVehicles {
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
};
|
||||
|
||||
class Heli_Transport_04_base_F;
|
||||
class Helicopter_Base_F : Helicopter {};
|
||||
class Helicopter_Base_H : Helicopter_Base_F {};
|
||||
class Heli_Transport_04_base_F : Helicopter_Base_H {};
|
||||
class O_Heli_Transport_04_ammo_F : Heli_Transport_04_base_F {
|
||||
XEH_ENABLED;
|
||||
transportAmmo = 0;
|
||||
MACRO_REARM_PICKUPAMMO
|
||||
};
|
||||
@ -158,13 +159,12 @@ class CfgVehicles {
|
||||
// Dummy Vehicles
|
||||
class ThingX;
|
||||
class GVAR(defaultCarriedObject) : ThingX {
|
||||
EGVAR(dragging,canCarry) = 1;
|
||||
EGVAR(dragging,carryPosition[]) = {0,0.5,0};
|
||||
EGVAR(dragging,carryDirection) = 0;
|
||||
XEH_ENABLED;
|
||||
displayName = QGVAR(dummy_obj);
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
model = "\A3\Weapons_F\AmmoBoxes\AmmoBox_F.p3d"; // TODO replace with custom model
|
||||
// TODO add pickup code
|
||||
model = "\A3\Weapons_F\AmmoBoxes\AmmoBox_F.p3d";
|
||||
};
|
||||
class GVAR(Bo_GBU12_LGB) : GVAR(defaultCarriedObject) {
|
||||
model = "\A3\Weapons_F\Ammo\Bomb_01_F.p3d";
|
||||
|
@ -16,12 +16,14 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_magazineClass", "_turretPath"];
|
||||
private ["_dummy","_magazineClass"];
|
||||
params ["_target", "_unit"];
|
||||
|
||||
if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_target distance _unit > REARM_ACTION_DISTANCE}) exitWith {false};
|
||||
|
||||
_magazineClass = _unit getVariable QGVAR(carriedMagazine);
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if (isNull _dummy) exitwith {false};
|
||||
_magazineClass = _dummy getVariable QGVAR(magazineClass);
|
||||
if (isNil "_magazineClass") exitWith {false};
|
||||
|
||||
([_target, _magazineClass] call FUNC(getNeedRearmMagazines)) select 0
|
||||
|
@ -17,33 +17,47 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_dummyName", "_dummyObj"];
|
||||
private ["_ammo", "_dummyName", "_dummy", "_actionID"];
|
||||
params ["_args"];
|
||||
_args params ["_unit", "_magazine"];
|
||||
|
||||
_unit setVariable [QGVAR(carriedMagazine), _magazine]; // TODO move to carried object
|
||||
[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
// TODO use ace carry
|
||||
_dummyObj = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if !(isNull _dummyObj) then {
|
||||
detach _dummyObj;
|
||||
deleteVehicle _dummyObj;
|
||||
_dummyObj setVariable [QGVAR(dummy), objNull];
|
||||
_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));
|
||||
_dummyObj = objNull;
|
||||
_dummy = objNull;
|
||||
if !(_dummyName == "") then {
|
||||
_dummyObj = _dummyName createVehicle (position _unit);
|
||||
_dummy = _dummyName createVehicle (position _unit);
|
||||
} else {
|
||||
_dummyObj = QGVAR(defaultCarriedObject) createVehicle (position _unit);
|
||||
_dummy = QGVAR(defaultCarriedObject) createVehicle (position _unit);
|
||||
};
|
||||
_dummyObj allowDamage false;
|
||||
_dummyObj attachTo [_unit, [0,0.5,0], "pelvis"];
|
||||
_dummy allowDamage false;
|
||||
_dummy attachTo [_unit, [0,0.5,0], "pelvis"];
|
||||
{
|
||||
[[_dummyObj, [[-1,0,0],[0,0,1]]], QUOTE(DFUNC(makeDummy)), _x] call EFUNC(common,execRemoteFnc);
|
||||
[[_dummy, [[-1,0,0],[0,0,1]]], QUOTE(DFUNC(makeDummy)), _x] call EFUNC(common,execRemoteFnc);
|
||||
} count (position _unit nearObjects ["CAManBase", 100]);
|
||||
_dummyObj setVariable [QGVAR(magazineClass), _magazine, true];
|
||||
_unit setVariable [QGVAR(dummy), _dummyObj];
|
||||
_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];
|
||||
|
@ -18,7 +18,9 @@
|
||||
private ["_magazineClass", "_ammo", "_tmpCal", "_cal", "_idx", "_needRearmMags", "_magazineDisplayName"];
|
||||
params ["_unit"];
|
||||
|
||||
_magazineClass = _unit getVariable QGVAR(carriedMagazine);
|
||||
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
||||
if (isNull _dummy) exitwith {false};
|
||||
_magazineClass = _dummy getVariable QGVAR(magazineClass);
|
||||
if (isNil "_magazineClass") exitWith {false};
|
||||
|
||||
_ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo");
|
||||
|
@ -34,7 +34,6 @@ if (local _unit) then {
|
||||
detach _dummy;
|
||||
deleteVehicle _dummy;
|
||||
};
|
||||
_unit setVariable [QGVAR(carriedMagazine), nil, true];
|
||||
_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm);
|
||||
_unit selectWeapon _weaponSelect;
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRearm), nil];
|
||||
|
Loading…
Reference in New Issue
Block a user