mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-19 18:06:32 +03:00
1.0.0.4 Developer Build
+ [ADDED] 30m_plot_kit as a trader only item so that server admins can control how many any the cost. + [ADDED] Building now requires a plot pole within 30 meters. + [FIXED] Building preview will now be cancelled if you get in combat. + [FIXED] When building constructioncount config variable is now used correctly. + [ADDED] Removal of some build-ables now come with a refund of parts. + [ADDED] Requirement and consumption of a M240_DZ when crafting mg240 nest. + [CHANGED] Added crowbar requirement to remove some new build-ables. + [FIXED] Removed refuel,siphon,repair,salvage from m240 nest. + [ADDED] one more non auto refuel large fuel capacity truck V3S_Refuel_TK_GUE_EP1_DZ + [ADDED] Building loot for 3 more Namalsk buildings. + [FIXED] Made sure we do not lock the mg nest and other buildables with within allvehicles. + [ADDED] Experiment with player zombie night vision. + [FIXED] Added fix to allow new storage devices to use cargo check feature. + [FIXED] offset with oil/fuel barrel should be fixed TODO: binarize + [CHANGED] Removed ammo from m240 nest, players must supply their own.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
private ["_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_isBuilding","_started","_finished","_animState","_isMedic","_startcombattimer","_dis","_sfx","_hasbuilditem","_tmpbuilt","_buildings","_onLadder","_isWater","_require","_text","_offset"];
|
||||
private ["_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_isBuilding","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_buildings","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Building already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
@@ -14,6 +14,9 @@ if(_isWater) exitWith {TradeInprogress = false; cutText [localize "str_player_26
|
||||
if(_onLadder) exitWith {TradeInprogress = false; cutText [localize "str_player_21", "PLAIN DOWN"];};
|
||||
if(player getVariable["combattimeout", 0] >= time) exitWith {TradeInprogress = false; cutText ["Cannot build while in combat.", "PLAIN DOWN"];};
|
||||
|
||||
|
||||
|
||||
|
||||
_item = _this;
|
||||
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
|
||||
_require = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
|
||||
@@ -21,6 +24,14 @@ _require = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >>
|
||||
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
||||
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
|
||||
|
||||
// Allow building of plot
|
||||
if(_classname == "Plastic_Pole_EP1_DZ") then {
|
||||
_IsNearPlot = 1;
|
||||
} else {
|
||||
_IsNearPlot = count (position player nearObjects ["Plastic_Pole_EP1_DZ",30]);
|
||||
};
|
||||
if(_IsNearPlot == 0) exitWith { TradeInprogress = false; cutText [format["Building requires plot within 30m %1",_missing] , "PLAIN DOWN"]; };
|
||||
|
||||
_missing = "";
|
||||
_hasrequireditem = true;
|
||||
{
|
||||
@@ -57,6 +68,12 @@ if (_hasrequireditem) then {
|
||||
|
||||
while {_isOk} do {
|
||||
|
||||
if (player getVariable["combattimeout", 0] >= time) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = "Cannot build while in combat.";
|
||||
};
|
||||
|
||||
cutText ["Planning consruction stand still 5 seconds to build.", "PLAIN DOWN"];
|
||||
|
||||
_location1 = getPosATL player;
|
||||
@@ -115,7 +132,7 @@ if (_hasrequireditem) then {
|
||||
_cancel = true;
|
||||
_reason = "Cannot build inside another building.";
|
||||
};
|
||||
} forEach _buildings;
|
||||
} forEach _buildings;
|
||||
|
||||
// No building in trader zones
|
||||
if(!placevault) then { _cancel = true; _reason = "Cannot build in a city."; };
|
||||
@@ -126,8 +143,8 @@ if (_hasrequireditem) then {
|
||||
|
||||
_limit = 5;
|
||||
|
||||
if(isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
|
||||
_limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount");
|
||||
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
|
||||
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
|
||||
};
|
||||
|
||||
_isOk = true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Crafting by [VB]AWOL
|
||||
* usage: spawn player_craftitem;
|
||||
*/
|
||||
private ["_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_id","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_isFireNear"];
|
||||
private ["_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_id","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_abort","_reason","_isNear","_missingTools","_hastoolweapon","_selectedRecipeTools","_distance","_crafting","_needNear"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Crafting already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
@@ -74,10 +74,16 @@ _reason = "";
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
|
||||
|
||||
_crafting = "Crafting";
|
||||
if (count _this == 2) then {
|
||||
_item = _this select 0;
|
||||
_crafting = _this select 1; // "Crafting1"
|
||||
} else {
|
||||
_item = _this;
|
||||
_crafting = "Crafting";
|
||||
};
|
||||
|
||||
// check if fire is reqired
|
||||
_needNear = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "neednearby");
|
||||
_needNear = getArray (configFile >> "cfgMagazines" >> _item >> "ItemActions" >> _crafting >> "neednearby");
|
||||
|
||||
if("fire" in _needNear) then {
|
||||
_isNear = {inflamed _x} count (position player nearObjects _distance);
|
||||
@@ -98,9 +104,10 @@ if (_canDo) then {
|
||||
|
||||
// Moved all recipes input and outputs to configs
|
||||
|
||||
_selectedRecipeOutput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "output");
|
||||
_selectedRecipeInput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "input");
|
||||
_selectedRecipeTools = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "require");
|
||||
_selectedRecipeOutput = getArray (configFile >> "cfgMagazines" >> _item >> "ItemActions" >> _crafting >> "output");
|
||||
_selectedRecipeInput = getArray (configFile >> "cfgMagazines" >> _item >> "ItemActions" >> _crafting >> "input");
|
||||
_selectedRecipeTools = getArray (configFile >> "cfgMagazines" >> _item >> "ItemActions" >> _crafting >> "requiretools");
|
||||
_consumeweapons = getArray (configFile >> "cfgMagazines" >> _item >> "ItemActions" >> _crafting >> "consumeweapons");
|
||||
|
||||
_missing = "";
|
||||
_missingTools = false;
|
||||
@@ -198,6 +205,11 @@ if (_canDo) then {
|
||||
|
||||
// Put items
|
||||
{
|
||||
// consumeweapons
|
||||
{
|
||||
player removeWeapon _x;
|
||||
} forEach _consumeweapons;
|
||||
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
diag_log format["Recipe Output: %1 %2", _itemOut,_countOut];
|
||||
@@ -205,6 +217,8 @@ if (_canDo) then {
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// get display name
|
||||
_textCreate = getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName");
|
||||
|
||||
@@ -1,243 +1,3 @@
|
||||
/*
|
||||
* Crafting by [VB]AWOL
|
||||
* usage: spawn player_craftitem;
|
||||
*/
|
||||
private ["_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_id","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_isFireNear"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Crafting already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
/*
|
||||
== Canned Foods
|
||||
"FoodCanBakedBeans",
|
||||
"FoodCanSardines",
|
||||
"FoodCanFrankBeans",
|
||||
"FoodCanPasta",
|
||||
"FoodBioMeat"
|
||||
|
||||
== Drinks
|
||||
"ItemSodaCoke",
|
||||
"ItemSodaPepsi",
|
||||
|
||||
== Trash
|
||||
"TrashTinCan",
|
||||
"TrashJackDaniels",
|
||||
"ItemSodaEmpty",
|
||||
"ItemSodaCokeEmpty",
|
||||
"ItemSodaPepsiEmpty",
|
||||
|
||||
== community stuff Trash
|
||||
"ItemSodaMdewEmpty",
|
||||
"ItemSodaMtngreenEmpty",
|
||||
"ItemSodaR4z0rEmpty",
|
||||
"ItemSodaClaysEmpty",
|
||||
"ItemSodaSmashtEmpty",.
|
||||
"ItemSodaDrwasteEmpty",.
|
||||
"ItemSodaLemonadeEmpty",.
|
||||
"ItemSodaLvgEmpty",.
|
||||
"ItemSodaMzlyEmpty",.
|
||||
"ItemSodaRabbitEmpty"
|
||||
|
||||
== Raw Meats
|
||||
"FoodSteakRaw",
|
||||
"FoodmeatRaw",
|
||||
"FoodbeefRaw",
|
||||
"FoodmuttonRaw",
|
||||
"FoodchickenRaw",
|
||||
"FoodrabbitRaw",
|
||||
"FoodbaconRaw"
|
||||
|
||||
== Cooked Meats
|
||||
"FoodSteakCooked",
|
||||
"FoodmeatCooked",
|
||||
"FoodbeefCooked",
|
||||
"FoodmuttonCooked",
|
||||
"FoodchickenCooked",
|
||||
"FoodrabbitCooked",
|
||||
"FoodbaconCooked"
|
||||
*/
|
||||
|
||||
// Removed metals:
|
||||
// _recipe_ItemBronzeBar = [[["ItemBronzeBar",1] ],[["ItemCopperBar",3],["ItemTinBar",3]]];
|
||||
|
||||
// New item ideas:
|
||||
// _recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]];
|
||||
// _recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]];
|
||||
// ItemSalt
|
||||
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
|
||||
|
||||
private["_crafting"];
|
||||
_crafting = "Crafting1";
|
||||
|
||||
// check if fire is reqired
|
||||
_needNear = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "neednearby");
|
||||
|
||||
if("fire" in _needNear) then {
|
||||
_isNear = {inflamed _x} count (position player nearObjects _distance);
|
||||
if(_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = "fire";
|
||||
};
|
||||
};
|
||||
|
||||
if(_abort) exitWith {
|
||||
cutText [format["Crafting needs a %1 within %2 meters",_reason,_distance], "PLAIN DOWN"];
|
||||
TradeInprogress = false;
|
||||
};
|
||||
|
||||
// diag_log format["Checking for fire: %1", _isFireNear];
|
||||
|
||||
if (_canDo) then {
|
||||
|
||||
// Moved all recipes input and outputs to configs
|
||||
|
||||
_selectedRecipeOutput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "output");
|
||||
_selectedRecipeInput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "input");
|
||||
_selectedRecipeTools = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "require");
|
||||
|
||||
_missing = "";
|
||||
_missingTools = false;
|
||||
{
|
||||
_hastoolweapon = _x in weapons player;
|
||||
if(!_hastoolweapon) exitWith { _missingTools = true; _missing = _x; };
|
||||
} forEach _selectedRecipeTools;
|
||||
|
||||
if(!_missingTools) then {
|
||||
|
||||
diag_log format["Selected Recipe Input: %1", _selectedRecipeInput];
|
||||
diag_log format["Selected Recipe Output: %1", _selectedRecipeOutput];
|
||||
|
||||
// Dry run to see if all parts are available.
|
||||
_proceed = true;
|
||||
{
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
|
||||
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
|
||||
|
||||
// not neccessary
|
||||
//if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
|
||||
|
||||
// match against class and parentClass
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
|
||||
|
||||
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
// If all parts proceed
|
||||
if (_proceed) then {
|
||||
|
||||
cutText ["Crafting started", "PLAIN DOWN"];
|
||||
|
||||
player playActionNow "Medic";
|
||||
|
||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||
_id = [player,50,true,(getPosATL player)] spawn 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 and !_isMedic) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
_removed_total = 0; // count total of removed items
|
||||
_tobe_removed_total = 0; // count total of all to be removed items
|
||||
// Take items
|
||||
{
|
||||
_removed = 0;
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
// diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_tobe_removed_total = _tobe_removed_total + _countIn;
|
||||
|
||||
{
|
||||
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
|
||||
_num_removed = ([player,_x] call BIS_fnc_invRemove);
|
||||
_removed = _removed + _num_removed;
|
||||
_removed_total = _removed_total + _num_removed;
|
||||
if(_num_removed >= 1) then {
|
||||
_temp_removed_array set [count _temp_removed_array,_x];
|
||||
};
|
||||
};
|
||||
|
||||
} forEach magazines player;
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
diag_log format["removed: %1 of: %2", _removed, _tobe_removed_total];
|
||||
|
||||
// Only proceed if all parts were removed successfully
|
||||
if(_removed_total == _tobe_removed_total) then {
|
||||
|
||||
// Put items
|
||||
{
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
diag_log format["Recipe Output: %1 %2", _itemOut,_countOut];
|
||||
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
};
|
||||
|
||||
// get display name
|
||||
_textCreate = getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName");
|
||||
|
||||
// Add crafted item
|
||||
cutText [format["Crafted Item: %1 x %2",_textCreate,_countOut], "PLAIN DOWN"];
|
||||
|
||||
} forEach _selectedRecipeOutput;
|
||||
|
||||
} else {
|
||||
// Refund parts since we failed
|
||||
{player addMagazine _x;} forEach _temp_removed_array;
|
||||
|
||||
cutText [format["Missing Parts after first check Item: %1 / %2",_removed_total,_tobe_removed_total], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
cutText ["Canceled crafting.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
|
||||
cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgWeapons" >> _missing >> "displayName");
|
||||
cutText [format["Missing Tool: %1",_textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
cutText ["Crafting needs a fire within 2 meters.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
TradeInprogress = false;
|
||||
[_this,_crafting] spawn player_craftitem;
|
||||
|
||||
@@ -1,243 +1,3 @@
|
||||
/*
|
||||
* Crafting by [VB]AWOL
|
||||
* usage: spawn player_craftitem;
|
||||
*/
|
||||
private ["_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_id","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_isFireNear"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Crafting already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
/*
|
||||
== Canned Foods
|
||||
"FoodCanBakedBeans",
|
||||
"FoodCanSardines",
|
||||
"FoodCanFrankBeans",
|
||||
"FoodCanPasta",
|
||||
"FoodBioMeat"
|
||||
|
||||
== Drinks
|
||||
"ItemSodaCoke",
|
||||
"ItemSodaPepsi",
|
||||
|
||||
== Trash
|
||||
"TrashTinCan",
|
||||
"TrashJackDaniels",
|
||||
"ItemSodaEmpty",
|
||||
"ItemSodaCokeEmpty",
|
||||
"ItemSodaPepsiEmpty",
|
||||
|
||||
== community stuff Trash
|
||||
"ItemSodaMdewEmpty",
|
||||
"ItemSodaMtngreenEmpty",
|
||||
"ItemSodaR4z0rEmpty",
|
||||
"ItemSodaClaysEmpty",
|
||||
"ItemSodaSmashtEmpty",.
|
||||
"ItemSodaDrwasteEmpty",.
|
||||
"ItemSodaLemonadeEmpty",.
|
||||
"ItemSodaLvgEmpty",.
|
||||
"ItemSodaMzlyEmpty",.
|
||||
"ItemSodaRabbitEmpty"
|
||||
|
||||
== Raw Meats
|
||||
"FoodSteakRaw",
|
||||
"FoodmeatRaw",
|
||||
"FoodbeefRaw",
|
||||
"FoodmuttonRaw",
|
||||
"FoodchickenRaw",
|
||||
"FoodrabbitRaw",
|
||||
"FoodbaconRaw"
|
||||
|
||||
== Cooked Meats
|
||||
"FoodSteakCooked",
|
||||
"FoodmeatCooked",
|
||||
"FoodbeefCooked",
|
||||
"FoodmuttonCooked",
|
||||
"FoodchickenCooked",
|
||||
"FoodrabbitCooked",
|
||||
"FoodbaconCooked"
|
||||
*/
|
||||
|
||||
// Removed metals:
|
||||
// _recipe_ItemBronzeBar = [[["ItemBronzeBar",1] ],[["ItemCopperBar",3],["ItemTinBar",3]]];
|
||||
|
||||
// New item ideas:
|
||||
// _recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]];
|
||||
// _recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]];
|
||||
// ItemSalt
|
||||
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
|
||||
|
||||
private["_crafting"];
|
||||
_crafting = "Crafting2";
|
||||
|
||||
// check if fire is reqired
|
||||
_needNear = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "neednearby");
|
||||
|
||||
if("fire" in _needNear) then {
|
||||
_isNear = {inflamed _x} count (position player nearObjects _distance);
|
||||
if(_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = "fire";
|
||||
};
|
||||
};
|
||||
|
||||
if(_abort) exitWith {
|
||||
cutText [format["Crafting needs a %1 within %2 meters",_reason,_distance], "PLAIN DOWN"];
|
||||
TradeInprogress = false;
|
||||
};
|
||||
|
||||
// diag_log format["Checking for fire: %1", _isFireNear];
|
||||
|
||||
if (_canDo) then {
|
||||
|
||||
// Moved all recipes input and outputs to configs
|
||||
|
||||
_selectedRecipeOutput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "output");
|
||||
_selectedRecipeInput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "input");
|
||||
_selectedRecipeTools = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "require");
|
||||
|
||||
_missing = "";
|
||||
_missingTools = false;
|
||||
{
|
||||
_hastoolweapon = _x in weapons player;
|
||||
if(!_hastoolweapon) exitWith { _missingTools = true; _missing = _x; };
|
||||
} forEach _selectedRecipeTools;
|
||||
|
||||
if(!_missingTools) then {
|
||||
|
||||
diag_log format["Selected Recipe Input: %1", _selectedRecipeInput];
|
||||
diag_log format["Selected Recipe Output: %1", _selectedRecipeOutput];
|
||||
|
||||
// Dry run to see if all parts are available.
|
||||
_proceed = true;
|
||||
{
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
|
||||
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
|
||||
|
||||
// not neccessary
|
||||
//if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
|
||||
|
||||
// match against class and parentClass
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
|
||||
|
||||
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
// If all parts proceed
|
||||
if (_proceed) then {
|
||||
|
||||
cutText ["Crafting started", "PLAIN DOWN"];
|
||||
|
||||
player playActionNow "Medic";
|
||||
|
||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||
_id = [player,50,true,(getPosATL player)] spawn 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 and !_isMedic) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
_removed_total = 0; // count total of removed items
|
||||
_tobe_removed_total = 0; // count total of all to be removed items
|
||||
// Take items
|
||||
{
|
||||
_removed = 0;
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
// diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_tobe_removed_total = _tobe_removed_total + _countIn;
|
||||
|
||||
{
|
||||
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
|
||||
_num_removed = ([player,_x] call BIS_fnc_invRemove);
|
||||
_removed = _removed + _num_removed;
|
||||
_removed_total = _removed_total + _num_removed;
|
||||
if(_num_removed >= 1) then {
|
||||
_temp_removed_array set [count _temp_removed_array,_x];
|
||||
};
|
||||
};
|
||||
|
||||
} forEach magazines player;
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
diag_log format["removed: %1 of: %2", _removed, _tobe_removed_total];
|
||||
|
||||
// Only proceed if all parts were removed successfully
|
||||
if(_removed_total == _tobe_removed_total) then {
|
||||
|
||||
// Put items
|
||||
{
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
diag_log format["Recipe Output: %1 %2", _itemOut,_countOut];
|
||||
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
};
|
||||
|
||||
// get display name
|
||||
_textCreate = getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName");
|
||||
|
||||
// Add crafted item
|
||||
cutText [format["Crafted Item: %1 x %2",_textCreate,_countOut], "PLAIN DOWN"];
|
||||
|
||||
} forEach _selectedRecipeOutput;
|
||||
|
||||
} else {
|
||||
// Refund parts since we failed
|
||||
{player addMagazine _x;} forEach _temp_removed_array;
|
||||
|
||||
cutText [format["Missing Parts after first check Item: %1 / %2",_removed_total,_tobe_removed_total], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
cutText ["Canceled crafting.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
|
||||
cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgWeapons" >> _missing >> "displayName");
|
||||
cutText [format["Missing Tool: %1",_textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
cutText ["Crafting needs a fire within 2 meters.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
TradeInprogress = false;
|
||||
[_this,_crafting] spawn player_craftitem;
|
||||
@@ -1,243 +1,3 @@
|
||||
/*
|
||||
* Crafting by [VB]AWOL
|
||||
* usage: spawn player_craftitem;
|
||||
*/
|
||||
private ["_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_id","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_isFireNear"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Crafting already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
/*
|
||||
== Canned Foods
|
||||
"FoodCanBakedBeans",
|
||||
"FoodCanSardines",
|
||||
"FoodCanFrankBeans",
|
||||
"FoodCanPasta",
|
||||
"FoodBioMeat"
|
||||
|
||||
== Drinks
|
||||
"ItemSodaCoke",
|
||||
"ItemSodaPepsi",
|
||||
|
||||
== Trash
|
||||
"TrashTinCan",
|
||||
"TrashJackDaniels",
|
||||
"ItemSodaEmpty",
|
||||
"ItemSodaCokeEmpty",
|
||||
"ItemSodaPepsiEmpty",
|
||||
|
||||
== community stuff Trash
|
||||
"ItemSodaMdewEmpty",
|
||||
"ItemSodaMtngreenEmpty",
|
||||
"ItemSodaR4z0rEmpty",
|
||||
"ItemSodaClaysEmpty",
|
||||
"ItemSodaSmashtEmpty",.
|
||||
"ItemSodaDrwasteEmpty",.
|
||||
"ItemSodaLemonadeEmpty",.
|
||||
"ItemSodaLvgEmpty",.
|
||||
"ItemSodaMzlyEmpty",.
|
||||
"ItemSodaRabbitEmpty"
|
||||
|
||||
== Raw Meats
|
||||
"FoodSteakRaw",
|
||||
"FoodmeatRaw",
|
||||
"FoodbeefRaw",
|
||||
"FoodmuttonRaw",
|
||||
"FoodchickenRaw",
|
||||
"FoodrabbitRaw",
|
||||
"FoodbaconRaw"
|
||||
|
||||
== Cooked Meats
|
||||
"FoodSteakCooked",
|
||||
"FoodmeatCooked",
|
||||
"FoodbeefCooked",
|
||||
"FoodmuttonCooked",
|
||||
"FoodchickenCooked",
|
||||
"FoodrabbitCooked",
|
||||
"FoodbaconCooked"
|
||||
*/
|
||||
|
||||
// Removed metals:
|
||||
// _recipe_ItemBronzeBar = [[["ItemBronzeBar",1] ],[["ItemCopperBar",3],["ItemTinBar",3]]];
|
||||
|
||||
// New item ideas:
|
||||
// _recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]];
|
||||
// _recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]];
|
||||
// ItemSalt
|
||||
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
|
||||
|
||||
private["_crafting"];
|
||||
_crafting = "Crafting3";
|
||||
|
||||
// check if fire is reqired
|
||||
_needNear = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "neednearby");
|
||||
|
||||
if("fire" in _needNear) then {
|
||||
_isNear = {inflamed _x} count (position player nearObjects _distance);
|
||||
if(_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = "fire";
|
||||
};
|
||||
};
|
||||
|
||||
if(_abort) exitWith {
|
||||
cutText [format["Crafting needs a %1 within %2 meters",_reason,_distance], "PLAIN DOWN"];
|
||||
TradeInprogress = false;
|
||||
};
|
||||
|
||||
// diag_log format["Checking for fire: %1", _isFireNear];
|
||||
|
||||
if (_canDo) then {
|
||||
|
||||
// Moved all recipes input and outputs to configs
|
||||
|
||||
_selectedRecipeOutput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "output");
|
||||
_selectedRecipeInput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "input");
|
||||
_selectedRecipeTools = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "require");
|
||||
|
||||
_missing = "";
|
||||
_missingTools = false;
|
||||
{
|
||||
_hastoolweapon = _x in weapons player;
|
||||
if(!_hastoolweapon) exitWith { _missingTools = true; _missing = _x; };
|
||||
} forEach _selectedRecipeTools;
|
||||
|
||||
if(!_missingTools) then {
|
||||
|
||||
diag_log format["Selected Recipe Input: %1", _selectedRecipeInput];
|
||||
diag_log format["Selected Recipe Output: %1", _selectedRecipeOutput];
|
||||
|
||||
// Dry run to see if all parts are available.
|
||||
_proceed = true;
|
||||
{
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
|
||||
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
|
||||
|
||||
// not neccessary
|
||||
//if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
|
||||
|
||||
// match against class and parentClass
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
|
||||
|
||||
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
// If all parts proceed
|
||||
if (_proceed) then {
|
||||
|
||||
cutText ["Crafting started", "PLAIN DOWN"];
|
||||
|
||||
player playActionNow "Medic";
|
||||
|
||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||
_id = [player,50,true,(getPosATL player)] spawn 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 and !_isMedic) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
_removed_total = 0; // count total of removed items
|
||||
_tobe_removed_total = 0; // count total of all to be removed items
|
||||
// Take items
|
||||
{
|
||||
_removed = 0;
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
// diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_tobe_removed_total = _tobe_removed_total + _countIn;
|
||||
|
||||
{
|
||||
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
|
||||
_num_removed = ([player,_x] call BIS_fnc_invRemove);
|
||||
_removed = _removed + _num_removed;
|
||||
_removed_total = _removed_total + _num_removed;
|
||||
if(_num_removed >= 1) then {
|
||||
_temp_removed_array set [count _temp_removed_array,_x];
|
||||
};
|
||||
};
|
||||
|
||||
} forEach magazines player;
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
diag_log format["removed: %1 of: %2", _removed, _tobe_removed_total];
|
||||
|
||||
// Only proceed if all parts were removed successfully
|
||||
if(_removed_total == _tobe_removed_total) then {
|
||||
|
||||
// Put items
|
||||
{
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
diag_log format["Recipe Output: %1 %2", _itemOut,_countOut];
|
||||
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
};
|
||||
|
||||
// get display name
|
||||
_textCreate = getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName");
|
||||
|
||||
// Add crafted item
|
||||
cutText [format["Crafted Item: %1 x %2",_textCreate,_countOut], "PLAIN DOWN"];
|
||||
|
||||
} forEach _selectedRecipeOutput;
|
||||
|
||||
} else {
|
||||
// Refund parts since we failed
|
||||
{player addMagazine _x;} forEach _temp_removed_array;
|
||||
|
||||
cutText [format["Missing Parts after first check Item: %1 / %2",_removed_total,_tobe_removed_total], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
cutText ["Canceled crafting.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
|
||||
cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgWeapons" >> _missing >> "displayName");
|
||||
cutText [format["Missing Tool: %1",_textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
cutText ["Crafting needs a fire within 2 meters.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
TradeInprogress = false;
|
||||
[_this,_crafting] spawn player_craftitem;
|
||||
@@ -1,243 +1,3 @@
|
||||
/*
|
||||
* Crafting by [VB]AWOL
|
||||
* usage: spawn player_craftitem;
|
||||
*/
|
||||
private ["_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_id","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_isFireNear"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Crafting already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
/*
|
||||
== Canned Foods
|
||||
"FoodCanBakedBeans",
|
||||
"FoodCanSardines",
|
||||
"FoodCanFrankBeans",
|
||||
"FoodCanPasta",
|
||||
"FoodBioMeat"
|
||||
|
||||
== Drinks
|
||||
"ItemSodaCoke",
|
||||
"ItemSodaPepsi",
|
||||
|
||||
== Trash
|
||||
"TrashTinCan",
|
||||
"TrashJackDaniels",
|
||||
"ItemSodaEmpty",
|
||||
"ItemSodaCokeEmpty",
|
||||
"ItemSodaPepsiEmpty",
|
||||
|
||||
== community stuff Trash
|
||||
"ItemSodaMdewEmpty",
|
||||
"ItemSodaMtngreenEmpty",
|
||||
"ItemSodaR4z0rEmpty",
|
||||
"ItemSodaClaysEmpty",
|
||||
"ItemSodaSmashtEmpty",.
|
||||
"ItemSodaDrwasteEmpty",.
|
||||
"ItemSodaLemonadeEmpty",.
|
||||
"ItemSodaLvgEmpty",.
|
||||
"ItemSodaMzlyEmpty",.
|
||||
"ItemSodaRabbitEmpty"
|
||||
|
||||
== Raw Meats
|
||||
"FoodSteakRaw",
|
||||
"FoodmeatRaw",
|
||||
"FoodbeefRaw",
|
||||
"FoodmuttonRaw",
|
||||
"FoodchickenRaw",
|
||||
"FoodrabbitRaw",
|
||||
"FoodbaconRaw"
|
||||
|
||||
== Cooked Meats
|
||||
"FoodSteakCooked",
|
||||
"FoodmeatCooked",
|
||||
"FoodbeefCooked",
|
||||
"FoodmuttonCooked",
|
||||
"FoodchickenCooked",
|
||||
"FoodrabbitCooked",
|
||||
"FoodbaconCooked"
|
||||
*/
|
||||
|
||||
// Removed metals:
|
||||
// _recipe_ItemBronzeBar = [[["ItemBronzeBar",1] ],[["ItemCopperBar",3],["ItemTinBar",3]]];
|
||||
|
||||
// New item ideas:
|
||||
// _recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]];
|
||||
// _recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]];
|
||||
// ItemSalt
|
||||
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
|
||||
|
||||
private["_crafting"];
|
||||
_crafting = "Crafting4";
|
||||
|
||||
// check if fire is reqired
|
||||
_needNear = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "neednearby");
|
||||
|
||||
if("fire" in _needNear) then {
|
||||
_isNear = {inflamed _x} count (position player nearObjects _distance);
|
||||
if(_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = "fire";
|
||||
};
|
||||
};
|
||||
|
||||
if(_abort) exitWith {
|
||||
cutText [format["Crafting needs a %1 within %2 meters",_reason,_distance], "PLAIN DOWN"];
|
||||
TradeInprogress = false;
|
||||
};
|
||||
|
||||
// diag_log format["Checking for fire: %1", _isFireNear];
|
||||
|
||||
if (_canDo) then {
|
||||
|
||||
// Moved all recipes input and outputs to configs
|
||||
|
||||
_selectedRecipeOutput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "output");
|
||||
_selectedRecipeInput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "input");
|
||||
_selectedRecipeTools = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "require");
|
||||
|
||||
_missing = "";
|
||||
_missingTools = false;
|
||||
{
|
||||
_hastoolweapon = _x in weapons player;
|
||||
if(!_hastoolweapon) exitWith { _missingTools = true; _missing = _x; };
|
||||
} forEach _selectedRecipeTools;
|
||||
|
||||
if(!_missingTools) then {
|
||||
|
||||
diag_log format["Selected Recipe Input: %1", _selectedRecipeInput];
|
||||
diag_log format["Selected Recipe Output: %1", _selectedRecipeOutput];
|
||||
|
||||
// Dry run to see if all parts are available.
|
||||
_proceed = true;
|
||||
{
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
|
||||
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
|
||||
|
||||
// not neccessary
|
||||
//if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
|
||||
|
||||
// match against class and parentClass
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
|
||||
|
||||
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
// If all parts proceed
|
||||
if (_proceed) then {
|
||||
|
||||
cutText ["Crafting started", "PLAIN DOWN"];
|
||||
|
||||
player playActionNow "Medic";
|
||||
|
||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||
_id = [player,50,true,(getPosATL player)] spawn 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 and !_isMedic) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
_removed_total = 0; // count total of removed items
|
||||
_tobe_removed_total = 0; // count total of all to be removed items
|
||||
// Take items
|
||||
{
|
||||
_removed = 0;
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
// diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_tobe_removed_total = _tobe_removed_total + _countIn;
|
||||
|
||||
{
|
||||
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
|
||||
_num_removed = ([player,_x] call BIS_fnc_invRemove);
|
||||
_removed = _removed + _num_removed;
|
||||
_removed_total = _removed_total + _num_removed;
|
||||
if(_num_removed >= 1) then {
|
||||
_temp_removed_array set [count _temp_removed_array,_x];
|
||||
};
|
||||
};
|
||||
|
||||
} forEach magazines player;
|
||||
|
||||
} forEach _selectedRecipeInput;
|
||||
|
||||
diag_log format["removed: %1 of: %2", _removed, _tobe_removed_total];
|
||||
|
||||
// Only proceed if all parts were removed successfully
|
||||
if(_removed_total == _tobe_removed_total) then {
|
||||
|
||||
// Put items
|
||||
{
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
diag_log format["Recipe Output: %1 %2", _itemOut,_countOut];
|
||||
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
};
|
||||
|
||||
// get display name
|
||||
_textCreate = getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName");
|
||||
|
||||
// Add crafted item
|
||||
cutText [format["Crafted Item: %1 x %2",_textCreate,_countOut], "PLAIN DOWN"];
|
||||
|
||||
} forEach _selectedRecipeOutput;
|
||||
|
||||
} else {
|
||||
// Refund parts since we failed
|
||||
{player addMagazine _x;} forEach _temp_removed_array;
|
||||
|
||||
cutText [format["Missing Parts after first check Item: %1 / %2",_removed_total,_tobe_removed_total], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
cutText ["Canceled crafting.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
|
||||
cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
_textMissing = getText(configFile >> "CfgWeapons" >> _missing >> "displayName");
|
||||
cutText [format["Missing Tool: %1",_textMissing], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
cutText ["Crafting needs a fire within 2 meters.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
TradeInprogress = false;
|
||||
[_this,_crafting] spawn player_craftitem;
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_target","_ent","_cnt","_index","_wound","_damage","_rnd","_move"];
|
||||
private ["_target","_ent","_rnd","_move","_isZombie"];
|
||||
_target = _this select 3;
|
||||
_ent = _target;
|
||||
|
||||
@@ -6,7 +6,7 @@ _ent = _target;
|
||||
player removeAction s_player_pzombiesattack;
|
||||
s_player_pzombiesattack = 1;
|
||||
|
||||
_rnd = round(random 9) + 1;
|
||||
_rnd = (round(random 9)) + 1;
|
||||
_move = "ZombieStandingAttack" + str(_rnd);
|
||||
player playMoveNow _move;
|
||||
|
||||
|
||||
48
dayz_code/actions/pzombie/pz_vision.sqf
Normal file
48
dayz_code/actions/pzombie/pz_vision.sqf
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
private ["_gen","_caller","_id","_NV","_NVOn","_OldAperture"];
|
||||
_gen = _this select 0;
|
||||
_caller = _this select 1;
|
||||
_id = _this select 2;
|
||||
|
||||
_gen removeAction _id;
|
||||
|
||||
_NV = player getvariable "NV";
|
||||
_NVOn = (_NV select 0);
|
||||
_OldAperture = (_NV select 1);
|
||||
|
||||
if(_NVOn == "ON")
|
||||
exitwith
|
||||
{
|
||||
setaperture -1;
|
||||
ppEffectDestroy ppColor;
|
||||
ppEffectDestroy ppBlur;
|
||||
player setvariable ["NV",["OFF",_oldAperture]];
|
||||
player addAction ["Night Vision", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 0, false, true, "nightVision", "_this == _target"];
|
||||
};
|
||||
|
||||
ppEffectDestroy ppColor;
|
||||
ppEffectDestroy ppBlur;
|
||||
|
||||
ppColor = ppEffectCreate ["ColorCorrections", 1999];
|
||||
ppColor ppEffectEnable true;
|
||||
ppColor ppEffectAdjust [1, 1, 0, [0.4, 1, 0.4, 0], [0.4, 1, 0.4, 0.0], [0.4, 1, 0.4, 1.0]];
|
||||
ppColor ppEffectCommit 0;
|
||||
|
||||
ppBlur = ppEffectCreate ["dynamicBlur", 505];
|
||||
ppBlur ppEffectEnable true;
|
||||
ppBlur ppEffectAdjust [.2];
|
||||
ppBlur ppEffectCommit 0;
|
||||
|
||||
aperture = 0.0001;
|
||||
while { aperture < _oldAperture } do
|
||||
{
|
||||
aperture = aperture + 0.0005;
|
||||
setAperture aperture;
|
||||
sleep 0.001;
|
||||
};
|
||||
|
||||
|
||||
player setVariable ["NV", ["ON", _oldAperture]];
|
||||
|
||||
player addAction ["Vision", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 0, false, true, "nightVision", "_this == _target"];
|
||||
exit;
|
||||
@@ -2,7 +2,7 @@
|
||||
delete object from db with extra waiting by [VB]AWOL
|
||||
parameters: _obj
|
||||
*/
|
||||
private ["_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_id","_objType"];
|
||||
private ["_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_id","_objType","_sfx","_dis","_itemOut","_countOut","_textCreate","_selectedRemoveOutput"];
|
||||
_obj = _this select 3;
|
||||
_objectID = _obj getVariable ["ObjectID","0"];
|
||||
_objectUID = _obj getVariable ["ObjectUID","0"];
|
||||
@@ -82,6 +82,24 @@ if (_proceed) then {
|
||||
publicVariableServer "dayzDeleteObj";
|
||||
|
||||
deleteVehicle _obj;
|
||||
|
||||
// give refund items
|
||||
_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
|
||||
if((count _selectedRemoveOutput) > 0) then {
|
||||
// Put items
|
||||
{
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
diag_log format["Removal Output: %1 %2", _itemOut,_countOut];
|
||||
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
};
|
||||
|
||||
} forEach _selectedRemoveOutput;
|
||||
cutText ["De-constructed parts are now in your inventory.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
private["_obj","_bag","_pos"];
|
||||
private["_obj"];
|
||||
_obj = _this select 3;
|
||||
_obj spawn player_packTent;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private["_position","_tent","_location","_isOk","_backpack","_tentType","_trg","_key"];
|
||||
private ["_tent","_location","_isOk","_cancel","_location3","_location4","_location1","_location2","_counter","_pondPos","_isPond","_ppos","_hastentitem","_dir","_id","_building","_isBuilding","_playerPos","_item","_offset_x","_offset_y","_offset_z","_offset_z_attach","_config","_text","_tmpvault","_vault_location","_objectsPond"];
|
||||
//check if can pitch here
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Vault pitching already in progress." , "PLAIN DOWN"]; };
|
||||
|
||||
Reference in New Issue
Block a user