"""Retain all consumers while correcting only the actual Glint throw actuator."""
import asyncio
from pathlib import Path
import test_equipment_gameplay_real_server as equipment
import test_equipment_resupply as resupply
import test_equipment_bk_yellow_carriers as yellow
from test_equipment_glint_held import release_glint_held
from test_gameplay_real_server import make_parser


class HeldGlintEquipment(yellow.YellowCarrierEquipment):
    async def collect(self,source,location):
        if (source,location)!=(1,65):return await super().collect(source,location)
        previous=resupply.release_glint
        resupply.release_glint=release_glint_held
        try:return await super().collect(source,location)
        finally:resupply.release_glint=previous


async def main(args):
    yellow.YellowCarrierEquipment=HeldGlintEquipment
    equipment.HELPERS.extend(Path(__file__).with_name(name) for name in
        ('test_equipment_glint_held.py','test_equipment_held_glint_continuation.py'))
    await yellow.main(args)


if __name__=='__main__':
    parser=make_parser(__doc__);parser.add_argument('--resume-checkpoint',type=Path)
    asyncio.run(main(parser.parse_args()))
