mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #38 from KoffeinFlummi/aceEvents
Replace some AGM custom events by ACE events
This commit is contained in:
commit
5bea43910d
@ -63,13 +63,15 @@ call COMPILE_FILE(scripts\KeyInput\initScrollWheel);
|
||||
enableCamShake true;
|
||||
|
||||
// Set the name for the current player
|
||||
[missionNamespace, "playerChanged", {
|
||||
if (alive (_this select 0)) then {
|
||||
[_this select 0] call FUNC(setName)
|
||||
["playerChanged", {
|
||||
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
||||
|
||||
if (alive _newPlayer) then {
|
||||
[_newPlayer] call FUNC(setName)
|
||||
};
|
||||
if (alive (_this select 1)) then {
|
||||
[_this select 1] call FUNC(setName)
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer] call FUNC(setName)
|
||||
};
|
||||
}] call FUNC(addCustomEventhandler);
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
|
||||
|
@ -162,19 +162,24 @@ PREP(hashListSet);
|
||||
PREP(hashListPush);
|
||||
|
||||
|
||||
// Loop to update the ACE_player variable
|
||||
|
||||
ACE_player = player;
|
||||
|
||||
if (hasInterface) then {
|
||||
["ACE_CheckForPlayerChange", "onEachFrame", {
|
||||
// PFH to update the ACE_player variable
|
||||
[{
|
||||
if !(ACE_player isEqualTo (missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", player])) then {
|
||||
_this = ACE_player;
|
||||
_oldPlayer = ACE_player;
|
||||
|
||||
ACE_player = missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", player];
|
||||
uiNamespace setVariable ["ACE_player", ACE_player];
|
||||
|
||||
[missionNamespace, "playerChanged", [ACE_player, _this]] call FUNC(callCustomEventHandlers);
|
||||
// Raise custom event. @todo, remove
|
||||
[missionNamespace, "playerChanged", [ACE_player, _oldPlayer]] call FUNC(callCustomEventHandlers);
|
||||
// Raise ACE event
|
||||
["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
|
||||
};
|
||||
}] call BIS_fnc_addStackedEventHandler;
|
||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,4 +12,7 @@ if (isNull (findDisplay 1713999)) then {
|
||||
(findDisplay 1713999) closeDisplay 1;
|
||||
};
|
||||
|
||||
// Raise custom event. @todo: remove
|
||||
[_player, "interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,callCustomEventHandlers);
|
||||
// Raise ACE localEvent
|
||||
["interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,localEvent);
|
||||
|
@ -12,4 +12,7 @@ if (isNull (findDisplay 1713999)) then {
|
||||
(findDisplay 1713999) closeDisplay 1;
|
||||
};
|
||||
|
||||
// Raise custom event. @todo: remove
|
||||
[_player, "interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,callCustomEventHandlers);
|
||||
// Raise ACE localEvent
|
||||
["interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,localEvent);
|
||||
|
@ -13,13 +13,19 @@ _setupPlayer = {
|
||||
|
||||
[_setupPlayer, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
[missionNamespace, "playerChanged", {
|
||||
//On player change, mute old unit and unmute new player
|
||||
[_this select 0] call EFUNC(common,muteUnit);
|
||||
(_this select 0) setVariable [QGVAR(isMuted), true, true];
|
||||
// Mutes/unmutes units when the player changes
|
||||
["playerChanged", {
|
||||
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
||||
|
||||
if (!((_this select 1) getVariable ["ACE_isUnconscious", false]) && {alive (_this select 1)}) then { //@todo: ACE_isUnconscious???
|
||||
[_this select 1] call EFUNC(common,unMuteUnit);
|
||||
// On player change mute the new player
|
||||
[_newPlayer] call EFUNC(common,muteUnit);
|
||||
_newPlayer setVariable [QGVAR(isMuted), true, true];
|
||||
|
||||
// Unmute the old player
|
||||
//@todo: sort interaction with medical system
|
||||
if (!(_oldPlayer getVariable ["ACE_isUnconscious", false]) && {alive _oldPlayer}) then {
|
||||
[_oldPlayer] call EFUNC(common,unMuteUnit);
|
||||
};
|
||||
(_this select 1) setVariable [QGVAR(isMuted), false, true];
|
||||
}] call EFUNC(common,addCustomEventHandler);
|
||||
_oldPlayer setVariable [QGVAR(isMuted), false, true];
|
||||
|
||||
}] call EFUNC(common,addEventhandler);
|
||||
|
@ -1,16 +1,16 @@
|
||||
/*
|
||||
Name: ACE_Respawn_fnc_showFriendlyFireMessages
|
||||
|
||||
|
||||
Author(s):
|
||||
commy2
|
||||
|
||||
|
||||
Description:
|
||||
shows a message in system chat of who killed who
|
||||
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - unit
|
||||
1: OBJECT - killer
|
||||
|
||||
|
||||
Returns:
|
||||
VOID
|
||||
*/
|
||||
@ -25,5 +25,8 @@ _killer = _this select 1;
|
||||
if (_unit != _killer && side group _unit in [side group ACE_player, civilian] && {side group _killer == side group ACE_player}) then {
|
||||
systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)];
|
||||
|
||||
// Raise custom event. @todo: remove
|
||||
[_unit, "killedByFriendly", [_unit, _killer]] call EFUNC(common,callCustomEventHandlers);
|
||||
// Raise ACE globalEvent
|
||||
["killedByFriendly", [_unit, _killer]] call EFUNC(common,globalEvent);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user