From c7312b9e05cef6d8ea7a8c8cc3b012b7b45fbc93 Mon Sep 17 00:00:00 2001 From: Zepheris Date: Sat, 3 Mar 2018 13:30:59 -0700 Subject: [PATCH] added presistent tree logging --- @ExileServer/extDB/sql_custom_v2/exile.ini | 27 +- mpmissions/Exile.Altis.pbo | Bin 2787729 -> 2787729 bytes mpmissions/Exile.Altis/CfgExileCustomCode.cpp | 8 +- ...er_object_tree_network_chopTreeRequest.sqf | 259 ++++++++++++++++++ 4 files changed, 290 insertions(+), 4 deletions(-) create mode 100644 mpmissions/Exile.Altis/custom/persistantTree/ExileServer_object_tree_network_chopTreeRequest.sqf diff --git a/@ExileServer/extDB/sql_custom_v2/exile.ini b/@ExileServer/extDB/sql_custom_v2/exile.ini index 732f532..2ead5bc 100644 --- a/@ExileServer/extDB/sql_custom_v2/exile.ini +++ b/@ExileServer/extDB/sql_custom_v2/exile.ini @@ -754,4 +754,29 @@ SQL1_INPUTS = 1,2 [setWeather] SQL1_1= UPDATE ptws SET weather = ? WHERE DateID = ? Number of Inputs = 2 -SQL1_INPUTS = 1,2 \ No newline at end of file +SQL1_INPUTS = 1,2 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Tree dammnit +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +[loadTreeIdPage] +SQL1_1 = SELECT id FROM tree LIMIT ?,? +Number Of Inputs = 2 +SQL1_INPUTS = 1,2 +OUTPUT = 1 + +[loadTree] +SQL1_1 = SELECT position_x, position_y, position_z FROM tree WHERE id = ? +Number Of Inputs = 1 +SQL1_INPUTS = 1 +OUTPUT = 1,2,3 + +[insertTree] +SQL1_1 = INSERT INTO tree SET position_x = ?, position_y = ?, position_z = ? +Number of Inputs = 3 +SQL1_INPUTS = 1,2,3 + +[ResetTree] +SQL1_1= UPDATE tree SET regrow = '0' WHERE id = ? +Number of Inputs = 1 +SQL1_INPUTS = 1 \ No newline at end of file diff --git a/mpmissions/Exile.Altis.pbo b/mpmissions/Exile.Altis.pbo index dde84ccf3871ae59882c003e630fdf9108d5fec1..bfad2c6b1932a9efe734bce46db02ff25a2745da 100644 GIT binary patch delta 221 zcmWN=I}X8c0Knn&;Zd|+^?uc}xPn8lbdWR=<3Hw}z+lw~hp$%=lFz-6=f}&&aD(gWt_7YuQ?{Pic|xL0g(_o=Gr=S^rkG}iIt^x-W1a;TX|lvJ xE3C4{IvZ@V#Wp*%*kzA>4mjk9HpiUYJTXmLX81WR)b-c?J>IVu~^^Qy2`jO8)6!YGRi#Ni;@r05<911TJB90ypsc zk}tkIq?l(R-?V3F2FYSGSCS}r8~aEcBOy_y!W31esZpoF471EJPm>l4v{__{4$G{t x${Oozu*nwNblIWDE_>{Az#&KUIp*XQiK*^6;qGgnX3Ldo+%5Nd_ 30) then + { + throw "No long distance tree chopping! Nope!"; + }; + _treeHeight = _tree call ExileClient_util_model_getHeight; + _treeHeight = _treeHeight max 1; + _newDamage = ((damage _tree) + (1 / (floor _treeHeight) )) min 1; + _tree setDamage _newDamage; + if (_newDamage isEqualTo 1) then + { + _tree setDamage 999; + }; + +/////////////////////////////////// +//////Chop Trees Into Vehicles///// +/////////////////////////////////// + _nearestTruck = (getPosATL _tree) nearEntities[[ + + "Exile_Car_BRDM2_HQ", + + "Exile_Car_BTR40_MG_Green","Exile_Car_BTR40_MG_Camo","Exile_Car_BTR40_Green","Exile_Car_BTR40_Camo", + + "Exile_Car_Golf_Red","Exile_Car_Golf_Black", + + "Exile_Car_Hatchback_Beige","Exile_Car_Hatchback_Green","Exile_Car_Hatchback_Blue","Exile_Car_Hatchback_BlueCustom", + "Exile_Car_Hatchback_BeigeCustom","Exile_Car_Hatchback_Yellow","Exile_Car_Hatchback_Grey","Exile_Car_Hatchback_Black", + "Exile_Car_Hatchback_Dark","Exile_Car_Hatchback_Rusty1","Exile_Car_Hatchback_Rusty2","Exile_Car_Hatchback_Rusty3", + + "Exile_Car_Hatchback_Sport_Red","Exile_Car_Hatchback_Sport_Blue","Exile_Car_Hatchback_Sport_Orange","Exile_Car_Hatchback_Sport_White", + "Exile_Car_Hatchback_Sport_Beige","Exile_Car_Hatchback_Sport_Green","Exile_Car_Hatchback_Sport_Admin", + + "Exile_Car_HEMMT","HMMWV_M134","Exile_Car_HMMWV_M134_Green","Exile_Car_HMMWV_M134_Desert","HMMWV_M2","Exile_Car_HMMWV_M2_Green", + "Exile_Car_HMMWV_M2_Desert","HMMWV_MEV","Exile_Car_HMMWV_MEV_Green","Exile_Car_HMMWV_MEV_Desert","HMMWV_UNA", + "Exile_Car_HMMWV_UNA_Green","Exile_Car_HMMWV_UNA_Desert", + + "Exile_Car_Hunter", + "Exile_Car_Ifrit", + + "Exile_Car_Ikarus_Blue","Exile_Car_Ikarus_Red","Exile_Car_Ikarus_Party", + + "Exile_Car_Lada_Green","Exile_Car_Lada_Taxi","Exile_Car_Lada_Red","Exile_Car_Lada_White","Exile_Car_Lada_Hipster", + + "Exile_Car_LandRover_Red","Exile_Car_LandRover_Urban","Exile_Car_LandRover_Green","Exile_Car_LandRover_Sand","Exile_Car_LandRover_Desert", + "Exile_Car_LandRover_Ambulance_Green","Exile_Car_LandRover_Ambulance_Desert","Exile_Car_LandRover_Ambulance_Sand", + + "Exile_Car_Octavius_White","Exile_Car_Octavius_Black", + + "Exile_Car_Offroad_Red","Exile_Car_Offroad_Beige","Exile_Car_Offroad_White","Exile_Car_Offroad_Blue","Exile_Car_Offroad_DarkRed", + "Exile_Car_Offroad_BlueCustom","Exile_Car_Offroad_Guerilla01","Exile_Car_Offroad_Guerilla02","Exile_Car_Offroad_Guerilla03", + "Exile_Car_Offroad_Guerilla04","Exile_Car_Offroad_Guerilla05","Exile_Car_Offroad_Guerilla06","Exile_Car_Offroad_Guerilla07", + "Exile_Car_Offroad_Guerilla08","Exile_Car_Offroad_Guerilla09","Exile_Car_Offroad_Guerilla10","Exile_Car_Offroad_Guerilla11", + "Exile_Car_Offroad_Guerilla12","Exile_Car_Offroad_Rusty1","Exile_Car_Offroad_Rusty2","Exile_Car_Offroad_Rusty3", + + "Exile_Car_Offroad_Armed_Guerilla01","Exile_Car_Offroad_Armed_Guerilla02","Exile_Car_Offroad_Armed_Guerilla03","Exile_Car_Offroad_Armed_Guerilla04", + "Exile_Car_Offroad_Armed_Guerilla05","Exile_Car_Offroad_Armed_Guerilla06","Exile_Car_Offroad_Armed_Guerilla07","Exile_Car_Offroad_Armed_Guerilla08", + "Exile_Car_Offroad_Armed_Guerilla09","Exile_Car_Offroad_Armed_Guerilla10","Exile_Car_Offroad_Armed_Guerilla11","Exile_Car_Offroad_Armed_Guerilla12", + + "Exile_Car_Offroad_Repair_Civillian","Exile_Car_Offroad_Repair_Red","Exile_Car_Offroad_Repair_Beige","Exile_Car_Offroad_Repair_White", + "Exile_Car_Offroad_Repair_Blue","Exile_Car_Offroad_Repair_DarkRed","Exile_Car_Offroad_Repair_BlueCustom","Exile_Car_Offroad_Repair_Guerilla01", + "Exile_Car_Offroad_Repair_Guerilla02","Exile_Car_Offroad_Repair_Guerilla03","Exile_Car_Offroad_Repair_Guerilla04","Exile_Car_Offroad_Repair_Guerilla05", + "Exile_Car_Offroad_Repair_Guerilla06","Exile_Car_Offroad_Repair_Guerilla07","Exile_Car_Offroad_Repair_Guerilla08","Exile_Car_Offroad_Repair_Guerilla09", + "Exile_Car_Offroad_Repair_Guerilla10","Exile_Car_Offroad_Repair_Guerilla11","Exile_Car_Offroad_Repair_Guerilla12", + + "Exile_Car_OldTractor_Red", + "Exile_Car_Strider", + + "Exile_Car_SUV_Red","Exile_Car_SUV_Black","Exile_Car_SUV_Grey","Exile_Car_SUV_Orange","Exile_Car_SUV_Rusty1","Exile_Car_SUV_Rusty2", + "Exile_Car_SUV_Rusty3","SUV_Base", + + "Exile_Car_SUVXL_Black","Exile_Car_SUV_Armed_Black", + + "Exile_Car_Tempest", + + "Exile_Car_TowTractor_White", + + "Exile_Car_Tractor_Red", + "Exile_Car_UAZ_Green","Exile_Car_UAZ_Open_Green", + + "Exile_Car_Ural_Covered_Blue","Exile_Car_Ural_Covered_Yellow","Exile_Car_Ural_Covered_Worker","Exile_Car_Ural_Covered_Military","Exile_Car_Ural_Open_Blue", + "Exile_Car_Ural_Open_Yellow","Exile_Car_Ural_Open_Worker","Exile_Car_Ural_Open_Military", + + "Exile_Car_V3S_Covered","Exile_Car_V3S_Open", + + "Exile_Car_Van_Black","Exile_Car_Van_White","Exile_Car_Van_Red","Exile_Car_Van_Guerilla01","Exile_Car_Van_Guerilla02", + "Exile_Car_Van_Guerilla03","Exile_Car_Van_Guerilla04","Exile_Car_Van_Guerilla05","Exile_Car_Van_Guerilla06","Exile_Car_Van_Guerilla07", + "Exile_Car_Van_Guerilla08", + + "Exile_Car_Van_Box_Black","Exile_Car_Van_Box_White","Exile_Car_Van_Box_Red","Exile_Car_Van_Box_Guerilla01","Exile_Car_Van_Box_Guerilla02", + "Exile_Car_Van_Box_Guerilla03","Exile_Car_Van_Box_Guerilla04","Exile_Car_Van_Box_Guerilla05","Exile_Car_Van_Box_Guerilla06","Exile_Car_Van_Box_Guerilla07", + "Exile_Car_Van_Box_Guerilla08", + + "Exile_Car_Van_Fuel_Black","Exile_Car_Van_Fuel_White","Exile_Car_Van_Fuel_Red","Exile_Car_Van_Fuel_Guerilla01","Exile_Car_Van_Fuel_Guerilla02","Exile_Car_Van_Fuel_Guerilla03", + + "Exile_Car_Volha_Blue","Exile_Car_Volha_White","Exile_Car_Volha_Black", + + "Exile_Car_Zamak", + + "Exile_Bike_QuadBike_Black","Exile_Bike_QuadBike_Blue","Exile_Bike_QuadBike_Red","Exile_Bike_QuadBike_White","Exile_Bike_QuadBike_Nato","Exile_Bike_QuadBike_Csat","Exile_Bike_QuadBike_Fia", + "Exile_Bike_QuadBike_Guerilla01","Exile_Bike_QuadBike_Guerilla02", + + "Exile_Chopper_Hellcat_Green","Exile_Chopper_Hellcat_FIA", + + "Exile_Chopper_Huey_Green","Exile_Chopper_Huey_Desert","Exile_Chopper_Huey_Armed_Green","Exile_Chopper_Huey_Armed_Desert", + + "Exile_Chopper_Hummingbird_Green","Exile_Chopper_Hummingbird_Civillian_Blue","Exile_Chopper_Hummingbird_Civillian_Red","Exile_Chopper_Hummingbird_Civillian_ION", + "Exile_Chopper_Hummingbird_Civillian_BlueLine","Exile_Chopper_Hummingbird_Civillian_Digital","Exile_Chopper_Hummingbird_Civillian_Elliptical", + "Exile_Chopper_Hummingbird_Civillian_Furious","Exile_Chopper_Hummingbird_Civillian_GrayWatcher","Exile_Chopper_Hummingbird_Civillian_Jeans", + "Exile_Chopper_Hummingbird_Civillian_Light","Exile_Chopper_Hummingbird_Civillian_Shadow","Exile_Chopper_Hummingbird_Civillian_Sheriff", + "Exile_Chopper_Hummingbird_Civillian_Speedy","Exile_Chopper_Hummingbird_Civillian_Sunset","Exile_Chopper_Hummingbird_Civillian_Vrana", + "Exile_Chopper_Hummingbird_Civillian_Wasp","Exile_Chopper_Hummingbird_Civillian_Wave", + + "Exile_Chopper_Huron_Black","Exile_Chopper_Huron_Green", + + "Exile_Chopper_Mohawk_FIA", + + "Exile_Chopper_Orca_CSAT","Exile_Chopper_Orca_Black","Exile_Chopper_Orca_BlackCustom", + + "Exile_Chopper_Taru_CSAT","Exile_Chopper_Taru_Black","Exile_Chopper_Taru_Covered_CSAT","Exile_Chopper_Taru_Covered_Black","Exile_Chopper_Taru_Transport_CSAT","Exile_Chopper_Taru_Transport_Black", + + "Exile_Plane_Ceasar","Exile_Plane_BlackfishInfantry","Exile_Plane_BlackfishVehicle", + "Exile_Car_ProwlerLight","Exile_Car_ProwlerUnarmed", + "Exile_Car_QilinUnarmed", + "Exile_Car_MB4WD", + "Exile_Car_MB4WDOpen", + + "C_Offroad_02_unarmed_F", + "B_T_LSV_01_armed_F", "B_T_LSV_01_unarmed_F", "O_T_LSV_02_armed_F","O_T_LSV_02_unarmed_F","B_T_UAV_03_F","C_Plane_Civil_01_F","O_T_UAV_04_CAS_F","B_T_VTOL_01_armed_F", + "B_T_VTOL_01_infantry_F","B_T_VTOL_01_vehicle_F","O_T_VTOL_02_infantry_F","O_T_VTOL_02_vehicle_F","I_C_Boat_Transport_02_F","C_Scoooter_Transport_01_F" + + ], 50]; + + _weaponHolder = objNull; + if ((count _nearestTruck > 0)) then + { + _truck = _nearestTruck select 0; + if (_truck canAdd "Exile_Item_WoodLog") then + { + _truck addMagazineCargoGlobal ["Exile_Item_WoodLog", 1]; + [_sessionID, "toastRequest", ["SuccessTitleOnly", [_woodVehicleText]]] call ExileServer_system_network_send_to; + } + else + { + _treePosition = getPosATL _tree; + _treePosition set[2, 0]; + _spawnRadius = 3; + _weaponHolders = nearestObjects[_treePosition, ["GroundWeaponHolder"], _spawnRadius]; + _weaponHolder = objNull; + + // Persistent Tree Logging Edits + _health = getDammage _tree; + _data = [_treePosition select 0, _treePosition select 1, _treePosition select 2]; + if (_health isEqualTo 1) then + { + _extDB2Message = ["insertTree", _data] call ExileServer_util_extDB2_createMessage; + _extDB2Message call ExileServer_system_database_query_fireAndForget; + }; + // Persistent Tree Logging Edits + + if (_weaponHolders isEqualTo []) then + { + _weaponHolderPosition = [_treePosition, _spawnRadius] call ExileClient_util_math_getRandomPositionInCircle; + _weaponHolderPosition set [2, 0]; + _weaponHolder = createVehicle ["GroundWeaponHolder", _weaponHolderPosition, [], 0, "CAN_COLLIDE"]; + _weaponHolder setPosATL _weaponHolderPosition; + } + else + { + _weaponHolder = _weaponHolders select 0; + }; + _weaponHolder addMagazineCargoGlobal ["Exile_Item_WoodLog", 1]; + [_sessionID, "toastRequest", ["SuccessTitleOnly", [_woodVehicleFullText]]] call ExileServer_system_network_send_to; + }; + } + else + { + _treePosition = getPosATL _tree; + _treePosition set[2, 0]; + _spawnRadius = 3; + _weaponHolders = nearestObjects[_treePosition, ["GroundWeaponHolder"], _spawnRadius]; + _weaponHolder = objNull; + + // Persistent Tree Logging Edits + _health = getDammage _tree; + _data = [_treePosition select 0, _treePosition select 1, _treePosition select 2]; + if (_health isEqualTo 1) then + { + _extDB2Message = ["insertTree", _data] call ExileServer_util_extDB2_createMessage; + _extDB2Message call ExileServer_system_database_query_fireAndForget; + }; + // Persistent Tree Logging Edits + + if (_weaponHolders isEqualTo []) then + { + _weaponHolderPosition = getPosATL _player; + _weaponHolder = createVehicle ["GroundWeaponHolder", _weaponHolderPosition, [], 0, "CAN_COLLIDE"]; + _weaponHolder setPosATL _weaponHolderPosition; + } + else + { + _weaponHolder = _weaponHolders select 0; + }; + _weaponHolder addMagazineCargoGlobal ["Exile_Item_WoodLog", 1]; + [_sessionID, "toastRequest", ["SuccessTitleOnly", [_woodText]]] call ExileServer_system_network_send_to; + }; +} +catch +{ + _exception call ExileServer_util_log; +}; +true \ No newline at end of file