Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding intellicard functionality. #32347

Merged
merged 18 commits into from
Oct 22, 2024
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 @@ -255,13 +276,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 @@ -360,7 +384,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.
Loading