From 039f1eb8daaddab0d5abe32c2415750ab8883774 Mon Sep 17 00:00:00 2001 From: Aaron Clark Date: Sat, 10 Nov 2012 08:02:49 -0600 Subject: [PATCH] sync with DayZ 1.7.4 CE --- dayz_code/actions/build.sqf | 2 +- dayz_code/actions/buy_db.sqf | 43 +- dayz_code/actions/dog/follow.sqf | 2 + dayz_code/actions/forcesave.sqf | 2 +- dayz_code/actions/player_SplitBars.sqf | 30 + dayz_code/actions/player_build.sqf | 2 +- dayz_code/actions/player_convertBars.sqf | 30 + dayz_code/actions/player_eat.sqf | 2 +- dayz_code/actions/player_wearClothes.sqf | 59 +- dayz_code/actions/remove.sqf | 2 +- dayz_code/actions/sell_db.sqf | 39 +- dayz_code/actions/trade_cancel.sqf | 12 +- dayz_code/cfgVehicles.hpp | 82 ++ dayz_code/compile/fn_damageHandlerVehicle.sqf | 5 - dayz_code/compile/fn_selfActions.sqf | 2 +- dayz_code/compile/player_animalCheck.sqf | 10 +- dayz_code/compile/player_death.sqf | 2 + dayz_code/compile/player_gearSync.sqf | 2 +- dayz_code/compile/player_humanityMorph.sqf | 3 - dayz_code/compile/player_packTent.sqf | 2 +- dayz_code/compile/player_projectileNear.sqf | 53 +- dayz_code/compile/player_switchModel.sqf | 15 +- dayz_code/compile/player_tameDog.sqf | 20 +- dayz_code/compile/player_weaponFiredNear.sqf | 6 +- dayz_code/config.cpp | 4 +- dayz_code/init/compiles.sqf | 2 + dayz_code/init/publicEH.sqf | 2 + dayz_code/init/variables.sqf | 3 + dayz_code/system/dog_agent.fsm | 867 ++++++++++-------- dayz_code/system/player_monitor.fsm | 8 +- dayz_code/z/addons/dayz_code/$PBOPREFIX$ | 1 - dayz_server/compile/server_playerSetup.sqf | 23 +- dayz_server/compile/server_publishBank.sqf | 33 + dayz_server/compile/server_traders.sqf | 41 + dayz_server/init/server_functions.sqf | 2 + dayz_server/system/server_monitor.sqf | 26 +- 36 files changed, 921 insertions(+), 518 deletions(-) create mode 100644 dayz_code/actions/player_SplitBars.sqf create mode 100644 dayz_code/actions/player_convertBars.sqf delete mode 100644 dayz_code/z/addons/dayz_code/$PBOPREFIX$ create mode 100644 dayz_server/compile/server_publishBank.sqf create mode 100644 dayz_server/compile/server_traders.sqf diff --git a/dayz_code/actions/build.sqf b/dayz_code/actions/build.sqf index 7b7d68db8..9d4a53878 100644 --- a/dayz_code/actions/build.sqf +++ b/dayz_code/actions/build.sqf @@ -34,7 +34,7 @@ player reveal _object; cutText [format[localize "str_build_01",_text], "PLAIN DOWN"]; dayzPublishObj = [dayz_characterID,_object,[_dir,_location],_classname]; -publicVariable "dayzPublishObj"; +publicVariableServer "dayzPublishObj"; if (isServer) then { dayzPublishObj call server_publishObj; }; diff --git a/dayz_code/actions/buy_db.sqf b/dayz_code/actions/buy_db.sqf index d57485a2f..8f6bb0ad1 100644 --- a/dayz_code/actions/buy_db.sqf +++ b/dayz_code/actions/buy_db.sqf @@ -8,6 +8,8 @@ _activatingPlayer = _this select 1; _trader_id = (_this select 3) select 0; _category = (_this select 3) select 1; +diag_log format["DEBUG TRADER OBJ: %1", _trader_id]; + dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action]; publicVariable "dayzTraderMenu"; if (isServer) then { @@ -16,28 +18,29 @@ if (isServer) then { waitUntil {!isNil "dayzTraderMenuResult"}; -//diag_log format["DEBUG Buy: %1", dayzTraderMenuResult]; +diag_log format["DEBUG Buy: %1", dayzTraderMenuResult]; { - _id = parseNumber (_x select 0); - _type = _x select 1; - _loc = _x select 2; - _name = _x select 3; - _qty = parseNumber (_x select 4); - _cost = parseNumber (_x select 5); - _sell = parseNumber (_x select 6); - _cur = _x select 7; - _cat = _x select 8; - _order = parseNumber (_x select 9); - _tid = parseNumber (_x select 10); - _currency = _x select 11; - _actionFile = _x select 12; + _header = _x select 0; // "TRD" + _btype = _x select 1; + _stype = _x select 2; + _loc = _x select 3; + _name = _x select 4; + _qty = _x select 5; + _cost = _x select 6; + _bcurrency = _x select 7; + _sell = _x select 8; + _scurrency = _x select 9; + _cat = _x select 10; + _order = _x select 11; + _tid = _x select 12; + _actionFile = _x select 13; - _textPart = getText(configFile >> _type >> _name >> "displayName"); + _textPart = getText(configFile >> _btype >> _name >> "displayName"); _File = "\z\addons\dayz_code\actions\" + _actionFile + ".sqf"; _part_out = _name; - _part_in = _currency; + _part_in = _bcurrency; _out = 1; _in = _cost; @@ -47,13 +50,13 @@ waitUntil {!isNil "dayzTraderMenuResult"}; // trade_items.sqf | [part_out, part_in, qty_out, qty_in,]; _part = player addAction [_Display, _File,[_part_out,_part_in,_out,_in], _order, true, true, "",""]; - //diag_log format["DEBUG TRADER: %1", _part]; - s_player_metals set [count s_player_metals,_part]; + diag_log format["DEBUG TRADER: %1", _part]; + s_player_parts set [count s_player_parts,_part]; } forEach dayzTraderMenuResult; -_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 92, true, false, "",""]; -s_player_metals set [count s_player_metals,_cancel]; +_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 10, true, false, "",""]; +s_player_parts set [count s_player_parts,_cancel]; // Clear Data maybe consider cacheing results dayzTraderMenuResult = nil; diff --git a/dayz_code/actions/dog/follow.sqf b/dayz_code/actions/dog/follow.sqf index 45f8c9970..cc47bdbe7 100644 --- a/dayz_code/actions/dog/follow.sqf +++ b/dayz_code/actions/dog/follow.sqf @@ -9,5 +9,7 @@ if(_whistle) then { sleep 1; +if (_dog distance player <= 900) then { _handle setFSMVariable ["_command","return"]; +}; diff --git a/dayz_code/actions/forcesave.sqf b/dayz_code/actions/forcesave.sqf index cc89bea31..32416c00a 100644 --- a/dayz_code/actions/forcesave.sqf +++ b/dayz_code/actions/forcesave.sqf @@ -1,7 +1,7 @@ private["_object"]; dayzUpdateVehicle = [_this select 3,"all"]; -publicVariable "dayzUpdateVehicle"; +publicVariableServer "dayzUpdateVehicle"; if (isServer) then { dayzUpdateVehicle call server_updateObject; }; \ No newline at end of file diff --git a/dayz_code/actions/player_SplitBars.sqf b/dayz_code/actions/player_SplitBars.sqf new file mode 100644 index 000000000..dbdad362b --- /dev/null +++ b/dayz_code/actions/player_SplitBars.sqf @@ -0,0 +1,30 @@ +private["_item"]; +_item = _this; +_config = configFile >> "CfgMagazines" >> _item; + +_consume = getArray (_config >> "ItemActions" >> "SplitBar" >> "use"); +_create = getArray (_config >> "ItemActions" >> "SplitBar" >> "output"); + +_textConsume = getText(configFile >> "CfgMagazines" >> (_consume select 0) >> "displayName"); +_textCreate = getText(configFile >> "CfgMagazines" >> (_create select 0) >> "displayName"); + +_amountNeed = count _consume; +_amountHas = {_x == (_consume select 0)} count magazines player; +_amountMake = count _create; + +_hasInput = (_amountNeed <= _amountHas); +player playActionNow "PutDown"; +if (_hasInput) then { + //Take Items + { + player removeMagazine _x; + } forEach _consume; + sleep 1; + //Give Items + { + player addMagazine _x; + } forEach _create; + cutText [format[("You have successfully converted %1 %2."),_amountMake,_textCreate], "PLAIN DOWN"]; +} else { + cutText [format[("You cannot convert that combination, you need %1 %2."),_amountNeed,_textConsume], "PLAIN DOWN"]; +}; \ No newline at end of file diff --git a/dayz_code/actions/player_build.sqf b/dayz_code/actions/player_build.sqf index 1b6383f29..928f70663 100644 --- a/dayz_code/actions/player_build.sqf +++ b/dayz_code/actions/player_build.sqf @@ -34,7 +34,7 @@ player reveal _object; cutText [format[localize "str_build_01",_text], "PLAIN DOWN"]; dayzPublishObj = [dayz_characterID,_object,[_dir,_location],_classname]; -publicVariable "dayzPublishObj"; +publicVariableServer "dayzPublishObj"; if (isServer) then { dayzPublishObj call server_publishObj; }; diff --git a/dayz_code/actions/player_convertBars.sqf b/dayz_code/actions/player_convertBars.sqf new file mode 100644 index 000000000..b09e94e6b --- /dev/null +++ b/dayz_code/actions/player_convertBars.sqf @@ -0,0 +1,30 @@ +private["_item"]; +_item = _this; +_config = configFile >> "CfgMagazines" >> _item; + +_consume = getArray (_config >> "ItemActions" >> "ReloadMag" >> "use"); +_create = getArray (_config >> "ItemActions" >> "ReloadMag" >> "output"); + +_textConsume = getText(configFile >> "CfgMagazines" >> (_consume select 0) >> "displayName"); +_textCreate = getText(configFile >> "CfgMagazines" >> (_create select 0) >> "displayName"); + +_amountNeed = count _consume; +_amountHas = {_x == (_consume select 0)} count magazines player; +_amountMake = count _create; + +_hasInput = (_amountNeed <= _amountHas); +player playActionNow "PutDown"; +if (_hasInput) then { + //Take Items + { + player removeMagazine _x; + } forEach _consume; + sleep 1; + //Give Items + { + player addMagazine _x; + } forEach _create; + cutText [format[("You have successfully converted %1 %2."),_amountMake,_textCreate], "PLAIN DOWN"]; +} else { + cutText [format[("You cannot convert that combination, you need %1 %2."),_amountNeed,_textConsume], "PLAIN DOWN"]; +}; \ No newline at end of file diff --git a/dayz_code/actions/player_eat.sqf b/dayz_code/actions/player_eat.sqf index 6cecd80ef..b02af46a0 100644 --- a/dayz_code/actions/player_eat.sqf +++ b/dayz_code/actions/player_eat.sqf @@ -35,7 +35,7 @@ _update set [3,true]; player setVariable["updatePlayer",_update,true]; */ dayzPlayerSave = player; -publicVariable "dayzPlayerSave"; +publicVariableServer "dayzPlayerSave"; if (isServer) then { dayzPlayerSave call server_updatePlayer; }; diff --git a/dayz_code/actions/player_wearClothes.sqf b/dayz_code/actions/player_wearClothes.sqf index 45c7eb90d..5457a82e3 100644 --- a/dayz_code/actions/player_wearClothes.sqf +++ b/dayz_code/actions/player_wearClothes.sqf @@ -1,73 +1,70 @@ -private["_item","_isFemale","_itemNew","_item","_onLadder"]; +/* +_item spawn player_wearClothes; +TODO: female +*/ +private["_item","_isFemale","_itemNew","_item","_onLadder","_model","_hasclothesitem","_config","_text"]; _item = _this; call gear_ui_init; _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]}; _hasclothesitem = _this in magazines player; - -_config = configFile >> "CfgMagazines" >> _item; -_text = getText (_config >> "displayName"); +_config = configFile >> "CfgMagazines"; +_text = getText (_config >> _item >> "displayName"); if (!_hasclothesitem) exitWith {cutText [format[(localize "str_player_31"),_text,"wear"] , "PLAIN DOWN"]}; if (vehicle player != player) exitWith {cutText ["You may not change clothes while in a vehicle", "PLAIN DOWN"]}; _isFemale = ((typeOf player == "SurvivorW2_DZ")||(typeOf player == "BanditW1_DZ")); -if (_isFemale) then { - if (_item != "Skin_Survivor2_DZ") exitWith {cutText ["Currently Female Characters cannot change to this skin. This will change in a future update.", "PLAIN DOWN"]}; -}; +if (_isFemale) exitWith {cutText ["Currently Female Characters cannot change to this skin. This will change in a future update.", "PLAIN DOWN"]}; +private["_itemNew","_myModel","_humanity","_isBandit","_isHero"]; _myModel = (typeOf player); -_itemNew = "Skin_Survivor2_DZ"; - -player removeMagazine _item; _humanity = player getVariable ["humanity",0]; +_isBandit = _humanity < -2000; +_isHero = _humanity > 5000; +_itemNew = "Skin_" + _myModel; + +if ( !(isClass(_config >> _itemNew)) ) then { + _itemNew = if (!_isFemale) then {"Skin_Survivor2_DZ"} else {"Skin_SurvivorW2_DZ"}; +}; switch (_item) do { case "Skin_Sniper1_DZ": { - _itemNew = "Skin_" + _myModel; - [dayz_playerUID,dayz_characterID,"Sniper1_DZ"] spawn player_humanityMorph; + _model = "Sniper1_DZ"; }; case "Skin_Camo1_DZ": { - _itemNew = "Skin_" + _myModel; - [dayz_playerUID,dayz_characterID,"Camo1_DZ"] spawn player_humanityMorph; + _model = "Camo1_DZ"; }; case "Skin_Rocket_DZ": { - _itemNew = "Skin_" + _myModel; - [dayz_playerUID,dayz_characterID,"Rocket_DZ"] spawn player_humanityMorph; + _model = "Rocket_DZ"; + }; + case "Skin_Soldier1_DZ": { + _model = "Soldier1_DZ"; }; case "Skin_Survivor2_DZ": { _model = "Survivor2_DZ"; if (_isFemale) then { _model = "SurvivorW2_DZ"; }; - if (_humanity < -2000) then { + if (_isBandit) then { _model = "Bandit1_DZ"; if (_isFemale) then { _model = "BanditW1_DZ"; }; }; - if (_humanity > 5000) then { + if (_isHero) then { _model = "Survivor3_DZ"; if (_isFemale) then { _model = "SurvivorW2_DZ"; }; }; - if (_model != _myModel) then { - [dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph; }; }; - case "Skin_Soldier1_DZ": { - _itemNew = "Skin_" + _myModel; - [dayz_playerUID,dayz_characterID,"Soldier1_DZ"] spawn player_humanityMorph; - }; -}; -_config = configFile >> "CfgMagazines" >> _itemNew; -_isClass = isClass (_config); - -if (_isClass) then { +if (_model != _myModel) then { + player removeMagazine _item; player addMagazine _itemNew; -}; -player setVariable ["humanity",_humanity,true]; \ No newline at end of file + [dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph; +}; \ No newline at end of file diff --git a/dayz_code/actions/remove.sqf b/dayz_code/actions/remove.sqf index c19b6432e..7d4a26456 100644 --- a/dayz_code/actions/remove.sqf +++ b/dayz_code/actions/remove.sqf @@ -14,7 +14,7 @@ _id = [player,50,true,(getPosATL player)] spawn player_alertZombies; sleep 5; dayzDeleteObj = [_objectID,_objectUID]; -publicVariable "dayzDeleteObj"; +publicVariableServer "dayzDeleteObj"; if (isServer) then { dayzDeleteObj call local_deleteObj; }; diff --git a/dayz_code/actions/sell_db.sqf b/dayz_code/actions/sell_db.sqf index ba18236c8..a79b9d35c 100644 --- a/dayz_code/actions/sell_db.sqf +++ b/dayz_code/actions/sell_db.sqf @@ -1,4 +1,4 @@ -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"]; +private["_activatingPlayer","_trader_id","_category","_action","_id","_btype","_stype","_loc","_name","_qty","_cost","_qty","_sell","_order","_tid","_bcurrency","_scurrency","_actionFile","_in","_out","_part","_cat","_cancel","_Display","_File","_textCurrency","_textPart"]; {player removeAction _x} forEach s_player_parts;s_player_parts = []; @@ -8,7 +8,7 @@ _activatingPlayer = _this select 1; _trader_id = (_this select 3) select 0; _category = (_this select 3) select 1; -diag_log format["DEBUG TRADER OBJ: %1", _trader]; +diag_log format["DEBUG TRADER OBJ: %1", _trader_id]; dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action]; publicVariable "dayzTraderMenu"; @@ -18,27 +18,28 @@ if (isServer) then { waitUntil {!isNil "dayzTraderMenuResult"}; -//diag_log format["DEBUG Sell: %1", dayzTraderMenuResult]; +diag_log format["DEBUG Sell: %1", dayzTraderMenuResult]; { - _id = parseNumber (_x select 0); - _type = _x select 1; - _loc = _x select 2; - _name = _x select 3; - _qty = parseNumber (_x select 4); - _cost = parseNumber (_x select 5); - _sell = parseNumber (_x select 6); - _cur = _x select 7; - _cat = _x select 8; - _order = parseNumber (_x select 9); - _tid = parseNumber (_x select 10); - _currency = _x select 11; - _actionFile = _x select 12; + _header = _x select 0; // "TRD" + _btype = _x select 1; + _stype = _x select 2; + _loc = _x select 3; + _name = _x select 4; + _qty = _x select 5; + _cost = _x select 6; + _bcurrency = _x select 7; + _sell = _x select 8; + _scurrency = _x select 9; + _cat = _x select 10; + _order = _x select 11; + _tid = _x select 12; + _actionFile = _x select 13; - _textPart = getText(configFile >> _type >> _name >> "displayName"); + _textPart = getText(configFile >> _stype >> _name >> "displayName"); _File = "\z\addons\dayz_code\actions\" + _actionFile + ".sqf"; - _part_out = _cur; + _part_out = _scurrency; _part_in = _name; _out = _sell; _in = 1; @@ -54,7 +55,7 @@ waitUntil {!isNil "dayzTraderMenuResult"}; } forEach dayzTraderMenuResult; -_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 99, true, false, "",""]; +_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 10, true, false, "",""]; s_player_parts set [count s_player_parts,_cancel]; dayzTraderMenuResult = nil; diff --git a/dayz_code/actions/trade_cancel.sqf b/dayz_code/actions/trade_cancel.sqf index 28c94da70..eba622cd7 100644 --- a/dayz_code/actions/trade_cancel.sqf +++ b/dayz_code/actions/trade_cancel.sqf @@ -1,9 +1,7 @@ -private["_sellgeneric1"]; +private["none"]; -{player removeAction _x} forEach s_player_tradecans;s_player_tradecans = []; -{player removeAction _x} forEach s_player_metals;s_player_metals = []; -{player removeAction _x} forEach s_player_bank;s_player_bank = []; +{player removeAction _x} forEach s_player_parts;s_player_parts = []; +//{player removeAction _x} forEach s_player_bank;s_player_bank = []; -s_player_tradecans_crtl = -1; -s_player_metal_crtl = -1; -s_player_bank_crtl = -1; \ No newline at end of file +s_player_parts_crtl = -1; +//s_player_bank_crtl = -1; \ No newline at end of file diff --git a/dayz_code/cfgVehicles.hpp b/dayz_code/cfgVehicles.hpp index 78bf318d3..6c6e02301 100644 --- a/dayz_code/cfgVehicles.hpp +++ b/dayz_code/cfgVehicles.hpp @@ -194,6 +194,88 @@ class CfgVehicles { gunnerCanSee = 2+16+32; driverCanSee = 2+16+32; }; + //HMMWV_Ambulance_CZ_DES_EP1 + class HMMWV_Ambulance; + class HMMWV_Ambulance_DZ: HMMWV_Ambulance + { + radartype = 0; + displayName = "HMMWV_Ambulance_DZ"; + scope = 2; + side = 2; + crew = ""; + typicalCargo[] = {}; + hiddenSelections[] = {}; + class TransportMagazines{}; + class TransportWeapons{}; + weapons[] = {}; + magazines[] = {}; + gunnerHasFlares = false; + }; + //Mi17_Civilian + class Mi17_Civilian; + class Mi17_DZ: Mi17_Civilian + { + radartype = 0; + displayName = "Mi17_DZ"; + scope = 2; + side = 2; + crew = ""; + typicalCargo[] = {}; + hiddenSelections[] = {}; + class TransportMagazines{}; + class TransportWeapons{}; + weapons[] = {}; + magazines[] = {}; + gunnerHasFlares = false; + }; + //An2_TK_EP1 + class An2_TK_EP1; + class AN2_DZ: An2_TK_EP1 { + radartype = 0; + displayName = "AN2_DZ"; + scope = 2; + side = 2; + crew = ""; + typicalCargo[] = {}; + hiddenSelections[] = {}; + class TransportMagazines{}; + class TransportWeapons{}; + weapons[] = {}; + magazines[] = {}; + gunnerHasFlares = false; + }; + //UH60M_MEV_EP1 + class UH60M_MEV_EP1; + class UH60M_DZ: UH60M_MEV_EP1 { + radartype = 0; + displayName = "UH60M_DZ"; + scope = 2; + side = 2; + crew = ""; + typicalCargo[] = {}; + hiddenSelections[] = {}; + class TransportMagazines{}; + class TransportWeapons{}; + weapons[] = {}; + magazines[] = {}; + gunnerHasFlares = false; + }; + //AH6X_EP1 + class AH6X_EP1; + class AH6X_DZ: AH6X_EP1 { + radartype = 0; + displayName = "AH6X_DZ"; + scope = 2; + side = 2; + crew = ""; + typicalCargo[] = {}; + hiddenSelections[] = {}; + class TransportMagazines{}; + class TransportWeapons{}; + weapons[] = {}; + magazines[] = {}; + gunnerHasFlares = false; + }; class House { class DestructionEffects; }; diff --git a/dayz_code/compile/fn_damageHandlerVehicle.sqf b/dayz_code/compile/fn_damageHandlerVehicle.sqf index f9bd0af6b..75399f6fe 100644 --- a/dayz_code/compile/fn_damageHandlerVehicle.sqf +++ b/dayz_code/compile/fn_damageHandlerVehicle.sqf @@ -15,11 +15,6 @@ _total = _damage; //diag_log ("DAMAGE VEH: " + typeof(_unit) + " / " + str(_hit) + " / " + str(_damage) + " / " + str(getDammage _unit)); if (local _unit) then { - if (_ammo == "zombie") then { - //_unit setDamage (_damage / 2); - _total = [_unit,_hit,_damage] call object_setFixServer; - } else { _total = [_unit,_hit,_damage] call object_setHitServer; - }; }; _total \ No newline at end of file diff --git a/dayz_code/compile/fn_selfActions.sqf b/dayz_code/compile/fn_selfActions.sqf index 56e1e532b..0bcdbf16f 100644 --- a/dayz_code/compile/fn_selfActions.sqf +++ b/dayz_code/compile/fn_selfActions.sqf @@ -228,7 +228,7 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) s_player_repairActions set [count s_player_repairActions,_handle]; } else { _color = "color='#70bf44'"; //green - _string = format["Remove%1",_cmpt,_color]; //Remove - Part + _string = format["Take%1",_cmpt,_color]; //Take - 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]; }; diff --git a/dayz_code/compile/player_animalCheck.sqf b/dayz_code/compile/player_animalCheck.sqf index 7e9652ccd..ff83b46dd 100644 --- a/dayz_code/compile/player_animalCheck.sqf +++ b/dayz_code/compile/player_animalCheck.sqf @@ -1,9 +1,11 @@ -private["_list","_Pos","_randrefpoint","_PosList","_PosSelect","_Pos","_list","_animalssupported","_type","_root","_favouritezones"]; + +private["_list","_Pos","_randrefpoint","_PosList","_PosSelect","_Pos","_list","_animalssupported","_type","_root","_favouritezones","_GroupMarker","_agent","_id","_tame"]; _list = getposATL player nearEntities [["CAAnimalBase"],dayz_animalDistance]; if (count _list < dayz_maxAnimals) then { //Find where animal likes - _animalssupported = ["hen","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit","Fin", "Pastor"]; + _animalssupported = ["hen","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit","DZ_Fin","DZ_Pastor"]; + //_animalssupported = ["DZ_Fin","DZ_Pastor"]; _type = (_animalssupported select floor(random(count _animalssupported))); if (_type == "Cow") then { _animalssupported = ["Cow01","Cow02","Cow03","Cow04"]; @@ -32,9 +34,9 @@ if (count _list < dayz_maxAnimals) then { _agent = createAgent [_type, _Pos, [], 0, "FORM"]; _agent setpos _Pos; _id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm"; - if (_type == "Fin" || _type == "Pastor") then { + if ((_type == "DZ_Fin") || (_type == "DZ_Pastor")) then { _tame = _agent addAction ["Tame Dog", "\z\addons\dayz_code\compile\player_tameDog.sqf"]; }; }; sleep 1; -};z \ No newline at end of file +}; \ No newline at end of file diff --git a/dayz_code/compile/player_death.sqf b/dayz_code/compile/player_death.sqf index c2e562dee..d5ac2af8c 100644 --- a/dayz_code/compile/player_death.sqf +++ b/dayz_code/compile/player_death.sqf @@ -24,6 +24,8 @@ player setVariable ["NORRN_unconscious", false, true]; player setVariable ["unconsciousTime", 0, true]; player setVariable ["USEC_isCardiac",false,true]; player setVariable ["medForceUpdate",true,true]; +//remove combat timer on death +player setVariable ["startcombattimer", 0, true]; r_player_unconscious = false; r_player_cardiac = false; diff --git a/dayz_code/compile/player_gearSync.sqf b/dayz_code/compile/player_gearSync.sqf index 66018ef35..a511a0609 100644 --- a/dayz_code/compile/player_gearSync.sqf +++ b/dayz_code/compile/player_gearSync.sqf @@ -2,7 +2,7 @@ private ["_objects"]; _objects = nearestObjects [getPosATL player, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10]; { dayzUpdateVehicle = [_x,"all"]; - publicVariable "dayzUpdateVehicle"; + publicVariableServer "dayzUpdateVehicle"; } foreach _objects; private ["_backpackWpnQtys","_backpackWpnTypes","_backpackWpn","_backpackMag","_countr"]; diff --git a/dayz_code/compile/player_humanityMorph.sqf b/dayz_code/compile/player_humanityMorph.sqf index 9271e49c6..ea993cd60 100644 --- a/dayz_code/compile/player_humanityMorph.sqf +++ b/dayz_code/compile/player_humanityMorph.sqf @@ -83,9 +83,6 @@ call dayz_resetSelfActions; eh_player_killed = player addeventhandler ["FiredNear",{_this call player_weaponFiredNear;} ]; -//Combat logging -_eh_combat_projectilenear = player addEventHandler ["IncomingFire",{_this call player_projectileNear;} ]; -// [player] call fnc_usec_damageHandle; player allowDamage true; diff --git a/dayz_code/compile/player_packTent.sqf b/dayz_code/compile/player_packTent.sqf index b65932759..5edd63161 100644 --- a/dayz_code/compile/player_packTent.sqf +++ b/dayz_code/compile/player_packTent.sqf @@ -35,7 +35,7 @@ if(_ownerID == dayz_characterID) then { _backpacks = getBackpackCargo _obj; dayzDeleteObj = [_objectID,_objectUID]; - publicVariable "dayzDeleteObj"; + publicVariableServer "dayzDeleteObj"; if (isServer) then { dayzDeleteObj call local_deleteObj; }; diff --git a/dayz_code/compile/player_projectileNear.sqf b/dayz_code/compile/player_projectileNear.sqf index c2a078e00..3f2bf55cf 100644 --- a/dayz_code/compile/player_projectileNear.sqf +++ b/dayz_code/compile/player_projectileNear.sqf @@ -1,30 +1,51 @@ -private["_unit","_shooter","_distance","_ammo","_position","_isInCombat"]; -_unit = _this select 0; -_shooter = _this select 1; -_ammo = _this select 2; -_distance = _this select 3; -_position = _this select 4; +private["_unit","_projectile","_isInCombat"]; +_unit = _this select 0; _projectile = _this select 6; -_isInComat = _unit getVariable["startcombattimer",0]; -_endPos = getPosATL _projectile; +diag_log ("0"); -_listNear = _unit nearEntities [["CAManBase","AllVehicles"],25]; +_isInComat = _unit getVariable["startcombattimer",0]; + +diag_log ("Bullit Speed: " +str(Speed _projectile)); +diag_log ("Bullit Velocity: " +str(velocity _projectile)); + +_listNear = []; +_callCount = 0; + +//approx 1020 meters +while {(alive _projectile) && !(isNull _projectile) && _callCount < 85;} do { + _projectilespeed = Speed _projectile; + _projectflight = (((_projectilespeed / 60) * 1000)); + if (_projectflight > 0) then { + sleep (12 / (_projectflight)); + }; + if (alive _projectile && !(isNull _projectile)) then {_currentNear = (Position _projectile) nearEntities [["CAManBase","AllVehicles"],15];}; + _listNear = _listNear + _currentNear; + _callCount = _callCount + 1; +}; +diag_log ("2"); { _nearVehicle = _x; - _isInCombat = _nearVehicle getVariable["startcombattimer",0]; - - if ((alive _unit) and (isPlayer _unit) and _isInCombat == 0) then { - _unit setVariable["startcombattimer", 1, true]; - diag_log("Now in Combat (Player): " + name _unit); + _listNear = _listNear - [_x]; + + diag_log ("3"); + + if (isPlayer _nearVehicle) then { + _isInCombat = _nearVehicle getVariable["startcombattimer",0]; + if ((alive _nearVehicle) and _isInCombat == 0) then { + _nearVehicle setVariable["startcombattimer", 1, true]; + diag_log("Now in Combat (Player): " + name _unit); + }; }; + if (_nearVehicle isKindOf "AllVehicles") then { { _isInCombat = _x getVariable["startcombattimer",0]; - if (isPlayer _x and _isInCombat == 0) then { + if (isPlayer _x and _isInCombat == 0 and alive _x) then { _x setVariable["startcombattimer", 1, true]; diag_log("Now in Combat (Crew): " + name _x); }; } forEach (crew _nearVehicle); }; -} forEach _listNear; \ No newline at end of file + +} forEach _listNear; diff --git a/dayz_code/compile/player_switchModel.sqf b/dayz_code/compile/player_switchModel.sqf index d9ccf3889..b3cfed16c 100644 --- a/dayz_code/compile/player_switchModel.sqf +++ b/dayz_code/compile/player_switchModel.sqf @@ -61,7 +61,7 @@ private ["_newBackpackType","_backpackWpn","_backpackMag"]; if (count _muzzles > 1) then { _currentWpn = currentMuzzle player; }; - + //Debug Message diag_log "Attempting to switch model"; diag_log str(_weapons); @@ -162,7 +162,7 @@ private ["_newBackpackType","_backpackWpn","_backpackMag"]; //Debug Message diag_log "Swichtable Unit Created. Equipment:"; diag_log str(weapons _newUnit); - diag_log str(magazines _newUnit); + diag_log str(magazines _newUnit); diag_log str(getWeaponCargo unitBackpack _newUnit); diag_log str(getMagazineCargo unitBackpack _newUnit); @@ -175,17 +175,10 @@ private ["_newBackpackType","_backpackWpn","_backpackMag"]; removeAllWeapons _oldUnit; {_oldUnit removeMagazine _x;} forEach magazines _oldUnit; - if (!isNull dayz_originalPlayer) then { - dayz_originalPlayer = _oldUnit; - _oldUnit addEventHandler ["HandleDamage",{false}]; - _oldUnit disableAI "ANIM"; - _oldUnit disableAI "MOVE"; - } else { - deleteVehicle _oldUnit; - }; + deleteVehicle _oldUnit; //Move player inside - + // player switchCamera = _currentCamera; if(_currentWpn != "") then {_newUnit selectWeapon _currentWpn;}; [objNull, player, rSwitchMove,_currentAnim] call RE; diff --git a/dayz_code/compile/player_tameDog.sqf b/dayz_code/compile/player_tameDog.sqf index a28ff401e..46feaaaff 100644 --- a/dayz_code/compile/player_tameDog.sqf +++ b/dayz_code/compile/player_tameDog.sqf @@ -4,12 +4,20 @@ _caller = _this select 1; _id = _this select 2; _params = _this select 3; _pos = position _target; +_hasRawMeat = "FoodSteakRaw" in magazines player; +_hasdog = player getVariable ["dogid", "false"]; -deleteVehicle (_this select 0); -_dog = (group player) createUnit [format["DZ_%1", typeOf _target], _pos, [], 0, "FORM"]; -_dog disableAI "FSM"; -_fsmid = [_dog, (count units group _caller)] execFSM "\z\addons\dayz_code\system\dog_agent.fsm"; -_fsmid setFSMVariable ["_handle", _fsmid]; -_target removeAction _id; +if ((_hasRawMeat) && (_hasdog == "false")) then { + player removeMagazine "FoodSteakRaw"; + deleteVehicle (_this select 0); + _dog = (group player) createUnit [typeOf _target, _pos, [], 0, "FORM"]; + player setvariable ["dogid", _fsmid]; + _dog disableAI "FSM"; + _fsmid = [_dog, typeOf _target] execFSM "\z\addons\dayz_code\system\dog_agent.fsm"; + _fsmid setFSMVariable ["_handle", _fsmid]; + _target removeAction _id; +} else { + cutText ["You must have RawMeat", "PLAIN DOWN"]; +}; //handle publicVariables here later. diff --git a/dayz_code/compile/player_weaponFiredNear.sqf b/dayz_code/compile/player_weaponFiredNear.sqf index ae465c9b8..25e2e0922 100644 --- a/dayz_code/compile/player_weaponFiredNear.sqf +++ b/dayz_code/compile/player_weaponFiredNear.sqf @@ -21,12 +21,10 @@ private["_unit","_magazine","_used","_quantity","_magsNet","_magsWhole","_key"," // Both the firer and those nearby (<=15m) go into "combat" to prevent ALT-F4 _firer setVariable["startcombattimer", 1, true]; - _listNear = _firer nearEntities [["CAManBase","AllVehicles"],15]; - { - if (_isPlayer) then { + + if (_distance <= 15) then { _unit setVariable["startcombattimer", 1, true]; }; - } forEach _listNear; if (_inVehicle) exitWith{}; if (_firer == player) exitWith{}; diff --git a/dayz_code/config.cpp b/dayz_code/config.cpp index 9c3081b26..38372fa72 100644 --- a/dayz_code/config.cpp +++ b/dayz_code/config.cpp @@ -357,7 +357,7 @@ class CfgBuildingLoot { { "BAF_AS50_scoped","weapon" }, { "Mk_48_DZ","weapon" }, { "M249_DZ","weapon" }, - { "BAF_L85A2_RIS_CWS","weapon" }, + //{"BAF_L85A2_RIS_CWS","weapon"}, { "DMR","weapon" }, { "","military" }, { "","medical" }, @@ -379,7 +379,7 @@ class CfgBuildingLoot { 0.02, //{"BAF_AS50_scoped","weapon"}, 0.03, //{"Mk_48_DZ","weapon"}, 0.05, //{"M249_DZ","weapon"}, - 0.01, //{"BAF_L85A2_RIS_CWS","weapon"}, + //0.01, //{"BAF_L85A2_RIS_CWS","weapon"}, 0.10, //{"DMR","weapon"}, 1, //{"","military"}, 0.5, //{"","medical"}, diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf index 79a469511..866e35fed 100644 --- a/dayz_code/init/compiles.sqf +++ b/dayz_code/init/compiles.sqf @@ -64,6 +64,8 @@ if (!isDedicated) then { //actions player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf"; player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf"; + player_convertBars = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_convertBars.sqf"; + player_SplitBars = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_SplitBars.sqf"; player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf"; player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf"; player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf"; diff --git a/dayz_code/init/publicEH.sqf b/dayz_code/init/publicEH.sqf index 0c284bf38..6954a33dd 100644 --- a/dayz_code/init/publicEH.sqf +++ b/dayz_code/init/publicEH.sqf @@ -27,6 +27,8 @@ if (isServer) then { "dayzDiscoRem" addPublicVariableEventHandler {dayz_disco = dayz_disco - [(_this select 1)];}; "dayzPlayerSave" addPublicVariableEventHandler {_id = (_this select 1) spawn server_playerSync;}; "dayzPublishObj" addPublicVariableEventHandler {(_this select 1) call server_publishObj}; + // "dayzPublishBank" addPublicVariableEventHandler {(_this select 1) call server_publishBank}; + "dayzTraderMenu" addPublicVariableEventHandler {(_this select 1) call server_traders}; "dayzUpdateVehicle" addPublicVariableEventHandler {_id = (_this select 1) spawn server_updateObject}; "dayzDeleteObj" addPublicVariableEventHandler {_id = (_this select 1) spawn local_deleteObj}; "dayzLogin" addPublicVariableEventHandler {_id = (_this select 1) spawn server_playerLogin}; diff --git a/dayz_code/init/variables.sqf b/dayz_code/init/variables.sqf index 397e38ff2..b791939bc 100644 --- a/dayz_code/init/variables.sqf +++ b/dayz_code/init/variables.sqf @@ -171,6 +171,9 @@ dayzHit = []; dayzPublishObj = []; //used for eventhandler to spawn a mirror of players tent dayzHideBody = objNull; +// dayzPublishBank = []; +dayzTraderMenu = []; + //DayZ settings dayz_dawn = 6; dayz_dusk = 18; diff --git a/dayz_code/system/dog_agent.fsm b/dayz_code/system/dog_agent.fsm index 315448772..2939f990c 100644 --- a/dayz_code/system/dog_agent.fsm +++ b/dayz_code/system/dog_agent.fsm @@ -1,184 +1,234 @@ -/*%FSM*/ +/*%FSM*/ /*%FSM*/ /* item0[] = {"init",0,250,-150.000000,-75.000000,-50.000000,-25.000000,0.000000,"init"}; item1[] = {"idle_exceeded",4,218,0.000000,225.000000,100.000000,275.000000,0.000000,"idle" \n "exceeded"}; item2[] = {"master_moved",4,218,-150.000000,300.000000,-50.000000,350.000000,0.000000,"master" \n "moved"}; -item3[] = {"moving",2,250,-150.000000,375.000000,-50.000000,425.000000,0.000000,"moving"}; -item4[] = {"close",4,218,-275.000000,300.000000,-175.000000,350.000000,0.000000,"close"}; +item3[] = {"Moving",2,250,-150.000000,375.000000,-50.000000,425.000000,0.000000,"Moving"}; +item4[] = {"close",4,4314,-275.000000,300.000000,-175.000000,350.000000,0.000000,"close"}; item5[] = {"",7,210,-229.000000,246.000000,-221.000000,254.000000,0.000000,""}; item6[] = {"Waiting",2,250,-150.000000,225.000000,-50.000000,275.000000,0.000000,"Waiting"}; item7[] = {"preloaded",4,218,-150.000000,0.000000,-50.000000,50.000000,0.000000,"preloaded"}; item8[] = {"reorientate",4,218,-150.000000,450.000000,-50.000000,500.000000,0.000000,"reorientate"}; -item9[] = {"Sitting",2,250,125.000000,225.000000,225.000000,275.000000,0.000000,"Sitting"}; -item10[] = {"master_moved",4,218,125.000000,300.000000,225.000000,350.000000,0.000000,"master" \n "moved"}; -item11[] = {"Getting_Up",2,250,125.000000,375.000000,225.000000,425.000000,0.000000,"Getting Up"}; +item9[] = {"Sitting",2,250,150.000000,225.000000,250.000000,275.000000,0.000000,"Sitting"}; +item10[] = {"master_moved",4,218,150.000000,300.000000,250.000000,350.000000,0.000000,"master" \n "moved"}; +item11[] = {"Getting_Up",2,250,150.000000,375.000000,250.000000,425.000000,0.000000,"Getting Up"}; item12[] = {"Up",4,218,0.000000,375.000000,100.000000,425.000000,0.000000,"Up"}; -item13[] = {"dead",4,218,0.000000,300.000000,100.000000,350.000000,0.000000,"dead"}; +item13[] = {"dead",4,218,0.000000,300.000000,100.000000,350.000000,3.000000,"dead"}; item14[] = {"End",1,250,0.000000,450.000000,100.000000,500.000000,0.000000,"End"}; item15[] = {"stay",4,218,0.000000,125.000000,100.000000,175.000000,1.000000,"stay"}; -item16[] = {"",7,210,-29.000002,245.999985,-20.999998,254.000000,0.000000,""}; +item16[] = {"",7,210,-29.000002,245.999985,-20.999998,254.000015,0.000000,""}; item17[] = {"",7,210,-29.000000,146.000000,-21.000000,153.999985,0.000000,""}; -item18[] = {"Staying",2,250,125.000000,125.000000,225.000000,175.000000,0.000000,"Staying"}; -item19[] = {"commanded",4,218,350.000000,175.000000,450.000000,225.000000,0.000000,"commanded"}; -item20[] = {"",7,210,396.000031,146.000000,403.999969,154.000000,0.000000,""}; -item21[] = {"",7,210,546.000000,146.000000,554.000000,154.000000,0.000000,""}; -item22[] = {"too_long",4,218,500.000000,175.000000,600.000000,225.000000,0.000000,"too long"}; -item23[] = {"",7,210,521.000000,396.000000,529.000000,404.000000,0.000000,""}; -item24[] = {"Reset",2,250,425.000000,300.000000,525.000000,350.000000,0.000000,"Reset"}; -item25[] = {"true",8,218,425.000000,375.000000,525.000000,425.000000,0.000000,"true"}; -item26[] = {"",7,210,396.000000,321.000000,404.000000,329.000000,0.000000,""}; -item27[] = {"track",4,218,0.000000,25.000000,100.000000,75.000000,0.000000,"track"}; -item28[] = {"",7,210,-29.000000,46.000008,-21.000000,53.999996,0.000000,""}; -item29[] = {"Tracking",2,250,250.000000,-50.000000,350.000000,0.000000,0.000000,"Tracking"}; -item30[] = {"commanded",4,218,400.000000,-50.000000,500.000000,0.000000,0.000000,"commanded"}; -item31[] = {"Checking",2,250,125.000000,25.000000,225.000000,75.000000,0.000000,"Checking"}; -item32[] = {"has_target",4,218,125.000000,-50.000000,225.000000,0.000000,1.000000,"has target"}; -item33[] = {"no_target",4,218,400.000000,25.000000,500.000000,75.000000,4.000000,"no target"}; -item34[] = {"Reset_1",2,250,575.000000,25.000000,675.000000,75.000000,0.000000,"Reset"}; -item35[] = {"",7,210,696.000000,46.000008,704.000000,53.999996,0.000000,""}; -item36[] = {"",7,210,371.000000,46.000008,379.000000,53.999989,0.000000,""}; -item37[] = {"",7,210,371.000000,-28.999994,379.000000,-21.000006,0.000000,""}; -item38[] = {"",7,210,371.000000,-129.000000,379.000000,-121.000008,0.000000,""}; -item39[] = {"at_target",4,218,400.000000,-150.000000,500.000000,-100.000000,0.000000,"at target"}; -item40[] = {"",7,210,546.000000,-28.999992,554.000000,-21.000008,0.000000,""}; -item41[] = {"",7,210,546.000000,46.000008,554.000000,53.999996,0.000000,""}; -item42[] = {"Chasing",2,250,525.000000,-150.000000,625.000000,-100.000000,0.000000,"Chasing"}; -item43[] = {"",7,210,696.000000,-179.000015,704.000000,-171.000000,0.000000,""}; -item44[] = {"",7,210,-229.000000,-179.000000,-221.000000,-171.000000,0.000000,""}; -item45[] = {"",7,210,-229.000000,171.000000,-221.000000,179.000000,0.000000,""}; -item46[] = {"reorientate",4,218,200.000000,-125.000000,300.000000,-75.000000,0.000000,"reorientate"}; -item47[] = {"action_init",2,250,-150.000000,75.000000,-50.000000,125.000000,0.000000,"action init"}; -item48[] = {"true",8,218,-150.000000,150.000000,-50.000000,200.000000,0.000000,"true"}; -item49[] = {"commanded",4,218,250.000000,300.000000,350.000000,350.000000,0.000000,"commanded"}; -item50[] = {"instant",4,218,-350.000000,375.000000,-250.000000,425.000000,0.000000,"instant"}; -item51[] = {"",7,210,-304.000000,246.000000,-296.000000,253.999985,0.000000,""}; -item52[] = {"",7,210,-29.000000,346.000000,-21.000000,354.000000,0.000000,""}; -item53[] = {"",7,210,171.000000,196.000000,179.000000,204.000000,0.000000,""}; -item54[] = {"",7,210,46.000000,196.000000,54.000000,204.000000,0.000000,""}; -item55[] = {"reorientate",4,218,575.000000,-75.000000,675.000000,-25.000000,0.000000,"reorientate"}; -item56[] = {"",7,210,571.000000,-78.999992,579.000000,-71.000008,0.000000,""}; -item57[] = {"",7,210,371.000000,-78.999992,379.000000,-71.000008,0.000000,""}; -item58[] = {"",7,210,370.999969,95.999992,379.000000,104.000000,0.000000,""}; -item59[] = {"",7,210,171.000000,96.000000,179.000000,104.000000,0.000000,""}; -item60[] = {"",7,210,58.500000,96.000000,66.500000,104.000000,0.000000,""}; -item61[] = {"",7,210,546.000000,321.000000,554.000000,329.000000,0.000000,""}; -item62[] = {"move",4,218,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"move"}; -item63[] = {"Get_Position",2,250,50.000000,-350.000000,150.000000,-300.000000,0.000000,"Get Position"}; -item64[] = {"valid_position",4,218,50.000000,-425.000000,150.000000,-375.000000,0.000000,"valid position"}; -item65[] = {"Moving_1",2,250,175.000000,-425.000000,275.000000,-375.000000,0.000000,"Moving"}; -item66[] = {"no_position",4,218,50.000000,-275.000000,150.000000,-225.000000,0.000000,"no position"}; -item67[] = {"Panda",2,250,175.000000,-275.000000,275.000000,-225.000000,0.000000,"Panda"}; -item68[] = {"commanded",4,218,175.000000,-350.000000,275.000000,-300.000000,0.000000,"commanded"}; -item69[] = {"",7,210,221.000000,-179.000000,229.000000,-171.000000,0.000000,""}; -item70[] = {"lost",4,218,300.000000,-425.000000,400.000000,-375.000000,0.000000,"lost"}; -item71[] = {"call_back",4,218,300.000000,-275.000000,400.000000,-225.000000,0.000000,"call back"}; -item72[] = {"Wander",2,250,300.000000,-350.000000,400.000000,-300.000000,0.000000,"Wander"}; -item73[] = {"In_Position",4,218,425.000000,-275.000000,525.000000,-225.000000,1.000000,"In Position"}; -item74[] = {"",7,210,171.000015,-154.000000,178.999985,-146.000000,0.000000,""}; -item75[] = {"",7,210,321.000000,-154.000031,329.000000,-145.999969,0.000000,""}; +item18[] = {"Staying",2,250,150.000000,125.000000,250.000000,175.000000,0.000000,"Staying"}; +item19[] = {"commanded",4,218,375.000000,175.000000,475.000000,225.000000,0.000000,"commanded"}; +item20[] = {"",7,210,421.000031,146.000000,428.999969,154.000000,0.000000,""}; +item21[] = {"",7,210,571.000000,146.000000,579.000000,154.000000,0.000000,""}; +item22[] = {"too_long",4,218,525.000000,175.000000,625.000000,225.000000,0.000000,"too long"}; +item23[] = {"Reset",2,250,450.000000,300.000000,550.000000,350.000000,0.000000,"Reset"}; +item24[] = {"true",8,218,450.000000,375.000000,550.000000,425.000000,0.000000,"true"}; +item25[] = {"",7,210,421.000000,321.000000,429.000000,329.000000,0.000000,""}; +item26[] = {"track",4,218,0.000000,25.000000,100.000000,75.000000,0.000000,"track"}; +item27[] = {"",7,210,-29.000000,46.000008,-21.000000,53.999996,0.000000,""}; +item28[] = {"Tracking",2,250,275.000000,-50.000000,375.000000,0.000000,0.000000,"Tracking"}; +item29[] = {"commanded",4,218,425.000000,-50.000000,525.000000,0.000000,0.000000,"commanded"}; +item30[] = {"Checking",2,250,150.000000,25.000000,250.000000,75.000000,0.000000,"Checking"}; +item31[] = {"has_target",4,218,150.000000,-50.000000,250.000000,0.000000,1.000000,"has target"}; +item32[] = {"no_target",4,218,425.000000,25.000000,525.000000,75.000000,4.000000,"no target"}; +item33[] = {"Reset_1",2,250,600.000000,25.000000,700.000000,75.000000,0.000000,"Reset"}; +item34[] = {"",7,210,721.000000,46.000008,729.000000,53.999996,0.000000,""}; +item35[] = {"",7,210,396.000000,46.000008,404.000000,53.999989,0.000000,""}; +item36[] = {"",7,210,396.000000,-28.999994,404.000000,-21.000006,0.000000,""}; +item37[] = {"",7,210,396.000000,-129.000000,404.000000,-121.000008,0.000000,""}; +item38[] = {"at_target",4,218,425.000000,-150.000000,525.000000,-100.000000,0.000000,"at target"}; +item39[] = {"",7,210,571.000000,-28.999992,579.000000,-21.000008,0.000000,""}; +item40[] = {"",7,210,571.000000,46.000008,579.000000,53.999996,0.000000,""}; +item41[] = {"Chasing",2,250,550.000000,-150.000000,650.000000,-100.000000,0.000000,"Chasing"}; +item42[] = {"",7,210,721.000000,-179.000015,729.000000,-171.000000,0.000000,""}; +item43[] = {"",7,210,-179.000000,-179.000000,-171.000000,-171.000000,0.000000,""}; +item44[] = {"",7,210,-179.000000,171.000000,-171.000000,179.000000,0.000000,""}; +item45[] = {"reorientate",4,218,225.000000,-125.000000,325.000000,-75.000000,0.000000,"reorientate"}; +item46[] = {"action_init",2,250,-150.000000,75.000000,-50.000000,125.000000,0.000000,"action init"}; +item47[] = {"true",8,218,-150.000000,150.000000,-50.000000,200.000000,0.000000,"true"}; +item48[] = {"commanded",4,218,275.000000,300.000000,375.000000,350.000000,0.000000,"commanded"}; +item49[] = {"instant",4,218,-350.000000,375.000000,-250.000000,425.000000,0.000000,"instant"}; +item50[] = {"",7,210,-304.000000,246.000000,-296.000000,253.999985,0.000000,""}; +item51[] = {"",7,210,-29.000000,321.000000,-21.000000,329.000000,0.000000,""}; +item52[] = {"",7,210,196.000000,196.000000,204.000000,204.000000,0.000000,""}; +item53[] = {"",7,210,46.000000,196.000000,54.000000,204.000000,0.000000,""}; +item54[] = {"reorientate",4,218,600.000000,-75.000000,700.000000,-25.000000,0.000000,"reorientate"}; +item55[] = {"",7,210,596.000000,-78.999992,604.000000,-71.000008,0.000000,""}; +item56[] = {"",7,210,396.000000,-78.999992,404.000000,-71.000008,0.000000,""}; +item57[] = {"",7,210,395.999969,95.999992,404.000000,104.000000,0.000000,""}; +item58[] = {"",7,210,196.000000,96.000000,204.000000,104.000000,0.000000,""}; +item59[] = {"",7,210,-29.000000,96.000000,-21.000000,104.000000,0.000000,""}; +item60[] = {"",7,210,571.000000,321.000000,579.000000,329.000000,0.000000,""}; +item61[] = {"move",4,218,0.000000,-350.000000,100.000000,-300.000000,0.000000,"move"}; +item62[] = {"Get_Position",2,250,125.000000,-350.000000,225.000000,-300.000000,0.000000,"Get Position"}; +item63[] = {"valid_position",4,218,125.000000,-425.000000,225.000000,-375.000000,0.000000,"valid position"}; +item64[] = {"Moving_1",2,250,250.000000,-425.000000,350.000000,-375.000000,0.000000,"Moving"}; +item65[] = {"no_position",4,218,125.000000,-275.000000,225.000000,-225.000000,0.000000,"no position"}; +item66[] = {"Nothing",2,250,250.000000,-275.000000,350.000000,-225.000000,0.000000,"Nothing"}; +item67[] = {"commanded",4,218,250.000000,-350.000000,350.000000,-300.000000,0.000000,"commanded"}; +item68[] = {"",7,210,295.999969,-179.000000,304.000031,-171.000000,0.000000,""}; +item69[] = {"lost",4,218,375.000000,-425.000000,475.000000,-375.000000,0.000000,"lost"}; +item70[] = {"call_back",4,218,375.000000,-275.000000,475.000000,-225.000000,0.000000,"call back"}; +item71[] = {"Wander",2,250,375.000000,-350.000000,475.000000,-300.000000,0.000000,"Wander"}; +item72[] = {"In_Position",4,218,475.000000,-300.000000,575.000000,-250.000000,1.000000,"In Position"}; +item73[] = {"",7,210,-28.999996,-329.000000,-21.000002,-321.000000,0.000000,""}; +item74[] = {"",7,210,296.000000,-454.000000,304.000000,-446.000000,0.000000,""}; +item75[] = {"",7,210,746.000000,-454.000000,753.999939,-446.000000,0.000000,""}; +item76[] = {"",7,210,746.000000,-329.000000,754.000000,-321.000000,0.000000,""}; +item77[] = {"",7,210,746.000000,446.000000,754.000000,453.999969,0.000000,""}; +item78[] = {"",7,210,-29.000000,246.000000,-21.000000,254.000000,0.000000,""}; +item79[] = {"",7,210,121.000000,446.000000,129.000000,454.000000,0.000000,""}; +item80[] = {"",7,210,121.000000,371.000000,129.000000,379.000000,0.000000,""}; +item81[] = {"",7,210,-29.000000,-404.000000,-21.000000,-396.000000,0.000000,""}; +item82[] = {"player_enter__ve",8,218,-150.000000,-425.000000,-50.000000,-375.000000,2.000000,"player enter " \n "vehicle"}; +item83[] = {"in_vehicle",2,250,-525.000000,-425.000000,-425.000000,-375.000000,0.000000,"in vehicle"}; +item84[] = {"player_exit__veh",4,218,-525.000000,-350.000000,-425.000000,-300.000000,0.000000,"player exit " \n "vehicle"}; +item85[] = {"",7,210,-228.999985,-454.000000,-221.000015,-446.000000,0.000000,""}; +item86[] = {"move_to_vehicle",2,250,-275.000000,-425.000000,-175.000000,-375.000000,0.000000,"move to vehicle"}; +item87[] = {"at_vehicle",4,218,-400.000000,-425.000000,-300.000000,-375.000000,0.000000,"at vehicle"}; +item88[] = {"",7,210,-478.999969,-454.000000,-471.000031,-446.000000,0.000000,""}; +item89[] = {"",7,210,-229.000000,-454.000000,-221.000000,-446.000000,0.000000,""}; +item90[] = {"vehicle_too_far",4,218,-275.000000,-350.000000,-175.000000,-300.000000,0.000000,"vehicle too far"}; +item91[] = {"Wait",2,250,-400.000000,-350.000000,-300.000000,-300.000000,0.000000,"Wait"}; +item92[] = {"call_back",4,218,-400.000000,-275.000000,-300.000000,-225.000000,0.000000,"call back"}; +item93[] = {"",7,210,-354.000000,246.000000,-346.000000,254.000000,0.000000,""}; +item94[] = {"In_Position",4,218,-300.000000,-300.000000,-200.000000,-250.000000,1.000000,"In Position"}; +item95[] = {"reorientate",4,218,-175.000000,-375.000000,-75.000000,-325.000000,0.000000,"reorientate"}; +item96[] = {"",7,210,-479.000000,96.000008,-471.000000,103.999992,0.000000,""}; +item97[] = {"",7,210,96.000000,96.000000,104.000000,104.000000,0.000000,""}; link0[] = {0,7}; link1[] = {1,9}; link2[] = {2,3}; link3[] = {3,4}; link4[] = {3,8}; -link5[] = {3,50}; -link6[] = {3,52}; +link5[] = {3,49}; +link6[] = {3,51}; link7[] = {4,5}; link8[] = {5,6}; link9[] = {6,2}; link10[] = {6,13}; link11[] = {6,16}; -link12[] = {7,47}; +link12[] = {7,46}; link13[] = {8,3}; link14[] = {9,10}; link15[] = {9,13}; -link16[] = {9,49}; -link17[] = {9,53}; +link16[] = {9,48}; +link17[] = {9,52}; link18[] = {10,11}; link19[] = {11,12}; -link20[] = {11,13}; -link21[] = {12,3}; +link20[] = {11,80}; +link21[] = {12,6}; link22[] = {13,14}; link23[] = {15,18}; link24[] = {16,1}; link25[] = {16,17}; link26[] = {17,15}; -link27[] = {17,28}; +link27[] = {17,59}; link28[] = {18,20}; -link29[] = {18,59}; -link30[] = {19,26}; +link29[] = {18,58}; +link30[] = {19,25}; link31[] = {20,19}; link32[] = {20,21}; link33[] = {21,22}; -link34[] = {22,61}; -link35[] = {24,25}; -link36[] = {25,11}; -link37[] = {26,24}; -link38[] = {27,31}; -link39[] = {28,27}; -link40[] = {28,62}; -link41[] = {29,37}; -link42[] = {29,38}; -link43[] = {29,46}; -link44[] = {30,40}; -link45[] = {31,32}; -link46[] = {31,36}; -link47[] = {32,29}; -link48[] = {33,41}; -link49[] = {34,35}; -link50[] = {35,43}; -link51[] = {36,33}; -link52[] = {36,58}; -link53[] = {37,30}; -link54[] = {37,36}; -link55[] = {38,39}; -link56[] = {39,42}; -link57[] = {40,41}; -link58[] = {41,34}; -link59[] = {42,55}; -link60[] = {42,56}; -link61[] = {43,69}; -link62[] = {44,45}; -link63[] = {45,48}; -link64[] = {46,29}; -link65[] = {47,48}; -link66[] = {48,6}; -link67[] = {49,11}; -link68[] = {50,51}; -link69[] = {51,5}; -link70[] = {52,13}; -link71[] = {52,16}; -link72[] = {53,54}; -link73[] = {54,15}; -link74[] = {55,42}; -link75[] = {56,57}; -link76[] = {57,37}; -link77[] = {58,59}; -link78[] = {59,60}; -link79[] = {60,13}; -link80[] = {61,24}; -link81[] = {62,63}; -link82[] = {63,64}; -link83[] = {63,66}; -link84[] = {64,65}; -link85[] = {65,68}; -link86[] = {65,70}; -link87[] = {65,74}; -link88[] = {66,67}; -link89[] = {67,69}; -link90[] = {68,67}; -link91[] = {69,44}; -link92[] = {70,72}; -link93[] = {71,67}; -link94[] = {72,71}; -link95[] = {72,73}; -link96[] = {72,75}; -link97[] = {73,72}; -link98[] = {74,13}; -link99[] = {75,74}; -globals[] = {25.000000,1,0,0,0,640,480,1,201,6316128,1,-335.377930,726.206177,762.469299,-723.096069,651,911,1}; -window[] = {2,-1,-1,-1,-1,1151,150,1358,150,3,669}; +link34[] = {22,60}; +link35[] = {23,24}; +link36[] = {24,11}; +link37[] = {25,23}; +link38[] = {26,30}; +link39[] = {27,26}; +link40[] = {27,73}; +link41[] = {28,36}; +link42[] = {28,37}; +link43[] = {28,45}; +link44[] = {29,39}; +link45[] = {30,31}; +link46[] = {30,35}; +link47[] = {31,28}; +link48[] = {32,40}; +link49[] = {33,34}; +link50[] = {34,42}; +link51[] = {35,32}; +link52[] = {35,57}; +link53[] = {36,29}; +link54[] = {36,35}; +link55[] = {37,38}; +link56[] = {38,41}; +link57[] = {39,40}; +link58[] = {40,33}; +link59[] = {41,54}; +link60[] = {41,55}; +link61[] = {42,68}; +link62[] = {43,44}; +link63[] = {44,47}; +link64[] = {45,28}; +link65[] = {46,47}; +link66[] = {47,6}; +link67[] = {48,11}; +link68[] = {49,50}; +link69[] = {50,5}; +link70[] = {51,13}; +link71[] = {51,78}; +link72[] = {52,53}; +link73[] = {53,15}; +link74[] = {54,41}; +link75[] = {55,56}; +link76[] = {56,36}; +link77[] = {57,58}; +link78[] = {58,97}; +link79[] = {59,27}; +link80[] = {60,23}; +link81[] = {61,62}; +link82[] = {62,63}; +link83[] = {62,65}; +link84[] = {63,64}; +link85[] = {64,67}; +link86[] = {64,69}; +link87[] = {64,74}; +link88[] = {65,66}; +link89[] = {66,68}; +link90[] = {67,66}; +link91[] = {68,43}; +link92[] = {69,71}; +link93[] = {70,66}; +link94[] = {71,70}; +link95[] = {71,72}; +link96[] = {71,76}; +link97[] = {72,71}; +link98[] = {73,61}; +link99[] = {73,81}; +link100[] = {74,75}; +link101[] = {75,76}; +link102[] = {76,77}; +link103[] = {77,79}; +link104[] = {79,80}; +link105[] = {80,13}; +link106[] = {81,82}; +link107[] = {82,86}; +link108[] = {83,84}; +link109[] = {83,88}; +link110[] = {84,96}; +link111[] = {85,74}; +link112[] = {86,87}; +link113[] = {86,89}; +link114[] = {86,90}; +link115[] = {86,95}; +link116[] = {87,83}; +link117[] = {88,89}; +link118[] = {90,91}; +link119[] = {91,89}; +link120[] = {91,92}; +link121[] = {91,94}; +link122[] = {92,93}; +link123[] = {93,50}; +link124[] = {94,91}; +link125[] = {95,86}; +link126[] = {96,46}; +link127[] = {97,13}; +globals[] = {25.000000,1,0,0,0,640,480,1,260,6316128,1,-727.852478,476.612427,472.387665,-270.819122,974,601,1}; +window[] = {2,-1,-1,-1,-1,824,44,1252,44,3,991}; *//*%FSM*/ class FSM { @@ -190,7 +240,7 @@ class FSM { name = "init"; init = /*%FSM*/"_dog = _this select 0;" \n - "_num = _this select 1;" \n + "_type = _this select 1;" \n "_standing = true;" \n "_command = ""none"";" \n "_forceWalk = false;" \n @@ -212,6 +262,8 @@ class FSM "_thrist = 0;" \n "_actionLieDown = -1;" \n "" \n + "_character = player;" \n + "" \n "_actionDir = ""\z\addons\dayz_code\actions\dog\"";" \n "" \n "_speedVal = [1,6,-1];"/*%FSM*/; @@ -231,11 +283,12 @@ class FSM }; }; /*%FSM*/ - /*%FSM*/ - class moving + /*%FSM*/ + class Moving { - name = "moving"; - init = /*%FSM*/"_pos = player modelToWorld [-1,1,0];" \n + name = "Moving"; + init = /*%FSM*/"_pos = (vehicle player) modelToWorld [-1,1,0];" \n + "" \n "if(_lastPos distance _pos > 1 or _forceChange) then {" \n " _lastPos = _pos;" \n " _dog doMove _pos;" \n @@ -244,17 +297,20 @@ class FSM "};" \n "_waitTime = time;" \n "" \n + "if (vehicle player != player) then {" \n + " diag_log format[""PLAYER IS IN: %1, str(vehicle player)];" \n + "};" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { - /*%FSM*/ - class stay + /*%FSM*/ + class dead { - priority = 1.000000; - to="Staying"; + priority = 3.000000; + to="End"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command == ""stay"""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ @@ -268,33 +324,6 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 0.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class idle_exceeded - { - priority = 0.000000; - to="Sitting"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"((time - _waitTime) > _idleTime) and _standing"/*%FSM*/; - action=/*%FSM*/"_standing = false;" \n - "if (!_watchDog) then {" \n - " _move = ""Dog_LieDown"";" \n - "} else {" \n - " _move = ""Dog_SitDown"";" \n - " _actionLieDown = _dog addAction [""Lie Down"", _actionDir + ""stay.sqf"",_handle, 0, true, true];" \n - "};" \n - "[objNull, _dog, rSwitchMove,_move] call RE;"/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class reorientate { @@ -305,33 +334,13 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class track - { - priority = 0.000000; - to="Checking"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command == ""track"""/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class move - { - priority = 0.000000; - to="Get_Position"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command == ""move"""/*%FSM*/; - action=/*%FSM*/"_command = ""none"";"/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class close { priority = 0.000000; to="Waiting"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"player distance _dog < 2"/*%FSM*/; + condition=/*%FSM*/"(vehicle player) distance _dog < 5"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ @@ -344,10 +353,31 @@ class FSM name = "Waiting"; init = /*%FSM*/"_waitTime = time;" \n "_waiting = true;" \n - "_lastpos = player modelToWorld [-1,1,0];"/*%FSM*/; + "_lastpos = player modelToWorld [-1,1,0];" \n + ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { + /*%FSM*/ + class dead + { + priority = 3.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class player_enter__ve + { + priority = 2.000000; + to="move_to_vehicle"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(vehicle _character != _character);"/*%FSM*/; + action=/*%FSM*/"diag_log ""PLAYER ENTERED VEHICLE"";"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class stay { @@ -358,33 +388,6 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class idle_exceeded - { - priority = 0.000000; - to="Sitting"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"((time - _waitTime) > _idleTime) and _standing"/*%FSM*/; - action=/*%FSM*/"_standing = false;" \n - "if (!_watchDog) then {" \n - " _move = ""Dog_LieDown"";" \n - "} else {" \n - " _move = ""Dog_SitDown"";" \n - " _actionLieDown = _dog addAction [""Lie Down"", _actionDir + ""stay.sqf"",_handle, 0, true, true];" \n - "};" \n - "[objNull, _dog, rSwitchMove,_move] call RE;"/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 0.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class track { @@ -405,13 +408,30 @@ class FSM action=/*%FSM*/"_command = ""none"";"/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class idle_exceeded + { + priority = 0.000000; + to="Sitting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"((time - _waitTime) > _idleTime) and _standing"/*%FSM*/; + action=/*%FSM*/"_standing = false;" \n + "if (!_watchDog) then {" \n + " _move = ""Dog_LieDown"";" \n + "} else {" \n + " _move = ""Dog_SitDown"";" \n + " _actionLieDown = _dog addAction [""Lie Down"", _actionDir + ""stay.sqf"",_handle, 0, true, true];" \n + "};" \n + "[objNull, _dog, rSwitchMove,_move] call RE;"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class master_moved { priority = 0.000000; - to="moving"; + to="Moving"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"player distance _dog > 2"/*%FSM*/; + condition=/*%FSM*/"(vehicle player) distance _dog > 2"/*%FSM*/; action=/*%FSM*/"_lastPos = position _dog;"/*%FSM*/; }; /*%FSM*/ @@ -427,6 +447,16 @@ class FSM precondition = /*%FSM*/""/*%FSM*/; class Links { + /*%FSM*/ + class dead + { + priority = 3.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class stay { @@ -447,16 +477,6 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 0.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class master_moved { @@ -491,7 +511,7 @@ class FSM /*%FSM*/ class dead { - priority = 0.000000; + priority = 3.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; @@ -502,7 +522,7 @@ class FSM class Up { priority = 0.000000; - to="moving"; + to="Waiting"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"((time - _waitTime) > 0.5)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; @@ -526,12 +546,18 @@ class FSM "_dog removeAction _actionFood;" \n "_dog removeAction _actionWater;" \n "" \n + "player removeAction _actionMove;" \n "player removeAction _actionSpeedStealth;" \n "player removeAction _actionSpeedFree;" \n "" \n "if(!isNil ""_actionCall"") then {" \n " player removeAction _actionCall;" \n - "};"/*%FSM*/; + "};" \n + "" \n + "if(!isNil ""_actionFollow"") then {" \n + " _dog removeAction _actionFollow;" \n + "};" \n + ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -554,6 +580,7 @@ class FSM "};" \n "" \n "_dog removeAction _actionStay;" \n + "" \n "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n "" \n @@ -562,26 +589,26 @@ class FSM precondition = /*%FSM*/""/*%FSM*/; class Links { - /*%FSM*/ - class too_long - { - priority = 0.000000; - to="reset"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"((time - _waitTime) > _staySkill)"/*%FSM*/; - action=/*%FSM*/"_command = ""none"";"/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class dead { - priority = 0.000000; + priority = 3.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class too_long + { + priority = 0.000000; + to="Reset"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"((time - _waitTime) > _staySkill)"/*%FSM*/; + action=/*%FSM*/"_command = ""none"";"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class commanded { @@ -589,7 +616,7 @@ class FSM to="Reset"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command != ""stay"""/*%FSM*/; - action=/*%FSM*/"if (_command == ""none"") then {" \n + action=/*%FSM*/"if (_command == ""return"") then {" \n " if ((player distance _dog > 5) and (_watchDog)) then {" \n " _dog playActionNow ""GestureBark"";" \n " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n @@ -600,13 +627,15 @@ class FSM }; }; /*%FSM*/ - /*%FSM*/ - class reset + /*%FSM*/ + class Reset { - name = "reset"; - init = /*%FSM*/"_dog removeAction _actionFollow;" \n - "_dog removeAction _actionLieDown;" \n + name = "Reset"; + init = /*%FSM*/"_dog removeAction _actionLieDown;" \n + "" \n "player removeAction _actionCall;" \n + "_dog removeAction _actionFollow;" \n + "" \n "_actionStay = _dog addAction [""Stay"",_actionDir + ""stay.sqf"",_handle, 5, true, true];" \n "_waiting = false;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; @@ -638,10 +667,6 @@ class FSM " _forceChange = false;" \n "};" \n "" \n - "" \n - "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n - "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n - "" \n "_waitTime = time;" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; @@ -651,25 +676,20 @@ class FSM class no_target { priority = 4.000000; - to="reset_1"; + to="Reset_1"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; action=/*%FSM*/"_command = ""none"";"/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class commanded + /*%FSM*/ + class dead { - priority = 0.000000; - to="reset_1"; + priority = 3.000000; + to="End"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command != ""track"""/*%FSM*/; - action=/*%FSM*/"if (_command == ""return"") then {" \n - " if ((player distance _dog > 5) and (_watchDog)) then {" \n - " _dog playActionNow ""GestureBark"";" \n - " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n - " };" \n - "};"/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ @@ -682,14 +702,19 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class dead + /*%FSM*/ + class commanded { priority = 0.000000; - to="End"; + to="Reset_1"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command != ""track"""/*%FSM*/; + action=/*%FSM*/"if (_command == ""return"") then {" \n + " if ((player distance _dog > 5) and (_watchDog)) then {" \n + " _dog playActionNow ""GestureBark"";" \n + " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n + " };" \n + "};"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ @@ -733,12 +758,22 @@ class FSM class no_target { priority = 4.000000; - to="reset_1"; + to="Reset_1"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; action=/*%FSM*/"_command = ""none"";"/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class dead + { + priority = 3.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class has_target { @@ -746,35 +781,24 @@ class FSM to="Tracking"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; - action=/*%FSM*/"_lastPos = position _dog;"/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 0.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/"_lastPos = position _dog;" \n + "" \n + "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n + "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ - /*%FSM*/ - class reset_1 + /*%FSM*/ + class Reset_1 { - name = "reset_1"; + name = "Reset_1"; init = /*%FSM*/"_actionTrack = _dog addAction [""Track"",_actionDir + ""track.sqf"",_handle, 4, true, true];" \n "" \n - "if(!isNil ""_actionFollow"") then {" \n - " _dog removeAction _actionFollow;" \n - "};" \n - "" \n - "if(!isNil ""_actionCall"") then {" \n - " player removeAction _actionCall;" \n - "};"/*%FSM*/; + "player removeAction _actionCall;" \n + "_dog removeAction _actionFollow;" \n + ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -816,6 +840,16 @@ class FSM action=/*%FSM*/"_command = ""none"";"/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class dead + { + priority = 3.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class commanded { @@ -831,16 +865,6 @@ class FSM "};"/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 0.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class reorientate { @@ -956,9 +980,9 @@ class FSM class no_position { priority = 0.000000; - to="Panda"; + to="Nothing"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"(count _movePos == 0)" \n + condition=/*%FSM*/"(count _movePos <= 0)" \n ""/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; @@ -971,7 +995,8 @@ class FSM precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(count _movePos > 0)" \n ""/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/"_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n + "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];"/*%FSM*/; }; /*%FSM*/ }; @@ -985,13 +1010,20 @@ class FSM "_dog forceSpeed (_speedVal select _maxSpeed);" \n "_forceChange = false;" \n "" \n - "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n - "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n - "" \n "_waitTime = time;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { + /*%FSM*/ + class dead + { + priority = 3.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class lost { @@ -1002,45 +1034,32 @@ class FSM action=/*%FSM*/"_pos = position _dog;"/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 0.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class commanded { priority = 0.000000; - to="Panda"; + to="Nothing"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command != ""none"""/*%FSM*/; - action=/*%FSM*/"if (_command == ""none"") then {" \n + action=/*%FSM*/"if (_command == ""return"") then {" \n " if ((player distance _dog > 5) and (_watchDog)) then {" \n " _dog playActionNow ""GestureBark"";" \n " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n " };" \n - "};"/*%FSM*/; + "};" \n + "" \n + "player removeAction _actionCall;" \n + "_dog removeAction _actionFollow;"/*%FSM*/; }; /*%FSM*/ }; }; /*%FSM*/ - /*%FSM*/ - class Panda + /*%FSM*/ + class Nothing { - name = "Panda"; - init = /*%FSM*/"if(!isNil ""_actionFollow"") then {" \n - " _dog removeAction _actionFollow;" \n - "};" \n - "" \n - "if(!isNil ""_actionCall"") then {" \n - " player removeAction _actionCall;" \n - "};"/*%FSM*/; + name = "Nothing"; + init = /*%FSM*/""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -1061,10 +1080,21 @@ class FSM class Wander { name = "Wander"; - init = /*%FSM*/"_isAlive = alive _dog;"/*%FSM*/; + init = /*%FSM*/"_pos = [(getPos _dog),10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n + "_dog moveTo _pos;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { + /*%FSM*/ + class dead + { + priority = 3.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class In_Position { @@ -1072,17 +1102,6 @@ class FSM to="Wander"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_dog distance _pos < 3"/*%FSM*/; - action=/*%FSM*/"_pos = [(getPos _dog),10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n - "_dog moveTo _pos;"/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 0.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ @@ -1090,12 +1109,146 @@ class FSM class call_back { priority = 0.000000; - to="Panda"; + to="Nothing"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command == ""return"""/*%FSM*/; + action=/*%FSM*/"if ((player distance _dog > 5) and (_watchDog)) then {" \n + " _dog playActionNow ""GestureBark"";" \n + " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n + "};" \n + "" \n + "player removeAction _actionCall;" \n + "_dog removeAction _actionFollow;" \n + ""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class in_vehicle + { + name = "in_vehicle"; + init = /*%FSM*/"terminate _heartbeat;" \n + "" \n + "_dog removeAction _actionWarn;" \n + "_dog removeAction _actionStay;" \n + "_dog removeAction _actionTrack;" \n + "_dog removeAction _actionBark;" \n + "_dog removeAction _actionFood;" \n + "_dog removeAction _actionWater;" \n + "" \n + "player removeAction _actionMove;" \n + "player removeAction _actionSpeedStealth;" \n + "player removeAction _actionSpeedFree;" \n + "" \n + "deleteVehicle _dog;" \n + "" \n + "diag_log ""DOG REMOVED"";"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class player_exit__veh + { + priority = 0.000000; + to="action_init"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(vehicle _character == _character)"/*%FSM*/; + action=/*%FSM*/"if (isNull _dog) then {" \n + " _dog = (group player) createUnit [ _type, player modelToWorld [-1,1,0], [], 0, ""FORM""];" \n + " _dog disableAI ""FSM"";" \n + "} ;" \n + "" \n + "diag_log ""DOG RECREATED"";"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class move_to_vehicle + { + name = "move_to_vehicle"; + init = /*%FSM*/"_playerloc = getPos (vehicle player);" \n + "_dog doMove _playerloc;" \n + "" \n + "diag_log ""DOG MOVING TO VEHICLE"";" \n + "_waitTime = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class vehicle_too_far + { + priority = 0.000000; + to="Wait"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_dog distance (vehicle player) > 300"/*%FSM*/; + action=/*%FSM*/"_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n + "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n + "" \n + "diag_log ""VEHICLE TOO FAR"";"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class reorientate + { + priority = 0.000000; + to="move_to_vehicle"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"((time - _waitTime) > 0.5)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class at_vehicle + { + priority = 0.000000; + to="in_vehicle"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_dog distance (vehicle player) <= 8"/*%FSM*/; + action=/*%FSM*/"diag_log ""DOG AT VEHICLE"";"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Wait + { + name = "Wait"; + init = /*%FSM*/"_pos = [(getPos _dog),10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n + "_dog moveTo _pos;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class In_Position + { + priority = 1.000000; + to="Wait"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_dog distance _pos < 3"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class call_back + { + priority = 0.000000; + to="Waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command == ""return"""/*%FSM*/; + action=/*%FSM*/"_dog removeAction _actionFollow;" \n + "player removeAction _actionCall;" \n + "" \n + "if ((player distance _dog > 5) and (_watchDog)) then {" \n + " _dog playActionNow ""GestureBark"";" \n + " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n + "};"/*%FSM*/; + }; + /*%FSM*/ }; }; /*%FSM*/ diff --git a/dayz_code/system/player_monitor.fsm b/dayz_code/system/player_monitor.fsm index e2c7fd9ca..ebdb0dada 100644 --- a/dayz_code/system/player_monitor.fsm +++ b/dayz_code/system/player_monitor.fsm @@ -34,9 +34,9 @@ item29[] = {"Load_In",2,250,-75.000000,850.000000,25.000000,900.000000,0.000000, item30[] = {"Bad_Version",4,218,50.000000,650.000000,150.000000,700.000000,0.000000,"Bad" \n "Version"}; item31[] = {"ERROR__Bad_Versi",2,250,175.000000,650.000000,275.000000,700.000000,0.000000,"ERROR:" \n "Bad Version"}; item32[] = {"Display_Ready",4,218,-175.000000,900.000000,-75.000000,950.000000,0.000000,"Display" \n "Ready"}; -item33[] = {"Preload_Display",2,250,-75.000000,950.000000,25.000000,1000.000000,0.000000,"Preload" \n "Display"}; +item33[] = {"Preload_Display",2,4346,-75.000000,950.000000,25.000000,1000.000000,0.000000,"Preload" \n "Display"}; item34[] = {"Preload_Done",4,218,-175.000000,1000.000000,-75.000000,1050.000000,0.000000,"Preload" \n "Done"}; -item35[] = {"Initialize",2,4346,-75.000000,1050.000000,25.000000,1100.000000,0.000000,"Initialize"}; +item35[] = {"Initialize",2,250,-75.000000,1050.000000,25.000000,1100.000000,0.000000,"Initialize"}; item36[] = {"Finish",1,250,-75.000000,1150.000000,25.000000,1200.000000,0.000000,"Finish"}; item37[] = {"True",8,218,25.000000,1100.000000,125.000000,1150.000000,0.000000,"True"}; item38[] = {"Too_Long",4,218,300.000000,150.000000,400.000000,200.000000,0.000000,"Too" \n "Long"}; @@ -115,7 +115,7 @@ link57[] = {50,49}; link58[] = {51,52}; link59[] = {52,29}; globals[] = {25.000000,1,0,0,0,640,480,1,81,6316128,1,-440.765930,455.171539,1392.221191,828.390381,955,601,1}; -window[] = {2,-1,-1,-1,-1,824,44,1015,44,3,972}; +window[] = {2,-1,-1,-1,-1,934,154,1125,154,3,972}; *//*%FSM*/ class FSM { @@ -929,7 +929,7 @@ class FSM "player disableConversation true;" \n "" \n "eh_player_killed = player addeventhandler [""FiredNear"",{_this call player_weaponFiredNear;} ];" \n - "_eh_combat_projectilenear = player addEventHandler [""IncomingFire"",{_this call player_projectileNear;}];" \n + "//_eh_combat_projectilenear = player addEventHandler [""IncomingFire"",{_this call player_projectileNear;}];" \n "" \n "//Select Weapon" \n "// Desc: select default weapon & handle multiple muzzles" \n diff --git a/dayz_code/z/addons/dayz_code/$PBOPREFIX$ b/dayz_code/z/addons/dayz_code/$PBOPREFIX$ deleted file mode 100644 index 86d7c3d1a..000000000 --- a/dayz_code/z/addons/dayz_code/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\addons\dayz_code \ No newline at end of file diff --git a/dayz_server/compile/server_playerSetup.sqf b/dayz_server/compile/server_playerSetup.sqf index c49c10c28..5c2481443 100644 --- a/dayz_server/compile/server_playerSetup.sqf +++ b/dayz_server/compile/server_playerSetup.sqf @@ -19,6 +19,13 @@ if (_playerID == "") exitWith { diag_log ("SETUP INIT FAILED: Exiting, no player ID: " + str(_playerObj)); }; +private["_dummy"]; +_dummy = getPlayerUID _playerObj; +if ( _playerID != _dummy ) then { + diag_log format["DEBUG: _playerID miscompare with UID! _playerID:%1",_playerID]; + _playerID = _dummy; +}; + //Variables _worldspace = []; _survival = [0,0,0]; @@ -244,22 +251,6 @@ _playerObj setVariable ["lastTime",time]; diag_log ("LOGIN PUBLISHING: " + str(_playerObj) + " Type: " + (typeOf _playerObj)); -myObj = objNull; -call compile format["myObj = player%1",_playerID]; - -if (!(isNull myObj)) then { - if (alive myObj) then { - deleteVehicle myObj; - diag_log ("LOGIN DUPLICATE PLAYER: " + str(_playerObj) + " DELETED ORIGINAL"); - }; -}; - -//Record player for management -myObj = _playerObj; -call compile format["player%1 = myObj;",_playerID]; -//diag_log (format["player%1 = myObj",_playerID]); -//dayz_players set [count dayz_players,_playerObj]; - dayzLogin = null; dayzLogin2 = null; diff --git a/dayz_server/compile/server_publishBank.sqf b/dayz_server/compile/server_publishBank.sqf new file mode 100644 index 000000000..52b049a63 --- /dev/null +++ b/dayz_server/compile/server_publishBank.sqf @@ -0,0 +1,33 @@ +private["_type","_mUID","_deposit","_key","_result","_outcome","_balance","_uid"]; +//[UID,_deposit,] +_mUID = _this select 0; +_deposit = _this select 1; +_type = _this select 2; +_player = _this select 3; + + +//GET DB ID +_key = format["CHILD:111:%1:%2:%3:",_mUID,_deposit,_type]; + +diag_log ("HIVE: WRITE: "+ str(_key)); + +_result = [_key] call server_hiveReadWrite; + +_outcome = _result select 0; + +if (_outcome == "PASS") then { + + _msg = _result select 1; + _balance = _result select 2; + + diag_log("BANK: Action msg:" + str(_msg) + " Balance:" + str(_player)); + + _clientID = owner _player; + + dayzBankBalance = _balance; + _clientID publicVariableClient "dayzBankBalance"; + + diag_log ("PUBLISH BANK: Deposit " + str(_clientID) + " with " + str(_deposit)); + +}; + diff --git a/dayz_server/compile/server_traders.sqf b/dayz_server/compile/server_traders.sqf new file mode 100644 index 000000000..7be92ec64 --- /dev/null +++ b/dayz_server/compile/server_traders.sqf @@ -0,0 +1,41 @@ +private["_type","_location","_clientID","_character","_tent","_traderid","_id","_outcome","_retrader"]; +//[dayz_characterID,_tent,[_dir,_location],"TentStorage"] +_character = _this select 0; +_traderid = _this select 1; + +_retrader = []; + +_clientID = owner _character; +diag_log ("HIVE: Menu Request by ClientID: "+ str(_clientID)); + +_key = format["CHILD:399:%1:",_traderid]; +_data = "HiveEXT" callExtension _key; + +diag_log "HIVE: Request sent"; + +//Process result +_result = call compile format ["%1",_data]; +_status = _result select 0; + +_myArray = []; +if (_status == "ObjectStreamStart") then { + _val = _result select 1; + //Stream Objects + diag_log ("HIVE: Commence Object Streaming..."); + for "_i" from 1 to _val do { + _data = "HiveEXT" callExtension _key; + _result = call compile format ["%1",_data]; + _status = _result select 0; + if (_status == "TRD") then { + _retrader set [count _retrader,_result]; + }; + //diag_log ("HIVE: Loop "); + }; + //diag_log ("HIVE: Streamed " + str(_val) + " objects"); +}; + + +diag_log(_retrader); +dayzTraderMenuResult = _retrader; +_clientID publicVariableClient "dayzTraderMenuResult"; +_retrader \ No newline at end of file diff --git a/dayz_server/init/server_functions.sqf b/dayz_server/init/server_functions.sqf index bd4a35938..99d82b4ca 100644 --- a/dayz_server/init/server_functions.sqf +++ b/dayz_server/init/server_functions.sqf @@ -12,6 +12,8 @@ server_updatePlayer = compile preprocessFileLineNumbers "\z\addons\dayz_server\ server_playerStat = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerStat.sqf"; server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf"; server_publishVeh = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf"; // Custom to add vehicles +server_publishBank = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishBank.sqf"; +server_traders = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_traders.sqf"; local_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_publishObj.sqf"; //Creates the object in DB local_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_deleteObj.sqf"; //Creates the object in DB local_createObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_createObj.sqf"; //Creates the object in DB diff --git a/dayz_server/system/server_monitor.sqf b/dayz_server/system/server_monitor.sqf index 824148a9e..035af59fc 100644 --- a/dayz_server/system/server_monitor.sqf +++ b/dayz_server/system/server_monitor.sqf @@ -49,15 +49,33 @@ diag_log "HIVE: Starting"; _idKey = _x select 1; _type = _x select 2; _ownerID = _x select 3; - _dir = (_x select 4) select 0; - _pos = (_x select 4) select 1; + + _worldspace = _x select 4; + _dir = 0; + _pos = [0,0,0]; + _wsDone = false; + if (count _worldspace >= 2) then + { + _dir = _worldspace select 0; + if (count (_worldspace select 1) == 3) then { + _pos = _worldspace select 1; + _wsDone = true; + } + }; + if (!_wsDone) then { + if (count _worldspace >= 1) then { _dir = _worldspace select 0; }; + _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos; + if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; }; + diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos)); + }; + _intentory= _x select 5; _hitPoints= _x select 6; _fuel = _x select 7; _damage = _x select 8; if (_damage < 1) then { - diag_log ("OBJ: " + str(_idKey) + _type); + diag_log format["OBJ: %1 - %2", _idKey,_type]; //Create it _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"]; @@ -135,7 +153,7 @@ diag_log "HIVE: Starting"; _position = ([(getPosATL _object),0,100,10,0,500,0] call BIS_fnc_findSafePos); _object setPosATL _position; }; - _id = _object spawn fnc_vehicleEventHandler; + _object call fnc_vehicleEventHandler; _totalvehicles = _totalvehicles + 1; };