Skip to content

Commit

Permalink
Maybe fixes test fail?
Browse files Browse the repository at this point in the history
  • Loading branch information
Ermucat committed Dec 25, 2024
1 parent ab3664a commit 789fa6e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 58 deletions.
8 changes: 4 additions & 4 deletions Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ protected override void Open()
// DeltaV - Add number change handler
private void OnNumberChanged(uint newNumber)
{
SendMessage(new AgentIDCardNumberChangedMessage(newNumber));
SendMessage(new AgentIdCardNumberChangedMessage(newNumber));
}

private void OnNameChanged(string newName)
{
SendMessage(new AgentIDCardNameChangedMessage(newName));
SendMessage(new AgentIdCardNameChangedMessage(newName));
}

private void OnJobChanged(string newJob)
{
SendMessage(new AgentIDCardJobChangedMessage(newJob));
SendMessage(new AgentIdCardJobChangedMessage(newJob));
}

public void OnJobIconChanged(ProtoId<JobIconPrototype> newJobIconId)
{
SendMessage(new AgentIDCardJobIconChangedMessage(newJobIconId));
SendMessage(new AgentIdCardJobIconChangedMessage(newJobIconId));
}

/// <summary>
Expand Down
16 changes: 8 additions & 8 deletions Content.Server/Access/Systems/AgentIDCardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public override void Initialize()
SubscribeLocalEvent<AgentIDCardComponent, AfterInteractEvent>(OnAfterInteract);
// BUI
SubscribeLocalEvent<AgentIDCardComponent, AfterActivatableUIOpenEvent>(AfterUIOpen);
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardNameChangedMessage>(OnNameChanged);
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobChangedMessage>(OnJobChanged);
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobIconChangedMessage>(OnJobIconChanged);
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardNumberChangedMessage>(OnNumberChanged); // DeltaV
SubscribeLocalEvent<AgentIDCardComponent, AgentIdCardNameChangedMessage>(OnNameChanged);
SubscribeLocalEvent<AgentIDCardComponent, AgentIdCardJobChangedMessage>(OnJobChanged);
SubscribeLocalEvent<AgentIDCardComponent, AgentIdCardJobIconChangedMessage>(OnJobIconChanged);
SubscribeLocalEvent<AgentIDCardComponent, AgentIdCardNumberChangedMessage>(OnNumberChanged); // DeltaV
}

// DeltaV - Add number change handler
private void OnNumberChanged(Entity<AgentIDCardComponent> ent, ref AgentIDCardNumberChangedMessage args)
private void OnNumberChanged(Entity<AgentIDCardComponent> ent, ref AgentIdCardNumberChangedMessage args)
{
if (!TryComp<NanoChatCardComponent>(ent, out var comp))
return;
Expand Down Expand Up @@ -122,23 +122,23 @@ private void AfterUIOpen(EntityUid uid, AgentIDCardComponent component, AfterAct
_uiSystem.SetUiState(uid, AgentIDCardUiKey.Key, state);
}

private void OnJobChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardJobChangedMessage args)
private void OnJobChanged(EntityUid uid, AgentIDCardComponent comp, AgentIdCardJobChangedMessage args)
{
if (!TryComp<IdCardComponent>(uid, out var idCard))
return;

_cardSystem.TryChangeJobTitle(uid, args.Job, idCard);
}

private void OnNameChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardNameChangedMessage args)
private void OnNameChanged(EntityUid uid, AgentIDCardComponent comp, AgentIdCardNameChangedMessage args)
{
if (!TryComp<IdCardComponent>(uid, out var idCard))
return;

_cardSystem.TryChangeFullName(uid, args.Name, idCard);
}

private void OnJobIconChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardJobIconChangedMessage args)
private void OnJobIconChanged(EntityUid uid, AgentIDCardComponent comp, AgentIdCardJobIconChangedMessage args)
{
if (!TryComp<IdCardComponent>(uid, out var idCard))
return;
Expand Down
55 changes: 9 additions & 46 deletions Content.Shared/Access/SharedAgentIDCardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,79 +41,42 @@ public AgentIDCardBoundUserInterfaceState(string currentName, string currentJob,

// DeltaV - Add number change message
[Serializable, NetSerializable]
public sealed class AgentIDCardNumberChangedMessage : BoundUserInterfaceMessage
public sealed class AgentIdCardNumberChangedMessage : BoundUserInterfaceMessage
{
public uint Number { get; }

public AgentIDCardNumberChangedMessage(uint number)
public AgentIdCardNumberChangedMessage(uint number)
{
Number = number;
}
}

[Serializable, NetSerializable]
public sealed class AgentIDCardNameChangedMessage : BoundUserInterfaceMessage
public sealed class AgentIdCardNameChangedMessage : BoundUserInterfaceMessage
{
public string Name { get; }

public AgentIDCardNameChangedMessage(string name)
public AgentIdCardNameChangedMessage(string name)
{
Name = name;
}
}

[Serializable, NetSerializable]
public sealed class AgentIDCardJobChangedMessage : BoundUserInterfaceMessage
public sealed class AgentIdCardJobChangedMessage : BoundUserInterfaceMessage
{
public string Job { get; }

public AgentIDCardJobChangedMessage(string job)
public AgentIdCardJobChangedMessage(string job)
{
Job = job;
}
}

[Serializable, NetSerializable]
public sealed class AgentIDCardJobIconChangedMessage : BoundUserInterfaceMessage
public sealed class AgentIdCardJobIconChangedMessage(ProtoId<JobIconPrototype> jobIconId)
: BoundUserInterfaceMessage
{
public ProtoId<JobIconPrototype> JobIconId { get; }

public AgentIDCardJobIconChangedMessage(ProtoId<JobIconPrototype> jobIconId)
{
JobIconId = jobIconId;
}
public ProtoId<JobIconPrototype> JobIconId { get; } = jobIconId;
}
}
[Serializable, NetSerializable]
public sealed class AgentIDCardNameChangedMessage : BoundUserInterfaceMessage
{
public string Name { get; }

public AgentIDCardNameChangedMessage(string name)
{
Name = name;
}
}

[Serializable, NetSerializable]
public sealed class AgentIDCardJobChangedMessage : BoundUserInterfaceMessage
{
public string Job { get; }

public AgentIDCardJobChangedMessage(string job)
{
Job = job;
}
}

[Serializable, NetSerializable]
public sealed class AgentIDCardJobIconChangedMessage : BoundUserInterfaceMessage
{
public ProtoId<JobIconPrototype> JobIconId { get; }

public AgentIDCardJobIconChangedMessage(ProtoId<JobIconPrototype> jobIconId)
{
JobIconId = jobIconId;
}
}

0 comments on commit 789fa6e

Please sign in to comment.