Demiplan polishing (#524)
* 10 -> 20 sharpening stone durability * auto destroy demiplans try 2 (better) * start demiplan protection time * buying demiplan key * increase island size
This commit is contained in:
@@ -15,31 +15,6 @@ public abstract partial class CP14SharedDemiplaneSystem : EntitySystem
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14DemiplaneRiftOpenedComponent, InteractHandEvent>(OnDemiplanPasswayInteract);
|
||||
|
||||
SubscribeLocalEvent<CP14DemiplaneDestroyWithoutPlayersComponent, CP14DemiplanEntityEnterEvent>(OnEntityEnter);
|
||||
SubscribeLocalEvent<CP14DemiplaneDestroyWithoutPlayersComponent, CP14DemiplanEntityLeaveEvent>(OnEntityLeave);
|
||||
}
|
||||
|
||||
private void OnEntityLeave(Entity<CP14DemiplaneDestroyWithoutPlayersComponent> ent, ref CP14DemiplanEntityLeaveEvent args)
|
||||
{
|
||||
//это можно легко абузить, если игроки найдут способ выходить из
|
||||
//демиплана другим способом. Лучше добавлять на игроков компонент, и тречить все смены карт у этого компонента
|
||||
if (ent.Comp.Players.Contains(args.Player))
|
||||
{
|
||||
ent.Comp.Players.Remove(args.Player);
|
||||
if (ent.Comp.Players.Count == 0)
|
||||
{
|
||||
QueueDel(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEntityEnter(Entity<CP14DemiplaneDestroyWithoutPlayersComponent> ent, ref CP14DemiplanEntityEnterEvent args)
|
||||
{
|
||||
if (!TryComp<ActorComponent>(args.Player, out var actor))
|
||||
return;
|
||||
|
||||
ent.Comp.Players.Add(args.Player);
|
||||
}
|
||||
|
||||
private void OnDemiplanPasswayInteract(Entity<CP14DemiplaneRiftOpenedComponent> passway, ref InteractHandEvent args)
|
||||
@@ -64,29 +39,3 @@ public abstract partial class CP14SharedDemiplaneSystem : EntitySystem
|
||||
public sealed partial class CP14DemiplanPasswayUseDoAfter : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is invoked on the demiplane when new players enter. This only applies to rift entrances, any other methods will not be taken into account.
|
||||
/// </summary>
|
||||
public sealed class CP14DemiplanEntityEnterEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid Player;
|
||||
|
||||
public CP14DemiplanEntityEnterEvent(EntityUid player)
|
||||
{
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is invoked on the demiplane when some players left. This only applies to rift entrances, any other methods will not be taken into account.
|
||||
/// </summary>
|
||||
public sealed class CP14DemiplanEntityLeaveEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid Player;
|
||||
|
||||
public CP14DemiplanEntityLeaveEvent(EntityUid player)
|
||||
{
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Content.Shared._CP14.Demiplane.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Keeps the demiplanes from being destroyed while they're in it.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SharedDemiplaneSystem))]
|
||||
public sealed partial class CP14DemiplaneStabilizerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// must be a being and be alive to work as a stabilizer
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool RequireAlive = false;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Content.Shared._CP14.Demiplane.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Automatically deletes the demiplane if everyone who entered it, exited back out, or died.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SharedDemiplaneSystem))]
|
||||
public sealed partial class CP14DemiplaneDestroyWithoutPlayersComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public HashSet<EntityUid> Players = new();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Content.Shared._CP14.Demiplane.Components;
|
||||
|
||||
/// <summary>
|
||||
/// is automatically delete over time if there are no active stabilizers inside this demiplane.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SharedDemiplaneSystem)), AutoGenerateComponentPause]
|
||||
public sealed partial class CP14DemiplaneDestroyWithoutStabilizationComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// how many time after generation the demiplane cannot be destroyed.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan ProtectedSpawnTime = TimeSpan.FromMinutes(1);
|
||||
|
||||
[DataField]
|
||||
[AutoPausedField]
|
||||
public TimeSpan EndProtectionTime = TimeSpan.Zero;
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Shared._CP14.DemiplaneTraveling;
|
||||
|
||||
/// <summary>
|
||||
/// teleports a certain number of entities between demiplanes with a delay
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, AutoGenerateComponentPause]
|
||||
public sealed partial class CP14DemiplaneRadiusTimedPasswayComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
@@ -16,5 +18,12 @@ public sealed partial class CP14DemiplaneRadiusTimedPasswayComponent : Component
|
||||
public float Radius = 3f;
|
||||
|
||||
[DataField]
|
||||
[AutoPausedField]
|
||||
public TimeSpan NextTimeTeleport = TimeSpan.Zero;
|
||||
|
||||
[DataField("arrivalSound")]
|
||||
public SoundSpecifier ArrivalSound = new SoundPathSpecifier("/Audio/Effects/teleport_arrival.ogg");
|
||||
|
||||
[DataField("departureSound")]
|
||||
public SoundSpecifier DepartureSound = new SoundPathSpecifier("/Audio/Effects/teleport_departure.ogg");
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Shared._CP14.DemiplaneTraveling;
|
||||
|
||||
/// <summary>
|
||||
@@ -14,4 +16,10 @@ public sealed partial class CP14DemiplaneRiftOpenedComponent : Component
|
||||
|
||||
[DataField]
|
||||
public float DoAfter = 4f;
|
||||
|
||||
[DataField("arrivalSound")]
|
||||
public SoundSpecifier ArrivalSound = new SoundPathSpecifier("/Audio/Effects/teleport_arrival.ogg");
|
||||
|
||||
[DataField("departureSound")]
|
||||
public SoundSpecifier DepartureSound = new SoundPathSpecifier("/Audio/Effects/teleport_departure.ogg");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user