From 211415389fb56962ef49ef379951edaef7079b7c Mon Sep 17 00:00:00 2001 From: vbawol Date: Wed, 17 Apr 2013 10:04:34 -0500 Subject: [PATCH] 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. --- Server Files/Battleye/publicvariableval.txt | 2 +- dayz_code/CfgMagazines.hpp | 24 +- dayz_code/CfgWeapons.hpp | 7 +- dayz_code/actions/cook.sqf | 9 +- dayz_code/actions/player_build.sqf | 252 ++++--- dayz_code/actions/player_craftItem.sqf | 239 ++++--- dayz_code/actions/player_craftItem1.sqf | 243 +++++++ dayz_code/actions/player_craftItem2.sqf | 243 +++++++ dayz_code/actions/player_craftItem3.sqf | 243 +++++++ dayz_code/actions/player_craftItem4.sqf | 243 +++++++ dayz_code/actions/refuel.sqf | 210 +++--- dayz_code/actions/remove.sqf | 19 +- dayz_code/actions/siphonFuel.sqf | 249 ++++--- dayz_code/actions/tame_dog.sqf | 10 +- dayz_code/actions/trade_any_boat.sqf | 2 - dayz_code/actions/trade_any_vehicle.sqf | 3 - dayz_code/cfgVehicles.hpp | 40 +- dayz_code/compile/building_spawnLoot.sqf | 4 +- dayz_code/compile/fn_damageActions.sqf | 37 +- dayz_code/compile/fn_selfActions.sqf | 21 +- dayz_code/compile/player_gearSync.sqf | 2 +- dayz_code/compile/player_packTent.sqf | 2 +- dayz_code/config.cpp | 29 +- dayz_code/init/compiles.sqf | 6 +- dayz_code/init/loot_init.sqf | 2 +- dayz_code/init/variables.sqf | 9 + dayz_code/rscTitles.hpp | 2 +- dayz_code/system/player_monitor.fsm | 2 +- dayz_equip/config.cpp | 672 ++++++++++++++++-- .../compile/server_onPlayerDisconnect.sqf | 2 +- dayz_server/compile/server_playerSync.sqf | 2 +- dayz_server/compile/server_publishObject.sqf | 11 +- dayz_server/compile/server_publishVehicle.sqf | 32 +- .../compile/server_publishVehicle2.sqf | 6 + dayz_server/compile/server_spawnCrashSite.sqf | 5 +- .../compile/server_updateNearbyObjects.sqf | 2 +- dayz_server/compile/server_updateObject.sqf | 6 +- dayz_server/init/server_functions.sqf | 15 +- dayz_server/system/server_monitor.sqf | 9 +- dayz_weapons/config.cpp | 4 + 40 files changed, 2351 insertions(+), 569 deletions(-) create mode 100644 dayz_code/actions/player_craftItem1.sqf create mode 100644 dayz_code/actions/player_craftItem2.sqf create mode 100644 dayz_code/actions/player_craftItem3.sqf create mode 100644 dayz_code/actions/player_craftItem4.sqf diff --git a/Server Files/Battleye/publicvariableval.txt b/Server Files/Battleye/publicvariableval.txt index 942b4f43d..8702a50ad 100644 --- a/Server Files/Battleye/publicvariableval.txt +++ b/Server Files/Battleye/publicvariableval.txt @@ -21,7 +21,7 @@ 5 "compile" 5 "loadFile" //1 "say" //+4 -5 "call" +5 "call" !="dog_callBack" !="remExField" = [,,"say",["dog_callBack",120]]" 1 "move" !="\"switchmove\"" !="\"playmove\"" !"moveIn" !"remove" !="\"remExField\" = [,,\"switchmove\",\"ActsPercMrunSlowWrflDf_FlipFlopPara\"]" 1 "chat" 1 "fade" diff --git a/dayz_code/CfgMagazines.hpp b/dayz_code/CfgMagazines.hpp index 0b72d81c6..f06042326 100644 --- a/dayz_code/CfgMagazines.hpp +++ b/dayz_code/CfgMagazines.hpp @@ -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"; }; }; diff --git a/dayz_code/CfgWeapons.hpp b/dayz_code/CfgWeapons.hpp index 310355b8b..d416e8b07 100644 --- a/dayz_code/CfgWeapons.hpp +++ b/dayz_code/CfgWeapons.hpp @@ -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"; }; diff --git a/dayz_code/actions/cook.sqf b/dayz_code/actions/cook.sqf index 957869b08..0df5b4e2f 100644 --- a/dayz_code/actions/cook.sqf +++ b/dayz_code/actions/cook.sqf @@ -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"; }; diff --git a/dayz_code/actions/player_build.sqf b/dayz_code/actions/player_build.sqf index 282a04aaf..317437b1c 100644 --- a/dayz_code/actions/player_build.sqf +++ b/dayz_code/actions/player_build.sqf @@ -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; \ No newline at end of file diff --git a/dayz_code/actions/player_craftItem.sqf b/dayz_code/actions/player_craftItem.sqf index 2fd3073e7..bcc9025f1 100644 --- a/dayz_code/actions/player_craftItem.sqf +++ b/dayz_code/actions/player_craftItem.sqf @@ -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"]; diff --git a/dayz_code/actions/player_craftItem1.sqf b/dayz_code/actions/player_craftItem1.sqf new file mode 100644 index 000000000..03ad2f94a --- /dev/null +++ b/dayz_code/actions/player_craftItem1.sqf @@ -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; \ No newline at end of file diff --git a/dayz_code/actions/player_craftItem2.sqf b/dayz_code/actions/player_craftItem2.sqf new file mode 100644 index 000000000..4e75edb6a --- /dev/null +++ b/dayz_code/actions/player_craftItem2.sqf @@ -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; \ No newline at end of file diff --git a/dayz_code/actions/player_craftItem3.sqf b/dayz_code/actions/player_craftItem3.sqf new file mode 100644 index 000000000..786666338 --- /dev/null +++ b/dayz_code/actions/player_craftItem3.sqf @@ -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; \ No newline at end of file diff --git a/dayz_code/actions/player_craftItem4.sqf b/dayz_code/actions/player_craftItem4.sqf new file mode 100644 index 000000000..8e2bf1d76 --- /dev/null +++ b/dayz_code/actions/player_craftItem4.sqf @@ -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; \ No newline at end of file diff --git a/dayz_code/actions/refuel.sqf b/dayz_code/actions/refuel.sqf index 436ab205a..994f33b1d 100644 --- a/dayz_code/actions/refuel.sqf +++ b/dayz_code/actions/refuel.sqf @@ -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 {}; -}; \ No newline at end of file + + // exit if abort flag was set + if(_abort) exitWith {}; + +} forEach magazines player; + +TradeInprogress = false; \ No newline at end of file diff --git a/dayz_code/actions/remove.sqf b/dayz_code/actions/remove.sqf index b26229d8c..9a857be82 100644 --- a/dayz_code/actions/remove.sqf +++ b/dayz_code/actions/remove.sqf @@ -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"]; diff --git a/dayz_code/actions/siphonFuel.sqf b/dayz_code/actions/siphonFuel.sqf index 36e578aab..a1b7aa3a7 100644 --- a/dayz_code/actions/siphonFuel.sqf +++ b/dayz_code/actions/siphonFuel.sqf @@ -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; \ No newline at end of file diff --git a/dayz_code/actions/tame_dog.sqf b/dayz_code/actions/tame_dog.sqf index 59a2626c1..b47a1e8cb 100644 --- a/dayz_code/actions/tame_dog.sqf +++ b/dayz_code/actions/tame_dog.sqf @@ -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); diff --git a/dayz_code/actions/trade_any_boat.sqf b/dayz_code/actions/trade_any_boat.sqf index 6a20d9d80..e38d5509c 100644 --- a/dayz_code/actions/trade_any_boat.sqf +++ b/dayz_code/actions/trade_any_boat.sqf @@ -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"]; diff --git a/dayz_code/actions/trade_any_vehicle.sqf b/dayz_code/actions/trade_any_vehicle.sqf index a5a985b54..d9dc9728d 100644 --- a/dayz_code/actions/trade_any_vehicle.sqf +++ b/dayz_code/actions/trade_any_vehicle.sqf @@ -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"]; diff --git a/dayz_code/cfgVehicles.hpp b/dayz_code/cfgVehicles.hpp index 81eb6db2d..811ada2ac 100644 --- a/dayz_code/cfgVehicles.hpp +++ b/dayz_code/cfgVehicles.hpp @@ -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; + }; diff --git a/dayz_code/compile/building_spawnLoot.sqf b/dayz_code/compile/building_spawnLoot.sqf index 9c8175770..4fdd9926a 100644 --- a/dayz_code/compile/building_spawnLoot.sqf +++ b/dayz_code/compile/building_spawnLoot.sqf @@ -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; diff --git a/dayz_code/compile/fn_damageActions.sqf b/dayz_code/compile/fn_damageActions.sqf index 07ece2192..ba5ac6326 100644 --- a/dayz_code/compile/fn_damageActions.sqf +++ b/dayz_code/compile/fn_damageActions.sqf @@ -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]; }; diff --git a/dayz_code/compile/fn_selfActions.sqf b/dayz_code/compile/fn_selfActions.sqf index b8001f3f5..364760e5e 100644 --- a/dayz_code/compile/fn_selfActions.sqf +++ b/dayz_code/compile/fn_selfActions.sqf @@ -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 diff --git a/dayz_code/compile/player_gearSync.sqf b/dayz_code/compile/player_gearSync.sqf index d4b7fbc7f..17bc66bff 100644 --- a/dayz_code/compile/player_gearSync.sqf +++ b/dayz_code/compile/player_gearSync.sqf @@ -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"]; diff --git a/dayz_code/compile/player_packTent.sqf b/dayz_code/compile/player_packTent.sqf index 87dacba97..95325f296 100644 --- a/dayz_code/compile/player_packTent.sqf +++ b/dayz_code/compile/player_packTent.sqf @@ -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; diff --git a/dayz_code/config.cpp b/dayz_code/config.cpp index 6b579115c..faecc7cfa 100644 --- a/dayz_code/config.cpp +++ b/dayz_code/config.cpp @@ -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}}; + }; }; diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf index d66732db2..9313b5093 100644 --- a/dayz_code/init/compiles.sqf +++ b/dayz_code/init/compiles.sqf @@ -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; diff --git a/dayz_code/init/loot_init.sqf b/dayz_code/init/loot_init.sqf index 1f3e3ad1d..a79f04cc2 100644 --- a/dayz_code/init/loot_init.sqf +++ b/dayz_code/init/loot_init.sqf @@ -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 { diff --git a/dayz_code/init/variables.sqf b/dayz_code/init/variables.sqf index d3e4b2924..dca8e28f9 100644 --- a/dayz_code/init/variables.sqf +++ b/dayz_code/init/variables.sqf @@ -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; diff --git a/dayz_code/rscTitles.hpp b/dayz_code/rscTitles.hpp index 8e6b18a9d..c86755787 100644 --- a/dayz_code/rscTitles.hpp +++ b/dayz_code/rscTitles.hpp @@ -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; diff --git a/dayz_code/system/player_monitor.fsm b/dayz_code/system/player_monitor.fsm index de3ee2f05..e7f3be9b7 100644 --- a/dayz_code/system/player_monitor.fsm +++ b/dayz_code/system/player_monitor.fsm @@ -897,7 +897,7 @@ class FSM name = "Load_In"; init = /*%FSM*/"//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 diff --git a/dayz_equip/config.cpp b/dayz_equip/config.cpp index c4ca8f488..a6b1bdf9d 100644 --- a/dayz_equip/config.cpp +++ b/dayz_equip/config.cpp @@ -1003,6 +1003,77 @@ class CfgMagazines }; }; }; + class ItemCanvas: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Canvas"; + model = "\dayz_equip\models\cloth_parcel.p3d"; + picture = "\dayz_equip\textures\equip_cloth_parcel_ca.paa"; + descriptionShort = "Canvas Parcel"; + class ItemActions + { + class Crafting + { + text = "Craft Tent"; + script = "spawn player_craftItem;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemKnife"}; + output[] = {{"ItemTent",1}}; + input[] = {{"ItemCanvas",2},{"ItemPole",2}}; + }; + class Crafting1 + { + text = "Craft Desert Tent"; + script = "spawn player_craftItem1;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemKnife"}; + output[] = {{"ItemTentDomed",1}}; + input[] = {{"ItemCanvas",2},{"ItemPole",2}}; + }; + class Crafting2 + { + text = "Craft Sun Shade"; + script = "spawn player_craftItem2;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemKnife"}; + output[] = {{"sun_shade_kit",1}}; + input[] = {{"ItemCanvas",1},{"PartWoodLumber",4}}; + }; + class Crafting3 + { + text = "Craft Burlap"; + script = "spawn player_craftItem3;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemKnife"}; + output[] = {{"ItemBurlap",1}}; + input[] = {{"ItemCanvas",2}}; + }; + }; + }; + class ItemBurlap: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Burlap"; + model = "\dayz_equip\models\sandbags.p3d"; + picture = "\dayz_equip\textures\equip_sandbag_ca.paa"; + descriptionShort = "Burlap Bag"; + class ItemActions + { + class Crafting + { + text = "Craft Sandbag"; + script = "spawn player_craftItem;"; + neednearby[] = {"sand"}; // todo add sand requirement + requiretools[] = {"ItemEtool"}; + output[] = {{"ItemSandbag",1}}; + input[] = {{"ItemBurlap",3}}; + }; + }; + }; class SkinBase: CA_Magazine { scope = 0; @@ -1019,6 +1090,15 @@ class CfgMagazines text = "Wear %1"; script = "spawn player_wearClothes;"; }; + class Crafting + { + text = "Craft Canvas"; + script = "spawn player_craftItem;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemKnife"}; + output[] = {{"ItemCanvas",1}}; + input[] = {{"SkinBase",4}}; + }; }; }; class Skin_Sniper1_DZ: SkinBase @@ -1229,7 +1309,7 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 4)"; + type = 256; displayName = "$STR_EQUIP_NAME_8"; model = "\dayz_equip\models\fueltank.p3d"; picture = "\dayz_equip\textures\equip_fueltank_ca.paa"; @@ -1239,7 +1319,7 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 6)"; + type = 256; displayName = "$STR_EQUIP_NAME_9"; model = "\dayz_equip\models\wheel.p3d"; picture = "\dayz_equip\textures\equip_wheel_ca.paa"; @@ -1249,17 +1329,105 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 3)"; + type = 256; displayName = "$STR_EQUIP_NAME_10"; model = "\dayz_equip\models\genericparts.p3d"; picture = "\dayz_equip\textures\equip_genericparts_ca.paa"; descriptionShort = "$STR_EQUIP_DESC_10"; + class ItemActions { + class Crafting + { + text = "Craft Pole"; + script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox","ItemCrowbar"}; + output[] = {{"ItemPole",1}}; + input[] = {{"PartGeneric",2},{"ItemTankTrap",1}}; + }; + }; + }; + class ItemCorrugated : CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Corrugated Fence"; + // TODO model and picture + model = "\dayz_equip\models\genericparts.p3d"; + picture = "\dayz_equip\textures\equip_genericparts_ca.paa"; + descriptionShort = "Corrugated Fence"; + class ItemActions { + class Build { + text = "Build Corrugated Fence"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "Fence_corrugated_DZ"; + }; + class Crafting + { + text = "Craft Wooden Shed"; + script = "spawn player_craftItem;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemCrowbar"}; + output[] = {{"wooden_shed_kit",1}}; + input[] = {{"ItemCorrugated",2},{"PartWoodPlywood",5},{"PartWoodLumber",5}}; + }; + class Crafting1 + { + text = "Craft Outhouse"; + script = "spawn player_craftItem1;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemCrowbar"}; + output[] = {{"outhouse_kit",1}}; + input[] = {{"ItemCorrugated",1},{"PartWoodPlywood",5},{"PartWoodLumber",3},{"ItemTrashToiletpaper",1}}; + }; + class Crafting2 + { + text = "Craft Storage Shed"; + script = "spawn player_craftItem2;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemCrowbar"}; + output[] = {{"storage_shed_kit",1}}; + input[] = {{"ItemCorrugated",5},{"PartWoodPlywood",2},{"PartWoodLumber",5}}; + }; + }; + }; + class ItemPole: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Metal Pole"; + // TODO model and picture + model = "\dayz_equip\models\genericparts.p3d"; + picture = "\dayz_equip\textures\equip_genericparts_ca.paa"; + descriptionShort = "Metal Pole"; + class ItemActions { + class Crafting + { + text = "Craft Corrugated Fence"; + script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox","ItemCrowbar"}; + output[] = {{"ItemCorrugated",1}}; + input[] = {{"ItemPole",2},{"PartGeneric",4},{"PartWoodLumber",2}}; + }; + class Crafting1 + { + text = "Craft Rusty Gate"; + script = "spawn player_craftItem1;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemCrowbar"}; + output[] = {{"rusty_gate_kit",1}}; + input[] = {{"ItemPole",6},{"PartGeneric",3},{"ItemTankTrap",1}}; + }; + }; }; class PartEngine: CA_Magazine { scope = 2; count = 1; - type = "(256 * 6)"; + type = 256; displayName = "$STR_EQUIP_NAME_11"; model = "\dayz_equip\models\engine.p3d"; picture = "\dayz_equip\textures\equip_engine_ca.paa"; @@ -1269,33 +1437,119 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 2)"; + type = 256; displayName = "$STR_EQUIP_NAME_40"; model = "\dayz_equip\models\woodPile.p3d"; picture = "\dayz_equip\textures\equip_woodPile_ca.paa"; descriptionShort = "$STR_EQUIP_DESC_40"; + class ItemActions { + class Crafting + { + text = "Craft Lumber"; + script = "spawn player_craftItem;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox","ItemKnife"}; + output[] = {{"PartWoodLumber",1}}; + input[] = {{"PartWoodPile",2}}; + }; + class Crafting1 + { + text = "Craft Arrows"; + script = "spawn player_craftItem1;"; + neednearby[] = {}; + requiretools[] = {"ItemKnife"}; + output[] = {{"WoodenArrow",3}}; + input[] = {{"PartWoodPile",1},{"ItemTrashRazor",1}}; + + }; + }; + }; + class PartWoodLumber: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Wood Lumber"; + // TODO make custom model and icon + model = "\dayz_equip\models\woodPile.p3d"; + picture = "\dayz_equip\textures\equip_woodPile_ca.paa"; + descriptionShort = "Wood Lumber"; class ItemActions { class Build { text = "Build Wood Gate"; script = "spawn player_build;"; - require = "ItemToolbox"; + require[] = {"ItemToolbox"}; create = "WoodGate_DZ"; }; class Crafting { - text = "Craft Arrows"; + text = "Craft Plywood"; script = "spawn player_craftItem;"; - output[] = {{"WoodenArrow",3}}; - input[] = {{"PartWoodPile",1},{"ItemTrashRazor",1}}; + neednearby[] = {}; + requiretools[] = {"ItemToolbox"}; + output[] = {{"PartWoodPlywood",1}}; + input[] = {{"PartWoodLumber",2}}; }; + class Crafting1 + { + text = "Craft Wood Bench"; + script = "spawn player_craftItem1;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox"}; + output[] = {{"park_bench_kit",1}}; + input[] = {{"PartWoodLumber",4}}; + + }; + }; + }; + class PartWoodPlywood: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Wood Plywood"; + // TODO make custom model and icon + model = "\dayz_equip\models\woodPile.p3d"; + picture = "\dayz_equip\textures\equip_woodPile_ca.paa"; + descriptionShort = "Wood Plywood"; + class ItemActions { + class Crafting + { + text = "Craft Shed"; + script = "spawn player_craftItem;"; + neednearby[] = {}; + requiretools[] = {"ItemToolbox"}; + output[] = {{"wood_shack_kit",1}}; + input[] = {{"PartWoodPlywood",4},{"PartWoodLumber",4}}; + + }; + }; + }; + class PartWoodShed: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Wooden Shack"; + // TODO make custom model and icon + model = "\dayz_equip\models\woodPile.p3d"; + picture = "\dayz_equip\textures\equip_woodPile_ca.paa"; + descriptionShort = "Wooden Shack"; + class ItemActions { + class Build { + text = "Build Wood Shack"; + script = "spawn player_build;"; + require[] = {"ItemToolbox"}; + create = "WoodShack_DZ"; + }; }; }; class PartVRotor: CA_Magazine { scope = 2; count = 1; - type = "(256 * 6)"; + type = 256; displayName = "$STR_EQUIP_NAME_32"; model = "\dayz_equip\models\vrotor.p3d"; picture = "\dayz_equip\textures\equip_vrotor_ca.paa"; @@ -1305,7 +1559,7 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 2)"; + type = 256; displayName = "$STR_EQUIP_NAME_30"; model = "\dayz_equip\models\carglass.p3d"; picture = "\dayz_equip\textures\equip_carglass_ca.paa"; @@ -1406,7 +1660,7 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 3)"; + type = 256; displayName = "Briefcase"; // model = "\misc3\briefcase.p3d"; picture = "\dayz_equip\textures\equip_bar_gold_CA.paa"; @@ -1428,6 +1682,8 @@ class CfgMagazines { text = "Smelt 10oz bar"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemGoldBar10oz",1}}; input[] = {{"ItemGoldBar",10}}; @@ -1449,6 +1705,8 @@ class CfgMagazines { text = "Smelt 1oz bars"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemGoldBar",10}}; input[] = {{"ItemGoldBar10oz",1}}; }; @@ -1469,6 +1727,8 @@ class CfgMagazines { text = "Smelt 10oz bar"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemSilverBar10oz",1}}; input[] = {{"ItemSilverBar",10}}; }; @@ -1490,6 +1750,8 @@ class CfgMagazines { text = "Smelt 1oz bars"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemSilverBar",10}}; input[] = {{"ItemSilverBar10oz",1}}; }; @@ -1510,6 +1772,8 @@ class CfgMagazines { text = "Smelt 10oz bar"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemCopperBar10oz",1}}; input[] = {{"ItemCopperBar",10}}; }; @@ -1531,6 +1795,8 @@ class CfgMagazines { text = "Smelt 1oz bars"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemCopperBar",10}}; input[] = {{"ItemCopperBar10oz",1}}; }; @@ -1573,6 +1839,8 @@ class CfgMagazines { text = "Smelt 1oz bars"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemAluminumBar",10}}; input[] = {{"ItemAluminumBar10oz",1}}; }; @@ -1604,6 +1872,8 @@ class CfgMagazines { text = "Smelt 1oz bars"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemTinBar",10}}; input[] = {{"ItemTinBar10oz",1}}; }; @@ -1614,7 +1884,7 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 2)"; + type = 256; displayName = "Zombie Parts"; model = "\dayz_equip\models\zombie_parts_bag_v2.p3d"; picture = "\dayz_equip\textures\parts_bag_texture3c_CA.paa"; @@ -1717,19 +1987,41 @@ class CfgMagazines { scope = 2; count = 1; - // fuelQuantity = 20; - type = "(256 * 6)"; + // fuelQuantity = 210; + type = 256; displayName = "Oil Barrel"; model = "\dayz_equip\models\oil_drum_model.p3d"; picture = "\dayz_equip\textures\equip_oil_drum_model_ca.paa"; descriptionShort = "210 litres of Oil in a Barrel"; }; + class ItemFuelBarrel: CA_Magazine + { + scope = 2; + count = 1; + fuelQuantity = 210; + type = 256; + displayName = "Fuel Barrel"; + model = "\dayz_equip\models\oil_drum_model.p3d"; + picture = "\dayz_equip\textures\equip_oil_drum_model_ca.paa"; + descriptionShort = "210 litres of fuel in a Barrel"; + }; + class ItemFuelBarrelEmpty: ItemFuelBarrel + { + scope = 2; + count = 1; + fuelQuantity = 0; + type = 256; + displayName = "Fuel Barrel (Empty)"; + // TODO add X to icon to represent empty barrel + picture = "\dayz_equip\textures\equip_oil_drum_model_ca.paa"; + descriptionShort = "210 litres of fuel in a Barrel (Empty)"; + }; class ItemJerrycan: CA_Magazine { scope = 2; count = 1; fuelQuantity = 20; - type = "(256 * 3)"; + type = 256; displayName = "$STR_EQUIP_NAME_19"; model = "\dayz_equip\models\jerrycan.p3d"; picture = "\dayz_equip\textures\equip_jerrycan_ca.paa"; @@ -1738,7 +2030,7 @@ class CfgMagazines class ItemJerrycanEmpty: ItemJerrycan { fuelQuantity = 0; - type = "(256 * 3)"; + type = 256; displayName = "$STR_EQUIP_NAME_39"; picture = "\dayz_equip\textures\equip_jerrycan_e_ca.paa"; descriptionShort = "$STR_EQUIP_DESC_39"; @@ -1748,7 +2040,7 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 6)"; + type = 256; displayName = "Supply Crate"; model = "\dayz_equip\models\supply_crate.p3d"; picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; @@ -1771,14 +2063,14 @@ class CfgMagazines }; class bulk_DZ_Backpack_EP1: bulk { - descriptionShort = "12 x DZ_Backpack_EP1"; + descriptionShort = "4 x DZ_Backpack_EP1"; class ItemActions { class CreateMags { text = "Open %1"; script = "spawn player_loadCrate;"; - output[] = {"DZ_Backpack_EP1",12,"backpack"}; + output[] = {"DZ_Backpack_EP1",4,"backpack"}; // types magazine, weapon, backpack }; }; @@ -1888,13 +2180,173 @@ class CfgMagazines }; }; - + // BUILDING KITS + class wooden_shed_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Nice Wooden Shed"; + descriptionShort = "Nice Wooden Shed"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "Wooden_shed_DZ"; + }; + }; + }; + class wood_shack_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Wood Shack"; + descriptionShort = "Wood Shack"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "WoodShack_DZ"; + }; + }; + }; + class m240_nest_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "M240 Nest"; + descriptionShort = "M240 Nest"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "M240Nest_DZ"; + }; + }; + }; + class sun_shade_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Canvas Sun Shade"; + descriptionShort = "Canvas Sun Shade"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "CanvasHut_DZ"; + }; + }; + }; + class park_bench_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Wood Bench"; + descriptionShort = "Wood Bench"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "ParkBench_DZ"; + }; + }; + }; + class rusty_gate_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Rusty Gate"; + descriptionShort = "Rusty Gate"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "MetalGate_DZ"; + }; + }; + }; + class outhouse_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Outhouse"; + descriptionShort = "Outhouse"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "OutHouse_DZ"; + }; + }; + }; + class storage_shed_kit: CA_Magazine + { + scope = 2; + count = 1; + type = 256; + displayName = "Storage Shed"; + descriptionShort = "Storage Shed"; + model = "\dayz_equip\models\supply_crate.p3d"; + picture = "\dayz_equip\textures\equip_wooden_crate_ca.paa"; + class ItemActions + { + class Build + { + text = "$STR_ACTIONS_BUILD"; + script = "spawn player_build;"; + require[] = {"ItemEtool","ItemToolbox"}; + create = "StorageShed_DZ"; + }; + }; + }; class ItemGenerator: CA_Magazine { scope = 2; count = 1; - type = "(256 * 6)"; + type = 256; displayName = "$STR_EQUIP_NAME_31"; model = "\dayz_equip\models\generator_gear.p3d"; picture = "\dayz_equip\textures\equip_generator_ca.paa"; @@ -1905,7 +2357,7 @@ class CfgMagazines { scope = 2; count = 1; - type = "(256 * 12)"; + type = 256; displayName = "Safe"; model = "\dayz_equip\models\safe1_onside.p3d"; picture = "\dayz_equip\textures\equip_safe_ca.paa"; @@ -1923,7 +2375,7 @@ class CfgMagazines { scope = 2; 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"; @@ -1938,29 +2390,7 @@ class CfgMagazines }; }; }; - class ItemSandbag: CA_Magazine - { - scope = 2; - count = 1; - type = 256; - displayName = "$STR_EQUIP_NAME_21"; - model = "\dayz_equip\models\sandbags.p3d"; - picture = "\dayz_equip\textures\equip_sandbag_ca.paa"; - descriptionShort = "$STR_EQUIP_DESC_21"; - class ItemActions - { - class Build - { - text = "$STR_ACTIONS_BUILD"; - script = "spawn player_build;"; - require[] = {"ItemEtool"}; - create = "Sandbag1_DZ"; - }; - }; - }; - - - + class ItemTankTrap: CA_Magazine { scope = 2; @@ -2114,6 +2544,7 @@ class CfgVehicles armor = 400; displayName = "Hedgehog (Steel)"; vehicleClass = "Fortifications"; + constructioncount = 10; }; @@ -2123,7 +2554,7 @@ class CfgVehicles vehicleClass = "Fortifications"; model = "\ca\misc\Fort_Razorwire"; icon = "\Ca\misc\data\icons\I_drutkolczasty_CA.paa"; - offset[] = {0,1,5,0.5}; + offset[] = {0,1.5,0.5}; accuracy = 0.3; mapSize = 5.5; displayName = "Wire"; @@ -2139,11 +2570,12 @@ class CfgVehicles cost = 100; model = "\ca\misc2\BagFenceLong.p3d"; icon = "\Ca\misc3\data\Icons\icon_fortBagFenceLong_ca.paa"; - offset[] = {0,1,5,0.5}; + offset[] = {0,1.5,0.5}; mapSize = 2; armor = 400; displayName = "Bag Fence"; vehicleClass = "Fortifications"; + constructioncount = 10; }; class Land_HBarrier1_DZ : BuiltItems { @@ -2151,7 +2583,7 @@ class CfgVehicles animated = 0; vehicleClass = "Fortifications"; typicalCargo[] = {}; - offset[] = {0,1,5,0.5}; + offset[] = {0,1.5,0.5}; irTarget = 0; accuracy = 0.3; transportAmmo = 0; @@ -2168,21 +2600,128 @@ class CfgVehicles mapSize = 2; displayName = "H-barrier cube"; GhostPreview = "Land_HBarrier1Preview"; + constructioncount = 20; }; - class Land_kulna; - class WoodGate_DZ: Land_kulna + + // PLAYER BUILDINGS + class USMC_WarfareBMGNest_M240; + class M240Nest_DZ: USMC_WarfareBMGNest_M240 + { + scope = 2; + offset[] = {0,3.5,0}; + displayName = "M240 Nest"; + vehicleClass = "Fortifications"; + transportMaxMagazines = 25; + transportMaxWeapons = 4; + transportMaxBackpacks = 1; + constructioncount = 20; + }; + class Land_covering_hut_EP1; + class CanvasHut_DZ: Land_covering_hut_EP1 { scope = 2; - destrType = "DestructBuilding"; - cost = 100; offset[] = {0,2.5,1}; - //model = "\ca\structures\Wall\Gate_wood2_5"; - //icon = "\ca\data\data\Unknown_object.paa"; - //mapSize = 2; - armor = 100; + displayName = "Canvas Hut"; + vehicleClass = "Fortifications"; + }; + class Park_bench1; + class ParkBench_DZ: Park_bench1 + { + scope = 2; + offset[] = {0,1.5,0.5}; + displayName = "Wood Bench"; + vehicleClass = "Fortifications"; + }; + class Land_Wall_Gate_Ind1_L; + class MetalGate_DZ: Land_Wall_Gate_Ind1_L + { + scope = 2; + offset[] = {0,2.5,1}; + displayName = "Rusty Gate"; + vehicleClass = "Fortifications"; + }; + class Land_KBud; + class OutHouse_DZ: Land_KBud + { + scope = 2; + offset[] = {0,2.5,1}; + displayName = "Outhouse"; + vehicleClass = "Fortifications"; + transportMaxMagazines = 4; + transportMaxWeapons = 1; + transportMaxBackpacks = 1; + constructioncount = 10; + class transportmagazines + { + class _xx_ItemTrashToiletpaper + { + magazine = "ItemTrashToiletpaper"; + count = 1; + }; + }; + }; + class Land_Shed_M01; + class StorageShed_DZ: Land_Shed_M01 + { + scope = 2; + offset[] = {0,2.5,1}; + displayName = "Storage Shed"; + vehicleClass = "Fortifications"; + transportMaxMagazines = 400; + transportMaxWeapons = 40; + transportMaxBackpacks = 20; + constructioncount = 20; + }; + class Fence_corrugated_plate; + class Fence_corrugated_DZ: Fence_corrugated_plate + { + scope = 2; + offset[] = {0,2.5,1}; + displayName = "Corrugated Fence"; + vehicleClass = "Fortifications"; + }; + class Land_kulna; + class WoodShack_DZ: Land_kulna + { + scope = 2; + //destrType = "DestructBuilding"; + //cost = 100; + offset[] = {0,2.5,1.3}; + //armor = 200; displayName = "Wooden Shack"; vehicleClass = "Fortifications"; - /* + transportMaxMagazines = 100; + transportMaxWeapons = 10; + transportMaxBackpacks = 5; + constructioncount = 20; + }; + class Land_Shed_wooden; + class Wooden_shed_DZ: Land_Shed_wooden + { + scope = 2; + //destrType = "DestructBuilding"; + //cost = 100; + offset[] = {0,2.5,1}; + //armor = 100; + displayName = "Wooden Shed"; + vehicleClass = "Fortifications"; + transportMaxMagazines = 200; + transportMaxWeapons = 20; + transportMaxBackpacks = 10; + }; + class WoodGate_DZ: BuiltItems + { + scope = 2; + destrType = "DestructTree"; + //cost = 100; + offset[] = {0,1.5,0.5}; + model = "\ca\structures\Wall\Gate_wood2_5"; + icon = "\ca\data\data\Unknown_object.paa"; + mapSize = 2; + // armor = 100; + displayName = "Wood Panel"; + vehicleClass = "Fortifications"; + class AnimationSources { class DoorR { @@ -2191,7 +2730,7 @@ class CfgVehicles initPhase = 0; } } - */ + }; class BearTrap_DZ: TrapItems { @@ -2476,7 +3015,16 @@ class CfgVehicles init = "[(_this select 0),'cfgMagazines','ItemOilBarrel'] execVM '\z\addons\dayz_code\init\object_pickupAction.sqf';"; }; }; - + class WeaponHolder_ItemFuelBarrel: WeaponHolderBase + { + scope = 2; + displayName = "Fuel Barrel"; + model = "\dayz_equip\proxy\oil_drum_model.p3d"; + class eventHandlers + { + init = "[(_this select 0),'cfgMagazines','ItemFuelBarrel'] execVM '\z\addons\dayz_code\init\object_pickupAction.sqf';"; + }; + }; class WeaponHolder_ItemJerrycanEmpty: WeaponHolderBase { scope = 2; @@ -2513,6 +3061,7 @@ class CfgVehicles }; class TentStorageDomed: TentStorage { + displayName = "Digital Camo Tent"; vehicleClass = "Survival"; model = "\dayz_equip\models\astan.p3d"; transportMaxMagazines = 75; @@ -2543,6 +3092,7 @@ class CfgVehicles transportMaxBackpacks = 0; }; + class CardboardBox: ReammoBox { accuracy = 1000; diff --git a/dayz_server/compile/server_onPlayerDisconnect.sqf b/dayz_server/compile/server_onPlayerDisconnect.sqf index cd38a749a..9b3c99ab9 100644 --- a/dayz_server/compile/server_onPlayerDisconnect.sqf +++ b/dayz_server/compile/server_onPlayerDisconnect.sqf @@ -35,7 +35,7 @@ dayz_disco = dayz_disco - [_playerID]; if (!isNull _object) then { //Update Vehicle { [_x,"gear"] call server_updateObject } foreach - (nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10]); + (nearestObjects [getPosATL _object, dayz_updateObjects, 10]); if (alive _object) then { [_object,(magazines _object),true,true] call server_playerSync; //[_object,[],true,false] call server_playerSync; diff --git a/dayz_server/compile/server_playerSync.sqf b/dayz_server/compile/server_playerSync.sqf index b55136e4e..3758bf54a 100644 --- a/dayz_server/compile/server_playerSync.sqf +++ b/dayz_server/compile/server_playerSync.sqf @@ -210,7 +210,7 @@ if (_characterID != "0") then { _pos = _this select 0; { [_x, "gear"] call server_updateObject; - } forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10]; + } forEach nearestObjects [_pos, dayz_updateObjects, 10]; //[_charPos] call server_updateNearbyObjects; //Reset timer diff --git a/dayz_server/compile/server_publishObject.sqf b/dayz_server/compile/server_publishObject.sqf index bcabe2b55..6b2037270 100644 --- a/dayz_server/compile/server_publishObject.sqf +++ b/dayz_server/compile/server_publishObject.sqf @@ -5,11 +5,8 @@ _object = _this select 1; _worldspace = _this select 2; _class = _this select 3; -if (!(_object isKindOf "Building")) exitWith { - deleteVehicle _object; -}; _allowed = [_object, "Server"] call check_publishobject; -if (!_allowed) exitWith { }; +if (!_allowed) exitWith { deleteVehicle _object; }; //diag_log ("PUBLISH: Attempt " + str(_object)); @@ -22,11 +19,11 @@ _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; +_object setVariable ["lastUpdate",time]; _object setVariable ["ObjectUID", _uid,true]; +_object setVariable ["characterID",dayz_characterID,true]; -_allowedObjects = ["TentStorage", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ"]; - -if ((typeOf _object) in _allowedObjects) then { +if ((typeOf _object) in dayz_allowedObjects) then { _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}]; }; diff --git a/dayz_server/compile/server_publishVehicle.sqf b/dayz_server/compile/server_publishVehicle.sqf index 64fdaf6b6..c02a94c29 100644 --- a/dayz_server/compile/server_publishVehicle.sqf +++ b/dayz_server/compile/server_publishVehicle.sqf @@ -28,25 +28,8 @@ if (_spawnDMG) then { _totaldam = 0; _hitpoints = _object call vehicle_getHitpoints; { - _dam = 0; - if(["Body",_x,false] call fnc_inString) then { - _dam = call generate_new_damage; - }; - if(["Engine",_x,false] call fnc_inString) then { - _dam = call generate_exp_damage; - }; - if(["HRotor",_x,false] call fnc_inString) then { - _dam = call generate_new_damage; - }; - if(["Fuel",_x,false] call fnc_inString) then { - _dam = call generate_exp_damage; - }; - if(["Wheel",_x,false] call fnc_inString) then { - _dam = call generate_new_damage; - }; - if(["Glass",_x,false] call fnc_inString) then { - _dam = call generate_new_damage; - }; + // generate damage on all parts + _dam = call generate_new_damage; _selection = getText(configFile >> "cfgVehicles" >> _class >> "HitPoints" >> _x >> "name"); @@ -60,11 +43,8 @@ if (_spawnDMG) then { // just set low base dmg - may change later _damage = 0; - // 50% chance that vehicle will have a little gas - _randFuel = random(1); - if(_randFuel > 0.5) then { - _fuel = random(0.5); - }; + // New fuel min max + _fuel = (random(DynamicVehicleFuelHigh-DynamicVehicleFuelLow)+DynamicVehicleFuelLow) / 100; }; }; @@ -134,5 +114,9 @@ dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; _object call fnc_vehicleEventHandler; + // testing - should make sure everyone has eventhandlers for vehicles was unused... + dayzVehicleInit = _object; + publicVariable "dayzVehicleInit"; + diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid)); }; \ No newline at end of file diff --git a/dayz_server/compile/server_publishVehicle2.sqf b/dayz_server/compile/server_publishVehicle2.sqf index 348e5e790..c34f5547a 100644 --- a/dayz_server/compile/server_publishVehicle2.sqf +++ b/dayz_server/compile/server_publishVehicle2.sqf @@ -97,6 +97,12 @@ _key call server_hiveWrite; dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; _object call fnc_vehicleEventHandler; + + // for non JIP users this should make sure everyone has eventhandlers for vehicles. + dayzVehicleInit = _object; + publicVariable "dayzVehicleInit"; + + diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid)); }; \ No newline at end of file diff --git a/dayz_server/compile/server_spawnCrashSite.sqf b/dayz_server/compile/server_spawnCrashSite.sqf index ffee487e5..ef451a5ef 100644 --- a/dayz_server/compile/server_spawnCrashSite.sqf +++ b/dayz_server/compile/server_spawnCrashSite.sqf @@ -79,6 +79,9 @@ while {true} do { _crash setVariable ["ObjectID",1,true]; + // Disable simulation server side + _crash enableSimulation false; + _num = round(random _randomizedLoot) + _guaranteedLoot; if(_crashModel == "Mass_grave") then { @@ -97,7 +100,7 @@ while {true} do { _config = configFile >> "CfgBuildingLoot" >> _lootTable; _itemTypes = [] + getArray (_config >> "itemType"); - _index = dayz_CBLBase find _lootTable; + _index = dayz_CBLBase find toLower(_lootTable); _weights = dayz_CBLChances select _index; _cntWeights = count _weights; diff --git a/dayz_server/compile/server_updateNearbyObjects.sqf b/dayz_server/compile/server_updateNearbyObjects.sqf index 6a00dbbd4..b86c7d7ed 100644 --- a/dayz_server/compile/server_updateNearbyObjects.sqf +++ b/dayz_server/compile/server_updateNearbyObjects.sqf @@ -3,4 +3,4 @@ _pos = _this select 0; { [_x, "gear"] call server_updateObject; -} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10]; +} forEach nearestObjects [_pos, dayz_updateObjects, 10]; diff --git a/dayz_server/compile/server_updateObject.sqf b/dayz_server/compile/server_updateObject.sqf index cc0af84f6..e36f9328c 100644 --- a/dayz_server/compile/server_updateObject.sqf +++ b/dayz_server/compile/server_updateObject.sqf @@ -33,15 +33,15 @@ if (!_parachuteWest) then { _isNotOk = true; // Loop to wait it out - _counter = _object getVariable ["markedForRemoval","0"]; + _counter = _object getVariable ["markedForRemoval",0]; _removeCounter = _counter + 1; _object setVariable ["markedForRemoval",(_counter + 1)]; }; }; -if (_isNotOk and _removeCounter < 5) exitWith { diag_log(format["About to remove vehicle: %1 - %2 / 10", typeOf _object, _removeCounter]); }; -if (_isNotOk and _removeCounter >= 5) exitWith { deleteVehicle _object; }; +if (_isNotOk and _removeCounter < 10) exitWith { diag_log(format["About to remove vehicle: %1 - %2 / 10", typeOf _object, _removeCounter]); }; +if (_isNotOk and _removeCounter >= 10) exitWith { deleteVehicle _object; }; _lastUpdate = _object getVariable ["lastUpdate",time]; diff --git a/dayz_server/init/server_functions.sqf b/dayz_server/init/server_functions.sqf index ad203c1d5..ef8af8a11 100644 --- a/dayz_server/init/server_functions.sqf +++ b/dayz_server/init/server_functions.sqf @@ -58,9 +58,8 @@ check_publishobject = { _allowed = false; diag_log format ["DEBUG: Checking if Object: %1 is allowed published by %2", _object, _playername]; - _allowedObjects = ["TentStorage", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ"]; - if ((typeOf _object) in _allowedObjects) then { + if ((typeOf _object) in dayz_allowedObjects) then { diag_log format ["DEBUG: Object: %1 published by %2 is Safe",_object, _playername]; _allowed = true; }; @@ -257,8 +256,9 @@ spawn_vehicles = { clearMagazineCargoGlobal _veh; // Add 0-3 loots to vehicle using random cfgloots - _allCfgLoots = [] + (getArray (configFile >> "cfgLoot")); _num = floor(random 4); + _allCfgLoots = ["trash","civilian","food","generic","medical","military","policeman","hunter","worker","clothes","militaryclothes","specialclothes","trash"]; + diag_log("DEBUG: spawing loot inside vehicle " + str(_allCfgLoots)); @@ -320,6 +320,8 @@ spawn_roadblocks = { diag_log("DEBUG: Spawning a crashed " + _spawnveh + " with " + _spawnloot + " at " + str(_position)); _veh = createVehicle [_spawnveh,_position, [], 0, "CAN_COLLIDE"]; + _veh enableSimulation false; + // Randomize placement a bit _veh setDir round(random 360); _veh setpos _position; @@ -364,6 +366,13 @@ if(isnil "DynamicVehicleDamageHigh") then { DynamicVehicleDamageHigh = 100; }; +if(isnil "DynamicVehicleFuelLow") then { + DynamicVehicleFuelLow = 0; +}; +if(isnil "DynamicVehicleFuelHigh") then { + DynamicVehicleFuelHigh = 100; +}; + // Damage generator function generate_new_damage = { private ["_damage"]; diff --git a/dayz_server/system/server_monitor.sqf b/dayz_server/system/server_monitor.sqf index 38a8a5fa7..ddd8dc661 100644 --- a/dayz_server/system/server_monitor.sqf +++ b/dayz_server/system/server_monitor.sqf @@ -25,7 +25,6 @@ if (_script != "") then serverVehicleCounter = []; -_allowedObjects = ["TentStorage", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ"]; //Stream in objects /* STREAM OBJECTS */ //Send the key @@ -99,13 +98,10 @@ _allowedObjects = ["TentStorage", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1 clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; - if ((typeOf _object) in _allowedObjects) then { - // Forces object to ground may not be needed - // _pos set [2,0]; - // Must be set to damage buildables + if ((typeOf _object) in dayz_allowedObjects) then { _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}]; }; - + _object setdir _dir; _object setpos _pos; _object setDamage _damage; @@ -190,7 +186,6 @@ _allowedObjects = ["TentStorage", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1 }; //Monitor the object - //_object enableSimulation false; dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; }; } forEach _myArray; diff --git a/dayz_weapons/config.cpp b/dayz_weapons/config.cpp index 74a107d38..8e6adaee8 100644 --- a/dayz_weapons/config.cpp +++ b/dayz_weapons/config.cpp @@ -650,6 +650,8 @@ class cfgMagazines { text = "Melt into Bars"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemTinBar",1}}; input[] = {{"TrashTinCan",6}}; }; @@ -669,6 +671,8 @@ class cfgMagazines { text = "Melt into Bars"; script = "spawn player_craftItem;"; + neednearby[] = {"fire"}; + requiretools[] = {"ItemToolbox"}; output[] = {{"ItemAluminumBar",1}}; input[] = {{"ItemSodaEmpty",6}}; };