mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 07:12:27 +02:00
* Added new ComponentEventBus, combined it with IEventBus. * Removed all traces of IEntity from ComponentDependencies. Removed IEntityManager dependency from ComponentManager. * Added entity create/delete events to IEntityManager. * ComponentEvents now use EntitySystemMessages instead of their custom ComponentEvent class. * Component events are now just overloads of entity events. * Removed obsolete EntitySystemMessage, now everything uses the base EntityEventArgs. * Add a bool argument for if the message should be broadcast as well as directed. Fix ordering and init issues of events in EntityManager. * Changed names from Component/Entity events to Directed/Broadcast. * Fix bugs and unit tests.
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Robust.Shared.GameObjects
|
|
{
|
|
internal class SharedTransformSystem : EntitySystem
|
|
{
|
|
private readonly Queue<MoveEvent> _gridMoves = new();
|
|
private readonly Queue<MoveEvent> _otherMoves = new();
|
|
|
|
public void DeferMoveEvent(MoveEvent moveEvent)
|
|
{
|
|
if (moveEvent.Sender.HasComponent<IMapGridComponent>())
|
|
_gridMoves.Enqueue(moveEvent);
|
|
else
|
|
_otherMoves.Enqueue(moveEvent);
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
// Process grid moves first.
|
|
Process(_gridMoves);
|
|
Process(_otherMoves);
|
|
|
|
void Process(Queue<MoveEvent> queue)
|
|
{
|
|
while (queue.TryDequeue(out var ev))
|
|
{
|
|
if (ev.Sender.Deleted)
|
|
continue;
|
|
|
|
RaiseLocalEvent(ev);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|