コード例 #1
0
 private void OnShutdown(EntityUid uid, PAIComponent component, ComponentShutdown args)
 {
     if (component.MidiAction != null)
     {
         _actionsSystem.RemoveAction(uid, component.MidiAction);
     }
 }
コード例 #2
0
 private void OnStartup(EntityUid uid, PAIComponent component, ComponentStartup args)
 {
     if (component.MidiAction != null)
     {
         _actionsSystem.AddAction(uid, component.MidiAction, null);
     }
 }
コード例 #3
0
 private void OnMindAdded(EntityUid uid, PAIComponent pai, MindAddedMessage args)
 {
     // Mind was added, shutdown the ghost role stuff so it won't get in the way
     if (EntityManager.HasComponent <GhostTakeoverAvailableComponent>(uid))
     {
         EntityManager.RemoveComponent <GhostTakeoverAvailableComponent>(uid);
     }
     UpdatePAIAppearance(uid, PAIStatus.On);
 }
コード例 #4
0
        private void AddWipeVerb(EntityUid uid, PAIComponent pai, GetVerbsEvent <ActivationVerb> args)
        {
            if (!args.CanAccess || !args.CanInteract)
            {
                return;
            }

            if (EntityManager.TryGetComponent <MindComponent>(uid, out var mind) && mind.HasMind)
            {
                ActivationVerb verb = new();
                verb.Text = Loc.GetString("pai-system-wipe-device-verb-text");
                verb.Act  = () => {
                    if (pai.Deleted)
                    {
                        return;
                    }
                    // Wiping device :(
                    // The shutdown of the Mind should cause automatic reset of the pAI during OnMindRemoved
                    // EDIT: But it doesn't!!!! Wtf? Do stuff manually
                    if (EntityManager.HasComponent <MindComponent>(uid))
                    {
                        EntityManager.RemoveComponent <MindComponent>(uid);
                        _popupSystem.PopupEntity(Loc.GetString("pai-system-wiped-device"), uid, Filter.Entities(args.User));
                        PAITurningOff(uid);
                    }
                };
                args.Verbs.Add(verb);
            }
            else if (EntityManager.HasComponent <GhostTakeoverAvailableComponent>(uid))
            {
                ActivationVerb verb = new();
                verb.Text = Loc.GetString("pai-system-stop-searching-verb-text");
                verb.Act  = () => {
                    if (pai.Deleted)
                    {
                        return;
                    }
                    if (EntityManager.HasComponent <GhostTakeoverAvailableComponent>(uid))
                    {
                        EntityManager.RemoveComponent <GhostTakeoverAvailableComponent>(uid);
                        _popupSystem.PopupEntity(Loc.GetString("pai-system-stopped-searching"), uid, Filter.Entities(args.User));
                        PAITurningOff(uid);
                    }
                };
                args.Verbs.Add(verb);
            }
        }
コード例 #5
0
 private void OnExamined(EntityUid uid, PAIComponent component, ExaminedEvent args)
 {
     if (args.IsInDetailsRange)
     {
         if (EntityManager.TryGetComponent <MindComponent>(uid, out var mind) && mind.HasMind)
         {
             args.PushMarkup(Loc.GetString("pai-system-pai-installed"));
         }
         else if (EntityManager.HasComponent <GhostTakeoverAvailableComponent>(uid))
         {
             args.PushMarkup(Loc.GetString("pai-system-still-searching"));
         }
         else
         {
             args.PushMarkup(Loc.GetString("pai-system-off"));
         }
     }
 }
コード例 #6
0
        private void OnUseInHand(EntityUid uid, PAIComponent component, UseInHandEvent args)
        {
            if (args.Handled)
            {
                return;
            }

            // Placeholder PAIs are essentially portable ghost role generators.

            args.Handled = true;

            // Check for pAI activation
            if (EntityManager.TryGetComponent <MindComponent>(uid, out var mind) && mind.HasMind)
            {
                _popupSystem.PopupEntity(Loc.GetString("pai-system-pai-installed"), uid, Filter.Entities(args.User), PopupType.Large);
                return;
            }
            else if (EntityManager.HasComponent <GhostTakeoverAvailableComponent>(uid))
            {
                _popupSystem.PopupEntity(Loc.GetString("pai-system-still-searching"), uid, Filter.Entities(args.User));
                return;
            }

            // Ownership tag
            string val = Loc.GetString("pai-system-pai-name", ("owner", args.User));

            // TODO Identity? People shouldn't dox-themselves by carrying around a PAI.
            // But having the pda's name permanently be "old lady's PAI" is weird.
            // Changing the PAI's identity in a way that ties it to the owner's identity also seems weird.
            // Cause then you could remotely figure out information about the owner's equipped items.

            EntityManager.GetComponent <MetaDataComponent>(component.Owner).EntityName = val;

            var ghostFinder = EntityManager.EnsureComponent <GhostTakeoverAvailableComponent>(uid);

            ghostFinder.RoleName        = Loc.GetString("pai-system-role-name");
            ghostFinder.RoleDescription = Loc.GetString("pai-system-role-description");

            _popupSystem.PopupEntity(Loc.GetString("pai-system-searching"), uid, Filter.Entities(args.User));
            UpdatePAIAppearance(uid, PAIStatus.Searching);
        }
コード例 #7
0
        private void OnUseInHand(EntityUid uid, PAIComponent component, UseInHandEvent args)
        {
            if (args.Handled)
            {
                return;
            }

            // Placeholder PAIs are essentially portable ghost role generators.

            args.Handled = true;

            // Check for pAI activation
            if (EntityManager.TryGetComponent <MindComponent>(uid, out var mind) && mind.HasMind)
            {
                _popupSystem.PopupEntity(Loc.GetString("pai-system-pai-installed"), uid, Filter.Entities(args.User));
                return;
            }
            else if (EntityManager.HasComponent <GhostTakeoverAvailableComponent>(uid))
            {
                _popupSystem.PopupEntity(Loc.GetString("pai-system-still-searching"), uid, Filter.Entities(args.User));
                return;
            }

            // Ownership tag
            string val = Loc.GetString("pai-system-pai-name", ("owner", args.User));

            EntityManager.GetComponent <MetaDataComponent>(component.Owner).EntityName = val;

            var ghostFinder = EntityManager.EnsureComponent <GhostTakeoverAvailableComponent>(uid);

            ghostFinder.RoleName        = Loc.GetString("pai-system-role-name");
            ghostFinder.RoleDescription = Loc.GetString("pai-system-role-description");

            _popupSystem.PopupEntity(Loc.GetString("pai-system-searching"), uid, Filter.Entities(args.User));
            UpdatePAIAppearance(uid, PAIStatus.Searching);
        }
コード例 #8
0
 private void OnMindRemoved(EntityUid uid, PAIComponent component, MindRemovedMessage args)
 {
     // Mind was removed, shutdown the PAI.
     PAITurningOff(uid);
 }