ACE3 icon indicating copy to clipboard operation
ACE3 copied to clipboard

Cargo - Add BI Vehicle in vehicle support

Open Vdauphin opened this issue 4 years ago • 31 comments

When merged this pull request will:

  • This PR choose, when possible, to use the BI Vehicle in Vehicle feature (ViV)
  • When loading an item, the function check if it is possible to load it with ViV
    • If yes load it as ViV
    • If no, check if it would be possible to load it if the vehicle is empty
      • Then unload ViV objects loaded and move them to ACE Cargo and put a pallet to mimic the fact they has been stacked.
  • When unloading an item, the function check if the item has been loaded with ViV and spawn it accordingly

To-do:

  • [x] Need to handle the case where player unload a ViV item without ACE Cargo. ie: As driver, you can unload all ViV item
  • [x] Need to differentiate normal "CargoNet_01_box_F" and ACE "CargoNet_01_box_F"
  • [x] Some people need a pallet fitting WW2 (Land_WoodenBox_02_F)
  • [x] Avoid the creation of two parachutes (one from ViV and one from ACE)
  • [x] Test needed for the last paradrop unloading commit

Concept:

Click here

Here the ViV start to be full: 20201104224822_1 Some objects are migrated to the ACE Cargo system and replace visually by a pallet: 20201104224823_1 Here again the ViV is full so some item are migrated to ACE Cargo: 20201104224824_1 Let's continue to load objects: 20201104224825_1 20201104224826_1 Here again the ViV is full so some item are migrated to ACE Cargo: 20201104224827_1 20201104224828_1 20201104225743_1

Example of behavior when a vehicle is already loaded:

A player can load his vehicle. Objects added after through ACE Cargo will shown 20201106220541_1 20201107162853_1

User experience with vehicle loaded with BI action ViV and objects loaded with ACE cargo:

Click here

20211030001530_1 20211030001028_1 20211030001550_1 20211030001605_1 20211030001615_1

Code to test this PR:

Click here

heli = createVehicle ["B_T_VTOL_01_vehicle_F", player getPos [25, 0], [], 0, "CAN_COLLIDE"];

[{ 
    veh = createVehicle ["B_LSV_01_armed_F", player getPos [25, 45], [], 0, "CAN_COLLIDE"];
    item = createVehicle ["Land_WoodenBox_F", player getPos [25, 90], [], 0, "CAN_COLLIDE"];

    // Vanilla loading, like using the scroll wheel
    heli setVehicleCargo veh;

    // ACE cargo loading, like when you interact with ACE menu
    [
        item, 
        heli, 
        true // just true for easy debug
    ] call ace_cargo_fnc_loadItem;
}] call CBA_fnc_execNextFrame; 
truck  = createVehicle ["B_Truck_01_flatbed_F", player getPos [25, 0], [], 0, "CAN_COLLIDE"]; 
[truck, 25] call ace_cargo_fnc_setSpace;

[{ 
    veh  = createVehicle ["B_T_Quadbike_01_F", player getPos [25, 45], [], 0, "CAN_COLLIDE"]; 
 
    // Vanilla loading, like using the scroll wheel 
    truck setVehicleCargo veh; 
 
    for "_i" from 1 to 8 step 1 do { 
        item  = createVehicle ["Land_WoodenBox_F", player getPos [25, 90], [], 0, "CAN_COLLIDE"]; 
 
        // ACE cargo loading, like when you interact with ACE menu 
        [ 
            item,  
            truck,  
            true // just true for easy debug 
        ] call ace_cargo_fnc_loadItem; 
    }; 
}] call CBA_fnc_execNextFrame; 

Community idea:

  • I would suggest the following: Make a setting that if a vehicle has a ViV config, use that config to read cargo space instead of our config value. Handle loading exclusively through ViV. For virtual objects, place a box of the closest size in ViV. Disable vanilla actions for ViV.
  • I like the idea of just displaying a similarly-sized box tbh (to represent the space like you would have in ACE Cargo now): https://github.com/VurtualRuler98/BoxLoader/

Vdauphin avatar Nov 04 '20 13:11 Vdauphin

Need to handle the case where player unload a ViV item without ACE Cargo. ie: As driver, you can unload all ViV item

we could use engine events for ViV stuff. 🙏 @dedmen

veteran29 avatar Nov 04 '20 15:11 veteran29

I will go for a [{isNull isVehicleCargo _this}, ace_cargo_fnc_unloadItem] call CBA_fnc_waitUntilAndExecute I guess

