mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
Replaced vehicle sethit/setvariable method with sethit/gethit and removed setvariable "Hit_" commands for vehicles (hit_partname can now probably be added to the setvariable filters list). Modified object_getHit.sqf return to now provide the selection name in order to reduce redundant config lookups. Returns '[Damage, Part Name]', instead of just 'Damage' Modified vehicle_GetHitpoints.sqf to remove incorrect hipoints from returning. Previously this script would return all hitpoints from any vehicle the current vehicle config inherited from, even if the hitpoint didn't exist in the calling vehicle. this posed a problem since getHit on an invalid part name returns Nil
50 lines
1.6 KiB
Plaintext
50 lines
1.6 KiB
Plaintext
/*
|
|
Created exclusively for ArmA2:OA - DayZMod.
|
|
Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com)
|
|
*/
|
|
|
|
/***********************************************************
|
|
ASSIGN DAMAGE TO A UNIT.
|
|
Called by "HandleDamage" vehicle Event Handler
|
|
or by "PVCDZ_veh_SH" PV
|
|
or by zombie_attack
|
|
|
|
- Function fnc_veh_handleDam
|
|
- [unit, selectionName, damage, source, projectile, broadcast] call fnc_veh_handleDam;
|
|
- return : updated damage for that part
|
|
broadcast: boolean. if true, then the request will be sent to all players if the vehicle is not local.
|
|
************************************************************/
|
|
private["_unit","_selection","_total","_damage","_needUpdate","_totalDmg"];
|
|
|
|
_unit = _this select 0;
|
|
_selection = _this select 1;
|
|
_total = _this select 2;
|
|
_totalDmg = if (_selection != "") then {false} else {true};
|
|
|
|
if (_total >= 0.98) then {
|
|
_total = 1.0;
|
|
};
|
|
|
|
if (local _unit) then {
|
|
if (_total > 0) then {
|
|
_unit setHit [_selection, _total];
|
|
|
|
PVDZ_veh_Save = [_unit,"damage",false,_totalDmg];
|
|
if (!isServer) then {
|
|
publicVariableServer "PVDZ_veh_Save";
|
|
} else {
|
|
PVDZ_veh_Save call server_updateObject;
|
|
};
|
|
};
|
|
} else {
|
|
//if ( (count _this > 5) AND {(_this select 5)}) then {
|
|
// vehicle is not local to this client, ask the client which vehicle is local to set damage
|
|
//_this resize 5; // delete "broadcast" boolean
|
|
PVDZ_send = [_unit,"VehHandleDam",_this];
|
|
publicVariableServer "PVDZ_send";
|
|
//};
|
|
};
|
|
|
|
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
|
|
_total
|