mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Remove the PVCDZ_obj_HideBody eventhandler. Players next to a hided animal see the hiding process too and after 10s the body will be deleted anyways. So there is no need to send a publicVariableServer first then back to all near clients if the body gets deleted within 10s. Also updates the normal hide body. The hided player model gets deleted by the server now.
77 lines
2.5 KiB
Plaintext
77 lines
2.5 KiB
Plaintext
private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_qty","_string","_isZombie","_humanity","_finished"];
|
|
|
|
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
|
dayz_actionInProgress = true;
|
|
|
|
_item = _this;
|
|
_type = typeOf _item;
|
|
_isZombie = _type isKindOf "zZombie_base";
|
|
_hasHarvested = _item getVariable["meatHarvested",false];
|
|
|
|
_knifeArray = [];
|
|
|
|
_PlayerNear = {isPlayer _x} count ((getPosATL _item) nearEntities ["CAManBase", 12]) > 1;
|
|
if (_PlayerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessages; dayz_actionInProgress = false;};
|
|
|
|
//Count how many active tools the player has
|
|
{
|
|
if (_x IN items player) then {
|
|
_knifeArray set [count _knifeArray, _x];
|
|
};
|
|
} count Dayz_Gutting;
|
|
|
|
if ((count _knifeArray) < 1) exitWith {
|
|
if (_isZombie) then {
|
|
format[localize "str_missing_to_do_this",localize "STR_EQUIP_NAME_4"] call dayz_rollingMessages;
|
|
} else {
|
|
localize "str_cannotgut" call dayz_rollingMessages;
|
|
};
|
|
dayz_actionInProgress = false;
|
|
};
|
|
|
|
if ((count _knifeArray > 0) and !_hasHarvested) then {
|
|
//Use sharpest knife player has
|
|
_activeKnife = _knifeArray select 0;
|
|
|
|
//Get Animal Type
|
|
_isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type);
|
|
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
|
|
|
|
[player,(getPosATL player),10,"gut"] spawn fnc_alertZombies;
|
|
|
|
_finished = ["Medic",1] call fn_loopAction;
|
|
if (!_finished) exitWith {};
|
|
|
|
// Added Nutrition-Factor for work
|
|
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
|
|
|
_item setVariable ["meatHarvested",true,true];
|
|
|
|
_qty = if (_isListed) then {getNumber (configFile >> "CfgSurvival" >> "Meat" >> _type >> "yield")} else {2};
|
|
if (_activeKnife == "ItemKnifeBlunt") then { _qty = round(_qty / 2); };
|
|
|
|
if (local _item) then {
|
|
[_item,_qty] spawn local_gutObject; //leave as spawn (sleeping in loops will work but can freeze the script)
|
|
} else {
|
|
PVCDZ_obj_GutBody =[_item,_qty];
|
|
publicVariable "PVCDZ_obj_GutBody";
|
|
};
|
|
|
|
["knives",0.2] call fn_dynamicTool;
|
|
|
|
if (_isZombie) then {
|
|
// Reduce humanity for gutting zeds
|
|
_humanity = player getVariable ["humanity",0];
|
|
_humanity = _humanity - 10;
|
|
player setVariable ["humanity",_humanity,true];
|
|
_string = format[localize "str_success_gutted_zombie",_text]; //%1 has been gutted, zombie parts are now on the carcass
|
|
} else {
|
|
_string = format[localize "str_success_gutted_animal",_text,_qty];
|
|
};
|
|
closeDialog 0;
|
|
uiSleep 0.02;
|
|
_string call dayz_rollingMessages;
|
|
};
|
|
|
|
dayz_actionInProgress = false;
|