1.0.0.3 Developer Build

+ [FIXED] Battleye kick when calling dog. Thanks to @kikyou2
+ [FIXED] Moved vehicle event handler to server side with a call to all
connected clients. Before it was just set on only the owner and the
server. This should fix issues with damage/repair handling of just
purchased vehicles.
+ [FIXED] Fixed case sensitivity in building loot generation. This was
only a problem on new maps that share the same buildings as others yet
have differing case in the classnames.
+ [ADDED] New build-ables: Fence_corrugated_DZ, M240Nest_DZ,
CanvasHut_DZ, ParkBench_DZ, MetalGate_DZ, OutHouse_DZ, Wooden_shed_DZ,
WoodShack_DZ, StorageShed_DZ.
+ [ADDED] New crafting items: ItemCanvas, PartWoodLumber,
PartWoodPlywood, ItemCorrugated, ItemPole
+ [ADDED] 55 gallon (210 liter) Fuel Barrel that can only be used on
helicopters or fuel trucks.
+ [ADDED] All DayZ specific magazine items now only take one slot, this
also makes it easier to become over burdened so be careful about
blacking out.
+ [ADDED] More building loot spawn positions for Namalsk.
+ [FIXED] When packing tent get classname of new weapon_holder from
config.
+ [CHANGED] Totally reworked player building system. Preview and
placement accuracy has been significantly improved. Building now
requires X number of stages to complete. Players cannot build while in
combat.
+ [CHANGED] Added required tools array and is nearby checking for fire,
etc. Also, each item can now have 5 separate crafting options.
+ [CHANGED] Reworked refuel and siphon code to support more can types.
+ [CHANGED] Removed all infinite fueling sources and added
(KamazRefuel_DZ, UralRefuel_TK_EP1_DZ,MtvrRefuel_DES_EP1_DZ) variants of
the fuel trucks to remove auto refuel and increase siphon-able fuel
capacity to 10000.  Old style refuel can still be used if the variable
dayz_oldrefuel = true is set in the missions init.sqf.
+ [CHANGED] Remove object code now uses config variables instead of hard
coded into sqf (default: constructioncount = 5)
+ [CHANGED] Moved most arrays for revealing objects, allowed objects,
update objects, disallowed combat roll to arrays within variables.sqf.
So that these arrays are unified and easier to change.
+ [CHANGED] New vehicle spawns now have a new fuel system using a random
percent between min and max variables. Defaults: (DynamicVehicleFuelLow
= 0; DynamicVehicleFuelHigh = 100;)
+ [CHANGED] New vehicle spawns now damage all parts and without a
limiter on fuel and engine parts, this could cause a vehicle to be very
close to blowing up.
+ [CHANGED] Disabled simulation server side of all road debris and
crashes.
This commit is contained in:
vbawol
2013-04-17 10:04:34 -05:00
parent 3bc0bbca37
commit 211415389f
40 changed files with 2351 additions and 569 deletions

View File

@@ -4,7 +4,7 @@ class CfgMagazines {
class ItemTentDomed : CA_Magazine {
scope = public;
count = 1;
type = (256 * 3);
type = 256;
displayName = $STR_EQUIP_NAME_20;
model = "\dayz_equip\models\tentbag_gear.p3d";
picture = "\dayz_equip\textures\equip_tentbag_ca.paa";
@@ -32,16 +32,28 @@ class CfgMagazines {
class Build {
text = "Build Sandbag";
script = "spawn player_build;";
require = "ItemEtool";
require[] = {"ItemEtool"};
create = "Sandbag1_DZ";
};
class Crafting
{
text = "Craft Large Sandbag";
script = "spawn player_craftItem;";
neednearby[] = {};
requiretools[] = {"ItemEtool","ItemToolbox"};
output[] = {{"ItemSandbagLarge",1}};
input[] = {{"ItemSandbag",3},{"ItemWire",1},{"ItemTankTrap",1}};
};
class Crafting1
{
text = "Craft M240 Nest";
script = "spawn player_craftItem1;";
neednearby[] = {};
requiretools[] = {"ItemEtool","ItemToolbox"};
output[] = {{"m240_nest_kit",1}};
input[] = {{"ItemSandbag",4},{"ItemCanvas",1},{"PartWoodPlywood",4},{"PartWoodLumber",3}};
// TODO add consume weapon
};
};
};
@@ -58,7 +70,7 @@ class CfgMagazines {
class Build {
text = "Build H-barrier cube";
script = "spawn player_build;";
require = "ItemEtool";
require[] = {"ItemEtool"};
create = "Land_HBarrier1_DZ";
};
};
@@ -77,7 +89,7 @@ class CfgMagazines {
class Build {
text = $STR_ACTIONS_BUILD;
script = "spawn player_build;";
require = "ItemToolbox";
require[] = {"ItemToolbox"};
create = "Hedgehog_DZ";
};
};
@@ -96,7 +108,7 @@ class CfgMagazines {
class Build {
text = "Place Trap";
script = "spawn player_setTrap;";
require = "ItemToolbox";
require[] = {"ItemToolbox"};
create = "BearTrap_DZ";
};
};
@@ -115,7 +127,7 @@ class CfgMagazines {
class Build {
text = $STR_ACTIONS_BUILD;
script = "spawn player_build;";
require = "ItemToolbox";
require[] = {"ItemToolbox"};
create = "Fort_RazorWire";
};
};

View File

@@ -10,7 +10,12 @@ class CfgWeapons {
libtextdesc = "Debug Map - Admin use only";
};
};
class ItemSmeltingKit: ItemCore {
displayname = "Smelting Kit";
};
class ItemAnvil: ItemCore {
displayname = "Anvil";
};
class ItemCompass: ItemCore {
model="z\addons\dayz_communityassets\models\compass.p3d";
};

