Skip to content

Commit

Permalink
Adding intellicard functionality. (#32347)
Browse files Browse the repository at this point in the history
* init

* im so confused

* clean

* sprite update

* :|

* further attempts

* be blessed for it works

* Very prestigious pAI

* cleaning up

* Intellicard in RD locker

* PAIn't

* .Clear()n't

* .Clear()n't for real this time

* Cleaning up

* Whoopsie Daisy
  • Loading branch information
ScarKy0 authored Oct 22, 2024
1 parent fc2bb79 commit 9873efd
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ private void OnAiMapInit(Entity<StationAiCoreComponent> ent, ref MapInitEvent ar

private bool SetupEye(Entity<StationAiCoreComponent> ent)
{
if (_net.IsClient)
return false;
if (ent.Comp.RemoteEntity != null)
return false;

Expand All @@ -299,8 +301,11 @@ private bool SetupEye(Entity<StationAiCoreComponent> ent)

private void ClearEye(Entity<StationAiCoreComponent> ent)
{
if (_net.IsClient)
return;
QueueDel(ent.Comp.RemoteEntity);
ent.Comp.RemoteEntity = null;
Dirty(ent);
}

private void AttachEye(Entity<StationAiCoreComponent> ent)
Expand Down Expand Up @@ -330,6 +335,8 @@ private void OnAiInsert(Entity<StationAiCoreComponent> ent, ref EntInsertedIntoC
if (_timing.ApplyingState)
return;

SetupEye(ent);

// Just so text and the likes works properly
_metadata.SetEntityName(ent.Owner, MetaData(args.Entity).EntityName);

Expand All @@ -351,6 +358,7 @@ private void OnAiRemove(Entity<StationAiCoreComponent> ent, ref EntRemovedFromCo
{
_eye.SetTarget(args.Entity, null, eyeComp);
}
ClearEye(ent);
}

private void UpdateAppearance(Entity<StationAiHolderComponent?> entity)
Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/UserInterface/IntrinsicUISystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public sealed class IntrinsicUISystem : EntitySystem
public override void Initialize()
{
SubscribeLocalEvent<IntrinsicUIComponent, MapInitEvent>(InitActions);
SubscribeLocalEvent<IntrinsicUIComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<IntrinsicUIComponent, ToggleIntrinsicUIEvent>(OnActionToggle);
}

Expand All @@ -21,6 +22,15 @@ private void OnActionToggle(EntityUid uid, IntrinsicUIComponent component, Toggl
args.Handled = InteractUI(uid, args.Key, component);
}

private void OnShutdown(EntityUid uid, IntrinsicUIComponent component, ref ComponentShutdown args)
{
foreach (var actionEntry in component.UIs.Values)
{
var actionId = actionEntry.ToggleActionEntity;
_actionsSystem.RemoveAction(uid, actionId);
}
}

private void InitActions(EntityUid uid, IntrinsicUIComponent component, MapInitEvent args)
{
foreach (var entry in component.UIs.Values)
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Catalog/Fills/Lockers/heads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
id: LockerFillResearchDirectorNoHardsuit
table: !type:AllSelector
children:
- id: Intellicard
- id: BoxEncryptionKeyScience
- id: CircuitImprinterMachineCircuitboard
- id: ClothingBeltUtilityFilled
Expand Down
29 changes: 26 additions & 3 deletions Resources/Prototypes/Entities/Mobs/Player/silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@
title: comms-console-announcement-title-station-ai
color: "#2ed2fd"

- type: entity
id: AiHeldIntellicard
description: Components added / removed from an entity that gets inserted into an Intellicard.
categories: [ HideSpawnMenu ]
components:
- type: IntrinsicRadioReceiver
- type: IntrinsicRadioTransmitter
channels:
- Binary
- type: ActiveRadio
channels:
- Binary
- Common
- type: ActionGrant
actions:
- ActionAIViewLaws
- type: UserInterface
interfaces:
enum.SiliconLawsUiKey.Key:
type: SiliconLawBoundUserInterface

# Ai
- type: entity
Expand All @@ -82,7 +102,8 @@
- type: StationAiHolder
slot:
name: station-ai-mind-slot
locked: true
locked: false
disableEject: true
whitelist:
tags:
- StationAi
Expand Down Expand Up @@ -256,13 +277,16 @@
# Items
- type: entity
id: Intellicard
name: Intellicard
name: intellicard
description: A storage device for AIs.
parent:
- BaseItem
- AiHolder
suffix: Empty
components:
- type: ContainerComp
proto: AiHeldIntellicard
container: station_ai_mind_slot
- type: Sprite
sprite: Objects/Devices/ai_card.rsi
layers:
Expand Down Expand Up @@ -361,7 +385,6 @@
enum.SiliconLawsUiKey.Key:
type: SiliconLawBoundUserInterface
- type: ComplexInteraction
- type: DoorRemote
- type: Actions
- type: Access
groups:
Expand Down
Binary file modified Resources/Textures/Objects/Devices/ai_card.rsi/base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/Textures/Objects/Devices/ai_card.rsi/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/Textures/Objects/Devices/ai_card.rsi/full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9873efd

Please sign in to comment.