Add thaw script

Made by @Victor-the-Cleaner
This commit is contained in:
A Man
2022-04-19 19:34:19 +02:00
parent 6ccf68c6aa
commit 911b455ae6
3 changed files with 103 additions and 11 deletions

View File

@@ -0,0 +1,74 @@
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
player removeAction s_player_boil;
player removeAction s_player_cook;
player removeAction s_player_thaw;
a_player_thaw = true;
//s_player_thaw = -1;
local _wasStanding = ["perc", animationState player] call fnc_inString;
local _alert = [player, getPosATL player, 10, "cook"];
local _foodArr = []; // [["classname",idx],["classname",idx]];
local _drinkArr = []; // [["classname",idx],["classname",idx]];
{ // build array(s) of frozen food & drink classes
call {
local _foodIdx = DZE_frozenFood find _x;
if (_foodIdx > -1) exitWith {_foodArr set [count _foodArr, [DZE_frozenFood select _foodIdx, _foodIdx]];};
local _drinkIdx = DZE_frozenDrink find _x;
if (_drinkIdx > -1) exitWith {_drinkArr set [count _drinkArr, [DZE_frozenDrink select _drinkIdx, _drinkIdx]];};
};
} count (magazines player);
local _qtyFood = count _foodArr;
local _qtyDrink = count _drinkArr;
local _finished = true;
scopeName "main";
// Thaw Frozen Food
if (_qtyFood > 0) then {
_alert spawn fnc_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {};
{
local _thawedFood = (DZE_thawedFood select (_x select 1)) call BIS_fnc_selectRandom; // refund
local _removed = [player, _x select 0] call BIS_fnc_invRemove;
if (_removed == 0) then {
_finished = false;
breakTo "main";
};
player addMagazine _thawedFood;
} forEach _foodArr;
format [localize (["STR_SUCCESS_THAWED_FOOD1","STR_SUCCESS_THAWED_FOOD2"] select (_qtyFood > 1)), _qtyFood] call dayz_rollingMessages;
};
// Thaw Frozen Drink
if (_qtyDrink > 0 && _finished) then {
_alert spawn fnc_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {};
{
local _thawedDrink = (DZE_thawedDrink select (_x select 1)) call BIS_fnc_selectRandom; // refund
local _removed = [player, _x select 0] call BIS_fnc_invRemove;
if (_removed == 0) then {
_finished = false;
breakTo "main";
};
player addMagazine _thawedDrink;
} forEach _drinkArr;
format [localize (["STR_SUCCESS_THAWED_DRINK1","STR_SUCCESS_THAWED_DRINK2"] select (_qtyDrink > 1)), _qtyDrink] call dayz_rollingMessages;
};
if (!_finished) then {
localize "STR_EPOCH_ACTION_CANCELED" call dayz_rollingMessages;
} else {
if (_wasStanding) then {
player playActionNow "PlayerStand"; // once the action has completed, return player to a standing pose if they were standing before the action
};
};
a_player_thaw = false;
dayz_actionInProgress = false;

View File

@@ -338,22 +338,28 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
s_player_siphonfuel = -1;
};
//Fireplace Actions check
if ((_cursorTarget call isInflamed) or (inflamed _cursorTarget)) then {
// Fireplace Actions Check
if ((inflamed _cursorTarget) || {_cursorTarget call isInflamed}) then {
local _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
local _hasunboiledwater = {_x in ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"]} count _magazinesPlayer > 0;
local _hasUnboiledWater = {_x in DZE_unboiledWater} count _magazinesPlayer > 0;
local _hasFrozenFoods = {_x in DZE_frozenFoods} count _magazinesPlayer > 0;
//Cook Meat
// Cook Meat
if (_hasRawMeat && !a_player_cooking) then {
if (s_player_cook < 0) then {
s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true];
s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf", _cursorTarget, 3, true, true];
};
};
//Boil Water
if (_hasunboiledwater && !a_player_boil) then {
// Boil Water
if (_hasUnboiledWater && !a_player_boil) then {
if (s_player_boil < 0) then {
s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true];
s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf", _cursorTarget, 3, true, true];
};
};
// Thaw Frozen Food
if (_hasFrozenFoods && !a_player_thaw) then {
if (s_player_thaw < 0) then {
s_player_thaw = player addAction [localize "STR_ACTIONS_THAW_FROZEN", "\z\addons\dayz_code\actions\thaw.sqf", _cursorTarget, 3, true, true];
};
};
} else {
@@ -365,6 +371,10 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
player removeAction s_player_boil;
s_player_boil = -1;
};
if (a_player_thaw) then {
player removeAction s_player_thaw;
s_player_thaw = -1;
};
};
// Remove Object
@@ -1068,6 +1078,8 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
s_player_cook = -1;
player removeAction s_player_boil;
s_player_boil = -1;
player removeAction s_player_thaw;
s_player_thaw = -1;
player removeAction s_player_packtent;
s_player_packtent = -1;
player removeAction s_player_packtentinfected;

