If you use the item approach, I’m not really sure how you would do either of those things. However, if you use the approach where you approximate the vehicle as a liquid, the vehicle is everywhere in the flatbed that contains the theoretical liquid.
Here is how I think it would work (limited programming expertise, so bear with me here):
Starting Assumptions:
1.) The volume of a vehicle tile is the same regardless of what kind of part it is, or how many parts are in that tile.
2.) Each flatbed tile has a storage volume equal to the volume of a vehicle tile. Items stored within the vehicle being loaded will be ignored for purposes of vehicle volume.
Operation:
1.) A dimensional comparison check will be done to confirm that the width/length of the flatbed is greater than or equal to that of the vehicle being loaded. Additionally, the program will check the inverse of the vehicle dimension vs the flatbed (to simulate loading the vehicle sideways). Inverse loading configuration will always take priority, to allow more vehicles to be crammed into a flatbed truck where possible (no point in a 1x3 motorbike that can be arranged sideways preventing a car from being loaded due to insufficient length).
2.) If true, the flatbed tiles will then be “filled” from left to right, starting at the top left corner.
3.) After each flatbed tile is filled, there should be a check to see if the width of the flatbed that has been filled “X” equals the width of the vehicle being loaded. If true, go to next row.
4.) If any of the flatbed tiles take damage above a certain amount, you could “spill” a bit of your liquefied vehicle stored in that area, and when it gets spawned during unloading, that tile will take a proportional amount of damage. If the flatbed is damaged beyond repair but not outright destroyed (greyed out), the vehicle tile its holding would be too.
5.) If a flatbed tile is outright destroyed, the items and materials from that tile on the stored vehicle could be dropped onto the ground at the time of destruction (this might be difficult to implement, I’m not sure).