mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #3792 from acemod/useGetUnitLoadout
use 'getUnitLoadout' instead of 'FUNC(getAllGear)' and deprecate it
This commit is contained in:
commit
cc9e128e74
@ -333,7 +333,7 @@ enableCamShake true;
|
||||
GVAR(OldPlayerVehicle) = vehicle objNull;
|
||||
GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex);
|
||||
GVAR(OldPlayerWeapon) = currentWeapon objNull;
|
||||
GVAR(OldPlayerInventory) = [objNull] call FUNC(getAllGear);
|
||||
GVAR(OldPlayerInventory) = [];
|
||||
GVAR(OldPlayerVisionMode) = currentVisionMode objNull;
|
||||
GVAR(OldCameraView) = "";
|
||||
GVAR(OldVisibleMap) = false;
|
||||
@ -381,7 +381,7 @@ GVAR(OldIsCamera) = false;
|
||||
};
|
||||
|
||||
// "playerInventoryChanged" event
|
||||
_data = [ACE_player] call FUNC(getAllGear);
|
||||
_data = getUnitLoadout ACE_player;
|
||||
if !(_data isEqualTo GVAR(OldPlayerInventory)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerInventory) = _data;
|
||||
|
@ -31,37 +31,15 @@ GVAR(AssignedItemsShownItems) = [
|
||||
["playerInventoryChanged", {
|
||||
params ["_unit", "_assignedItems"];
|
||||
|
||||
_assignedItems = _assignedItems select 17;
|
||||
_assignedItems = _assignedItems param [9, ["","","","","",""]]; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]
|
||||
|
||||
GVAR(AssignedItemsShownItems) = [true, true, true, true, true];
|
||||
|
||||
{
|
||||
if !(_x in GVAR(AssignedItems)) then {
|
||||
GVAR(AssignedItems) pushBack _x;
|
||||
GVAR(AssignedItemsInfo) pushBack toLower getText (configFile >> "CfgWeapons" >> _x >> "ACE_hideItemType");
|
||||
};
|
||||
|
||||
switch (GVAR(AssignedItemsInfo) select (GVAR(AssignedItems) find _x)) do {
|
||||
case ("map"): {
|
||||
GVAR(AssignedItemsShownItems) set [0, false];
|
||||
};
|
||||
case ("compass"): {
|
||||
GVAR(AssignedItemsShownItems) set [1, false];
|
||||
};
|
||||
case ("watch"): {
|
||||
GVAR(AssignedItemsShownItems) set [2, false];
|
||||
};
|
||||
case ("radio"): {
|
||||
GVAR(AssignedItemsShownItems) set [3, false];
|
||||
};
|
||||
case ("gps"): {
|
||||
GVAR(AssignedItemsShownItems) set [4, false];
|
||||
};
|
||||
};
|
||||
false
|
||||
} count _assignedItems;
|
||||
|
||||
//systemChat str GVAR(AssignedItemsShownItems);
|
||||
GVAR(AssignedItemsShownItems) = [
|
||||
!((_assignedItems select 0) isEqualTo "") && {getText (configFile >> "CfgWeapons" >> _assignedItems select 0 >> "ACE_hideItemType") != "map"},
|
||||
!((_assignedItems select 3) isEqualTo "") && {getText (configFile >> "CfgWeapons" >> _assignedItems select 3 >> "ACE_hideItemType") != "compass"},
|
||||
!((_assignedItems select 4) isEqualTo "") && {getText (configFile >> "CfgWeapons" >> _assignedItems select 4 >> "ACE_hideItemType") != "watch"},
|
||||
!((_assignedItems select 2) isEqualTo "") && {getText (configFile >> "CfgWeapons" >> _assignedItems select 2 >> "ACE_hideItemType") != "radio"},
|
||||
!((_assignedItems select 1) isEqualTo "") && {getText (configFile >> "CfgWeapons" >> _assignedItems select 1 >> "ACE_hideItemType") != "gps"}
|
||||
];
|
||||
|
||||
GVAR(AssignedItemsShownItems) params ["_showMap", "_showCompass", "_showWatch", "_showRadio", "_showGPS"];
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
ACE_DEPRECATED("ace_common_fnc_getAllGear","3.7.0","getUnitLoadout");
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
if (isNull _unit) exitWith {[
|
||||
|
@ -18,6 +18,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
ACE_DEPRECATED("ace_common_fnc_setAllGear","3.7.0","setUnitLoadout");
|
||||
|
||||
params ["_unit", "_allGear", ["_clearAttachments", false], ["_clearBackpack", false]];
|
||||
|
||||
if (!local _unit) exitWith {
|
||||
|
@ -42,10 +42,10 @@ GVAR(surfaceCache) = "";
|
||||
GVAR(surfaceCacheIsDust) = false;
|
||||
|
||||
// init GlassesChanged eventhandler
|
||||
GVAR(OldGlasses) = "#NULLSTRING";
|
||||
GVAR(OldGlasses) = "<null>";
|
||||
|
||||
["playerInventoryChanged", {
|
||||
(_this select 1) params ["", "_currentGlasses"];
|
||||
private _currentGlasses = (_this select 1) param [7, ""];
|
||||
|
||||
if (GVAR(OldGlasses) != _currentGlasses) then {
|
||||
["GlassesChanged", [ACE_player, _currentGlasses]] call EFUNC(common,localEvent);
|
||||
|
@ -298,9 +298,7 @@ GVAR(lastHeartBeatSound) = ACE_time;
|
||||
["isNotUnconscious", {!((_this select 0) getVariable ["ACE_isUnconscious", false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
||||
// Item Event Handler
|
||||
["playerInventoryChanged", {
|
||||
[ACE_player] call FUNC(itemCheck);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
["playerInventoryChanged", FUNC(itemCheck)] call EFUNC(common,addEventHandler);
|
||||
|
||||
if (hasInterface) then {
|
||||
["PlayerJip", {
|
||||
|
@ -29,7 +29,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [
|
||||
GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
|
||||
|
||||
// Setup the event handlers
|
||||
["playerInventoryChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["playerInventoryChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler);
|
||||
["playerVisionModeChanged", {
|
||||
_this call FUNC(updatePPEffects);
|
||||
_this call FUNC(onVisionModeChanged);
|
||||
|
@ -43,5 +43,4 @@ GVAR(PFH) = false;
|
||||
// don't show speed and height when in expert mode
|
||||
["infoDisplayChanged", {_this call FUNC(handleInfoDisplayChanged)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
//[ACE_Player,([ACE_player] call EFUNC(common,getAllGear))] call FUNC(storeParachute);
|
||||
["playerInventoryChanged", FUNC(storeParachute) ] call EFUNC(common,addEventHandler);
|
||||
["playerInventoryChanged", FUNC(storeParachute)] call EFUNC(common,addEventHandler);
|
||||
|
@ -19,13 +19,9 @@
|
||||
params ["_unit"];
|
||||
|
||||
// Saves the gear when the player! (and only him) is killed
|
||||
if (ACE_player == _unit) then {
|
||||
GVAR(unitGear) = [];
|
||||
|
||||
if (GVAR(SavePreDeathGear)) then {
|
||||
GVAR(unitGear) = [_unit] call EFUNC(common,getAllGear);
|
||||
GVAR(unitGear) append [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit];
|
||||
};
|
||||
if (ACE_player == _unit && {GVAR(SavePreDeathGear)}) then {
|
||||
_unit setVariable [QGVAR(unitGear), getUnitLoadout _unit];
|
||||
_unit setVariable [QGVAR(activeWeaponAndMuzzle), [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit]];
|
||||
};
|
||||
|
||||
if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then {
|
||||
|
@ -20,7 +20,11 @@ params ["_unit"];
|
||||
|
||||
// Restores the gear when the player respawns
|
||||
if (GVAR(SavePreDeathGear)) then {
|
||||
[_unit, GVAR(unitGear)] call FUNC(restoreGear);
|
||||
[
|
||||
_unit,
|
||||
_unit getVariable QGVAR(unitGear),
|
||||
_unit getVariable QGVAR(activeWeaponAndMuzzle)
|
||||
] call FUNC(restoreGear);
|
||||
};
|
||||
|
||||
// fix for setVariable public being lost on respawn for machines that JIP after the command was broadcasted
|
||||
|
@ -19,30 +19,35 @@
|
||||
params ["_unit", "_allGear", "_activeWeaponAndMuzzle"];
|
||||
|
||||
// restore all gear
|
||||
[_unit, _allGear, true, true] call EFUNC(common,setAllGear);
|
||||
if (!isNil "_allGear") then {
|
||||
_unit setUnitLoadout _allGear;
|
||||
};
|
||||
|
||||
// restore the last active weapon, muzzle and weaponMode
|
||||
_activeWeaponAndMuzzle params ["_activeWeapon", "_activeMuzzle", "_activeWeaponMode"];
|
||||
if (!isNil "_activeWeaponAndMuzzle") then {
|
||||
// @todo, replace this with CBA_fnc_selectWeapon after next CBA update
|
||||
_activeWeaponAndMuzzle params ["_activeWeapon", "_activeMuzzle", "_activeWeaponMode"];
|
||||
|
||||
if (
|
||||
(_activeMuzzle != "") &&
|
||||
{_activeMuzzle != _activeWeapon} &&
|
||||
{_activeMuzzle in getArray (configFile >> "CfgWeapons" >> _activeWeapon >> "muzzles")}
|
||||
) then {
|
||||
_unit selectWeapon _activeMuzzle;
|
||||
} else {
|
||||
if (_activeWeapon != "") then {
|
||||
_unit selectWeapon _activeWeapon;
|
||||
};
|
||||
};
|
||||
|
||||
if (currentWeapon _unit != "") then {
|
||||
private _index = 0;
|
||||
|
||||
while {
|
||||
_index < 100 && {currentWeaponMode _unit != _activeWeaponMode}
|
||||
} do {
|
||||
_unit action ["SwitchWeapon", _unit, _unit, _index];
|
||||
_index = _index + 1;
|
||||
if (
|
||||
(_activeMuzzle != "") &&
|
||||
{_activeMuzzle != _activeWeapon} &&
|
||||
{_activeMuzzle in getArray (configFile >> "CfgWeapons" >> _activeWeapon >> "muzzles")}
|
||||
) then {
|
||||
_unit selectWeapon _activeMuzzle;
|
||||
} else {
|
||||
if (_activeWeapon != "") then {
|
||||
_unit selectWeapon _activeWeapon;
|
||||
};
|
||||
};
|
||||
|
||||
if (currentWeapon _unit != "") then {
|
||||
private _index = 0;
|
||||
|
||||
while {
|
||||
_index < 100 && {currentWeaponMode _unit != _activeWeaponMode}
|
||||
} do {
|
||||
_unit action ["SwitchWeapon", _unit, _unit, _index];
|
||||
_index = _index + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -10,10 +10,7 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// Check inventory when it changes
|
||||
["playerInventoryChanged", {
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
}] call EFUNC(common,addEventhandler);
|
||||
|
||||
["playerInventoryChanged", FUNC(inventoryCheck)] call EFUNC(common,addEventhandler);
|
||||
|
||||
// Instantly hide knobs when scoping in
|
||||
["cameraViewChanged", {
|
||||
|
Loading…
Reference in New Issue
Block a user