diff --git a/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp b/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp index 036afefef..e8c305905 100644 --- a/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp +++ b/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp @@ -3,7 +3,7 @@ #define COMBINE_MAG class CombineMag\ {\ text = $STR_MAG_COMBINE;\ - script = "spawn player_combineMag;"; // r_action_count = r_action_count + 1;\ + script = "spawn player_combineMag;";\ }; #include "9x18.hpp" //Makarov diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf index e1af8aa8f..3358049b3 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf @@ -146,15 +146,16 @@ if (_enoughMoney) then { _location = [([player] call FNC_GetPos),0,20,1,0,2000,0] call BIS_fnc_findSafePos; }; - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; - _location = ([_veh] call FNC_GetPos); + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; if (_buyingType in ["trade_any_vehicle_free", "trade_any_bicycle", "trade_any_bicycle_old"]) then { - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,true,"0",_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,true,"0",_activatingPlayer]; } else { - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,false,_keySelected,_activatingPlayer]; }; publicVariableServer "PVDZE_veh_Publish2"; + [_part_out,_sign] spawn fn_waitForObject; _keySelected; }; //systemChat localize "STR_EPOCH_PLAYER_105"; // "Stand still to complete trade". Medic animation loop no longer used. diff --git a/SQF/dayz_code/actions/trade_any_bicycle.sqf b/SQF/dayz_code/actions/trade_any_bicycle.sqf index 556c99824..7f43d9738 100644 --- a/SQF/dayz_code/actions/trade_any_bicycle.sqf +++ b/SQF/dayz_code/actions/trade_any_bicycle.sqf @@ -1,4 +1,4 @@ -private ["_veh","_location","_isOk","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; +private ["_sign","_location","_isOk","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; DZE_ActionInProgress = true; @@ -127,12 +127,12 @@ if (_finished) then { }; //place vehicle spawn marker (local) - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; - _location = (getPosATL _veh); - - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,true,dayz_characterID,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,true,dayz_characterID,_activatingPlayer]; publicVariableServer "PVDZE_veh_Publish2"; + [_part_out,_sign] spawn fn_waitForObject; format[localize "STR_EPOCH_PLAYER_180",_qty_in,_textPartIn,_textPartOut] call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/actions/trade_any_bicycle_old.sqf b/SQF/dayz_code/actions/trade_any_bicycle_old.sqf index 5840c58b7..f083b1b32 100644 --- a/SQF/dayz_code/actions/trade_any_bicycle_old.sqf +++ b/SQF/dayz_code/actions/trade_any_bicycle_old.sqf @@ -1,4 +1,4 @@ -private ["_veh","_location","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_playerNear"]; +private ["_sign","_location","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_playerNear"]; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; DZE_ActionInProgress = true; @@ -104,14 +104,12 @@ if (_qty >= _qty_in) then { }; //place vehicle spawn marker (local) - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; - _location = (getPosATL _veh); - - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,true,dayz_characterID,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,true,dayz_characterID,_activatingPlayer]; publicVariableServer "PVDZE_veh_Publish2"; - - player reveal _veh; + [_part_out,_sign] spawn fn_waitForObject; format[localize "str_epoch_player_180",_qty_in,_textPartIn,_textPartOut] call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/actions/trade_any_boat.sqf b/SQF/dayz_code/actions/trade_any_boat.sqf index 6e5750902..9f476e92e 100644 --- a/SQF/dayz_code/actions/trade_any_boat.sqf +++ b/SQF/dayz_code/actions/trade_any_boat.sqf @@ -1,4 +1,4 @@ -private ["_veh","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; +private ["_sign","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; DZE_ActionInProgress = true; @@ -132,12 +132,12 @@ if (_finished) then { }; //place vehicle spawn marker (local) - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; - _location = (getPosATL _veh); - - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; publicVariableServer "PVDZE_veh_Publish2"; + [_part_out,_sign] spawn fn_waitForObject; format[localize "STR_EPOCH_ACTIONS_11",_qty_in,_textPartIn,_textPartOut] call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/actions/trade_any_boat_old.sqf b/SQF/dayz_code/actions/trade_any_boat_old.sqf index 9362d86ae..06a6cb56c 100644 --- a/SQF/dayz_code/actions/trade_any_boat_old.sqf +++ b/SQF/dayz_code/actions/trade_any_boat_old.sqf @@ -1,4 +1,4 @@ -private ["_veh","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_okToSell","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_playerNear"]; +private ["_sign","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_okToSell","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_playerNear"]; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; DZE_ActionInProgress = true; @@ -110,14 +110,12 @@ if (_qty >= _qty_in) then { }; //place vehicle spawn marker (local) - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; - - _location = (getPosATL _veh); + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; publicVariableServer "PVDZE_veh_Publish2"; - - player reveal _veh; + [_part_out,_sign] spawn fn_waitForObject; format["Bought %3 for %1 %2, key added to toolbelt.",_qty_in,_textPartIn,_textPartOut] call dayz_rollingMessages; } else { diff --git a/SQF/dayz_code/actions/trade_any_vehicle.sqf b/SQF/dayz_code/actions/trade_any_vehicle.sqf index 7163a4673..f0189ed2c 100644 --- a/SQF/dayz_code/actions/trade_any_vehicle.sqf +++ b/SQF/dayz_code/actions/trade_any_vehicle.sqf @@ -1,4 +1,4 @@ -private ["_veh","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_keyColor","_damage","_tireDmg","_tires","_okToSell","_temp_keys","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; +private ["_sign","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_keyColor","_damage","_tireDmg","_tires","_okToSell","_temp_keys","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; DZE_ActionInProgress = true; @@ -131,12 +131,12 @@ if (_finished) then { }; //place vehicle spawn marker (local) - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; - _location = (getPosATL _veh); - - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; publicVariableServer "PVDZE_veh_Publish2"; + [_part_out,_sign] spawn fn_waitForObject; format[localize "STR_EPOCH_ACTIONS_11",_qty_in,_textPartIn,_textPartOut] call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/actions/trade_any_vehicle_free.sqf b/SQF/dayz_code/actions/trade_any_vehicle_free.sqf index 965916f34..b47ff0d6f 100644 --- a/SQF/dayz_code/actions/trade_any_vehicle_free.sqf +++ b/SQF/dayz_code/actions/trade_any_vehicle_free.sqf @@ -1,4 +1,4 @@ -private ["_veh","_location","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; +private ["_sign","_location","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"]; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; DZE_ActionInProgress = true; @@ -130,12 +130,12 @@ if (_finished) then { }; //place vehicle spawn marker (local) - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; - _location = (getPosATL _veh); - - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,true,0,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,true,0,_activatingPlayer]; publicVariableServer "PVDZE_veh_Publish2"; + [_part_out,_sign] spawn fn_waitForObject; }; } else { diff --git a/SQF/dayz_code/actions/trade_any_vehicle_old.sqf b/SQF/dayz_code/actions/trade_any_vehicle_old.sqf index 3c0eb299f..971559602 100644 --- a/SQF/dayz_code/actions/trade_any_vehicle_old.sqf +++ b/SQF/dayz_code/actions/trade_any_vehicle_old.sqf @@ -1,4 +1,4 @@ -private ["_veh","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_playerNear"]; +private ["_sign","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_playerNear"]; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; DZE_ActionInProgress = true; @@ -117,12 +117,12 @@ if (_qty >= _qty_in) then { }; //place vehicle spawn marker (local) - _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; + _sign = "Sign_arrow_down_large_EP1" createVehicleLocal _location; + _location = [_sign] call FNC_GetPos; - _location = (getPosATL _veh); - - PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; + PVDZE_veh_Publish2 = [[_dir,_location],_part_out,false,_result select 1,_activatingPlayer]; publicVariableServer "PVDZE_veh_Publish2"; + [_part_out,_sign] spawn fn_waitForObject; format["Bought %3 for %1 %2, key added to toolbelt.",_qty_in,_textPartIn,_textPartOut] call dayz_rollingMessages; } else { diff --git a/SQF/dayz_code/compile/fn_waitForObject.sqf b/SQF/dayz_code/compile/fn_waitForObject.sqf new file mode 100644 index 000000000..bdbbe213e --- /dev/null +++ b/SQF/dayz_code/compile/fn_waitForObject.sqf @@ -0,0 +1,12 @@ +private ["_object","_sign"]; + +_object = _this select 0; +_sign = _this select 1; + +waitUntil { + uiSleep 1; + !isNull (nearestObject [player,_object]) +}; + +deleteVehicle _sign; +player reveal (nearestObject [player,_object]); \ No newline at end of file diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 1d6af9f57..ad227c134 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -166,6 +166,7 @@ if (!isDedicated) then { epoch_returnChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\epoch_returnChange.sqf"; fn_gearMenuChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf"; fn_pauseMenuChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_pauseMenuChecks.sqf"; + fn_waitForObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_waitForObject.sqf"; player_onPause = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_onPause.sqf"; player_addDuplicateTool = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_addDuplicateTool.sqf"; player_antiWall = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_antiWall.sqf"; diff --git a/SQF/dayz_server/compile/server_publishVehicle2.sqf b/SQF/dayz_server/compile/server_publishVehicle2.sqf index dffeb210d..a96aa423e 100644 --- a/SQF/dayz_server/compile/server_publishVehicle2.sqf +++ b/SQF/dayz_server/compile/server_publishVehicle2.sqf @@ -1,11 +1,10 @@ -private ["_activatingPlayer","_isOK","_object","_worldspace","_location","_dir","_class","_uid","_key","_keySelected","_characterID","_donotusekey"]; -//PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer]; -_object = _this select 0; -_worldspace = _this select 1; -_class = _this select 2; -_donotusekey = _this select 3; -_keySelected = _this select 4; -_activatingPlayer = _this select 5; +private ["_activatingPlayer","_isOK","_worldspace","_location","_dir","_class","_uid","_key","_keySelected","_characterID","_donotusekey"]; +//PVDZE_veh_Publish2 = [[_dir,_location],_part_out,false,_keySelected,_activatingPlayer]; +_worldspace = _this select 0; +_class = _this select 1; +_donotusekey = _this select 2; +_keySelected = _this select 3; +_activatingPlayer = _this select 4; if(_donotusekey) then { _isOK = true; @@ -21,7 +20,6 @@ if(_donotusekey) then { _characterID = str(getNumber(configFile >> "CfgWeapons" >> _keySelected >> "keyid")); }; -diag_log ("PUBLISH: Attempt " + str(_object)); _dir = _worldspace select 0; _location = _worldspace select 1; _uid = _worldspace call dayz_objectUID2; @@ -32,17 +30,16 @@ diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; // Switched to spawn so we can wait a bit for the ID -[_object,_uid,_characterID,_class,_dir,_location,_donotusekey,_activatingPlayer] spawn { +[_uid,_characterID,_class,_dir,_location,_donotusekey,_activatingPlayer] spawn { private ["_object","_uid","_characterID","_done","_retry","_key","_result","_outcome","_oid","_class","_location","_object_para","_donotusekey","_activatingPlayer"]; - _object = _this select 0; - _uid = _this select 1; - _characterID = _this select 2; - _class = _this select 3; - //_dir = _this select 4; - _location = _this select 5; - _donotusekey = _this select 6; - _activatingPlayer = _this select 7; + _uid = _this select 0; + _characterID = _this select 1; + _class = _this select 2; + //_dir = _this select 3; + _location = _this select 4; + _donotusekey = _this select 5; + _activatingPlayer = _this select 6; _done = false; _retry = 0; @@ -55,7 +52,6 @@ _key call server_hiveWrite; _outcome = _result select 0; if (_outcome == "PASS") then { _oid = _result select 1; - //_object setVariable ["ObjectID", _oid, true]; diag_log("CUSTOM: Selected " + str(_oid)); _done = true; _retry = 100; @@ -68,9 +64,6 @@ _key call server_hiveWrite; }; }; - // Remove marker - deleteVehicle _object; - if(!_done) exitWith { diag_log("CUSTOM: failed to get id for : " + str(_uid)); }; if(DZE_TRADER_SPAWNMODE) then {