diff --git a/SQF/dayz_code/actions/object_disassembly.sqf b/SQF/dayz_code/actions/object_disassembly.sqf deleted file mode 100644 index 90d3000f4..000000000 --- a/SQF/dayz_code/actions/object_disassembly.sqf +++ /dev/null @@ -1,165 +0,0 @@ -private ["_cursorTarget","_onLadder","_isWater","_alreadyRemoving","_characterID","_objectID","_objectUID","_ownerArray","_dir", - "_realObjectStillThere","_upgrade","_entry","_parent","_requiredParts","_requiredTools","_model","_needTool","_displayname", - "_whpos","_wh","_object","_vector","_dis","_puid","_variables"]; - - -_cursorTarget = _this; - -// ArmaA2 bug workaround: sometimes the object is null -if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then { - _cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5]; - _cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 }; -}; - -if(isNull _cursorTarget) exitWith { localize "str_disassembleNoOption" call dayz_rollingMessages; }; - -//Normal blocked stuff -_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; -_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming; -if(_isWater or _onLadder) exitWith { localize "str_water_ladder_cant_do" call dayz_rollingMessages; }; - -_alreadyRemoving = _cursorTarget getVariable["ObjectLocked",0]; -if (_alreadyRemoving == 1) exitWith { localize "str_disassembleInProgress" call dayz_rollingMessages; }; - -if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; -dayz_actionInProgress = true; - -_cursorTarget setVariable["ObjectLocked",1,true]; -_characterID = _cursorTarget getVariable ["characterID","0"]; -_objectID = _cursorTarget getVariable ["ObjectID","0"]; -_objectUID = _cursorTarget getVariable ["ObjectUID","0"]; -_ownerArray = _cursorTarget getVariable ["ownerArray",[]]; -_dir = round getDir _cursorTarget; -_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget]; -_pos = getposATL _cursorTarget; -if (((_vector select 1) select 2) - 1 > 0.001) then { _pos set [2,0]; }; - -_realObjectStillThere = true; -_upgrade = typeOf _cursorTarget; -_entry = configFile >> "CfgVehicles" >> _upgrade; -r_interrupt = false; - -_disassemblyParts = [] + (getArray (_entry >> "Disassembly" >> "removedParts")); -_disassemblyReturnChance = getNumber (_entry >> "Disassembly" >> "removedChance"); - -for "_i" from 1 to 20 do { - _parent = inheritsFrom _entry; - _requiredParts = [] + (getArray (_parent >> "Upgrade" >> "requiredParts")); - _requiredTools = [] + (getArray (_parent >> "Upgrade" >> "requiredTools")); - _model = getText (_parent >> "model"); // model of parent - _displayname = getText (_entry >> "displayName"); // name of current - diag_log format["%1 - %2 - %3 - %4 - %5",_parent,_requiredParts,_requiredTools,_model,_displayname]; - - // check the tools needed - _needTool = ""; - { - if !(_x in items player) exitWith { _needTool = getText(configFile >> "CfgWeapons" >> _x >> "displayName"); }; - } count _requiredTools; - - if (_needTool != "") exitWith { format[localize "str_disassembleMissingTool",_needTool] call dayz_rollingMessages; }; - - if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0) then { - player playActionNow "Medic"; - _dis=20; - [player,"tentpack",0,false,20] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; - //wait animation starts and block - waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 1}; - }; - - if (_realObjectStillThere) then { // send to server the destroy request - _realObjectStillThere = false; - PVDZ_obj_Destroy = [_objectID,_objectUID,player,_cursorTarget,dayz_authKey]; - publicVariableServer "PVDZ_obj_Destroy"; - diag_log [diag_ticktime, __FILE__, "Networked object, request to destroy", PVDZ_obj_Destroy]; - } else { - // remove object - deleteVehicle _cursorTarget; - }; - _cursorTarget = objNull; - - ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; - - // check whether we reached the base class, for which no P3D is defined - if (count _requiredParts == 0) exitwith { - diag_log [diag_ticktime, __FILE__, "Dismantle terminated, last building deleted is:", _upgrade]; - }; - - // create a weaponholder with dismissed parts - _whpos=player modelToWorld [2 * sin(30*_i), 2 * cos(30*_i), 0]; - _whpos set [2,0]; - _wh = createVehicle ["WeaponHolder", _whpos, [], 0, "CAN_COLLIDE"]; - _wh setDir (30*_i); - _wh setPosATL _whpos; - { - //Never return _disassemblyParts_. - if (!(_x in _disassemblyParts)) then { - //Random other returned items. - if ([_disassemblyReturnChance] call fn_chance) then { - if (isClass (configFile >> "CfgMagazines" >> _x)) - then { _wh addMagazineCargoGlobal [_x, 1]; } - else { _wh addWeaponCargoGlobal [_x, 1]; }; - }; - }; - } forEach _requiredParts; - diag_log [diag_ticktime, __FILE__, "Pile created with:", _requiredParts]; - - // create the parent object locally - _upgrade = configName _parent; - if (getNumber(_parent >> "scope")==2) then { - _cursorTarget = _upgrade createVehicleLocal getMarkerpos "respawn_west"; - _cursorTarget setVectorDirAndUp _vector; - _cursorTarget setPosATL _pos; - }; - - uiSleep 1.5; - - if (r_interrupt) exitwith { - diag_log [diag_ticktime, __FILE__, "Operation interrupted, last building deleted is:", _upgrade]; - }; - - _entry = _parent; -}; - -// wait animation ends -waitUntil {r_interrupt or (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0)}; -if (r_interrupt and vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - r_interrupt = false; -}; - -if (!_realObjectStillThere) then { - // current object is a local one, replace it by a networked one, with all attributes - // and request a HIVE save - if (!isNull _cursorTarget) then { - _upgrade = typeOf _cursorTarget; - deleteVehicle _cursorTarget; - if (getNumber(_parent >> "scope")==2) then { - _object = createVehicle [_upgrade, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"]; - //if (_object isKindOf "DZ_buildables") then { _object allowDamage false; }; - _object setVectorDirAndUp _vector; - _object setPosATL _pos; - _puid = getPlayerUID player; - if (!(_puid in _ownerArray)) then { - _ownerArray set [ count _ownerArray, _puid ]; - }; - _object setVariable ["ownerArray",_ownerArray,true]; - _variables = [[ "ownerArray", _ownerArray]]; - _object setVariable ["characterID",_characterID,true]; - PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],_variables,player,dayz_authKey]; - publicVariableServer "PVDZ_obj_Publish"; - diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish]; - /* - //Send maintenance info - PVDZ_veh_Save = [_object,"maintenance"]; - publicVariableServer "PVDZ_veh_Save";*/ - player reveal _object; - }; - }; -}; - -localize "str_disassembleDone" call dayz_rollingMessages; - -_cursorTarget setVariable["ObjectLocked",0,true]; -dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/object_maintenance.sqf b/SQF/dayz_code/actions/object_maintenance.sqf deleted file mode 100644 index ce6474311..000000000 --- a/SQF/dayz_code/actions/object_maintenance.sqf +++ /dev/null @@ -1,103 +0,0 @@ -/* - Upkeep on built items. -*/ - -#define MAINTENANCE_NUTRITION_VALUES [20,40,15,0] - - -private ["_cursorTarget","_item","_classname","_displayname","_requiredTools","_requiredParts","_onLadder","_isWater","_startMaintenance","_dis","_sfx","_finished"]; - -_cursorTarget = _this; - -// ArmaA2 bug workaround: sometimes the object is null -if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then { - _cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5]; - _cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 }; -}; - -if(isNull _cursorTarget) exitWith { - localize "str_maintenanceNoOption" call dayz_rollingMessages; -}; - -//Item -_item = typeof _cursorTarget; -//diag_log (str(_item)); - -_classname = configFile >> "CfgVehicles" >> _item; -_displayname = getText (_classname >> "displayname"); - -//Get tools needed -_requiredTools = getArray (_classname >> "Maintenance" >> "requiredTools"); -//diag_log (str(_requiredTools)); - -//get parts needed -_requiredParts = getArray (_classname >> "Maintenance" >> "requiredParts"); -//diag_log (str(_requiredParts)); - -//Normal blocked stuff -_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; -_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming; - -_startMaintenance = true; - -if(_isWater or _onLadder) exitWith { - localize "str_water_ladder_cant_do" call dayz_rollingMessages; -}; - -if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; -dayz_actionInProgress = true; - -// lets check player has requiredTools for upgrade -{ - if (!(_x IN items player)) exitWith { - format[localize "str_maintenanceMissingTool",_x] call dayz_rollingMessages; //"Missing %1 to do maintenance %2." - _startMaintenance = false; - }; -} count _requiredTools; - -// lets check player has requiredParts for upgrade -{ - if (!(_x IN magazines player)) exitWith { - format[localize "str_maintenanceMissingPart",_x,_displayname] call dayz_rollingMessages; //"Missing %1 to maintenance %2." - _startMaintenance = false; - }; -} count _requiredParts; - - -if (_startMaintenance) then { - _dis=20; - _sfx = "tentpack"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - [player,_dis,true,(getPosATL player)] call player_alertZombies; - - _finished = ["Medic",1] call fn_loopAction; - - if (_finished) then { - //Double check player did not drop any items - { - if !(_x in magazines player) exitWith { - format[localize "str_maintenanceMissingPart",_x,_displayname] call dayz_rollingMessages; //"Missing %1 to maintenance %2." - _startMaintenance = false; - }; - } count _requiredParts; - - if (!_startMaintenance) exitWith {}; - { player removeMagazine _x } count _requiredParts; - - ["Working",0,MAINTENANCE_NUTRITION_VALUES] call dayz_NutritionSystem; // Added Nutrition-Factor for work - - PVDZ_veh_Save = [_cursorTarget,"maintenance"]; - if (isServer) then { - PVDZ_veh_Save call server_updateObject; - } else { - publicVariableServer "PVDZ_veh_Save"; - }; - - //PVDZ_object_replace = _cursorTarget; - //publicVariableServer "PVDZ_object_replace"; - _cursorTarget setVariable["Maintenance",false,true]; - localize "str_maintenanceDone" call dayz_rollingMessages; - }; -}; - -dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/show_dialog.sqf b/SQF/dayz_code/actions/show_dialog.sqf deleted file mode 100644 index f260b8af1..000000000 --- a/SQF/dayz_code/actions/show_dialog.sqf +++ /dev/null @@ -1,22 +0,0 @@ -private ["_trader_data", "_dialog"]; - -if (dayz_actionInProgress) exitWith {localize "STR_EPOCH_PLAYER_103" call dayz_rollingMessages;}; - -_trader_data = (_this select 3); - -_dialog = createdialog "TraderDialog"; -lbClear TraderDialogCatList; -lbClear TraderDialogItemList; - -TraderCurrentCatIndex = -1; -TraderItemList = []; - -TraderCatList = []; -{ - private ["_index", "_x"]; - _index = lbAdd [TraderDialogCatList, _x select 0]; - TraderCatList set [count TraderCatList, _x select 1]; -} count _trader_data; -waitUntil { !dialog }; -TraderCurrentCatIndex = -1; -TraderCatList = []; diff --git a/SQF/dayz_code/compile/player_hiveTrading.sqf b/SQF/dayz_code/compile/player_hiveTrading.sqf deleted file mode 100644 index a5abf9f66..000000000 --- a/SQF/dayz_code/compile/player_hiveTrading.sqf +++ /dev/null @@ -1,215 +0,0 @@ -// trader menu gui by maca134 -TraderDialogCatList = 12000; -TraderDialogItemList = 12001; -TraderDialogBuyPrice = 12002; -TraderDialogSellPrice = 12003; -TraderDialogBuyBtn = 12004; -TraderDialogSellBtn = 12005; -TraderDialogCurrency = 12006; - -TraderCurrentCatIndex = -1; -TraderCatList = []; -TraderItemList = []; - -TraderDialogLoadItemList = { - private ["_index","_trader_id","_activatingPlayer","_objclass","_item_list"]; - TraderItemList = []; - _index = _this select 0; - - if (_index < 0 || TraderCurrentCatIndex == _index) exitWith {}; - TraderCurrentCatIndex = _index; - - _trader_id = TraderCatList select _index; - _activatingPlayer = player; - - lbClear TraderDialogItemList; - ctrlSetText [TraderDialogBuyPrice, ""]; - ctrlSetText [TraderDialogSellPrice, ""]; - - lbAdd [TraderDialogItemList, "Loading items..."]; - - //PVDZE_plr_TradeMenuResult = call compile format["tcacheBuy_%1;",_trader_id]; - PVDZE_plr_TradeMenuResult = missionNamespace getVariable (format["tcacheBuy_%1;",_trader_id]); - - //[[5969,["Ikarus",2],10003,[5,"ItemGoldBar",1],[3,"ItemGoldBar",1],0,588,"trade_any_vehicle"],[5970,["Ikarus_TK_CIV_EP1",2],10006,[5,"ItemGoldBar",1],[3,"ItemGoldBar",1],0,588,"trade_any_vehicle"],[5971,["S1203_TK_CIV_EP1",2],10004,[4,"ItemGoldBar",1],[2,"ItemGoldBar",1],0,588,"trade_any_vehicle"],[5972,["S1203_ambulance_EP1",2],10002,[4,"ItemGoldBar",1],[2,"ItemGoldBar",1],0,588,"trade_any_vehicle"]] - - if(isNil "PVDZE_plr_TradeMenuResult") then { - PVDZE_plr_TradeMenu = [_activatingPlayer,_trader_id]; - publicVariableServer "PVDZE_plr_TradeMenu"; - waitUntil {!isNil "PVDZE_plr_TradeMenuResult"}; - if (count PVDZE_plr_TradeMenuResult > 0) then { - missionNamespace setVariable [(format["tcacheBuy_%1;",_trader_id]),PVDZE_plr_TradeMenuResult]; - }; - }; - - lbClear TraderDialogItemList; - _item_list = []; - { - private ["_header", "_item", "_name", "_type", "_textPart", "_qty", "_buy", "_bqty", "_bname", "_btype", "_btextCurrency", "_sell", "_sqty", "_sname", "_stype", "_stextCurrency", "_order", "_order", "_afile", "_File", "_count", "_bag", "_bagclass", "_index", "_image", "_ignore"]; - _header = _x select 0; // "TRD" - _item = _x select 1; - _name = _item select 0; - _type = _item select 1; - switch (true) do { - case (_type == 1): { - _type = "CfgMagazines"; - }; - case (_type == 2): { - _type = "CfgVehicles"; - }; - case (_type == 3): { - _type = "CfgWeapons"; - }; - }; - - _ignore = false; - if (dayz_classicBloodBagSystem && _name in dayz_typedBags) then { - if (_name == "bloodBagONEG") then {_name = "ItemBloodbag";} else {_ignore = true;}; - }; - - // Display Name of item - _textPart = getText(configFile >> _type >> _name >> "displayName"); - - // Total in stock - _qty = _x select 2; - - // Buy Data from array - _buy = _x select 3; - _bqty = _buy select 0; - _bname = _buy select 1; - _btype = _buy select 2; - switch(true)do{ - case (_btype == 1): { - _btype = "CfgMagazines"; - }; - case (_btype == 2): { - _btype = "CfgVehicles"; - }; - case (_btype == 3): { - _btype = "CfgWeapons"; - }; - }; - - // Display Name of buy item - _btextCurrency = getText(configFile >> _btype >> _bname >> "displayName"); - - _sell = _x select 4; - _sqty = _sell select 0; - _sname = _sell select 1; - _stype = _sell select 2; - switch(true)do{ - case (_stype == 1): { - _stype = "CfgMagazines"; - }; - case (_stype == 2): { - _stype = "CfgVehicles"; - }; - case (_stype == 3): { - _stype = "CfgWeapons"; - }; - }; - // Display Name of sell item - _stextCurrency = getText(configFile >> _stype >> _sname >> "displayName"); - - // Menu sort order - _order = _x select 5; - - // Action file to use for trade - _afile = _x select 7; - _File = "\z\addons\dayz_code\actions\" + _afile + ".sqf"; - - _count = 0; - if(_type == "CfgVehicles") then { - if (_afile == "trade_backpacks") then { - _bag = unitBackpack player; - _bagclass = typeOf _bag; - if(_name == _bagclass) then { - _count = 1; - }; - } else { - if (isClass(configFile >> "CfgVehicles" >> _name)) then { - _count = {(typeOf _x) == _name} count (nearestObjects [(getPosATL player), [_name], Z_VehicleDistance]); - }; - }; - }; - - if(_type == "CfgMagazines") then { - _count = {_x == _name} count magazines player; - }; - - if(_type == "CfgWeapons") then { - _count = {_x == _name} count weapons player; - }; - - if (!_ignore) then { - _index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]]; - - if (_count > 0) then { - lbSetColor [TraderDialogItemList, _index, [0, 1, 0, 1]]; - }; - - _image = getText(configFile >> _type >> _name >> "picture"); - lbSetPicture [TraderDialogItemList, _index, _image]; - - _item_list set [count _item_list, [ - _name, - _textPart, - _bqty, - _bname, - _btextCurrency, - _sqty, - _sname, - _stextCurrency, - _header, - _File - ]]; - }; - } forEach PVDZE_plr_TradeMenuResult; - TraderItemList = _item_list; -}; - -TraderDialogShowPrices = { - private ["_index", "_item"]; - _index = _this select 0; - if (_index < 0) exitWith {}; - while {count TraderItemList < 1} do { uiSleep 1; }; - _item = TraderItemList select _index; - - _qty = {_x == (_item select 3)} count magazines player; - - ctrlSetText [TraderDialogBuyPrice, format["%1 %2", _item select 2, _item select 4]]; - - /* - if(_qty == 0) then { - ctrlEnable [TraderDialogBuyBtn, false]; - } else { - ctrlEnable [TraderDialogBuyBtn, true]; - }; - */ - - ctrlSetText [TraderDialogSellPrice, format["%1 %2", _item select 5, _item select 7]]; -}; - -TraderDialogBuy = { - private ["_index", "_item", "_data"]; - _index = _this select 0; - if (_index < 0) exitWith { - localize "STR_EPOCH_PLAYER_106" call dayz_rollingMessages; - }; - _item = TraderItemList select _index; - _data = [_item select 0, _item select 3, 1, _item select 2, "buy", _item select 4, _item select 1, _item select 8]; - [0, player, '', _data] execVM (_item select 9); - TraderItemList = []; -}; - -TraderDialogSell = { - private ["_index", "_item", "_data"]; - _index = _this select 0; - if (_index < 0) exitWith { - localize "STR_EPOCH_PLAYER_106" call dayz_rollingMessages; - }; - _item = TraderItemList select _index; - _data = [_item select 6, _item select 0, _item select 5, 1, "sell", _item select 1, _item select 7, _item select 8]; - [0, player, '', _data] execVM (_item select 9); - TraderItemList = []; -}; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 71612053c..a81cf7405 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -60,7 +60,6 @@ if (!isDedicated) then { //Objects object_setpitchbank = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setpitchbank.sqf"; object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf"; - //object_dismantle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_dismantle.sqf"; //Collisions //fn_collisions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_collisions.sqf";