Merge pull request #5894 from acemod/ownerEvent-instead-of-local-logic

use ownerEvent instead of game logics
This commit is contained in:
commy2 2018-01-02 16:16:58 +01:00 committed by GitHub
commit bcf834d2c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 60 deletions

View File

@ -41,18 +41,6 @@ if (isServer) then {
TRACE_1("Knocked Out, Doing Deadman", _unit);
[_unit] call FUNC(onIncapacitated);
}] call CBA_fnc_addEventHandler;
[QGVAR(sendOrientations), {
params ["_logic"];
TRACE_1("sendOrientations received:",_logic);
// Filter the array before sending it
GVAR(explosivesOrientations) = GVAR(explosivesOrientations) select {
_x params ["_explosive"];
(!isNull _explosive && {alive _explosive})
};
TRACE_1("orientationsSent sent:",GVAR(explosivesOrientations));
[QGVAR(orientationsSent), [GVAR(explosivesOrientations)], _logic] call CBA_fnc_targetEvent;
}] call CBA_fnc_addEventHandler;
};
if (!hasInterface) exitWith {};
@ -62,27 +50,6 @@ GVAR(Setup) = objNull;
GVAR(pfeh_running) = false;
GVAR(CurrentSpeedDial) = 0;
// In case we are a JIP client, ask the server for orientation of any previously
// placed mine.
if (didJIP) then {
[QGVAR(orientationsSent), {
params ["_explosivesOrientations"];
TRACE_1("orientationsSent received:",_explosivesOrientations);
{
_x params ["_explosive","_direction","_pitch"];
TRACE_3("orientation set:",_explosive,_direction,_pitch);
[_explosive, _direction, _pitch] call FUNC(setPosition);
} forEach _explosivesOrientations;
deleteVehicle GVAR(localLogic);
GVAR(localLogic) = nil;
}] call CBA_fnc_addEventHandler;
// Create a logic to get the client ID
GVAR(localLogic) = ([sideLogic] call CBA_fnc_getSharedGroup) createUnit ["Logic", [0,0,0], [], 0, "NONE"];
TRACE_1("sendOrientations sent:",GVAR(localLogic));
[QGVAR(sendOrientations), [GVAR(localLogic)]] call CBA_fnc_serverEvent;
};
["ace_interactMenuOpened", {
//Cancel placement if interact menu opened
if (GVAR(pfeh_running)) then {

View File

@ -21,10 +21,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
if (isServer) then {
GVAR(explosivesOrientations) = []
};
GVAR(detonationHandlers) = [];
ADDON = true;

View File

@ -29,15 +29,3 @@ if (isNull (attachedTo _explosive)) then {
//Attaching to a vehicle (dirAndUp based on vehicle)
_explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]];
};
if (isServer) then {
// Store the orientation to broadcast it later to JIP players
GVAR(explosivesOrientations) pushBack [_explosive, _direction, _pitch];
// This is a good time to filter the array and remove explosives that no longer exist
GVAR(explosivesOrientations) = GVAR(explosivesOrientations) select {
_x params ["_explosive"];
(!isNull _explosive && {alive _explosive})
};
TRACE_1("setPosition",GVAR(explosivesOrientations));
};

View File

@ -9,8 +9,7 @@
// request marker data for JIP
if (isMultiplayer && {!isServer} && {hasInterface}) then {
GVAR(localLogic) = (createGroup sideLogic) createUnit ["Logic", [0,0,0], [], 0, "NONE"];
[QGVAR(sendMarkersJIP), [GVAR(localLogic)]] call CBA_fnc_serverEvent;
[QGVAR(sendMarkersJIP), CBA_clientID] call CBA_fnc_serverEvent;
};
GVAR(mapDisplaysWithDrawEHs) = [];

View File

@ -15,11 +15,11 @@
*/
#include "script_component.hpp"
params ["_logic"];
TRACE_1("params",_logic);
params ["_owner"];
TRACE_1("params",_owner);
[
QGVAR(setMarkerJIP),
[GETGVAR(allMapMarkers,[]), GETGVAR(allMapMarkersProperties,[])],
[_logic]
] call CBA_fnc_targetEvent;
_owner
] call CBA_fnc_ownerEvent;

View File

@ -50,8 +50,3 @@ TRACE_3("params",_allMapMarkers,_allMapMarkersProperties);
};
false
} count allMapMarkers;
private _group = group GVAR(localLogic);
deleteVehicle GVAR(localLogic);
GVAR(localLogic) = nil;
deleteGroup _group;