Actions Done

This commit is contained in:
icomrade
2016-02-29 10:45:53 -05:00
parent a47c3dc137
commit b667d01c1c
27 changed files with 1958 additions and 1094 deletions

View File

@@ -1,90 +1,101 @@
private ["_item","_hasKnife","_hasKnifeBlunt","_hasHarvested","_qty","_text","_string","_type","_started","_finished","_animState","_isMedic","_isListed","_config"];
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"]; };
DZE_ActionInProgress = true;
player removeAction s_player_butcher;
s_player_butcher = 1;
_item = _this select 3;
_hasKnife = "ItemKnife" in items player;
_hasKnifeBlunt = "ItemKnifeBlunt" in items player;
_type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];
_config = configFile >> "CfgSurvival" >> "Meat" >> _type;
_config = configFile >> "CfgSurvival" >> "Meat" >> _type;
if ((_hasKnife || _hasKnifeBlunt) && !_hasHarvested) then {
//Get Animal Type
_isListed = isClass (_config);
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
_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"]};
//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 { cutText [localize "str_cannotgut", "PLAIN DOWN"] };
if ((count _knifeArray > 0) and !_hasHarvested) then {
private ["_qty"];
[1,1] call dayz_HungerThirst;
// force animation
//Select random can from array
_activeKnife = _knifeArray call BIS_fnc_selectRandom;
//Get Animal Type
_isListed = isClass (_config);
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
player playActionNow "Medic";
// Alert zombies
[player,10,true,(getPosATL player)] spawn player_alertZombies;
_dis=10;
_sfx = "gut";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] call player_alertZombies;
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
while {r_doLoop} do {
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if (_isMedic) then {
_started = true;
};
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
uiSleep 0.1;
};
r_doLoop = false;
// Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
if (!_finished) exitWith {
r_interrupt = false;
if (vehicle player == player) then {
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
cutText [(localize "str_epoch_player_30") , "PLAIN DOWN"];
//_abort = true;
_item setVariable ["meatHarvested",true,true];
_qty = 2;
if (_isListed) then {
_qty = getNumber (_config >> "yield");
};
_hasHarvested = _item getVariable["meatHarvested",false];
if(_finished && !_hasHarvested) then {
if (_activeKnife == "ItemKnifeBlunt") then { _qty = round(_qty / 2); };
_item setVariable["meatHarvested",true,true];
// Play sound since we finished
[player,"gut",0,false,10] call dayz_zombieSpeak;
_qty = 2;
if (_isListed) then {
_qty = getNumber (_config >> "yield");
};
if (_hasKnifeBlunt) then { _qty = round(_qty / 2); };
if (local _item) then {
[_item,_qty] spawn local_gutObject;
} else {
//Leave this as PV instead of PVS/PVC - Skaronator
PVDZE_plr_GutBody =[_item,_qty];
publicVariable "PVDZE_plr_GutBody";
};
if (local _item) then {
[_item,_qty] spawn local_gutObject; //leave as spawn (sleeping in loops will work but can freeze the script)
} else {
PVDZE_plr_GutBody =[_item,_qty];
publicVariable "PVDZE_plr_GutBody";
_string = format[localize "str_success_gutted_animal",_text,_qty];
cutText [_string, "PLAIN DOWN"];
//achievement system
if (!achievement_Gut) then {
achievement_Gut = true;
};
};
//_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;
};
}; */
uisleep 6;
_string = format[localize "str_success_gutted_animal",_text,_qty];
closedialog 0;
uisleep 0.02;
//cutText [_string, "PLAIN DOWN"];
_string call dayz_rollingMessages;
};
s_player_butcher = -1;
DZE_ActionInProgress = false;