From c26e1e996bdcd3bd5561b3acc50d9529b633d4bf Mon Sep 17 00:00:00 2001 From: john681611 Date: Fri, 19 Apr 2019 20:26:56 +0100 Subject: [PATCH] Replace R3C towing for advanced towing --- .../R3F_LOG/addons_config/A3_vanilla/Air.sqf | 7 - .../addons_config/A3_vanilla/Building.sqf | 6 - .../addons_config/A3_vanilla/LandVehicle.sqf | 11 - .../addons_config/A3_vanilla/Others.sqf | 6 - .../addons_config/A3_vanilla/ReammoBox_F.sqf | 6 - .../R3F_LOG/addons_config/A3_vanilla/Ship.sqf | 7 - .../addons_config/A3_vanilla/StaticWeapon.sqf | 6 - .../A3_vanilla/delta_A3_1.32_to_1.35.sqf | 7 - common/R3F_LOG/addons_config/All_in_Arma.sqf | 15 - .../R3F_LOG/addons_config/All_in_Arma/Air.sqf | 59 -- .../addons_config/All_in_Arma/Building.sqf | 171 ---- .../addons_config/All_in_Arma/LandVehicle.sqf | 122 --- .../addons_config/All_in_Arma/Others.sqf | 72 -- .../addons_config/All_in_Arma/ReammoBox.sqf | 69 -- .../addons_config/All_in_Arma/Ship.sqf | 41 - common/R3F_LOG/addons_config/R3F_addons.sqf | 31 - common/R3F_LOG/addons_config/TEMPLATE.sqf | 121 --- common/R3F_LOG/config.sqf | 139 ++- common/R3F_LOG/init.sqf | 78 +- common/Server/fn_advancedTowingInit.sqf | 872 ++++++++++++++++++ common/initServer.sqf | 1 + 21 files changed, 971 insertions(+), 876 deletions(-) delete mode 100644 common/R3F_LOG/addons_config/All_in_Arma.sqf delete mode 100644 common/R3F_LOG/addons_config/All_in_Arma/Air.sqf delete mode 100644 common/R3F_LOG/addons_config/All_in_Arma/Building.sqf delete mode 100644 common/R3F_LOG/addons_config/All_in_Arma/LandVehicle.sqf delete mode 100644 common/R3F_LOG/addons_config/All_in_Arma/Others.sqf delete mode 100644 common/R3F_LOG/addons_config/All_in_Arma/ReammoBox.sqf delete mode 100644 common/R3F_LOG/addons_config/All_in_Arma/Ship.sqf delete mode 100644 common/R3F_LOG/addons_config/R3F_addons.sqf delete mode 100644 common/R3F_LOG/addons_config/TEMPLATE.sqf create mode 100644 common/Server/fn_advancedTowingInit.sqf diff --git a/common/R3F_LOG/addons_config/A3_vanilla/Air.sqf b/common/R3F_LOG/addons_config/A3_vanilla/Air.sqf index 6894c61..b5998fd 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/Air.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/Air.sqf @@ -1,11 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - "plane" -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/A3_vanilla/Building.sqf b/common/R3F_LOG/addons_config/A3_vanilla/Building.sqf index 8f46cce..fddd63c 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/Building.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/Building.sqf @@ -1,10 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/A3_vanilla/LandVehicle.sqf b/common/R3F_LOG/addons_config/A3_vanilla/LandVehicle.sqf index 89fe20b..4d52ccc 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/LandVehicle.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/LandVehicle.sqf @@ -1,15 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ - "truck_01_base_f", - "truck_02_base_f", - "truck_03_base_f", - "b_apc_tracked_01_crv_f" -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - "car_f" -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/A3_vanilla/Others.sqf b/common/R3F_LOG/addons_config/A3_vanilla/Others.sqf index abc4fae..fce6b8e 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/Others.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/Others.sqf @@ -1,10 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/A3_vanilla/ReammoBox_F.sqf b/common/R3F_LOG/addons_config/A3_vanilla/ReammoBox_F.sqf index a57126c..aa6806e 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/ReammoBox_F.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/ReammoBox_F.sqf @@ -1,10 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/A3_vanilla/Ship.sqf b/common/R3F_LOG/addons_config/A3_vanilla/Ship.sqf index ceff65b..0c2ee8c 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/Ship.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/Ship.sqf @@ -1,11 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - "ship_f" -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/A3_vanilla/StaticWeapon.sqf b/common/R3F_LOG/addons_config/A3_vanilla/StaticWeapon.sqf index 34f56ee..68e72a7 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/StaticWeapon.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/StaticWeapon.sqf @@ -1,10 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/A3_vanilla/delta_A3_1.32_to_1.35.sqf b/common/R3F_LOG/addons_config/A3_vanilla/delta_A3_1.32_to_1.35.sqf index 5bae5fa..a5d583d 100644 --- a/common/R3F_LOG/addons_config/A3_vanilla/delta_A3_1.32_to_1.35.sqf +++ b/common/R3F_LOG/addons_config/A3_vanilla/delta_A3_1.32_to_1.35.sqf @@ -1,11 +1,4 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - "machine_base_f" -]; R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + [ diff --git a/common/R3F_LOG/addons_config/All_in_Arma.sqf b/common/R3F_LOG/addons_config/All_in_Arma.sqf deleted file mode 100644 index e11290e..0000000 --- a/common/R3F_LOG/addons_config/All_in_Arma.sqf +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Logistics configuration for All in Arma. - * The configuration is splitted in categories dispatched in the included files. - */ - -// Load the logistics config only if the addon is used -if (isClass (configfile >> "CfgPatches" >> "AiA_Core")) then -{ - #include "All_in_Arma\Air.sqf" - #include "All_in_Arma\LandVehicle.sqf" - #include "All_in_Arma\Ship.sqf" - #include "All_in_Arma\Building.sqf" - #include "All_in_Arma\ReammoBox.sqf" - #include "All_in_Arma\Others.sqf" -}; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/All_in_Arma/Air.sqf b/common/R3F_LOG/addons_config/All_in_Arma/Air.sqf deleted file mode 100644 index 3c92295..0000000 --- a/common/R3F_LOG/addons_config/All_in_Arma/Air.sqf +++ /dev/null @@ -1,59 +0,0 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; - -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; - -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ - "ah64_base_ep1", - "aw159_lynx_baf", - "baf_merlin_hc3_d", - "ch47_base_ep1", - "ka60_base_pmc", - "kamov_base", - "mi17_base", - "mi24_base", - "uh1_base", - "uh60_base" -]; - -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ -]; - -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ - ["ah1_base", 5], - ["ah64_base_ep1", 10], - ["ah6_base_ep1", 20], - ["aw159_lynx_baf", 40], - ["baf_merlin_hc3_d", 100], - ["ch47_base_ep1", 130], - ["ka60_base_pmc", 60], - ["kamov_base", 10], - ["mi17_base", 80], - ["mi24_base", 50], - ["uh1h_base", 40], - ["uh1_base", 40], - ["uh60_base", 60], - ["an2_base_ep1", 50], - ["c130j", 250], - ["dc3", 90], - ["mv22", 60] -]; - -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - ["ka137_mg_pmc", 45], - ["ka137_pmc", 45], - ["pchela1t", 45] -]; - -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ - "ka137_mg_pmc", - "ka137_pmc" -]; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/All_in_Arma/Building.sqf b/common/R3F_LOG/addons_config/All_in_Arma/Building.sqf deleted file mode 100644 index 2cc33df..0000000 --- a/common/R3F_LOG/addons_config/All_in_Arma/Building.sqf +++ /dev/null @@ -1,171 +0,0 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; - -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; - -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ -]; - -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ - "land_misc_cargo1a_ep1", - "land_misc_cargo1ao", - "land_misc_cargo1ao_ep1", - "land_misc_cargo1b", - "land_misc_cargo1b_ep1", - "land_misc_cargo1bo", - "land_misc_cargo1c", - "land_misc_cargo1c_ep1", - "land_misc_cargo1d", - "land_misc_cargo1d_ep1", - "land_misc_cargo1e", - "land_misc_cargo1e_ep1", - "land_misc_cargo1f", - "land_misc_cargo1g", - "land_misc_cargomarket1a_ep1", - "base_warfarebcontructionsite", - "misc_cargo_cont_net1", - "misc_cargo_cont_small", - "misc_cargo_cont_small2" -]; - -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ - ["land_misc_cargo1ao", 110], - ["land_misc_cargo1a_ep1", 110], - ["land_misc_cargo1ao_ep1", 110], - ["land_misc_cargo1b", 110], - ["land_misc_cargo1b_ep1", 110], - ["land_misc_cargo1bo", 110], - ["land_misc_cargo1c", 110], - ["land_misc_cargo1c_ep1", 110], - ["land_misc_cargo1d", 110], - ["land_misc_cargo1d_ep1", 110], - ["land_misc_cargo1e", 110], - ["land_misc_cargo1e_ep1", 110], - ["land_misc_cargo1f", 110], - ["land_misc_cargo1g", 110], - ["land_misc_cargomarket1a_ep1", 110], - ["base_warfarebcontructionsite", 110], - ["fortress2", 20], - ["warfarebcamp", 30], - ["misc_cargo_cont_small", 65], - ["misc_cargo_cont_small2", 50] -]; - -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - ["concrete_wall_ep1", 3], - ["fencewood", 1], - ["fencewoodpalet", 1], - ["wire", 2], - ["fire", 1], - ["flagcarriersmall", 1], - ["fort_razorwire", 2], - ["gunrack1", 2], - ["base_warfarebbarrier5x", 3], - ["base_warfarebbarrier10x", 6], - ["base_warfarebbarrier10xtall", 12], - ["base_warfarebbarrier5xpreview", 2], - ["land_camonet_east", 2], - ["land_camonet_nato", 2], - ["land_fire", 1], - ["land_fire_barrel", 3], - ["land_fort_watchtower", 20], - ["land_guardshed", 3], - ["land_misc_cargo1ao", 120], - ["land_misc_cargo1a_ep1", 120], - ["land_misc_cargo1ao_ep1", 120], - ["land_misc_cargo1b", 120], - ["land_misc_cargo1b_ep1", 120], - ["land_misc_cargo1bo", 120], - ["land_misc_cargo1c", 120], - ["land_misc_cargo1c_ep1", 120], - ["land_misc_cargo1d", 120], - ["land_misc_cargo1d_ep1", 120], - ["land_misc_cargo1e", 120], - ["land_misc_cargo1e_ep1", 120], - ["land_misc_cargo1f", 120], - ["land_misc_cargo1g", 120], - ["land_misc_cargomarket1a_ep1", 120], - ["land_woodenramp", 2], - ["land_fort_bagfence_corner", 3], - ["land_fort_bagfence_long", 2], - ["land_fort_bagfence_round", 4], - ["land_fort_rampart", 4], - ["land_fortified_nest_big", 20], - ["land_fortified_nest_small", 10], - ["land_cncblock", 2], - ["land_cncblock_d", 2], - ["land_cncblock_stripes", 2], - ["land_hbarrier_large", 4], - ["land_bagfencecorner", 2], - ["land_hbarrier1", 1], - ["land_hbarrier3", 2], - ["land_hbarrier5", 3], - ["land_toilet", 3], - ["paletabase", 2], - ["roadbarrier_light", 2], - ["targettraining", 2], - ["warfarebunkersign", 3], - ["zavoraanim", 2], - ["base_warfarebcontructionsite", 120], - ["fortress1", 10], - ["hedgehog", 3], - ["land_prebehlavka", 3], - ["land_prolejzacka", 2], - ["ammocrate_nointeractive_", 7], - ["misc_cargo_cont_net1", 25], - ["misc_cargo_cont_small", 75], - ["misc_cargo_cont_small2", 60], - ["shed", 2], - ["target", 2] -]; - -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ - "concrete_wall_ep1", - "fencewood", - "fencewoodpalet", - "wire", - "fire", - "flagcarriersmall", - "fort_razorwire", - "gunrack1", - "base_warfarebbarrier5x", - "land_camonet_east", - "land_camonet_nato", - "land_fire", - "land_fort_watchtower", - "land_guardshed", - "land_woodenramp", - "land_fort_bagfence_corner", - "land_fort_bagfence_long", - "land_fort_bagfence_round", - "land_fort_rampart", - "land_fortified_nest_big", - "land_fortified_nest_small", - "land_cncblock", - "land_cncblock_d", - "land_cncblock_stripes", - "land_hbarrier_large", - "land_bagfencecorner", - "land_toilet", - "paletabase", - "roadbarrier_light", - "targettraining", - "warfarebunkersign", - "zavoraanim", - "fortress1", - "hedgehog", - "land_prebehlavka", - "land_prolejzacka", - "ammocrate_nointeractive_", - "misc_cargo_cont_net1", - "shed", - "target" -]; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/All_in_Arma/LandVehicle.sqf b/common/R3F_LOG/addons_config/All_in_Arma/LandVehicle.sqf deleted file mode 100644 index 17f749c..0000000 --- a/common/R3F_LOG/addons_config/All_in_Arma/LandVehicle.sqf +++ /dev/null @@ -1,122 +0,0 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ - "towingtractor", - "tractorold", - "mtvr", - "t810_turrets_base_acr" -]; - -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - "d30_base", - "m119", - "zu23_base" -]; - -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ - "heli_light_02_base_f", - "heli_transport_01_base_f", - "heli_transport_02_base_f" -]; - -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ - "atv_base_ep1", - "armoredsuv_base_pmc", - "baf_jackal2_base_d", - "datsun_pk1", - "dingo_base_acr", - "hilux_pk1", - "hmmwv_base", - "ikarus", - "lada_base", - "landrover_base", - "octavia_acr", - "offroad_dshkm_base", - "pickup_pk_base", - "s1203_tk_civ_ep1", - "suv_base_ep1", - "skodabase", - "towingtractor", - "tractorold", - "kamaz_base", - "mtvr", - "t810_turrets_base_acr", - "truck_base_h", - "ural_base_withturret", - "v3s_base", - "uaz_base", - "volha_tk_civ_base_ep1", - "vwgolf", - "btr40_mg_base_ep1", - "btr90_base", - "gaz_vodnik_hmg", - "lav25_base", - "strykerbase_ep1", - "hilux1_civil_1_open", - "d30_base", - "m119", - "zu23_base", - "m113_base" -]; - -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ - ["atv_base_ep1", 3], - ["armoredsuv_base_pmc", 15], - ["baf_jackal2_base_d", 18], - ["datsun_pk1", 10], - ["dingo_base_acr", 25], - ["hilux_pk1", 10], - ["hmmwv_base", 18], - ["hmmwv_avenger", 5], - ["ikarus", 60], - ["landrover_base", 15], - ["offroad_dshkm_base", 10], - ["pickup_pk_base", 10], - ["s1203_tk_civ_ep1", 20], - ["suv_base_ep1", 12], - ["kamaz_base", 100], - ["mtvr", 80], - ["t810_turrets_base_acr", 80], - ["truck_base_h", 50], - ["ural_base_withturret", 10], - ["ural_base", 100], - ["v3s_base", 90], - ["uaz_base", 15], - ["brdm2_base", 15], - ["btr40_mg_base_ep1", 12], - ["btr90_base", 18], - ["gaz_vodnik_hmg", 18], - ["lav25_base", 18], - ["strykerbase_ep1", 18], - ["hilux1_civil_1_open", 12], - ["baf_fv510_d", 8], - ["m113_base", 10], - ["m2a2_ep1", 8], - ["aav", 8] -]; - -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - ["atv_base_ep1", 40], - ["mmt_base", 8], - ["m1030", 30], - ["tt650_base", 30], - ["stinger_pod", 15], - ["stinger_pod_us_ep1", 15], - ["tow_tripod", 10], - ["tow_tripod_base", 10], - ["m119", 50], - ["d30_base", 50], - ["zu23_base", 50], - ["warfarebmgnest_m240_base", 10], - ["uh1wreck", 200], - ["uh60_wreck_ep1", 200] -]; - -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ - "mmt_base" -]; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/All_in_Arma/Others.sqf b/common/R3F_LOG/addons_config/All_in_Arma/Others.sqf deleted file mode 100644 index 42660e0..0000000 --- a/common/R3F_LOG/addons_config/All_in_Arma/Others.sqf +++ /dev/null @@ -1,72 +0,0 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; - -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; - -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ -]; - -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ -]; - -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ -]; - -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - ["targetgrenadbase", 5], - ["wallmap", 2], - ["foldchair", 1], - ["woodchair", 1], - ["foldtable", 2], - ["land_barrel_empty", 2], - ["land_barrel_sand", 2], - ["land_barrel_water", 2], - ["land_conelight", 1], - ["barrel1", 2], - ["barrel2", 2], - ["barrel3", 2], - ["barrel4", 2], - ["barrel5", 2], - ["barrel6", 2], - ["wooden_barrel", 2], - ["fuel_can", 1], - ["notice_board", 2], - ["roadcone", 1], - ["sign_danger", 2], - ["smalltable", 2], - ["small_items", 1], - ["land_shelf_ep1", 2] -]; - -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ - "wallmap", - "foldchair", - "woodchair", - "foldtable", - "land_barrel_empty", - "land_barrel_sand", - "land_barrel_water", - "land_conelight", - "barrel1", - "barrel2", - "barrel3", - "barrel4", - "barrel5", - "barrel6", - "wooden_barrel", - "fuel_can", - "notice_board", - "roadcone", - "sign_danger", - "smalltable", - "small_items", - "land_shelf_ep1" -]; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/All_in_Arma/ReammoBox.sqf b/common/R3F_LOG/addons_config/All_in_Arma/ReammoBox.sqf deleted file mode 100644 index 3ba6cf1..0000000 --- a/common/R3F_LOG/addons_config/All_in_Arma/ReammoBox.sqf +++ /dev/null @@ -1,69 +0,0 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; - -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; - -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ -]; - -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ -]; - -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ -]; - -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - ["guerillacachebox", 5], - ["specialweaponsbox", 10], - ["rubasicammunitionbox", 5], - ["rubasicweaponsbox", 15], - ["ruspecialweaponsbox", 12], - ["ruvehiclebox", 50], - ["ammobox_pmc", 5], - ["baf_vehiclebox", 30], - ["czbasicweapons_ep1", 5], - ["gerbasicweapons_ep1", 5], - ["guerillacachebox_ep1", 5], - ["tkbasicammunitionbox_ep1", 5], - ["tkvehiclebox_ep1", 40], - ["tkbasicweapons_ep1", 5], - ["tklaunchers_ep1", 5], - ["tkspecialweapons_ep1", 5], - ["unbasicammunitionbox_ep1", 5], - ["unbasicweapons_ep1", 5], - ["usbasicammunitionbox_ep1", 5], - ["usvehiclebox_ep1", 30], - ["usbasicweapons_ep1", 5], - ["uslaunchers_ep1", 5], - ["usspecialweapons_ep1", 8], - ["usbasicammunitionbox", 5], - ["usvehiclebox", 20] -]; - -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ - "guerillacachebox", - "rubasicammunitionbox", - "ammobox_pmc", - "czbasicweapons_ep1", - "gerbasicweapons_ep1", - "guerillacachebox_ep1", - "tkbasicammunitionbox_ep1", - "tkbasicweapons_ep1", - "tklaunchers_ep1", - "tkspecialweapons_ep1", - "unbasicammunitionbox_ep1", - "unbasicweapons_ep1", - "usbasicammunitionbox_ep1", - "usbasicweapons_ep1", - "uslaunchers_ep1", - "usspecialweapons_ep1", - "usbasicammunitionbox" -]; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/All_in_Arma/Ship.sqf b/common/R3F_LOG/addons_config/All_in_Arma/Ship.sqf deleted file mode 100644 index d4a810a..0000000 --- a/common/R3F_LOG/addons_config/All_in_Arma/Ship.sqf +++ /dev/null @@ -1,41 +0,0 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; - -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - "boat", - "pbx_acr", - "seafox", - "smallboat_1" -]; - -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ - "heli_light_02_base_f", - "heli_transport_01_base_f", - "heli_transport_02_base_f" -]; - -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ - "boat", - "seafox", - "smallboat_1" -]; - -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ -]; - -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - ["rubberboat", 40], - ["pbx_acr", 40] -]; - -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ - "rubberboat", - "pbx_acr" -]; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/R3F_addons.sqf b/common/R3F_LOG/addons_config/R3F_addons.sqf deleted file mode 100644 index 01fc1e3..0000000 --- a/common/R3F_LOG/addons_config/R3F_addons.sqf +++ /dev/null @@ -1,31 +0,0 @@ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ -]; - -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ -]; - -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ -]; - -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ - "r3f_uniformbox", - "r3f_weaponstock" -]; - -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ -]; - -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - ["r3f_uniformbox", 5], - ["r3f_weaponstock", 5] -]; - -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ -]; \ No newline at end of file diff --git a/common/R3F_LOG/addons_config/TEMPLATE.sqf b/common/R3F_LOG/addons_config/TEMPLATE.sqf deleted file mode 100644 index fc9cd86..0000000 --- a/common/R3F_LOG/addons_config/TEMPLATE.sqf +++ /dev/null @@ -1,121 +0,0 @@ -/** - * English and French comments - * Commentaires anglais et français - * - * This file is a template to add objetcs from an addon in the configuration variables of the logistics system. - * Make a copy of this file and fill it. Then add a #include to this file in the file R3F_LOG\config.sqf. - * - * IMPORTANT NOTE : when a logistics feature is given to an object/vehicle class name, all the classes which inherit - * of the parent/generic class (according to the CfgVehicles) will also have this feature. - * CfgVehicles tree view example : http://madbull.arma.free.fr/A3_stable_1.20.124746_CfgVehicles_tree.html - * - * - * Ce fichier est un exemple vierge permettant d'ajouter des objets d'un addon dans la configuration du système de logistique. - * Faites une copie de ce fichier et remplissez-le. Puis ajouter un #include vers celui-ci dans le fichier R3F_LOG\config.sqf. - * - * NOTE IMPORTANTE : lorsqu'une fonctionnalité logistique est accordée à un nom de classe d'objet/véhicule, les classes - * héritant de cette classe mère/générique (selon le CfgVehicles) se verront également dotées de cette fonctionnalité. - * Exemple d'arborescence du CfgVehicles : http://madbull.arma.free.fr/A3_stable_1.20.124746_CfgVehicles_tree.html - */ - -/** - * List of class names of ground vehicles which can tow objects. - * Liste des noms de classes des véhicules terrestres pouvant remorquer des objets. - */ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ - // e.g. : "MyTowingVehicleClassName1", "MyTowingVehicleClassName2" -]; - -/** - * List of class names of objects which can be towed. - * Liste des noms de classes des objets remorquables. - */ -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - // e.g. : "MyTowableObjectClassName1", "MyTowableObjectClassName2" -]; - - -/****** LIFT WITH VEHICLE / HELIPORTER AVEC VEHICULE ******/ - -/** - * List of class names of helicopters which can lift objects. - * Liste des noms de classes des hélicoptères pouvant héliporter des objets. - */ -R3F_LOG_CFG_can_lift = R3F_LOG_CFG_can_lift + -[ - // e.g. : "MyLifterVehicleClassName1", "MyLifterVehicleClassName2" -]; - -/** - * List of class names of objects which can be lifted. - * Liste des noms de classes des objets héliportables. - */ -R3F_LOG_CFG_can_be_lifted = R3F_LOG_CFG_can_be_lifted + -[ - // e.g. : "MyLiftableObjectClassName1", "MyLiftableObjectClassName2" -]; - - -/****** LOAD IN VEHICLE / CHARGER DANS LE VEHICULE ******/ - -/* - * This section uses a numeric quantification of capacity and cost of the objets. - * For example, in a vehicle has a capacity of 100, we will be able to load in 5 objects costing 20 capacity units. - * The capacity doesn't represent a real volume or weight, but a choice made for gameplay. - * - * Note : the priority of a declaration of cost/capacity to another one corresponds to the inverse order in the tables. - * It means that the most generic classes should be listed before the less generic classes. - * For example : the "Truck_F" class is a child of the "Car_F" class (see http://madbull.arma.free.fr/A3_stable_1.20.124746_CfgVehicles_tree.html). - * If "Car_F" is declared before "Truck_F" with a capacity of 40, and "Truck_F" is declared after with a capacity of 140, - * Then all the child classes of "Truck_F" will have a capacity of 140. - * And all the derived classes of "Car_F", not in "Truck_F", will have a capacity of 40. - * - * - * Cette section utilise une quantification numérique de la capacité et du coût des objets. - * Par exemple, dans un véhicule d'une capacité de 100, nous pouvons charger 5 objets coûtant 20 unités de capacité. - * La capacité ne représente ni un poids, ni un volume, mais un choix fait pour la jouabilité. - * - * Note : la priorité d'une déclaration de coût/capacité sur une autre correspond à l'ordre inverse dans les tableaux. - * Cela implique que les classes les plus génériques doivent être listées avant les classes moins gnériques. - * Par exemple : la classe "Truck_F" est une classe dérviée de "Car_F" (voir http://madbull.arma.free.fr/A3_stable_1.20.124746_CfgVehicles_tree.html). - * Si "Car_F" est déclaré avant "Truck_F" avec une capacité de 40, et que "Truck_F" est déclaré après avec une capacité de 140, - * Alors toutes les classes dérivées de "Truck_F" auront une capacité de 140. - * Et toutes les classes dans "Car_F", non présentes dans "Truck_F", auront une capacité de 40. - */ - -/** - * List of class names of vehicles or cargo objects which can transport objects. - * The second element of the nested arrays is the load capacity (in relation with the capacity cost of the objects). - * - * Liste des noms de classes des véhicules ou "objets contenant" pouvant transporter des objets. - * Le deuxième élément des sous-tableaux est la capacité de chargement (en relation avec le coût de capacité des objets). - */ -R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + -[ - // e.g. : ["MyTransporterClassName1", itsCapacity], ["MyTransporterClassName2", itsCapacity] -]; - -/** - * List of class names of objects which can be loaded in transport vehicle/cargo. - * The second element of the nested arrays is the cost capacity (in relation with the capacity of the vehicles). - * - * Liste des noms de classes des objets transportables. - * Le deuxième élément des sous-tableaux est le coût de capacité (en relation avec la capacité des véhicules). - */ -R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + -[ - // e.g. : ["MyTransportableObjectClassName1", itsCost], ["MyTransportableObjectClassName2", itsCost] -]; - -/****** MOVABLE-BY-PLAYER OBJECTS / OBJETS DEPLACABLES PAR LE JOUEUR ******/ - -/** - * List of class names of objects which can be carried and moved by a player. - * Liste des noms de classes des objets qui peuvent être portés et déplacés par le joueur. - */ -R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + -[ - // e.g. : "MyMovableObjectClassName1", "MyMovableObjectClassName2" -]; \ No newline at end of file diff --git a/common/R3F_LOG/config.sqf b/common/R3F_LOG/config.sqf index 979d42f..d89b51d 100644 --- a/common/R3F_LOG/config.sqf +++ b/common/R3F_LOG/config.sqf @@ -2,7 +2,7 @@ * MAIN CONFIGURATION FILE * * English and French comments - * Commentaires anglais et français + * Commentaires anglais et fran�ais * * (EN) * This file contains the configuration variables of the logistics system. @@ -12,10 +12,10 @@ * CfgVehicles tree view example : http://madbull.arma.free.fr/A3_stable_1.20.124746_CfgVehicles_tree.html * * (FR) - * Fichier contenant les variables de configuration du système de logistique. - * Pour la configuration de l'usine de création, voir le fichier "config_creation_factory.sqf". - * NOTE IMPORTANTE : lorsqu'une fonctionnalité logistique est accordée à un nom de classe d'objet/véhicule, les classes - * héritant de cette classe mère/générique (selon le CfgVehicles) se verront également dotées de cette fonctionnalité. + * Fichier contenant les variables de configuration du syst�me de logistique. + * Pour la configuration de l'usine de cr�ation, voir le fichier "config_creation_factory.sqf". + * NOTE IMPORTANTE : lorsqu'une fonctionnalit� logistique est accord�e � un nom de classe d'objet/v�hicule, les classes + * h�ritant de cette classe m�re/g�n�rique (selon le CfgVehicles) se verront �galement dot�es de cette fonctionnalit�. * Exemple d'arborescence du CfgVehicles : http://madbull.arma.free.fr/A3_stable_1.20.124746_CfgVehicles_tree.html */ @@ -33,12 +33,12 @@ * * * (FR) - * Défini si les objets et véhicules disposent des fonctionnalités logistiques par défaut, - * ou si elles doivent être autorisés explicitement sur des objets/véhicules spécifiques. + * D�fini si les objets et v�hicules disposent des fonctionnalit�s logistiques par d�faut, + * ou si elles doivent �tre autoris�s explicitement sur des objets/v�hicules sp�cifiques. * - * Si false : tous les objets sont actifs en accord avec les noms de classes listés dans ce fichier - * Vous pouvez désactiver certains objets avec : objet setVariable ["R3F_LOG_disabled", true]; - * Si true : tous les objets sont inactifs par défaut + * Si false : tous les objets sont actifs en accord avec les noms de classes list�s dans ce fichier + * Vous pouvez d�sactiver certains objets avec : objet setVariable ["R3F_LOG_disabled", true]; + * Si true : tous les objets sont inactifs par d�faut * Vous pouvez activer quelques objets avec : objet setVariable ["R3F_LOG_disabled", false]; */ R3F_LOG_CFG_disabled_by_default = false; @@ -63,18 +63,18 @@ R3F_LOG_CFG_disabled_by_default = false; * See also the config variable R3F_LOG_CFG_unlock_objects_timer. * * (FR) - * Défini le mode de verrouillage des fonctionnalités logistics pour un objet donné. - * Un objet peut être verrouillé pour une side, une faction, un joueur (respawn) ou une unité (vie). - * Si l'objet est verrouillé, le joueur peut le déverrouiller en fonction de la + * D�fini le mode de verrouillage des fonctionnalit�s logistics pour un objet donn�. + * Un objet peut �tre verrouill� pour une side, une faction, un joueur (respawn) ou une unit� (vie). + * Si l'objet est verrouill�, le joueur peut le d�verrouiller en fonction de la * valeur de la variable de configiration R3F_LOG_CFG_unlock_objects_timer. * - * Si "none" : pas de verrouillage, tout le monde peut utiliser les fonctionnalités logistiques. - * Si "side" : l'objet est verrouillé pour la dernière side ayant interagit avec lui. - * Si "faction" : l'objet est verrouillé pour la dernière faction ayant interagit avec lui. - * Si "player" : l'objet est verrouillé pour le dernier joueur ayant interagit avec lui. Le verrou est transmis après respawn. - * Si "unit" : l'objet est verrouillé pour le dernier joueur ayant interagit avec lui. Le verrou est perdu quand l'unité meurt. + * Si "none" : pas de verrouillage, tout le monde peut utiliser les fonctionnalit�s logistiques. + * Si "side" : l'objet est verrouill� pour la derni�re side ayant interagit avec lui. + * Si "faction" : l'objet est verrouill� pour la derni�re faction ayant interagit avec lui. + * Si "player" : l'objet est verrouill� pour le dernier joueur ayant interagit avec lui. Le verrou est transmis apr�s respawn. + * Si "unit" : l'objet est verrouill� pour le dernier joueur ayant interagit avec lui. Le verrou est perdu quand l'unit� meurt. * - * Note : pour les objets militaires (non civils), le verrou est initialisé à la side de l'objet. + * Note : pour les objets militaires (non civils), le verrou est initialis� � la side de l'objet. * * Voir aussi la variable de configiration R3F_LOG_CFG_unlock_objects_timer. */ @@ -87,8 +87,8 @@ R3F_LOG_CFG_lock_objects_mode = "none"; * Set to -1 to deny the unlock of objects. * See also the config variable R3F_LOG_CFG_lock_objects_mode. * - * Défini la durée (en secondes) du compte-à-rebours pour déverrouiller un objet. - * Mettre à -1 pour qu'on ne puisse pas déverrouiller les objets. + * D�fini la dur�e (en secondes) du compte-�-rebours pour d�verrouiller un objet. + * Mettre � -1 pour qu'on ne puisse pas d�verrouiller les objets. * Voir aussi la variable de configiration R3F_LOG_CFG_lock_objects_mode. */ R3F_LOG_CFG_unlock_objects_timer = 0; @@ -99,8 +99,8 @@ R3F_LOG_CFG_unlock_objects_timer = 0; * Define if movable objects with no gravity simulation can be set in height over the ground (no ground contact). * The no gravity objects corresponds to most of decoration and constructions items. * - * Défini si les objets déplaçable sans simulation de gravité peuvent être position en hauteur sans être contact avec le sol. - * Les objets sans gravité correspondent à la plupart des objets de décors et de construction. + * D�fini si les objets d�pla�able sans simulation de gravit� peuvent �tre position en hauteur sans �tre contact avec le sol. + * Les objets sans gravit� correspondent � la plupart des objets de d�cors et de construction. */ R3F_LOG_CFG_no_gravity_objects_can_be_set_in_height_over_ground = false; @@ -110,8 +110,8 @@ R3F_LOG_CFG_no_gravity_objects_can_be_set_in_height_over_ground = false; * Automatic language selection according to the game language. * New languages can be easily added (read below). * - * Sélection automatique de la langue en fonction de la langue du jeu. - * De nouveaux langages peuvent facilement être ajoutés (voir ci-dessous). + * S�lection automatique de la langue en fonction de la langue du jeu. + * De nouveaux langages peuvent facilement �tre ajout�s (voir ci-dessous). */ R3F_LOG_CFG_language = switch (language) do { @@ -148,17 +148,17 @@ R3F_LOG_CFG_language = switch (language) do * To allow the logistics to everyone, just set the condition to "true". * * (FR) - * Cette variable permet d'utiliser une condition SQF dynamique pour autoriser ou non les fonctions logistiques sur des clients spécifiques. - * La variable doit être une CHAINE de caractères délimitée par des guillemets et doit contenir une condition SQF valide qui sera évaluée durant la mission. - * Par exemple pour autoriser la logistique sur seulement quelques joueurs ayant un ID de jeu connu, la variable peut être défini comme suit : + * Cette variable permet d'utiliser une condition SQF dynamique pour autoriser ou non les fonctions logistiques sur des clients sp�cifiques. + * La variable doit �tre une CHAINE de caract�res d�limit�e par des guillemets et doit contenir une condition SQF valide qui sera �valu�e durant la mission. + * Par exemple pour autoriser la logistique sur seulement quelques joueurs ayant un ID de jeu connu, la variable peut �tre d�fini comme suit : * "getPlayerUID player in [""76xxxxxxxxxxxxxxx"", ""76yyyyyyyyyyyyyyy"", ""76zzzzzzzzzzzzzzz""]" * Ou elle peut se baser sur le nom de profil : "profileName in [""maxime"", ""martin"", ""marc""]" * Ou pour n'autoriser que l'admin de serveur : "serverCommandAvailable "#kick""" - * Les condition sont évaluées en temps réel, et peuvent donc dépendre du déroulement de la mission : "alive officier && taskState tache1 == ""Succeeded""" - * Ou pour interdire la logistique dans la zone défini par un marqueur circulaire : "player distance getMarkerPos ""markerName"" > getMarkerSize ""markerName"" select 0" - * Notez que les guillemets des chaînes de caractères dans la chaîne de condition doivent être doublés. - * Note : si la condition dépend de l'objet/véhicule pointé, vous pouvez utiliser la commande cursorTarget - * Pour autoriser la logistique chez tout le monde, il suffit de définir la condition à "true". + * Les condition sont �valu�es en temps r�el, et peuvent donc d�pendre du d�roulement de la mission : "alive officier && taskState tache1 == ""Succeeded""" + * Ou pour interdire la logistique dans la zone d�fini par un marqueur circulaire : "player distance getMarkerPos ""markerName"" > getMarkerSize ""markerName"" select 0" + * Notez que les guillemets des cha�nes de caract�res dans la cha�ne de condition doivent �tre doubl�s. + * Note : si la condition d�pend de l'objet/v�hicule point�, vous pouvez utiliser la commande cursorTarget + * Pour autoriser la logistique chez tout le monde, il suffit de d�finir la condition � "true". */ R3F_LOG_CFG_string_condition_allow_logistics_on_this_client = "true"; @@ -173,23 +173,23 @@ R3F_LOG_CFG_string_condition_allow_logistics_on_this_client = "true"; * Or based on the profile name : "profileName in [""john"", ""jack"", ""james""]" * Or only for the server admin : "serverCommandAvailable "#kick""" * Note that quotes of the strings inside the string condition must be doubled. - * Note : if the condition depends of the aimed objects/véhicule, you can use the command cursorTarget + * Note : if the condition depends of the aimed objects/v�hicule, you can use the command cursorTarget * Note also that the condition is evaluted in real time, so it can use condition depending on the mission progress : * "alive officer && taskState task1 == ""Succeeded""" * To allow the creation factory to everyone, just set the condition to "true". * * (FR) - * Cette variable permet d'utiliser une condition SQF dynamique pour rendre accessible ou non l'usine de création sur des clients spécifiques. - * La variable doit être une CHAINE de caractères délimitée par des guillemets et doit contenir une condition SQF valide qui sera évaluée durant la mission. - * Par exemple pour autoriser l'usine de création sur seulement quelques joueurs ayant un ID de jeu connu, la variable peut être défini comme suit : + * Cette variable permet d'utiliser une condition SQF dynamique pour rendre accessible ou non l'usine de cr�ation sur des clients sp�cifiques. + * La variable doit �tre une CHAINE de caract�res d�limit�e par des guillemets et doit contenir une condition SQF valide qui sera �valu�e durant la mission. + * Par exemple pour autoriser l'usine de cr�ation sur seulement quelques joueurs ayant un ID de jeu connu, la variable peut �tre d�fini comme suit : * "getPlayerUID player in [""76xxxxxxxxxxxxxxx"", ""76yyyyyyyyyyyyyyy"", ""76zzzzzzzzzzzzzzz""]" * Ou elle peut se baser sur le nom de profil : "profileName in [""maxime"", ""martin"", ""marc""]" * Ou pour n'autoriser que l'admin de serveur : "serverCommandAvailable "#kick""" - * Notez que les guillemets des chaînes de caractères dans la chaîne de condition doivent être doublés. - * Note : si la condition dépend de l'objet/véhicule pointé, vous pouvez utiliser la commande cursorTarget - * Notez aussi que les condition sont évaluées en temps réel, et peuvent donc dépendre du déroulement de la mission : + * Notez que les guillemets des cha�nes de caract�res dans la cha�ne de condition doivent �tre doubl�s. + * Note : si la condition d�pend de l'objet/v�hicule point�, vous pouvez utiliser la commande cursorTarget + * Notez aussi que les condition sont �valu�es en temps r�el, et peuvent donc d�pendre du d�roulement de la mission : * "alive officier && taskState tache1 == ""Succeeded""" - * Pour autoriser l'usine de création chez tout le monde, il suffit de définir la condition à "true". + * Pour autoriser l'usine de cr�ation chez tout le monde, il suffit de d�finir la condition � "true". */ R3F_LOG_CFG_string_condition_allow_creation_factory_on_this_client = "true"; @@ -210,49 +210,28 @@ R3F_LOG_CFG_string_condition_allow_creation_factory_on_this_client = "true"; * Inheritance tree view : http://madbull.arma.free.fr/A3_1.32_CfgVehicles_tree.html * * (FR) - * Deux moyens existent pour gérer de nouveaux objets avec le système logistique. Le premier consiste à ajouter - * ces objets dans les listes appropriées ci-dessous. Le deuxième est de créer un fichier externe dans le répertoire - * /addons_config/ basé sur /addons_config/TEMPLATE.sqf, et d'ajouter un #include ci-dessous. - * La première méthode est préférable lorsqu'il s'agit d'ajouter ou corriger quelques classes diverses. - * La deuxième méthode est préférable s'il s'agit de prendre en compte le contenu d'un addon supplémentaire. - * - * Ces variables sont basées sur le principe d'héritage utilisés dans l'arborescence du CfgVehicles. - * Cela signifie qu'une fonctionnalité accordée à une classe, le sera aussi pour toutes ses classes filles. - * Vue de l'arborescence d'héritage : http://madbull.arma.free.fr/A3_1.32_CfgVehicles_tree.html + * Deux moyens existent pour g�rer de nouveaux objets avec le syst�me logistique. Le premier consiste � ajouter + * ces objets dans les listes appropri�es ci-dessous. Le deuxi�me est de cr�er un fichier externe dans le r�pertoire + * /addons_config/ bas� sur /addons_config/TEMPLATE.sqf, et d'ajouter un #include ci-dessous. + * La premi�re m�thode est pr�f�rable lorsqu'il s'agit d'ajouter ou corriger quelques classes diverses. + * La deuxi�me m�thode est pr�f�rable s'il s'agit de prendre en compte le contenu d'un addon suppl�mentaire. + * + * Ces variables sont bas�es sur le principe d'h�ritage utilis�s dans l'arborescence du CfgVehicles. + * Cela signifie qu'une fonctionnalit� accord�e � une classe, le sera aussi pour toutes ses classes filles. + * Vue de l'arborescence d'h�ritage : http://madbull.arma.free.fr/A3_1.32_CfgVehicles_tree.html */ /****** LIST OF ADDONS CONFIG TO INCLUDE / LISTE DES CONFIG D'ADDONS A INCLURE ******/ #include "addons_config\A3_vanilla.sqf" -#include "addons_config\All_in_Arma.sqf" -#include "addons_config\R3F_addons.sqf" //#include "addons_config\YOUR_ADDITIONAL_ADDON.sqf" -/****** TOW WITH VEHICLE / REMORQUER AVEC VEHICULE ******/ - -/** - * List of class names of ground vehicles which can tow objects. - * Liste des noms de classes des véhicules terrestres pouvant remorquer des objets. - */ -R3F_LOG_CFG_can_tow = R3F_LOG_CFG_can_tow + -[ - "Tank","Ship","LandVehicle" -]; - -/** - * List of class names of objects which can be towed. - * Liste des noms de classes des objets remorquables. - */ -R3F_LOG_CFG_can_be_towed = R3F_LOG_CFG_can_be_towed + -[ - "LandVehicle","Plane","Helicopter","Tank","Ship" -]; /****** LIFT WITH VEHICLE / HELIPORTER AVEC VEHICULE ******/ /** * List of class names of helicopters which can lift objects. - * Liste des noms de classes des hélicoptères pouvant héliporter des objets. + * Liste des noms de classes des h�licopt�res pouvant h�liporter des objets. */ R3F_LOG_CFG_can_lift = [ @@ -261,7 +240,7 @@ R3F_LOG_CFG_can_lift = /** * List of class names of objects which can be lifted. - * Liste des noms de classes des objets héliportables. + * Liste des noms de classes des objets h�liportables. */ R3F_LOG_CFG_can_be_lifted = [ @@ -278,17 +257,17 @@ R3F_LOG_CFG_can_be_lifted = * The capacity doesn't represent a real volume or weight, but a choice made for gameplay. * * (FR) - * Cette section utilise une quantification numérique de la capacité et du coût des objets. - * Par exemple, dans un véhicule d'une capacité de 100, nous pouvons charger 5 objets coûtant 20 unités de capacité. - * La capacité ne représente ni un poids, ni un volume, mais un choix fait pour la jouabilité. + * Cette section utilise une quantification num�rique de la capacit� et du co�t des objets. + * Par exemple, dans un v�hicule d'une capacit� de 100, nous pouvons charger 5 objets co�tant 20 unit�s de capacit�. + * La capacit� ne repr�sente ni un poids, ni un volume, mais un choix fait pour la jouabilit�. */ /** * List of class names of vehicles or cargo objects which can transport objects. * The second element of the nested arrays is the load capacity (in relation with the capacity cost of the objects). * - * Liste des noms de classes des véhicules ou "objets contenant" pouvant transporter des objets. - * Le deuxième élément des sous-tableaux est la capacité de chargement (en relation avec le coût de capacité des objets). + * Liste des noms de classes des v�hicules ou "objets contenant" pouvant transporter des objets. + * Le deuxi�me �l�ment des sous-tableaux est la capacit� de chargement (en relation avec le co�t de capacit� des objets). */ R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + [ @@ -300,7 +279,7 @@ R3F_LOG_CFG_can_transport_cargo = R3F_LOG_CFG_can_transport_cargo + * The second element of the nested arrays is the cost capacity (in relation with the capacity of the vehicles). * * Liste des noms de classes des objets transportables. - * Le deuxième élément des sous-tableaux est le coût de capacité (en relation avec la capacité des véhicules). + * Le deuxi�me �l�ment des sous-tableaux est le co�t de capacit� (en relation avec la capacit� des v�hicules). */ R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + [ @@ -311,7 +290,7 @@ R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + /** * List of class names of objects which can be carried and moved by a player. - * Liste des noms de classes des objets qui peuvent être portés et déplacés par le joueur. + * Liste des noms de classes des objets qui peuvent �tre port�s et d�plac�s par le joueur. */ R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + [ diff --git a/common/R3F_LOG/init.sqf b/common/R3F_LOG/init.sqf index 1b958aa..2e6a74c 100644 --- a/common/R3F_LOG/init.sqf +++ b/common/R3F_LOG/init.sqf @@ -1,5 +1,5 @@ /** - * Script principal qui initialise le système de logistique + * Script principal qui initialise le syst�me de logistique * * Copyright (C) 2014 Team ~R3F~ * @@ -22,7 +22,7 @@ #ifdef R3F_LOG_enable /* DEBUT import config */ - // Initialise les listes vides avant que le config.sqf les concatène + // Initialise les listes vides avant que le config.sqf les concat�ne R3F_LOG_CFG_can_tow = []; R3F_LOG_CFG_can_be_towed = []; R3F_LOG_CFG_can_lift = []; @@ -45,7 +45,7 @@ /* * On inverse l'ordre de toutes les listes de noms de classes pour donner - * la priorité aux classes spécifiques sur les classes génériques + * la priorit� aux classes sp�cifiques sur les classes g�n�riques */ reverse R3F_LOG_CFG_can_tow; reverse R3F_LOG_CFG_can_be_towed; @@ -64,13 +64,13 @@ {R3F_LOG_CFG_can_be_transported_cargo select _forEachIndex set [0, toLower (_x select 0)];} forEach R3F_LOG_CFG_can_be_transported_cargo; {R3F_LOG_CFG_can_be_moved_by_player set [_forEachIndex, toLower _x];} forEach R3F_LOG_CFG_can_be_moved_by_player; - // On construit la liste des classes des transporteurs dans les quantités associées (pour les nearestObjects, count isKindOf, ...) + // On construit la liste des classes des transporteurs dans les quantit�s associ�es (pour les nearestObjects, count isKindOf, ...) R3F_LOG_classes_transporteurs = []; { R3F_LOG_classes_transporteurs pushBack (_x select 0); } forEach R3F_LOG_CFG_can_transport_cargo; - // On construit la liste des classes des transportables dans les quantités associées (pour les nearestObjects, count isKindOf, ...) + // On construit la liste des classes des transportables dans les quantit�s associ�es (pour les nearestObjects, count isKindOf, ...) R3F_LOG_classes_objets_transportables = []; { R3F_LOG_classes_objets_transportables pushBack (_x select 0); @@ -85,7 +85,7 @@ }; } forEach (R3F_LOG_CFG_can_be_moved_by_player + R3F_LOG_CFG_can_be_lifted + R3F_LOG_CFG_can_be_towed + R3F_LOG_classes_objets_transportables); - // Gestion compatibilité fichier de config 3.0 => 3.1 (définition de valeurs par défaut) + // Gestion compatibilit� fichier de config 3.0 => 3.1 (d�finition de valeurs par d�faut) if (isNil "R3F_LOG_CFG_lock_objects_mode") then {R3F_LOG_CFG_lock_objects_mode = "side";}; if (isNil "R3F_LOG_CFG_unlock_objects_timer") then {R3F_LOG_CFG_unlock_objects_timer = 30;}; if (isNil "R3F_LOG_CFG_CF_sell_back_bargain_rate") then {R3F_LOG_CFG_CF_sell_back_bargain_rate = 0.75;}; @@ -95,7 +95,7 @@ if (isServer) then { - // On crée le point d'attache qui servira aux attachTo pour les objets à charger virtuellement dans les véhicules + // On cr�e le point d'attache qui servira aux attachTo pour les objets � charger virtuellement dans les v�hicules R3F_LOG_PUBVAR_point_attache = "Land_HelipadEmpty_F" createVehicle [0,0,0]; R3F_LOG_PUBVAR_point_attache setPosASL [0,0,0]; R3F_LOG_PUBVAR_point_attache setVectorDirAndUp [[0,1,0], [0,0,1]]; @@ -103,18 +103,18 @@ // Partage du point d'attache avec tous les joueurs publicVariable "R3F_LOG_PUBVAR_point_attache"; - /** Liste des objets à ne pas perdre dans un vehicule/cargo détruit */ + /** Liste des objets � ne pas perdre dans un vehicule/cargo d�truit */ R3F_LOG_liste_objets_a_proteger = []; - /* Protège les objets présents dans R3F_LOG_liste_objets_a_proteger */ + /* Prot�ge les objets pr�sents dans R3F_LOG_liste_objets_a_proteger */ execVM "R3F_LOG\surveiller_objets_a_proteger.sqf"; }; /** - * Suite à une PVEH, exécute une commande en fonction de la localité de l'argument - * @param 0 l'argument sur lequel exécuter la commande - * @param 1 la commande à exécuter (chaîne de caractères) - * @param 2 les éventuels paramètres de la commande (optionnel) + * Suite � une PVEH, ex�cute une commande en fonction de la localit� de l'argument + * @param 0 l'argument sur lequel ex�cuter la commande + * @param 1 la commande � ex�cuter (cha�ne de caract�res) + * @param 2 les �ventuels param�tres de la commande (optionnel) * @note il faut passer par la fonction R3F_LOG_FNCT_exec_commande_MP */ R3F_LOG_FNCT_PVEH_commande_MP = @@ -124,14 +124,14 @@ _commande = _this select 1 select 1; _parametre = if (count (_this select 1) == 3) then {_this select 1 select 2} else {0}; - // Commandes à argument global et effet local + // Commandes � argument global et effet local switch (_commande) do { // Aucune pour l'instant // ex : case "switchMove": {_argument switchMove _parametre;}; }; - // Commandes à argument local et effet global + // Commandes � argument local et effet global if (local _argument) then { switch (_commande) do @@ -142,7 +142,7 @@ }; }; - // Commandes à faire uniquement sur le serveur + // Commandes � faire uniquement sur le serveur if (isServer) then { if (_commande == "setOwnerTo") then @@ -154,10 +154,10 @@ "R3F_LOG_PV_commande_MP" addPublicVariableEventHandler R3F_LOG_FNCT_PVEH_commande_MP; /** - * Ordonne l'exécution d'une commande quelque soit la localité de l'argument ou de l'effet - * @param 0 l'argument sur lequel exécuter la commande - * @param 1 la commande à exécuter (chaîne de caractères) - * @param 2 les éventuels paramètres de la commande (optionnel) + * Ordonne l'ex�cution d'une commande quelque soit la localit� de l'argument ou de l'effet + * @param 0 l'argument sur lequel ex�cuter la commande + * @param 1 la commande � ex�cuter (cha�ne de caract�res) + * @param 2 les �ventuels param�tres de la commande (optionnel) * @usage [_objet, "setDir", 160] call R3F_LOG_FNCT_exec_commande_MP */ R3F_LOG_FNCT_exec_commande_MP = @@ -167,12 +167,12 @@ ["R3F_LOG_PV_commande_MP", R3F_LOG_PV_commande_MP] spawn R3F_LOG_FNCT_PVEH_commande_MP; }; - /** Pseudo-mutex permettant de n'exécuter qu'un script de manipulation d'objet à la fois (true : vérouillé) */ + /** Pseudo-mutex permettant de n'ex�cuter qu'un script de manipulation d'objet � la fois (true : v�rouill�) */ R3F_LOG_mutex_local_verrou = false; call compile preprocessFile "R3F_LOG\fonctions_generales\lib_geometrie_3D.sqf"; - // Indices du tableau des fonctionnalités retourné par R3F_LOG_FNCT_determiner_fonctionnalites_logistique + // Indices du tableau des fonctionnalit�s retourn� par R3F_LOG_FNCT_determiner_fonctionnalites_logistique R3F_LOG_IDX_can_be_depl_heli_remorq_transp = 0; R3F_LOG_IDX_can_be_moved_by_player = 1; R3F_LOG_IDX_can_lift = 2; @@ -190,19 +190,19 @@ R3F_LOG_FNCT_calculer_chargement_vehicule = compile preprocessFile "R3F_LOG\transporteur\calculer_chargement_vehicule.sqf"; R3F_LOG_FNCT_transporteur_charger_auto = compile preprocessFile "R3F_LOG\transporteur\charger_auto.sqf"; - // Un serveur dédié n'en a pas besoin + // Un serveur d�di� n'en a pas besoin if !(isDedicated) then { - // Le client attend que le serveur ai créé et publié la référence de l'objet servant de point d'attache + // Le client attend que le serveur ai cr�� et publi� la r�f�rence de l'objet servant de point d'attache waitUntil {!isNil "R3F_LOG_PUBVAR_point_attache"}; - /** Indique quel objet le joueur est en train de déplacer, objNull si aucun */ + /** Indique quel objet le joueur est en train de d�placer, objNull si aucun */ R3F_LOG_joueur_deplace_objet = objNull; - /** Objet actuellement sélectionner pour être chargé/remorqué */ + /** Objet actuellement s�lectionner pour �tre charg�/remorqu� */ R3F_LOG_objet_selectionne = objNull; - /** Tableau contenant toutes les usines créées */ + /** Tableau contenant toutes les usines cr��es */ R3F_LOG_CF_liste_usines = []; call compile preprocessFile "R3F_LOG\fonctions_generales\lib_visualisation_objet.sqf"; @@ -266,7 +266,7 @@ R3F_LOG_action_deverrouiller_valide = false; - /** Sur ordre (publicVariable), révéler la présence d'un objet au joueur (accélérer le retour des addActions) */ + /** Sur ordre (publicVariable), r�v�ler la pr�sence d'un objet au joueur (acc�l�rer le retour des addActions) */ R3F_LOG_FNCT_PUBVAR_reveler_au_joueur = { private ["_objet"]; @@ -279,7 +279,7 @@ }; "R3F_LOG_PUBVAR_reveler_au_joueur" addPublicVariableEventHandler R3F_LOG_FNCT_PUBVAR_reveler_au_joueur; - /** Event handler GetIn : ne pas monter dans un véhicule qui est en cours de transport */ + /** Event handler GetIn : ne pas monter dans un v�hicule qui est en cours de transport */ R3F_LOG_FNCT_EH_GetIn = { if (local (_this select 2)) then @@ -297,17 +297,17 @@ }; }; - // Actions à faire quand le joueur est apparu + // Actions � faire quand le joueur est apparu 0 spawn { waitUntil {!isNull player}; - // Ajout d'un event handler "WeaponDisassembled" pour gérer le cas où une arme est démontée alors qu'elle est en cours de transport + // Ajout d'un event handler "WeaponDisassembled" pour g�rer le cas o� une arme est d�mont�e alors qu'elle est en cours de transport player addEventHandler ["WeaponDisassembled", { private ["_objet"]; - // Récupération de l'arme démontée avec cursorTarget au lieu de _this (http://feedback.arma3.com/view.php?id=18090) + // R�cup�ration de l'arme d�mont�e avec cursorTarget au lieu de _this (http://feedback.arma3.com/view.php?id=18090) _objet = cursorTarget; if (!isNull _objet && {!isNull (_objet getVariable ["R3F_LOG_est_deplace_par", objNull])}) then @@ -317,20 +317,20 @@ }]; }; - /** Variable publique passer à true pour informer le script surveiller_nouveaux_objets.sqf de la création d'un objet */ + /** Variable publique passer � true pour informer le script surveiller_nouveaux_objets.sqf de la cr�ation d'un objet */ R3F_LOG_PUBVAR_nouvel_objet_a_initialiser = false; - /* Vérification permanente des conditions donnant accès aux addAction */ + /* V�rification permanente des conditions donnant acc�s aux addAction */ execVM "R3F_LOG\surveiller_conditions_actions_menu.sqf"; - /* Auto-détection permanente des objets sur le jeu */ + /* Auto-d�tection permanente des objets sur le jeu */ execVM "R3F_LOG\surveiller_nouveaux_objets.sqf"; /* - * Système assurant la protection contre les blessures lors du déplacement d'objets - * On choisit de ne pas faire tourner le système sur un serveur dédié par économie de ressources. - * Seuls les joueurs et les IA commandées par les joueurs (locales) seront protégés. - * Les IA n'étant pas commandées par un joueur ne seront pas protégées, ce qui est un moindre mal. + * Syst�me assurant la protection contre les blessures lors du d�placement d'objets + * On choisit de ne pas faire tourner le syst�me sur un serveur d�di� par �conomie de ressources. + * Seuls les joueurs et les IA command�es par les joueurs (locales) seront prot�g�s. + * Les IA n'�tant pas command�es par un joueur ne seront pas prot�g�es, ce qui est un moindre mal. */ execVM "R3F_LOG\systeme_protection_blessures.sqf"; }; diff --git a/common/Server/fn_advancedTowingInit.sqf b/common/Server/fn_advancedTowingInit.sqf new file mode 100644 index 0000000..1c0ee58 --- /dev/null +++ b/common/Server/fn_advancedTowingInit.sqf @@ -0,0 +1,872 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 Seth Duda + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#define SA_Find_Surface_ASL_Under_Position(_object,_positionAGL,_returnSurfaceASL,_canFloat) \ +_objectASL = AGLToASL (_object modelToWorldVisual (getCenterOfMass _object)); \ +_surfaceIntersectStartASL = [_positionAGL select 0, _positionAGL select 1, (_objectASL select 2) + 1]; \ +_surfaceIntersectEndASL = [_positionAGL select 0, _positionAGL select 1, (_objectASL select 2) - 5]; \ +_surfaces = lineIntersectsSurfaces [_surfaceIntersectStartASL, _surfaceIntersectEndASL, _object, objNull, true, 5]; \ +_returnSurfaceASL = AGLToASL _positionAGL; \ +{ \ + scopeName "surfaceLoop"; \ + if( isNull (_x select 2) ) then { \ + _returnSurfaceASL = _x select 0; \ + breakOut "surfaceLoop"; \ + } else { \ + if!((_x select 2) isKindOf "RopeSegment") then { \ + _objectFileName = str (_x select 2); \ + if((_objectFileName find " t_") == -1 && (_objectFileName find " b_") == -1) then { \ + _returnSurfaceASL = _x select 0; \ + breakOut "surfaceLoop"; \ + }; \ + }; \ + }; \ +} forEach _surfaces; \ +if(_canFloat && (_returnSurfaceASL select 2) < 0) then { \ + _returnSurfaceASL set [2,0]; \ +}; \ + +#define SA_Find_Surface_ASL_Under_Model(_object,_modelOffset,_returnSurfaceASL,_canFloat) \ +SA_Find_Surface_ASL_Under_Position(_object, (_object modelToWorldVisual _modelOffset), _returnSurfaceASL,_canFloat); + +#define SA_Find_Surface_AGL_Under_Model(_object,_modelOffset,_returnSurfaceAGL,_canFloat) \ +SA_Find_Surface_ASL_Under_Model(_object,_modelOffset,_returnSurfaceAGL,_canFloat); \ +_returnSurfaceAGL = ASLtoAGL _returnSurfaceAGL; + +#define SA_Get_Cargo(_vehicle,_cargo) \ +if( count (ropeAttachedObjects _vehicle) == 0 ) then { \ + _cargo = objNull; \ +} else { \ + _cargo = ((ropeAttachedObjects _vehicle) select 0) getVariable ["SA_Cargo",objNull]; \ +}; + +SA_Advanced_Towing_Install = { + +// Prevent advanced towing from installing twice +if(!isNil "SA_TOW_INIT") exitWith {}; +SA_TOW_INIT = true; + +diag_log "Advanced Towing Loading..."; + +SA_Simulate_Towing_Speed = { + + params ["_vehicle"]; + + private ["_runSimulation","_currentCargo","_maxVehicleSpeed","_maxTowedVehicles","_vehicleMass"]; + + _maxVehicleSpeed = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "maxSpeed"); + _vehicleMass = 1000 max (getMass _vehicle); + _maxTowedCargo = missionNamespace getVariable ["SA_MAX_TOWED_CARGO",2]; + _runSimulation = true; + + private ["_currentVehicle","_totalCargoMass","_totalCargoCount","_findNextCargo","_towRopes","_ropeLength"]; + private ["_ends","_endsDistance","_currentMaxSpeed","_newMaxSpeed"]; + + while {_runSimulation} do { + + // Calculate total mass and count of cargo being towed (only takes into account + // cargo that's actively being towed (e.g. there's no slack in the rope) + + _currentVehicle = _vehicle; + _totalCargoMass = 0; + _totalCargoCount = 0; + _findNextCargo = true; + while {_findNextCargo} do { + _findNextCargo = false; + SA_Get_Cargo(_currentVehicle,_currentCargo); + if(!isNull _currentCargo) then { + _towRopes = _currentVehicle getVariable ["SA_Tow_Ropes",[]]; + if(count _towRopes > 0) then { + _ropeLength = ropeLength (_towRopes select 0); + _ends = ropeEndPosition (_towRopes select 0); + _endsDistance = (_ends select 0) distance (_ends select 1); + if( _endsDistance >= _ropeLength - 2 ) then { + _totalCargoMass = _totalCargoMass + (1000 max (getMass _currentCargo)); + _totalCargoCount = _totalCargoCount + 1; + _currentVehicle = _currentCargo; + _findNextCargo = true; + }; + }; + }; + }; + + _newMaxSpeed = _maxVehicleSpeed / (1 max ((_totalCargoMass / _vehicleMass) * 2)); + _newMaxSpeed = (_maxVehicleSpeed * 0.75) min _newMaxSpeed; + + // Prevent vehicle from moving if trying to move more cargo than pre-defined max + if(_totalCargoCount > _maxTowedCargo) then { + _newMaxSpeed = 0; + }; + + _currentMaxSpeed = _vehicle getVariable ["SA_Max_Tow_Speed",_maxVehicleSpeed]; + + if(_currentMaxSpeed != _newMaxSpeed) then { + _vehicle setVariable ["SA_Max_Tow_Speed",_newMaxSpeed]; + }; + + sleep 0.1; + + }; +}; + +SA_Simulate_Towing = { + + params ["_vehicle","_vehicleHitchModelPos","_cargo","_cargoHitchModelPos","_ropeLength"]; + + private ["_lastCargoHitchPosition","_lastCargoVectorDir","_cargoLength","_maxDistanceToCargo","_lastMovedCargoPosition","_cargoHitchPoints"]; + private ["_vehicleHitchPosition","_cargoHitchPosition","_newCargoHitchPosition","_cargoVector","_movedCargoVector","_attachedObjects","_currentCargo"]; + private ["_newCargoDir","_lastCargoVectorDir","_newCargoPosition","_doExit","_cargoPosition","_vehiclePosition","_maxVehicleSpeed","_vehicleMass","_cargoMass","_cargoCanFloat"]; + private ["_cargoCorner1AGL","_cargoCorner1ASL","_cargoCorner2AGL","_cargoCorner2ASL","_cargoCorner3AGL","_cargoCorner3ASL","_cargoCorner4AGL","_cargoCorner4ASL","_surfaceNormal1","_surfaceNormal2","_surfaceNormal"]; + private ["_cargoCenterASL","_surfaceHeight","_surfaceHeight2","_maxSurfaceHeight"]; + + _maxVehicleSpeed = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "maxSpeed"); + _cargoCanFloat = if( getNumber (configFile >> "CfgVehicles" >> typeOf _cargo >> "canFloat") == 1 ) then { true } else { false }; + + private ["_cargoCenterOfMassAGL","_cargoModelCenterGroundPosition"]; + SA_Find_Surface_AGL_Under_Model(_cargo,getCenterOfMass _cargo,_cargoCenterOfMassAGL,_cargoCanFloat); + _cargoModelCenterGroundPosition = _cargo worldToModelVisual _cargoCenterOfMassAGL; + _cargoModelCenterGroundPosition set [0,0]; + _cargoModelCenterGroundPosition set [1,0]; + _cargoModelCenterGroundPosition set [2, (_cargoModelCenterGroundPosition select 2) - 0.05]; // Adjust height so that it doesn't ride directly on ground + + // Calculate cargo model corner points + private ["_cargoCornerPoints"]; + _cargoCornerPoints = [_cargo] call SA_Get_Corner_Points; + _corner1 = _cargoCornerPoints select 0; + _corner2 = _cargoCornerPoints select 1; + _corner3 = _cargoCornerPoints select 2; + _corner4 = _cargoCornerPoints select 3; + + + // Try to set cargo owner if the towing client doesn't own the cargo + if(local _vehicle && !local _cargo) then { + [[_cargo, clientOwner],"SA_Set_Owner"] call SA_RemoteExecServer; + }; + + _vehicleHitchModelPos set [2,0]; + _cargoHitchModelPos set [2,0]; + + _lastCargoHitchPosition = _cargo modelToWorld _cargoHitchModelPos; + _lastCargoVectorDir = vectorDir _cargo; + _lastMovedCargoPosition = getPos _cargo; + + _cargoHitchPoints = [_cargo] call SA_Get_Hitch_Points; + _cargoLength = (_cargoHitchPoints select 0) distance (_cargoHitchPoints select 1); + + _vehicleMass = 1 max (getMass _vehicle); + _cargoMass = getMass _cargo; + if(_cargoMass == 0) then { + _cargoMass = _vehicleMass; + }; + + _maxDistanceToCargo = _ropeLength; + + _doExit = false; + + // Start vehicle speed simulation + [_vehicle] spawn SA_Simulate_Towing_Speed; + + while {!_doExit} do { + + _vehicleHitchPosition = _vehicle modelToWorld _vehicleHitchModelPos; + _vehicleHitchPosition set [2,0]; + _cargoHitchPosition = _lastCargoHitchPosition; + _cargoHitchPosition set [2,0]; + + _cargoPosition = getPos _cargo; + _vehiclePosition = getPos _vehicle; + + if(_vehicleHitchPosition distance _cargoHitchPosition > _maxDistanceToCargo) then { + + // Calculated simulated towing position + direction + _newCargoHitchPosition = _vehicleHitchPosition vectorAdd ((_vehicleHitchPosition vectorFromTo _cargoHitchPosition) vectorMultiply _ropeLength); + _cargoVector = _lastCargoVectorDir vectorMultiply _cargoLength; + _movedCargoVector = _newCargoHitchPosition vectorDiff _lastCargoHitchPosition; + _newCargoDir = vectorNormalized (_cargoVector vectorAdd _movedCargoVector); + //if(_isRearCargoHitch) then { + // _newCargoDir = _newCargoDir vectorMultiply -1; + //}; + _lastCargoVectorDir = _newCargoDir; + _newCargoPosition = _newCargoHitchPosition vectorAdd (_newCargoDir vectorMultiply -(vectorMagnitude (_cargoHitchModelPos))); + + SA_Find_Surface_ASL_Under_Position(_cargo,_newCargoPosition,_newCargoPosition,_cargoCanFloat); + + // Calculate surface normal (up) (more realistic than surfaceNormal function) + SA_Find_Surface_ASL_Under_Model(_cargo,_corner1,_cargoCorner1ASL,_cargoCanFloat); + SA_Find_Surface_ASL_Under_Model(_cargo,_corner2,_cargoCorner2ASL,_cargoCanFloat); + SA_Find_Surface_ASL_Under_Model(_cargo,_corner3,_cargoCorner3ASL,_cargoCanFloat); + SA_Find_Surface_ASL_Under_Model(_cargo,_corner4,_cargoCorner4ASL,_cargoCanFloat); + _surfaceNormal1 = (_cargoCorner1ASL vectorFromTo _cargoCorner3ASL) vectorCrossProduct (_cargoCorner1ASL vectorFromTo _cargoCorner2ASL); + _surfaceNormal2 = (_cargoCorner4ASL vectorFromTo _cargoCorner2ASL) vectorCrossProduct (_cargoCorner4ASL vectorFromTo _cargoCorner3ASL); + _surfaceNormal = _surfaceNormal1 vectorAdd _surfaceNormal2; + + if(missionNamespace getVariable ["SA_TOW_DEBUG_ENABLED", false]) then { + if(isNil "sa_tow_debug_arrow_1") then { + sa_tow_debug_arrow_1 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + sa_tow_debug_arrow_2 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + sa_tow_debug_arrow_3 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + sa_tow_debug_arrow_4 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + }; + sa_tow_debug_arrow_1 setPosASL _cargoCorner1ASL; + sa_tow_debug_arrow_1 setVectorUp _surfaceNormal; + sa_tow_debug_arrow_2 setPosASL _cargoCorner2ASL; + sa_tow_debug_arrow_2 setVectorUp _surfaceNormal; + sa_tow_debug_arrow_3 setPosASL _cargoCorner3ASL; + sa_tow_debug_arrow_3 setVectorUp _surfaceNormal; + sa_tow_debug_arrow_4 setPosASL _cargoCorner4ASL; + sa_tow_debug_arrow_4 setVectorUp _surfaceNormal; + }; + + // Calculate adjusted surface height based on surface normal (prevents vehicle from clipping into ground) + _cargoCenterASL = AGLtoASL (_cargo modelToWorldVisual [0,0,0]); + _cargoCenterASL set [2,0]; + _surfaceHeight = ((_cargoCorner1ASL vectorAdd ( _cargoCenterASL vectorMultiply -1)) vectorDotProduct _surfaceNormal1) / ([0,0,1] vectorDotProduct _surfaceNormal1); + _surfaceHeight2 = ((_cargoCorner1ASL vectorAdd ( _cargoCenterASL vectorMultiply -1)) vectorDotProduct _surfaceNormal2) / ([0,0,1] vectorDotProduct _surfaceNormal2); + _maxSurfaceHeight = (_newCargoPosition select 2) max _surfaceHeight max _surfaceHeight2; + _newCargoPosition set [2, _maxSurfaceHeight ]; + + _newCargoPosition = _newCargoPosition vectorAdd ( _cargoModelCenterGroundPosition vectorMultiply -1 ); + + _cargo setVectorDir _newCargoDir; + _cargo setVectorUp _surfaceNormal; + _cargo setPosWorld _newCargoPosition; + + _lastCargoHitchPosition = _newCargoHitchPosition; + _maxDistanceToCargo = _vehicleHitchPosition distance _newCargoHitchPosition; + _lastMovedCargoPosition = _cargoPosition; + + _massAdjustedMaxSpeed = _vehicle getVariable ["SA_Max_Tow_Speed",_maxVehicleSpeed]; + if(speed _vehicle > (_massAdjustedMaxSpeed)+0.1) then { + _vehicle setVelocity ((vectorNormalized (velocity _vehicle)) vectorMultiply (_massAdjustedMaxSpeed/3.6)); + }; + + } else { + + if(_lastMovedCargoPosition distance _cargoPosition > 2) then { + _lastCargoHitchPosition = _cargo modelToWorld _cargoHitchModelPos; + _lastCargoVectorDir = vectorDir _cargo; + }; + + }; + + // If vehicle isn't local to the client, switch client running towing simulation + if(!local _vehicle) then { + [_this,"SA_Simulate_Towing",_vehicle] call SA_RemoteExec; + _doExit = true; + }; + + // If the vehicle isn't towing anything, stop the towing simulation + SA_Get_Cargo(_vehicle,_currentCargo); + if(isNull _currentCargo) then { + _doExit = true; + }; + + sleep 0.01; + + }; +}; + +SA_Get_Corner_Points = { + params ["_vehicle"]; + private ["_centerOfMass","_bbr","_p1","_p2","_rearCorner","_rearCorner2","_frontCorner","_frontCorner2"]; + private ["_maxWidth","_widthOffset","_maxLength","_lengthOffset","_widthFactor","_lengthFactor"]; + + // Correct width and length factor for air + _widthFactor = 0.75; + _lengthFactor = 0.75; + if(_vehicle isKindOf "Air") then { + _widthFactor = 0.3; + }; + if(_vehicle isKindOf "Helicopter") then { + _widthFactor = 0.2; + _lengthFactor = 0.45; + }; + + _centerOfMass = getCenterOfMass _vehicle; + _bbr = boundingBoxReal _vehicle; + _p1 = _bbr select 0; + _p2 = _bbr select 1; + _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); + _widthOffset = ((_maxWidth / 2) - abs ( _centerOfMass select 0 )) * _widthFactor; + _maxLength = abs ((_p2 select 1) - (_p1 select 1)); + _lengthOffset = ((_maxLength / 2) - abs (_centerOfMass select 1 )) * _lengthFactor; + _rearCorner = [(_centerOfMass select 0) + _widthOffset, (_centerOfMass select 1) - _lengthOffset, _centerOfMass select 2]; + _rearCorner2 = [(_centerOfMass select 0) - _widthOffset, (_centerOfMass select 1) - _lengthOffset, _centerOfMass select 2]; + _frontCorner = [(_centerOfMass select 0) + _widthOffset, (_centerOfMass select 1) + _lengthOffset, _centerOfMass select 2]; + _frontCorner2 = [(_centerOfMass select 0) - _widthOffset, (_centerOfMass select 1) + _lengthOffset, _centerOfMass select 2]; + + if(missionNamespace getVariable ["SA_TOW_DEBUG_ENABLED", false]) then { + if(isNil "sa_tow_debug_arrow_1") then { + sa_tow_debug_arrow_1 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + sa_tow_debug_arrow_2 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + sa_tow_debug_arrow_3 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + sa_tow_debug_arrow_4 = "Sign_Arrow_F" createVehicleLocal [0,0,0]; + }; + sa_tow_debug_arrow_1 setPosASL AGLtoASL (_vehicle modelToWorldVisual _rearCorner); + sa_tow_debug_arrow_2 setPosASL AGLtoASL (_vehicle modelToWorldVisual _rearCorner2); + sa_tow_debug_arrow_3 setPosASL AGLtoASL (_vehicle modelToWorldVisual _frontCorner); + sa_tow_debug_arrow_4 setPosASL AGLtoASL (_vehicle modelToWorldVisual _frontCorner2); + }; + + [_rearCorner,_rearCorner2,_frontCorner,_frontCorner2]; +}; + +SA_Get_Hitch_Points = { + params ["_vehicle"]; + private ["_cornerPoints","_rearCorner","_rearCorner2","_frontCorner","_frontCorner2","_rearHitchPoint"]; + private ["_frontHitchPoint","_sideLeftPoint","_sideRightPoint"]; + _cornerPoints = [_vehicle] call SA_Get_Corner_Points; + _rearCorner = _cornerPoints select 0; + _rearCorner2 = _cornerPoints select 1; + _frontCorner = _cornerPoints select 2; + _frontCorner2 = _cornerPoints select 3; + _rearHitchPoint = ((_rearCorner vectorDiff _rearCorner2) vectorMultiply 0.5) vectorAdd _rearCorner2; + _frontHitchPoint = ((_frontCorner vectorDiff _frontCorner2) vectorMultiply 0.5) vectorAdd _frontCorner2; + //_sideLeftPoint = ((_frontCorner vectorDiff _rearCorner) vectorMultiply 0.5) vectorAdd _frontCorner; + //_sideRightPoint = ((_frontCorner2 vectorDiff _rearCorner2) vectorMultiply 0.5) vectorAdd _frontCorner2; + [_frontHitchPoint,_rearHitchPoint]; +}; + +SA_Attach_Tow_Ropes = { + params ["_cargo","_player"]; + _vehicle = _player getVariable ["SA_Tow_Ropes_Vehicle", objNull]; + if(!isNull _vehicle) then { + if(local _vehicle) then { + private ["_towRopes","_vehicleHitch","_cargoHitch","_objDistance","_ropeLength"]; + _towRopes = _vehicle getVariable ["SA_Tow_Ropes",[]]; + if(count _towRopes == 1) then { + + /* + private ["_cargoHitchPoints","_distanceToFrontHitch","_distanceToRearHitch","_isRearCargoHitch"]; + _cargoHitchPoints = [_cargo] call SA_Get_Hitch_Points; + _distanceToFrontHitch = player distance (_cargo modelToWorld (_cargoHitchPoints select 0)); + _distanceToRearHitch = player distance (_cargo modelToWorld (_cargoHitchPoints select 1)); + if( _distanceToFrontHitch < _distanceToRearHitch ) then { + _cargoHitch = _cargoHitchPoints select 0; + _isRearCargoHitch = false; + } else { + _cargoHitch = _cargoHitchPoints select 1; + _isRearCargoHitch = true; + }; + */ + + _cargoHitch = ([_cargo] call SA_Get_Hitch_Points) select 0; + + _vehicleHitch = ([_vehicle] call SA_Get_Hitch_Points) select 1; + _ropeLength = (ropeLength (_towRopes select 0)); + _objDistance = ((_vehicle modelToWorld _vehicleHitch) distance (_cargo modelToWorld _cargoHitch)); + if( _objDistance > _ropeLength ) then { + [["The tow ropes are too short. Move vehicle closer.", false],"SA_Hint",_player] call SA_RemoteExec; + } else { + [_vehicle,_player] call SA_Drop_Tow_Ropes; + _helper = "Land_Can_V2_F" createVehicle position _cargo; + _helper attachTo [_cargo, _cargoHitch]; + _helper setVariable ["SA_Cargo",_cargo,true]; + hideObject _helper; + [[_helper],"SA_Hide_Object_Global"] call SA_RemoteExecServer; + [_helper, [0,0,0], [0,0,-1]] ropeAttachTo (_towRopes select 0); + [_vehicle,_vehicleHitch,_cargo,_cargoHitch,_ropeLength] spawn SA_Simulate_Towing; + }; + }; + } else { + [_this,"SA_Attach_Tow_Ropes",_vehicle,true] call SA_RemoteExec; + }; + }; +}; + +SA_Take_Tow_Ropes = { + params ["_vehicle","_player"]; + if(local _vehicle) then { + diag_log format ["Take Tow Ropes Called %1", _this]; + private ["_existingTowRopes","_hitchPoint","_rope"]; + _existingTowRopes = _vehicle getVariable ["SA_Tow_Ropes",[]]; + if(count _existingTowRopes == 0) then { + _hitchPoint = [_vehicle] call SA_Get_Hitch_Points select 1; + _rope = ropeCreate [_vehicle, _hitchPoint, 10]; + _vehicle setVariable ["SA_Tow_Ropes",[_rope],true]; + _this call SA_Pickup_Tow_Ropes; + }; + } else { + [_this,"SA_Take_Tow_Ropes",_vehicle,true] call SA_RemoteExec; + }; +}; + +SA_Pickup_Tow_Ropes = { + params ["_vehicle","_player"]; + if(local _vehicle) then { + private ["_attachedObj","_helper"]; + { + _attachedObj = _x; + { + _attachedObj ropeDetach _x; + } forEach (_vehicle getVariable ["SA_Tow_Ropes",[]]); + deleteVehicle _attachedObj; + } forEach ropeAttachedObjects _vehicle; + _helper = "Land_Can_V2_F" createVehicle position _player; + { + [_helper, [0, 0, 0], [0,0,-1]] ropeAttachTo _x; + _helper attachTo [_player, [-0.1, 0.1, 0.15], "Pelvis"]; + } forEach (_vehicle getVariable ["SA_Tow_Ropes",[]]); + hideObject _helper; + [[_helper],"SA_Hide_Object_Global"] call SA_RemoteExecServer; + _player setVariable ["SA_Tow_Ropes_Vehicle", _vehicle,true]; + _player setVariable ["SA_Tow_Ropes_Pick_Up_Helper", _helper,true]; + } else { + [_this,"SA_Pickup_Tow_Ropes",_vehicle,true] call SA_RemoteExec; + }; +}; + +SA_Drop_Tow_Ropes = { + params ["_vehicle","_player"]; + if(local _vehicle) then { + private ["_helper"]; + _helper = (_player getVariable ["SA_Tow_Ropes_Pick_Up_Helper", objNull]); + if(!isNull _helper) then { + { + _helper ropeDetach _x; + } forEach (_vehicle getVariable ["SA_Tow_Ropes",[]]); + detach _helper; + deleteVehicle _helper; + }; + _player setVariable ["SA_Tow_Ropes_Vehicle", nil,true]; + _player setVariable ["SA_Tow_Ropes_Pick_Up_Helper", nil,true]; + } else { + [_this,"SA_Drop_Tow_Ropes",_vehicle,true] call SA_RemoteExec; + }; +}; + +SA_Put_Away_Tow_Ropes = { + params ["_vehicle","_player"]; + if(local _vehicle) then { + private ["_existingTowRopes","_hitchPoint","_rope"]; + _existingTowRopes = _vehicle getVariable ["SA_Tow_Ropes",[]]; + if(count _existingTowRopes > 0) then { + _this call SA_Pickup_Tow_Ropes; + _this call SA_Drop_Tow_Ropes; + { + ropeDestroy _x; + } forEach _existingTowRopes; + _vehicle setVariable ["SA_Tow_Ropes",nil,true]; + }; + } else { + [_this,"SA_Put_Away_Tow_Ropes",_vehicle,true] call SA_RemoteExec; + }; +}; + +SA_Attach_Tow_Ropes_Action = { + private ["_vehicle","_cargo","_canBeTowed"]; + _cargo = cursorTarget; + _vehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull]; + if([_vehicle,_cargo] call SA_Can_Attach_Tow_Ropes) then { + + _canBeTowed = true; + + if!(missionNamespace getVariable ["SA_TOW_LOCKED_VEHICLES_ENABLED",false]) then { + if( locked _cargo > 1 ) then { + ["Cannot attach tow ropes to locked vehicle",false] call SA_Hint; + _canBeTowed = false; + }; + }; + + if!(missionNamespace getVariable ["SA_TOW_IN_EXILE_SAFEZONE_ENABLED",false]) then { + if(!isNil "ExilePlayerInSafezone") then { + if( ExilePlayerInSafezone ) then { + ["Cannot attach tow ropes in safe zone",false] call SA_Hint; + _canBeTowed = false; + }; + }; + }; + + if(_canBeTowed) then { + [_cargo,player] call SA_Attach_Tow_Ropes; + }; + + }; +}; + +SA_Attach_Tow_Ropes_Action_Check = { + private ["_vehicle","_cargo"]; + _vehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull]; + _cargo = cursorTarget; + [_vehicle,_cargo] call SA_Can_Attach_Tow_Ropes; +}; + +SA_Can_Attach_Tow_Ropes = { + params ["_vehicle","_cargo"]; + if(!isNull _vehicle && !isNull _cargo) then { + [_vehicle,_cargo] call SA_Is_Supported_Cargo && vehicle player == player && player distance _cargo < 10 && _vehicle != _cargo; + } else { + false; + }; +}; + +SA_Take_Tow_Ropes_Action = { + private ["_vehicle","_canTakeTowRopes"]; + _vehicle = cursorTarget; + if([_vehicle] call SA_Can_Take_Tow_Ropes) then { + + _canTakeTowRopes = true; + + if!(missionNamespace getVariable ["SA_TOW_LOCKED_VEHICLES_ENABLED",false]) then { + if( locked _vehicle > 1 ) then { + ["Cannot take tow ropes from locked vehicle",false] call SA_Hint; + _canTakeTowRopes = false; + }; + }; + + if!(missionNamespace getVariable ["SA_TOW_IN_EXILE_SAFEZONE_ENABLED",false]) then { + if(!isNil "ExilePlayerInSafezone") then { + if( ExilePlayerInSafezone ) then { + ["Cannot take tow ropes in safe zone",false] call SA_Hint; + _canTakeTowRopes = false; + }; + }; + }; + + if(_canTakeTowRopes) then { + [_vehicle,player] call SA_Take_Tow_Ropes; + }; + + }; +}; + +SA_Take_Tow_Ropes_Action_Check = { + [cursorTarget] call SA_Can_Take_Tow_Ropes; +}; + +SA_Can_Take_Tow_Ropes = { + params ["_vehicle"]; + if([_vehicle] call SA_Is_Supported_Vehicle) then { + private ["_existingVehicle","_existingTowRopes"]; + _existingTowRopes = _vehicle getVariable ["SA_Tow_Ropes",[]]; + _existingVehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull]; + vehicle player == player && player distance _vehicle < 10 && (count _existingTowRopes) == 0 && isNull _existingVehicle; + } else { + false; + }; +}; + +SA_Put_Away_Tow_Ropes_Action = { + private ["_vehicle","_canPutAwayTowRopes"]; + _vehicle = cursorTarget; + if([_vehicle] call SA_Can_Put_Away_Tow_Ropes) then { + + _canPutAwayTowRopes = true; + + if!(missionNamespace getVariable ["SA_TOW_LOCKED_VEHICLES_ENABLED",false]) then { + if( locked _vehicle > 1 ) then { + ["Cannot put away tow ropes in locked vehicle",false] call SA_Hint; + _canPutAwayTowRopes = false; + }; + }; + + if!(missionNamespace getVariable ["SA_TOW_IN_EXILE_SAFEZONE_ENABLED",false]) then { + if(!isNil "ExilePlayerInSafezone") then { + if( ExilePlayerInSafezone ) then { + ["Cannot put away tow ropes in safe zone",false] call SA_Hint; + _canPutAwayTowRopes = false; + }; + }; + }; + + if(_canPutAwayTowRopes) then { + [_vehicle,player] call SA_Put_Away_Tow_Ropes; + }; + + }; +}; + +SA_Put_Away_Tow_Ropes_Action_Check = { + [cursorTarget] call SA_Can_Put_Away_Tow_Ropes; +}; + +SA_Can_Put_Away_Tow_Ropes = { + params ["_vehicle"]; + private ["_existingTowRopes"]; + if([_vehicle] call SA_Is_Supported_Vehicle) then { + _existingTowRopes = _vehicle getVariable ["SA_Tow_Ropes",[]]; + vehicle player == player && player distance _vehicle < 10 && (count _existingTowRopes) > 0; + } else { + false; + }; +}; + + +SA_Drop_Tow_Ropes_Action = { + private ["_vehicle"]; + _vehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull]; + if([] call SA_Can_Drop_Tow_Ropes) then { + [_vehicle, player] call SA_Drop_Tow_Ropes; + }; +}; + +SA_Drop_Tow_Ropes_Action_Check = { + [] call SA_Can_Drop_Tow_Ropes; +}; + +SA_Can_Drop_Tow_Ropes = { + !isNull (player getVariable ["SA_Tow_Ropes_Vehicle", objNull]) && vehicle player == player; +}; + + + +SA_Pickup_Tow_Ropes_Action = { + private ["_nearbyTowVehicles","_canPickupTowRopes","_vehicle"]; + _nearbyTowVehicles = missionNamespace getVariable ["SA_Nearby_Tow_Vehicles",[]]; + if([] call SA_Can_Pickup_Tow_Ropes) then { + + _vehicle = _nearbyTowVehicles select 0; + _canPickupTowRopes = true; + + if!(missionNamespace getVariable ["SA_TOW_LOCKED_VEHICLES_ENABLED",false]) then { + if( locked _vehicle > 1 ) then { + ["Cannot pick up tow ropes from locked vehicle",false] call SA_Hint; + _canPickupTowRopes = false; + }; + }; + + if!(missionNamespace getVariable ["SA_TOW_IN_EXILE_SAFEZONE_ENABLED",false]) then { + if(!isNil "ExilePlayerInSafezone") then { + if( ExilePlayerInSafezone ) then { + ["Cannot pick up tow ropes in safe zone",false] call SA_Hint; + _canPickupTowRopes = false; + }; + }; + }; + + if(_canPickupTowRopes) then { + [_nearbyTowVehicles select 0, player] call SA_Pickup_Tow_Ropes; + }; + + }; +}; + +SA_Pickup_Tow_Ropes_Action_Check = { + [] call SA_Can_Pickup_Tow_Ropes; +}; + +SA_Can_Pickup_Tow_Ropes = { + isNull (player getVariable ["SA_Tow_Ropes_Vehicle", objNull]) && count (missionNamespace getVariable ["SA_Nearby_Tow_Vehicles",[]]) > 0 && vehicle player == player; +}; + +SA_TOW_SUPPORTED_VEHICLES = [ + "Tank", "Car", "Ship" +]; + +SA_Is_Supported_Vehicle = { + params ["_vehicle","_isSupported"]; + _isSupported = false; + if(not isNull _vehicle) then { + { + if(_vehicle isKindOf _x) then { + _isSupported = true; + }; + } forEach (missionNamespace getVariable ["SA_TOW_SUPPORTED_VEHICLES_OVERRIDE",SA_TOW_SUPPORTED_VEHICLES]); + }; + _isSupported; +}; + +SA_TOW_RULES = [ + ["Tank","CAN_TOW","Tank"], + ["Tank","CAN_TOW","Car"], + ["Tank","CAN_TOW","Ship"], + ["Tank","CAN_TOW","Air"], + ["Car","CAN_TOW","Tank"], + ["Car","CAN_TOW","Car"], + ["Car","CAN_TOW","Ship"], + ["Car","CAN_TOW","Air"], + ["Ship","CAN_TOW","Ship"] +]; + +SA_Is_Supported_Cargo = { + params ["_vehicle","_cargo"]; + private ["_canTow"]; + _canTow = false; + if(not isNull _vehicle && not isNull _cargo) then { + { + if(_vehicle isKindOf (_x select 0)) then { + if(_cargo isKindOf (_x select 2)) then { + if( (toUpper (_x select 1)) == "CAN_TOW" ) then { + _canTow = true; + } else { + _canTow = false; + }; + }; + }; + } forEach (missionNamespace getVariable ["SA_TOW_RULES_OVERRIDE",SA_TOW_RULES]); + }; + _canTow; +}; + +SA_Hint = { + params ["_msg",["_isSuccess",true]]; + if(!isNil "ExileClient_gui_notification_event_addNotification") then { + if(_isSuccess) then { + ["Success", [_msg]] call ExileClient_gui_notification_event_addNotification; + } else { + ["Whoops", [_msg]] call ExileClient_gui_notification_event_addNotification; + }; + } else { + hint _msg; + }; +}; + +SA_Hide_Object_Global = { + params ["_obj"]; + if( _obj isKindOf "Land_Can_V2_F" ) then { + hideObjectGlobal _obj; + }; +}; + +SA_Set_Owner = { + params ["_obj","_client"]; + _obj setOwner _client; +}; + +SA_Add_Player_Tow_Actions = { + + player addAction ["Deploy Tow Ropes", { + [] call SA_Take_Tow_Ropes_Action; + }, nil, 0, false, true, "", "call SA_Take_Tow_Ropes_Action_Check"]; + + player addAction ["Put Away Tow Ropes", { + [] call SA_Put_Away_Tow_Ropes_Action; + }, nil, 0, false, true, "", "call SA_Put_Away_Tow_Ropes_Action_Check"]; + + player addAction ["Attach To Tow Ropes", { + [] call SA_Attach_Tow_Ropes_Action; + }, nil, 0, false, true, "", "call SA_Attach_Tow_Ropes_Action_Check"]; + + player addAction ["Drop Tow Ropes", { + [] call SA_Drop_Tow_Ropes_Action; + }, nil, 0, false, true, "", "call SA_Drop_Tow_Ropes_Action_Check"]; + + player addAction ["Pickup Tow Ropes", { + [] call SA_Pickup_Tow_Ropes_Action; + }, nil, 0, false, true, "", "call SA_Pickup_Tow_Ropes_Action_Check"]; + + player addEventHandler ["Respawn", { + player setVariable ["SA_Tow_Actions_Loaded",false]; + }]; + +}; + +SA_Find_Nearby_Tow_Vehicles = { + private ["_nearVehicles","_nearVehiclesWithTowRopes","_vehicle","_ends","_end1","_end2"]; + _nearVehicles = []; + { + _nearVehicles append (position player nearObjects [_x, 30]); + } forEach (missionNamespace getVariable ["SA_TOW_SUPPORTED_VEHICLES_OVERRIDE",SA_TOW_SUPPORTED_VEHICLES]); + _nearVehiclesWithTowRopes = []; + { + _vehicle = _x; + { + _ends = ropeEndPosition _x; + if(count _ends == 2) then { + _end1 = _ends select 0; + _end2 = _ends select 1; + if(((position player) distance _end1) < 5 || ((position player) distance _end2) < 5 ) then { + _nearVehiclesWithTowRopes pushBack _vehicle; + } + }; + } forEach (_vehicle getVariable ["SA_Tow_Ropes",[]]); + } forEach _nearVehicles; + _nearVehiclesWithTowRopes; +}; + +if(!isDedicated) then { + [] spawn { + while {true} do { + if(!isNull player && isPlayer player) then { + if!( player getVariable ["SA_Tow_Actions_Loaded",false] ) then { + [] call SA_Add_Player_Tow_Actions; + player setVariable ["SA_Tow_Actions_Loaded",true]; + }; + }; + missionNamespace setVariable ["SA_Nearby_Tow_Vehicles", (call SA_Find_Nearby_Tow_Vehicles)]; + sleep 2; + }; + }; +}; + +SA_RemoteExec = { + params ["_params","_functionName","_target",["_isCall",false]]; + if(!isNil "ExileClient_system_network_send") then { + ["AdvancedTowingRemoteExecClient",[_params,_functionName,_target,_isCall]] call ExileClient_system_network_send; + } else { + if(_isCall) then { + _params remoteExecCall [_functionName, _target]; + } else { + _params remoteExec [_functionName, _target]; + }; + }; +}; + +SA_RemoteExecServer = { + params ["_params","_functionName",["_isCall",false]]; + if(!isNil "ExileClient_system_network_send") then { + ["AdvancedTowingRemoteExecServer",[_params,_functionName,_isCall]] call ExileClient_system_network_send; + } else { + if(_isCall) then { + _params remoteExecCall [_functionName, 2]; + } else { + _params remoteExec [_functionName, 2]; + }; + }; +}; + +if(isServer) then { + + // Adds support for exile network calls (Only used when running exile) // + + SA_SUPPORTED_REMOTEEXECSERVER_FUNCTIONS = ["SA_Set_Owner","SA_Hide_Object_Global"]; + + ExileServer_AdvancedTowing_network_AdvancedTowingRemoteExecServer = { + params ["_sessionId", "_messageParameters",["_isCall",false]]; + _messageParameters params ["_params","_functionName"]; + if(_functionName in SA_SUPPORTED_REMOTEEXECSERVER_FUNCTIONS) then { + if(_isCall) then { + _params call (missionNamespace getVariable [_functionName,{}]); + } else { + _params spawn (missionNamespace getVariable [_functionName,{}]); + }; + }; + }; + + SA_SUPPORTED_REMOTEEXECCLIENT_FUNCTIONS = ["SA_Simulate_Towing","SA_Attach_Tow_Ropes","SA_Take_Tow_Ropes","SA_Put_Away_Tow_Ropes","SA_Pickup_Tow_Ropes","SA_Drop_Tow_Ropes","SA_Hint"]; + + ExileServer_AdvancedTowing_network_AdvancedTowingRemoteExecClient = { + params ["_sessionId", "_messageParameters"]; + _messageParameters params ["_params","_functionName","_target",["_isCall",false]]; + if(_functionName in SA_SUPPORTED_REMOTEEXECCLIENT_FUNCTIONS) then { + if(_isCall) then { + _params remoteExecCall [_functionName, _target]; + } else { + _params remoteExec [_functionName, _target]; + }; + }; + }; + + // Install Advanced Towing on all clients (plus JIP) // + + publicVariable "SA_Advanced_Towing_Install"; + remoteExecCall ["SA_Advanced_Towing_Install", -2,true]; + +}; + +diag_log "Advanced Towing Loaded"; + +}; + +if(isServer) then { + [] call SA_Advanced_Towing_Install; +}; diff --git a/common/initServer.sqf b/common/initServer.sqf index 58aaded..f460b4c 100644 --- a/common/initServer.sqf +++ b/common/initServer.sqf @@ -30,6 +30,7 @@ respawnMHQ = compile preprocessFileLineNumbers 'Server\mhq\respawn.sqf'; [] execVM "Server\z_townmgr.sqf"; [] execVM "Server\mhq\marker.sqf"; [] execVM "Server\VehicleMarker.sqf"; +[] execVM "Server\fn_advancedTowingInit.sqf"; waitUntil {ztowninit==1}; [] execVM "Server\eos\zoneConfig.sqf"; [] execVM "Server\cleanupAuto.sqf";