Skip to content
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

Improve Compatibility of Advanced Slingloading script with CUP Helicopters #5

Open
ComfyPillow opened this issue Apr 5, 2016 · 4 comments
Assignees

Comments

@ComfyPillow
Copy link
Collaborator

Affected Script: comfy-downtime/src/FP_ComfyDowntime.VR/scripts/fn_advancedSlingLoadingInit.sqf

The Advanced Slingloading Script offers slingloading for every helicopter to slingload and every vehicle to be slingloaded.

However it can benefit from a few things.

  1. The Script has this Array, which overrides the mass that the helicopter can lift beyond the helicopter's current mass. We can benefit from adding a few CUP Helicopters such as the MI-6 into the array, as it's lifting capabilities are currenly very underwhelming despite the fact that it is a heavy transport helicopter.
SA_Rope_Get_Lift_Capability = {
    private ["_heli","_heliType"];
    _heli = [_this,0] call BIS_fnc_param;
    _heliType = toLower(typeOf _heli);
    _returnVal = [500,0];
    if(
        //(_heliType) == toLower("B_Heli_Transport_01_F") ||
        //(_heliType) == toLower("B_Heli_Transport_01_camo_F") ||
        (_heliType) == toLower("I_Heli_Transport_02_F")
    ) then {
        _returnVal = [4000,100000];
    };
    if(
        (_heliType) == toLower("B_Heli_Transport_03_F") ||
        (_heliType) == toLower("B_Heli_Transport_03_unarmed_F")
    ) then {
        _returnVal = [10000,100000];
    };
    if(
        (_heliType) == toLower("O_Heli_Transport_04_F") ||
        (_heliType) == toLower("O_Heli_Transport_04_ammo_F")
    ) then {
        _returnVal = [12000,100000];
    };
    _returnVal;
};
  1. The MI-6 Hook currenly has an issue what it's opes spawn inside the cargo space. This is due to an issue with CUP's memory point placement being inside the cargo hold. Maybe we can add a special case to spawn the ropes slightly lower for the Hook (And maybe other future affected helicopters).

The Current solution is to wiggle the helicopter left and right so the ropes fall trough the floor thanks to Arma's realistic simulation of physics.

@ComfyPillow ComfyPillow self-assigned this Apr 5, 2016
@Cuel
Copy link
Contributor

Cuel commented Apr 5, 2016

String comparison ignores case unless using arrays with in / find

alt syntax

_heliType in (["I_Heli_Transport_02_F", "I_Heli_Transport_01_F"] apply {toLower _x})

@WhiteFox08
Copy link
Contributor

I've created a issue for the Mi-6T and A on their github. http://dev.cup-arma3.org/T1399

@ComfyPillow
Copy link
Collaborator Author

ComfyPillow commented Apr 24, 2016

I'v eupdated the Slingloading script to the newest version from upstream. Seems like a lot of things have been updated and changed.

I'm currently taking a look at the script and look for potential places for improvement.

So far, I've found the following code block(s), which I'd like to refactor:

ASL_Add_Player_Actions = {

    player addAction ["Extend Cargo Ropes", { 
        [] call ASL_Extend_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Extend_Ropes_Action_Check"];

    player addAction ["Shorten Cargo Ropes", { 
        [] call ASL_Shorten_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Shorten_Ropes_Action_Check"];

    player addAction ["Release Cargo", { 
        [] call ASL_Release_Cargo_Action;
    }, nil, 0, false, true, "", "call ASL_Release_Cargo_Action_Check"];

    player addAction ["Retract Cargo Ropes", { 
        [] call ASL_Retract_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Retract_Ropes_Action_Check"];

    player addAction ["Deploy Cargo Ropes", { 
        [] call ASL_Deploy_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Deploy_Ropes_Action_Check"];

    player addAction ["Put Away Cargo Ropes", { 
        [] call ASL_Put_Away_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Put_Away_Ropes_Action_Check"];

    player addAction ["Attach To Cargo Ropes", { 
        [] call ASL_Attach_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Attach_Ropes_Action_Check"];

    player addAction ["Drop Cargo Ropes", { 
        [] call ASL_Drop_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Drop_Ropes_Action_Check"];

    player addAction ["Pickup Cargo Ropes", { 
        [] call ASL_Pickup_Ropes_Action;
    }, nil, 0, false, true, "", "call ASL_Pickup_Ropes_Action_Check"];

    player addEventHandler ["Respawn", {
        player setVariable ["ASL_Actions_Loaded",false];
    }];

};

if(!isDedicated) then {
    [] spawn {
        while {true} do {
            if(!isNull player && isPlayer player) then {
                if!( player getVariable ["ASL_Actions_Loaded",false] ) then {
                    [] call ASL_Add_Player_Actions;
                    player setVariable ["ASL_Actions_Loaded",true];
                };
            };
            missionNamespace setVariable ["ASL_Nearby_Vehicles", (call ASL_Find_Nearby_Vehicles)];
            sleep 2;
        };
    };
};

That while{true} loop needs to go. There's no reason to have this. I also want to replace the AddActions with ACE Actions. these are JIP Safe and also work when you are using Zeus to remote-control an AI.
Should also improve the performance a tiny bit, since you don't have 9 AddAction considiton checks being called on every frame for each player, and since we can remove the infinite while block, this should also help a little.

@ComfyPillow
Copy link
Collaborator Author

Uses ACE Interactions now, and removed that terrible while loop.

ASL_Find_Nearby_Vehicles now only gets called when opening the ACE Menu, instead of every 2 seconds for the whole game.

And the 9 Check functions now only get called once when opening the ACE Menu, as opposed to every frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants