@@ -45,7 +45,6 @@ public sealed class ThrusterSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<ThrusterComponent, ComponentShutdown>(OnThrusterShutdown);
|
SubscribeLocalEvent<ThrusterComponent, ComponentShutdown>(OnThrusterShutdown);
|
||||||
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
|
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
|
||||||
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
|
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
|
||||||
SubscribeLocalEvent<ThrusterComponent, ReAnchorEvent>(OnThrusterReAnchor);
|
|
||||||
SubscribeLocalEvent<ThrusterComponent, MoveEvent>(OnRotate);
|
SubscribeLocalEvent<ThrusterComponent, MoveEvent>(OnRotate);
|
||||||
SubscribeLocalEvent<ThrusterComponent, IsHotEvent>(OnIsHotEvent);
|
SubscribeLocalEvent<ThrusterComponent, IsHotEvent>(OnIsHotEvent);
|
||||||
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
|
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
|
||||||
@@ -151,9 +150,9 @@ public sealed class ThrusterSystem : EntitySystem
|
|||||||
private void OnRotate(EntityUid uid, ThrusterComponent component, ref MoveEvent args)
|
private void OnRotate(EntityUid uid, ThrusterComponent component, ref MoveEvent args)
|
||||||
{
|
{
|
||||||
// TODO: Disable visualizer for old direction
|
// TODO: Disable visualizer for old direction
|
||||||
|
// TODO: Don't make them rotatable and make it require anchoring.
|
||||||
|
|
||||||
if (!component.Enabled ||
|
if (!component.Enabled ||
|
||||||
component.Type != ThrusterType.Linear ||
|
|
||||||
!EntityManager.TryGetComponent(uid, out TransformComponent? xform) ||
|
!EntityManager.TryGetComponent(uid, out TransformComponent? xform) ||
|
||||||
!EntityManager.TryGetComponent(xform.GridUid, out ShuttleComponent? shuttleComponent))
|
!EntityManager.TryGetComponent(xform.GridUid, out ShuttleComponent? shuttleComponent))
|
||||||
{
|
{
|
||||||
@@ -176,22 +175,44 @@ public sealed class ThrusterSystem : EntitySystem
|
|||||||
// Disable if new tile invalid
|
// Disable if new tile invalid
|
||||||
if (component.IsOn && !canEnable)
|
if (component.IsOn && !canEnable)
|
||||||
{
|
{
|
||||||
DisableThruster(uid, component, xform, args.OldRotation);
|
DisableThruster(uid, component, args.OldPosition.EntityId, xform, args.OldRotation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldDirection = (int) args.OldRotation.GetCardinalDir() / 2;
|
var oldDirection = (int) args.OldRotation.GetCardinalDir() / 2;
|
||||||
var direction = (int) args.NewRotation.GetCardinalDir() / 2;
|
var direction = (int) args.NewRotation.GetCardinalDir() / 2;
|
||||||
|
var oldShuttleComponent = shuttleComponent;
|
||||||
|
|
||||||
shuttleComponent.LinearThrust[oldDirection] -= component.Thrust;
|
if (args.ParentChanged)
|
||||||
shuttleComponent.BaseLinearThrust[oldDirection] -= component.BaseThrust;
|
{
|
||||||
DebugTools.Assert(shuttleComponent.LinearThrusters[oldDirection].Contains(uid));
|
oldShuttleComponent = Comp<ShuttleComponent>(args.OldPosition.EntityId);
|
||||||
shuttleComponent.LinearThrusters[oldDirection].Remove(uid);
|
|
||||||
|
|
||||||
shuttleComponent.LinearThrust[direction] += component.Thrust;
|
// If no parent change doesn't matter for angular.
|
||||||
shuttleComponent.BaseLinearThrust[direction] += component.BaseThrust;
|
if (component.Type == ThrusterType.Angular)
|
||||||
DebugTools.Assert(!shuttleComponent.LinearThrusters[direction].Contains(uid));
|
{
|
||||||
shuttleComponent.LinearThrusters[direction].Add(uid);
|
oldShuttleComponent.AngularThrust -= component.Thrust;
|
||||||
|
DebugTools.Assert(oldShuttleComponent.AngularThrusters.Contains(uid));
|
||||||
|
oldShuttleComponent.AngularThrusters.Remove(uid);
|
||||||
|
|
||||||
|
shuttleComponent.AngularThrust += component.Thrust;
|
||||||
|
DebugTools.Assert(!shuttleComponent.AngularThrusters.Contains(uid));
|
||||||
|
shuttleComponent.AngularThrusters.Add(uid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component.Type == ThrusterType.Linear)
|
||||||
|
{
|
||||||
|
oldShuttleComponent.LinearThrust[oldDirection] -= component.Thrust;
|
||||||
|
oldShuttleComponent.BaseLinearThrust[oldDirection] -= component.BaseThrust;
|
||||||
|
DebugTools.Assert(oldShuttleComponent.LinearThrusters[oldDirection].Contains(uid));
|
||||||
|
oldShuttleComponent.LinearThrusters[oldDirection].Remove(uid);
|
||||||
|
|
||||||
|
shuttleComponent.LinearThrust[direction] += component.Thrust;
|
||||||
|
shuttleComponent.BaseLinearThrust[direction] += component.BaseThrust;
|
||||||
|
DebugTools.Assert(!shuttleComponent.LinearThrusters[direction].Contains(uid));
|
||||||
|
shuttleComponent.LinearThrusters[direction].Add(uid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAnchorChange(EntityUid uid, ThrusterComponent component, ref AnchorStateChangedEvent args)
|
private void OnAnchorChange(EntityUid uid, ThrusterComponent component, ref AnchorStateChangedEvent args)
|
||||||
@@ -206,14 +227,6 @@ public sealed class ThrusterSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnThrusterReAnchor(EntityUid uid, ThrusterComponent component, ref ReAnchorEvent args)
|
|
||||||
{
|
|
||||||
DisableThruster(uid, component, args.OldGrid);
|
|
||||||
|
|
||||||
if (CanEnable(uid, component))
|
|
||||||
EnableThruster(uid, component);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnThrusterInit(EntityUid uid, ThrusterComponent component, ComponentInit args)
|
private void OnThrusterInit(EntityUid uid, ThrusterComponent component, ComponentInit args)
|
||||||
{
|
{
|
||||||
_ambient.SetAmbience(uid, false);
|
_ambient.SetAmbience(uid, false);
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
- scene
|
- scene
|
||||||
- replay_recording_stats
|
- replay_recording_stats
|
||||||
- print_pvs_ack
|
- print_pvs_ack
|
||||||
|
- merge_grids
|
||||||
|
|
||||||
|
|
||||||
- Flags: MAPPING
|
- Flags: MAPPING
|
||||||
|
|||||||
Reference in New Issue
Block a user