Skip to content

Commit

Permalink
[Port] Surgery fixes: Diamond Fish (#926)
Browse files Browse the repository at this point in the history
* хирургия на рыбе

хирургия на рыбе

Co-Authored-By: deltanedas <@deltanedas:kde.org>

* Shadowkin upgrade + commentary fixes

* add localization

* kill BreathingImmunity

---------

Co-authored-by: deltanedas <[email protected]>
  • Loading branch information
Roudenn and deltanedas authored Nov 23, 2024
1 parent 892e75e commit e2cd9b9
Show file tree
Hide file tree
Showing 18 changed files with 193 additions and 4 deletions.
1 change: 1 addition & 0 deletions Content.Server/Backmen/Blob/ZombieBlobSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public override void Update(float frameTime)
}
continue;
}
else
// end-backmen: blob zombie
if (respirator.Saturation < respirator.SuffocationThreshold)
{
Expand Down
26 changes: 26 additions & 0 deletions Content.Server/_Shitmed/Body/Organ/StatusEffectOrganComponent.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// List of status effects and components to refresh while the organ is installed.
/// </summary>
[DataField(required: true)]
public Dictionary<ProtoId<StatusEffectPrototype>, string> Refresh = new();

/// <summary>
/// How long to wait between each refresh.
/// Effects can only last at most this long once the organ is removed.
/// </summary>
[DataField]
public TimeSpan Delay = TimeSpan.FromSeconds(5);

[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan NextUpdate = TimeSpan.Zero;
}
33 changes: 33 additions & 0 deletions Content.Server/_Shitmed/Body/Organ/StatusEffectOrganSystem.cs
Original file line number Diff line number Diff line change
@@ -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<StatusEffectOrganComponent, OrganComponent>();
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<StatusEffectsComponent>(body, out var effects))
continue;

foreach (var (key, component) in comp.Refresh)
{
_effects.TryAddStatusEffect(body, key, comp.Delay, refresh: true, component, effects);
}
}
}
}
1 change: 1 addition & 0 deletions Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private void OnBodyPartRemove(Entity<BodyPartComponent> ent, ref ComponentRemove
if (ent.Comp.PartType == BodyPartType.Torso)
_slots.RemoveItemSlot(ent, ent.Comp.ItemInsertionSlot);
}

private void OnBodyPartInserted(Entity<BodyPartComponent> ent, ref EntInsertedIntoContainerMessage args)
{
// Body part inserted into another body part.
Expand Down
6 changes: 6 additions & 0 deletions Resources/Locale/ru-RU/backmen/surgery/surgery-items.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ ent-MedicalBiofabMachineBoard = медицинский биофабрикато
.desc = Машинная плата, необходимая для создания медицинского биофабрикатора.
ent-BoneGel = бутылка костяного геля
.desc = Контейнер для костяного геля, нужно время от времени пополнять в специальной машине.
ent-OrganSpaceAnimalLungs = космические лёгкие
ent-OrganSpaceAnimalHeart = космическое сердце
ent-TorsoCarp = туловище карпа
ent-TailCarp = плавник карпа
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ent-SurgeryAttachLeftHand = Прикрепить левую ладонь
ent-SurgeryAttachRightHand = Прикрепить правую ладонь
ent-SurgeryAttachLeftFoot = Прикрепить левую стопу
ent-SurgeryAttachRightFoot = Прикрепить правую стопу
ent-SurgeryAttachTail = Прикрепить хвост
ent-SurgeryTendWoundsBrute = Восстановить механические повреждения
ent-SurgeryTendWoundsBurn = Восстановить термические повреждения
Expand Down
9 changes: 9 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions Resources/Prototypes/_Backmen/Body/Prototypes/carp.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
stomach: OrganShadowkinStomach
liver: OrganShadowkinLiver
kidneys: OrganShadowkinKidneys
lungs: OrganHumanLungs
lungs: OrganSpaceAnimalLungs
right arm:
part: RightArmShadowkin
connections:
Expand Down
19 changes: 18 additions & 1 deletion Resources/Prototypes/_Backmen/Entities/Surgery/surgeries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion Resources/Prototypes/_Backmen/status_effects.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
- type: statusEffect
id: ZombieDisease #Praise him
id: ZombieDisease #Praise him

- type: statusEffect
id: BreathingImmunity
alwaysAllowed: true # Used by space animal lungs to work on anything

- type: statusEffect
id: Brainrotted
17 changes: 17 additions & 0 deletions Resources/Prototypes/_Goobstation/Body/Organs/Animal/space.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions Resources/Prototypes/_Goobstation/Body/Prototypes/Animal/carp.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Resources/Prototypes/status_effects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

- type: statusEffect
id: PressureImmunity
alwaysAllowed: true # Backmen: Used by space animal heart to work on anything

- type: statusEffect
id: Muted
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e2cd9b9

Please sign in to comment.