* Mobs burn to ashes on excessive heat damage (#26971) * mobs burn to ashes on excessive heat damage * remove comment, remove random lines I didn't mean to add * combine code into behavior * clean unused * fix namespace * drop next to * fix spawn entities behavior spawning entities outside container * fix burning to ash not working on all mobs (#27158) * add ghostnado button to warp menu (#27556) * add ghostnado button to warp menu * translator ops --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * Make arguments and parameters wrap to one variable per line (#27766) * Fix ghosts getting spawned in nullspace (#27617) * Add tests for ghost spawn position * Make ghosts spawn immediately * Format mind system * Move ghost spawning to GhostSystem * Spawn ghost on grid or map This fixes the ghosts being attached the parent entity instead of the grid. * Move logging out of the ghost system * Make round start observer spawn using GhostSystem * Move GameTicker ghost spawning to GhostSystem Moved the more robust character name selection code over. Moved the TimeOfDeath code over. Added canReturn logic. * Add overrides and default for ghost spawn coordinates * Add warning log to ghost spawn fail * Clean up test * Dont spawn ghost on map delete * Minor changes to the role test * Fix role test failing to spawn ghost It was failing the map check due to using Nullspace * Fix ghost tests when running in parallel Not sure what happened, but it seems to be because they were running simultaneously and overwriting values. * Clean up ghost tests * Test that map deletion does not spawn ghosts * Spawn ghost on the next available map * Disallow spawning on deleted maps * Fix map deletion ghost test * Cleanup --------- Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: ShadowCommander <shadowjjt@gmail.com>
162 lines
4.9 KiB
C#
162 lines
4.9 KiB
C#
using Content.Shared.Emoting;
|
|
using Content.Shared.Hands;
|
|
using Content.Shared.Interaction.Events;
|
|
using Content.Shared.Item;
|
|
using Content.Shared.Popups;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Ghost
|
|
{
|
|
/// <summary>
|
|
/// System for the <see cref="GhostComponent"/>.
|
|
/// Prevents ghosts from interacting when <see cref="GhostComponent.CanGhostInteract"/> is false.
|
|
/// </summary>
|
|
public abstract class SharedGhostSystem : EntitySystem
|
|
{
|
|
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<GhostComponent, UseAttemptEvent>(OnAttempt);
|
|
SubscribeLocalEvent<GhostComponent, InteractionAttemptEvent>(OnAttempt);
|
|
SubscribeLocalEvent<GhostComponent, EmoteAttemptEvent>(OnAttempt);
|
|
SubscribeLocalEvent<GhostComponent, DropAttemptEvent>(OnAttempt);
|
|
SubscribeLocalEvent<GhostComponent, PickupAttemptEvent>(OnAttempt);
|
|
}
|
|
|
|
private void OnAttempt(EntityUid uid, GhostComponent component, CancellableEntityEventArgs args)
|
|
{
|
|
if (!component.CanGhostInteract)
|
|
args.Cancel();
|
|
}
|
|
|
|
public void SetTimeOfDeath(EntityUid uid, TimeSpan value, GhostComponent? component)
|
|
{
|
|
if (!Resolve(uid, ref component))
|
|
return;
|
|
|
|
component.TimeOfDeath = value;
|
|
}
|
|
|
|
public void SetCanReturnToBody(EntityUid uid, bool value, GhostComponent? component = null)
|
|
{
|
|
if (!Resolve(uid, ref component))
|
|
return;
|
|
|
|
component.CanReturnToBody = value;
|
|
}
|
|
|
|
public void SetCanReturnToBody(GhostComponent component, bool value)
|
|
{
|
|
component.CanReturnToBody = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// A client to server request to get places a ghost can warp to.
|
|
/// Response is sent via <see cref="GhostWarpsResponseEvent"/>
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class GhostWarpsRequestEvent : EntityEventArgs
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// An individual place a ghost can warp to.
|
|
/// This is used as part of <see cref="GhostWarpsResponseEvent"/>
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public struct GhostWarp
|
|
{
|
|
public GhostWarp(NetEntity entity, string displayName, bool isWarpPoint)
|
|
{
|
|
Entity = entity;
|
|
DisplayName = displayName;
|
|
IsWarpPoint = isWarpPoint;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The entity representing the warp point.
|
|
/// This is passed back to the server in <see cref="GhostWarpToTargetRequestEvent"/>
|
|
/// </summary>
|
|
public NetEntity Entity { get; }
|
|
|
|
/// <summary>
|
|
/// The display name to be surfaced in the ghost warps menu
|
|
/// </summary>
|
|
public string DisplayName { get; }
|
|
|
|
/// <summary>
|
|
/// Whether this warp represents a warp point or a player
|
|
/// </summary>
|
|
public bool IsWarpPoint { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// A server to client response for a <see cref="GhostWarpsRequestEvent"/>.
|
|
/// Contains players, and locations a ghost can warp to
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class GhostWarpsResponseEvent : EntityEventArgs
|
|
{
|
|
public GhostWarpsResponseEvent(List<GhostWarp> warps)
|
|
{
|
|
Warps = warps;
|
|
}
|
|
|
|
/// <summary>
|
|
/// A list of warp points.
|
|
/// </summary>
|
|
public List<GhostWarp> Warps { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// A client to server request for their ghost to be warped to an entity
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class GhostWarpToTargetRequestEvent : EntityEventArgs
|
|
{
|
|
public NetEntity Target { get; }
|
|
|
|
public GhostWarpToTargetRequestEvent(NetEntity target)
|
|
{
|
|
Target = target;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// A client to server request for their ghost to be warped to the most followed entity.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class GhostnadoRequestEvent : EntityEventArgs;
|
|
|
|
/// <summary>
|
|
/// A client to server request for their ghost to return to body
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class GhostReturnToBodyRequest : EntityEventArgs
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// A server to client update with the available ghost role count
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class GhostUpdateGhostRoleCountEvent : EntityEventArgs
|
|
{
|
|
public int AvailableGhostRoles { get; }
|
|
|
|
public GhostUpdateGhostRoleCountEvent(int availableGhostRoleCount)
|
|
{
|
|
AvailableGhostRoles = availableGhostRoleCount;
|
|
}
|
|
}
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
public sealed class GhostReturnToRoundRequest : EntityEventArgs
|
|
{
|
|
}
|
|
}
|