mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Bugfix: Holosigns, dragon rifts align themselves with the grid (#45063)
* Fix holosign rotation * figgs dragon rift * DragonSystem: use subscriptions * HUH * Apply SnappingOpossum's suggestions Co-authored by: SnappingOpposum <snappingopossum@outlook.com> * I can't believe he's done this Co-authored-by: SnappingOpossum <snappingopossum@outlook.com> --------- Co-authored-by: SnappingOpossum <snappingopossum@outlook.com>
This commit is contained in:
parent
5acd4c4927
commit
2dd9f035a8
2 changed files with 13 additions and 27 deletions
|
|
@ -49,18 +49,6 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
|
||||
private const int RiftsAllowed = 3;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DragonComponent, MapInitEvent>(OnInit);
|
||||
SubscribeLocalEvent<DragonComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<DragonComponent, DragonSpawnRiftActionEvent>(OnSpawnRift);
|
||||
SubscribeLocalEvent<DragonComponent, RefreshMovementSpeedModifiersEvent>(OnDragonMove);
|
||||
SubscribeLocalEvent<DragonComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
SubscribeLocalEvent<DragonComponent, EntityZombifiedEvent>(OnZombified);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
|
@ -111,17 +99,20 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
}
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
private void OnInit(EntityUid uid, DragonComponent component, MapInitEvent args)
|
||||
{
|
||||
Roar(uid, component);
|
||||
_actions.AddAction(uid, ref component.SpawnRiftActionEntity, component.SpawnRiftAction);
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
private void OnShutdown(EntityUid uid, DragonComponent component, ComponentShutdown args)
|
||||
{
|
||||
DeleteRifts(uid, false, component);
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
private void OnSpawnRift(EntityUid uid, DragonComponent component, DragonSpawnRiftActionEvent args)
|
||||
{
|
||||
if (component.Weakened)
|
||||
|
|
@ -161,8 +152,10 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
}
|
||||
}
|
||||
|
||||
var position = _transform.GetWorldPosition(xform);
|
||||
|
||||
// cant put a rift on solars
|
||||
foreach (var tile in _map.GetTilesIntersecting(xform.GridUid.Value, grid, new Circle(_transform.GetWorldPosition(xform), RiftTileRadius), false))
|
||||
foreach (var tile in _map.GetTilesIntersecting(xform.GridUid.Value, grid, new Circle(position, RiftTileRadius), false))
|
||||
{
|
||||
if (!_turf.IsSpace(tile))
|
||||
continue;
|
||||
|
|
@ -171,14 +164,14 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
return;
|
||||
}
|
||||
|
||||
var (position, rotation) = _transform.GetWorldPositionRotation(xform);
|
||||
var carpUid = Spawn(component.RiftPrototype, new MapCoordinates(position, xform.MapID), rotation: rotation);
|
||||
var carpUid = Spawn(component.RiftPrototype, new MapCoordinates(position, xform.MapID), rotation: Transform(xform.GridUid.Value).LocalRotation);
|
||||
|
||||
component.Rifts.Add(carpUid);
|
||||
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
||||
}
|
||||
|
||||
// TODO: just make this a move speed modifier component???
|
||||
[SubscribeLocalEvent]
|
||||
private void OnDragonMove(EntityUid uid, DragonComponent component, RefreshMovementSpeedModifiersEvent args)
|
||||
{
|
||||
if (component.Weakened)
|
||||
|
|
@ -187,6 +180,7 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
}
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
private void OnMobStateChanged(EntityUid uid, DragonComponent component, MobStateChangedEvent args)
|
||||
{
|
||||
// Deletes all rifts after dying
|
||||
|
|
@ -200,6 +194,7 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
DeleteRifts(uid, false, component);
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
private void OnZombified(Entity<DragonComponent> ent, ref EntityZombifiedEvent args)
|
||||
{
|
||||
// prevent carp attacking zombie dragon
|
||||
|
|
|
|||
|
|
@ -11,14 +11,7 @@ public sealed partial class HolosignSystem : EntitySystem
|
|||
[Dependency] private INetManager _net = default!;
|
||||
[Dependency] private PowerCellSystem _powerCell = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<HolosignProjectorComponent, BeforeRangedInteractEvent>(OnBeforeInteract);
|
||||
SubscribeLocalEvent<HolosignProjectorComponent, ExaminedEvent>(OnExamine);
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
private void OnExamine(Entity<HolosignProjectorComponent> ent, ref ExaminedEvent args)
|
||||
{
|
||||
// TODO: This should probably be using an itemstatus
|
||||
|
|
@ -37,6 +30,7 @@ public sealed partial class HolosignSystem : EntitySystem
|
|||
}
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
private void OnBeforeInteract(Entity<HolosignProjectorComponent> ent, ref BeforeRangedInteractEvent args)
|
||||
{
|
||||
if (args.Handled
|
||||
|
|
@ -48,10 +42,7 @@ public sealed partial class HolosignSystem : EntitySystem
|
|||
|
||||
// overlapping of the same holo on one tile remains allowed to allow holofan refreshes
|
||||
if (ent.Comp.PredictedSpawn || _net.IsServer)
|
||||
{
|
||||
// TODO: make a proxy for this method.
|
||||
EntityManager.PredictedSpawnAtPosition(ent.Comp.SignProto, args.ClickLocation, Angle.Zero);
|
||||
}
|
||||
PredictedSpawnAtPosition(ent.Comp.SignProto, args.ClickLocation);
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue