tech disk 1984 (no tier 3) (#16646)
This commit is contained in:
@@ -7,15 +7,27 @@ namespace Content.Server.Research.TechnologyDisk.Components;
|
||||
[RegisterComponent]
|
||||
public sealed class DiskConsoleComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How much it costs to print a disk
|
||||
/// </summary>
|
||||
[DataField("pricePerDisk"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public int PricePerDisk = 2500;
|
||||
public int PricePerDisk = 1000;
|
||||
|
||||
[DataField("diskPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
/// <summary>
|
||||
/// The prototype of what's being printed
|
||||
/// </summary>
|
||||
[DataField("diskPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string DiskPrototype = "TechnologyDisk";
|
||||
|
||||
[DataField("printDuration")]
|
||||
/// <summary>
|
||||
/// How long it takes to print <see cref="DiskPrototype"/>
|
||||
/// </summary>
|
||||
[DataField("printDuration"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan PrintDuration = TimeSpan.FromSeconds(1);
|
||||
|
||||
/// <summary>
|
||||
/// The sound made when printing occurs
|
||||
/// </summary>
|
||||
[DataField("printSound")]
|
||||
public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/printer.ogg");
|
||||
}
|
||||
|
||||
@@ -30,13 +30,14 @@ public sealed class DiskConsoleSystem : EntitySystem
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var (printing, console, xform) in EntityQuery<DiskConsolePrintingComponent, DiskConsoleComponent, TransformComponent>())
|
||||
var query = EntityQueryEnumerator<DiskConsolePrintingComponent, DiskConsoleComponent, TransformComponent>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<string, int>();
|
||||
foreach (var discipline in _prototype.EnumeratePrototypes<TechDisciplinePrototype>())
|
||||
{
|
||||
lockoutTiers.Add(discipline.ID, discipline.LockoutTier);
|
||||
}
|
||||
|
||||
//get a list of every distinct recipe in all the technologies.
|
||||
var allTechs = new List<string>();
|
||||
foreach (var tech in _prototype.EnumeratePrototypes<TechnologyPrototype>())
|
||||
{
|
||||
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<string>();
|
||||
foreach (var tech in allTechs)
|
||||
{
|
||||
if (allUnlocked.Contains(tech))
|
||||
continue;
|
||||
|
||||
validTechs.Add(tech);
|
||||
}
|
||||
|
||||
if (!validTechs.Any())
|
||||
return;
|
||||
|
||||
//pick one
|
||||
component.Recipes = new();
|
||||
|
||||
Reference in New Issue
Block a user