make linking logic gates 1000% better (#25041)

* make door status use SendSignal

* LastSignals and logic, add ClearSignal api too

* make everything outputting a logic signal default to false

* refactor ops

* :trollface:

* :trollface:

* protoid for LastSignals

* oop

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2024-02-12 06:45:51 +00:00
committed by GitHub
parent 16b56c7f45
commit f41ece37c3
12 changed files with 146 additions and 68 deletions

View File

@@ -153,7 +153,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
return;
var comp = EnsureComp<DeviceLinkSourceComponent>(uid);
comp.Ports ??= new HashSet<string>();
comp.Ports ??= new HashSet<ProtoId<SourcePortPrototype>>();
foreach (var port in ports)
{
@@ -233,10 +233,10 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
/// Returns the links of a source
/// </summary>
/// <returns>A list of sink and source port ids that are linked together</returns>
public HashSet<(string source, string sink)> GetLinks(EntityUid sourceUid, EntityUid sinkUid, DeviceLinkSourceComponent? sourceComponent = null)
public HashSet<(ProtoId<SourcePortPrototype> source, ProtoId<SinkPortPrototype> sink)> GetLinks(EntityUid sourceUid, EntityUid sinkUid, DeviceLinkSourceComponent? sourceComponent = null)
{
if (!Resolve(sourceUid, ref sourceComponent) || !sourceComponent.LinkedPorts.TryGetValue(sinkUid, out var links))
return new HashSet<(string source, string sink)>();
return new HashSet<(ProtoId<SourcePortPrototype>, ProtoId<SinkPortPrototype>)>();
return links;
}