makes conveyors to use machine linking & refactors machine linking a bit (#2464)

* makes conveyors to use machine linking & refactors machine linking a bit

* nullable errors

* temp commit, starting work on construction

* working recipies & graphs

* fixes crash

* makes items gravitate towards the center when on a conveyor

* makes conveyors take bool signal too

* ignores components clientside

* default arm
entitymanager
maxtransmitters
unsubscribe methods

* twowayLEVER

* _

* componentreference
struct

* yaml run
leverDefinitelyNotCopiedFromGirderNoNoNo dies today :(

* nullable

* no divide by 0

* making sloth happy

* space gone - happy?

* final fix

* yes

* adds item to lathe

* conveyor item -> conveyor assembly

* technology

* reviews ADRESSED

* Update Content.Shared/GameObjects/Verbs/VerbUtility.cs

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
Paul Ritter
2020-11-18 14:53:46 +01:00
committed by GitHub
parent 2cae1ac641
commit 501156f84c
24 changed files with 345 additions and 447 deletions

View File

@@ -17,78 +17,4 @@ namespace Content.Server.GameObjects.EntitySystems
}
}
}
public class ConveyorGroup
{
private readonly HashSet<ConveyorComponent> _conveyors;
private readonly HashSet<ConveyorSwitchComponent> _switches;
public ConveyorGroup()
{
_conveyors = new HashSet<ConveyorComponent>(0);
_switches = new HashSet<ConveyorSwitchComponent>(0);
State = ConveyorState.Off;
}
public IReadOnlyCollection<ConveyorComponent> Conveyors => _conveyors;
public IReadOnlyCollection<ConveyorSwitchComponent> Switches => _switches;
public ConveyorState State { get; private set; }
public void AddConveyor(ConveyorComponent conveyor)
{
_conveyors.Add(conveyor);
conveyor.Sync(this);
}
public void RemoveConveyor(ConveyorComponent conveyor)
{
_conveyors.Remove(conveyor);
}
public void AddSwitch(ConveyorSwitchComponent conveyorSwitch)
{
_switches.Add(conveyorSwitch);
if (_switches.Count == 1)
{
SetState(conveyorSwitch);
}
conveyorSwitch.Sync(this);
}
public void RemoveSwitch(ConveyorSwitchComponent conveyorSwitch)
{
_switches.Remove(conveyorSwitch);
}
public void SetState(ConveyorSwitchComponent conveyorSwitch)
{
var state = conveyorSwitch.State;
if (state == ConveyorState.Loose)
{
if (_switches.Count > 0)
{
return;
}
state = ConveyorState.Off;
}
State = state;
foreach (var conveyor in Conveyors)
{
conveyor.Sync(this);
}
foreach (var connectedSwitch in _switches)
{
connectedSwitch.Sync(this);
}
}
}
}