From 9ca20ad439a6d1a33543f03f0523b9652e3d5f5c Mon Sep 17 00:00:00 2001 From: vbawol Date: Sun, 17 Feb 2013 09:14:52 -0600 Subject: [PATCH] 0.961 + Corrected conversion rate for silver to gold when selling bulk supply crates. + Added sleep within spawn {} for fetching vehicle ID, should reduce db spam. + Switched normal wire to fortrazor_wire and added as builtitems + Potential fix for wild spawning helicopters in forests. + Player zombies should now be able to break the legs of other players. + Purchased vehicles now spawn on the closestHeliHCivil within 200m. --- dayz_code/actions/pzombie/pz_attack.sqf | 11 +- dayz_code/actions/trade_items.sqf | 51 +- dayz_code/config.cpp | 2 +- dayz_code/init/compiles.sqf | 1 + dayz_code/init/publicEH.sqf | 2 +- dayz_code/medical/publicEH/medBreakLegs.sqf | 26 + dayz_code/rscTitles.hpp | 2 +- dayz_equip/config.cpp | 17 + dayz_server/compile/server_publishVehicle.sqf | 104 ++-- dayz_server/system/newservercleanup.fsm | 465 ++++++++++++++++++ 10 files changed, 589 insertions(+), 92 deletions(-) create mode 100644 dayz_code/medical/publicEH/medBreakLegs.sqf create mode 100644 dayz_server/system/newservercleanup.fsm diff --git a/dayz_code/actions/pzombie/pz_attack.sqf b/dayz_code/actions/pzombie/pz_attack.sqf index 98ddb06a8..cbfe2ce0a 100644 --- a/dayz_code/actions/pzombie/pz_attack.sqf +++ b/dayz_code/actions/pzombie/pz_attack.sqf @@ -19,16 +19,7 @@ _isZombie = _ent isKindOf "zZombie_base"; if (_ent isKindOf "Animal" or _isZombie) then { _ent setDamage 1; } else { - - // TODO TEST AND Improve - _cnt = count (DAYZ_woundHit select 1); - _index = floor (random _cnt); - _index = (DAYZ_woundHit select 1) select _index; - _wound = (DAYZ_woundHit select 0) select _index; - - _damage = 0.1 + random (1.2); - - [_item, _wound, _damage, player,"zombie"] call fnc_usec_damageHandler; + ["usecBreakLegs",[_unit,player]] call broadcastRpcCallAll; }; diff --git a/dayz_code/actions/trade_items.sqf b/dayz_code/actions/trade_items.sqf index ea26ce18f..51cfce258 100644 --- a/dayz_code/actions/trade_items.sqf +++ b/dayz_code/actions/trade_items.sqf @@ -54,40 +54,35 @@ if (_bulkqty >= 1) then { // gold = 6 silver // - if (_part_out == "ItemSilverBar") then { + if (_part_out == "ItemSilverBar" and _qty_out >= 30) then { - if (_qty_out >= 6) then { + - // find number of gold - _gold_out = _qty_out / 6; + // find number of gold + _gold_out = _qty_out / 30; - // whole number of gold bars - _gold_qty_out = floor _gold_out; + // whole number of gold bars + _gold_qty_out = floor _gold_out; - _part_out = "ItemGoldBar"; - for "_x" from 1 to _gold_qty_out do { - player addMagazine _part_out; - }; - - // Find remainder - _partial_qty_out = (_gold_out - _gold_qty_out) * 6; - - // whole number of gold bars - _silver_qty_out = floor _partial_qty_out; - - _part_out = "ItemSilverBar"; - for "_x" from 1 to _silver_qty_out do { - player addMagazine _part_out; - }; - - - } else { - - for "_x" from 1 to _qty_out do { - player addMagazine _part_out; - }; + _part_out = "ItemGoldBar"; + for "_x" from 1 to _gold_qty_out do { + player addMagazine _part_out; }; + // Find remainder + _partial_qty_out = (_gold_out - _gold_qty_out) * 30; + + // whole number of silver bars + _silver_qty_out = floor _partial_qty_out; + + _part_out = "ItemSilverBar"; + for "_x" from 1 to _silver_qty_out do { + player addMagazine _part_out; + }; + + + + } else { for "_x" from 1 to _qty_out do { diff --git a/dayz_code/config.cpp b/dayz_code/config.cpp index 7556d3b48..2c5316266 100644 --- a/dayz_code/config.cpp +++ b/dayz_code/config.cpp @@ -33,7 +33,7 @@ class CfgMods hidePicture = 0; hideName = 0; action = "http://www.dayzepoch.com"; - version = "0.96"; + version = "0.961"; hiveVersion = 0.96; //0.93 }; }; diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf index fd00c0c9e..7f2f06838 100644 --- a/dayz_code/init/compiles.sqf +++ b/dayz_code/init/compiles.sqf @@ -430,6 +430,7 @@ if (!isDedicated) then { player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf"; player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf"; player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf"; + player_breaklegs = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBreakLegs.sqf"; player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf"; world_isDay = {if ((daytime < (24 - dayz_sunRise)) and (daytime > dayz_sunRise)) then {true} else {false}}; player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf"; diff --git a/dayz_code/init/publicEH.sqf b/dayz_code/init/publicEH.sqf index 4bacf2fa1..694ebcae9 100644 --- a/dayz_code/init/publicEH.sqf +++ b/dayz_code/init/publicEH.sqf @@ -63,6 +63,7 @@ registerBroadcastRpc = { ["usecPainK", { (_this select 1) call player_medPainkiller; } ] call registerBroadcastRpc; //BIS_Effects_Burn is empty on the server anyway, but this EH is called ["dayzFire", { (_this select 1) spawn BIS_Effects_Burn; } ] call registerBroadcastRpc; +["usecBreakLegs", { (_this select 1) call player_breaklegs; } ] call registerBroadcastRpc; //server only if (isServer) then { @@ -77,7 +78,6 @@ if (!isDedicated) then { ["dayzHideBody", { hideBody (_this select 1); } ] call registerBroadcastRpc; ["dayzHumanity", { (_this select 1) spawn player_humanityChange; } ] call registerBroadcastRpc; ["dayzHitV", { (_this select 1) call fnc_usec_damageVehicle; } ] call registerBroadcastRpc; - ["dayzFlies", { (_this select 1) call spawn_flies; } ] call registerBroadcastRpc; ["dayzRoadFlare", { (_this select 1) spawn object_roadFlare; } ] call registerBroadcastRpc; ["norrnRaDrag", { [_this select 1] execVM "\z\addons\dayz_code\medical\publicEH\animDrag.sqf"; } ] call registerBroadcastRpc; diff --git a/dayz_code/medical/publicEH/medBreakLegs.sqf b/dayz_code/medical/publicEH/medBreakLegs.sqf new file mode 100644 index 000000000..2d1111d57 --- /dev/null +++ b/dayz_code/medical/publicEH/medBreakLegs.sqf @@ -0,0 +1,26 @@ +// medBreakLegs.sqf +private["_array","_unit","_medic","_display","_control","_hitLegs","_hitArms"]; +disableserialization; +_array = _this; //_this select 0; +_unit = _array select 0; +_medic = _array select 1; + +if (_unit == player) then { + r_fracture_legs = true; + r_fracture_arms = true; + _unit setHit["legs",1]; + _unit setHit["hands",1]; + + //Ensure Control is visible + _display = uiNamespace getVariable 'DAYZ_GUI_display'; + _control = _display displayCtrl 1203; + _control ctrlShow true; + + _id = true spawn dayz_disableRespawn; +}; +_unit setVariable ["hit_legs",1,false]; +_unit setVariable ["hit_hands",1,false]; + +if (isServer) then { + _unit setVariable["medForceUpdate",true]; +}; \ No newline at end of file diff --git a/dayz_code/rscTitles.hpp b/dayz_code/rscTitles.hpp index cb3e67184..7455caa6a 100644 --- a/dayz_code/rscTitles.hpp +++ b/dayz_code/rscTitles.hpp @@ -87,7 +87,7 @@ class RscDisplayMain : RscStandardDisplay class DAYZ_Version : CA_Version { idc = -1; - text = "DayZ Epoch 0.96 (1.7.5.1)"; + text = "DayZ Epoch 0.961 (1.7.5.1)"; y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)"; }; class CA_TitleMainMenu; diff --git a/dayz_equip/config.cpp b/dayz_equip/config.cpp index 9df484c06..62066eca6 100644 --- a/dayz_equip/config.cpp +++ b/dayz_equip/config.cpp @@ -1940,6 +1940,23 @@ class CfgVehicles displayName = "Hedgehog (Steel)"; vehicleClass = "Fortifications"; }; + + + class Fort_RazorWire : BuiltItems { + scope = 2; + animated = 0; + vehicleClass = "Fortifications"; + model = "\ca\misc\Fort_Razorwire"; + icon = "\Ca\misc\data\icons\I_drutkolczasty_CA.paa"; + accuracy = 0.3; + mapSize = 5.5; + displayName = "Wire"; + destrType = "DestructTent"; + armor = 100; + GhostPreview = "Fort_RazorWirePreview"; + } + + class Sandbag1_DZ: BuiltItems { scope = 2; diff --git a/dayz_server/compile/server_publishVehicle.sqf b/dayz_server/compile/server_publishVehicle.sqf index e23287ead..4898949e9 100644 --- a/dayz_server/compile/server_publishVehicle.sqf +++ b/dayz_server/compile/server_publishVehicle.sqf @@ -69,66 +69,68 @@ if (_spawnDMG) then { }; //Send request -_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _characterID, _worldspace, [], _array, _fuel,_uid]; // Change this to dynamic parts damage and fuel +_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _characterID, _worldspace, [], _array, _fuel,_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,_fuel,_damage,_array,_characterID,_class] spawn { + private["_object","_uid","_fuel","_damage","_array","_characterID","_done","_retry","_key","_result","_outcome","_oid","_selection","_dam","_class"]; -_done = false; -_retry = 0; -// TODO: Needs major overhaul -while {_retry < 15} do { - - // 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; + _object = _this select 0; + _uid = _this select 1; + _fuel = _this select 2; + _damage = _this select 3; + _array = _this select 4; + _characterID = _this select 5; + _class = _this select 6; - } else { - diag_log("CUSTOM: trying again to get id for: " + str(_uid)); - _done = false; - _retry = _retry + 1; + _done = false; + _retry = 0; + // TODO: Needs major overhaul + 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; + }; }; -}; -if(!_done) exitWith { deleteVehicle _object; diag_log("CUSTOM: failed to get id for : " + str(_uid)); }; + if(!_done) exitWith { deleteVehicle _object; diag_log("CUSTOM: failed to get id for : " + str(_uid)); }; + _object setVariable ["lastUpdate",time]; + _object setVariable ["CharacterID", _characterID, true]; + _object setDamage _damage; -// disable marker later -//_marker = createMarker [str(_location) , _location]; -//_marker setMarkerShape "ICON"; -//_marker setMarkerType "DOT"; -//_marker setMarkerText (typeOf _object); -//_marker setMarkerColor "ColorBlue"; + // Set Hits after ObjectID is set + { + _selection = _x select 0; + _dam = _x select 1; + if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8}; + [_object,_selection,_dam] call object_setFixServer; + } forEach _array; -// try this instead of commented out ID code above -// worked except vehicle pos was not saved -// _object setVariable ["ObjectUID", _uid, true]; + + _object setFuel _fuel; + + _object setvelocity [0,0,1]; -_object setVariable ["lastUpdate",time]; -_object setVariable ["CharacterID", _characterID, true]; + _object call fnc_vehicleEventHandler; -_object setDamage _damage; + dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; -// Set Hits after ObjectID is set -{ - _selection = _x select 0; - _dam = _x select 1; - if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8}; - [_object,_selection,_dam] call object_setFixServer; -} forEach _array; - -_object setvelocity [0,0,1]; -_object setFuel _fuel; - -_object call fnc_vehicleEventHandler; - -dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; - -diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid)); \ No newline at end of file + diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid)); +}; \ No newline at end of file diff --git a/dayz_server/system/newservercleanup.fsm b/dayz_server/system/newservercleanup.fsm new file mode 100644 index 000000000..4e205382e --- /dev/null +++ b/dayz_server/system/newservercleanup.fsm @@ -0,0 +1,465 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"init",0,250,-75.000000,-400.000000,25.000000,-350.000000,0.000000,"init"}; +item1[] = {"true",8,218,-75.000000,-175.000000,25.000000,-125.000000,0.000000,"true"}; +item2[] = {"waiting",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"waiting"}; +item3[] = {"time_dead",4,218,-300.000000,-25.000000,-200.000000,25.000000,4.000000,"time" \n "dead"}; +item4[] = {"cleanup_dead",2,250,-300.000000,50.000000,-200.000000,100.000000,0.000000,"cleanup" \n "dead"}; +item5[] = {"time_items",4,218,0.000000,-25.000000,100.000000,25.000000,2.000000,"time" \n "items"}; +item6[] = {"cleanup_items",2,250,0.000000,50.000000,100.000000,100.000000,0.000000,"cleanup" \n "items"}; +item7[] = {"time_sync",4,218,-150.000000,-25.000000,-50.000000,25.000000,3.000000,"time" \n "sync"}; +item8[] = {"sync_the_time",2,250,-150.000000,50.000000,-50.000000,100.000000,0.000000,"sync" \n "the time"}; +item9[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"}; +item10[] = {"general_cleanup",2,250,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup"}; +item11[] = {"",7,210,-341.500000,220.999985,-333.500000,229.000015,0.000000,""}; +item12[] = {"",7,210,-341.500000,-154.000000,-333.500000,-146.000000,0.000000,""}; +item13[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"}; +item14[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"}; +item15[] = {"update_objects",2,250,150.000000,50.000000,250.000000,100.000000,0.000000,"update objects"}; +item16[] = {"time_obj_update",4,218,150.000000,-25.000000,250.000000,25.000000,1.000000,"time" \n "obj update"}; +item17[] = {"anti_hack",4,218,150.000000,-100.000000,250.000000,-50.000000,0.000000,"anti hack"}; +item18[] = {"check_for_hacker",2,250,150.000000,-175.000000,250.000000,-125.000000,0.000000,"check for" \n "hackers"}; +item19[] = {"zeds",4,218,-300.000000,-100.000000,-200.000000,-50.000000,5.000000,"zeds"}; +item20[] = {"zeds_2",2,4346,-300.000000,-250.000000,-200.000000,-200.000000,0.000000,"zeds 2"}; +link0[] = {0,13}; +link1[] = {1,2}; +link2[] = {2,3}; +link3[] = {2,5}; +link4[] = {2,7}; +link5[] = {2,16}; +link6[] = {2,17}; +link7[] = {2,19}; +link8[] = {3,4}; +link9[] = {4,9}; +link10[] = {5,6}; +link11[] = {6,9}; +link12[] = {7,8}; +link13[] = {8,9}; +link14[] = {9,10}; +link15[] = {10,11}; +link16[] = {11,12}; +link17[] = {12,1}; +link18[] = {13,14}; +link19[] = {14,1}; +link20[] = {15,9}; +link21[] = {16,15}; +link22[] = {17,18}; +link23[] = {18,1}; +link24[] = {19,20}; +link25[] = {20,1}; +globals[] = {25.000000,1,0,0,0,640,480,1,35,6316128,1,-490.323517,223.868469,433.310364,-391.167908,802,1030,1}; +window[] = {2,-1,-1,-32000,-32000,1037,130,1244,130,3,820}; +*//*%FSM*/ +class FSM +{ + fsmName = "DayZ Server Cleanup"; + class States + { + /*%FSM*/ + class init + { + name = "init"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class initialized + { + priority = 0.000000; + to="prepare"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isnil ""bis_fnc_init"""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class waiting + { + name = "waiting"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class zeds + { + priority = 5.000000; + to="zeds_2"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastZombieCheck) > 60"/*%FSM*/; + action=/*%FSM*/"_lastZombieCheck = time;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class time_dead + { + priority = 4.000000; + to="cleanup_dead"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastDeadCheck) > 600"/*%FSM*/; + action=/*%FSM*/"_lastDeadCheck = time;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class time_sync + { + priority = 3.000000; + to="sync_the_time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastTimeSync) > 300"/*%FSM*/; + action=/*%FSM*/"_lastTimeSync = time;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class time_items + { + priority = 2.000000; + to="cleanup_items"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastItemCheck) > 60"/*%FSM*/; + action=/*%FSM*/"_lastItemCheck = time;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class time_obj_update + { + priority = 1.000000; + to="update_objects"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time-_lastObjectUpdateCheck) > 10"/*%FSM*/; + action=/*%FSM*/"_lastObjectUpdateCheck = time;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class anti_hack + { + priority = 0.000000; + to="check_for_hacker"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time-_timeHackCheck) > 1"/*%FSM*/; + action=/*%FSM*/"_timeHackCheck = time;"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class cleanup_dead + { + name = "cleanup_dead"; + init = /*%FSM*/"_numDead = {local _x} count allDead;" \n + "" \n + "if (_numDead > 300) then { " \n + "" \n + " diag_log (""CLEANUP: TOO MANY DEAD BODIES"");" \n + " diag_log (""CLEANUP: PERFORMING BODY CLEANUP ON "" + str(_numDead) + "" BODIES"");" \n + "" \n + " //Cleanup zed's & players" \n + "" \n + " _delQtyZ = 0; " \n + " _delQtyP = 0;" \n + " {" \n + " if (local _x) then {" \n + " if (_x isKindOf ""zZombie_Base"") then {" \n + " deleteVehicle _x;" \n + " _delQtyZ = _delQtyZ + 1;" \n + " } else {" \n + " _pos = getPosATL _x;" \n + " _sfx = nearestObject [_pos,""Sound_Flies""];" \n + " if (!(isNull _sfx)) then {" \n + " deleteVehicle _sfx;" \n + " };" \n + " deleteVehicle _x;" \n + " _delQtyP = _delQtyP + 1;" \n + " };" \n + " };" \n + " } forEach allDead;" \n + "" \n + " //Check Flies" \n + " _dwUSOFC=0;" \n + " {" \n + " if (local _x) then {" \n + " deleteVehicle _x;" \n + " _dwUSOFC=_dwUSOFC+1;" \n + " };" \n + " diag_log (""CLEANUP: DELETED AN UNCONTROLLED SOUND OF FLIES:"" + str(_dwUSOFC) );" \n + " } forEach allMissionObjects ""Sound_Flies"";" \n + "" \n + " //clean fireplaces" \n + " _dwUFPC=0;" \n + " {" \n + " if (local _x) then {" \n + " deleteVehicle _x;" \n + " _dwUFPC=_dwUFPC+1;" \n + " };" \n + " diag_log (""CLEANUP: DELETED AN UNCONTROLLED FIREPLACE:"" + str(_dwUFPC) );" \n + " } forEach allMissionObjects ""Land_Fire_DZ"";" \n + "" \n + " diag_log (""CLEANUP: DELETED "" + str(_delQtyP) + "" PLAYER BODIES AND "" + str(_delQtyZ) + "" BODIES"");" \n + "};" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="general_cleanup"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class cleanup_items + { + name = "cleanup_items"; + init = /*%FSM*/"_missionObjs = allMissionObjects ""WeaponHolder"";" \n + "_qty = count _missionObjs;" \n + "//diag_log (""CLEANUP: PERFORMING ITEM CLEANUP: TOTAL "" + str(_qty) + "" LOOT BAGS"");" \n + "_delQty = 0;" \n + "_qtyLoc = 0;" \n + "{" \n + " if (local _x) then {" \n + " _qtyLoc = _qtyLoc + 1; // debugging" \n + " _keep = _x getVariable [""permaLoot"",false];" \n + " _nearby = count (_x nearEntities [AllPlayers, 100]);" \n + " if ( (!_keep) && (_nearby==0) ) then {" \n + " deleteVehicle _x;" \n + " _delQty = _delQty + 1;" \n + " };" \n + " };" \n + "} forEach _missionObjs;" \n + "" \n + "if (_delQty > 0) then {" \n + " diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \n + "};" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="general_cleanup"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class sync_the_time + { + name = "sync_the_time"; + init = /*%FSM*/"//Send request" \n + "_key = ""CHILD:307:"";" \n + "_result = _key call server_hiveReadWrite;" \n + "_outcome = _result select 0;" \n + "if(_outcome == ""PASS"") then {" \n + " _date = _result select 1; " \n + " _dateNum = dateToNumber(_date); " \n + " _diff = ( _dateNum - dateToNumber (date) )*365*24*60;" \n + " if ( abs(_diff)>5 ) then {" \n + " [""dayzSetDate"",_date] call broadcastRpcCallAll;" \n + " diag_log (""TIME SYNC: Local Time set to "" + str(_date));" \n + " };" \n + "};" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="general_cleanup"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class general_cleanup + { + name = "general_cleanup"; + init = /*%FSM*/"//Clean groups" \n + "{" \n + " //diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n + " if (count units _x==0) then {" \n + " deleteGroup _x;" \n + " //diag_log (""CLEANUP: DELETING A GROUP"");" \n + " };" \n + "} forEach allGroups;" \n + "" \n + "/*" \n + "//Check for Ammobox" \n + " {" \n + " if(!(_x isKindOf ""WeaponHolder"")) then {" \n + " diag_log (""CLEANUP: DELETING AN AMMOBOX "" + (typeOf _x));" \n + " deleteVehicle _x;" \n + " };" \n + " } forEach allMissionObjects ""ReammoBox"";" \n + "*/" \n + "" \n + "dayz_serverObjectMonitor = _safety;" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class prepare + { + name = "prepare"; + init = /*%FSM*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n + "" \n + "_safety = dayz_serverObjectMonitor;" \n + "" \n + "_lastTimeSync = time;" \n + "_lastDeadCheck = time;" \n + "_lastItemCheck = time;" \n + "_lastObjectUpdateCheck = time;" \n + "_timeHackCheck = time;" \n + "_lastZombieCheck = time;" \n + "_deadBodies = [];" \n + "_maxBodies = 15;" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class update_objects + { + name = "update_objects"; + init = /*%FSM*/"if ((count needUpdate_objects) > 0) then {" \n + "" \n + " diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n + "" \n + " {" \n + " //_x setVariable [""needUpdate"",false,true];" \n + " needUpdate_objects = needUpdate_objects - [_x];" \n + " [_x,""all""] call server_updateObject; //should be call!!!" \n + " } forEach needUpdate_objects;" \n + "};" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="general_cleanup"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class check_for_hacker + { + name = "check_for_hacker"; + init = /*%FSM*/"//Check for hackers" \n + " {" \n + " if(vehicle _x != _x) then {" \n + " if (!(vehicle _x in _safety) && ((typeOf vehicle _x) != ""ParachuteWest"")) then {" \n + " diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n + " (vehicle _x) setDamage 1;" \n + " _x setDamage 1;" \n + " };" \n + " };" \n + " } forEach allUnits;" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class zeds_2 + { + name = "zeds_2"; + init = /*%FSM*/"_tmr = time;" \n + "{" \n + " _x enableSimulation false;" \n + "} forEach entities ""zZombie_Base"";" \n + "diag_log format[""DISABLED SIMULATION FOR %1 ZOMBIES IN %2 SECONDS"", count entities ""zZombie_Base"", time - _tmr];" \n + ""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="init"; + finalStates[] = + { + }; +}; +/*%FSM*/ \ No newline at end of file