Vdauphin avatar Nov 04 '20 15:11 Vdauphin

I like this conceptually but play mostly with ww2 mods where the modern style of cargo pallet will not be a great look. Could you include a setting to define a class for the pallet?

Drofseh avatar Nov 04 '20 23:11 Drofseh

Do you have a class name for the WW2 pallet?

Vdauphin avatar Nov 05 '20 11:11 Vdauphin

Do you have a class name for the WW2 pallet?

I'll have a look for something I think is good, but not everyone will run the same ww2 mods as my unit. Some people only run IFA3 or only FOW. That's why I would like the setting to accept a class name.

Drofseh avatar Nov 05 '20 22:11 Drofseh

Land_WoodenBox_02_F would fit, it's a Livonia object too so not mod dependant.

Drofseh avatar Nov 06 '20 06:11 Drofseh

Need to handle the case where player unload a ViV item without ACE Cargo. ie: As driver, you can unload all ViV item

we could use engine events for ViV stuff. pray @dedmen

if you make FT ticket now, and DM me on discord I may be able to get it into 2.02. I'll be gone for a while now and won't read github :u @veteran29

dedmen avatar Dec 19 '20 23:12 dedmen

if you make FT ticket now, and DM me on discord I may be able to get it into 2.02. I'll be gone for a while now and won't read github :u @veteran29

https://feedback.bistudio.com/T155799

veteran29 avatar Dec 20 '20 22:12 veteran29

Btw I completely forgot the ViV events. I'll put them back onto my todo now that I just saw them

dedmen avatar Aug 02 '21 13:08 dedmen

This PR don't need ViV events

Vdauphin avatar Aug 02 '21 15:08 Vdauphin

Did you check unloading in aircraft in air? As ViV does its own parachute stuff, and we'd still want to keep the ACE attached smoke on the drop. Don't know if vanilla has a smoke too?

And if vanilla spawns parachute, then ACE doing it too might interfere. I just read the ViV feedback thread on BIF, and one of the last requests was the ability to disable automatic parachuting because someone wanted to do something custom.

Ah I see you didn't touch the paradropItem function at all? Does detach work properly with ViV? Doesn't it just detach inside the aircraft and make it explode in the air?

dedmen avatar Aug 02 '21 19:08 dedmen

