diff --git a/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs b/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs index 2f07cae3b8..09b1972e5f 100644 --- a/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs +++ b/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs @@ -7,15 +7,27 @@ namespace Content.Server.Research.TechnologyDisk.Components; [RegisterComponent] public sealed class DiskConsoleComponent : Component { + /// + /// How much it costs to print a disk + /// [DataField("pricePerDisk"), ViewVariables(VVAccess.ReadWrite)] - public int PricePerDisk = 2500; + public int PricePerDisk = 1000; - [DataField("diskPrototype", customTypeSerializer: typeof(PrototypeIdSerializer))] + /// + /// The prototype of what's being printed + /// + [DataField("diskPrototype", customTypeSerializer: typeof(PrototypeIdSerializer)), ViewVariables(VVAccess.ReadWrite)] public string DiskPrototype = "TechnologyDisk"; - [DataField("printDuration")] + /// + /// How long it takes to print + /// + [DataField("printDuration"), ViewVariables(VVAccess.ReadWrite)] public TimeSpan PrintDuration = TimeSpan.FromSeconds(1); + /// + /// The sound made when printing occurs + /// [DataField("printSound")] public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/printer.ogg"); } diff --git a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs index b784c37d0b..492d1d2471 100644 --- a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs +++ b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs @@ -30,13 +30,14 @@ public sealed class DiskConsoleSystem : EntitySystem { base.Update(frameTime); - foreach (var (printing, console, xform) in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var printing, out var console, out var xform)) { if (printing.FinishTime > _timing.CurTime) continue; - RemComp(printing.Owner, printing); - EntityManager.SpawnEntity(console.DiskPrototype, xform.Coordinates); + RemComp(uid, printing); + Spawn(console.DiskPrototype, xform.Coordinates); } } diff --git a/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs b/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs index e0b10257ac..9db6c837bf 100644 --- a/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs +++ b/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs @@ -42,7 +42,7 @@ public sealed class TechnologyDiskSystem : EntitySystem } } _popup.PopupEntity(Loc.GetString("tech-disk-inserted"), target, args.User); - Del(uid); + QueueDel(uid); args.Handled = true; } @@ -66,10 +66,19 @@ public sealed class TechnologyDiskSystem : EntitySystem if (component.Recipes != null) return; + var lockoutTiers = new Dictionary(); + foreach (var discipline in _prototype.EnumeratePrototypes()) + { + lockoutTiers.Add(discipline.ID, discipline.LockoutTier); + } + //get a list of every distinct recipe in all the technologies. var allTechs = new List(); foreach (var tech in _prototype.EnumeratePrototypes()) { + if (tech.Tier >= lockoutTiers[tech.Discipline]) + continue; + allTechs.AddRange(tech.RecipeUnlocks); } allTechs = allTechs.Distinct().ToList(); @@ -83,7 +92,17 @@ public sealed class TechnologyDiskSystem : EntitySystem allUnlocked = allUnlocked.Distinct().ToList(); //make a list of every single non-unlocked tech - var validTechs = allTechs.Where(tech => !allUnlocked.Contains(tech)).ToList(); + var validTechs = new List(); + foreach (var tech in allTechs) + { + if (allUnlocked.Contains(tech)) + continue; + + validTechs.Add(tech); + } + + if (!validTechs.Any()) + return; //pick one component.Recipes = new();