View File

@@ -143,6 +143,7 @@ if (!isDedicated) then {
s_player_fire = -1;
s_player_cook = -1;
s_player_boil = -1;
s_player_thaw = -1;
s_player_packtent = -1;
s_player_packtentinfected = -1;
s_player_fillfuel = -1;
@@ -161,8 +162,6 @@ if (!isDedicated) then {
s_player_fishing_veh = -1;
s_player_gather = -1;
s_player_destroytent = -1;
// Epoch Additions
s_player_packvault = -1;
s_player_lockvault = -1;
s_player_unlockvault = -1;
@@ -244,6 +243,7 @@ if (!isDedicated) then {
// General Variables
a_player_cooking = false;
a_player_boil = false;
a_player_thaw = false;
dayz_actionInProgress = false;
dayz_DisplayGenderSelect = true;
carryClick = false;
@@ -296,6 +296,12 @@ if (!isDedicated) then {
DayZ_fuelSources = ["Land_Ind_TankSmall","Land_fuel_tank_big","Land_fuel_tank_stairs","Land_fuel_tank_stairs_ep1","Land_wagon_tanker","Land_fuelstation","Land_fuelstation_army","Land_smd_fuelstation_army","land_fuelstation_w","Land_benzina_schnell","Fueltank_DZE"];
dayz_plantOutput = ["FoodPumpkin","FoodSunFlowerSeed","ItemKiloHemp","FoodPumpkin","FoodSunFlowerSeed","FoodPotatoRaw","FoodCarrot","ItemKiloHemp","ItemKiloBlackTea","ItemTobaccoLeafs","equip_garlic_bulb","equip_comfreyleafs"];
dayz_plantTypes = ["","MAP_pumpkin","MAP_p_Helianthus","fiberplant"] + DZE_Plants;
DZE_frozenFood = ["FoodCanFrozen1","FoodCanFrozen2"];
DZE_thawedFood = [["FoodCanDog1","FoodCanUnlabeled"],["FoodCanDog2","FoodCanRusUnlabeled"]]; // paired with DZE_frozenFood. Must have a corresponding equal number of elements, or optional comma separated arrays for randomization.
DZE_frozenDrink = ["ItemWaterBottleFrozen","ItemPlasticWaterBottleFrozen","ItemSodaFrozen1","ItemSodaFrozen2"];
DZE_thawedDrink = [["ItemWaterBottle"],["ItemPlasticWaterBottle"],["ItemSodaCoke"],["ItemSodaPepsi"]]; // paired with DZE_frozenDrink. Must have a corresponding equal number of elements, or optional comma separated arrays for randomization.
DZE_frozenFoods = DZE_frozenFood + DZE_frozenDrink;
DZE_unboiledWater = ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"];
DZE_LockableStorage = DZE_LockedStorage + DZE_UnLockedStorage;
DZE_UpgradableStorage = ["StorageShed_DZ","WoodShack_DZ","Wooden_shed_DZ","GunRack_DZ","WoodCrate_DZ","VaultStorageLocked","LockboxStorageLocked","LockboxStorageWinterLocked"];
DZE_LockboxesUnlocked = ["LockboxStorage","LockboxStorage2","LockboxStorageWinter","LockboxStorageWinter2"];