Skip to content

Commit

Permalink
Map - Use SlotItemChanged event (#9961)
Browse files Browse the repository at this point in the history
* Update XEH_postInitClient.sqf

* Use `addPlayerEH`

* Switch to `CBA_fnc_addBISPlayerEventHandler`
  • Loading branch information
johnb432 authored Oct 15, 2024
1 parent d1d12fb commit b23c657
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions addons/map/XEH_postInitClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,22 @@ GVAR(flashlights) = createHashMap;
// hide clock on map if player has no watch
GVAR(hasWatch) = true;

["loadout", {
params ["_unit"];
if (isNull _unit) exitWith {
[QGVAR(slotItemChanged), "SlotItemChanged", {
params ["", "_item", "_slot", "_assign"];

if (_slot != TYPE_WATCH) exitWith {};

GVAR(hasWatch) = _assign && {_item isKindOf ["ItemWatch", configFile >> "CfgWeapons"]};
}] call CBA_fnc_addBISPlayerEventHandler;

["unit", {
params ["_newPlayer"];

if (isNull _newPlayer) exitWith {
GVAR(hasWatch) = true;
};
GVAR(hasWatch) = false;
{
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
} forEach (assignedItems _unit);

GVAR(hasWatch) = (_newPlayer getSlotItemName TYPE_WATCH) isKindOf ["ItemWatch", configFile >> "CfgWeapons"];
}, true] call CBA_fnc_addPlayerEventHandler;


Expand Down

0 comments on commit b23c657

Please sign in to comment.