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

Intellicards now have a doAfter. #33198

Merged
merged 11 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Content.Server/Silicons/StationAi/StationAiSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override void AnnounceIntellicardUsage(EntityUid uid, SoundSpecifier? cue
if (!TryComp<ActorComponent>(uid, out var actor))
return;

var msg = Loc.GetString("ai-intellicard-download-warning");
var msg = Loc.GetString("ai-consciousness-download-warning");
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", msg));
_chats.ChatMessageToOne(ChatChannel.Server, msg, wrappedMessage, default, false, actor.PlayerSession.Channel, colorOverride: Color.Red);

Expand Down
23 changes: 15 additions & 8 deletions Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,29 @@ private void OnHolderInteract(Entity<StationAiHolderComponent> ent, ref AfterInt
if (!TryComp(args.Used, out IntellicardComponent? intelliComp))
return;

var isUploading = _slots.CanEject(ent.Owner, args.User, ent.Comp.Slot);
var isDownloading = _slots.CanEject(args.Target.Value, args.User, targetHolder.Slot);
var cardHasAi = _slots.CanEject(ent.Owner, args.User, ent.Comp.Slot);
var coreHasAi = _slots.CanEject(args.Target.Value, args.User, targetHolder.Slot);

if (isUploading == isDownloading)
if (cardHasAi && coreHasAi)
{
_popup.PopupClient(Loc.GetString("intellicard-core-occupied"), args.User, args.User, PopupType.Medium);
args.Handled = true;
return;
}
if (!cardHasAi && !coreHasAi)
{
_popup.PopupClient(Loc.GetString("intellicard-core-empty"), args.User, args.User, PopupType.Medium);
args.Handled = true;
return;
}

if (TryGetHeldFromHolder((args.Target.Value, targetHolder), out var held) && _timing.CurTime > intelliComp.NextWarningAllowed)
{
intelliComp.NextWarningAllowed = _timing.CurTime + intelliComp.WarningDelay;
AnnounceIntellicardUsage(held, intelliComp.WarningSound);
}

var doAfterArgs = new DoAfterArgs(EntityManager, args.User, isUploading ? intelliComp.UploadTime : intelliComp.DownloadTime, new IntellicardDoAfterEvent(), args.Target, ent.Owner)
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, cardHasAi ? intelliComp.UploadTime : intelliComp.DownloadTime, new IntellicardDoAfterEvent(), args.Target, ent.Owner)
{
BreakOnDamage = true,
BreakOnMove = true,
Expand Down Expand Up @@ -469,10 +479,7 @@ public sealed partial class JumpToCoreEvent : InstantActionEvent
}

[Serializable, NetSerializable]
public sealed partial class IntellicardDoAfterEvent : SimpleDoAfterEvent
{

}
public sealed partial class IntellicardDoAfterEvent : SimpleDoAfterEvent;


[Serializable, NetSerializable]
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/intellicard/intellicard.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# General
intellicard-core-occupied = The core is already occupied.
ScarKy0 marked this conversation as resolved.
Show resolved Hide resolved
intellicard-core-empty = The core is empty.
ScarKy0 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/silicons/station-ai.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ toggle-light = Toggle light

ai-device-not-responding = Device is not responding

ai-intellicard-download-warning = Your consciousness is being downloaded.
ai-consciousness-download-warning = Your consciousness is being downloaded.
Loading