Before this PR, the ViV allow loading vehicle visually (https://community.bistudio.com/wiki/Arma_3:_Vehicle_in_Vehicle_Transport). Before this PR, ACE cargo system load item and hide them under the ground by using attachTo

With this PR, the ViV allow loading vehicle visually (https://community.bistudio.com/wiki/Arma_3:_Vehicle_in_Vehicle_Transport). When you unload this type of vehicle (ie: previously loaded by using normal vanilla scroll menu) all vanilla behavior still apply. I don't change anything here. I just overwrite the vanilla scroll menu Unload all vehicles to a ACE interaction version. This interaction unload only vehicles not loaded inside ACE cargo (https://github.com/acemod/ACE3/pull/7984/files#diff-cb230982fd4f4b1a16f435906c6ea7876b85e5c5860a2c818d6f1a119ba49b4cR4). With this PR, ACE cargo system load item and if possible add them visually to the cargo of the vehicle by using setVehicleCargo but if this command fail I still hide them under the ground by using attachTo. ACE cargo unloading is still not affected here.


Here is some code to help you quickly test (ACE with this PR: https://github.com/acemod/ACE3/actions/runs/823982449)

heli  = createVehicle ["B_T_VTOL_01_vehicle_F", player getPos [25, 0], [], 0, "CAN_COLLIDE"];
veh  = createVehicle ["B_LSV_01_armed_F", player getPos [25, 45], [], 0, "CAN_COLLIDE"];
item  = createVehicle ["Land_WoodenBox_F", player getPos [25, 90], [], 0, "CAN_COLLIDE"];

// Vanilla loading, like using the scroll wheel
heli setVehicleCargo veh;

// ACE cargo loading, like when you interact with ACE menu
[
    item, 
    heli, 
    true // just true for easy debug
] call ace_cargo_fnc_loadItem;

20210802225027_1 The paradrop of each heli and item behave as before.

Keep in mind, this PR is more a visual change than a merging of vanilla ViV and ACE cargo. Each system keep the previous behavior

Vdauphin avatar Aug 02 '21 20:08 Vdauphin

When you unload this type of vehicle (ie: previously loaded by using normal vanilla scroll menu) all vanilla behavior still apply.

Yes thats what I mean, I don't know if vanilla air unloading also attaches chemlight and smoke like ACE does.

This interaction unload only vehicles not loaded inside ACE cargo

Isn't that confusing? you select "unload all" and it only unloads half of the things 🤔

So load vehicle in via ace cargo (uses ViV internally), and then paradrop it in air it will properly use normal ACE Paradrop and not the Vanilla ViV paradrop? That was my question

Because looking at the code you adjusted fnc_unloadItem.sqf properly to work with ViV, but you didn't adjust the paradrop (which is basically a copy of fnc_unloadItem.sqf with extra features)

dedmen avatar Aug 03 '21 19:08 dedmen

Here this is the exact same code, even including comments in fnc_unloadItem.sqf and fnc_paradropItem.sqf But you only updated one of the two.

https://github.com/acemod/ACE3/pull/7984/files#diff-070cc5773079749210aa2488a49801c093617f64895c9dfdf5b20c135a8eab07L52

https://github.com/acemod/ACE3/blob/master/addons/cargo/functions/fnc_paradropItem.sqf#L44

I wonder if thats really intended and if paradrop really works? I imagine you adjust the unload version because you need to adjust it, why do you not need to adjust the paradrop one?

dedmen avatar Aug 03 '21 19:08 dedmen

Isn't that confusing? you select "unload all" and it only unloads half of the things thinking

It is as before. The current behavior is when you "unload all vehicles" you don't unload ACE cargo objects :thinking: If you want to unload object in ACE cargo you use the ACE interaction menu. Also it is pretty clear because the scroll wheel say: "unload all VEHICLES" as you can't load vehicle with ACE cargo the player know what this interaction will unload, ie: vehicles and not objects as objects can only be loaded with ACE cargo

So load vehicle in via ace cargo (uses ViV internally),

No, you can't load vehicle with ACE cargo, only objects.

Here this is the exact same code, even including comments in fnc_unloadItem.sqf and fnc_paradropItem.sqf But you only updated one of the two.

That is correct... I throught the paradrop was just a call of the fnc_unloadItem.sqf and an event handling the paradrop

I wonder if thats really intended and if paradrop really works?

it looks like it is working

I imagine you adjust the unload version because you need to adjust it, why do you not need to adjust the paradrop one?

Because I thought the unloading was handle only by the fnc_unloadItem.sqf and not also by the fnc_paradropItem.sqf :cry: I will adjust it.

Thank you for the input and sorry for the confusion!

Vdauphin avatar Aug 03 '21 20:08 Vdauphin

as you can't load vehicle with ACE cargo

You can if the vehicle is configured to have cargo size. For example I load Quads and Bicycles into ACE Cargo on helicopters quite often when I do Logistics. You can even very simply enable vehicle ACE cargo loading via Eden Editor Attribute, we just did that in a mission on last Saturday where we loaded a bunch of vehicles in ACE Cargo of a C130. So yes you can definitely load vehicles with ACE Cargo.

as objects can only be loaded with ACE cargo

Huh? but your last screenshot shows a ammobox being loaded in ViV? In fact all of your screenshots show non-vehicle Objects being loaded in ViV.

Also it is pretty clear because the scroll wheel say: "unload all VEHICLES" as you can't load vehicle with ACE cargo the player know what this interaction will unload,

Yes but.. It says "unload all VEHICLES" even when you also have non-vehicle objects (wheels, ammoboxes like shown in your screenshots) loaded in ViV. So thats not clear at all if ViV "unload all VEHICLES" also includes non-vehicle objects??

dedmen avatar Aug 04 '21 09:08 dedmen

You can if the vehicle is configured to have cargo size.

We can do what we want in A3. We just need to be consistant

So yes you can definitely load vehicles with ACE Cargo.

Sure but the intended behavior is:

  • ACE cargo to load items/objects by using ACE interaction
  • ViV load only vehicles, you drive the vehicle and use the scroll wheel

It is up to mission maker to change this behavior and change interaction name accordingly.

Huh? but your last screenshot shows a ammobox being loaded in ViV? In fact all of your screenshots show non-vehicle Objects being loaded in ViV.

Yes but there are loaded thought ACE cargo interaction not with vanilla scroll menu.

So thats not clear at all if ViV "unload all VEHICLES" also includes non-vehicle objects??

No because it will unload only vehicles and not items/objects... Also the interaction is not show if only item/objects are loaded (https://github.com/acemod/ACE3/pull/7984/files#diff-9182bb8a0870e1121805b2943f97e5e04eec113876a41b3bd8877ab5f88213f0R4) To unload items/objects the player open the ACE cargo and use the corresponding list.

Vdauphin avatar Aug 04 '21 16:08 Vdauphin

not with vanilla scroll menu.

Everything I'm talking about is exclusively ACE Cargo Loading/Unloading. Not at all talking about vanilla ViV vehicle loading.

To unload items/objects the player open the ACE cargo and use the corresponding list.

Yes but according to your screenshots, these objects are stored in ViV slot (instead of being attachTo'ed underground) and you have to get them outta there on unload.

You load ammobox via ACE Cargo, it appears inside ViV slot (because thats the feature you are adding, right?) Now what happens when you unload that ammobox, in-flight. You need to get it out of ViV, problem is, ViV has its own paradrop/unload in air implementation. And I don't know if the ViV unload command (which you have to use to get the box out of ViV) immediately triggers vanilla parachute (according to BIF posts it does), which means it wouldn't have the ACE parachute and ACE Chemlight and ACE Smokegrenade. Thats my concern. I hope thats clear enough now?

dedmen avatar Aug 04 '21 16:08 dedmen

Yes but according to your screenshots, these objects are stored in ViV slot (instead of being attachTo'ed underground) and you have to get them outta there on unload.

As you can't load item object with scroll menu, the only way to load them is by using ACE cargo. Then when the player will want to unload it, he will use the same path ie: ACE cargo interaction etc. If you use only ACE cargo then the interaction "unload all VEHICLES" will never be shown, so no confusion here.

You load ammobox via ACE Cargo, it appears inside ViV slot (because thats the feature you are adding, right?) Now what happens when you unload that ammobox, in-flight.

it happen this:

20210804191544_1 20210804191549_1

You need to get it out of ViV, problem is, ViV has its own paradrop/unload in air implementation.

I use detach which is not triggering this paradrop implementation. Or I could check if a parachute is already attach and don't add the ACE one. As you want

And I don't know if the ViV unload command (which you have to use to get the box out of ViV) immediately triggers vanilla parachute (according to BIF posts it does),

Yes it does.

which means it wouldn't have the ACE parachute and ACE Chemlight and ACE Smokegrenade. Thats my concern.

No, it would have A3 parachute and ACE parachute and ACE Chemlight and ACE Smokegrenade without the last commit

Vdauphin avatar Aug 04 '21 17:08 Vdauphin

As you can't load item object with scroll menu, the only way to load them is by using ACE cargo.

So am I missunderstanding this ticket and loading a Ammobox via ACE Cargo doesn't make it visibly appear in ViV cargo? I thought thats all this ticket is about

dedmen avatar Aug 04 '21 17:08 dedmen

So am I missunderstanding this ticket and loading a Ammobox via ACE Cargo doesn't make it visibly appear in ViV cargo? I thought thats all this ticket is about

This PR makes ACE Cargo use ViV cargo space if available, nothing else. ACE Cargo functionality is separate from engine ViV. Only cargo space is shared.

Please do not use this place for discussions.

veteran29 avatar Aug 05 '21 11:08 veteran29

This PR makes ACE Cargo use ViV cargo space if available, nothing else.

Yes thats what I thought, and unloading a ViV cargo vehicle via engine command might trigger engine paradrop handling which will conflict with ours. And seeing paradrop code wasn't modified, even though unloading code (which is the exact same block of code) was modified I sensed there might be something wrong. Which is why I asked to make sure.

Certainly confusing when you get told that "This PR makes ACE Cargo use ViV cargo space if available" but also get told "ammoboxes cannot be loaded into ViV" and "Only vehicles get loaded into ViV" and "You cannot load vehicles with ACE Cargo"

All conflicting info, and confusing.

dedmen avatar Aug 06 '21 16:08 dedmen

Is this blocked by something? I was considering making something like this but it seems the work has already been done.

ZluskeN avatar Mar 08 '23 09:03 ZluskeN

@Vdauphin I'm good to review and test? Nothing else to be done here?

BrettMayson avatar May 16 '23 08:05 BrettMayson

Yes sure but it definitely need some testing in "real" condition to find some edge cases

Vdauphin avatar May 16 '23 17:05 Vdauphin

Seems we are still missing: https://github.com/acemod/ACE3/pull/7984#issuecomment-721783599 The engine events were added 3 years ago. But they are not used in this code.

dedmen avatar Jul 14 '24 12:07 dedmen