diff --git a/Content.Shared/White/HardlightSpear/HardlightSpearComponent.cs b/Content.Shared/White/HardlightSpear/HardlightSpearComponent.cs new file mode 100644 index 0000000000..9d4d5da3f9 --- /dev/null +++ b/Content.Shared/White/HardlightSpear/HardlightSpearComponent.cs @@ -0,0 +1,12 @@ +using Content.Shared.Actions; + +namespace Content.Shared.White.HardlightSpear; + +[RegisterComponent] +public sealed partial class HardlightSpearComponent : Component +{ +} + +public sealed partial class ActivateHardlightSpearImplantEvent : InstantActionEvent +{ +} diff --git a/Content.Shared/White/HardlightSpear/HardlightSpearSystem.cs b/Content.Shared/White/HardlightSpear/HardlightSpearSystem.cs new file mode 100644 index 0000000000..68ec9558e7 --- /dev/null +++ b/Content.Shared/White/HardlightSpear/HardlightSpearSystem.cs @@ -0,0 +1,79 @@ +using System.Linq; +using Content.Shared.Hands.EntitySystems; +using Content.Shared.Implants.Components; +using Content.Shared.Interaction.Events; +using Content.Shared.Item; +using Content.Shared.Physics; +using Content.Shared.Popups; +using Content.Shared.Throwing; +using Robust.Shared.Audio.Systems; +using Robust.Shared.Physics; +using Robust.Shared.Physics.Events; +using Robust.Shared.Spawners; + +namespace Content.Shared.White.HardlightSpear; + +public sealed class HardlightSpearSystem : EntitySystem +{ + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly SharedHandsSystem _hands = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnLand); + SubscribeLocalEvent(OnDrop); + SubscribeLocalEvent(OnPickupAttempt); + SubscribeLocalEvent(OnPreventCollision); + SubscribeLocalEvent(OnImplantActivate); + } + + private void OnPreventCollision(EntityUid uid, HardlightSpearComponent component, ref PreventCollideEvent args) + { + // Opaque collision mask doesn't work for EmbeddableProjectileComponent + if (TryComp(args.OtherEntity, out FixturesComponent? fixtures) && + fixtures.Fixtures.All(fix => (fix.Value.CollisionLayer & (int) CollisionGroup.Opaque) == 0)) + { + args.Cancelled = true; + } + } + + private void OnImplantActivate(EntityUid uid, SubdermalImplantComponent component, + ActivateHardlightSpearImplantEvent args) + { + if (!TryComp(component.ImplantedEntity, out TransformComponent? transform)) + return; + + var spear = EntityManager.SpawnEntity("SpearHardlight", transform.Coordinates); + + if (_hands.TryPickupAnyHand(component.ImplantedEntity.Value, spear)) + { + _audio.PlayPvs("/Audio/Weapons/ebladeon.ogg", spear); + args.Handled = true; + return; + } + + Del(spear); + } + + private void OnPickupAttempt(EntityUid uid, HardlightSpearComponent component, GettingPickedUpAttemptEvent args) + { + if (!HasComp(uid)) + return; + + args.Cancel(); + _popup.PopupClient(Loc.GetString("hardlight-spear-pickup-failed"), uid, args.User); + } + + private void OnDrop(EntityUid uid, HardlightSpearComponent component, DroppedEvent args) + { + EnsureComp(uid); + } + + private void OnLand(EntityUid uid, HardlightSpearComponent component, ref LandEvent args) + { + EnsureComp(uid); + } +} diff --git a/Resources/Locale/en-US/white/items/hardlight_spear.ftl b/Resources/Locale/en-US/white/items/hardlight_spear.ftl new file mode 100644 index 0000000000..0dd36db018 --- /dev/null +++ b/Resources/Locale/en-US/white/items/hardlight_spear.ftl @@ -0,0 +1,5 @@ +hardlight-spear-pickup-failed = You can't pick up hardlight spear. +use-hardlight-spear-implant-action-name = Create hardlight spear +use-hardlight-spear-implant-action-description = Creates hardlight spear in your hands. +uplink-hardlight-spear-implant-name = Hardlight spear implanter +uplink-hardlight-spear-implant-desc = An implant injected into the body, and later activated at the user's will. It will summon a spear made out of hardlight that the user can use to wreak havoc. diff --git a/Resources/Locale/ru-RU/implant/implant.ftl b/Resources/Locale/ru-RU/implant/implant.ftl index 33c79386dc..d98a5be308 100644 --- a/Resources/Locale/ru-RU/implant/implant.ftl +++ b/Resources/Locale/ru-RU/implant/implant.ftl @@ -11,7 +11,7 @@ implanter-inject-text = Установка implanter-empty-text = Пусто implanter-implant-text = { $implantName }{ $lineBreak }{ $implantDescription } implanter-contained-implant-text = [color=green]{ $desc }[/color] -implanter-label = [color=white]Имплант: { $currentEntities }{ $lineBreak }Режим: { $modeString }[/color] +implanter-label = [color=white]Имплант: { $implantName }{ $lineBreak }Режим: { $modeString }[/color] ## Implanter Actions diff --git a/Resources/Locale/ru-RU/white/items/hardlight_spear.ftl b/Resources/Locale/ru-RU/white/items/hardlight_spear.ftl new file mode 100644 index 0000000000..3e6d783a7a --- /dev/null +++ b/Resources/Locale/ru-RU/white/items/hardlight_spear.ftl @@ -0,0 +1,13 @@ +hardlight-spear-pickup-failed = Вы не можете подобрать световое копьё. +use-hardlight-spear-implant-action-name = Создать световое копьё. +use-hardlight-spear-implant-action-description = Создает световое копьё в ваших руках. +uplink-hardlight-spear-implant-name = Имплантатор световое копьё +uplink-hardlight-spear-implant-desc = Имплант, вводимый в тело и активируемый по желанию пользователя. Он вызывает копье из твердого света, с помощью которого пользователь может сеять хаос. + +ent-SpearHardlight = световое копьё + .desc = Копьё из твердого света. + +ent-HardlightSpearImplanter = имплантатор световое копьё + +ent-HardlightSpearImplant = имплант световое копьё + .desc = Этот имплант создаёт световое копьё в ваших руках. diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/spear.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/spear.yml index 4dff7f3ee1..f870bbbf50 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/spear.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/spear.yml @@ -16,8 +16,8 @@ fix1: shape: !type:PolygonShape vertices: - - -0.40,-0.30 - - -0.30,-0.40 + - -0.20,-0.10 + - -0.10,-0.20 - 0.40,0.30 - 0.30,0.40 density: 20 @@ -42,6 +42,7 @@ animation: WeaponArcThrust soundHit: path: /Audio/Weapons/bladeslice.ogg + range: 2 # Spears are long - type: DamageOtherOnHit damage: types: diff --git a/Resources/Prototypes/White/Actions/types.yml b/Resources/Prototypes/White/Actions/types.yml index 640129826c..58a92d084a 100644 --- a/Resources/Prototypes/White/Actions/types.yml +++ b/Resources/Prototypes/White/Actions/types.yml @@ -12,3 +12,18 @@ sprite: Objects/Weapons/Grenades/smoke.rsi state: icon event: !type:ActivateImplantEvent + +- type: entity + id: ActivateHardlightSpearImplant + name: use-hardlight-spear-implant-action-name + description: use-hardlight-spear-implant-action-description + noSpawn: true + components: + - type: InstantAction + useDelay: 1.5 + itemIconStyle: BigAction + priority: -20 + icon: + sprite: White/Objects/Weapons/hardlight_spear.rsi + state: spear + event: !type:ActivateHardlightSpearImplantEvent diff --git a/Resources/Prototypes/White/Catalog/uplink.yml b/Resources/Prototypes/White/Catalog/uplink.yml index 11b52af8e4..9e1dc62a02 100644 --- a/Resources/Prototypes/White/Catalog/uplink.yml +++ b/Resources/Prototypes/White/Catalog/uplink.yml @@ -73,3 +73,14 @@ Telecrystal: 2 categories: - UplinkImplants + +- type: listing + id: UplinkHardlightSpearImplanter + name: uplink-hardlight-spear-implant-name + description: uplink-hardlight-spear-implant-desc + icon: { sprite: /Textures/White/Objects/Weapons/hardlight_spear.rsi, state: spear } + productEntity: HardlightSpearImplanter + cost: + Telecrystal: 15 + categories: + - UplinkImplants diff --git a/Resources/Prototypes/White/Entities/Objects/Misc/implanters.yml b/Resources/Prototypes/White/Entities/Objects/Misc/implanters.yml index ed9c98665b..4970be67b5 100644 --- a/Resources/Prototypes/White/Entities/Objects/Misc/implanters.yml +++ b/Resources/Prototypes/White/Entities/Objects/Misc/implanters.yml @@ -1,7 +1,15 @@ - type: entity id: SmokeImplanter - name: Имплант дыма + name: имплант дыма parent: BaseImplantOnlyImplanterSyndi components: - type: Implanter implant: SmokeImplant + +- type: entity + id: HardlightSpearImplanter + name: hardlight spear implanter + parent: BaseImplantOnlyImplanterSyndi + components: + - type: Implanter + implant: HardlightSpearImplant diff --git a/Resources/Prototypes/White/Entities/Objects/Misc/subdermal_implants.yml b/Resources/Prototypes/White/Entities/Objects/Misc/subdermal_implants.yml index ef97cb1ef4..686d3b4283 100644 --- a/Resources/Prototypes/White/Entities/Objects/Misc/subdermal_implants.yml +++ b/Resources/Prototypes/White/Entities/Objects/Misc/subdermal_implants.yml @@ -1,7 +1,7 @@ - type: entity parent: BaseSubdermalImplant id: SmokeImplant - name: Имплант дыма + name: имплант дыма description: Этот имплант выпускает облако дыма при активации. noSpawn: true components: @@ -13,3 +13,13 @@ duration: 15 - type: SoundOnTrigger sound: /Audio/Effects/smoke.ogg + +- type: entity + parent: BaseSubdermalImplant + id: HardlightSpearImplant + name: hardlight spear implant + description: This implant creates hardlight spear in your hands. + noSpawn: true + components: + - type: SubdermalImplant + implantAction: ActivateHardlightSpearImplant diff --git a/Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml b/Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml new file mode 100644 index 0000000000..929a166d6c --- /dev/null +++ b/Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml @@ -0,0 +1,42 @@ +- type: entity + name: hardlight spear + parent: Spear + id: SpearHardlight + description: A spear made out of hardened light. + components: + - type: Sprite + sprite: White/Objects/Weapons/hardlight_spear.rsi + - type: MeleeWeapon + damage: + types: + Piercing: 18 + Heat: 18 + soundHit: + path: /Audio/Weapons/smash.ogg + - type: DamageOtherOnHit + damage: + types: + Piercing: 30 + Heat: 30 + - type: Wieldable + - type: IncreaseDamageOnWield + damage: + types: + Piercing: 4 + Heat: 4 + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 30 #excess damage avoids cost of spawning entities. + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: EmbeddableProjectile + offset: 0.15,0.15 + deleteOnRemove: true + - type: HardlightSpear + - type: PointLight + radius: 1.5 + energy: 2 + color: yellow diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/equipped-BACKPACK.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/equipped-BACKPACK.png new file mode 100644 index 0000000000..4efd16f69c Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/equipped-BACKPACK.png differ diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-left.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-left.png new file mode 100644 index 0000000000..0bb135ee5e Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-left.png differ diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-right.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-right.png new file mode 100644 index 0000000000..27aef7038a Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-right.png differ diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json new file mode 100644 index 0000000000..94fc8982f9 --- /dev/null +++ b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json @@ -0,0 +1,34 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from monkestation at https://github.com/Monkestation/MonkeStation/commit/c995c9bda2c23386614ac1cb00aca552f573ba9f, equipped and wielded sprites by Aviu", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "spear" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + }, + { + "name": "wielded-inhand-left", + "directions": 4 + }, + { + "name": "wielded-inhand-right", + "directions": 4 + }, + { + "name": "equipped-BACKPACK", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/spear.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/spear.png new file mode 100644 index 0000000000..df63e0c8fd Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/spear.png differ diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png new file mode 100644 index 0000000000..74cbb4eaf8 Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png differ diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png new file mode 100644 index 0000000000..111f49782e Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png differ