mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-04 15:22:53 +03:00
Update combat handling
- Remove startcombattimer variable - Add combatNoTimeout variable to handle a combat without a time limit
This commit is contained in:
@@ -115,7 +115,7 @@ if (r_player_unconscious) then {
|
||||
};
|
||||
|
||||
//Lets make sure the player is looking at the target
|
||||
if (isPlayer cursorTarget) then {
|
||||
if (isPlayer cursorTarget && _hasPatient) then {
|
||||
if (!r_player_unconscious && !_inVehicle && {!r_drag_sqf && !r_action && player distance _menClose < 3}) then {
|
||||
local _unit = cursorTarget;
|
||||
player reveal _unit;
|
||||
@@ -153,109 +153,107 @@ if (isPlayer cursorTarget) then {
|
||||
};
|
||||
|
||||
local _vehClose = (getPosATL player) nearEntities [["Car","Tank","Helicopter","Plane","StaticWeapon","Ship"],5];
|
||||
local _action = [];
|
||||
|
||||
//Allow player to drag
|
||||
if(_unconscious && !_dragged) then {
|
||||
r_action = true;
|
||||
local _action1 = _unit addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\openGear.sqf",_unit, 0, true, true];
|
||||
local _action2 = _unit addAction [localize "str_actions_medical_01", "\z\addons\dayz_code\medical\drag.sqf",_unit, 0, true, true];
|
||||
local _action3 = _unit addAction [localize "str_actions_medical_02", "\z\addons\dayz_code\medical\pulse.sqf",_unit, 0, true, true];
|
||||
local _action4 = _unit addAction [localize "str_actions_medical_drag", "\z\addons\dayz_code\medical\carry.sqf",_unit, 0, true, true];
|
||||
|
||||
if (_hasPatient) then {
|
||||
local _action = [];
|
||||
//Allow player to drag
|
||||
if(_unconscious && !_dragged) then {
|
||||
r_action = true;
|
||||
local _action1 = _unit addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\openGear.sqf",_unit, 0, true, true];
|
||||
local _action2 = _unit addAction [localize "str_actions_medical_01", "\z\addons\dayz_code\medical\drag.sqf",_unit, 0, true, true];
|
||||
local _action3 = _unit addAction [localize "str_actions_medical_02", "\z\addons\dayz_code\medical\pulse.sqf",_unit, 0, true, true];
|
||||
local _action4 = _unit addAction [localize "str_actions_medical_drag", "\z\addons\dayz_code\medical\carry.sqf",_unit, 0, true, true];
|
||||
|
||||
r_player_actions set [count r_player_actions, _action1];
|
||||
r_player_actions set [count r_player_actions, _action2];
|
||||
r_player_actions set [count r_player_actions, _action3];
|
||||
r_player_actions set [count r_player_actions, _action4];
|
||||
};
|
||||
//Load Vehicle
|
||||
if (_unconscious && {(count _vehClose > 0) && !locked (_vehClose select 0)}) then {
|
||||
r_action = true;
|
||||
local _vehicle = _vehClose select 0;
|
||||
local _vehType = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
_action = _unit addAction [format[localize "str_actions_medical_03",_vehType], "\z\addons\dayz_code\medical\load\load_act.sqf",[player,_vehicle,_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions, _action1];
|
||||
r_player_actions set [count r_player_actions, _action2];
|
||||
r_player_actions set [count r_player_actions, _action3];
|
||||
r_player_actions set [count r_player_actions, _action4];
|
||||
};
|
||||
//Load Vehicle
|
||||
if (_unconscious && {(count _vehClose > 0) && !locked (_vehClose select 0)}) then {
|
||||
r_action = true;
|
||||
local _vehicle = _vehClose select 0;
|
||||
local _vehType = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
_action = _unit addAction [format[localize "str_actions_medical_03",_vehType], "\z\addons\dayz_code\medical\load\load_act.sqf",[player,_vehicle,_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to bandage
|
||||
if(_injured && _hasBandage) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemBandage"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give sepsis bandage
|
||||
if((_injured || _hasSepsis) && _hasSepsisBandage) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_04_sepsis", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemSepsisBandage"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give antibacterial wipe
|
||||
if(_hasSepsis && _hasABWipes) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_04_wipes", "\z\addons\dayz_code\medical\wipes.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give Epinephrine
|
||||
if(_unconscious && _hasEpi) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_05", "\z\addons\dayz_code\medical\epinephrine.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give Morphine
|
||||
if((_legsBroke || _armsBroke) && _hasMorphine) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_06", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"ItemMorphine"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give equip_woodensplint
|
||||
if((_legsBroke || _armsBroke) && _hasSplint) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_06_splint", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"equip_woodensplint"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give Painkillers
|
||||
if(_inPain && _hasPainkillers) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_07", "\z\addons\dayz_code\medical\painkiller.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to transfuse blood
|
||||
if(_lowBlood && _hasBloodBag) then {
|
||||
r_action = true;
|
||||
if (dayz_classicBloodBagSystem) then {
|
||||
_action = _unit addAction [localize "str_actions_medical_08", "\z\addons\dayz_code\medical\transfusion.sqf",[_unit,"ItemBloodbag"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
} else {
|
||||
local _tempArray = [];
|
||||
{ // This was a TODO by the Vanilla Mod devs.
|
||||
if (_x in _playerMagazines && {!(_x in _tempArray)}) then {
|
||||
local _displayName = getText(configFile >> "cfgMagazines" >> _x >> "displayName");
|
||||
_action = _unit addAction [format[localize "str_actions_medical_08a",_displayName], "\z\addons\dayz_code\medical\transfusion.sqf",[_unit,_x], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
_tempArray set [count _tempArray, _x];
|
||||
};
|
||||
} count _bloodBags;
|
||||
};
|
||||
//Allow player to bandage
|
||||
if(_injured && _hasBandage) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemBandage"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give sepsis bandage
|
||||
if((_injured || _hasSepsis) && _hasSepsisBandage) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_04_sepsis", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemSepsisBandage"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give antibacterial wipe
|
||||
if(_hasSepsis && _hasABWipes) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_04_wipes", "\z\addons\dayz_code\medical\wipes.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give Epinephrine
|
||||
if(_unconscious && _hasEpi) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_05", "\z\addons\dayz_code\medical\epinephrine.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give Morphine
|
||||
if((_legsBroke || _armsBroke) && _hasMorphine) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_06", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"ItemMorphine"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give equip_woodensplint
|
||||
if((_legsBroke || _armsBroke) && _hasSplint) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_06_splint", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"equip_woodensplint"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to give Painkillers
|
||||
if(_inPain && _hasPainkillers) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_07", "\z\addons\dayz_code\medical\painkiller.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Allow player to transfuse blood
|
||||
if(_lowBlood && _hasBloodBag) then {
|
||||
r_action = true;
|
||||
if (dayz_classicBloodBagSystem) then {
|
||||
_action = _unit addAction [localize "str_actions_medical_08", "\z\addons\dayz_code\medical\transfusion.sqf",[_unit,"ItemBloodbag"], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
} else {
|
||||
local _tempArray = [];
|
||||
{ // This was a TODO by the Vanilla Mod devs.
|
||||
if (_x in _playerMagazines && {!(_x in _tempArray)}) then {
|
||||
local _displayName = getText(configFile >> "cfgMagazines" >> _x >> "displayName");
|
||||
_action = _unit addAction [format[localize "str_actions_medical_08a",_displayName], "\z\addons\dayz_code\medical\transfusion.sqf",[_unit,_x], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
_tempArray set [count _tempArray, _x];
|
||||
};
|
||||
} count _bloodBags;
|
||||
};
|
||||
};
|
||||
//Allow player to give antibiotics
|
||||
if (_infected && _hasAntibiotics) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_give_antibiotics", "\z\addons\dayz_code\medical\antibiotics.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions, _action];
|
||||
};
|
||||
_isFriendly = [player, _unit] call FNC_check_access;
|
||||
if !(_isFriendly select 1) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
if (r_action) then {
|
||||
r_action_targets set [(count r_action_targets), _unit];
|
||||
};
|
||||
if (r_action_unload) then {
|
||||
r_action_unload = false;
|
||||
call fnc_usec_medic_removeActions;
|
||||
};
|
||||
};
|
||||
//Allow player to give antibiotics
|
||||
if (_infected && _hasAntibiotics) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction [localize "str_actions_medical_give_antibiotics", "\z\addons\dayz_code\medical\antibiotics.sqf",[_unit], 0, true, true];
|
||||
r_player_actions set [count r_player_actions, _action];
|
||||
};
|
||||
_isFriendly = [player, _unit] call FNC_check_access;
|
||||
if !(_isFriendly select 1) then {
|
||||
r_action = true;
|
||||
_action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
if (r_action) then {
|
||||
r_action_targets set [(count r_action_targets), _unit];
|
||||
};
|
||||
if (r_action_unload) then {
|
||||
r_action_unload = false;
|
||||
call fnc_usec_medic_removeActions;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user