From e2cd9b9e2fca6562a45776ee48670c6c5be0981f Mon Sep 17 00:00:00 2001 From: Rouden <149893554+Roudenn@users.noreply.github.com> Date: Sun, 24 Nov 2024 01:34:46 +0300 Subject: [PATCH] [Port] Surgery fixes: Diamond Fish (#926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * хирургия на рыбе хирургия на рыбе Co-Authored-By: deltanedas <@deltanedas:kde.org> * Shadowkin upgrade + commentary fixes * add localization * kill BreathingImmunity --------- Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> --- .../Backmen/Blob/ZombieBlobSystem.cs | 1 + .../Body/Systems/RespiratorSystem.cs | 1 - .../Body/Organ/StatusEffectOrganComponent.cs | 26 ++++++++++++ .../Body/Organ/StatusEffectOrganSystem.cs | 33 ++++++++++++++++ .../Body/Systems/SharedBodySystem.Parts.cs | 1 + .../ru-RU/backmen/surgery/surgery-items.ftl | 6 +++ .../backmen/surgery/surgery-operations.ftl | 1 + .../Prototypes/Entities/Mobs/NPCs/carp.yml | 9 +++++ .../_Backmen/Body/Prototypes/carp.yml | 37 ++++++++++++++++++ .../_Backmen/Body/Prototypes/shadowkin.yml | 2 +- .../_Backmen/Entities/Surgery/surgeries.yml | 19 ++++++++- .../Prototypes/_Backmen/status_effects.yml | 9 ++++- .../_Goobstation/Body/Organs/Animal/space.yml | 17 ++++++++ .../Body/Prototypes/Animal/carp.yml | 17 ++++++++ Resources/Prototypes/status_effects.yml | 1 + .../Aliens/Carps/carp_parts.rsi/meta.json | 17 ++++++++ .../Mobs/Aliens/Carps/carp_parts.rsi/tail.png | Bin 0 -> 244 bytes .../Aliens/Carps/carp_parts.rsi/torso.png | Bin 0 -> 479 bytes 18 files changed, 193 insertions(+), 4 deletions(-) create mode 100644 Content.Server/_Shitmed/Body/Organ/StatusEffectOrganComponent.cs create mode 100644 Content.Server/_Shitmed/Body/Organ/StatusEffectOrganSystem.cs create mode 100644 Resources/Prototypes/_Backmen/Body/Prototypes/carp.yml create mode 100644 Resources/Prototypes/_Goobstation/Body/Organs/Animal/space.yml create mode 100644 Resources/Prototypes/_Goobstation/Body/Prototypes/Animal/carp.yml create mode 100644 Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/meta.json create mode 100644 Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/tail.png create mode 100644 Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/torso.png diff --git a/Content.Server/Backmen/Blob/ZombieBlobSystem.cs b/Content.Server/Backmen/Blob/ZombieBlobSystem.cs index 0155a6a6a3c..63a79a6fe1b 100644 --- a/Content.Server/Backmen/Blob/ZombieBlobSystem.cs +++ b/Content.Server/Backmen/Blob/ZombieBlobSystem.cs @@ -17,6 +17,7 @@ using Content.Shared.Atmos; using Content.Shared.Backmen.Blob; using Content.Shared.Backmen.Blob.Components; +using Content.Shared.Backmen.Surgery.Body; using Content.Shared.Damage; using Content.Shared.Inventory; using Content.Shared.Mind.Components; diff --git a/Content.Server/Body/Systems/RespiratorSystem.cs b/Content.Server/Body/Systems/RespiratorSystem.cs index 81ae54c51bf..57a88da049c 100644 --- a/Content.Server/Body/Systems/RespiratorSystem.cs +++ b/Content.Server/Body/Systems/RespiratorSystem.cs @@ -104,7 +104,6 @@ public override void Update(float frameTime) } continue; } - else // end-backmen: blob zombie if (respirator.Saturation < respirator.SuffocationThreshold) { diff --git a/Content.Server/_Shitmed/Body/Organ/StatusEffectOrganComponent.cs b/Content.Server/_Shitmed/Body/Organ/StatusEffectOrganComponent.cs new file mode 100644 index 00000000000..640f61d5e8e --- /dev/null +++ b/Content.Server/_Shitmed/Body/Organ/StatusEffectOrganComponent.cs @@ -0,0 +1,26 @@ +using Content.Shared.StatusEffect; +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; + +namespace Content.Server._Shitmed.Body.Organ; + +[RegisterComponent, Access(typeof(StatusEffectOrganSystem))] +[AutoGenerateComponentPause] +public sealed partial class StatusEffectOrganComponent : Component +{ + /// + /// List of status effects and components to refresh while the organ is installed. + /// + [DataField(required: true)] + public Dictionary, string> Refresh = new(); + + /// + /// How long to wait between each refresh. + /// Effects can only last at most this long once the organ is removed. + /// + [DataField] + public TimeSpan Delay = TimeSpan.FromSeconds(5); + + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] + public TimeSpan NextUpdate = TimeSpan.Zero; +} diff --git a/Content.Server/_Shitmed/Body/Organ/StatusEffectOrganSystem.cs b/Content.Server/_Shitmed/Body/Organ/StatusEffectOrganSystem.cs new file mode 100644 index 00000000000..b3394b7dd91 --- /dev/null +++ b/Content.Server/_Shitmed/Body/Organ/StatusEffectOrganSystem.cs @@ -0,0 +1,33 @@ +using Content.Shared.Body.Organ; +using Content.Shared.StatusEffect; +using Robust.Shared.Timing; + +namespace Content.Server._Shitmed.Body.Organ; + +public sealed class StatusEffectOrganSystem : EntitySystem +{ + [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly StatusEffectsSystem _effects = default!; + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var query = EntityQueryEnumerator(); + var now = _timing.CurTime; + while (query.MoveNext(out var uid, out var comp, out var organ)) + { + if (now < comp.NextUpdate || organ.Body is not {} body) + continue; + + comp.NextUpdate = now + comp.Delay; + if (!TryComp(body, out var effects)) + continue; + + foreach (var (key, component) in comp.Refresh) + { + _effects.TryAddStatusEffect(body, key, comp.Delay, refresh: true, component, effects); + } + } + } +} diff --git a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs index e6d76e56ab9..f4f24542220 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs @@ -52,6 +52,7 @@ private void OnBodyPartRemove(Entity ent, ref ComponentRemove if (ent.Comp.PartType == BodyPartType.Torso) _slots.RemoveItemSlot(ent, ent.Comp.ItemInsertionSlot); } + private void OnBodyPartInserted(Entity ent, ref EntInsertedIntoContainerMessage args) { // Body part inserted into another body part. diff --git a/Resources/Locale/ru-RU/backmen/surgery/surgery-items.ftl b/Resources/Locale/ru-RU/backmen/surgery/surgery-items.ftl index 15cb777981e..bb731b29f74 100644 --- a/Resources/Locale/ru-RU/backmen/surgery/surgery-items.ftl +++ b/Resources/Locale/ru-RU/backmen/surgery/surgery-items.ftl @@ -31,3 +31,9 @@ ent-MedicalBiofabMachineBoard = медицинский биофабрикато .desc = Машинная плата, необходимая для создания медицинского биофабрикатора. ent-BoneGel = бутылка костяного геля .desc = Контейнер для костяного геля, нужно время от времени пополнять в специальной машине. + +ent-OrganSpaceAnimalLungs = космические лёгкие +ent-OrganSpaceAnimalHeart = космическое сердце + +ent-TorsoCarp = туловище карпа +ent-TailCarp = плавник карпа diff --git a/Resources/Locale/ru-RU/backmen/surgery/surgery-operations.ftl b/Resources/Locale/ru-RU/backmen/surgery/surgery-operations.ftl index dd7bfaeee9b..37ffba1a853 100644 --- a/Resources/Locale/ru-RU/backmen/surgery/surgery-operations.ftl +++ b/Resources/Locale/ru-RU/backmen/surgery/surgery-operations.ftl @@ -43,6 +43,7 @@ ent-SurgeryAttachLeftHand = Прикрепить левую ладонь ent-SurgeryAttachRightHand = Прикрепить правую ладонь ent-SurgeryAttachLeftFoot = Прикрепить левую стопу ent-SurgeryAttachRightFoot = Прикрепить правую стопу +ent-SurgeryAttachTail = Прикрепить хвост ent-SurgeryTendWoundsBrute = Восстановить механические повреждения ent-SurgeryTendWoundsBurn = Восстановить термические повреждения diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml index 872551741c4..f92877e962d 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml @@ -99,6 +99,15 @@ - type: NightVision isToggle: true color: "#808080" + # start-backmen: surgery + - type: Body + prototype: Carp + - type: SurgeryTarget + - type: UserInterface + interfaces: + enum.SurgeryUIKey.Key: + type: SurgeryBui + # end-backmen: surgery - type: entity parent: BaseMobCarp diff --git a/Resources/Prototypes/_Backmen/Body/Prototypes/carp.yml b/Resources/Prototypes/_Backmen/Body/Prototypes/carp.yml new file mode 100644 index 00000000000..44d831cba87 --- /dev/null +++ b/Resources/Prototypes/_Backmen/Body/Prototypes/carp.yml @@ -0,0 +1,37 @@ +- type: entity + abstract: true + parent: PartAnimal + id: BaseCarpPart + components: + - type: Sprite + sprite: _Goobstation/Mobs/Aliens/Carps/carp_parts.rsi + +- type: entity + categories: [ HideSpawnMenu ] + parent: BaseCarpPart + id: TailCarp + name: carp tail + description: Unique glands in this tail let space carp fly in a vacuum. + components: + - type: Sprite + layers: + - state: tail + - type: BodyPart + partType: Tail + - type: MovementBodyPart + walkSpeed: 2.5 + sprintSpeed: 3.5 + # TODO: Make it actually needed. Legs are hardcoded to be the only parts that matter for movement. + # TODO: space flight stuff + +- type: entity + categories: [ HideSpawnMenu ] + parent: BaseCarpPart + id: TorsoCarp + name: carp torso + components: + - type: Sprite + layers: + - state: torso + - type: BodyPart + partType: Torso diff --git a/Resources/Prototypes/_Backmen/Body/Prototypes/shadowkin.yml b/Resources/Prototypes/_Backmen/Body/Prototypes/shadowkin.yml index 652fee55b3d..b111c558d18 100644 --- a/Resources/Prototypes/_Backmen/Body/Prototypes/shadowkin.yml +++ b/Resources/Prototypes/_Backmen/Body/Prototypes/shadowkin.yml @@ -23,7 +23,7 @@ stomach: OrganShadowkinStomach liver: OrganShadowkinLiver kidneys: OrganShadowkinKidneys - lungs: OrganHumanLungs + lungs: OrganSpaceAnimalLungs right arm: part: RightArmShadowkin connections: diff --git a/Resources/Prototypes/_Backmen/Entities/Surgery/surgeries.yml b/Resources/Prototypes/_Backmen/Entities/Surgery/surgeries.yml index 43d8adfd6ed..2c48f1a09e7 100644 --- a/Resources/Prototypes/_Backmen/Entities/Surgery/surgeries.yml +++ b/Resources/Prototypes/_Backmen/Entities/Surgery/surgeries.yml @@ -281,7 +281,24 @@ - type: SurgeryPartRemovedCondition connection: feet part: Foot - symmetry: None + +- type: entity + parent: SurgeryBase + id: SurgeryAttachTail + name: Attach Tail + categories: [ HideSpawnMenu ] + components: + - type: Surgery + requirement: SurgeryOpenIncision + steps: + - SurgeryStepInsertFeature + - SurgeryStepSealWounds + - type: SurgeryPartCondition + part: Torso + - type: SurgeryPartRemovedCondition + connection: tail + part: Tail + #symmetry: None #- type: entity # parent: SurgeryBase diff --git a/Resources/Prototypes/_Backmen/status_effects.yml b/Resources/Prototypes/_Backmen/status_effects.yml index 387e94fb72d..50cc459e0af 100644 --- a/Resources/Prototypes/_Backmen/status_effects.yml +++ b/Resources/Prototypes/_Backmen/status_effects.yml @@ -1,2 +1,9 @@ - type: statusEffect - id: ZombieDisease #Praise him \ No newline at end of file + id: ZombieDisease #Praise him + +- type: statusEffect + id: BreathingImmunity + alwaysAllowed: true # Used by space animal lungs to work on anything + +- type: statusEffect + id: Brainrotted diff --git a/Resources/Prototypes/_Goobstation/Body/Organs/Animal/space.yml b/Resources/Prototypes/_Goobstation/Body/Organs/Animal/space.yml new file mode 100644 index 00000000000..540d374c1f8 --- /dev/null +++ b/Resources/Prototypes/_Goobstation/Body/Organs/Animal/space.yml @@ -0,0 +1,17 @@ +- type: entity + parent: OrganAnimalLungs + id: OrganSpaceAnimalLungs + name: space animal lungs + components: + - type: StatusEffectOrgan + refresh: + BreathingImmunity: RespiratorImmunity + +- type: entity + parent: OrganAnimalHeart + id: OrganSpaceAnimalHeart + name: space animal heart + components: + - type: StatusEffectOrgan + refresh: + PressureImmunity: PressureImmunity diff --git a/Resources/Prototypes/_Goobstation/Body/Prototypes/Animal/carp.yml b/Resources/Prototypes/_Goobstation/Body/Prototypes/Animal/carp.yml new file mode 100644 index 00000000000..81bf6a4bd5c --- /dev/null +++ b/Resources/Prototypes/_Goobstation/Body/Prototypes/Animal/carp.yml @@ -0,0 +1,17 @@ +- type: body + id: Carp + name: carp + root: torso + slots: + torso: + part: TorsoAnimal + connections: + - tail + organs: + lungs: OrganSpaceAnimalLungs # Immunity to airloss + stomach: OrganAnimalStomach + liver: OrganAnimalLiver + heart: OrganSpaceAnimalHeart # Immunity to cold + kidneys: OrganAnimalKidneys + tail: + part: TailCarp diff --git a/Resources/Prototypes/status_effects.yml b/Resources/Prototypes/status_effects.yml index 49e5ccc5794..7d8938c6f52 100644 --- a/Resources/Prototypes/status_effects.yml +++ b/Resources/Prototypes/status_effects.yml @@ -36,6 +36,7 @@ - type: statusEffect id: PressureImmunity + alwaysAllowed: true # Backmen: Used by space animal heart to work on anything - type: statusEffect id: Muted diff --git a/Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/meta.json b/Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/meta.json new file mode 100644 index 00000000000..cdecf550def --- /dev/null +++ b/Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/meta.json @@ -0,0 +1,17 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from and modified by deltanedas (github) for GoobStation", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "tail" + }, + { + "name": "torso" + } + ] +} diff --git a/Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/tail.png b/Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/tail.png new file mode 100644 index 0000000000000000000000000000000000000000..bb0b9458102d2bc45fcb23a1299ec5d627695ab9 GIT binary patch literal 244 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?4jBOuH;Rhv&5D7ehi z#W5tJ_3h--oX&~@uJ5@Sxo1wxIlz~5c&_Y?hOav|w>C!ZGFt5*By{LSv%rkaMGL>j z)Hftbw0%tOGj{UQ{A|akxWZ`tZYKr-K?Vln)tj%d7M%-rxpyim`xTS;Tc$L(o{tq% zdkwD?C4A7poqON4?wWY6Pv_9;3 n9Qsl0-tV8a(?B+<-(j%1;hefA>G*M=iy1s!{an^LB{Ts5fYV&u literal 0 HcmV?d00001 diff --git a/Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/torso.png b/Resources/Textures/_Goobstation/Mobs/Aliens/Carps/carp_parts.rsi/torso.png new file mode 100644 index 0000000000000000000000000000000000000000..ab0f5ff82f052cdae7df742d3821405ddace5baa GIT binary patch literal 479 zcmV<50U-W~P)@dbnRWJ$1S(W2k3w>ckat()*(Rn@GV z9~JTnsbM%CkE5JP1EI_T4Dfh7fX|93rLfi}2Ap%rSf|rzko9K{Gz^;OInFt} z_iY8f0s~lU(ONe{KX7883mqFY%QA!ztX8W@Fo5?S7~ehbalkp(d%_HYgb*$Kdc7tv z?>(E%hTU%0!ljgGt(({DmF%p^p3labT002ovPDHLkV1juf(YOEr literal 0 HcmV?d00001