mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
temporarily re-allowDamage when using setHit(PointDamage)
This commit is contained in:
parent
0e09879528
commit
744b9778df
@ -145,9 +145,23 @@ if (isServer) then {
|
|||||||
[QGVAR(playActionNow), {(_this select 0) playActionNow (_this select 1)}] call CBA_fnc_addEventHandler;
|
[QGVAR(playActionNow), {(_this select 0) playActionNow (_this select 1)}] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(switchMove), {(_this select 0) switchMove (_this select 1)}] call CBA_fnc_addEventHandler;
|
[QGVAR(switchMove), {(_this select 0) switchMove (_this select 1)}] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(setVectorDirAndUp), {(_this select 0) setVectorDirAndUp (_this select 1)}] call CBA_fnc_addEventHandler;
|
[QGVAR(setVectorDirAndUp), {(_this select 0) setVectorDirAndUp (_this select 1)}] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(setVanillaHitPointDamage), {(_this select 0) setHitPointDamage (_this select 1)}] call CBA_fnc_addEventHandler;
|
|
||||||
[QGVAR(addWeaponItem), {(_this select 0) addWeaponItem [(_this select 1), (_this select 2)]}] call CBA_fnc_addEventHandler;
|
[QGVAR(addWeaponItem), {(_this select 0) addWeaponItem [(_this select 1), (_this select 2)]}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
[QGVAR(setVanillaHitPointDamage), {
|
||||||
|
params ["_object", "_hitPointAnddamage"];
|
||||||
|
private _isDamageAllowed = isDamageAllowed _object;
|
||||||
|
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_object allowDamage true;
|
||||||
|
};
|
||||||
|
|
||||||
|
_object setHitPointDamage _hitPointAnddamage;
|
||||||
|
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_object allowDamage false;
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Request framework
|
// Request framework
|
||||||
[QGVAR(requestCallback), FUNC(requestCallback)] call CBA_fnc_addEventHandler;
|
[QGVAR(requestCallback), FUNC(requestCallback)] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(receiveRequest), FUNC(receiveRequest)] call CBA_fnc_addEventHandler;
|
[QGVAR(receiveRequest), FUNC(receiveRequest)] call CBA_fnc_addEventHandler;
|
||||||
|
@ -24,8 +24,17 @@ if (!local _unit) exitWith {
|
|||||||
|
|
||||||
private _hitPointDamages = getAllHitPointsDamage _unit param [2, []];
|
private _hitPointDamages = getAllHitPointsDamage _unit param [2, []];
|
||||||
|
|
||||||
|
private _isDamageAllowed = isDamageAllowed _unit;
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_unit allowDamage true;
|
||||||
|
};
|
||||||
|
|
||||||
_unit setDamage _damage;
|
_unit setDamage _damage;
|
||||||
|
|
||||||
{
|
{
|
||||||
_unit setHitIndex [_forEachIndex, _x];
|
_unit setHitIndex [_forEachIndex, _x];
|
||||||
} forEach _hitPointDamages;
|
} forEach _hitPointDamages;
|
||||||
|
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_unit allowDamage false;
|
||||||
|
};
|
||||||
|
@ -4,4 +4,17 @@
|
|||||||
[QGVAR(setVehicleHitPointDamage), {_this call FUNC(setHitPointDamage)}] call CBA_fnc_addEventHandler;
|
[QGVAR(setVehicleHitPointDamage), {_this call FUNC(setHitPointDamage)}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// wheels
|
// wheels
|
||||||
[QGVAR(setWheelHitPointDamage), {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler;
|
[QGVAR(setWheelHitPointDamage), {
|
||||||
|
params ["_object", "_hitPoint", "_damage"];
|
||||||
|
private _isDamageAllowed = isDamageAllowed _object;
|
||||||
|
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_object allowDamage true;
|
||||||
|
};
|
||||||
|
|
||||||
|
_object setHitPointDamage [_hitPoint, _damage];
|
||||||
|
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_object allowDamage false;
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -26,6 +26,11 @@ if !(local _vehicle) exitWith {};
|
|||||||
(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["_allHitPointsSelections", []], ["_allHitPointDamages", []]];
|
(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["_allHitPointsSelections", []], ["_allHitPointDamages", []]];
|
||||||
|
|
||||||
// set damage of the vehicle
|
// set damage of the vehicle
|
||||||
|
private _isDamageAllowed = isDamageAllowed _vehicle;
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_vehicle allowDamage true;
|
||||||
|
};
|
||||||
|
|
||||||
_vehicle setDamage _damage;
|
_vehicle setDamage _damage;
|
||||||
|
|
||||||
// restore original hitpoint damage values
|
// restore original hitpoint damage values
|
||||||
@ -33,5 +38,9 @@ _vehicle setDamage _damage;
|
|||||||
_vehicle setHitIndex [_forEachIndex, _x];
|
_vehicle setHitIndex [_forEachIndex, _x];
|
||||||
} forEach _allHitPointDamages;
|
} forEach _allHitPointDamages;
|
||||||
|
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_vehicle allowDamage false;
|
||||||
|
};
|
||||||
|
|
||||||
// normalize hitpoints
|
// normalize hitpoints
|
||||||
[_vehicle] call FUNC(normalizeHitPoints);
|
[_vehicle] call FUNC(normalizeHitPoints);
|
||||||
|
@ -62,6 +62,11 @@ if (_hitPointDamageSumOld > 0) then {
|
|||||||
TRACE_5("structuralDamage",_damageOld,_damageNew,_hitPointDamageRepaired,_hitPointDamageSumOld,_realHitpointCount);
|
TRACE_5("structuralDamage",_damageOld,_damageNew,_hitPointDamageRepaired,_hitPointDamageSumOld,_realHitpointCount);
|
||||||
|
|
||||||
// set new structural damage value
|
// set new structural damage value
|
||||||
|
private _isDamageAllowed = isDamageAllowed _vehicle;
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_vehicle allowDamage true;
|
||||||
|
};
|
||||||
|
|
||||||
_vehicle setDamage [_damageNew, _useEffects];
|
_vehicle setDamage [_damageNew, _useEffects];
|
||||||
|
|
||||||
//Repair the hitpoint in the damages array:
|
//Repair the hitpoint in the damages array:
|
||||||
@ -74,3 +79,7 @@ _allHitPointDamages set [_hitPointIndex, _hitPointDamage];
|
|||||||
|
|
||||||
// normalize hitpoints
|
// normalize hitpoints
|
||||||
[_vehicle] call FUNC(normalizeHitPoints);
|
[_vehicle] call FUNC(normalizeHitPoints);
|
||||||
|
|
||||||
|
if !(_isDamageAllowed) then {
|
||||||
|
_vehicle allowDamage false;
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user