Skip to content

Commit

Permalink
Ports Shitmed Updates From Goob (#1387)
Browse files Browse the repository at this point in the history
Lots of stuff. Also moved everything I could to the _Shitmed namespace
as I do in Goob. Will make future ports way faster

# Changelog
:cl: Mocho
- add: Added some fun organs and other thingies, check out the Goob PRs
if you want more details.
- fix: Fixed tons of issues with shitmed. Too many for the changelog in
fact.
  • Loading branch information
gluesniffler authored Dec 31, 2024
1 parent 98e8af5 commit 3c9db94
Show file tree
Hide file tree
Showing 689 changed files with 7,488 additions and 2,324 deletions.
6 changes: 5 additions & 1 deletion Content.Client/Body/Systems/BodySystem.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using Content.Shared.Body.Systems;
using Content.Shared.Body.Part;
// Shitmed Change Start
using Content.Shared._Shitmed.Body.Part;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;
using Content.Shared.Body.Components;
// Shitmed Change End

namespace Content.Client.Body.Systems;

public sealed class BodySystem : SharedBodySystem
{
// Shitmed Change Start
[Dependency] private readonly MarkingManager _markingManager = default!;

private void ApplyMarkingToPart(MarkingPrototype markingPrototype,
Expand Down Expand Up @@ -69,4 +72,5 @@ protected override void RemoveBodyMarkings(EntityUid target, BodyPartAppearanceC
{
return;
}
// Shitmed Change End
}
9 changes: 6 additions & 3 deletions Content.Client/Hands/Systems/HandsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
using Content.Client.Examine;
using Content.Client.Strip;
using Content.Client.Verbs.UI;
using Content.Shared.Body.Part;
using Content.Shared._Shitmed.Body.Events; // Shitmed Change
using Content.Shared.Body.Part; // Shitmed Change
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
Expand Down Expand Up @@ -49,8 +50,8 @@ public override void Initialize()
SubscribeLocalEvent<HandsComponent, ComponentShutdown>(OnHandsShutdown);
SubscribeLocalEvent<HandsComponent, ComponentHandleState>(HandleComponentState);
SubscribeLocalEvent<HandsComponent, VisualsChangedEvent>(OnVisualsChanged);
SubscribeLocalEvent<HandsComponent, BodyPartRemovedEvent>(HandleBodyPartRemoved);
SubscribeLocalEvent<HandsComponent, BodyPartDisabledEvent>(HandleBodyPartDisabled);
SubscribeLocalEvent<HandsComponent, BodyPartRemovedEvent>(HandleBodyPartRemoved); // Shitmed Change
SubscribeLocalEvent<HandsComponent, BodyPartDisabledEvent>(HandleBodyPartDisabled); // Shitmed Change

OnHandSetActive += OnHandActivated;
}
Expand Down Expand Up @@ -244,6 +245,7 @@ public void UIHandAltActivateItem(string handName)

#region visuals

// Shitmed Change Start
private void HideLayers(EntityUid uid, HandsComponent component, Entity<BodyPartComponent> part, SpriteComponent? sprite = null)
{
if (part.Comp.PartType != BodyPartType.Hand || !Resolve(uid, ref sprite, logMissing: false))
Expand All @@ -270,6 +272,7 @@ private void HideLayers(EntityUid uid, HandsComponent component, Entity<BodyPart

private void HandleBodyPartDisabled(EntityUid uid, HandsComponent component, ref BodyPartDisabledEvent args) => HideLayers(uid, component, args.Part);

// Shitmed Change End
protected override void HandleEntityInserted(EntityUid uid, HandsComponent hands, EntInsertedIntoContainerMessage args)
{
base.HandleEntityInserted(uid, hands, args);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Shared.MedicalScanner;
using Content.Shared.Targeting;
using Content.Shared._Shitmed.Targeting; // Shitmed Change
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;

namespace Content.Client.HealthAnalyzer.UI
{
Expand All @@ -18,15 +18,13 @@ public HealthAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owne
protected override void Open()
{
base.Open();
_window = new HealthAnalyzerWindow
{
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName,
};
_window.OnClose += Close;
_window.OnBodyPartSelected += SendBodyPartMessage;
_window.OpenCentered();

_window = this.CreateWindow<HealthAnalyzerWindow>();
_window.OnBodyPartSelected += SendBodyPartMessage; // Shitmed Change
_window.Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName;
}


protected override void ReceiveMessage(BoundUserInterfaceMessage message)
{
if (_window == null)
Expand All @@ -38,21 +36,20 @@ protected override void ReceiveMessage(BoundUserInterfaceMessage message)
_window.Populate(cast);
}

// Shitmed Change Start
private void SendBodyPartMessage(TargetBodyPart? part, EntityUid target) => SendMessage(new HealthAnalyzerPartMessage(EntMan.GetNetEntity(target), part ?? null));

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

if (_window != null)
{
_window.OnClose -= Close;
_window.OnBodyPartSelected -= SendBodyPartMessage;
}

_window?.Dispose();
}

// Shitmed Change End
}
}
6 changes: 5 additions & 1 deletion Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
MaxHeight="525"
MinWidth="350">
MinWidth="350"> <!-- Shitmed Change -->
<ScrollContainer
Margin="5 5 5 5"
ReturnMeasure="True"
Expand All @@ -14,14 +14,17 @@
<Label
Name="NoPatientDataText"
Text="{Loc health-analyzer-window-no-patient-data-text}"/>
<!-- Shitmed Change Start -->
<Button Name="ReturnButton"
Text="{Loc 'health-analyzer-window-return-button-text'}"
Margin="0 0 0 10"
HorizontalExpand="False"/>
<!-- Shitmed Change End -->
<BoxContainer
Name="PatientDataContainer"
Margin="0 0 0 5"
Orientation="Vertical">
<!-- Shitmed Change Start -->
<BoxContainer Orientation="Horizontal"
Margin="0 0 0 5">
<PanelContainer>
Expand Down Expand Up @@ -222,6 +225,7 @@
</BoxContainer>

<PanelContainer StyleClasses="LowDivider"/>
<!-- Shitmed Change End -->

<BoxContainer
Name="GroupsContainer"
Expand Down
54 changes: 21 additions & 33 deletions Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
using System.Linq;
using System.Numerics;
using Content.Client.Message;
using Content.Shared.Atmos;
using Content.Client.UserInterface.Controls;
using Content.Shared.Alert;
using Content.Shared._Shitmed.Targeting; // Shitmed
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Targeting; // Shitmed
using Content.Shared.FixedPoint;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.IdentityManagement;
using Content.Shared.Inventory;
using Content.Shared.MedicalScanner;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Nutrition.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

Expand All @@ -37,7 +31,7 @@ public sealed partial class HealthAnalyzerWindow : FancyWindow
private readonly IPrototypeManager _prototypes;
private readonly IResourceCache _cache;

// Start-Shitmed
// Shitmed Change Start
public event Action<TargetBodyPart?, EntityUid>? OnBodyPartSelected;
private EntityUid _spriteViewEntity;

Expand All @@ -46,8 +40,7 @@ public sealed partial class HealthAnalyzerWindow : FancyWindow

private readonly Dictionary<TargetBodyPart, TextureButton> _bodyPartControls;
private EntityUid? _target;

// End-Shitmed
// Shitmed Change End

public HealthAnalyzerWindow()
{
Expand All @@ -58,7 +51,7 @@ public HealthAnalyzerWindow()
_spriteSystem = _entityManager.System<SpriteSystem>();
_prototypes = dependencies.Resolve<IPrototypeManager>();
_cache = dependencies.Resolve<IResourceCache>();
// Start-Shitmed
// Shitmed Change Start
_bodyPartControls = new Dictionary<TargetBodyPart, TextureButton>
{
{ TargetBodyPart.Head, HeadButton },
Expand All @@ -80,9 +73,10 @@ public HealthAnalyzerWindow()
bodyPartButton.Value.OnPressed += _ => SetActiveBodyPart(bodyPartButton.Key, bodyPartButton.Value);
}
ReturnButton.OnPressed += _ => ResetBodyPart();
// End-Shitmed
// Shitmed Change End
}

// Shitmed Change Start
public void SetActiveBodyPart(TargetBodyPart part, TextureButton button)
{
if (_target == null)
Expand All @@ -106,6 +100,7 @@ public void SetActiveButtons(bool isHumanoid)
button.Value.Visible = isHumanoid;
}

// Not all of this function got messed with, but it was spread enough to warrant being covered entirely by a Shitmed Change
public void Populate(HealthAnalyzerScannedUserMessage msg)
{
// Start-Shitmed
Expand Down Expand Up @@ -191,27 +186,21 @@ public void Populate(HealthAnalyzerScannedUserMessage msg)
if (showAlerts)
AlertsContainer.DisposeAllChildren();

if (msg.Unrevivable == true) // Right now this does nothing, but we have it just for parity :)
{
var unrevivableLabel = new RichTextLabel
if (msg.Unrevivable == true)
AlertsContainer.AddChild(new RichTextLabel
{
Text = Loc.GetString("health-analyzer-window-entity-unrevivable-text"),
Margin = new Thickness(0, 4),
MaxWidth = 300
};
unrevivableLabel.SetMessage(Loc.GetString("health-analyzer-window-entity-unrevivable-text"), defaultColor: Color.Red);
AlertsContainer.AddChild(unrevivableLabel);
}
});

if (msg.Bleeding == true)
{
var bleedingLabel = new RichTextLabel
AlertsContainer.AddChild(new RichTextLabel
{
Text = Loc.GetString("health-analyzer-window-entity-bleeding-text"),
Margin = new Thickness(0, 4),
MaxWidth = 300
};
bleedingLabel.SetMessage(Loc.GetString("health-analyzer-window-entity-bleeding-text"), defaultColor: Color.Red);
AlertsContainer.AddChild(bleedingLabel);
}
});

// Damage Groups

Expand All @@ -222,9 +211,8 @@ public void Populate(HealthAnalyzerScannedUserMessage msg)
IReadOnlyDictionary<string, FixedPoint2> damagePerType = damageable.Damage.DamageDict;

DrawDiagnosticGroups(damageSortedGroups, damagePerType);
// End-Shitmed
}

// Shitmed Change End
private static string GetStatus(MobState mobState)
{
return mobState switch
Expand Down Expand Up @@ -273,7 +261,7 @@ private void DrawDiagnosticGroups(

var damageString = Loc.GetString(
"health-analyzer-window-damage-type-text",
("damageType", Loc.GetString("health-analyzer-window-damage-type-" + type)),
("damageType", _prototypes.Index<DamageTypePrototype>(type).LocalizedName),
("amount", typeAmount)
);

Expand Down Expand Up @@ -324,7 +312,7 @@ private BoxContainer CreateDiagnosticGroupTitle(string text, string id)
return rootContainer;
}

// Start-Shitmed
// Shitmed Change Start
/// <summary>
/// Sets up the Body Doll using Alert Entity to use in Health Analyzer.
/// </summary>
Expand All @@ -344,11 +332,11 @@ private BoxContainer CreateDiagnosticGroupTitle(string text, string id)
int layer = 0;
foreach (var (bodyPart, integrity) in body)
{
// TODO: Fix this way PartStatusUIController and make it use layers instead of TextureRects
// TODO: PartStatusUIController and make it use layers instead of TextureRects when EE refactors alerts.
string enumName = Enum.GetName(typeof(TargetBodyPart), bodyPart) ?? "Unknown";
int enumValue = (int) integrity;
var rsi = new SpriteSpecifier.Rsi(new ResPath($"/Textures/Interface/Targeting/Status/{enumName.ToLowerInvariant()}.rsi"), $"{enumName.ToLowerInvariant()}_{enumValue}");
// It's probably shitcode but im lazy to get into sprite stuff - It is shitcode :)
var rsi = new SpriteSpecifier.Rsi(new ResPath($"/Textures/_Shitmed/Interface/Targeting/Status/{enumName.ToLowerInvariant()}.rsi"), $"{enumName.ToLowerInvariant()}_{enumValue}");
// Shitcode with love from Russia :)
if (!sprite.TryGetLayer(layer, out _))
sprite.AddLayer(_spriteSystem.Frame0(rsi));
else
Expand All @@ -358,6 +346,6 @@ private BoxContainer CreateDiagnosticGroupTitle(string text, string id)
}
return _spriteViewEntity;
}
// End-Shitmed
// Shitmed Change End
}
}
18 changes: 3 additions & 15 deletions Content.Client/Humanoid/HumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Numerics;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
Expand Down Expand Up @@ -31,15 +30,6 @@ private void UpdateSprite(HumanoidAppearanceComponent component, SpriteComponent
UpdateLayers(component, sprite);
ApplyMarkingSet(component, sprite);

var speciesPrototype = _prototypeManager.Index(component.Species);

var height = Math.Clamp(component.Height, speciesPrototype.MinHeight, speciesPrototype.MaxHeight);
var width = Math.Clamp(component.Width, speciesPrototype.MinWidth, speciesPrototype.MaxWidth);
component.Height = height;
component.Width = width;

sprite.Scale = new Vector2(width, height);

sprite[sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes)].Color = component.EyeColor;
}

