mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
It makes no sense to rename the identical DayZ PVs to have an E in their name. I don't see any good reason it was done in the first place. All it accomplishes is breaking script compatibility between the two mods and requiring different publicvariable.txt filters. The only time it makes sense is for custom Epoch variables that aren't used in vanilla. All admins have to do to update custom scripts is swap the names according to the change log. Note I've submitted a pull request to replace PVDZ_veh_Save with PVDZ_obj_Save in official too because they are duplicates.
63 lines
2.0 KiB
Plaintext
63 lines
2.0 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)
|
|
*/
|
|
|
|
/***********************************************************
|
|
REPAIR A PART OF A UNIT.
|
|
Called by "PVDZ_veh_SF" PV
|
|
or by action/repair.sqf
|
|
|
|
- Function fnc_veh_handleRepair
|
|
- [unit, selectionName, damage, broadcast] call fnc_veh_handleRepair;
|
|
- return : 0 :)
|
|
broadcast: boolean. if true, then the request will be sent to all players if the vehicle is not local.
|
|
************************************************************/
|
|
private ["_hitpointnames","_log","_damage","_action"];
|
|
|
|
_unit = _this select 0;
|
|
_selection = _this select 1;
|
|
_damage = _this select 2;
|
|
_action = if (_damage == 0) then {"repair"} else {"damage"};
|
|
|
|
_hitpointnames = [];
|
|
{
|
|
_hitpointnames set [count _hitpointnames, getText (configFile >> "CfgVehicles" >> (typeOf _unit) >> "HitPoints" >> _x >> "name")];
|
|
} forEach (_unit call vehicle_getHitpoints);
|
|
|
|
if ((isNil "_selection") OR {(!(_selection in _hitpointnames))}) exitWith {_this select 2};
|
|
|
|
_SVname = "hit_" + _selection;
|
|
|
|
_log = format["%1 vehicle:%2#%3 part:""%4"" current_part_damage:%5", __FILE__,
|
|
typeOf _unit, _unit getVariable ["ObjectID",""],
|
|
_selection, _unit getVariable [_SVname, 0] ];
|
|
|
|
if (local _unit) then {
|
|
// only local unit can set the damage of a vehicle part
|
|
_unit setVariable [_SVname, _damage, true];
|
|
_unit setHit [_selection, _damage];
|
|
_log = format["%1. setH!t[%2,0]", _log, _selection];
|
|
|
|
if (!isServer) then {
|
|
PVDZ_obj_Save = [_unit, _action];
|
|
publicVariableServer "PVDZ_obj_Save";
|
|
_log = _log + ". Requesting server hive write";
|
|
} else {
|
|
[_unit, _action] call server_updateObject;
|
|
_log = _log + ". Writing to hive";
|
|
};
|
|
} else {
|
|
if ((count _this > 3) && {(_this select 3)}) then {
|
|
// vehicle is not local to this client, ask the client which vehicle is local to set damage
|
|
_this resize 3; // delete "broadcast" boolean
|
|
_log = _log + ". Broadcasting to all";
|
|
PVDZ_veh_SF = _this;
|
|
publicVariable "PVDZ_veh_SF";
|
|
};
|
|
};
|
|
|
|
//diag_log _log;
|
|
|
|
0
|