From 2e75836d457cbd402830b1ab0a22055d3477e96c Mon Sep 17 00:00:00 2001 From: sethduda Date: Sun, 27 Mar 2016 09:21:03 -0400 Subject: [PATCH] Updates to actions --- addons/SA_AdvancedTowing.pbo | Bin 28811 -> 30597 bytes ...A_AdvancedTowing.pbo.AdvancedTowing.bisign | Bin 567 -> 567 bytes .../functions/fn_advancedTowingInit.sqf | 265 ++++++++++++------ 3 files changed, 173 insertions(+), 92 deletions(-) diff --git a/addons/SA_AdvancedTowing.pbo b/addons/SA_AdvancedTowing.pbo index 8083bf2b150fcd2176f6869f6f563c4c262e685f..4cec3183ce282dc53ee0ae0f3b4bf8cd017123e0 100644 GIT binary patch delta 2082 zcmb7^%TE(g6vjgX^AP zqeIioq-)}QI?%sRnD*P$3ivtL1&>FSx;Aq#M92FWA3MuTnyDUDSt(vfOtEmC(tz7P zP#p+fWTqpb7}F+fJaV+^a2Sab6HzbX5-A2}!!75SD-v!&F*X!sCJ~>5j-n23rKJJ0osP#@4)OOx96O5=>!{C37f3y>^copD)>xJuJY#7?vDO#lpp){8S4p zyNvK~v=W!pt`tH@h1X7&7XL4-0qTZ22s{!AeoYZ-Zbl|pAJxGJstjtJ6E#9jkf~Rw zEvz}3;gw4ZXDPj!$LXV^1gM9U6Bfs;CAicd%8+o5OOoDasR^K!F_7ne(n@!o24&{#}L*PlgK+O zSdQGgOXM>t+__jmf*sdhXnMgiq>U^B^sVAM;eI$T_uTrj4mOJH^Jo+NCINp|h};34 zn~i+jW(H?a1xuddz1!FTpT?ITTcKq0PsR@Q@X}UOK*0ia1dh9H(B+wfMUNggZz}}+ zJ(_^rQ2lr$Vu%P{`z^3IPzg?NZO$01g!i@Z#S?;YdmR{k2aNnMa7RMX)Qo5m;yw|N z!#AeQ(&K}PZK^W15kj$7;Ips6l$o<+^2raCTgkUuE8z>G)QrSQc?L+k=q1^Uu=q}_ zWX*4-E&AD0#IWh4oXW&VNHmfxLh7TBzWy?Pir~u5fyHa7louaXj@5#GNL9@jH;9o1 u`4N7``y##Sf1pekpQ})$e~jO$s&%H{e%JllSYLe;zWvm`>S}to82bl97p*q{ delta 1022 zcmZ`%OK1~e5GKJsl9HOn#HO(^e^QgG#F|=7Au+9aqHPk?NZRcqVY}V#hQ?h;HkMLK z5iNqDppFHF;^Qa?Qi2CB3f@Ey^)6z?izhu4AN8RBW;gA&;9-AuX1;Ico5$ieRe4=? zE2cgcynWVN-x2(op1r(!eOg`D<2iAvr?R1*=&NkTTGVhfqlcwT1K4`CcaArLt=|p$ zXcIgS-mh?>@*Ze9cTy|xGijR5QF$6RQ}(*7Xv5dxD1`h5@Ft8fK5)m z5|u)GLIVSSE!G%SQSjYt>JYZFh@~i!3(=T_YmEDKT1~C9h|ZoXCQJD|k~|L*hl~m^ z3ZPLbU`w>Zhr~tGc3NZ)APmL5`e9+r1HJ*bcPCY8xm+mEQ`7XM%t5CEs9RK`nfJrh zvGPGBxSF^o7-6a%^y4OL6^`)|OMDe1=uf)vI?TD)yl`0RUW&Nk<&dqex;^L~u|ikM*;XBnOcdvFMf&$^;7rm7wjmunjPHX# zDKD%Ikz4l^1XGGtsuH#Tjv2tp=-^)5A`?Es65)gmf`ZOWC)~|E!#CWD8#2I+5d*v! z8Ff*7i4#zkqshX=EMBjCH$~KkJV%hg(j1!8X<=Du#<+w>iqC7qxdJAZWwZS&9u}*l(m>X+b1cJ3!zA#IB Zjp%0iz5CJZde4u?mM5#-&Sl5zm4Egxa>W1u diff --git a/addons/SA_AdvancedTowing.pbo.AdvancedTowing.bisign b/addons/SA_AdvancedTowing.pbo.AdvancedTowing.bisign index f4ce3a244d35800511c3f358fd8aa0d859a18a21..cfd4f9759b48cd1aaf858fb4cb80b0a9d02a9145 100644 GIT binary patch delta 406 zcmV;H0crlX1h)i`tA9BbY~#Oz!GSW77Ay0$`-?+0+;E%~zfq-dY8@l4q%;p83WurB zxJTJn%i;mCrc`SIhn3ukpH;<{g`WX~PT_lF2d?Zj&xgZDz0lqsR=;RbtlhA*U6aL6 zE@hOGioM!*bJr+;>)-jhfSUJY^d#FZhSlUk?*bgR^~PC57k@kg0001h0000@U1GL2 zuiSC#0!ZfOWN~=8Vqvmu4s#&CLinX2HO*n&%v0K7F|B*)0&|W7IHY62@1wHvA059} z_#;waEQ(xCt%saLwZZ~|K~5aqZ}l%pm8qfWS82uurW?s3%xQVPd(upVUQ|9n8rOK& zrp5NLTlVMTVBR-OSRj1)p~3mf AsQ>@~ delta 406 zcmV;H0crlX1h)i`tAB_SqQL6ZFVvuqX*T%lO0B`%R8}449ABEA598TJO`!GNMt_dr zC+wXCnM6tF=b}ty6;3Xj0kbJq+s8D<-6-NK?P$w?j)~gGEg)s$fFS2hHybZR^s{LD z6FMiSS^p7D@ZySkh)iOtu+@EBt)_-yG!BGT52MeI?eVQzc7HYk0001h0001m0A`C^ z8oqEqH5S+pc|CJnSmln}IrlTr1SpYPKl=afB*mhfjoti9^AQ|41=^e;uU@3<0r<&v1A0ISK?cc^tcUEp(sbto_piokzdruB~^IUFKEi~cKnM z+MckWH^=mJQel;L4PGYYaG@g+DHJHoEBd~_gdhVwl@ALLRy84MS29Q`SccpcMRLKu A%m4rY diff --git a/addons/SA_AdvancedTowing/functions/fn_advancedTowingInit.sqf b/addons/SA_AdvancedTowing/functions/fn_advancedTowingInit.sqf index cb31c2a..a25fcde 100644 --- a/addons/SA_AdvancedTowing/functions/fn_advancedTowingInit.sqf +++ b/addons/SA_AdvancedTowing/functions/fn_advancedTowingInit.sqf @@ -348,24 +348,6 @@ 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 { @@ -375,6 +357,7 @@ 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; { @@ -409,69 +392,154 @@ SA_Drop_Tow_Ropes = { }; }; -SA_Attach_Tow_Ropes_Action = { - 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; +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 { - false; + [_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","_towVehicle","_isCargoBeingTowed","_isCargoTowingCargo","_isChainingEnabled","_isTowVehicleBeingTowed","_isTowVehicleTowingCargo"]; - _vehicle = cursorTarget; - [_vehicle] call SA_Can_Attach_Tow_Ropes; + 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 ["_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; + 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_Attach_Tow_Ropes_Action_Disabled_Check = { - private ["_vehicle","_towVehicle"]; +SA_Take_Tow_Ropes_Action = { + private ["_vehicle","_canTakeTowRopes"]; _vehicle = cursorTarget; - _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; + 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 = { - private ["_vehicle"]; - _vehicle = cursorTarget; + [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",[]]; - _towVehicle = player getVariable ["SA_Tow_Ropes_Vehicle", objNull]; - vehicle player == player && player distance _vehicle < 10 && (count _existingTowRopes) == 0 && isNull _towVehicle; + _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_Check = { - private ["_vehicle"]; +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; @@ -480,30 +548,64 @@ SA_Put_Away_Tow_Ropes_Action_Check = { }; }; -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(!isNull _vehicle) then { + 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" ]; @@ -575,23 +677,6 @@ 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", { @@ -606,10 +691,6 @@ 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"];