Move some addActions to config UserActions

Should improve client FPS while still allowing conditions and scripts to
be customized.

Some special vehicles like MV22, UH1Y, etc. have UserActions overwritten
in their configs, so please let me know if you find any others that do
not get the option to repair or salvage because UserActions is
overwritten in their config. I think I got them all.

Vanilla commits:

a8c4238c0c

350d73abe1
This commit is contained in:
ebaydayz
2016-11-20 19:47:10 -05:00
parent ef1ad261e2
commit 3aad4b61e9
34 changed files with 320 additions and 259 deletions

View File

@@ -1,17 +1,21 @@
private ["_item","_type","_hasHarvested","_config","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_sharpnessRemaining","_qty","_chance","_string"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_29" call dayz_rollingMessages;};
private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_sharpnessRemaining","_qty","_chance","_string","_isZombie","_humanity"];
_isZombie = _this isKindOf "zZombie_base";
if (dayz_actionInProgress) exitWith {
if (_isZombie) then {
localize "str_epoch_player_31" call dayz_rollingMessages;
} else {
localize "str_epoch_player_29" call dayz_rollingMessages;
};
};
dayz_actionInProgress = true;
_item = _this select 3;
_item = _this;
_type = typeOf _item;
_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 {localize "str_pickup_limit_5" call dayz_rollingMessages; dayz_actionInProgress = false;};
@@ -22,8 +26,14 @@ if (_PlayerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessag
};
} count Dayz_Gutting;
if ((count _knifeArray) < 1) exitWith { localize "str_cannotgut" call dayz_rollingMessages; dayz_actionInProgress = false; };
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 {
private "_qty";
@@ -32,7 +42,7 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
_activeKnife = _knifeArray call BIS_fnc_selectRandom;
//Get Animal Type
_isListed = isClass _config;
_isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type);
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
player playActionNow "Medic";
@@ -46,7 +56,7 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
_item setVariable ["meatHarvested",true,true];
_qty = if (_isListed) then {getNumber (_config >> "yield")} else {2};
_qty = if (_isListed) then {getNumber (configFile >> "CfgSurvival" >> "Meat" >> _type >> "yield")} else {2};
if (_activeKnife == "ItemKnifeBlunt") then { _qty = round(_qty / 2); };
if (local _item) then {
@@ -83,7 +93,15 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
};
uiSleep 6;
_string = format[localize "str_success_gutted_animal",_text,_qty];
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;