Compare commits
1 Commits
master
...
demiplanes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06ca2810c9 |
@@ -26,6 +26,7 @@ public sealed partial class CP14DemiplaneSystem
|
||||
private const double JobMaxTime = 0.002;
|
||||
|
||||
[Dependency] private readonly ExamineSystemShared _examine = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
|
||||
private void InitGeneration()
|
||||
{
|
||||
@@ -141,6 +142,23 @@ public sealed partial class CP14DemiplaneSystem
|
||||
if (generator.Comp.Location is null)
|
||||
return;
|
||||
|
||||
var curTime = _timing.CurTime;
|
||||
|
||||
if (curTime < generator.Comp.LastUseTime + generator.Comp.UseDelay)
|
||||
return;
|
||||
|
||||
generator.Comp.LastUseTime = curTime;
|
||||
|
||||
if (generator.Comp.NeedDemiplaneCrystal)
|
||||
{
|
||||
var demiplaneCrystals = _lookup.GetEntitiesInRange<CP14DemiplaneCrystalComponent>(Transform(generator).Coordinates, generator.Comp.DemiplaneCrystalRange);
|
||||
if (demiplaneCrystals.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//We cant open demiplan in another demiplan or if parent is not Map
|
||||
if (HasComp<CP14DemiplaneComponent>(Transform(generator).MapUid) || !HasComp<MapGridComponent>(_transform.GetParentUid(args.User)))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Content.Server._CP14.Demiplane.Components;
|
||||
|
||||
[RegisterComponent, Access(typeof(CP14DemiplaneSystem))]
|
||||
public sealed partial class CP14DemiplaneCrystalComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -23,4 +23,16 @@ public sealed partial class CP14DemiplaneGeneratorDataComponent : Component
|
||||
|
||||
[DataField(required: true)]
|
||||
public Dictionary<ProtoId<CP14DemiplaneModifierCategoryPrototype>, float> Limits;
|
||||
|
||||
[DataField]
|
||||
public bool NeedDemiplaneCrystal = true;
|
||||
|
||||
[DataField]
|
||||
public float DemiplaneCrystalRange = 15f;
|
||||
|
||||
[DataField]
|
||||
public TimeSpan UseDelay = TimeSpan.FromSeconds(1.0);
|
||||
|
||||
[DataField]
|
||||
public TimeSpan LastUseTime = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user