Expand All @@ -65,7 +55,7 @@ private void UpdateLayers(HumanoidAppearanceComponent component, SpriteComponent
foreach (var (key, info) in component.CustomBaseLayers)
{
oldLayers.Remove(key);
// Shitmed modification: For whatever reason these weren't actually ignoring the skin color as advertised.
// Shitmed Change: For whatever reason these weren't actually ignoring the skin color as advertised.
SetLayerData(component, sprite, key, info.Id, sexMorph: false, color: info.Color, overrideSkin: true);
}

Expand All @@ -85,7 +75,7 @@ private void SetLayerData(
string? protoId,
bool sexMorph = false,
Color? color = null,
bool overrideSkin = false)
bool overrideSkin = false) // Shitmed Change
{
var layerIndex = sprite.LayerMapReserveBlank(key);
var layer = sprite[layerIndex];
Expand All @@ -103,7 +93,7 @@ private void SetLayerData(
var proto = _prototypeManager.Index<HumanoidSpeciesSpriteLayer>(protoId);
component.BaseLayers[key] = proto;

if (proto.MatchSkin && !overrideSkin)
if (proto.MatchSkin && !overrideSkin) // Shitmed Change
layer.Color = component.SkinColor.WithAlpha(proto.LayerAlpha);

if (proto.BaseSprite != null)
Expand Down Expand Up @@ -209,8 +199,6 @@ public override void LoadProfile(EntityUid uid, HumanoidCharacterProfile? profil
humanoid.Species = profile.Species;
humanoid.SkinColor = profile.Appearance.SkinColor;
humanoid.EyeColor = profile.Appearance.EyeColor;
humanoid.Height = profile.Height;
humanoid.Width = profile.Width;

UpdateSprite(humanoid, Comp<SpriteComponent>(uid));
}
Expand Down
6 changes: 6 additions & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,18 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.Arcade2);
human.AddFunction(ContentKeyFunctions.Arcade3);
human.AddFunction(ContentKeyFunctions.LookUp);
// Shitmed Change Start - TODO: Add groin targeting.
human.AddFunction(ContentKeyFunctions.TargetHead);
human.AddFunction(ContentKeyFunctions.TargetTorso);
human.AddFunction(ContentKeyFunctions.TargetLeftArm);
human.AddFunction(ContentKeyFunctions.TargetLeftHand);
human.AddFunction(ContentKeyFunctions.TargetRightArm);
human.AddFunction(ContentKeyFunctions.TargetRightHand);
human.AddFunction(ContentKeyFunctions.TargetLeftLeg);
human.AddFunction(ContentKeyFunctions.TargetLeftFoot);
human.AddFunction(ContentKeyFunctions.TargetRightLeg);
human.AddFunction(ContentKeyFunctions.TargetRightFoot);
// Shitmed Change End

// actions should be common (for ghosts, mobs, etc)
common.AddFunction(ContentKeyFunctions.OpenActionsMenu);
Expand Down
Loading

0 comments on commit 3c9db94

Please sign in to comment.