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

@ -102,12 +102,12 @@ class ACE_CSW_Groups {
class prefix_100rnd_hmg_csw_mag { // Same name as the carryable magazine
prefix_100rnd_hmg_mag = 1; // Vehicle magazine that will be loaded when loading this magazine
};
// Using an existing CSW magazine
class ace_csw_100Rnd_127x99_mag {
banana_dummy_ammo = 1;
};
/*
Carryable magazines already defined by ACE:
- ace_csw_100Rnd_127x99_mag
@ -134,16 +134,18 @@ class CfgVehicles {
class StaticMGWeapon;
class prefix_hmg: StaticMGWeapon {
class ACE_CSW {
enabled = 1; // Enables ACE CSW for this weapon
enabled = 1; // Enables ACE CSW for this weapon
proxyWeapon = "prefix_hmg_weapon_proxy"; // The proxy weapon created above
magazineLocation = "_target selectionPosition 'magazine'"; // Ammo handling interaction point location
disassembleWeapon = "prefix_hmg_carry"; // Carryable weapon created above
disassembleTurret = "ace_csw_m3Tripod"; // Which static tripod will appear when weapon is disassembled
ammoLoadTime = 7; // How long it takes in seconds to load ammo into the weapon
ammoLoadTime = 7; // How long it takes in seconds to load ammo into the weapon
ammoUnloadTime = 5; // How long it takes in seconds to unload ammo from the weapon
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";
};
};
};