mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixed rearm sucess hint and collision with dummy
This commit is contained in:
parent
463309db2d
commit
3072bd9d22
@ -9,6 +9,7 @@ PREP(getMaxMagazines);
|
||||
PREP(getNeedRearmMagazines);
|
||||
PREP(handleKilled);
|
||||
PREP(handleUnconscious);
|
||||
PREP(makeDummy);
|
||||
PREP(moduleRearmSettings);
|
||||
PREP(pickUpAmmo);
|
||||
PREP(pickUpSuccess);
|
||||
@ -16,6 +17,5 @@ PREP(rearm);
|
||||
PREP(rearmEntireVehicle);
|
||||
PREP(rearmEntireVehicleSuccess);
|
||||
PREP(rearmSuccess);
|
||||
PREP(turn);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Turns an object.
|
||||
* Make a dummy object by disabling collision and turning it.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [dummy, [[1,0,0],[0,0,1]]] call ace_rearm_fnc_turn
|
||||
* [dummy, [[1,0,0],[0,0,1]]] call ace_rearm_fnc_makeDummy
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -19,3 +19,4 @@
|
||||
params ["_obj", "_dirAndUp"];
|
||||
|
||||
_obj setVectorDirAndUp _dirAndUp;
|
||||
player disableCollisionWith _obj;
|
@ -35,8 +35,10 @@ _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
_dummy = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy));
|
||||
if !(_dummy == "") then {
|
||||
_dummy = _dummy createVehicle (position _unit);
|
||||
_dummy attachTo [_unit, [0,0.5,0], "pelvis"];
|
||||
[[_dummy, [[-1,0,0],[0,0,1]]], QUOTE(DFUNC(turn)), 2] call EFUNC(common,execRemoteFnc);
|
||||
_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]);
|
||||
_unit setVariable [QGVAR(dummy), _dummy];
|
||||
};
|
||||
|
@ -18,7 +18,7 @@
|
||||
private ["_turretPath", "_magazines", "_magazine", "_currentMagazines", "_maxMagazines", "_maxRounds", "_currentRounds"];
|
||||
params ["_vehicle"];
|
||||
|
||||
if !(local _vehicle) exitWith {
|
||||
if !(local _vehicle) exitWith { // TODO if there are players inside the turrets they will not be rearmed due to locality issues
|
||||
[_this, QFUNC(rearmEntireVehicleSuccess), _vehicle] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[vehicle, player, [0], 5, "calcium", 500]] call ace_rearm_fnc_rearmSuccess
|
||||
* [[vehicle, player, [-1], 2, "5000Rnd_762x51_Belt", 500]] call ace_rearm_fnc_rearmSuccess
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -40,7 +40,7 @@ if (local _unit) then {
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRearm), nil];
|
||||
};
|
||||
|
||||
if !(local _target) exitWith {
|
||||
if !(local _target) exitWith { // TODO if there are players inside the turrets they will not be rearmed due to locality issues
|
||||
[_this, QUOTE(DFUNC(rearmSuccess)), _target] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
|
||||
@ -52,13 +52,16 @@ if (_maxMagazines == 1) then {
|
||||
if (GVAR(level) == 1) then {
|
||||
// Fill magazine completely
|
||||
_target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath];
|
||||
["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _rounds,
|
||||
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
|
||||
getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent);
|
||||
} else {
|
||||
// Fill only at most _numRounds
|
||||
_target setMagazineTurretAmmo [_magazineClass, ((_target magazineTurretAmmo [_magazineClass, _turretPath]) + _numRounds) min _rounds, _turretPath];
|
||||
["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _numRounds,
|
||||
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
|
||||
getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
[[LSTRING(Hint_RearmedTriple), _numRounds,
|
||||
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
|
||||
getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit] call EFUNC(common,displayTextStructured);
|
||||
} else {
|
||||
for "_idx" from 1 to _maxMagazines do {
|
||||
_currentRounds = _target magazineTurretAmmo [_magazineClass, _turretPath];
|
||||
@ -75,6 +78,9 @@ if (_maxMagazines == 1) then {
|
||||
} else {
|
||||
_target setMagazineTurretAmmo [_magazineClass, _currentRounds + _numRounds, _turretPath];
|
||||
};
|
||||
["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _numRounds,
|
||||
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
|
||||
getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent);
|
||||
} else {
|
||||
// Fill current magazine completely and fill next magazine partially
|
||||
_target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath];
|
||||
@ -82,10 +88,10 @@ if (_maxMagazines == 1) then {
|
||||
_target addMagazineTurret [_magazineClass, _turretPath];
|
||||
_target setMagazineTurretAmmo [_magazineClass, _currentRounds, _turretPath];
|
||||
};
|
||||
["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _rounds,
|
||||
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
|
||||
getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
[[LSTRING(Hint_RearmedTriple), _rounds,
|
||||
getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"),
|
||||
getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
_target removeMagazineTurret [_magazineClass, _turretPath];
|
||||
_numMagazines = _numMagazines - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user