Adds Special Respawn, spawns a new disk if the old one was deleted (#12762)

* Spawns a new disk if one was deleted

* Adds tiledef to space checks, also adds a way to randomly check for a respawn point on station

* Removes unused method

* Cuts down on tile checks needed by checking surrounding tiles first

* Fixes up an issue where the coords wouldn't spawn

* Removes disk system, adds special respawning system and comp

* Fixes spelling error

* Fixes linter issue

* Maybe fixes the linter with a ref event?

* Empty commit to rerun tests

* Maybe fix?

* check for deleted grid

* Moves shutdown code to terminating code

* Customtypeseralizer

* changes name of datafield

* Removes owning station references

* Trying the queue event again
This commit is contained in:
keronshb
2022-12-19 21:38:34 -05:00
committed by GitHub
parent 0549b22cbc
commit 3327c2998f
6 changed files with 251 additions and 18 deletions

View File

@@ -1,8 +1,5 @@
using System.Text;
using Content.Server.AlertLevel;
using Content.Server.Audio;
using Content.Server.Chat;
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Server.Coordinates.Helpers;
using Content.Server.DoAfter;
@@ -19,7 +16,6 @@ using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Server.Nuke
{
@@ -48,6 +44,7 @@ namespace Content.Server.Nuke
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<NukeComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<NukeComponent, ComponentRemove>(OnRemove);
SubscribeLocalEvent<NukeComponent, MapInitEvent>(OnMapInit);
@@ -105,9 +102,8 @@ namespace Content.Server.Nuke
var originStation = _stationSystem.GetOwningStation(uid);
if (originStation != null)
{
nuke.OriginStation = originStation;
}
else
{
var transform = Transform(uid);
@@ -124,7 +120,8 @@ namespace Content.Server.Nuke
private void OnItemSlotChanged(EntityUid uid, NukeComponent component, ContainerModifiedMessage args)
{
if (!component.Initialized) return;
if (!component.Initialized)
return;
if (args.Container.ID != component.DiskSlot.ID)
return;
@@ -229,9 +226,8 @@ namespace Content.Server.Nuke
return;
if (component.Status == NukeStatus.AWAIT_ARM && Transform(uid).Anchored)
{
ArmBomb(uid, component);
}
else
{
if (args.Session.AttachedEntity is not { } user)
@@ -303,10 +299,9 @@ namespace Content.Server.Nuke
nuke.RemainingTime = 0;
ActivateBomb(uid, nuke);
}
else
{
UpdateUserInterface(uid, nuke);
}
}
private void UpdateStatus(EntityUid uid, NukeComponent? component = null)
@@ -456,9 +451,7 @@ namespace Content.Server.Nuke
// let people know that a nuclear bomb was armed in their vicinity instead.
// Otherwise, you could set every station to whatever AlertLevelOnActivate is.
if (stationUid != null)
{
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, true, true, true, true);
}
var nukeXform = Transform(uid);
var pos = nukeXform.MapPosition;
@@ -493,9 +486,7 @@ namespace Content.Server.Nuke
var stationUid = _stationSystem.GetOwningStation(uid);
if (stationUid != null)
{
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnDeactivate, true, true, true);
}
// warn a crew
var announcement = Loc.GetString("nuke-component-announcement-unarmed");
@@ -614,11 +605,17 @@ namespace Content.Server.Nuke
/// <summary>
/// Raised directed on the nuke when its disarm doafter is successful.
/// </summary>
public sealed class NukeDisarmSuccessEvent : EntityEventArgs {}
public sealed class NukeDisarmSuccessEvent : EntityEventArgs
{
}
/// <summary>
/// Raised directed on the nuke when its disarm doafter is cancelled.
/// </summary>
public sealed class NukeDisarmCancelledEvent : EntityEventArgs {}
public sealed class NukeDisarmCancelledEvent : EntityEventArgs
{
}
}