FlightControl-Master / MOOSE

Mission Object Oriented Scripting Environment (MOOSE) for lua mission scripting design in DCS World
http://flightcontrol-master.github.io/MOOSE/
GNU General Public License v3.0
292 stars 94 forks source link

Update Set.lua: added handler for EVENTS.PlayerLeaveUnit in SET_GROUP… #2134

Closed DarthZyll closed 1 month ago

DarthZyll commented 1 month ago

…:FilterStart()

Ops.CSAR was throwing the following errors constantly when a player would leave the CSAR helo:

GROUP05000.GetDCSObject((ERROR: Could not get DCS group object of group Archer-1 because DCS object could not be found!))

This was because the SET_GROUP FilterStart on allheligroupset was not handling the scenario when a player left w/o a death.

I believe other FilterStart() funcs should also be revisited, such as SET_UNIT:FilterStart() and SET_OPSGROUP:FilterStart(), but my change was only tested with SET_GROUP:FilterStart()

Applevangelist commented 1 month ago

Good find! What about multi-crew units and someone leaves, then this would remove the group, too?

DarthZyll commented 1 month ago

That's a good question I have not considered. Let me test with a multi crew aircraft and CSAR with a friend and will get back to you

DarthZyll commented 1 month ago

Happy to report that it actually worked as expected. We tested these scenarios within Ops.CSAR with the SET_GROUP:FilterStart() including the EVENTS.PlayerLeaveUnit event.

One person in single player helo, another person in a single player helo - csarUnits table shows both aircraft as active (pass) One person leaves their helo - csarUnits now shows only one aircraft as active (pass) Second person leaves their helo - csarUnits is empty (pass) One person joins a two-seater Apache - csarUnits table shows one aircraft as active (pass) Second person joins the Apache - csarUnits table remains unchanged, one aircraft as active (pass) CPG leaves the Apache - csarUnits table remains unchanged, one aircraft as active (pass) Pilot leaves the Apache (despawn) - csarUnits is empty (pass)

I'm puzzled how its actually working, but the testing was thorough, and it works as expected.