Carp rift proximity (#10429)
This commit is contained in:
@@ -15,15 +15,19 @@ using Content.Server.GameTicking.Rules;
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Dragon;
|
using Content.Shared.Dragon;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Dragon
|
namespace Content.Server.Dragon
|
||||||
{
|
{
|
||||||
public sealed partial class DragonSystem : GameRuleSystem
|
public sealed partial class DragonSystem : GameRuleSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
|
||||||
[Dependency] private readonly ChatSystem _chat = default!;
|
[Dependency] private readonly ChatSystem _chat = default!;
|
||||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
@@ -38,6 +42,11 @@ namespace Content.Server.Dragon
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const int RiftRange = 15;
|
private const int RiftRange = 15;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Radius of tiles
|
||||||
|
/// </summary>
|
||||||
|
private const int RiftTileRadius = 2;
|
||||||
|
|
||||||
private const int RiftsAllowed = 3;
|
private const int RiftsAllowed = 3;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -219,7 +228,7 @@ namespace Content.Server.Dragon
|
|||||||
var xform = Transform(uid);
|
var xform = Transform(uid);
|
||||||
|
|
||||||
// Have to be on a grid fam
|
// Have to be on a grid fam
|
||||||
if (xform.GridUid == null)
|
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("carp-rift-anchor"), uid, Filter.Entities(uid));
|
_popupSystem.PopupEntity(Loc.GetString("carp-rift-anchor"), uid, Filter.Entities(uid));
|
||||||
return;
|
return;
|
||||||
@@ -234,6 +243,15 @@ namespace Content.Server.Dragon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var tile in grid.GetTilesIntersecting(new Circle(xform.WorldPosition, RiftTileRadius), false))
|
||||||
|
{
|
||||||
|
if (!tile.IsSpace(_tileDef))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_popupSystem.PopupEntity(Loc.GetString("carp-rift-space-proximity", ("proximity", RiftTileRadius)), uid, Filter.Entities(uid));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
|
var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
|
||||||
component.Rifts.Add(carpUid);
|
component.Rifts.Add(carpUid);
|
||||||
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ carp-rift-examine = It is [color=yellow]{$percentage}%[/color] charged!
|
|||||||
carp-rift-max = You have reached your maximum amount of rifts
|
carp-rift-max = You have reached your maximum amount of rifts
|
||||||
carp-rift-anchor = Rifts require a stable surface to spawn.
|
carp-rift-anchor = Rifts require a stable surface to spawn.
|
||||||
carp-rift-proximity = Too close to a nearby rift! Need to be at least {$proximity}m away.
|
carp-rift-proximity = Too close to a nearby rift! Need to be at least {$proximity}m away.
|
||||||
|
carp-rift-space-proximity = Too close to space! Need to be at least {$proximity}m away.
|
||||||
carp-rift-weakened = You are unable to summon more rifts in your weakened state.
|
carp-rift-weakened = You are unable to summon more rifts in your weakened state.
|
||||||
carp-rift-destroyed = A rift has been destroyed! You are now weakened temporarily.
|
carp-rift-destroyed = A rift has been destroyed! You are now weakened temporarily.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user