-
Notifications
You must be signed in to change notification settings - Fork 4
Advanced Towing - Change into seperate Functions #446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Andx667
wants to merge
23
commits into
master
Choose a base branch
from
split-advanced-towing
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
26cb92e
split up, todo check
Andx667 6c17347
move marco to script component
Andx667 2976e74
fix hemtt warnings
Andx667 f3dafdf
Update addons/advancedtowing/functions/fnc_install.sqf
Andx667 ad4f632
Update addons/advancedtowing/functions/fnc_takeTowRopes.sqf
Andx667 33f7a45
Update addons/advancedtowing/functions/fnc_putAwayTowRopes.sqf
Andx667 60423f9
Update addons/advancedtowing/functions/fnc_simulateTowingSpeed.sqf
Andx667 0de4b0b
Update addons/advancedtowing/functions/fnc_takeTowRopesAction.sqf
Andx667 27beb0e
Update addons/advancedtowing/functions/fnc_isSupportedCargo.sqf
Andx667 bb3335d
Update addons/advancedtowing/functions/fnc_addPlayerTowActions.sqf
Andx667 3f1ddfa
Update addons/advancedtowing/functions/fnc_pickupTowRopesAction.sqf
Andx667 9bbc849
Update addons/advancedtowing/functions/fnc_dropTowRopesActionCheck.sqf
Andx667 59c4b8a
Update addons/advancedtowing/functions/fnc_attachTowRopes.sqf
Andx667 1d43916
wip
Andx667 17ce00d
unify gvars
Andx667 4cde213
wip
Andx667 0edaf40
fix errors
Andx667 b114508
wip
Andx667 cbf17f9
wip
Andx667 8edba9a
Merge branch 'master' into split-advanced-towing
Andx667 37666e1
minor refactor
Andx667 3ec0ef4
Merge branch 'master' into split-advanced-towing
Andx667 33b536c
Merge branch 'master' into split-advanced-towing
Andx667 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| //missionNamespace setVariable ["SA_TOW_SUPPORTED_VEHICLES_OVERRIDE", ["rsr_bergepanzer_flecktarn", "rsr_wisent_repair_flecktarn"]]; | ||
| missionNamespace setVariable ["ttt_advancedtowing_Debug_Enabled", true]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,38 @@ | ||
| PREP(initAdvancedTowing); | ||
| PREP(addPlayerTowActions); | ||
| PREP(attachTowRopes); | ||
| PREP(attachTowRopesAction); | ||
| PREP(attachTowRopesActionCheck); | ||
| PREP(canAttachTowRopes); | ||
| PREP(canDropTowRopes); | ||
| PREP(canPickupTowRopes); | ||
| PREP(canPutAwayTowRopes); | ||
| PREP(canTakeTowRopes); | ||
| PREP(customHideObjectGlobal); | ||
| PREP(customHint); | ||
| PREP(customRemoteExec); | ||
| PREP(customRemoteExecServer); | ||
| PREP(customSetOwner); | ||
| PREP(dropTowRopes); | ||
| PREP(dropTowRopesAction); | ||
| PREP(dropTowRopesActionCheck); | ||
| PREP(findNearbyTowVehicles); | ||
| PREP(findSurfaceAGLUnderModel); | ||
| PREP(findSurfaceASLUnderModel); | ||
| PREP(findSurfaceASLUnderPosition); | ||
| PREP(getCargo); | ||
| PREP(getCornerPoints); | ||
| PREP(getHitchPoints); | ||
| PREP(init); | ||
| PREP(isSupportedCargo); | ||
| PREP(isSupportedVehicle); | ||
| PREP(pickupTowRopes); | ||
| PREP(pickupTowRopesAction); | ||
| PREP(pickupTowRopesActionCheck); | ||
| PREP(putAwayTowRopes); | ||
| PREP(putAwayTowRopesAction); | ||
| PREP(putAwayTowRopesActionCheck); | ||
| PREP(simulateTowing); | ||
| PREP(simulateTowingSpeed); | ||
| PREP(takeTowRopes); | ||
| PREP(takeTowRopesAction); | ||
| PREP(takeTowRopesActionCheck); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| #include "script_component.hpp" | ||
|
|
||
| [] call FUNC(initAdvancedTowing); | ||
| [] call FUNC(init); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
addons/advancedtowing/functions/fnc_addPlayerTowActions.sqf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Authors: You | ||
| * Description. | ||
| * | ||
| * Arguments: | ||
| * 0: Argument (optional, default: value) <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Return description <NONE> | ||
| * | ||
| * Example: | ||
| * [params] call PREFIX_advancedtowing_fnc_addPlayerTowActions | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| player addAction ["Take Tow Ropes", { //ToDo Localize | ||
| call FUNC(takeTowRopesAction); | ||
| }, nil, 0, false, true, "", QUOTE([ARR_2(FUNC(takeTowRopesActionCheck),_this)] call CBA_fnc_directCall)]; | ||
|
|
||
| player addAction ["Put Away Tow Ropes", { //ToDo Localize | ||
| call FUNC(putAwayTowRopesAction); | ||
| }, nil, 0, false, true, "", QUOTE([ARR_2(FUNC(putAwayTowRopesActionCheck),_this)] call CBA_fnc_directCall)]; | ||
|
|
||
| player addAction ["Attach To Tow Ropes", { //ToDo Localize | ||
| call FUNC(attachTowRopesAction); | ||
| }, nil, 0, false, true, "", QUOTE([ARR_2(FUNC(attachTowRopesActionCheck),_this)] call CBA_fnc_directCall)]; | ||
|
|
||
| player addAction ["Drop Tow Ropes", { //ToDo Localize | ||
| call FUNC(dropTowRopesAction); | ||
| }, nil, 0, false, true, "", QUOTE([ARR_2(FUNC(dropTowRopesActionCheck),_this)] call CBA_fnc_directCall)]; | ||
|
|
||
| player addAction ["Pickup Tow Ropes", { //ToDo Localize | ||
| call FUNC(pickupTowRopesAction); | ||
| }, nil, 0, false, true, "", QUOTE([ARR_2(FUNC(pickupTowRopesActionCheck),_this)] call CBA_fnc_directCall)]; | ||
|
|
||
| player addEventHandler ["Respawn", { | ||
| player setVariable [QGVAR(Actions_Loaded), false]; | ||
| }]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Authors: You | ||
| * Description. | ||
| * | ||
| * Arguments: | ||
| * 0: Argument (optional, default: value) <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Return description <NONE> | ||
| * | ||
| * Example: | ||
| * [params] call PREFIX_advancedtowing_fnc_attachTowRopes | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_cargo", "_player"]; | ||
|
|
||
| private _vehicle = _player getVariable [QGVAR(Ropes_Vehicle), objNull]; | ||
| private _isRearCargoHitch = false; | ||
|
|
||
| if(!isNull _vehicle) then { | ||
| if(local _vehicle) then { | ||
| private ["_cargoHitch", "_objDistance", "_ropeLength"]; | ||
| private _towRopes = _vehicle getVariable [QGVAR(Ropes), []]; | ||
|
|
||
| if(count _towRopes == 1) then { | ||
|
|
||
| private _cargoHitchPoints = [_cargo] call FUNC(getHitchPoints); | ||
| private _distanceToFrontHitch = player distance (_cargo modelToWorld (_cargoHitchPoints select 0)); | ||
| private _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 FUNC(getHitchPoints)) select 0; | ||
|
|
||
| private _vehicleHitch = ([_vehicle] call FUNC(getHitchPoints)) 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], QFUNC(customHint), _player] call FUNC(customRemoteExec); //ToDo Localize | ||
| } else { | ||
| [_vehicle,_player] call FUNC(dropTowRopes); | ||
| _helper = "Land_Can_V2_F" createVehicle position _cargo; | ||
| _helper attachTo [_cargo, _cargoHitch]; | ||
| _helper setVariable [QGVAR(Cargo), _cargo, true]; | ||
| hideObject _helper; | ||
| [[_helper], QFUNC(customHideObjectGlobal)] call FUNC(customRemoteExecServer); | ||
| [_helper, [0, 0, 0], [0, 0, -1]] ropeAttachTo (_towRopes select 0); | ||
| [_vehicle, _vehicleHitch, _cargo, _cargoHitch, _ropeLength] spawn FUNC(simulateTowing); | ||
| }; | ||
| }; | ||
| } else { | ||
| [_this, QFUNC(attachTowRopes), _vehicle, true] call FUNC(customRemoteExec); | ||
| }; | ||
| }; | ||
36 changes: 36 additions & 0 deletions
36
addons/advancedtowing/functions/fnc_attachTowRopesAction.sqf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Authors: You | ||
| * Description. | ||
| * | ||
| * Arguments: | ||
| * 0: Argument (optional, default: value) <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Return description <NONE> | ||
| * | ||
| * Example: | ||
| * [params] call PREFIX_advancedtowing_fnc_attachTowRopesAction | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| private _cargo = cursorTarget; | ||
| private _vehicle = player getVariable [QGVAR(Ropes_Vehicle), objNull]; | ||
|
|
||
| if([_vehicle, _cargo] call FUNC(canAttachTowRopes)) then { | ||
|
|
||
| private _canBeTowed = true; | ||
|
|
||
| if!(missionNamespace getVariable [QGVAR(Locked_Vehicles_Enabled), false]) then { | ||
| if( locked _cargo > 1 ) then { | ||
| ["Cannot attach tow ropes to locked vehicle", false] call FUNC(customHint);//ToDo Localize | ||
| _canBeTowed = false; | ||
| }; | ||
| }; | ||
|
|
||
| if(_canBeTowed) then { | ||
| [_cargo, player] call FUNC(attachTowRopes); | ||
| }; | ||
|
|
||
| }; |
21 changes: 21 additions & 0 deletions
21
addons/advancedtowing/functions/fnc_attachTowRopesActionCheck.sqf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Authors: You | ||
| * Description. | ||
| * | ||
| * Arguments: | ||
| * 0: Argument (optional, default: value) <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Return description <NONE> | ||
| * | ||
| * Example: | ||
| * [params] call PREFIX_advancedtowing_fnc_attachTowRopesActionCheck | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| private _vehicle = player getVariable [QGVAR(Ropes_Vehicle), objNull]; | ||
| private _cargo = cursorTarget; | ||
|
|
||
| [_vehicle, _cargo] call FUNC(canAttachTowRopes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Authors: You | ||
| * Description. | ||
| * | ||
| * Arguments: | ||
| * 0: Argument (optional, default: value) <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Return description <NONE> | ||
| * | ||
| * Example: | ||
| * [params] call PREFIX_advancedtowing_fnc_canAttachTowRopes | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_vehicle", "_cargo"]; | ||
|
|
||
| if(!isNull _vehicle && !isNull _cargo) then { | ||
| [_vehicle, _cargo] call FUNC(isSupportedCargo) && isNull objectParent player && player distance _cargo < 10 && _vehicle != _cargo; | ||
| } else { | ||
| false; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Authors: You | ||
| * Description. | ||
| * | ||
| * Arguments: | ||
| * 0: Argument (optional, default: value) <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Return description <NONE> | ||
| * | ||
| * Example: | ||
| * [params] call PREFIX_advancedtowing_fnc_canDropTowRopes | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| !isNull (player getVariable [QGVAR(Ropes_Vehicle), objNull]) && isNull objectParent player; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Authors: You | ||
| * Description. | ||
| * | ||
| * Arguments: | ||
| * 0: Argument (optional, default: value) <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Return description <NONE> | ||
| * | ||
| * Example: | ||
| * [params] call PREFIX_advancedtowing_fnc_canPickupTowRopes | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| isNull (player getVariable [QGVAR(Ropes_Vehicle), objNull]) && count (missionNamespace getVariable [QGVAR(Nearby_Tow_Vehicles), []]) > 0 && isNull objectParent player; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.