add container property

This commit is contained in:
Salluci 2023-07-13 13:16:15 +03:00
parent c46dc339c5
commit 6c2a8a2117
4 changed files with 32 additions and 7 deletions

View File

@ -56,8 +56,7 @@ if ((maxLoad _container) isEqualTo 0) then {
if (isNull _container) then {
// Create ammo storage container
private _weaponRelPos = _unloadTo getRelPos RELATIVE_DIRECTION(270);
_weaponRelPos set [2, ((getPosATL _unloadTo) select 2) + 0.05];
private _weaponRelPos = (_unloadTo getRelPos RELATIVE_DIRECTION(270)) vectorAdd [0, 0, 0.05];
_container = createVehicle [["GroundWeaponHolder", QGVAR(ammo_holder)] select GVAR(handleExtraMagazinesType), [0, 0, 0], [], 0, "CAN_COLLIDE"];
_unloadTo setVariable [QGVAR(container), _container, true];
_container setDir random [0, 180, 360];

View File

@ -80,7 +80,30 @@ if (_vehicle getVariable [QGVAR(secondaryWeaponMagazine), ""] isNotEqualTo "") t
if (_storeExtraMagazines) then {
TRACE_1("saving extra mags to container",_containerMagazineCount);
// Create container from config if available, use setting if not
private _containerType = getText (configOf _vehicle >> QUOTE(ADDON) >> "container");
if (_containerType isNotEqualTo "") then {
private _relPos = (_vehicle getRelPos RELATIVE_DIRECTION(270)) vectorAdd [0, 0, 0.05];
_container = createVehicle [_containerType, [0, 0, 0], [], 0, "CAN_COLLIDE"];
_vehicle setVariable [QGVAR(container), _container, true];
_container setDir random [0, 180, 360];
_container setPosATL _relPos;
if ((_relPos select 2) < 0.5) then {
_container setVectorUp (surfaceNormal _relPos);
};
// empty container inventory
// TODO: make a function in common?
clearItemCargoGlobal _container;
clearWeaponCargoGlobal _container;
clearMagazineCargoGlobal _container;
clearBackpackCargoGlobal _container;
} else {
_container = _vehicle;
};
{
[_vehicle, _x, _containerMagazineCount select _forEachIndex] call FUNC(reload_handleReturnAmmo);
[_container, _x, _containerMagazineCount select _forEachIndex] call FUNC(reload_handleReturnAmmo);
} forEach _containerMagazineClassnames;
};

View File

@ -29,6 +29,7 @@ class CfgVehicles {
class ace_csw {
proxyWeapon = QFUNC(csw_getProxyWeapon);
magazineLocation = "_target selectionPosition 'usti hlavne'";
container = "ACE_Box_82mm_Mo_Combo";
};
class Turrets: Turrets {
class MainTurret: MainTurret {

View File

@ -144,6 +144,8 @@ class CfgVehicles {
desiredAmmo = 100; // When the weapon is reloaded it will try and reload to this ammo capacity
// Optional callback function for when the CSW gets disassembled, called with [tripod, staticWeapon]
disassembleFunc = "prefix_fnc_handleDisassembly";
// Optional object to store unloaded magazines in
container = "ReammoBox_F";
};
};
};