From 6930ae3a21ca7b8a8e2bcf8fb2ef27d51ba1f953 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 5 Mar 2016 22:14:45 +0100 Subject: [PATCH] add support for seatSwitchedMan, reloaded and use native getInMan and getOutMan events, fix #286 --- addons/xeh/CfgEventHandlers.hpp | 2 ++ addons/xeh/fnc_addClassEventHandler.sqf | 17 ----------------- addons/xeh/script_component.hpp | 4 +++- addons/xeh/script_xeh.hpp | 11 +++++++++-- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/addons/xeh/CfgEventHandlers.hpp b/addons/xeh/CfgEventHandlers.hpp index 22f5ef03a..84cb3866a 100644 --- a/addons/xeh/CfgEventHandlers.hpp +++ b/addons/xeh/CfgEventHandlers.hpp @@ -69,10 +69,12 @@ class Extended_MPRespawn_EventHandlers {}; class Extended_Put_EventHandlers {}; class Extended_Respawn_EventHandlers {}; class Extended_SeatSwitched_EventHandlers {}; +class Extended_SeatSwitchedMan_EventHandlers {}; class Extended_SoundPlayed_EventHandlers {}; class Extended_Take_EventHandlers {}; class Extended_WeaponAssembled_EventHandlers {}; class Extended_WeaponDisassembled_EventHandlers {}; +class Extended_Reloaded_EventHandlers {}; // display xeh class Extended_DisplayLoad_EventHandlers { diff --git a/addons/xeh/fnc_addClassEventHandler.sqf b/addons/xeh/fnc_addClassEventHandler.sqf index 6d5f5edd7..a59e750b1 100644 --- a/addons/xeh/fnc_addClassEventHandler.sqf +++ b/addons/xeh/fnc_addClassEventHandler.sqf @@ -38,23 +38,6 @@ if (!GVAR(fallbackRunning) && {ISINCOMP(_className)}) then { // no such CfgVehicles class if (!isClass _config) exitWith {false}; -// handle custom event handlers -if (_eventName == "getInMan" && {isNil QGVAR(getInManAdded)}) then { - GVAR(getInManAdded) = ["All", "getIn", { - { - [_this select 2, _this select 1, _this select 0, _this select 3] call _x; - } forEach ((_this select 2) getVariable QGVAR(getInMan)); - }] call CBA_fnc_addClassEventHandler; -}; - -if (_eventName == "getOutMan" && {isNil QGVAR(getOutManAdded)}) then { - GVAR(getOutManAdded) = ["All", "getOut", { - { - [_this select 2, _this select 1, _this select 0, _this select 3] call _x; - } forEach ((_this select 2) getVariable QGVAR(getOutMan)); - }] call CBA_fnc_addClassEventHandler; -}; - _eventName = toLower _eventName; // no such event diff --git a/addons/xeh/script_component.hpp b/addons/xeh/script_component.hpp index cdd103469..3caf21e82 100644 --- a/addons/xeh/script_component.hpp +++ b/addons/xeh/script_component.hpp @@ -82,8 +82,10 @@ "Put", \ "Take", \ "SeatSwitched", \ + "SeatSwitchedMan", \ "SoundPlayed", \ "WeaponAssembled", \ "WeaponDisassembled", \ "WeaponDeployed", \ - "WeaponRested" + "WeaponRested", \ + "Reloaded" diff --git a/addons/xeh/script_xeh.hpp b/addons/xeh/script_xeh.hpp index 78ee0bd92..2cedb6fb8 100644 --- a/addons/xeh/script_xeh.hpp +++ b/addons/xeh/script_xeh.hpp @@ -27,7 +27,9 @@ firedNear = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_fir fuel = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_cba_xeh_fuel"")"; \ gear = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_gear"")"; \ getIn = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_getIn"")"; \ +getInMan = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_getInMan"")"; \ getOut = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_getOut"")"; \ +getOutMan = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_getOutMan"")"; \ handleHeal = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_handleHeal"")"; \ hit = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_hit"")"; \ hitPart = "{_this call _x} forEach ((_this select 0 select 0) getVariable ""cba_xeh_hitPart"")"; \ @@ -42,11 +44,13 @@ respawn = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_respa put = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_put"")"; \ take = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_take"")"; \ seatSwitched = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_seatSwitched"")"; \ +seatSwitchedMan = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_seatSwitchedMan"")"; \ soundPlayed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_soundPlayed"")"; \ weaponAssembled = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponAssembled"")"; \ weaponDisassembled = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponDisassembled"")"; \ weaponDeployed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponDeployed"")"; \ -weaponRested = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponRested"")"; +weaponRested = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponRested"")"; \ +reloaded = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_reloaded"")"; /* @@ -73,7 +77,9 @@ firedNear = ""; \ fuel = ""; \ gear = ""; \ getIn = ""; \ +getInMan = ""; \ getOut = ""; \ +getOutMan = ""; \ handleHeal = ""; \ hit = ""; \ hitPart = ""; \ @@ -92,4 +98,5 @@ soundPlayed = ""; \ weaponAssembled = ""; \ weaponDisassembled = ""; \ weaponDeployed = ""; \ -weaponRested = ""; +weaponRested = ""; \ +reloaded = "";