View File

@@ -18,10 +18,11 @@ _cookedmeat = meatcooked;
_removed = 0;
if (_meat in magazines player) then {
_text = getText (configFile >> "CfgMagazines" >> _meatcooked >> "displayName");
cutText [format["Started cooking %1 of %2",_qty,_text], "PLAIN DOWN"];
_qty = {_x == _meat} count magazines player;
_qty = {_x == _meat} count magazines player;
cutText [format["Started cooking %1",_text], "PLAIN DOWN"];
player playActionNow "Medic";
_dis=6;
@@ -69,7 +70,7 @@ _cookedmeat = meatcooked;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText [format["Canceled cooking %1 of %2",_qty,_text], "PLAIN DOWN"];
cutText [format["Canceled cooking %1",_text], "PLAIN DOWN"];
// player addMagazine "ItemBandage";
};

View File

@@ -1,127 +1,219 @@
private["_location","_isOk","_dir","_classname","_item"];
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"];
if(TradeInprogress) exitWith { cutText ["Building already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater _location) or dayz_isSwimming;
_bypass = false;
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
_cancel = false;
_reason = "";
// call gear_ui_init;
call gear_ui_init;
if(_isWater) exitWith {cutText [localize "str_player_26", "PLAIN DOWN"];};
if(_onLadder) exitWith {cutText [localize "str_player_21", "PLAIN DOWN"];};
if(_isWater) exitWith {TradeInprogress = false; cutText [localize "str_player_26", "PLAIN DOWN"];};
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 = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "require");
_require = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_attachToOffset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
_hasbuilditem = _this in magazines player;
_hasrequireditem = _require in items player;
_missing = "";
_hasrequireditem = true;
{
_hastoolweapon = _x in weapons player;
if(!_hastoolweapon) exitWith { _hasrequireditem = false; _missing = _x; }
} forEach _require;
if (!_hasbuilditem) exitWith {cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]};
if (_text == "TrapBear") then { _bypass = true; };
_hasbuilditem = _this in magazines playwer;
if (!_hasbuilditem) exitWith {TradeInprogress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };
if (_hasrequireditem or _bypass) then {
_dir = getDir player;
if (!_hasrequireditem) exitWith {TradeInprogress = false; cutText [format["Missing tool %1",_missing] , "PLAIN DOWN"]; };
if (_hasrequireditem) then {
_location = [0,0,0];
_dir = getDir player;
// Start Preview loop
_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_tmpbuilt setdir _dir;
_tmpbuilt attachTo [player,_attachToOffset];
player allowDamage false;
_position = player modeltoworld _offset;
_position = [(_position select 0),(_position select 1), 0];
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object setDir _dir;
_object setPos _position;
_object allowDamage false;
_object attachTo [player];
_cancel = false;
_counter = 0;
_isOk = true;
while {_isOk} do {
if(_counter == 0) then {
cutText ["Planning consruction stand still 5 seconds to build.", "PLAIN DOWN"];
sleep 5;
_location1 = getPosATL player;
sleep 5;
_location2 = getPosATL player;
if(_location1 distance _location2 < 0.1) exitWith {
cutText ["Started consruction move within 5 seconds to cancel.", "PLAIN DOWN"];
_location3 = getPosATL player;
sleep 5;
_location4 = getPosATL player;
cutText ["Planning consruction stand still 5 seconds to build.", "PLAIN DOWN"];
_location1 = getPosATL player;
sleep 5;
_location2 = getPosATL player;
if(_location3 distance _location4 > 0.1) exitWith {
_isOk = false;
_cancel = true;
};
_isOk = false;
};
if(_location1 distance _location2 < 0.1) exitWith {
_isOk = false;
};
if(_counter >= 1) exitWith {
if(_location1 distance _location2 > 5) exitWith {
_isOk = false;
_cancel = true;
_reason = "Moving to fast.";
};
if(_counter >= 10) exitWith {
_isOk = false;
_cancel = true;
_reason = "Ran out of time to find position.";
};
_counter = _counter + 1;
};
detach _tmpbuilt;
detach _object;
deleteVehicle _object;
// Get location of detached tmp built
_built_location = (getPosATL _tmpbuilt);
deleteVehicle _tmpbuilt;
// Start Build
_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_dir = getDir player;
_tmpbuilt setdir _dir;
// Get position based on player
_location = player modeltoworld _offset;
// No building on roads
if (isOnRoad _location) then { _cancel = true; _reason = "Cannot build on a road."; };
// set building with ground
_location = [(_location select 0),(_location select 1), 0];
_tmpbuilt setpos _location;
// set building with offset
// _tmpbuilt setpos _location;
player allowDamage true;
// testing new way of finding building
_buildings = nearestObjects [(vehicle player), ["Building"], 100];
{
_isBuilding = [(vehicle player),_x] call fnc_isInsideBuilding;
if(_isBuilding) exitWith {
_cancel = true;
_reason = "Cannot build inside another building.";
};
} forEach _buildings;
// No building in trader zones
if(!placevault) then { _cancel = true; _reason = "Cannot build in a city."; };
if(!_cancel) then {
_dir = getDir player;
player removeMagazine _item;
//disableSerialization;
//call dayz_forceSave;
player playActionNow "Medic";
sleep 1;
_dis=20;
_sfx = "repair";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
cutText [format["Placing %1, move to cancel.",_text], "PLAIN DOWN"];
_hasbuilditem = _this in magazines player;
if (!_hasbuilditem) exitWith {cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]};
_limit = 5;
player allowDamage false;
_object = createVehicle [_classname, _built_location, [], 0, "CAN_COLLIDE"];
_object setDir _dir;
_object setpos _built_location;
player reveal _object;
if(isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount");
};
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
_isOk = true;
_proceed = false;
_counter = 0;
while {_isOk} do {
player playActionNow "Medic";
_dis=20;
_sfx = "repair";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
//["dayzPublishObj",[dayz_characterID,_object,[_dir,_location],_classname]] call callRpcProcedure;
dayzPublishObj = [dayz_characterID,_object,[_dir,_location],_classname];
publicVariableServer "dayzPublishObj";
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 or (player getVariable["combattimeout", 0] >= time)) then {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
sleep 2;
player allowDamage true;
if(!_finished) exitWith {
_isOk = false;
_proceed = false;
};
if(_finished) then {
_counter = _counter + 1;
};
cutText [format["Constructing %1 stage %2 of %3, move to cancel.",_text, _counter,_limit], "PLAIN DOWN"];
if(_counter == _limit) exitWith {
_isOk = false;
_proceed = true;
};
};
if (_proceed) then {
_num_removed = ([player,_item] call BIS_fnc_invRemove);
if(_num_removed == 1) then {
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
//["dayzPublishObj",[dayz_characterID,_tmpbuilt,[_dir,_location],_classname]] call callRpcProcedure;
dayzPublishObj = [dayz_characterID,_tmpbuilt,[_dir,_location],_classname];
publicVariableServer "dayzPublishObj";
} else {
deleteVehicle _tmpbuilt;
cutText ["Canceled building." , "PLAIN DOWN"];
};
} else {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
deleteVehicle _tmpbuilt;
cutText ["Canceled building." , "PLAIN DOWN"];
};
} else {
cutText [format["Canceled construction of %1.",_text], "PLAIN DOWN"];
deleteVehicle _tmpbuilt;
cutText [format["Canceled construction of %1 %2.",_text,_reason], "PLAIN DOWN"];
};
} else {
cutText [format[localize "str_build_failed_01",_text], "PLAIN DOWN"];
};
TradeInprogress = false;

View File

@@ -67,143 +67,174 @@ TradeInprogress = true;
// 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);
// reqire fire target
// TODO: add requirements to config. example: fire nearby, specific toolbelt items like toolbox.
_isFireNear = {inflamed _x} count (position player nearObjects 2);
_crafting = "Crafting";
diag_log format["Checking for fire: %1", _isFireNear];
// check if fire is reqired
_needNear = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "neednearby");
if (_isFireNear >= 1 and _canDo) then {
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");
_selectedRecipeOutput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "output");
_selectedRecipeInput = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "input");
_selectedRecipeTools = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> _crafting >> "require");
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;
_missing = "";
_missingTools = false;
{
_itemIn = _x select 0;
_countIn = _x select 1;
_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];
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
// not neccessary
//if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
// 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;
// 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; };
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
} forEach _selectedRecipeInput;
} forEach _selectedRecipeInput;
// If all parts proceed
if (_proceed) then {
// If all parts proceed
if (_proceed) then {
cutText ["Crafting started", "PLAIN DOWN"];
cutText ["Crafting started", "PLAIN DOWN"];
player playActionNow "Medic";
player playActionNow "Medic";
[player,"repair",0,false] call dayz_zombieSpeak;
_id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
[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 {
r_interrupt = false;
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if (_isMedic) then {
_started = true;
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;
};
if (_started and !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
r_doLoop = false;
if (_finished) then {
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
_removed_total = 0; // count total of removed items
_tobe_removed_total = 0; // count total of all to be removed items
// Take 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");
_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;
// Add crafted item
cutText [format["Crafted Item: %1 x %2",_textCreate,_countOut], "PLAIN DOWN"];
{
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 _selectedRecipeOutput;
} 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 {
// 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"];
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText ["Canceled crafting.", "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 >> "CfgMagazines" >> _missing >> "displayName");
cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
_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"];

View File

@@ -0,0 +1,243 @@
/*
* 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);
_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;

View File

@@ -0,0 +1,243 @@
/*
* 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);
_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;

View File

@@ -0,0 +1,243 @@
/*
* 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);
_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;

View File

@@ -0,0 +1,243 @@
/*
* 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);
_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;

View File

@@ -1,116 +1,146 @@
private["_vehicle","_curFuel","_newFuel","_timeLeft"];
_vehicle = cursorTarget;
private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_location1","_location2","_abort","_canName","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCan","_configVeh","_capacity","_nameText","_availableCansEmpty","_availableCans"];
if(TradeInprogress) exitWith { cutText ["Refuel already in progress." , "PLAIN DOWN"] };
TradeInprogress = true;
// Use target from addaction
_vehicle = _this select 0;
_fillCounter = 0;
_abort = false;
_canSize = getNumber(configFile >> "cfgMagazines" >> "ItemJerrycan" >> "fuelQuantity");
// Static vehicle fuel information
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
_capacity = getNumber(_configVeh >> "fuelCapacity");
_nameType = getText(_configVeh >> "displayName");
_nameText = getText(_configVeh >> "displayName");
// _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
_availableCans = ["ItemJerrycan","ItemFuelBarrel"];
// Get number of full jerry cans
_refuelQty = {_x == "ItemJerrycan"} count magazines player;
// Loop to find containers that can could hold fuel and fill them
{
_configCan = configFile >> "CfgMagazines" >> _x;
// attempt to refuel for each empty jerry can
for "_x" from 1 to _refuelQty do {
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel + _canSize);
if(_x in _availableCans) then {
// Get full can size
_canName = _x;
_canSize = getNumber(_configCan >> "fuelQuantity");
_canText = getText(_configCan >> "displayName");
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel + _canSize);
if (_newFuel > _capacity) exitWith {
cutText [format["%1 is full of fuel.",_nameType], "PLAIN DOWN"];
};
if (_newFuel <= _capacity) then {
_newFuel = (_newFuel / _capacity);
// calculate new fuel
_newFuel = (_newFuel / _capacity);
_fillCounter = _fillCounter + 1;
diag_log ("refuel check: " + str(_newFuel) + " / " + str(_capacity));
if(_refuelQty == 1) then {
cutText ["Preparing to refuel, stand still to drain full jerry can.", "PLAIN DOWN"];
} else {
cutText [format[("Preparing to refuel, stand still to drain full jerry can %1 of %2."),_fillCounter,_refuelQty] , "PLAIN DOWN"];
};
cutText [format["Preparing to refuel, stand still to drain %1.",_canText], "PLAIN DOWN"];
// alert zombies
[player,20,true,(getPosATL player)] spawn player_alertZombies;
// force animation
player playActionNow "Medic";
// Play sound and alert zombies
[player,"refuel",0,false] call dayz_zombieSpeak;
[player,20,true,(getPosATL player)] spawn player_alertZombies;
if(!dayz_isSwimming) then {
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) exitWith {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText ["Canceled refuel." , "PLAIN DOWN"];
_abort = true;
};
} else {
// Alternate method in water make sure player stays in one spot for 6 seconds
_location1 = getPosATL player;
sleep 6;
_location2 = getPosATL player;
if(_location1 distance _location2 > 0.1) then {
_finished = false;
} else {
_finished = true;
};
};
if (_finished) then {
if(!dayz_isSwimming) then {
if ("ItemJerrycan" in magazines player) then {
// force animation
player playActionNow "Medic";
player removeMagazine "ItemJerrycan";
player addMagazine "ItemJerrycanEmpty";
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
// Get fuel levels again to prevent wasted gas from others filling
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel + _canSize);
_newFuel = (_newFuel / _capacity);
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;
dayzSetFuel = [_vehicle,_newFuel];
publicVariable "dayzSetFuel";
if (local _vehicle) then {
dayzSetFuel spawn local_setFuel;
if(!_finished) then {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
} else {
// Alternate method in water make sure player stays in one spot for 6 seconds
_location1 = getPosATL player;
sleep 6;
_location2 = getPosATL player;
if(_location1 distance _location2 < 3) then {
_finished = true;
};
};
cutText [format[localize "str_player_05",_nameType,_canSize], "PLAIN DOWN"];
if (_finished) then {
call fnc_usec_medic_removeActions;
r_action = false;
// Get vehicle fuel levels again
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel + _canSize);
sleep 1;
if (_newFuel <= _capacity) then {
// calculate minimum needed fuel
_newFuel = (_newFuel / _capacity);
if(([player,_canName] call BIS_fnc_invRemove) == 1) then {
dayzSetFuel = [_vehicle,_newFuel];
if (local _vehicle) then {
dayzSetFuel spawn local_setFuel;
};
publicVariable "dayzSetFuel";
// Play sound
[player,"refuel",0,false] call dayz_zombieSpeak;
// Add filled can
player addMagazine _canName+"Empty";
cutText [format[localize "str_player_05",_nameText,_canSize], "PLAIN DOWN"];
call fnc_usec_medic_removeActions;
r_action = false;
sleep 1;
} else {
_abort = true;
};
} else {
cutText [format["%1 cannot hold that much fuel.",_nameText], "PLAIN DOWN"];
_abort = true;
};
} else {
cutText ["Canceled refuel." , "PLAIN DOWN"];
_abort = true;
};
} else {
cutText [format["%1 cannot hold that much fuel.",_nameText], "PLAIN DOWN"];
_abort = true;
};
};
};
if(_abort) exitWith {};
};
// exit if abort flag was set
if(_abort) exitWith {};
} forEach magazines player;
TradeInprogress = false;

View File

@@ -10,23 +10,12 @@ _objectUID = _obj getVariable ["ObjectUID","0"];
_isOk = true;
_proceed = false;
_objType = typeOf _obj;
_limit = 5;
switch(true)do{
case (_objType == "WoodGate_DZ"): {
_limit = 5;
};
case (_objType == "Land_HBarrier1_DZ"): {
_limit = 20;
};
case (_objType == "Sandbag1_DZ"): {
_limit = 10;
};
case (_objType == "Hedgehog_DZ"): {
_limit = 10;
};
};
if(isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount");
};
cutText [format["Starting de-construction of %1.",_objType], "PLAIN DOWN"];

View File

@@ -1,133 +1,156 @@
private["_vehicle","_curFuel","_newFuel","_timeLeft"];
_vehicle = cursorTarget;
private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_location1","_location2","_abort","_canNameEmpty","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCanEmpty","_configVeh","_capacity","_nameText","_availableCansEmpty","_availableCans"];
if(TradeInprogress) exitWith { cutText ["Siphon already in progress." , "PLAIN DOWN"] };
TradeInprogress = true;
// Use target from addaction
_vehicle = _this select 0;
_fillCounter = 0;
_abort = false;
_canSize = getNumber(configFile >> "cfgMagazines" >> "ItemJerrycan" >> "fuelQuantity");
// Static vehicle fuel information
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
_capacity = getNumber(_configVeh >> "fuelCapacity");
_nameType = getText(_configVeh >> "displayName");
_nameText = getText(_configVeh >> "displayName");
// Get number of empty jerry cans
_siphonQty = {_x == "ItemJerrycanEmpty"} count magazines player;
_availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
_availableCans = ["ItemJerrycan","ItemFuelBarrel"];
// attempt to siphon for each empty jerry can
for "_x" from 1 to _siphonQty do {
// Loop to find containers that can could hold fuel and fill them
{
_configCanEmpty = configFile >> "CfgMagazines" >> _x;
diag_log format["Looking for: %1", _x];
if(_x in _availableCansEmpty) then {
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
// calculate minimum needed fuel
_newFuel = (_newFuel / _capacity);
if(_newFuel <= 0) exitWith {
cutText [format["%1 does not have enough fuel.",_nameType], "PLAIN DOWN"];
};
if (_newFuel > 0) then {
_fillCounter = _fillCounter + 1;
if(_siphonQty == 1) then {
cutText ["Preparing to siphon, stand still to fill empty jerry can.", "PLAIN DOWN"];
} else {
cutText [format[("Preparing to siphon, stand still to fill empty jerry can %1 of %2."),_fillCounter,_siphonQty] , "PLAIN DOWN"];
};
// alert zombies
[player,20,true,(getPosATL player)] spawn player_alertZombies;
if(!dayz_isSwimming) then {
// force animation
player playActionNow "Medic";
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) exitWith {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText ["Canceled siphon." , "PLAIN DOWN"];
_abort = true;
};
} else {
// Alternate method in water make sure player stays in one spot for 6 seconds
_location1 = getPosATL player;
sleep 6;
_location2 = getPosATL player;
if(_location1 distance _location2 > 0.1) then {
_finished = false;
} else {
_finished = true;
};
};
if (_finished) then {
if ("ItemJerrycanEmpty" in magazines player) then {
// Play sound
[player,"refuel",0,false] call dayz_zombieSpeak;
diag_log format["gas fuelQuantity config : %1", _x];
player removeMagazine "ItemJerrycanEmpty";
player addMagazine "ItemJerrycan";
// Get Empty can size
_canNameEmpty = _x;
_canSizeEmpty = getNumber(_configCanEmpty >> "fuelQuantity");
_canTypeEmpty = getText(_configCanEmpty >> "displayName");
// Get fuel levels again to ensure proper fuel level from others siphoning
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
// Get Full can size
_canName = configName(inheritsFrom(configFile >> "cfgMagazines" >> _canNameEmpty));
_canSize = getNumber(configFile >> "cfgMagazines" >> _canName >> "fuelQuantity");
// is empty
if(_canSizeEmpty == 0) then {
// calculate minimum needed fuel
_newFuel = (_newFuel / _capacity);
diag_log format["is empty fuelQuantity : %1", _x];
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
if (_newFuel > 0) then {
dayzSetFuel = [_vehicle,_newFuel];
if (local _vehicle) then {
dayzSetFuel spawn local_setFuel;
};
publicVariable "dayzSetFuel";
// calculate new fuel
_newFuel = (_newFuel / _capacity);
cutText [format["%1 has been drained for %2 litres of Fuel",_nameType,_canSize], "PLAIN DOWN"];
call fnc_usec_medic_removeActions;
r_action = false;
if (_newFuel > 0) then {
cutText [format["Preparing to siphon, stand still to fill %1.",_canTypeEmpty], "PLAIN DOWN"];
sleep 1;
// alert zombies
[player,20,true,(getPosATL player)] spawn player_alertZombies;
_finished = false;
if(!dayz_isSwimming) then {
// force animation
player playActionNow "Medic";
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = 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 {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
} else {
// Alternate method in water make sure player stays in one spot for 6 seconds
_location1 = getPosATL player;
sleep 6;
_location2 = getPosATL player;
if(_location1 distance _location2 < 3) then {
_finished = true;
};
};
if (_finished) then {
// Get vehicle fuel levels again
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
// calculate minimum needed fuel
_newFuel = (_newFuel / _capacity);
if (_newFuel > 0) then {
if(([player,_canNameEmpty] call BIS_fnc_invRemove) == 1) then {
dayzSetFuel = [_vehicle,_newFuel];
if (local _vehicle) then {
dayzSetFuel spawn local_setFuel;
};
publicVariable "dayzSetFuel";
// Play sound
[player,"refuel",0,false] call dayz_zombieSpeak;
// Add filled can
player addMagazine _canName;
cutText [format["%1 has been drained for %2 litres of Fuel",_nameText,_canSize], "PLAIN DOWN"];
call fnc_usec_medic_removeActions;
r_action = false;
sleep 1;
} else {
_abort = true;
};
} else {
cutText [format["%1 does not have enough fuel to siphon.",_nameText], "PLAIN DOWN"];
_abort = true;
};
} else {
cutText ["Canceled siphon." , "PLAIN DOWN"];
_abort = true;
};
} else {
cutText [format["%1 does not have enough fuel to siphon.",_nameText], "PLAIN DOWN"];
_abort = true;
};
};
};
};
};
};
// exit if abort flag was set
if(_abort) exitWith {};
if(_abort) exitWith {};
};
} forEach magazines player;
TradeInprogress = false;

View File

@@ -24,20 +24,20 @@ _dog = _this select 3;
_removed = 0;
_itemIn = "FoodmeatRaw";
_countIn = 1;
_selected = "";
{
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
_removed = _removed + ([player,_x] call BIS_fnc_invRemove);
};
if(_removed == 1) exitWith { _selected = _x; };
if(_removed == 1) exitWith { _selected = _x; };
} forEach magazines player;
// get name of item removed
_textRemoved = getText(configFile >> "CfgMagazines" >> _selected >> "displayName");
// Only proceed if removed count matches
if(_removed == _countIn) then {
// get name of item removed
_textRemoved = getText(configFile >> "CfgMagazines" >> _selected >> "displayName");
// add failure rate based on skill level variable (days alive)
_chanceToFail = ((random 1 + (dayz_skilllevel/100)) > 0.5);

View File

@@ -105,8 +105,6 @@ if (_qty >= _qty_in) then {
dayzPublishVeh2 = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
publicVariableServer "dayzPublishVeh2";
_veh call fnc_vehicleEventHandler;
player reveal _veh;
cutText [format[("Bought %3 %4 for %1 %2"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];

View File

@@ -111,9 +111,6 @@ if (_qty >= _qty_in) then {
dayzPublishVeh2 = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
publicVariableServer "dayzPublishVeh2";
// event handlers to correctly track damage client side
_veh call fnc_vehicleEventHandler;
player reveal _veh;
cutText [format[("Bought %3 %4 for %1 %2"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];

View File

@@ -1220,7 +1220,45 @@ class Citizen1; // External class reference
transportMaxMagazines = 25;
transportmaxbackpacks = 4;
};
class KamazRefuel;
class KamazRefuel_DZ: KamazRefuel
{
scope = 2;
side = 2;
crew = "";
typicalCargo[] = {};
hiddenSelections[] = {};
class TransportMagazines{};
class TransportWeapons{};
transportFuel = 0;
fuelCapacity = 10000;
};
class UralRefuel_TK_EP1;
class UralRefuel_TK_EP1_DZ: UralRefuel_TK_EP1
{
scope = 2;
side = 2;
crew = "";
typicalCargo[] = {};
hiddenSelections[] = {};
class TransportMagazines{};
class TransportWeapons{};
transportFuel = 0;
fuelCapacity = 10000;
};
class MtvrRefuel_DES_EP1;
class MtvrRefuel_DES_EP1_DZ: MtvrRefuel_DES_EP1
{
scope = 2;
side = 2;
crew = "";
typicalCargo[] = {};
hiddenSelections[] = {};
class TransportMagazines{};
class TransportWeapons{};
transportFuel = 0;
fuelCapacity = 10000;
};

View File

@@ -2,8 +2,8 @@ private["_obj","_type","_config","_positions","_iPos","_nearBy","_itemType","_it
_obj = _this select 0;
// experiment to get true classname to prevent issues with case
_type = configName (configFile >> "CfgVehicles" >> (typeOf _obj));
// lower case to prevent issues with differing case for buildings from map to map.
_type = toLower(typeOf _obj);
diag_log format["Spawning loot for: %1", _type];
_config = configFile >> "CfgBuildingLoot" >> _type;

View File

@@ -4,8 +4,8 @@ scriptName "Functions\misc\fn_damageActions.sqf";
- Function
- [] call fnc_usec_damageActions;
************************************************************/
private["_menClose","_unit","_unconscious","_lowBlood","_injured","_inPain","_hasBandage","_hasEpi","_hasMorphine","_hasBlood","_action1","_action2","_action","_vehClose","_hasVehicle","_vehicle","_inVehicle","_crew","_unconscious_crew","_patients","_charID","_friendlies"];
private ["_weaponName","_action","_turret","_weapons","_assignedRole","_action1","_action2","_x","_vehicle","_unit","_vehType","_displayName","_ammoQty","_ammoSerial","_weapon","_magTypes","_type","_typeVeh","_index","_inventory","_unitTo","_isEngineer","_vehClose","_hasVehicle","_unconscious","_lowBlood","_injured","_inPain","_legsBroke","_armsBroke","_charID","_friendlies","_playerMagazines","_hasBandage","_hasEpi","_hasMorphine","_hasBlood","_hasToolbox","_hasJerry","_hasJerryE","_hasEtool","_hasWire","_hasPainkillers","_unconscious_crew","_patients","_crew","_menClose","_hasPatient","_inVehicle","_isClose","_bag","_classbag"];
_menClose = cursorTarget;
_hasPatient = alive _menClose;
_vehicle = vehicle player;
@@ -52,16 +52,19 @@ if (_hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unco
_armsBroke = _unit getVariable ["hit_hands", 0] >= 1;
_charID = _unit getVariable ["characterID", 0];
_friendlies = player getVariable ["friendlies", []];
_hasBandage = "ItemBandage" in magazines player;
_hasEpi = "ItemEpinephrine" in magazines player;
_hasMorphine = "ItemMorphine" in magazines player;
_hasBlood = "ItemBloodbag" in magazines player;
_playerMagazines = magazines player;
_hasBandage = "ItemBandage" in _playerMagazines;
_hasEpi = "ItemEpinephrine" in _playerMagazines;
_hasMorphine = "ItemMorphine" in _playerMagazines;
_hasBlood = "ItemBloodbag" in _playerMagazines;
_hasToolbox = "ItemToolbox" in items player;
_hasJerry = "ItemJerrycan" in magazines player;
_hasJerryE = "ItemJerrycanEmpty" in magazines player;
_hasJerry = "ItemJerrycan" in _playerMagazines;
_hasBarrel = "ItemFuelBarrel" in _playerMagazines;
_hasJerryE = "ItemJerrycanEmpty" in _playerMagazines;
_hasBarrelE = "ItemFuelBarrelEmpty" in _playerMagazines;
_hasEtool = "ItemEtool" in weapons player;
_hasWire = "ItemWire" in magazines player;
_hasPainkillers = "ItemPainkiller" in magazines player;
_hasWire = "ItemWire" in _playerMagazines;
_hasPainkillers = "ItemPainkiller" in _playerMagazines;
//Allow player to drag
if(_unconscious) then {
@@ -88,7 +91,7 @@ if (_hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unco
if(_injured and _hasBandage) then {
r_action = true;
//_unit setdamage 0.8;
_action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit], 0, true, true, "", "'ItemBandage' in magazines player"];
_action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Epinephrine
@@ -100,19 +103,19 @@ if (_hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unco
//Allow player to give Morphine
if((_legsBroke or _armsBroke) and _hasMorphine) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_06", "\z\addons\dayz_code\medical\morphine.sqf",[_unit], 0, true, true, "", "'ItemMorphine' in magazines player"];
_action = _unit addAction [localize "str_actions_medical_06", "\z\addons\dayz_code\medical\morphine.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Painkillers
if(_inPain and _hasPainkillers) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_07", "\z\addons\dayz_code\medical\painkiller.sqf",[_unit], 0, true, true, "", "'ItemPainkiller' in magazines player"];
_action = _unit addAction [localize "str_actions_medical_07", "\z\addons\dayz_code\medical\painkiller.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to transfuse blood
if(_lowBlood and _hasBlood) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_08", "\z\addons\dayz_code\medical\transfusion.sqf",[_unit], 0, true, true, "", "'ItemBloodbag' in magazines player"];
_action = _unit addAction [localize "str_actions_medical_08", "\z\addons\dayz_code\medical\transfusion.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
@@ -122,15 +125,15 @@ if (_hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unco
_typeVeh = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
//CAN WE REFUEL THE OBJECT?
if ((fuel _unit < 1) and _hasJerry) then {
if ((fuel _unit < 1) and (_hasJerry or _hasBarrel)) then {
r_action = true;
_action = _unit addAction [format[localize "str_actions_medical_10",_typeVeh], "\z\addons\dayz_code\actions\refuel.sqf",[_unit], 0, true, true, "", "'ItemJerrycan' in magazines player"];
_action = _unit addAction [format[localize "str_actions_medical_10",_typeVeh], "\z\addons\dayz_code\actions\refuel.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//CAN WE siphon fuel from THE OBJECT?
if ((fuel _unit > 0) and _hasJerryE) then {
if ((fuel _unit > 0) and (_hasJerryE or _hasBarrelE)) then {
r_action = true;
_action = _unit addAction [format["Siphon fuel from %1",_typeVeh], "\z\addons\dayz_code\actions\siphonFuel.sqf",[_unit], 0, true, true, "", "'ItemJerrycanEmpty' in magazines player"];
_action = _unit addAction [format["Siphon fuel from %1",_typeVeh], "\z\addons\dayz_code\actions\siphonFuel.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};

View File

@@ -110,6 +110,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_isDog = (cursorTarget isKindOf "DZ_Pastor" || cursorTarget isKindOf "DZ_Fin");
_isZombie = cursorTarget isKindOf "zZombie_base";
_isDestructable = cursorTarget isKindOf "BuiltItems";
_isWreck = typeOf cursorTarget in ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"];
_isTent = cursorTarget isKindOf "TentStorage";
_isFuel = false;
_isAlive = alive cursorTarget;
@@ -125,14 +126,14 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
} forEach _rawmeat;
if (_hasFuelE) then {
if (_hasFuelE and dayz_oldrefuel) then {
_isFuel = (cursorTarget isKindOf "Land_Ind_TankSmall") or (cursorTarget isKindOf "Land_fuel_tank_big") or (cursorTarget isKindOf "Land_fuel_tank_stairs") or (cursorTarget isKindOf "Land_fuel_tank_stairs_ep1") or (cursorTarget isKindOf "Land_wagon_tanker") or (cursorTarget isKindOf "Land_fuelstation") or (cursorTarget isKindOf "Land_fuelstation_army");
};
// diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
//Allow player to delete objects
if(_isDestructable and _hasToolbox and _canDo) then {
if((_isDestructable or _isWreck) and _hasToolbox and _canDo) then {
if (s_player_deleteBuild < 0) then {
s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",cursorTarget, 1, true, true, "", ""];
};
@@ -204,13 +205,15 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
//Allow player to fill jerrycan
if(_hasFuelE and _isFuel and _canDo) then {
if (s_player_fillfuel < 0) then {
s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
if(dayz_oldrefuel) then {
if(_hasFuelE and _isFuel and _canDo) then {
if (s_player_fillfuel < 0) then {
s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
};
} else {
player removeAction s_player_fillfuel;
s_player_fillfuel = -1;
};
} else {
player removeAction s_player_fillfuel;
s_player_fillfuel = -1;
};
// Human Gut animal or zombie

View File

@@ -1,5 +1,5 @@
private ["_objects"];
_objects = nearestObjects [getPosATL player, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10];
_objects = nearestObjects [getPosATL player, dayz_updateObjects, 10];
{
//["dayzUpdateVehicle",[_x,"gear"]] call callRpcProcedure;
dayzUpdateVehicle = [_x,"gear"];

View File

@@ -28,7 +28,7 @@ if(_ownerID == dayz_characterID) then {
sleep 3;
_classname = getText (configFile >> "CfgMagazines" >> (typeOf_obj) >> "create");
_classname = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "create");
_location = _pos;

View File

@@ -40,7 +40,7 @@ class CfgMods
hidePicture = 0;
hideName = 0;
action = "http://www.dayzepoch.com";
version = "1.0.0.2";
version = "1.0.0.3";
hiveVersion = 0.96; //0.93
};
};
@@ -2861,6 +2861,33 @@ class HeliCrash_No50s: Default {
class land_bud2: Industrial {
lootPos[] = {{-2.32031,-1.25,-1.76814},{-1.58008,-2.3125,-1.77484}};
};
class land_senik: Residential {
lootPos[] = {{-4.56445,-2.97705,-4.13721},{13.1641,-6.80127,-4.28022},{-4.23242,-0.213379,-4.1315},{-3.44043,4.7998,-4.12115},{-7.64453,3.81445,-4.12319},{-14.0889,-5.66602,-4.14276},{-1.25977,-3.44336,-4.13817}};
};
class land_zd_1: Residential {
lootPos[] = {{2.14258,3.37402,-3.67255},{-1.60645,-3.25098,-3.67255},{0.649902,-2.38086,-3.67255},{-1.16113,1.41406,-3.67255},{2.88721,-2.80078,-3.67255},{-4.45117,-3.0127,-4.04225},{-5.94385,3.13867,-4.04225}};
};
class Land_dum_ras: Residential {
lootPos[] = {{-1.53223,3.34424,-2.66958},{1.36621,-0.507813,-2.66958},{0.860352,3.72705,0.272604},{-0.767578,-1.96289,0.272604},{-0.27832,-3.96045,0.272604}};
};
class land_kostelik_final_2122: Church {
lootPos[] = {{5.41992,-3.45703,-5.57918},{-0.963379,4.74414,-5.57919},{1.09082,-2.79297,-5.57919},{-1.39063,-5.18555,-5.57918}};
};
class land_plynom: Residential {
lootPos[] = {{1.07568,-0.65625,2.21929},{-0.184082,-1.46973,2.21929},{-1.24854,-0.0126953,2.21929},{1.1377,-0.887695,-2.60304},{-1.3877,0.386719,-2.60304},{-0.822754,-1.33398,-2.60304}};
};
class land_seb_mine_main_opt: Industrial {
lootPos[] = {{0.590332,4.68115,-0.991421},{-1.86768,4.13525,-0.992432},{0.14209,2.53271,-0.995407},{-3.43457,2.68115,-0.995136},{-3.01416,2.59521,-5.08478},{0.776855,-2.89209,-5.11486},{-6.06885,3.33838,7.8684},{-6.38086,-2.05469,7.8684},{-1.7251,-3.09668,7.8684},{-5.64111,-0.92334,14.6913},{-6.23584,2.76465,14.6913}};
};
class land_seb_mine_near: Industrial {
lootPos[] = {{7.87646,-5.52881,-8.8979},{9.02979,-5.5918,-8.8979},{4.37451,-7.10156,-8.8979}};
};
class land_x_vez_tex: Residential {
lootPos[] = {{0.433105,-1.02734,-0.273926},{1.00391,3.02197,-0.272713},{1.36426,0.449219,-0.273571},{-1.89795,3.22168,-0.27232},{-5.00537,-3.64307,-0.274128}};
};
class land_marsh1: Residential {
lootPos[] = {{3.76953,-5.73193,-3.95897},{-0.986816,-4.26074,-3.95897},{2.52637,0.376465,-3.95897},{4.78955,2.92969,-3.95897},{4.56543,6.82227,-3.95897},{-2.88184,4.24121,-4.01684}};
};
};

View File

@@ -75,6 +75,10 @@ if (!isDedicated) then {
player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
player_loadCrate = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_loadCrate.sqf";
player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
player_craftItem1 = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem1.sqf";
player_craftItem2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem2.sqf";
player_craftItem3 = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem3.sqf";
player_craftItem4 = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem4.sqf";
player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf";
player_vaultPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_pitch.sqf";
player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
@@ -241,7 +245,7 @@ if (!isDedicated) then {
};
if (!r_fracture_legs and (time - dayz_lastCheckBit > 4)) then {
_inBuilding = [player] call fnc_isInsideBuilding;
_nearbyObjects = nearestObjects[getPosATL player, ["TentStorage", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Wire_cat1"], 8];
_nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8];
if (!_inBuilding and (count _nearbyObjects == 0)) then {
dayz_lastCheckBit = time;
call player_CombatRoll;

View File

@@ -4,7 +4,7 @@ dayz_CBLBase = [];
_config = configFile >> "CfgBuildingLoot";
for "_i" from 0 to ((count _config) - 1) do {
_classname = configName (_config select _i);
_classname = toLower(configName (_config select _i));
_itemChances = [] + getArray (_config >> _classname >> "ItemChance");
_itemCount = count _itemChances;
if (_itemCount > 0) then {

View File

@@ -411,6 +411,15 @@ if(isNil "dayz_tameDogs") then {
if(isNil "dayz_paraSpawn") then {
dayz_paraSpawn = false;
};
if(isNil "dayz_oldrefuel") then {
dayz_oldrefuel = false;
};
// update objects
dayz_updateObjects = ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage","M240Nest_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ"];
dayz_disallowedVault = ["TentStorage", "BuiltItems"];
dayz_reveal = ["AllVehicles","WeaponHolder","TentStorage","VaultStorage","VaultStorageLocked","BuiltItems"];
dayz_allowedObjects = ["TentStorage","TentStorageDomed", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ","Fence_corrugated_DZ","M240Nest_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ"];
dayz_spawnPos = getPosATL player;

View File

@@ -137,7 +137,7 @@ class RscDisplayMain : RscStandardDisplay
class DAYZ_Version : CA_Version
{
idc = -1;
text = "DayZ Epoch 1.0.0.2pre (1.7.6.1)";
text = "DayZ Epoch 1.0.0.3 dev (1.7.6.1)";
y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)";
};
delete CA_TitleMainMenu;

View File

@@ -897,7 +897,7 @@ class FSM
name = "Load_In";
init = /*%FSM<STATEINIT""">*/"//Reveal action types" \n
"" \n
"{player reveal _x} forEach (nearestObjects [getPosATL player, [""AllVehicles"",""WeaponHolder"",""TentStorage"",""VaultStorage"",""BuiltItems""], 50]);" \n
"{player reveal _x} forEach (nearestObjects [getPosATL player, dayz_reveal, 50]);" \n
"" \n
"dayz_clientPreload = true;" \n
"3 fadeSound 1;" \n