Actions cleanup

This commit is contained in:
ebaydayz
2016-03-29 14:47:28 -04:00
parent e1a0bfebc1
commit 71b975b05e
38 changed files with 330 additions and 503 deletions

View File

@@ -1,58 +1,43 @@
private ["_item", "_type", "_hasHarvested", "_config", "_knifeArray", "_PlayerNear", "_isListed", "_activeKnife", "_text", "_dis", "_sfx", "_sharpnessRemaining"];
if (DZE_ActionInProgress) exitWith {cutText [localize "str_epoch_player_29","PLAIN DOWN"];};
private ["_item","_type","_hasHarvested","_config","_knifeArray","_playerNear","_isListed","_activeKnife","_text","_sharpnessRemaining","_qty","_chance","_msg","_string"];
if (DZE_ActionInProgress) exitWith {cutText [localize "str_epoch_player_31","PLAIN DOWN"];};
DZE_ActionInProgress = true;
_item = _this select 3;
_type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];
_hasHarvested = _item getVariable ["meatHarvested",false];
_config = configFile >> "CfgSurvival" >> "Meat" >> _type;
_knifeArray = [];
player removeAction s_player_butcher;
s_player_butcher = -1;
_PlayerNear = {isPlayer _x} count ((getPosATL _item) nearEntities ["CAManBase", 10]) > 1;
if (_PlayerNear) exitWith {cutText [localize "str_pickup_limit_5", "PLAIN DOWN"]};
_playerNear = {isPlayer _x} count ((getPosATL _item) nearEntities ["CAManBase", 10]) > 1;
if (_playerNear) exitWith {cutText [localize "str_pickup_limit_5","PLAIN DOWN"]; DZE_ActionInProgress = false;};
//Count how many active tools the player has
{
if (_x IN items player) then {
_knifeArray set [count _knifeArray, _x];
};
if (_x in items player) then {_knifeArray set [count _knifeArray, _x];};
} count Dayz_Gutting;
if ((count _knifeArray) < 1) exitwith { cutText [localize "str_cannotgut", "PLAIN DOWN"] };
if ((count _knifeArray) < 1) exitWith {cutText [localize "str_cannotgut","PLAIN DOWN"]; DZE_ActionInProgress = false; };
if ((count _knifeArray > 0) and !_hasHarvested) then {
private ["_qty"];
if ((count _knifeArray > 0) && !_hasHarvested) then {
private "_qty";
//Select random can from array
_activeKnife = _knifeArray call BIS_fnc_selectRandom;
//Get Animal Type
_isListed = isClass (_config);
//Get Zombie Type
_isListed = isClass _config;
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
player playActionNow "Medic";
_dis=10;
_sfx = "gut";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] call player_alertZombies;
// Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
[player,"gut",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] call player_alertZombies;
["Working",0,[20,40,15,0]] call dayz_NutritionSystem; // Added Nutrition-Factor for work
_item setVariable ["meatHarvested",true,true];
_qty = 2;
if (_isListed) then {
_qty = getNumber (_config >> "yield");
};
_qty = if (_isListed) then {getNumber (_config >> "yield")} else {2};
if (_activeKnife == "ItemKnifeBlunt") then { _qty = round(_qty / 2); };
if (local _item) then {
@@ -62,39 +47,38 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
publicVariable "PVDZE_plr_GutBodyZ";
};
//_sharpnessRemaining = getText (configFile >> "cfgWeapons" >> _activeKnife >> "sharpnessRemaining");
/* switch _activeKnife do {
case "ItemKnife" : {
//_chance = getNumber (configFile >> "cfgWeapons" >> _activeKnife >> "chance");
if ([0.2] call fn_chance) then {
if (dayz_knifeDulling) then {
_sharpnessRemaining = getText (configFile >> "cfgWeapons" >> _activeKnife >> "sharpnessRemaining");
switch _activeKnife do {
case "ItemKnife" : {
//_chance = getNumber (configFile >> "cfgWeapons" >> _activeKnife >> "chance");
if ([0.2] call fn_chance) then {
player removeWeapon _activeKnife;
player addWeapon _sharpnessRemaining;
//systemChat (localize "str_info_bluntknife");
_msg = localize "str_info_bluntknife";
_msg call dayz_rollingMessages;
};
};
case "ItemKnifeBlunt" : {
//do nothing
};
default {
player removeWeapon _activeKnife;
player addWeapon _sharpnessRemaining;
//systemChat (localize "str_info_bluntknife");
_msg = localize "str_info_bluntknife";
_msg call dayz_rollingMessages;
};
};
};
case "ItemKnifeBlunt" : {
//do nothing
};
default {
player removeWeapon _activeKnife;
player addWeapon _sharpnessRemaining;
};
}; */
};
// Reduce humanity for gutting zeds
_humanity = player getVariable["humanity",0];
_humanity = player getVariable ["humanity",0];
_humanity = _humanity - 10;
player setVariable["humanity",_humanity,true];
player setVariable ["humanity",_humanity,true];
uisleep 6;
_string = format["Successfully Gutted Zombie",_text,_qty];
//cutText [_string, "PLAIN DOWN"];
closedialog 0;
uisleep 0.02;
uiSleep 6;
_string = format[localize "str_success_gutted_animal",_text,_qty]; //%1 has been gutted, %2 meat steaks now on the carcass
closeDialog 0;
uiSleep 0.02;
//cutText [_string, "PLAIN DOWN"];
_string call dayz_rollingMessages;
};