From f58858c013c7621318c42ab2bf5cbc8e087c6796 Mon Sep 17 00:00:00 2001 From: vbawol Date: Tue, 29 Jan 2013 00:36:55 -0600 Subject: [PATCH] 0.8 --- MPMissions/DayZ_Epoch_11.Chernarus/init.sqf | 34 ++++++++-- dayz_code/actions/repair.sqf | 1 + dayz_code/actions/repair_vehicle.sqf | 64 ++++++++++++++++++ dayz_code/actions/salvage.sqf | 57 ++++++++++++++++ dayz_code/actions/salvage_vehicle.sqf | 62 +++++++++++++++++ dayz_code/actions/siphonFuel.sqf | 37 ++++++++++ dayz_code/actions/trade_items.sqf | 54 ++++++--------- dayz_code/actions/trade_items_wo_db.sqf | 50 ++++++++------ dayz_code/actions/trade_weapons.sqf | 67 ++++++++---------- dayz_code/compile/fn_damageActions.sqf | 8 +++ dayz_code/compile/fn_selfActions.sqf | 75 +++++++-------------- dayz_code/config.cpp | 2 +- dayz_code/init/variables.sqf | 1 + dayz_code/rscTitles.hpp | 2 +- 14 files changed, 365 insertions(+), 149 deletions(-) create mode 100644 dayz_code/actions/repair_vehicle.sqf create mode 100644 dayz_code/actions/salvage.sqf create mode 100644 dayz_code/actions/salvage_vehicle.sqf create mode 100644 dayz_code/actions/siphonFuel.sqf diff --git a/MPMissions/DayZ_Epoch_11.Chernarus/init.sqf b/MPMissions/DayZ_Epoch_11.Chernarus/init.sqf index ad6886626..e81278c35 100644 --- a/MPMissions/DayZ_Epoch_11.Chernarus/init.sqf +++ b/MPMissions/DayZ_Epoch_11.Chernarus/init.sqf @@ -101,7 +101,7 @@ menu_RU_Citizen3 = [ "friendly" ]; // Auto Traders -menu_CIV_Worker3 = [ +menu_Worker3 = [ [["Cars",41],["Trucks Unarmed",42],["SUV",466],["Buses and Vans",467],["Offroad",43],["Helicopter Unarmed",44],["Military Unarmed",45]], [], "friendly" @@ -149,7 +149,7 @@ menu_RU_Villager3 = [ menu_TK_CIV_Takistani04_EP1 = [ [["Explosives",23]], [], - "hostile" + "neutral" ]; // ["friendly"] must have more than -2000 humanity, @@ -177,7 +177,7 @@ waitUntil {time > 3}; if ((!isServer) && (player != player)) then { - waitUntil {player == player}; + waitUntil {player == player}; waitUntil {time > 3}; }; @@ -202,6 +202,14 @@ if (isServer) then { "Ikarus", "SUV_TK_CIV_EP1", "SUV_Green", + "SUV_Yellow", + "SUV_White", + "SUV_Silver", + "SUV_Red", + "SUV_Pink", + "SUV_Orange", + "SUV_Charcoal", + "SUV_Blue", "UH1H_DZ", "Mi17_Civilian", "LandRover_CZ_EP1", @@ -234,6 +242,14 @@ if (isServer) then { 0.01, // "Ikarus" 0.1, // "SUV_TK_CIV_EP1" 0.1, // "SUV_Green", + 0.1, // "SUV_Yellow", + 0.1, // "SUV_White", + 0.1, // "SUV_Silver", + 0.1, // "SUV_Red", + 0.1, // "SUV_Pink", + 0.1, // "SUV_Orange", + 0.1, // "SUV_Charcoal", + 0.1, // "SUV_Blue", 0.05, // "UH1H_DZ" 0.09, // "Mi17_Civilian" 0.11, // "LandRover_CZ_EP1" @@ -248,7 +264,7 @@ if (isServer) then { 0.1, // "tractor" 0.1]; // "CSJ_GyroP" - AllowedVehiclesLimit = [ 5, // "Old_moto_TK_Civ_EP1", + AllowedVehiclesLimit = [ 5, // "Old_moto_TK_Civ_EP1", 10, // "MMT_Civ" 10, // Old_bike_TK_INS_EP1 5, // "ATV_US_EP1", @@ -256,7 +272,7 @@ if (isServer) then { 5, // "datsun1_civil_3_open", 3, // "Pickup_PK_TK_GUE_EP1", 2, // "Octavia_ACR" - 2, // VWGolf + 2, // "VWGolf" 3, // "Lada1", 3, // "Skoda", 3, // "car_sedan", @@ -266,6 +282,14 @@ if (isServer) then { 2, // "Ikarus" 4, // "SUV_TK_CIV_EP1" 2, // "SUV_Green", + 1, // "SUV_Yellow", + 1, // "SUV_White", + 1, // "SUV_Silver", + 1, // "SUV_Red", + 1, // "SUV_Pink", + 1, // "SUV_Orange", + 1, // "SUV_Charcoal", + 1, // "SUV_Blue", 2, // "UH1H_DZ" 2, // "Mi17_Civilian" 2, // "LandRover_CZ_EP1" diff --git a/dayz_code/actions/repair.sqf b/dayz_code/actions/repair.sqf index ba4323fc3..bc16c433f 100644 --- a/dayz_code/actions/repair.sqf +++ b/dayz_code/actions/repair.sqf @@ -47,6 +47,7 @@ if (_section and _hasToolbox) then { {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; dayz_myCursorTarget = objNull; +s_player_repair_crtl = -1; //check if repaired fully _hitpoints = _vehicle call vehicle_getHitpoints; diff --git a/dayz_code/actions/repair_vehicle.sqf b/dayz_code/actions/repair_vehicle.sqf new file mode 100644 index 000000000..6c071f5eb --- /dev/null +++ b/dayz_code/actions/repair_vehicle.sqf @@ -0,0 +1,64 @@ +private["_activatingPlayer","_trader_id","_category","_action","_id","_type","_loc","_name","_qty","_cost","_qty","_sell","_cur","_order","_tid","_currency","_actionFile","_in","_out","_part","_cat","_cancel","_Display","_File","_textCurrency","_textPart"]; + +// [ _trader_id, _category, _action ]; +_activatingPlayer = _this select 1; + +_vehicle = _this select 3; + +{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; +// dayz_myCursorTarget = _vehicle; + +_allFixed = true; +_hitpoints = _vehicle call vehicle_getHitpoints; + +{ + _damage = [_vehicle,_x] call object_getHit; + _part = "PartGeneric"; + + //change "HitPart" to " - Part" rather than complicated string replace + _cmpt = toArray (_x); + _cmpt set [0,20]; + _cmpt set [1,toArray ("-") select 0]; + _cmpt set [2,20]; + _cmpt = toString _cmpt; + + if(["Engine",_x,false] call fnc_inString) then { + _part = "PartEngine"; + }; + + if(["HRotor",_x,false] call fnc_inString) then { + _part = "PartVRotor"; //yes you need PartVRotor to fix HRotor LOL + }; + + if(["Fuel",_x,false] call fnc_inString) then { + _part = "PartFueltank"; + }; + + if(["Wheel",_x,false] call fnc_inString) then { + _part = "PartWheel"; + }; + + if(["Glass",_x,false] call fnc_inString) then { + _part = "PartGlass"; + }; + + // get every damaged part no matter how tiny damage is! + if (_damage > 0) then { + + _allFixed = false; + _color = "color='#ffff00'"; //yellow + if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange + if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red + + _string = format["Repair%1",_cmpt,_color]; //Repair - Part + _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""]; + s_player_repairActions set [count s_player_repairActions,_handle]; + }; + +} forEach _hitpoints; +if (_allFixed) then { + _vehicle setDamage 0; +}; + + +s_player_repair_crtl = 1; \ No newline at end of file diff --git a/dayz_code/actions/salvage.sqf b/dayz_code/actions/salvage.sqf new file mode 100644 index 000000000..38bfbf8e8 --- /dev/null +++ b/dayz_code/actions/salvage.sqf @@ -0,0 +1,57 @@ +private["_vehicle","_part","_hitpoint","_type","_selection","_array"]; +_id = _this select 2; +_array = _this select 3; +_vehicle = _array select 0; +_part = _array select 1; +_hitpoint = _array select 2; +_type = typeOf _vehicle; + +// +_hasToolbox = "ItemToolbox" in items player; + +// moving this here because we need to know which part needed if we don't have it +_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName"); +_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName"); + +if (_hasToolbox) then { + + _damage = [_vehicle,_hitpoint] call object_getHit; + _vehicle removeAction _id; + + //dont allow removal of damaged parts + if (_damage < 0.15) then { + + _isOK = [player,_part] call BIS_fnc_invAdd; + if (_isOK) then { + + + //Fix the part + _selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name"); + //vehicle is owned by whoever is in it, so we have to have each client try and fix it + + ["dayzSetFix",[_vehicle,_selection,1],_vehicle] call broadcastRpcCallIfLocal; + + player playActionNow "Medic"; + sleep 1; + + [player,"repair",0,false] call dayz_zombieSpeak; + null = [player,50,true,(getPosATL player)] spawn player_alertZombies; + sleep 5; + _vehicle setvelocity [0,0,1]; + + //Success! + cutText [format["You have successfully removed %1 from the %2",_namePart,_nameType], "PLAIN DOWN"]; + + + }; + + + }; + +} else { + cutText [format["You need %1 to remove this part.",_namePart], "PLAIN DOWN"]; +}; + +{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; +dayz_myCursorTarget = objNull; +s_player_repair_crtl = -1; \ No newline at end of file diff --git a/dayz_code/actions/salvage_vehicle.sqf b/dayz_code/actions/salvage_vehicle.sqf new file mode 100644 index 000000000..6c19cb9a9 --- /dev/null +++ b/dayz_code/actions/salvage_vehicle.sqf @@ -0,0 +1,62 @@ +private["_activatingPlayer","_trader_id","_category","_action","_id","_type","_loc","_name","_qty","_cost","_qty","_sell","_cur","_order","_tid","_currency","_actionFile","_in","_out","_part","_cat","_cancel","_Display","_File","_textCurrency","_textPart"]; + +// [ _trader_id, _category, _action ]; +_activatingPlayer = _this select 1; + +_vehicle = _this select 3; + +{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; +// dayz_myCursorTarget = _vehicle; + +_allFixed = true; +_hitpoints = _vehicle call vehicle_getHitpoints; + +{ + _damage = [_vehicle,_x] call object_getHit; + _part = "PartGeneric"; + + //change "HitPart" to " - Part" rather than complicated string replace + _cmpt = toArray (_x); + _cmpt set [0,20]; + _cmpt set [1,toArray ("-") select 0]; + _cmpt set [2,20]; + _cmpt = toString _cmpt; + + if(["Engine",_x,false] call fnc_inString) then { + _part = "PartEngine"; + }; + + if(["HRotor",_x,false] call fnc_inString) then { + _part = "PartVRotor"; //yes you need PartVRotor to fix HRotor LOL + }; + + if(["Fuel",_x,false] call fnc_inString) then { + _part = "PartFueltank"; + }; + + if(["Wheel",_x,false] call fnc_inString) then { + _part = "PartWheel"; + }; + + if(["Glass",_x,false] call fnc_inString) then { + _part = "PartGlass"; + }; + + // allow removal of any lightly damaged parts + if (_damage < 0.25) then { + + // Do not allow removal of engine or fueltanks + if( _part == "PartGlass" or _part == "PartWheel" ) then { + + _color = "color='#ff0000'"; //red + _string = format["Remove %1",_cmpt,_color]; //Remove - Part + _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\salvage.sqf",[_vehicle,_part,_x], 0, false, true, "",""]; + s_player_repairActions set [count s_player_repairActions,_handle]; + }; + }; + +} forEach _hitpoints; + + + +s_player_repair_crtl = 1; \ No newline at end of file diff --git a/dayz_code/actions/siphonFuel.sqf b/dayz_code/actions/siphonFuel.sqf new file mode 100644 index 000000000..e9e6571d8 --- /dev/null +++ b/dayz_code/actions/siphonFuel.sqf @@ -0,0 +1,37 @@ +private["_vehicle","_curFuel","_newFuel","_timeLeft"]; +_vehicle = cursorTarget; + +_canSize = getNumber(configFile >> "cfgMagazines" >> "ItemJerrycan" >> "fuelQuantity"); +_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle); +_capacity = getNumber(_configVeh >> "fuelCapacity"); +_nameType = getText(_configVeh >> "displayName"); +_curFuel = ((fuel _vehicle) * _capacity); +_newFuel = (_curFuel - _canSize); + +// calculate minimum needed fuel +_newFuel = (_newFuel / _capacity); + +if (_newFuel > 0) then { + + player removeMagazine "ItemJerrycanEmpty"; + player addMagazine "ItemJerrycan"; + + player playActionNow "Medic"; + [player,"refuel",0,false] call dayz_zombieSpeak; + + _id = [player,20,true,(getPosATL player)] spawn player_alertZombies; + + sleep 6; + + //apply newFuel to vehicle on every peer + ["dayzSetFuel",[_vehicle,_newFuel]] call broadcastRpcCallAll; + + cutText [format["%1 has been drained for %2 litres of Fuel",_nameType,_canSize], "PLAIN DOWN"]; + sleep 1; + + call fnc_usec_medic_removeActions; + r_action = false; + +} else { + cutText [format["%1 has no fuel.",_nameType], "PLAIN DOWN"]; +}; diff --git a/dayz_code/actions/trade_items.sqf b/dayz_code/actions/trade_items.sqf index c4ace261a..f43468878 100644 --- a/dayz_code/actions/trade_items.sqf +++ b/dayz_code/actions/trade_items.sqf @@ -21,44 +21,32 @@ if (_qty >= _qty_in) then { _bos = 1; }; - _isOk = false; - if(_buy_o_sell == "buy") then { - _config = (configFile >> "cfgMagazines" >> _part_out); - _isOk = [player,_config] call BIS_fnc_invAdd; - } else { - _isOk = true; - }; - - if (_isOk) then { - - ["dayzTradeObject",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure; - diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject]; - - waitUntil {!isNil "dayzTradeResult"}; - - diag_log format["DEBUG Complete Trade: %1", dayzTradeResult]; - - if(dayzTradeResult == "PASS") then { - for "_x" from 1 to _qty_in do { - player removeMagazine _part_in; - }; - for "_x" from 1 to _qty_out do { - player addMagazine _part_out; - }; - - // [player,"repair",0,false] call dayz_zombieSpeak; - cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; - } else { - cutText [format[("Insufficient Stock %1"),_textPartOut] , "PLAIN DOWN"]; + ["dayzTradeObject",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure; + + diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject]; + + waitUntil {!isNil "dayzTradeResult"}; + + diag_log format["DEBUG Complete Trade: %1", dayzTradeResult]; + + if(dayzTradeResult == "PASS") then { + for "_x" from 1 to _qty_in do { + player removeMagazine _part_in; }; - dayzTradeResult = nil; - + for "_x" from 1 to _qty_out do { + player addMagazine _part_out; + }; + + // [player,"repair",0,false] call dayz_zombieSpeak; + cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; } else { - cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"]; - }; + cutText [format[("Insufficient Stock %1"),_textPartOut] , "PLAIN DOWN"]; + }; + dayzTradeResult = nil; + } else { diff --git a/dayz_code/actions/trade_items_wo_db.sqf b/dayz_code/actions/trade_items_wo_db.sqf index c66929273..a8407a399 100644 --- a/dayz_code/actions/trade_items_wo_db.sqf +++ b/dayz_code/actions/trade_items_wo_db.sqf @@ -1,4 +1,4 @@ -private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos"]; +private["_activatingPlayer","_part_out","_part_in","_qty_out","_qty_in","_buy_o_sell","_textPartIn","_textPartOut","_traderID","_counter","_failed","_qty","_isOk","_needed"]; // [part_out,part_in, qty_out, qty_in,]; //_activatingPlayer = _this select 1; @@ -12,34 +12,44 @@ _textPartIn = (_this select 3) select 5; _textPartOut = (_this select 3) select 6; //_traderID = (_this select 3) select 7; +_counter = 0; +_failed = false; + _qty = {_x == _part_in} count magazines player; if (_qty >= _qty_in) then { - _isOk = false; - if(_buy_o_sell == "buy") then { - _config = (configFile >> "cfgMagazines" >> _part_out); - _isOk = [player,_config] call BIS_fnc_invAdd; - } else { - _isOk = true; + // Take currency + for "_x" from 1 to _qty_in do { + player removeMagazine _part_in; }; - if (_isOk) then { - - for "_x" from 1 to _qty_in do { - player removeMagazine _part_in; - }; - - for "_x" from 1 to _qty_out do { + // check for space if buying and do not check if selling + for "_x" from 1 to _qty_out do { + if(_buy_o_sell == "buy") then { + _isOk = [player,_part_out] call BIS_fnc_invAdd; + if (!_isOk) exitWith { _failed = true; }; + _counter = _counter + 1; + } else { player addMagazine _part_out; }; - - // [player,"repair",0,false] call dayz_zombieSpeak; - cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; - - } else { - cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"]; }; + + // revert trade since it failed + if(_failed) then { + // add back currency + for "_x" from 1 to _qty_in do { + player addMagazine _part_in; + }; + // remove partial trade + for "_x" from 1 to _counter do { + player removeMagazine _part_out; + }; + cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"]; + } else { + cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; + }; + } else { _needed = _qty_in - _qty; cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"]; diff --git a/dayz_code/actions/trade_weapons.sqf b/dayz_code/actions/trade_weapons.sqf index 89f336076..f0a3e7151 100644 --- a/dayz_code/actions/trade_weapons.sqf +++ b/dayz_code/actions/trade_weapons.sqf @@ -23,55 +23,44 @@ if(_buy_o_sell == "buy") then { if (_qty >= _qty_in) then { - _isOk = false; - if(_buy_o_sell == "buy") then { - _config = (configFile >> "cfgWeapons" >> _part_out); - _isOk = [player,_config] call BIS_fnc_invAdd; - } else { - _isOk = true; - }; - - if (_isOk) then { - ["dayzTradeObject",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure; + ["dayzTradeObject",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure; - waitUntil {!isNil "dayzTradeResult"}; + waitUntil {!isNil "dayzTradeResult"}; - diag_log format["DEBUG Complete Trade: %1", dayzTradeResult]; + diag_log format["DEBUG Complete Trade: %1", dayzTradeResult]; - if(dayzTradeResult == "PASS") then { + if(dayzTradeResult == "PASS") then { - for "_x" from 1 to _qty_in do { - if(_buy_o_sell == "buy") then { - player removeMagazine _part_in; - } else { - player removeWeapon _part_in; - }; + for "_x" from 1 to _qty_in do { + if(_buy_o_sell == "buy") then { + player removeMagazine _part_in; + } else { + player removeWeapon _part_in; }; - - for "_x" from 1 to _qty_out do { - if(_buy_o_sell == "buy") then { - player addWeapon _part_out; - } else { - player addMagazine _part_out; - }; - }; - - - // [player,"repair",0,false] call dayz_zombieSpeak; - cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; - - {player removeAction _x} forEach s_player_parts;s_player_parts = []; - s_player_parts_crtl = -1; - - } else { - cutText [format[("Insufficient Stock %1"),_textPartOut] , "PLAIN DOWN"]; }; - dayzTradeResult = nil; + + for "_x" from 1 to _qty_out do { + if(_buy_o_sell == "buy") then { + player addWeapon _part_out; + } else { + player addMagazine _part_out; + }; + }; + + + // [player,"repair",0,false] call dayz_zombieSpeak; + cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; + + {player removeAction _x} forEach s_player_parts;s_player_parts = []; + s_player_parts_crtl = -1; + } else { - cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"]; + cutText [format[("Insufficient Stock %1"),_textPartOut] , "PLAIN DOWN"]; }; + dayzTradeResult = nil; + } else { _needed = _qty_in - _qty; diff --git a/dayz_code/compile/fn_damageActions.sqf b/dayz_code/compile/fn_damageActions.sqf index b940f4489..fc20be1f8 100644 --- a/dayz_code/compile/fn_damageActions.sqf +++ b/dayz_code/compile/fn_damageActions.sqf @@ -58,6 +58,7 @@ if (_hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unco _hasBlood = "ItemBloodbag" in magazines player; _hasToolbox = "ItemToolbox" in items player; _hasJerry = "ItemJerrycan" in magazines player; + _hasJerryE = "ItemJerrycanEmpty" in magazines player; _hasEtool = "ItemEtool" in weapons player; _hasWire = "ItemWire" in magazines player; _hasPainkillers = "ItemPainkiller" in magazines player; @@ -126,6 +127,13 @@ if (_hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unco _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"]; r_player_actions set [count r_player_actions,_action]; }; + //CAN WE siphon fuel from THE OBJECT? + if ((fuel _unit > 0) and _hasJerryE) 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"]; + r_player_actions set [count r_player_actions,_action]; + }; + //CAN WE ISSUE ANOTHER KIND OF AMMUNITION? if (count weapons _unit > 0) then { //Get mag array diff --git a/dayz_code/compile/fn_selfActions.sqf b/dayz_code/compile/fn_selfActions.sqf index 4569394ea..132abe73e 100644 --- a/dayz_code/compile/fn_selfActions.sqf +++ b/dayz_code/compile/fn_selfActions.sqf @@ -231,64 +231,37 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) s_player_sleep = -1; }; + + + + + //Repairing Vehicles - if ((dayz_myCursorTarget != cursorTarget) and !_isMan and _hasToolbox and (damage cursorTarget < 1)) then { - _vehicle = cursorTarget; - {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; - dayz_myCursorTarget = _vehicle; - - _allFixed = true; - _hitpoints = _vehicle call vehicle_getHitpoints; + if (_isVehicle and (dayz_myCursorTarget != cursorTarget) and !_isMan and _hasToolbox and (damage cursorTarget < 1)) then { - { - _damage = [_vehicle,_x] call object_getHit; - _part = "PartGeneric"; - - //change "HitPart" to " - Part" rather than complicated string replace - _cmpt = toArray (_x); - _cmpt set [0,20]; - _cmpt set [1,toArray ("-") select 0]; - _cmpt set [2,20]; - _cmpt = toString _cmpt; - - if(["Engine",_x,false] call fnc_inString) then { - _part = "PartEngine"; - }; - - if(["HRotor",_x,false] call fnc_inString) then { - _part = "PartVRotor"; //yes you need PartVRotor to fix HRotor LOL - }; - - if(["Fuel",_x,false] call fnc_inString) then { - _part = "PartFueltank"; - }; + if (s_player_repair_crtl < 0) then { - if(["Wheel",_x,false] call fnc_inString) then { - _part = "PartWheel"; - }; - - if(["Glass",_x,false] call fnc_inString) then { - _part = "PartGlass"; - }; + _vehicle = cursorTarget; - // get every damaged part no matter how tiny damage is! - if (_damage > 0) then { - - _allFixed = false; - _color = "color='#ffff00'"; //yellow - if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange - if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red + dayz_myCursorTarget = _vehicle; - _string = format["Repair%1",_cmpt,_color]; //Repair - Part - _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""]; - s_player_repairActions set [count s_player_repairActions,_handle]; - }; + _menu = dayz_myCursorTarget addAction ["Repair Vehicle", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_vehicle, 0, true, false, "",""]; + _menu1 = dayz_myCursorTarget addAction ["Salvage Vehicle", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_vehicle, 0, true, false, "",""]; - } forEach _hitpoints; - if (_allFixed) then { - _vehicle setDamage 0; + s_player_repairActions set [count s_player_repairActions,_menu]; + s_player_repairActions set [count s_player_repairActions,_menu1]; + + s_player_repair_crtl = 1; + + } else { + {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; + s_player_repair_crtl = -1; }; }; + + + + _humanity = player getVariable ["humanity",0]; @@ -422,6 +395,8 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) } else { //Engineering {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; + s_player_repair_crtl = -1; + dayz_myCursorTarget = objNull; {player removeAction _x} forEach s_player_madsci;s_player_madsci = []; diff --git a/dayz_code/config.cpp b/dayz_code/config.cpp index d83adacf1..1605e34cc 100644 --- a/dayz_code/config.cpp +++ b/dayz_code/config.cpp @@ -33,7 +33,7 @@ class CfgMods hidePicture = 0; hideName = 0; action = "http://www.dayepoch.com"; - version = "0.796"; + version = "0.8"; hiveVersion = 0.96; //0.93 }; }; diff --git a/dayz_code/init/variables.sqf b/dayz_code/init/variables.sqf index 25fd320eb..ebf85fc0c 100644 --- a/dayz_code/init/variables.sqf +++ b/dayz_code/init/variables.sqf @@ -105,6 +105,7 @@ dayz_resetSelfActions = { s_player_warndog = -1; s_player_followdog = -1; s_last_trader = -1; + s_player_repair_crtl = -1; }; call dayz_resetSelfActions; diff --git a/dayz_code/rscTitles.hpp b/dayz_code/rscTitles.hpp index dcbb82f81..ddb2657ba 100644 --- a/dayz_code/rscTitles.hpp +++ b/dayz_code/rscTitles.hpp @@ -87,7 +87,7 @@ class RscDisplayMain : RscStandardDisplay class DAYZ_Version : CA_Version { idc = -1; - text = "DayZ Epoch 0.796 (1.7.5.M1D25)"; + text = "DayZ Epoch 0.8 (1.7.5.M1D25)"; y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)"; }; class CA_TitleMainMenu;