From 4304673fd60ade46f65f803325dfe07f2f6f432d Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Thu, 4 Jan 2024 04:11:28 +0900 Subject: [PATCH] Add hardlight spear implant (#587) * Add hardlight spear implant * Small fixes * Fix collision layer --- .../HardlightSpear/HardlightSpearComponent.cs | 12 +++ .../HardlightSpear/HardlightSpearSystem.cs | 79 ++++++++++++++++++ .../en-US/white/items/hardlight_spear.ftl | 5 ++ Resources/Locale/ru-RU/implant/implant.ftl | 2 +- .../ru-RU/white/items/hardlight_spear.ftl | 13 +++ .../Entities/Objects/Weapons/Melee/spear.yml | 5 +- Resources/Prototypes/White/Actions/types.yml | 15 ++++ Resources/Prototypes/White/Catalog/uplink.yml | 11 +++ .../Entities/Objects/Misc/implanters.yml | 10 ++- .../Objects/Misc/subdermal_implants.yml | 12 ++- .../Objects/Weapons/hardlight_spear.yml | 42 ++++++++++ .../hardlight_spear.rsi/equipped-BACKPACK.png | Bin 0 -> 324 bytes .../hardlight_spear.rsi/inhand-left.png | Bin 0 -> 640 bytes .../hardlight_spear.rsi/inhand-right.png | Bin 0 -> 649 bytes .../Weapons/hardlight_spear.rsi/meta.json | 34 ++++++++ .../Weapons/hardlight_spear.rsi/spear.png | Bin 0 -> 526 bytes .../wielded-inhand-left.png | Bin 0 -> 400 bytes .../wielded-inhand-right.png | Bin 0 -> 375 bytes 18 files changed, 235 insertions(+), 5 deletions(-) create mode 100644 Content.Shared/White/HardlightSpear/HardlightSpearComponent.cs create mode 100644 Content.Shared/White/HardlightSpear/HardlightSpearSystem.cs create mode 100644 Resources/Locale/en-US/white/items/hardlight_spear.ftl create mode 100644 Resources/Locale/ru-RU/white/items/hardlight_spear.ftl create mode 100644 Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml create mode 100644 Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/equipped-BACKPACK.png create mode 100644 Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-left.png create mode 100644 Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/inhand-right.png create mode 100644 Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json create mode 100644 Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/spear.png create mode 100644 Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png create mode 100644 Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png 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 0000000000000000000000000000000000000000..4efd16f69cc796b46d5fb6b3034865025c43b95b GIT binary patch literal 324 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|{&~7MhE&XX zd+VTJvjLAw;8gdIUmPV*aXw~XPm8eh{_%d!M$yV<+k=AQPmNN~O$@iUk2*JTr;q8^ zr!qG~e2bj*E{DY*RhsHw5d4#AVnZI&&j(D0g%so?mgq3Po_w|R>-D)W9X2M{mR{Y! zxIF&P62b54FL&vzid}Yf+i%V(b0THt|J(aX_Eh2j_dA!BNL)8QWuVf)GJ!$Jfysk` zv!ak0NGdR@JUGkQ@!|h@CI$wZ8NYWob{vwr{aXF;<*>}&x2a1CxxBJtc5BN=tg&JI z)Ohp>XTg4zjo0t<{`l=Jl+MSxTHn*ce4%JWrRSl2jQRUi1V8pjF#a@a2CEqi4B`cIb_Lo1C3pgSLR^9L|K}e6f#3|oYSmXufqcf2AirP+hi5m^ zK%69RcNeBK?wS-JhrPtp*OmP_j|ek^kj}$oC!o*)PZ!4!i_^&o67w21GWs^0XY_TD ziajk{qHLycgZ)Bp#)QO#9S3@s*|N_(&wVAYlEJefmx;MqWRv!qYX$~;oHn&6ma8&9 z_DV^QsVHs8@8#LFGDvud+Jax%XIC?8F!gvFU9>5B&iD0DsYD}pM$MBSY|LJhcpftf zWFC6bkR@@5<=Ab3hfF&-RBkz}WMP^S-guT_sSroPZq{k1SG90{_|*7hM)+oBpIFYI z?JOrf7hFkfePbLTGv&J5LH8VY<1i}H@RFVp0D&>I0iVIQ`i-h478uY6DY9GDWM4f1=P$x literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..27aef7038a713b70e0fee95310ea486276165a01 GIT binary patch literal 649 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|eg=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zo@Ck7R(*Mse{D1E8|NsBE)_x_CC>*5x0UeIQm?eF$OGfBGQ zp+I-xK2PQSJ{`xi4%uwDwpy97;rN`!usV5{eN06Of*ez{4_KFRXsnf0kh^w|+r;wn zr6V`PHKkiP4`|%o{cqDGwF(#42XWIKYVojzq1$&;%ls^(Zh0&**J}%qK zJon_pOAQU@o|bvbJo{Wz%+z`&i$mMxn);g~7qTN0uHJwAri%Gdg5Yj7FIj$|k5o%s zBT7;dOH!?pi&B9UgOP!ev96(!u8~2AfsvJorIn$%wt<0_fx*>jTQ8z$$jwj5OshoK zU~FYz0nyOO{q{0Yg9hA&lFZ!H;*!MN0(3o=R;I=fJK{S;h$J-NzKi;96_3bqO+dInsa<(VlZ89@5fF<_hTzpg-lEs96ar0FEpd$~Nl7e8wMs5Z1yT$~21drZhDN$Z1|bGURwkBK zhUVG^237_JSEp?SIR&91H$NpatrA^>v6YbpM8j#lSL=WpG~hOrWag$8mn7yEpzE=; zGB$?jaoxgy2dJk6q{k(-IJqdZpd>Rtk3m_%$<^J{Pr=34ldCMXs2C`wV5?xFXTZf- zo|#gT0pu7PadBp(W~OJ9KsZ2~N>YJLr5uo0aY1TgkrEeYN@h_pP|%QzGp#5Q=o~Ox ZS;5uM1#EWnD^+ix{S2N!fpty^O#ouZn^FJ( literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..74cbb4eaf82f7a1736ccf41fb194dc1f6721536e GIT binary patch literal 400 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D%zy*ynULn`LH zofRn5tia=9Ij{Y@oLutni&@MMI;&-Rf7=U_+8mDr= zEqR_owTl<)x)b(G3U{Bpxw3ExQmIGLL!ktw5vy`g;~eh^^ZN#r&VKt+tL@a zwyj;}l%?(Jv}GMj_WG?Nhc@qyo|=5_)~>s%eXD!@^Oxjr*7tm#etyBOulslDT+BRt r<#D$t`-RuDbCWF!_JV@;L1+y_sbHmO*6NcMAcuLn`njxgN@xNAW|FEB literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..111f49782e26fc6ebc31fb0d15ec7acfbb545abd GIT binary patch literal 375 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D%z4Lw~PLn`LH zof$25$biFT^B%o>wIz~|`@db_sC99czxR7}p~QlX>|TsOjX?0C>6qip=YH*SOLZB0 zfwaoowabn@ zxPI3!(s@i$)=6s}HXhVX)4RYJ_bBNnlt}{H>PfuIJ zw_>`&Oi_;T+?kI{%^Q}y*?oKMmQ(IG&l}}`&Hes$-9GI(dv47-GwW}>7tc4z%}zI0 zuk~16|5ZHid)&YMf9hZ&91K{)_hdvD)cxV`FC*-Gtk;QQ`LEsDn;vS R#a@71;_2$=vd$@?2>?H?q$mIY literal 0 HcmV?d00001