mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Revert "Fixed: numerous player-based events were repeat invalid firing for null player object. This is now limited to only appropriate null-friendly events."
This reverts commit 6864529d9c
.
This commit is contained in:
parent
b78b93f2cd
commit
e27c91710c
@ -106,60 +106,31 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
|
||||
// PFH to raise varios events
|
||||
[{
|
||||
if(!isNil "ACE_player" && { !isNull ACE_player }) then {
|
||||
// "playerInventoryChanged" event
|
||||
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
|
||||
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerInventory) = _newPlayerInventory;
|
||||
["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerVisionModeChanged" event
|
||||
_newPlayerVisionMode = currentVisionMode ACE_player;
|
||||
if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVisionMode) = _newPlayerVisionMode;
|
||||
["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "inventoryDisplayChanged" event
|
||||
_newInventoryDisplayIsOpen = !(isNull findDisplay 602);
|
||||
if !(_newInventoryDisplayIsOpen isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldInventoryDisplayIsOpen) = _newInventoryDisplayIsOpen;
|
||||
["inventoryDisplayChanged", [ACE_player, _newInventoryDisplayIsOpen]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerVehicleChanged" event
|
||||
_newPlayerVehicle = vehicle ACE_player;
|
||||
if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVehicle) = _newPlayerVehicle;
|
||||
["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerTurretChanged" event
|
||||
_newPlayerTurret = [ACE_player] call FUNC(getTurretIndex);
|
||||
if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerTurret) = _newPlayerTurret;
|
||||
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerWeaponChanged" event
|
||||
_newPlayerWeapon = currentWeapon ACE_player;
|
||||
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
|
||||
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
|
||||
};
|
||||
// "playerInventoryChanged" event
|
||||
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
|
||||
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerInventory) = _newPlayerInventory;
|
||||
["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
//
|
||||
// These events can fire on a null player object
|
||||
//
|
||||
|
||||
|
||||
// "playerVisionModeChanged" event
|
||||
_newPlayerVisionMode = currentVisionMode ACE_player;
|
||||
if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVisionMode) = _newPlayerVisionMode;
|
||||
["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "inventoryDisplayChanged" event
|
||||
_newInventoryDisplayIsOpen = !(isNull findDisplay 602);
|
||||
if !(_newInventoryDisplayIsOpen isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldInventoryDisplayIsOpen) = _newInventoryDisplayIsOpen;
|
||||
["inventoryDisplayChanged", [ACE_player, _newInventoryDisplayIsOpen]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "zeusDisplayChanged" event
|
||||
_newZeusDisplayIsOpen = !(isNull findDisplay 312);
|
||||
if !(_newZeusDisplayIsOpen isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
|
||||
@ -167,7 +138,7 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen;
|
||||
["zeusDisplayChanged", [ACE_player, _newZeusDisplayIsOpen]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
|
||||
// "cameraViewChanged" event
|
||||
_newCameraView = cameraView;
|
||||
if !(_newCameraView isEqualTo GVAR(OldCameraView)) then {
|
||||
@ -175,7 +146,31 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
GVAR(OldCameraView) = _newCameraView;
|
||||
["cameraViewChanged", [ACE_player, _newCameraView]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
|
||||
// "playerVehicleChanged" event
|
||||
_newPlayerVehicle = vehicle ACE_player;
|
||||
if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVehicle) = _newPlayerVehicle;
|
||||
["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerTurretChanged" event
|
||||
_newPlayerTurret = [ACE_player] call FUNC(getTurretIndex);
|
||||
if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerTurret) = _newPlayerTurret;
|
||||
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerWeaponChanged" event
|
||||
_newPlayerWeapon = currentWeapon ACE_player;
|
||||
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
|
||||
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
|
Loading…
Reference in New Issue
Block a user