rekterakathom / Overthrow

A dynamic and persistent revolution platform for Arma 3
https://steamcommunity.com/sharedfiles/filedetails/?id=2824471652
GNU General Public License v2.0
13 stars 11 forks source link

Looting rewrite #120

Open Tuupertunut opened 4 months ago

Tuupertunut commented 4 months ago

Partial rewrite of the looting code, for both recovery truck and recruit looting. Changes a lot of small details but keeps looting working the same on larger scale.

I created two generic inventory management functions: OT_fnc_dumpContainer adds all items from one container to another and OT_fnc_dumpUnitLoadout adds items from unit's loadout to a container. These are based on the latest Arma inventory commands and can correctly copy all items that a container or unit might have, handling all edge cases like half used magazines, weapon attached magazines, items inside backpacks and vests, laser designator batteries, ACE medical item replacements etc. The new looting code uses these functions to handle all inventory management correctly. These will probably replace other inventory management functions in the future, like OT_fnc_dumpStuff and OT_fnc_transferHelper. Ultimately I think the correct place for these generic functions would be CBA so I might make a pull request there at some point (related: https://github.com/CBATeam/CBA_A3/issues/1551).

Outside of inventory management, the looting code now also loots all item piles on the ground. Looting with recruits handles cases like multiple looters looting at the same time. Looters will collect weapons when they visit a body instead of all weapons just teleporting in at the beginning.

See commit messages and code comments for more info.

rekterakathom commented 4 months ago

Awesome work. It might take me a while to review and merge, this needs a lot of testing and maybe some small tweaks here and there.