Replaced advanced wounds event sync by regular setvariable public

This commit is contained in:
Glowbal 2015-04-01 20:03:44 +02:00
parent 635f3e31c9
commit 7252966a78
6 changed files with 32 additions and 21 deletions

View File

@ -217,13 +217,15 @@ if (isNil QGVAR(level)) then {
}, 0, []] call CBA_fnc_addPerFrameHandler; }, 0, []] call CBA_fnc_addPerFrameHandler;
// broadcast injuries to JIP clients in a MP session if (USE_WOUND_EVENT_SYNC) then {
if (isMultiplayer) then { // broadcast injuries to JIP clients in a MP session
// We are only pulling the wounds for the units in the player group. Anything else will come when the unit interacts with them. if (isMultiplayer) then {
if (hasInterface) then { // We are only pulling the wounds for the units in the player group. Anything else will come when the unit interacts with them.
{ if (hasInterface) then {
[_x, player] call FUNC(requestWoundSync); {
}foreach units group player; [_x, player] call FUNC(requestWoundSync);
}foreach units group player;
};
}; };
}; };

View File

@ -21,7 +21,9 @@ GVAR(currentSelectedSelectionN) = if (count _this > 2) then {_this select 2} els
GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull}; GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull};
[_target, ACE_player] call FUNC(requestWoundSync); if (USE_WOUND_EVENT_SYNC) then {
[_target, ACE_player] call FUNC(requestWoundSync);
};
if (_show) then { if (_show) then {
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"]; ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"];

View File

@ -123,18 +123,20 @@ _woundsCreated = [];
}; };
}foreach (_injuryTypeInfo select 0); }foreach (_injuryTypeInfo select 0);
_unit setvariable [QGVAR(openWounds), _openWounds]; _unit setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC];
// Only update if new wounds have been created // Only update if new wounds have been created
if (count _woundsCreated > 0) then { if (count _woundsCreated > 0) then {
_unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; _unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true];
}; };
// TODO Should this be done in a single broadcast? if (USE_WOUND_EVENT_SYNC) then {
// Broadcast the new injuries across the net in parts. One broadcast per injury. Prevents having to broadcast one massive array of injuries. // TODO Should this be done in a single broadcast?
{ // Broadcast the new injuries across the net in parts. One broadcast per injury. Prevents having to broadcast one massive array of injuries.
["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); {
}foreach _woundsCreated; ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent);
}foreach _woundsCreated;
};
_painLevel = _unit getvariable [QGVAR(pain), 0]; _painLevel = _unit getvariable [QGVAR(pain), 0];
_unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; _unit setvariable [QGVAR(pain), _painLevel + _painToAdd];

View File

@ -23,8 +23,10 @@ if (GVAR(level) >= 2) then {
_unit setvariable [QGVAR(bloodPressure), [0, 0]]; _unit setvariable [QGVAR(bloodPressure), [0, 0]];
_unit setvariable [QGVAR(airwayStatus), 0]; _unit setvariable [QGVAR(airwayStatus), 0];
_openWounds = _unit getvariable [QGVAR(openWounds), []]; if (USE_WOUND_EVENT_SYNC) then {
{ _openWounds = _unit getvariable [QGVAR(openWounds), []];
["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); {
}foreach _openWounds; ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent);
}foreach _openWounds;
};
}; };

View File

@ -85,10 +85,11 @@ _impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_eff
_mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _effectivenessFound) max 0]; _mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _effectivenessFound) max 0];
_openWounds set [_mostEffectiveSpot, _mostEffectiveInjury]; _openWounds set [_mostEffectiveSpot, _mostEffectiveInjury];
_target setvariable [QGVAR(openWounds), _openWounds]; _target setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC];
["medical_propagateWound", [_unit, _mostEffectiveInjury]] call EFUNC(common,globalEvent);
if (USE_WOUND_EVENT_SYNC) then {
["medical_propagateWound", [_unit, _mostEffectiveInjury]] call EFUNC(common,globalEvent);
};
// Handle the reopening of bandaged wounds // Handle the reopening of bandaged wounds
if (_impact > 0) then { if (_impact > 0) then {
// TODO handle reopening of bandaged wounds // TODO handle reopening of bandaged wounds

View File

@ -10,3 +10,5 @@
#endif #endif
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#define USE_WOUND_EVENT_SYNC false