Compare commits

..

No commits in common. "master" and "1.3" have entirely different histories.
master ... 1.3

5 changed files with 100 additions and 364 deletions

2
.gitignore vendored
View File

@ -45,5 +45,3 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk
*.pbo
addons/SA_AdvancedTowing.pbo.AdvancedTowing.bisign

126
README.md
View File

@ -1,131 +1,5 @@
# Advanced Towing
Adds support for towing vehicles using ropes. Works in both SP and MP. Supports Exile.
Also check out my Advanced Sling Loading addon for more rope features!
**Features:**
- Tow other vehicles behind Ships, Cars, Trucks and Tanks
- The size of the vehicle impacts it's towing capability
- Other players (including AI) can tow other players
- Supports towing damaged / destroyed vehicles
- Supports towing "trains" of vehicles (limited to 2 by default - see below)
**Installation:**
1. Subscrive via steam: http://steamcommunity.com/sharedfiles/filedetails/?id=639837898 or dowload latest release from https://github.com/sethduda/AdvancedTowing/releases
2. If installing this on a server, add the addon to the -serverMod command line option
3. Optionally, this can be installed directly in the mission PBO by calling the advanced towing script via initServer.sqf. You'll find the sqf script (fn_advancedTowingInit.sqf) in the addons directory inside the downloaded addon.
**Default Towing Rules:**
- Tanks can tow tanks, cars, ships and air
- Cars can tow cars, ships and air
- Trucks can tow cars, ships and air
- Ships can only tow ships
- You can't tow locked vehicles (see settings below)
- You can only tow up to two vehicles at a time (see settings below)
**Notes for Mission Makers:**
You can enable "trains" of vehicles by defining the SA_MAX_TOWED_CARGO varible in your init.sqf file. By default, this is set to 2. When set, vehicles can tow up to the max number of specified vehicles. If you try to tow more, your vehicle won't be able to move. Note, however, mass of all vehicles will be taken into account. It's going to be slower to two vehicles vs one.
```SA_MAX_TOWED_CARGO = 3; ```
You can customize which classes of objects can "deploy" tow ropes by overriding the SA_TOW_SUPPORTED_VEHICLES_OVERRIDE variable in an init.sqf file.
```SA_TOW_SUPPORTED_VEHICLES_OVERRIDE = [ "Air", "Ship" ]; ```
This will only allow objects of class Air and Ship deploy tow ropes.
You can customize what can and can't be towed by defining the SA_TOW_RULES_OVERRIDE variable in the init.sqf file.
```SA_TOW_RULES_OVERRIDE =
[ ["Air", "CAN_TOW", "Ship"],
["Air", "CAN_TOW", "Air"],
["Ship", "CANT_TOW", "Air"],
["Ship", "CAN_TOW", "Ship"]
]; ```
In this example, all objects of class Air can tow Ships and Air. However, Ships can only tow ships.
You can allow towing of locked vehicles by defining SA_TOW_LOCKED_VEHICLES_ENABLED in your init.sqf file. It defaults to false.
```SA_TOW_LOCKED_VEHICLES_ENABLED = true; ```
You can allow towing in an Exile safe zone by defining SA_TOW_IN_EXILE_SAFEZONE_ENABLED in your init.sqf file. It default to false.
```SA_TOW_IN_EXILE_SAFEZONE_ENABLED = true; ```
**Not working on your server?**
Make sure you have the mod listed in the -mod or -serverMod command line option. Only -serverMod is required for this addon. If still not working, check your server log to make sure the addon is found.
**FAQ**
*This addon is only required on the server - is it going to slow down my server?*
No - while this addon is server-side only, it installs itself on all clients without them downloading the addon. Most of the time, the towing code actually runs client-side, even though you installed the addon only on the server. Magic!
*Why is the vehicle I'm towing jumpy/laggy?*
If you're towing a vehicle that another player is driving, it's slower to transmit position updates for the towed vehicle. This will result in laggy looking towing. Have the player move to the passenger seat and then re-attach the tow ropes.
Also, when using this in MP, all other players watching someone tow something will also notice the towed vehicle isn't moving as smoothly. This is also due to network delay. Usually this isn't too noticeable unless moving very fast.
*Battleye kicks me when I try to do xyz. What do I do?*
You need to configure Battleye rules on your server. Below are the files you need to configure:
setvariable.txt
Add the following exclusions to the end of all lines starting with 4, 5, 6, or 7 if they contain "" (meaning applies to all values):
!="SA_Cargo" !="SA_Tow_Ropes" !="SA_Tow_Ropes_Vehicle" !="SA_Tow_Ropes_Pick_Up_Helper"
setvariableval.txt
If you have any lines starting with 4, 5, 6, or 7 and they contain "" (meaning applies to all values) it's not going to work. Either remove the line or explicitly define the values you want to kick. Since the values of the variables above can vary, I don't know of a good way to define an exclusion rule.
Also, it's possible there are other battleye filter files that can cause issues. If you check your battleye logs you can figure out which file is causing a problem.
*The tow actions appear when looking at a vehicle, but do nothing when I select them. How do I fix that?*
Most likely your server is setup with a white list for remote executions. In order to fix this, you need to modify your mission's description.ext file, adding the following CfgRemoteExec rules. If using InfiStar you should edit your cfgremoteexec.hpp instead of the description.ext file. See https://community.bistudio.com/wiki/Arma_3_Remote_Execution for more details on CfgRemoteExec.
```
class CfgRemoteExec
{
class Functions
{
class SA_Simulate_Towing { allowedTargets=0; };
class SA_Attach_Tow_Ropes { allowedTargets=0; };
class SA_Take_Tow_Ropes { allowedTargets=0; };
class SA_Put_Away_Tow_Ropes { allowedTargets=0; };
class SA_Pickup_Tow_Ropes { allowedTargets=0; };
class SA_Drop_Tow_Ropes { allowedTargets=0; };
class SA_Set_Owner { allowedTargets=2; };
class SA_Hint { allowedTargets=1; };
class SA_Hide_Object_Global { allowedTargets=2; };
};
};
```
**Issues & Feature Requests**
https://github.com/sethduda/AdvancedTowing/issues
If anyone wants to help fix any of these, please let me know. You can fork the repo and create a pull request.
**Special Thanks for Testing & Support:**
- Stay Alive Tactical Team (http://sa.clanservers.com)
- BI forum community: diesel tech jc, TeTeT, belbo
- Crimson Gaming for testing on exile (http://crimsongamingau.com)
- DirtySanchez & XLD (exilemod.com) for his great ideas & work to make this functional with Exile
---
The MIT License (MIT)

Binary file not shown.

Binary file not shown.

View File

@ -65,7 +65,7 @@ SA_Simulate_Towing_Speed = {
_maxVehicleSpeed = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "maxSpeed");
_vehicleMass = 1000 max (getMass _vehicle);
_maxTowedCargo = missionNamespace getVariable ["SA_MAX_TOWED_CARGO",2];
_maxTowedCargo = missionNamespace getVariable ["SA_MAX_TOWED_CARGO",1];
_runSimulation = true;
private ["_currentVehicle","_totalCargoMass","_totalCargoCount","_findNextCargo","_towRopes","_ropeLength"];
@ -126,7 +126,6 @@ SA_Simulate_Towing = {
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 };
@ -136,11 +135,11 @@ SA_Simulate_Towing = {
_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
_cargoModelCenterGroundPosition set [2, (_cargoModelCenterGroundPosition select 2) - 0.10]; // 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;
_cargoCornerPoints = [_vehicle] call SA_Get_Corner_Points;
_corner1 = _cargoCornerPoints select 0;
_corner2 = _cargoCornerPoints select 1;
_corner3 = _cargoCornerPoints select 2;
@ -209,31 +208,6 @@ SA_Simulate_Towing = {
_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;
@ -250,7 +224,7 @@ SA_Simulate_Towing = {
};
} else {
if(_lastMovedCargoPosition distance _cargoPosition > 2) then {
_lastCargoHitchPosition = _cargo modelToWorld _cargoHitchModelPos;
_lastCargoVectorDir = vectorDir _cargo;
@ -278,45 +252,19 @@ SA_Simulate_Towing = {
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;
};
private ["_maxWidth","_widthOffset","_maxLength","_lengthOffset"];
_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;
_widthOffset = ((_maxWidth / 2) - abs ( _centerOfMass select 0 )) * 0.75;
_maxLength = abs ((_p2 select 1) - (_p1 select 1));
_lengthOffset = ((_maxLength / 2) - abs (_centerOfMass select 1 )) * _lengthFactor;
_lengthOffset = ((_maxLength / 2) - abs (_centerOfMass select 1 )) * 0.75;
_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];
};
@ -400,6 +348,24 @@ SA_Take_Tow_Ropes = {
};
};
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_Pickup_Tow_Ropes = {
params ["_vehicle","_player"];
if(local _vehicle) then {
@ -409,7 +375,6 @@ SA_Pickup_Tow_Ropes = {
{
_attachedObj ropeDetach _x;
} forEach (_vehicle getVariable ["SA_Tow_Ropes",[]]);
deleteVehicle _attachedObj;
} forEach ropeAttachedObjects _vehicle;
_helper = "Land_Can_V2_F" createVehicle position _player;
{
@ -444,154 +409,69 @@ SA_Drop_Tow_Ropes = {
};
};
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;
};
private ["_vehicle","_towVehicle"];
_vehicle = cursorTarget;
_towVehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull];
if([_vehicle] call SA_Can_Attach_Tow_Ropes) then {
[_vehicle,player] call SA_Attach_Tow_Ropes;
} else {
false;
};
};
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;
private ["_vehicle","_towVehicle","_isCargoBeingTowed","_isCargoTowingCargo","_isChainingEnabled","_isTowVehicleBeingTowed","_isTowVehicleTowingCargo"];
_vehicle = cursorTarget;
[_vehicle] 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;
params ["_cargo"];
private ["_towVehicle","_canBeTowed"];
_towVehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull];
if(!isNull _towVehicle && !isNull _cargo) then {
_canBeTowed = [_towVehicle,_cargo] call SA_Is_Supported_Cargo && vehicle player == player && player distance _cargo < 10 && _towVehicle != _cargo;
if!(missionNamespace getVariable ["SA_TOW_LOCKED_VEHICLES_ENABLED",false]) then {
_canBeTowed = _canBeTowed && locked _cargo <= 1;
};
if!(missionNamespace getVariable ["SA_TOW_IN_EXILE_SAFEZONE_ENABLED",false]) then {
if(!isNil "ExilePlayerInSafezone") then {
_canBeTowed = _canBeTowed && !ExilePlayerInSafezone;
};
};
_canBeTowed;
} else {
false;
};
};
SA_Take_Tow_Ropes_Action = {
private ["_vehicle","_canTakeTowRopes"];
SA_Attach_Tow_Ropes_Action_Disabled_Check = {
private ["_vehicle","_towVehicle"];
_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;
};
_towVehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull];
if(!isNull _towVehicle && !isNull _vehicle) then {
not([_towVehicle,_vehicle] call SA_Is_Supported_Cargo) && vehicle player == player && player distance _vehicle < 10 && _towVehicle != _vehicle;
} else {
false;
};
};
SA_Take_Tow_Ropes_Action_Check = {
[cursorTarget] call SA_Can_Take_Tow_Ropes;
};
SA_Can_Take_Tow_Ropes = {
params ["_vehicle"];
private ["_vehicle"];
_vehicle = cursorTarget;
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;
_towVehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull];
vehicle player == player && player distance _vehicle < 10 && (count _existingTowRopes) == 0 && isNull _towVehicle;
} 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"];
private ["_vehicle"];
_vehicle = cursorTarget;
if([_vehicle] call SA_Is_Supported_Vehicle) then {
_existingTowRopes = _vehicle getVariable ["SA_Tow_Ropes",[]];
vehicle player == player && player distance _vehicle < 10 && (count _existingTowRopes) > 0;
@ -600,64 +480,30 @@ SA_Can_Put_Away_Tow_Ropes = {
};
};
SA_Drop_Tow_Ropes_Action_Check = {
!isNull (player getVariable ["SA_Tow_Ropes_Vehicle", objNull]) && vehicle player == player;
};
SA_Pickup_Tow_Ropes_Action_Check = {
isNull (player getVariable ["SA_Tow_Ropes_Vehicle", objNull]) && count (missionNamespace getVariable ["SA_Nearby_Tow_Vehicles",[]]) > 0 && vehicle player == player;
};
SA_Pickup_Tow_Ropes_Action = {
private ["_nearbyTowVehicles"];
_nearbyTowVehicles = missionNamespace getVariable ["SA_Nearby_Tow_Vehicles",[]];
if(count _nearbyTowVehicles > 0) then {
[_nearbyTowVehicles select 0, player] call SA_Pickup_Tow_Ropes;
};
};
SA_Drop_Tow_Ropes_Action = {
private ["_vehicle"];
_vehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull];
if([] call SA_Can_Drop_Tow_Ropes) then {
if(!isNull _vehicle) 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"
];
@ -680,7 +526,6 @@ SA_TOW_RULES = [
["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"],
@ -722,9 +567,7 @@ SA_Hint = {
SA_Hide_Object_Global = {
params ["_obj"];
if( _obj isKindOf "Land_Can_V2_F" ) then {
hideObjectGlobal _obj;
};
hideObjectGlobal _obj;
};
SA_Set_Owner = {
@ -732,6 +575,23 @@ SA_Set_Owner = {
_obj setOwner _client;
};
SA_Take_Tow_Ropes_Action = {
private ["_vehicle"];
_vehicle = cursorTarget;
if([_vehicle] call SA_Is_Supported_Vehicle) then {
[_vehicle,player] call SA_Take_Tow_Ropes;
};
};
SA_Put_Away_Tow_Ropes_Action = {
private ["_vehicle"];
_vehicle = cursorTarget;
if([_vehicle] call SA_Is_Supported_Vehicle) then {
[_vehicle,player] call SA_Put_Away_Tow_Ropes;
};
};
SA_Add_Player_Tow_Actions = {
player addAction ["Deploy Tow Ropes", {
@ -746,6 +606,10 @@ SA_Add_Player_Tow_Actions = {
[] call SA_Attach_Tow_Ropes_Action;
}, nil, 0, false, true, "", "call SA_Attach_Tow_Ropes_Action_Check"];
player addAction ["Cannot Attach Tow Ropes", {
["Your vehicle not strong enough. Find a larger vehicle!",false] call SA_Hint;
}, nil, 0, false, true, "", "call SA_Attach_Tow_Ropes_Action_Disabled_Check"];
player addAction ["Drop Tow Ropes", {
[] call SA_Drop_Tow_Ropes_Action;
}, nil, 0, false, true, "", "call SA_Drop_Tow_Ropes_Action_Check"];