Skip to content

Commit

Permalink
Requests
Browse files Browse the repository at this point in the history
  • Loading branch information
FireNameFN committed Nov 11, 2024
1 parent c47fb5f commit 3e9c1c1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Content.Shared.Physics;

namespace Content.Server._CorvaxNext.Teleporter;

[RegisterComponent]
Expand All @@ -8,4 +10,7 @@ public sealed partial class SyndicateTeleporterComponent : Component

[DataField]
public int TeleportationRangeLength = 4;

[DataField]
public CollisionGroup CollisionGroup = CollisionGroup.MobMask;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ public sealed class SyndicateTeleporterSystem : EntitySystem
[Dependency] private readonly SharedBodySystem _body = default!;
[Dependency] private readonly IRobustRandom _random = default!;

[ValidatePrototypeId<EntityPrototype>]
private const string TeleportEffectPrototype = "TeleportEffect";
private static readonly EntProtoId TeleportEffectPrototype = "TeleportEffect";

public override void Initialize()
{
SubscribeLocalEvent<SyndicateTeleporterComponent, UseInHandEvent>(OnUseInHand);
}

private void OnUseInHand(EntityUid entity, SyndicateTeleporterComponent teleproter, UseInHandEvent e)
private void OnUseInHand(Entity<SyndicateTeleporterComponent> teleproter, ref UseInHandEvent e)
{
if (e.Handled)
return;
Expand All @@ -37,15 +36,15 @@ private void OnUseInHand(EntityUid entity, SyndicateTeleporterComponent teleprot

List<EntityCoordinates> safeCoordinates = [];

for (var i = 0; i <= teleproter.TeleportationRangeLength; i++)
for (var i = 0; i <= teleproter.Comp.TeleportationRangeLength; i++)
{
var offset = (teleproter.TeleportationRangeStart + i) * direction;
var offset = (teleproter.Comp.TeleportationRangeStart + i) * direction;

var coordinates = transform.Coordinates.Offset(offset).SnapToGrid(EntityManager, _map);

var tile = coordinates.GetTileRef(EntityManager, _map);

if (tile is not null && _turf.IsTileBlocked(tile.Value, CollisionGroup.MobMask))
if (tile is not null && _turf.IsTileBlocked(tile.Value, teleproter.Comp.CollisionGroup))
continue;

safeCoordinates.Add(coordinates);
Expand All @@ -55,7 +54,7 @@ private void OnUseInHand(EntityUid entity, SyndicateTeleporterComponent teleprot

if (safeCoordinates.Count < 1)
{
var offset = (teleproter.TeleportationRangeStart + _random.NextFloat(teleproter.TeleportationRangeLength)) * direction;
var offset = (teleproter.Comp.TeleportationRangeStart + _random.NextFloat(teleproter.Comp.TeleportationRangeLength)) * direction;

resultCoordinates = transform.Coordinates.Offset(offset);
}
Expand Down
13 changes: 0 additions & 13 deletions Resources/Prototypes/Catalog/uplink_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2104,16 +2104,3 @@
whitelist:
- Chef
- Mime

# Corvax-Next-Teleporter-Start
- type: listing
id: UplinkTeleporter
name: uplink-syndicate-teleporter-name
description: uplink-syndicate-teleporter-desc
icon: { sprite: _CorvaxNext/Objects/Devices/syndicate_teleporter.rsi, state: icon }
productEntity: SyndicateTeleporter
cost:
Telecrystal: 12
categories:
- UplinkDisruption
# Corvax-Next-Teleporter-End
10 changes: 10 additions & 0 deletions Resources/Prototypes/_CorvaxNext/Catalog/uplink_catalog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- type: listing
id: UplinkTeleporter
name: uplink-syndicate-teleporter-name
description: uplink-syndicate-teleporter-desc
icon: { sprite: _CorvaxNext/Objects/Devices/syndicate_teleporter.rsi, state: icon }
productEntity: SyndicateTeleporter
cost:
Telecrystal: 12
categories:
- UplinkDisruption

0 comments on commit 3e9c1c1

Please sign in to comment.