Exemplo n.º 1
0
        private void OnTargetScanSuccessful(TargetScanSuccessfulEvent ev)
        {
            if (!EntityManager.TryGetComponent(ev.Scanner, out ForensicScannerComponent? scanner))
            {
                return;
            }

            scanner.CancelToken = null;

            if (!TryComp <ForensicsComponent>(ev.Target, out var forensics))
            {
                return;
            }

            scanner.Fingerprints = forensics.Fingerprints.ToList();
            scanner.Fibers       = forensics.Fibers.ToList();
            scanner.LastScanned  = MetaData(ev.Target).EntityName;
            OpenUserInterface(ev.User, scanner);
        }
        private void OnTargetScanSuccessful(TargetScanSuccessfulEvent args)
        {
            args.Component.CancelToken = null;
            UpdateScannedUser(args.Component.Owner, args.User, args.Target, args.Component);
            // Below is for the traitor item
            // Piggybacking off another component's doafter is complete CBT so I gave up
            // and put it on the same component
            if (string.IsNullOrEmpty(args.Component.Disease) || args.Target == null)
            {
                return;
            }

            _disease.TryAddDisease(args.Target.Value, args.Component.Disease);

            if (args.User == args.Target)
            {
                _popupSystem.PopupEntity(Loc.GetString("disease-scanner-gave-self", ("disease", args.Component.Disease)),
                                         args.User, Filter.Entities(args.User));
                return;
            }
            _popupSystem.PopupEntity(Loc.GetString("disease-scanner-gave-other", ("target", Identity.Entity(args.Target.Value, EntityManager)), ("disease", args.Component.Disease)),
                                     args.User, Filter.Entities(args.User));
        }
 private void OnTargetScanSuccessful(TargetScanSuccessfulEvent args)
 {
     args.Component.CancelToken = null;
     UpdateScannedUser(args.Component.Owner, args.User, args.Target, args.Component);
 }