Vehicle Damage - Add turret tossing again (#9989)

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
This commit is contained in:
johnb432 2024-06-22 20:08:43 +02:00 committed by GitHub
parent f45dff8a09
commit 56016a4816
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 25 deletions

View File

@ -31,26 +31,14 @@
["Car", "init", LINKFUNC(addEventHandler), true, [], true] call CBA_fnc_addClassEventHandler;
};
// blow off turret effect
/*
Disabled temporarily due to issues with being able to repair tanks after death. Needs work
*/
/*["Tank", "killed", {
if (random 1 < 0.15) then {
// Blow off turret effect
// TODO: Add blowing-off-turret effect to vehicles that cook-off but aren't destroyed (no catastrophic explosion)
// The problem is that vehicles are repairable if they haven't been destroyed. So if the turret is gone and vehicle is repaired, how do we handle that?
["Tank", "Killed", {
if (_this select 3 && random 1 < 0.15) then {
(_this select 0) call FUNC(blowOffTurret);
};
}, true, [], true] call CBA_fnc_addClassEventHandler;*/
// event to add a turret to a curator if the vehicle already belonged to that curator
if (isServer) then {
[QGVAR(addTurretToEditable), {
params ["_vehicle", "_turret"];
{
_x addCuratorEditableObjects [[_turret], false];
} forEach (objectCurators _vehicle);
}] call CBA_fnc_addEventHandler;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
};
// init eject from destroyed vehicle

View File

@ -4,7 +4,7 @@
* Blow off turret effect.
*
* Arguments:
* 0: Vehicle <Object>
* 0: Vehicle <OBJECT>
*
* Return Value:
* None
@ -15,13 +15,12 @@
* Public: No
*/
// delayed so the object is spawned after the model changes to a wreck
// the sudden change in the model would cause nearby physx objects to get stuck
// Delayed so the object is spawned after the model changes to a wreck
// The sudden change in the model would cause nearby PhysX objects to get stuck
[{
params ["_vehicle"];
private _config = _vehicle call CBA_fnc_getObjectConfig;
getArray (_config >> QGVAR(turret)) params [["_model", "", [""]], ["_offset", [0,0,0], [[]], 3]];
(getArray (configOf _vehicle >> QGVAR(turret))) params [["_model", "", [""]], ["_offset", [0, 0, 0], [[]], 3]];
if (_model isEqualTo "") exitWith {};
@ -31,6 +30,8 @@
_turret setVectorUp [random 1, random 1, 1];
_turret setVelocity [random 7, random 7, 8 + random 5];
// add turret to all curators that already own the wreck
[QGVAR(addTurretToEditable), [_vehicle, _turret]] call CBA_fnc_serverEvent;
// Add turret to all curators that already own the wreck
if (["ace_zeus"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(zeus,addObjects), [[_turret], objectCurators _vehicle]] call CBA_fnc_serverEvent;
};
}, _this, 1] call CBA_fnc_waitAndExecute;