diff --git a/Content.Server/_CorvaxNext/Teleporter/SyndicateTeleporterComponent.cs b/Content.Server/_CorvaxNext/Teleporter/SyndicateTeleporterComponent.cs new file mode 100644 index 00000000000..55d66351bfd --- /dev/null +++ b/Content.Server/_CorvaxNext/Teleporter/SyndicateTeleporterComponent.cs @@ -0,0 +1,16 @@ +using Content.Shared.Physics; + +namespace Content.Server._CorvaxNext.Teleporter; + +[RegisterComponent] +public sealed partial class SyndicateTeleporterComponent : Component +{ + [DataField] + public float TeleportationRangeStart = 4; + + [DataField] + public int TeleportationRangeLength = 4; + + [DataField] + public CollisionGroup CollisionGroup = CollisionGroup.MobMask; +} diff --git a/Content.Server/_CorvaxNext/Teleporter/SyndicateTeleporterSystem.cs b/Content.Server/_CorvaxNext/Teleporter/SyndicateTeleporterSystem.cs new file mode 100644 index 00000000000..40a40e4696e --- /dev/null +++ b/Content.Server/_CorvaxNext/Teleporter/SyndicateTeleporterSystem.cs @@ -0,0 +1,72 @@ +using Content.Shared.Body.Systems; +using Content.Shared.Coordinates.Helpers; +using Content.Shared.Interaction.Events; +using Content.Shared.Maps; +using Content.Shared.Physics; +using Content.Shared.Random.Helpers; +using Robust.Shared.Map; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; + +namespace Content.Server._CorvaxNext.Teleporter; + +public sealed class SyndicateTeleporterSystem : EntitySystem +{ + [Dependency] private readonly SharedTransformSystem _transform = default!; + [Dependency] private readonly IMapManager _map = default!; + [Dependency] private readonly TurfSystem _turf = default!; + [Dependency] private readonly SharedBodySystem _body = default!; + [Dependency] private readonly IRobustRandom _random = default!; + + private static readonly EntProtoId TeleportEffectPrototype = "TeleportEffect"; + + public override void Initialize() + { + SubscribeLocalEvent(OnUseInHand); + } + + private void OnUseInHand(Entity teleproter, ref UseInHandEvent e) + { + if (e.Handled) + return; + + var transform = Transform(e.User); + + var direction = transform.LocalRotation.ToWorldVec().Normalized(); + + List safeCoordinates = []; + + for (var i = 0; i <= teleproter.Comp.TeleportationRangeLength; i++) + { + 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, teleproter.Comp.CollisionGroup)) + continue; + + safeCoordinates.Add(coordinates); + } + + EntityCoordinates resultCoordinates; + + if (safeCoordinates.Count < 1) + { + var offset = (teleproter.Comp.TeleportationRangeStart + _random.NextFloat(teleproter.Comp.TeleportationRangeLength)) * direction; + + resultCoordinates = transform.Coordinates.Offset(offset); + } + else + resultCoordinates = _random.Pick(safeCoordinates); + + Spawn(TeleportEffectPrototype, transform.Coordinates); + Spawn(TeleportEffectPrototype, resultCoordinates); + + _transform.SetCoordinates(e.User, resultCoordinates); + + if (safeCoordinates.Count < 1) + _body.GibBody(e.User, true); + } +} diff --git a/Resources/Audio/_CorvaxNext/Effects/attributions.yml b/Resources/Audio/_CorvaxNext/Effects/attributions.yml new file mode 100644 index 00000000000..2f7a7ac079a --- /dev/null +++ b/Resources/Audio/_CorvaxNext/Effects/attributions.yml @@ -0,0 +1,4 @@ +- files: ["electrical_short_circuit.ogg", "electrical_short_circuit2.ogg"] + license: "CC-BY-NC-3.0" + copyright: "Taken from zvukipro.com" + source: "https://zvukipro.com/predmet/158-zvuk-elektrichestva.html" diff --git a/Resources/Audio/_CorvaxNext/Effects/electrical_short_circuit.ogg b/Resources/Audio/_CorvaxNext/Effects/electrical_short_circuit.ogg new file mode 100644 index 00000000000..af495a37f61 Binary files /dev/null and b/Resources/Audio/_CorvaxNext/Effects/electrical_short_circuit.ogg differ diff --git a/Resources/Audio/_CorvaxNext/Effects/electrical_short_circuit2.ogg b/Resources/Audio/_CorvaxNext/Effects/electrical_short_circuit2.ogg new file mode 100644 index 00000000000..be87ac68d2f Binary files /dev/null and b/Resources/Audio/_CorvaxNext/Effects/electrical_short_circuit2.ogg differ diff --git a/Resources/Locale/en-US/store/uplink-catalog.ftl b/Resources/Locale/en-US/store/uplink-catalog.ftl index a78f39d5696..896d6e0f800 100644 --- a/Resources/Locale/en-US/store/uplink-catalog.ftl +++ b/Resources/Locale/en-US/store/uplink-catalog.ftl @@ -451,3 +451,8 @@ uplink-combat-bakery-desc = A kit of clandestine baked weapons. Contains a bague uplink-business-card-name = Syndicate Business Card uplink-business-card-desc = A business card that you can give to someone to demonstrate your involvement in the syndicate or leave at the crime scene in order to make fun of the detective. You can buy no more than three of them. + +# Corvax-Next-Teleporter-Start +uplink-syndicate-teleporter-name = Hand syndicate teleporter +uplink-syndicate-teleporter-desc = An experimental hand teleporting device. Teleports its owner forward in a small area. Be careful not to end up in the wall. +# Corvax-Next-Teleporter-End diff --git a/Resources/Locale/ru-RU/store/uplink-catalog.ftl b/Resources/Locale/ru-RU/store/uplink-catalog.ftl index 9489574ba5c..89de56245d4 100644 --- a/Resources/Locale/ru-RU/store/uplink-catalog.ftl +++ b/Resources/Locale/ru-RU/store/uplink-catalog.ftl @@ -309,3 +309,7 @@ uplink-combat-bakery-name = Набор боевой выпечки uplink-combat-bakery-desc = Набор подпольного печёного оружия. Содержит меч-багет, пару метательных круассанов и микроволновую плату Синдиката для изготовления новых. Когда дело будет сделано, съешьте все улики. uplink-business-card-name = Визитная карточка Синдиката uplink-business-card-desc = Визитная карточка, которую можно передать кому-нибудь, чтобы продемонстрировать свою принадлежность к Синдикату, или оставить на месте преступления, чтобы подшутить над детективом. Вы можете приобрести не более трёх таких визиток. +# Corvax-Next-Teleporter-Start +uplink-syndicate-teleporter-name = Ручной телепортер Синдиката +uplink-syndicate-teleporter-desc = Экспериментальное ручное телепортирующее устройство. Телепортирует владельца вперёд на некоторое расстояние. Будьте осторожны не умереть в стене. +# Corvax-Next-Teleporter-End diff --git a/Resources/Prototypes/_CorvaxNext/Catalog/uplink_catalog.yml b/Resources/Prototypes/_CorvaxNext/Catalog/uplink_catalog.yml new file mode 100644 index 00000000000..fae7a0b49d1 --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/Catalog/uplink_catalog.yml @@ -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 diff --git a/Resources/Prototypes/_CorvaxNext/Entities/Effects/teleport_effect.yml b/Resources/Prototypes/_CorvaxNext/Entities/Effects/teleport_effect.yml new file mode 100644 index 00000000000..70ccd8ff92a --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/Entities/Effects/teleport_effect.yml @@ -0,0 +1,22 @@ +- type: entity + id: TeleportEffect + categories: [ HideSpawnMenu ] + components: + - type: TimedDespawn + lifetime: 0.4 + - type: Sprite + drawdepth: Effects + noRot: true + layers: + - shader: unshaded + map: ["enum.EffectLayers.Unshaded"] + sprite: _CorvaxNext/Effects/teleport_sparks.rsi + state: sparks + - type: EffectVisuals + - type: Tag + tags: + - HideContextMenu + - type: EmitSoundOnSpawn + sound: + collection: ShortCircuit + - type: AnimationPlayer diff --git a/Resources/Prototypes/_CorvaxNext/Entities/Objects/Devices/Syndicate_Gadgets/syndicate_teleporter.yml b/Resources/Prototypes/_CorvaxNext/Entities/Objects/Devices/Syndicate_Gadgets/syndicate_teleporter.yml new file mode 100644 index 00000000000..dcb2555589e --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/Entities/Objects/Devices/Syndicate_Gadgets/syndicate_teleporter.yml @@ -0,0 +1,18 @@ +- type: entity + parent: BaseItem + id: SyndicateTeleporter + name: syndicate teleporter + description: Personal syndicate teleporter. + components: + - type: Sprite + sprite: _CorvaxNext/Objects/Devices/syndicate_teleporter.rsi + state: icon + - type: Item + - type: SyndicateTeleporter + - type: UseDelay + delay: 60 + - type: EmitSoundOnUse + sound: + collection: BrokenDevice + params: + variation: 0.125 diff --git a/Resources/Prototypes/_CorvaxNext/SoundCollections/teleporter.yml b/Resources/Prototypes/_CorvaxNext/SoundCollections/teleporter.yml new file mode 100644 index 00000000000..afa317b6e37 --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/SoundCollections/teleporter.yml @@ -0,0 +1,9 @@ +- type: soundCollection + id: BrokenDevice + files: + - /Audio/_CorvaxNext/Effects/electrical_short_circuit.ogg + +- type: soundCollection + id: ShortCircuit + files: + - /Audio/_CorvaxNext/Effects/electrical_short_circuit2.ogg diff --git a/Resources/Textures/_CorvaxNext/Effects/teleport_sparks.rsi/meta.json b/Resources/Textures/_CorvaxNext/Effects/teleport_sparks.rsi/meta.json new file mode 100644 index 00000000000..44a5e6b62b7 --- /dev/null +++ b/Resources/Textures/_CorvaxNext/Effects/teleport_sparks.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "created by pofitlo", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "sparks", + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + } + ] +} diff --git a/Resources/Textures/_CorvaxNext/Effects/teleport_sparks.rsi/sparks.png b/Resources/Textures/_CorvaxNext/Effects/teleport_sparks.rsi/sparks.png new file mode 100644 index 00000000000..a852aec09fc Binary files /dev/null and b/Resources/Textures/_CorvaxNext/Effects/teleport_sparks.rsi/sparks.png differ diff --git a/Resources/Textures/_CorvaxNext/Objects/Devices/syndicate_teleporter.rsi/icon.png b/Resources/Textures/_CorvaxNext/Objects/Devices/syndicate_teleporter.rsi/icon.png new file mode 100644 index 00000000000..09334d69557 Binary files /dev/null and b/Resources/Textures/_CorvaxNext/Objects/Devices/syndicate_teleporter.rsi/icon.png differ diff --git a/Resources/Textures/_CorvaxNext/Objects/Devices/syndicate_teleporter.rsi/meta.json b/Resources/Textures/_CorvaxNext/Objects/Devices/syndicate_teleporter.rsi/meta.json new file mode 100644 index 00000000000..4e5e9d86e7b --- /dev/null +++ b/Resources/Textures/_CorvaxNext/Objects/Devices/syndicate_teleporter.rsi/meta.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "created by pofitlo", + + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + } + ] +}