mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
0.994
+ added client side caching of trader menus = faster less server load. + removed stock count on buy menus and replaced with yellow color coding if out of stock. + reworked purchased vehicle spawning and added parachute drop.
This commit is contained in:
@@ -8,24 +8,15 @@ _activatingPlayer = _this select 1;
|
|||||||
_trader_id = (_this select 3) select 0;
|
_trader_id = (_this select 3) select 0;
|
||||||
_category = (_this select 3) select 1;
|
_category = (_this select 3) select 1;
|
||||||
|
|
||||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
dayzTraderMenuResult = call compile format["tcacheBuy_%1;",_trader_id];
|
||||||
|
|
||||||
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
if(isNil "dayzTraderMenuResult") then {
|
||||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||||
publicVariableServer "dayzTraderMenu";
|
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||||
|
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||||
waitUntil {!isNil "dayzTraderMenuResult"};
|
publicVariableServer "dayzTraderMenu";
|
||||||
|
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||||
/*
|
};
|
||||||
`id`,
|
|
||||||
`item` varchar(255) NOT NULL COMMENT '[Class Name,1 = CfgMagazines | 2 = Vehicle | 3 = Weapon]',
|
|
||||||
`qty` int(8) NOT NULL COMMENT 'amount in stock available to buy',
|
|
||||||
`buy` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
|
||||||
`sell` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
|
||||||
`order` int(2) NOT NULL DEFAULT '0' COMMENT '# sort order for addAction menu',
|
|
||||||
`tid` int(8) NOT NULL COMMENT 'Trader Menu ID',
|
|
||||||
`afile` varchar(64) NOT NULL DEFAULT 'trade_items',
|
|
||||||
*/
|
|
||||||
|
|
||||||
diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||||
{
|
{
|
||||||
@@ -103,24 +94,16 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
|||||||
// Allways 1 for now
|
// Allways 1 for now
|
||||||
_out = 1;
|
_out = 1;
|
||||||
|
|
||||||
|
|
||||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
||||||
if(_qty <= 0) then {
|
|
||||||
_Display = format["Buy %1 (Out of Stock: %2)", _textPart, _qty];
|
if (_qty > 0) then {
|
||||||
_part = player addAction [_Display, "\z\addons\dayz_code\actions\trade_cancel.sqf",[], 0, true, false, "",""];
|
_Display = format["Buy %1 (%2) for %3 %4", _textPart, _name, _bqty, _textCurrency];
|
||||||
} else {
|
} else {
|
||||||
// if over 50 in stock lower price to that of sell price
|
_Display = format["<t color='#ffff00'>Buy %1 (%2) for %3 %4</t>", _textPart, _name, _bqty, _textCurrency];
|
||||||
if(_qty >= 50) then {
|
|
||||||
_Display = format["Buy %1 (%2) for %3 %4 (Available: %5)", _textPart, _name, _sqty, _textCurrencySell, _qty];
|
|
||||||
_part = player addAction [_Display, _File,[_name,_sname,_out,_sqty,"buy",_textCurrencySell,_textPart,_header], _order, true, true, "",""];
|
|
||||||
} else {
|
|
||||||
_Display = format["Buy %1 (%2) for %3 %4 (Available: %5)", _textPart, _name, _bqty, _textCurrency, _qty];
|
|
||||||
_part = player addAction [_Display, _File,[_name,_bname,_out,_bqty,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_part = player addAction [_Display, _File,[_name,_bname,_out,_bqty,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
|
||||||
|
|
||||||
diag_log format["DEBUG TRADER: %1", _part];
|
diag_log format["DEBUG TRADER: %1", _part];
|
||||||
s_player_parts set [count s_player_parts,_part];
|
s_player_parts set [count s_player_parts,_part];
|
||||||
|
|
||||||
@@ -129,6 +112,9 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
|||||||
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 0, true, false, "",""];
|
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 0, true, false, "",""];
|
||||||
s_player_parts set [count s_player_parts,_cancel];
|
s_player_parts set [count s_player_parts,_cancel];
|
||||||
|
|
||||||
|
// Cache data in client side global variable
|
||||||
|
call compile format["tcacheBuy_%1 = %2;",_tid,dayzTraderMenuResult];
|
||||||
|
|
||||||
// Clear Data maybe consider cacheing results
|
// Clear Data maybe consider cacheing results
|
||||||
dayzTraderMenuResult = nil;
|
dayzTraderMenuResult = nil;
|
||||||
s_player_parts_crtl = 1;
|
s_player_parts_crtl = 1;
|
||||||
@@ -8,23 +8,15 @@ _activatingPlayer = _this select 1;
|
|||||||
_trader_id = (_this select 3) select 0;
|
_trader_id = (_this select 3) select 0;
|
||||||
_category = (_this select 3) select 1;
|
_category = (_this select 3) select 1;
|
||||||
|
|
||||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
dayzTraderMenuResult = call compile format["tcacheSell_%1;",_trader_id];
|
||||||
|
|
||||||
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
if(isNil "dayzTraderMenuResult") then {
|
||||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||||
publicVariableServer "dayzTraderMenu";
|
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||||
|
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||||
waitUntil {!isNil "dayzTraderMenuResult"};
|
publicVariableServer "dayzTraderMenu";
|
||||||
|
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||||
/*
|
};
|
||||||
`item` varchar(255) NOT NULL COMMENT '[Class Name,1 = CfgMagazines | 2 = Vehicle | 3 = Weapon]',
|
|
||||||
`qty` int(8) NOT NULL COMMENT 'amount in stock available to buy',
|
|
||||||
`buy` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
|
||||||
`sell` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
|
||||||
`order` int(2) NOT NULL DEFAULT '0' COMMENT '# sort order for addAction menu',
|
|
||||||
`tid` int(8) NOT NULL COMMENT 'Trader Menu ID',
|
|
||||||
`afile` varchar(64) NOT NULL DEFAULT 'trade_items',
|
|
||||||
*/
|
|
||||||
|
|
||||||
diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||||
{
|
{
|
||||||
@@ -124,37 +116,17 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// if under 5 in stock raise price to that of buy price
|
if (_count > 0) then {
|
||||||
if(_qty <= 5) then {
|
_Display = format["Sell %1 for %2 %3 each", _textPart, _sqty, _textCurrency];
|
||||||
|
} else {
|
||||||
if (_count > 0) then {
|
_Display = format["<t color='#ffff00'>Sell %1 for %2 %3 each</t>", _textPart, _sqty, _textCurrency];
|
||||||
_Display = format["Sell %1 for %2 %3 each", _textPart, _bqty, _textCurrencyBuy];
|
};
|
||||||
} else {
|
|
||||||
_Display = format["<t color='#ffff00'>Sell %1 for %2 %3 each</t>", _textPart, _bqty, _textCurrencyBuy];
|
|
||||||
};
|
|
||||||
|
|
||||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
|
||||||
|
|
||||||
_part = player addAction [_Display, _File,[_sname,_name,_bqty,_in,"sell",_textPart,_textCurrencyBuy,_header], _order, true, true, "",""];
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (_count > 0) then {
|
|
||||||
_Display = format["Sell %1 for %2 %3 each", _textPart, _sqty, _textCurrency];
|
|
||||||
} else {
|
|
||||||
_Display = format["<t color='#ffff00'>Sell %1 for %2 %3 each</t>", _textPart, _sqty, _textCurrency];
|
|
||||||
};
|
|
||||||
|
|
||||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
|
||||||
|
|
||||||
_part = player addAction [_Display, _File,[_sname,_name,_sqty,_in,"sell",_textPart,_textCurrency,_header], _order, true, true, "",""];
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
||||||
|
_part = player addAction [_Display, _File,[_sname,_name,_sqty,_in,"sell",_textPart,_textCurrency,_header], _order, true, true, "",""];
|
||||||
|
|
||||||
|
|
||||||
diag_log format["DEBUG TRADER: %1", _part];
|
// diag_log format["DEBUG TRADER: %1", _part];
|
||||||
s_player_parts set [count s_player_parts,_part];
|
s_player_parts set [count s_player_parts,_part];
|
||||||
|
|
||||||
} forEach dayzTraderMenuResult;
|
} forEach dayzTraderMenuResult;
|
||||||
@@ -162,6 +134,12 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
|||||||
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 0, true, false, "",""];
|
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 0, true, false, "",""];
|
||||||
s_player_parts set [count s_player_parts,_cancel];
|
s_player_parts set [count s_player_parts,_cancel];
|
||||||
|
|
||||||
// Clear Data maybe consider cacheing results
|
// Cache data in client side global variable
|
||||||
|
call compile format["tcacheSell_%1 = %2;",_tid,dayzTraderMenuResult];
|
||||||
|
|
||||||
|
|
||||||
|
// Clear Data
|
||||||
dayzTraderMenuResult = nil;
|
dayzTraderMenuResult = nil;
|
||||||
|
|
||||||
|
|
||||||
s_player_parts_crtl = 1;
|
s_player_parts_crtl = 1;
|
||||||
|
|||||||
@@ -53,28 +53,13 @@ if (_qty >= _qty_in) then {
|
|||||||
|
|
||||||
_location = [(position player),0,20,1,2,2000,0] call BIS_fnc_findSafePos;
|
_location = [(position player),0,20,1,2,2000,0] call BIS_fnc_findSafePos;
|
||||||
|
|
||||||
//place tent (local)
|
//place vehicle spawn marker (local)
|
||||||
_veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
|
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
_veh setVariable ["JustSpawned",true,true];
|
|
||||||
|
|
||||||
_veh setdir _dir;
|
|
||||||
_veh setpos _location;
|
|
||||||
|
|
||||||
//_veh setPosATL _position;
|
|
||||||
|
|
||||||
_location = getPosATL _veh;
|
|
||||||
|
|
||||||
_veh setVariable ["characterID",dayz_playerUID,true];
|
|
||||||
|
|
||||||
clearWeaponCargoGlobal _veh;
|
|
||||||
clearMagazineCargoGlobal _veh;
|
|
||||||
|
|
||||||
//["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
|
//["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
|
||||||
dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
dayzPublishVeh2 = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||||
publicVariableServer "dayzPublishVeh";
|
publicVariableServer "dayzPublishVeh2";
|
||||||
|
|
||||||
|
|
||||||
_veh call fnc_vehicleEventHandler;
|
_veh call fnc_vehicleEventHandler;
|
||||||
|
|
||||||
player reveal _veh;
|
player reveal _veh;
|
||||||
@@ -99,7 +84,6 @@ if (_qty >= _qty_in) then {
|
|||||||
dayzDeleteObj = [_objectID,_objectUID];
|
dayzDeleteObj = [_objectID,_objectUID];
|
||||||
publicVariableServer "dayzDeleteObj";
|
publicVariableServer "dayzDeleteObj";
|
||||||
|
|
||||||
|
|
||||||
deleteVehicle _obj;
|
deleteVehicle _obj;
|
||||||
|
|
||||||
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||||
@@ -118,7 +102,7 @@ if (_qty >= _qty_in) then {
|
|||||||
if(_buy_o_sell == "buy") then {
|
if(_buy_o_sell == "buy") then {
|
||||||
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
||||||
} else {
|
} else {
|
||||||
cutText [format[("No %1 found within 20 meters."),_textPartOut] , "PLAIN DOWN"];
|
cutText [format[("No %1 found within 20 meters."),_textPartIn] , "PLAIN DOWN"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,25 +59,12 @@ if (_qty >= _qty_in) then {
|
|||||||
_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
|
_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
|
||||||
};
|
};
|
||||||
|
|
||||||
//place tent (local)
|
//place vehicle spawn marker (local)
|
||||||
_veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
|
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
_veh setVariable ["JustSpawned",true,true];
|
|
||||||
|
|
||||||
_veh setdir _dir;
|
|
||||||
_veh setpos _location;
|
|
||||||
|
|
||||||
_location = getPosATL _veh;
|
|
||||||
|
|
||||||
//_veh setVariable ["ObjectUID",dayz_playerUID,true];
|
|
||||||
|
|
||||||
|
|
||||||
clearWeaponCargoGlobal _veh;
|
|
||||||
clearMagazineCargoGlobal _veh;
|
|
||||||
|
|
||||||
//["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
|
//["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
|
||||||
dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
dayzPublishVeh2 = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||||
publicVariableServer "dayzPublishVeh";
|
publicVariableServer "dayzPublishVeh2";
|
||||||
|
|
||||||
// event handlers to correctly track damage client side
|
// event handlers to correctly track damage client side
|
||||||
_veh call fnc_vehicleEventHandler;
|
_veh call fnc_vehicleEventHandler;
|
||||||
@@ -123,7 +110,7 @@ if (_qty >= _qty_in) then {
|
|||||||
if(_buy_o_sell == "buy") then {
|
if(_buy_o_sell == "buy") then {
|
||||||
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
||||||
} else {
|
} else {
|
||||||
cutText [format[("No %1 found within 20 meters."),_textPartOut] , "PLAIN DOWN"];
|
cutText [format[("No %1 found within 20 meters."),_textPartIn] , "PLAIN DOWN"];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class CfgMods
|
|||||||
hidePicture = 0;
|
hidePicture = 0;
|
||||||
hideName = 0;
|
hideName = 0;
|
||||||
action = "http://www.dayzepoch.com";
|
action = "http://www.dayzepoch.com";
|
||||||
version = "0.993";
|
version = "0.994";
|
||||||
hiveVersion = 0.96; //0.93
|
hiveVersion = 0.96; //0.93
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ if (isServer) then {
|
|||||||
|
|
||||||
// Dayz epoch custom
|
// Dayz epoch custom
|
||||||
"dayzPublishVeh" addPublicVariableEventHandler {(_this select 1) spawn server_publishVeh};
|
"dayzPublishVeh" addPublicVariableEventHandler {(_this select 1) spawn server_publishVeh};
|
||||||
|
"dayzPublishVeh2" addPublicVariableEventHandler {(_this select 1) spawn server_publishVeh2};
|
||||||
"dayzTradeObject" addPublicVariableEventHandler {(_this select 1) spawn server_tradeObj};
|
"dayzTradeObject" addPublicVariableEventHandler {(_this select 1) spawn server_tradeObj};
|
||||||
"dayzTraderMenu" addPublicVariableEventHandler {(_this select 1) spawn server_traders};
|
"dayzTraderMenu" addPublicVariableEventHandler {(_this select 1) spawn server_traders};
|
||||||
"dayzPlayerDeaths" addPublicVariableEventHandler {(_this select 1) spawn server_deaths};
|
"dayzPlayerDeaths" addPublicVariableEventHandler {(_this select 1) spawn server_deaths};
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class RscDisplayMain : RscStandardDisplay
|
|||||||
class DAYZ_Version : CA_Version
|
class DAYZ_Version : CA_Version
|
||||||
{
|
{
|
||||||
idc = -1;
|
idc = -1;
|
||||||
text = "DayZ Epoch 0.993 (1.7.6.1)";
|
text = "DayZ Epoch 0.994 (1.7.6.1)";
|
||||||
y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)";
|
y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)";
|
||||||
};
|
};
|
||||||
delete CA_TitleMainMenu;
|
delete CA_TitleMainMenu;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ _location = _worldspace select 1;
|
|||||||
|
|
||||||
//Generate UID test using time
|
//Generate UID test using time
|
||||||
// _uid = str( round (dateToNumber date)) + str(round time);
|
// _uid = str( round (dateToNumber date)) + str(round time);
|
||||||
_uid = _worldspace call dayz_objectUID3;
|
_uid = _worldspace call dayz_objectUID2;
|
||||||
//_uid = format["%1%2",(round time),_uid];
|
//_uid = format["%1%2",(round time),_uid];
|
||||||
|
|
||||||
if (_spawnDMG) then {
|
if (_spawnDMG) then {
|
||||||
@@ -127,7 +127,6 @@ dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
|||||||
if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
|
if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
|
||||||
[_object,_selection,_dam] call object_setFixServer;
|
[_object,_selection,_dam] call object_setFixServer;
|
||||||
} forEach _array;
|
} forEach _array;
|
||||||
|
|
||||||
|
|
||||||
_object setFuel _fuel;
|
_object setFuel _fuel;
|
||||||
|
|
||||||
@@ -135,7 +134,5 @@ dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
|||||||
|
|
||||||
_object call fnc_vehicleEventHandler;
|
_object call fnc_vehicleEventHandler;
|
||||||
|
|
||||||
_object setVariable ["JustSpawned",nil,true];
|
|
||||||
|
|
||||||
diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid));
|
diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid));
|
||||||
};
|
};
|
||||||
102
dayz_server/compile/server_publishVehicle2.sqf
Normal file
102
dayz_server/compile/server_publishVehicle2.sqf
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
private["_object","_worldspace","_location","_dir","_character","_tent","_class","_id","_uid","_dam","_hitpoints","_selection","_array","_damage","_randFuel","_fuel","_key","_result","_outcome","_totaldam","_parts","_retry","_done","_spawnDMG"];
|
||||||
|
|
||||||
|
_object = _this select 0;
|
||||||
|
_worldspace = _this select 1;
|
||||||
|
_class = _this select 2;
|
||||||
|
_spawnDMG = _this select 3;
|
||||||
|
_characterID = _this select 4;
|
||||||
|
|
||||||
|
diag_log ("PUBLISH: Attempt " + str(_object));
|
||||||
|
_dir = _worldspace select 0;
|
||||||
|
_location = _worldspace select 1;
|
||||||
|
|
||||||
|
//Generate UID test using time
|
||||||
|
_uid = _worldspace call dayz_objectUID3;
|
||||||
|
|
||||||
|
// TODO: check if uid already exists and if so increment by 1 and check again as soon as we find nothing continue.
|
||||||
|
|
||||||
|
//Send request
|
||||||
|
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _characterID, _worldspace, [], [], 1,_uid];
|
||||||
|
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] spawn {
|
||||||
|
private["_object","_uid","_characterID","_done","_retry","_key","_result","_outcome","_oid","_selection","_dam","_class"];
|
||||||
|
|
||||||
|
_object = _this select 0;
|
||||||
|
_uid = _this select 1;
|
||||||
|
_characterID = _this select 2;
|
||||||
|
_class = _this select 3;
|
||||||
|
_dir = _this select 4;
|
||||||
|
_location = _this select 5;
|
||||||
|
|
||||||
|
_done = false;
|
||||||
|
_retry = 0;
|
||||||
|
// TODO: Needs major overhaul for 1.1
|
||||||
|
while {_retry < 10} do {
|
||||||
|
|
||||||
|
sleep 1;
|
||||||
|
// GET DB ID
|
||||||
|
_key = format["CHILD:388:%1:",_uid];
|
||||||
|
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||||
|
_result = _key call server_hiveReadWrite;
|
||||||
|
_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;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
diag_log("CUSTOM: trying again to get id for: " + str(_uid));
|
||||||
|
_done = false;
|
||||||
|
_retry = _retry + 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Remove marker
|
||||||
|
deleteVehicle _object;
|
||||||
|
|
||||||
|
if(!_done) exitWith { diag_log("CUSTOM: failed to get id for : " + str(_uid)); };
|
||||||
|
|
||||||
|
_object_para = "ParachuteMediumWest" createVehicle [0,0,0];
|
||||||
|
|
||||||
|
_object_para setpos [_location select 0, _location select 1,(_location select 2) + 65];
|
||||||
|
|
||||||
|
_object = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
|
_object setVariable ["ObjectID", _oid, true];
|
||||||
|
|
||||||
|
_object setVariable ["lastUpdate",time];
|
||||||
|
|
||||||
|
_object setVariable ["CharacterID", _characterID, true];
|
||||||
|
|
||||||
|
_object attachTo [_object_para, [0,0,-1.6]];
|
||||||
|
|
||||||
|
sleep 1.0;
|
||||||
|
|
||||||
|
WaitUntil{(getpos _object select 2) < 0.1};
|
||||||
|
|
||||||
|
detach _object;
|
||||||
|
|
||||||
|
deleteVehicle _object_para;
|
||||||
|
|
||||||
|
// _object setDamage _damage;
|
||||||
|
// _object setFuel _fuel;
|
||||||
|
|
||||||
|
clearWeaponCargoGlobal _object;
|
||||||
|
clearMagazineCargoGlobal _object;
|
||||||
|
|
||||||
|
_veh setdir _dir;
|
||||||
|
_veh setpos _location;
|
||||||
|
|
||||||
|
//_object setvelocity [0,0,1];
|
||||||
|
|
||||||
|
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
||||||
|
|
||||||
|
_object call fnc_vehicleEventHandler;
|
||||||
|
|
||||||
|
diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid));
|
||||||
|
};
|
||||||
@@ -7,12 +7,11 @@ _object = _this select 0;
|
|||||||
_type = _this select 1;
|
_type = _this select 1;
|
||||||
_parachuteWest = typeOf _object == "ParachuteWest";
|
_parachuteWest = typeOf _object == "ParachuteWest";
|
||||||
_isNotOk = false;
|
_isNotOk = false;
|
||||||
|
_firstTime = false;
|
||||||
|
_removeCounter = 0;
|
||||||
|
|
||||||
_objectID = _object getVariable ["ObjectID","0"];
|
_objectID = _object getVariable ["ObjectID","0"];
|
||||||
_uid = _object getVariable ["ObjectUID","0"];
|
_uid = _object getVariable ["ObjectUID","0"];
|
||||||
_justSpawned = _object getVariable ["JustSpawned",false];
|
|
||||||
|
|
||||||
if (_justSpawned) exitWith { diag_log(format["Vehicle Just Spawned do nothing: %1", typeOf _object]); };
|
|
||||||
|
|
||||||
if ((typeName _objectID != "string") || (typeName _uid != "string")) then
|
if ((typeName _objectID != "string") || (typeName _uid != "string")) then
|
||||||
{
|
{
|
||||||
@@ -31,10 +30,16 @@ if (!_parachuteWest) then {
|
|||||||
_object_position select 1,
|
_object_position select 1,
|
||||||
_object_position select 2]);
|
_object_position select 2]);
|
||||||
_isNotOk = true;
|
_isNotOk = true;
|
||||||
|
|
||||||
|
// Loop to wait it out
|
||||||
|
_counter = _object getVariable ["markedForRemoval","0"];
|
||||||
|
_removeCounter = _object setVariable ["markedForRemoval",(_counter + 1)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_isNotOk) 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];
|
_lastUpdate = _object getVariable ["lastUpdate",time];
|
||||||
_needUpdate = _object in needUpdate_objects;
|
_needUpdate = _object in needUpdate_objects;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ server_playerDied = compile preprocessFileLineNumbers "\z\addons\dayz_server\c
|
|||||||
server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf"; //Creates the object in DB
|
server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf"; //Creates the object in DB
|
||||||
server_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf"; //Removes the object from the DB
|
server_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf"; //Removes the object from the DB
|
||||||
server_publishVeh = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf"; // Custom to add vehicles
|
server_publishVeh = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf"; // Custom to add vehicles
|
||||||
|
server_publishVeh2 = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle2.sqf"; // Custom to add vehicles
|
||||||
server_tradeObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_tradeObject.sqf";
|
server_tradeObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_tradeObject.sqf";
|
||||||
server_traders = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_traders.sqf";
|
server_traders = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_traders.sqf";
|
||||||
server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf";
|
server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf";
|
||||||
|
|||||||
Reference in New Issue
Block a user