Skip to content

Commit b23c657

Browse files
authored
Map - Use SlotItemChanged event (#9961)
* Update XEH_postInitClient.sqf * Use `addPlayerEH` * Switch to `CBA_fnc_addBISPlayerEventHandler`
1 parent d1d12fb commit b23c657

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

addons/map/XEH_postInitClient.sqf

+14-7
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,22 @@ GVAR(flashlights) = createHashMap;
6565
// hide clock on map if player has no watch
6666
GVAR(hasWatch) = true;
6767

68-
["loadout", {
69-
params ["_unit"];
70-
if (isNull _unit) exitWith {
68+
[QGVAR(slotItemChanged), "SlotItemChanged", {
69+
params ["", "_item", "_slot", "_assign"];
70+
71+
if (_slot != TYPE_WATCH) exitWith {};
72+
73+
GVAR(hasWatch) = _assign && {_item isKindOf ["ItemWatch", configFile >> "CfgWeapons"]};
74+
}] call CBA_fnc_addBISPlayerEventHandler;
75+
76+
["unit", {
77+
params ["_newPlayer"];
78+
79+
if (isNull _newPlayer) exitWith {
7180
GVAR(hasWatch) = true;
7281
};
73-
GVAR(hasWatch) = false;
74-
{
75-
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
76-
} forEach (assignedItems _unit);
82+
83+
GVAR(hasWatch) = (_newPlayer getSlotItemName TYPE_WATCH) isKindOf ["ItemWatch", configFile >> "CfgWeapons"];
7784
}, true] call CBA_fnc_addPlayerEventHandler;
7885

7986

0 commit comments

Comments
 (0)