mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-20 18:36:29 +03:00
0.9 + pre 1.7.5
This commit is contained in:
@@ -1,25 +1,21 @@
|
||||
private ["_onLadder","_item","_config","_text","_regen","_display","_control","_bloodVal","_ctrlBlood","_rndInfection","_cookedfood","_hasfooditem","_EatInfection","_id"];
|
||||
private["_onLadder","_item","_hasfooditem","_rawfood","_cookedfood","_config","_text","_regen","_id","_display"];
|
||||
disableserialization;
|
||||
call gear_ui_init;
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
_cookedfood = _item in ["FoodSteakCooked","FoodmuttonCooked","FoodchickenCooked","FoodRabbitCooked","FoodBaconCooked","FoodBioMeat"];
|
||||
|
||||
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
|
||||
|
||||
if (vehicle player != player) exitWith {cutText ["You may not eat while in a vehicle", "PLAIN DOWN"]};
|
||||
|
||||
//Force players to wait 3 mins to eat again
|
||||
//if (dayz_lastMeal < 180) exitWith {cutText ["You may not eat, you're already full", "PLAIN DOWN"]};
|
||||
|
||||
_item = _this;
|
||||
_hasfooditem = _this in magazines player;
|
||||
_hasfooditem = _item in magazines player;
|
||||
|
||||
if (_item == "FoodBioMeat") then {
|
||||
_rndInfection = (random 7);
|
||||
} else {
|
||||
_rndInfection = (random 15);
|
||||
};
|
||||
|
||||
_EatInfection = (_rndInfection < 1);
|
||||
//_rawfood = _item in ["FoodSteakRaw","FoodmeatRaw","FoodbeefRaw","FoodmuttonRaw","FoodchickenRaw","FoodrabbitRaw","FoodbaconRaw"];
|
||||
//_cookedfood = _item in ["FoodSteakCooked","FoodmeatCooked","FoodbeefCooked","FoodmuttonCooked","FoodchickenCooked","FoodrabbitCooked","FoodbaconCooked"];
|
||||
_rawfood = _item in meatraw;
|
||||
_cookedfood = item in meatcooked;
|
||||
|
||||
_config = configFile >> "CfgMagazines" >> _item;
|
||||
_text = getText (_config >> "displayName");
|
||||
@@ -27,14 +23,6 @@ _regen = getNumber (_config >> "bloodRegen");
|
||||
|
||||
if (!_hasfooditem) exitWith {cutText [format[(localize "str_player_31"),_text,"consume"] , "PLAIN DOWN"]};
|
||||
|
||||
if (_EatInfection and _cookedfood) then {
|
||||
r_player_infected = true;
|
||||
player setVariable["USEC_infected",true];
|
||||
};
|
||||
|
||||
//Rawtime = getVarable _item
|
||||
//_Cookedtime = _item getVariable ["timemeatCooked", time];
|
||||
|
||||
player playActionNow "PutDown";
|
||||
player removeMagazine _item;
|
||||
sleep 1;
|
||||
@@ -45,6 +33,17 @@ if (dayz_lastMeal < 3600) then {
|
||||
};
|
||||
};
|
||||
|
||||
if ( _rawfood and (random 15 < 1)) then {
|
||||
r_player_infected = true;
|
||||
player setVariable["USEC_infected",true];
|
||||
};
|
||||
|
||||
[player,"eat",0,false] call dayz_zombieSpeak;
|
||||
|
||||
if (!_rawfood and !_cookedfood) then{
|
||||
player addMagazine "TrashTinCan";
|
||||
};
|
||||
|
||||
r_player_blood = r_player_blood + _regen;
|
||||
if (r_player_blood > r_player_bloodTotal) then {
|
||||
r_player_blood = r_player_bloodTotal;
|
||||
@@ -54,26 +53,18 @@ player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
|
||||
player setVariable["USEC_BloodQty",r_player_blood,true];
|
||||
player setVariable["medForceUpdate",true];
|
||||
|
||||
[player,"eat",0,false] call dayz_zombieSpeak;
|
||||
/*
|
||||
_update = player getVariable["updatePlayer",[false,false,false,false,false]];
|
||||
_update set [3,true];
|
||||
player setVariable["updatePlayer",_update,true];
|
||||
*/
|
||||
["dayzPlayerSave",[player,[],true]] call callRpcProcedure;
|
||||
|
||||
dayz_lastMeal = time;
|
||||
dayz_hunger = 0;
|
||||
|
||||
_id = [player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
_id = [player,5,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
//Ensure Control is visible
|
||||
_display = uiNamespace getVariable 'DAYZ_GUI_display';
|
||||
_control = _display displayCtrl 1301;
|
||||
_control ctrlShow true;
|
||||
(_display displayCtrl 1301) ctrlShow true;
|
||||
|
||||
_bloodVal = r_player_blood / r_player_bloodTotal;
|
||||
if (_bloodVal >= 0.2) then {
|
||||
_ctrlBlood ctrlShow true;
|
||||
if (r_player_blood / r_player_bloodTotal >= 0.2) then {
|
||||
(_display displayCtrl 1300) ctrlShow true;
|
||||
};
|
||||
cutText [format[(localize "str_player_consumed"),_text], "PLAIN DOWN"];
|
||||
Reference in New Issue
Block a user