private void OnComponentInit(EntityUid uid, MedicalScannerComponent scannerComponent, ComponentInit args)
        {
            base.Initialize();

            scannerComponent.BodyContainer = scannerComponent.Owner.EnsureContainer <ContainerSlot>($"{scannerComponent.Name}-bodyContainer");
            UpdateUserInterface(uid, scannerComponent);
        }
        private void AddInsertOtherVerb(EntityUid uid, MedicalScannerComponent component, GetVerbsEvent <InteractionVerb> args)
        {
            if (args.Using == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                IsOccupied(component) ||
                !component.CanInsert(args.Using.Value))
            {
                return;
            }

            string name = "Unknown";

            if (TryComp <MetaDataComponent>(args.Using.Value, out var metadata))
            {
                name = metadata.EntityName;
            }

            InteractionVerb verb = new()
            {
                Act      = () => InsertBody(component.Owner, args.Target, component),
                Category = VerbCategory.Insert,
                Text     = name
            };

            args.Verbs.Add(verb);
        }
        private void AddAlternativeVerbs(EntityUid uid, MedicalScannerComponent component, GetVerbsEvent <AlternativeVerb> args)
        {
            if (!args.CanAccess || !args.CanInteract)
            {
                return;
            }

            // Eject verb
            if (IsOccupied(component))
            {
                AlternativeVerb verb = new();
                verb.Act      = () => EjectBody(uid, component);
                verb.Category = VerbCategory.Eject;
                verb.Text     = Loc.GetString("medical-scanner-verb-noun-occupant");
                args.Verbs.Add(verb);
            }

            // Self-insert verb
            if (!IsOccupied(component) &&
                component.CanInsert(args.User) &&
                _blocker.CanMove(args.User))
            {
                AlternativeVerb verb = new();
                verb.Act  = () => InsertBody(component.Owner, args.User, component);
                verb.Text = Loc.GetString("medical-scanner-verb-enter");
                args.Verbs.Add(verb);
            }
        }
Exemple #4
0
        private void AddAlternativeVerbs(EntityUid uid, MedicalScannerComponent component, GetAlternativeVerbsEvent args)
        {
            if (!args.CanAccess || !args.CanInteract)
            {
                return;
            }

            // Eject verb
            if (component.IsOccupied)
            {
                Verb verb = new();
                verb.Act      = () => component.EjectBody();
                verb.Category = VerbCategory.Eject;
                verb.Text     = Loc.GetString("medical-scanner-verb-noun-occupant");
                args.Verbs.Add(verb);
            }

            // Self-insert verb
            if (!component.IsOccupied &&
                component.CanInsert(args.User) &&
                _actionBlockerSystem.CanMove(args.User))
            {
                Verb verb = new();
                verb.Act  = () => component.InsertBody(args.User);
                verb.Text = Loc.GetString("medical-scanner-verb-enter");
                // TODO VERN ICON
                // TODO VERB CATEGORY
                // create a verb category for "enter"?
                // See also, disposal unit.  Also maybe add verbs for entering lockers/body bags?
                args.Verbs.Add(verb);
            }
        }
        private void OnRelayMovement(EntityUid uid, MedicalScannerComponent scannerComponent, RelayMovementEntityEvent args)
        {
            if (!_blocker.CanInteract(args.Entity, scannerComponent.Owner))
            {
                return;
            }

            EjectBody(uid, scannerComponent);
        }
        private void OnActivated(EntityUid uid, MedicalScannerComponent scannerComponent, ActivateInWorldEvent args)
        {
            if (!this.IsPowered(uid, EntityManager))
            {
                return;
            }

            UpdateUserInterface(uid, scannerComponent);
        }
        private void OnActivated(EntityUid uid, MedicalScannerComponent scannerComponent, ActivateInWorldEvent args)
        {
            if (!TryComp <ActorComponent>(args.User, out var actor) || !IsPowered(scannerComponent))
            {
                return;
            }

            scannerComponent.UserInterface?.Toggle(actor.PlayerSession);
            UpdateUserInterface(uid, scannerComponent);
        }
Exemple #8
0
        private void OnRelayMovement(EntityUid uid, MedicalScannerComponent component, RelayMovementEntityEvent args)
        {
            if (_blocker.CanInteract(args.Entity))
            {
                if (_gameTiming.CurTime <
                    component.LastInternalOpenAttempt + MedicalScannerComponent.InternalOpenAttemptDelay)
                {
                    return;
                }

                component.LastInternalOpenAttempt = _gameTiming.CurTime;
                component.EjectBody();
            }
        }
Exemple #9
0
        private void AddInsertOtherVerb(EntityUid uid, MedicalScannerComponent component, GetInteractionVerbsEvent args)
        {
            if (args.Using == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                component.IsOccupied ||
                !component.CanInsert(args.Using))
            {
                return;
            }

            Verb verb = new();

            verb.Act      = () => component.InsertBody(args.Using);
            verb.Category = VerbCategory.Insert;
            verb.Text     = args.Using.Name;
            args.Verbs.Add(verb);
        }
        private void AddInsertOtherVerb(EntityUid uid, MedicalScannerComponent component, GetVerbsEvent <InteractionVerb> args)
        {
            if (args.Using == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                component.IsOccupied ||
                !component.CanInsert(args.Using.Value))
            {
                return;
            }

            InteractionVerb verb = new();

            verb.Act      = () => component.InsertBody(args.Using.Value);
            verb.Category = VerbCategory.Insert;
            verb.Text     = EntityManager.GetComponent <MetaDataComponent>(args.Using.Value).EntityName;
            args.Verbs.Add(verb);
        }
 private void OnScanButtonPressed(EntityUid uid, MedicalScannerComponent scannerComponent, ScanButtonPressedMessage args)
 {
     TrySaveCloningData(uid, scannerComponent);
 }
 private void HandleDragDropOn(EntityUid uid, MedicalScannerComponent scannerComponent, DragDropEvent args)
 {
     InsertBody(uid, args.Dragged, scannerComponent);
 }
 private void OnDestroyed(EntityUid uid, MedicalScannerComponent scannerComponent, DestructionEventArgs args)
 {
     EjectBody(uid, scannerComponent);
 }