private const string PaperSlotId = "Paper";
- /// <summary>
- /// The prototype ID to use for faxed or copied entities if we can't get one from
- /// the paper entity for whatever reason.
- /// </summary>
- [ValidatePrototypeId<EntityPrototype>]
- private const string DefaultPaperPrototypeId = "Paper";
-
- [ValidatePrototypeId<EntityPrototype>]
- private const string OfficePaperPrototypeId = "PaperOffice";
-
public override void Initialize()
{
base.Initialize();
return;
}
- _adminLogger.Add(LogType.Action, LogImpact.Low,
+ _adminLogger.Add(LogType.Action,
+ LogImpact.Low,
$"{ToPrettyString(args.User):user} renamed {ToPrettyString(uid):tool} from \"{component.FaxName}\" to \"{newName}\"");
component.FaxName = newName;
_popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-name-set"), uid);
private void OnCopyButtonPressed(EntityUid uid, FaxMachineComponent component, FaxCopyMessage args)
{
if (HasComp<MobStateComponent>(component.PaperSlot.Item))
- _faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob.
+ _faxecute.Faxecute(uid, component); // when button pressed it will hurt the mob.
else
Copy(uid, component, args);
}
private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args)
{
if (HasComp<MobStateComponent>(component.PaperSlot.Item))
- _faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob.
+ _faxecute.Faxecute(uid, component); // when button pressed it will hurt the mob.
else
Send(uid, component, args);
}
/// </summary>
public void PrintFile(EntityUid uid, FaxMachineComponent component, FaxFileMessage args)
{
- string prototype;
- if (args.OfficePaper)
- prototype = OfficePaperPrototypeId;
- else
- prototype = DefaultPaperPrototypeId;
+ var prototype = args.OfficePaper ? component.PrintOfficePaperId : component.PrintPaperId;
var name = Loc.GetString("fax-machine-printed-paper-name");
// Unfortunately, since a paper entity does not yet exist, we have to emulate what LabelSystem will do.
var nameWithLabel = (args.Label is { } label) ? $"{name} ({label})" : name;
- _adminLogger.Add(LogType.Action, LogImpact.Low,
+ _adminLogger.Add(LogType.Action,
+ LogImpact.Low,
$"{ToPrettyString(args.Actor):actor} " +
$"added print job to \"{component.FaxName}\" {ToPrettyString(uid):tool} " +
$"of {nameWithLabel}: {args.Content}");
var printout = new FaxPrintout(paper.Content,
nameMod?.BaseName ?? metadata.EntityName,
labelComponent?.CurrentLabel,
- metadata.EntityPrototype?.ID ?? DefaultPaperPrototypeId,
+ metadata.EntityPrototype?.ID ?? component.PrintPaperId,
paper.StampState,
paper.StampedBy,
paper.EditingDisabled);
UpdateUserInterface(uid, component);
- _adminLogger.Add(LogType.Action, LogImpact.Low,
+ _adminLogger.Add(LogType.Action,
+ LogImpact.Low,
$"{ToPrettyString(args.Actor):actor} " +
$"added copy job to \"{component.FaxName}\" {ToPrettyString(uid):tool} " +
$"of {ToPrettyString(sendEntity):subject}: {printout.Content}");
// TODO: Ideally, we could just make a copy of the whole entity when it's
// faxed, in order to preserve visuals, etc.. This functionality isn't
// available yet, so we'll pass along the originating prototypeId and fall
- // back to DefaultPaperPrototypeId in SpawnPaperFromQueue if we can't find one here.
+ // back to component.PrintPaperId in SpawnPaperFromQueue if we can't find one here.
payload[FaxConstants.FaxPaperPrototypeData] = metadata.EntityPrototype.ID;
}
_deviceNetworkSystem.QueuePacket(uid, component.DestinationFaxAddress, payload);
- _adminLogger.Add(LogType.Action, LogImpact.Low,
+ _adminLogger.Add(LogType.Action,
+ LogImpact.Low,
$"{ToPrettyString(args.Actor):actor} " +
$"sent fax from \"{component.FaxName}\" {ToPrettyString(uid):tool} " +
$"to \"{faxName}\" ({component.DestinationFaxAddress}) " +
var printout = component.PrintingQueue.Dequeue();
- var entityToSpawn = printout.PrototypeId.Length == 0 ? DefaultPaperPrototypeId : printout.PrototypeId;
+ var entityToSpawn = printout.PrototypeId.Length == 0 ? component.PrintPaperId.ToString() : printout.PrototypeId;
var printed = EntityManager.SpawnEntity(entityToSpawn, Transform(uid).Coordinates);
if (TryComp<PaperComponent>(printed, out var paper))