mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 11:42:38 +03:00
Add new unit_setFractures function to handle better broken bones
- Removes old object_setHit - Double checks if global broken bone variables are properly set after changing clothes. - This should finally fix broken bones after changing clothes.
This commit is contained in:
@@ -15,6 +15,8 @@ _old addEventHandler ["HandleDamage", {0}];
|
||||
//Logout
|
||||
local _humanity = player getVariable ["humanity",0];
|
||||
local _medical = player call player_sumMedical;
|
||||
local _legsBroken = r_fracture_legs;
|
||||
local _armsBroken = r_fracture_arms;
|
||||
local _worldspace = [round(direction player),getPosATL player];
|
||||
local _zombieKills = player getVariable ["zombieKills",0];
|
||||
local _headShots = player getVariable ["headShots",0];
|
||||
@@ -59,7 +61,7 @@ if (count _medical > 0) then {
|
||||
player setVariable ["blood_type",(_medical select 11),true];
|
||||
player setVariable ["rh_factor",(_medical select 12),true];
|
||||
player setVariable ["messing",(_medical select 13),true];
|
||||
player setVariable ["blood_testdone",(_medical select 14),true];
|
||||
player setVariable ["blood_testdone",(_medical select 14),true];
|
||||
|
||||
//Add Wounds
|
||||
{
|
||||
@@ -71,14 +73,12 @@ if (count _medical > 0) then {
|
||||
|
||||
//Add fractures
|
||||
local _fractures = _medical select 9;
|
||||
// player setVariable ["hit_legs",(_fractures select 0),true];
|
||||
// player setVariable ["hit_hands",(_fractures select 1),true];
|
||||
[player,"legs",(_fractures select 0)] call object_setHit;
|
||||
[player,"hands",(_fractures select 1)] call object_setHit;
|
||||
[player,"legs",(_fractures select 0),_legsBroken,_armsBroken] call unit_setFractures;
|
||||
[player,"hands",(_fractures select 1),_legsBroken,_armsBroken] call unit_setFractures;
|
||||
} else {
|
||||
//Reset Fractures
|
||||
player setVariable ["hit_legs",0,true];
|
||||
player setVariable ["hit_hands",0,true];
|
||||
[player,"legs",0,false,false] call unit_setFractures;
|
||||
[player,"hands",0,false,false] call unit_setFractures;
|
||||
player setVariable ["USEC_injured",false,true];
|
||||
player setVariable ["USEC_inPain",false,true];
|
||||
};
|
||||
|
||||
15
SQF/dayz_code/compile/unit_setFractures.sqf
Normal file
15
SQF/dayz_code/compile/unit_setFractures.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
local _unit = _this select 0;
|
||||
local _selection = _this select 1;
|
||||
local _damage = _this select 2;
|
||||
local _fracture_legs = _this select 3;
|
||||
local _fracture_arms = _this select 4;
|
||||
|
||||
local _fracture = "hit_" + _selection;
|
||||
|
||||
// Setting damage directly. Do not get the damage from the new unit first. This damage has to be 0. If not the new unit broke its legs in debug. If we add it with the damage the old unit had before, it will result in broken bones even the player had no broken bones before.
|
||||
_unit setVariable [_fracture,_damage,true];
|
||||
_unit setHit [_selection,_damage];
|
||||
|
||||
// This makes sure that even when the player broke his legs during changing clothes the fracture variables getting properly resetted.
|
||||
r_fracture_legs = _fracture_legs;
|
||||
r_fracture_arms = _fracture_arms;
|
||||
@@ -764,7 +764,6 @@ fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\
|
||||
fnc_getPos = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_getPos.sqf";
|
||||
fnc_spawnObjects = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_spawnObjects.sqf";
|
||||
object_getHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_getHit.sqf"; //gets the hit value for a HitPoint (i.e. HitLegs) against the selection (i.e. "legs"), returns the value
|
||||
object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
|
||||
object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records and sets hit)
|
||||
|
||||
fn_vehicleAddons = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_vehicleAddons.sqf";
|
||||
@@ -784,6 +783,7 @@ local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\comp
|
||||
local_setFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
|
||||
local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
|
||||
player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf"; //New
|
||||
unit_setFractures = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\unit_setFractures.sqf"; //set fractures on players
|
||||
player_bloodCalc = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\bloodCalc.sqf";
|
||||
fn_selectRandomLocation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomLocation.sqf";
|
||||
fn_addCargo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_addCargo.sqf";
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
private ["_msg","_unit","_medic","_item"];
|
||||
local _unit = _this select 0;
|
||||
local _medic = _this select 1;
|
||||
local _item = _this select 2;
|
||||
local _displayName = getText(configFile >> "CfgMagazines" >> _item >> "displayName");
|
||||
|
||||
_unit = _this select 0;
|
||||
_medic = _this select 1;
|
||||
_item = _this select 2;
|
||||
|
||||
r_fracture_legs = false;
|
||||
r_fracture_arms = false;
|
||||
_unit setHit["legs",0];
|
||||
_unit setHit["hands",0];
|
||||
_unit setVariable ["hit_legs",0,true];
|
||||
_unit setVariable ["hit_hands",0,true];
|
||||
[_unit,"legs",0,false,false] call unit_setFractures;
|
||||
[_unit,"hands",0,false,false] call unit_setFractures;
|
||||
|
||||
if (_medic != player) then {
|
||||
_msg = if (_item == "equip_woodensplint") then {"STR_ITEM_NAME_WOODENSPLINT"} else {"STR_EQUIP_NAME_15"};
|
||||
format [localize "str_actions_medical_general_received",(name _medic), localize _msg] call dayz_rollingMessages;
|
||||
};
|
||||
format [localize "str_actions_medical_general_received",(name _medic),_displayName] call dayz_rollingMessages;
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user