Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge surgery #105

Merged
merged 28 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4de7f50
Fix AddTrait And ReplaceTrait Functions (#1195)
VMSolidus Nov 10, 2024
e469816
Automatic Changelog Update (#1195)
SimpleStation14 Nov 10, 2024
6305e2d
Update Credits (#1202)
github-actions[bot] Nov 10, 2024
04cdc14
Add Missing `DOTNET_ROOT` Environment Variable For Nix Devs (#1203)
DocNITE Nov 11, 2024
20ac0b3
Swapped Hands HUD Fix (#1207)
Suraru Nov 13, 2024
c909724
Fix Butlertron's Hitbox (#1192)
VMSolidus Nov 13, 2024
66490ca
Automatic Changelog Update (#1192)
SimpleStation14 Nov 13, 2024
d1e4d11
The Hive: Update Engineering (#1201)
Ichaie Nov 13, 2024
4071d41
Automatic Changelog Update (#1201)
SimpleStation14 Nov 13, 2024
12c0a63
Return Old Lobby Music (#1204)
DocNITE Nov 13, 2024
74688cf
Automatic Changelog Update (#1204)
SimpleStation14 Nov 13, 2024
a77f581
Prevent Listening Posts From Spawning On Planets (#1188)
VMSolidus Nov 13, 2024
7063c79
Automatic Changelog Update (#1188)
SimpleStation14 Nov 13, 2024
ccb26b2
Fix Silver Crate Name (#1218)
sleepyyapril Nov 14, 2024
6b2ec00
Auto Voting System (#1213)
sleepyyapril Nov 14, 2024
8385fb1
Automatic Changelog Update (#1213)
SimpleStation14 Nov 14, 2024
3c31771
Fix Trait Component Removal (#1221)
DEATHB4DEFEAT Nov 14, 2024
387a362
Some Language Fixes (#1223)
Mnemotechnician Nov 14, 2024
8739096
Automatic Changelog Update (#1223)
SimpleStation14 Nov 14, 2024
3423e93
The Return of Spray Paint (#1222)
DEATHB4DEFEAT Nov 15, 2024
cfdc273
Bounties Localization Fix (#1219)
sleepyyapril Nov 15, 2024
45fdd0c
Automatic Changelog Update (#1222)
SimpleStation14 Nov 15, 2024
a505ed7
Change some Code Style Settings (#1226)
DEATHB4DEFEAT Nov 16, 2024
71185a7
Give Penguins Cold Resistance (#1229)
zelezniciar1 Nov 16, 2024
1c20299
Automatic Changelog Update (#1229)
SimpleStation14 Nov 16, 2024
029b763
Shitmed: Implementing Existing Newmed Code Into SS14 (#1159)
gluesniffler Nov 17, 2024
ea9a076
Automatic Changelog Update (#1159)
SimpleStation14 Nov 17, 2024
abca273
Merge remote-tracking branch 'EE-Master/master' into Merge-Surgery
VMSolidus Nov 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ csharp_style_expression_bodied_constructors = false:suggestion
#csharp_style_expression_bodied_indexers = true:silent
#csharp_style_expression_bodied_lambdas = true:silent
#csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:suggestion
csharp_style_expression_bodied_methods = true:suggestion
#csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:suggestion

Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Body/Components/BrainComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Content.Client.Body.Components;
[RegisterComponent]
public sealed partial class BrainComponent : Component { }
3 changes: 3 additions & 0 deletions Content.Client/Body/Components/LungComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Content.Client.Body.Components;
[RegisterComponent]
public sealed partial class LungComponent : Component { }
3 changes: 3 additions & 0 deletions Content.Client/Body/Components/StomachComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Content.Client.Body.Components;
[RegisterComponent]
public sealed partial class StomachComponent : Component { }
65 changes: 65 additions & 0 deletions Content.Client/Body/Systems/BodySystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,72 @@
using Content.Shared.Body.Systems;
using Content.Shared.Body.Part;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;
using Content.Shared.Body.Components;

namespace Content.Client.Body.Systems;

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

private void ApplyMarkingToPart(MarkingPrototype markingPrototype,
IReadOnlyList<Color>? colors,
bool visible,
SpriteComponent sprite)
{
for (var j = 0; j < markingPrototype.Sprites.Count; j++)
{
var markingSprite = markingPrototype.Sprites[j];

if (markingSprite is not SpriteSpecifier.Rsi rsi)
continue;

var layerId = $"{markingPrototype.ID}-{rsi.RsiState}";

if (!sprite.LayerMapTryGet(layerId, out _))
{
var layer = sprite.AddLayer(markingSprite, j + 1);
sprite.LayerMapSet(layerId, layer);
sprite.LayerSetSprite(layerId, rsi);
}

sprite.LayerSetVisible(layerId, visible);

if (!visible)
continue;

// Okay so if the marking prototype is modified but we load old marking data this may no longer be valid
// and we need to check the index is correct. So if that happens just default to white?
if (colors != null && j < colors.Count)
sprite.LayerSetColor(layerId, colors[j]);
else
sprite.LayerSetColor(layerId, Color.White);
}
}

protected override void ApplyPartMarkings(EntityUid target, BodyPartAppearanceComponent component)
{
if (!TryComp(target, out SpriteComponent? sprite))
return;

if (component.Color != null)
sprite.Color = component.Color.Value;

foreach (var (visualLayer, markingList) in component.Markings)
foreach (var marking in markingList)
{
if (!_markingManager.TryGetMarking(marking, out var markingPrototype))
continue;

ApplyMarkingToPart(markingPrototype, marking.MarkingColors, marking.Visible, sprite);
}
}

protected override void RemoveBodyMarkings(EntityUid target, BodyPartAppearanceComponent partAppearance, HumanoidAppearanceComponent bodyAppearance)
{
return;
}
}
35 changes: 34 additions & 1 deletion Content.Client/Hands/Systems/HandsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Client.Examine;
using Content.Client.Strip;
using Content.Client.Verbs.UI;
using Content.Shared.Body.Part;
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
Expand Down Expand Up @@ -38,7 +39,6 @@ public sealed class HandsSystem : SharedHandsSystem
public event Action<string, EntityUid>? OnPlayerItemRemoved;
public event Action<string>? OnPlayerHandBlocked;
public event Action<string>? OnPlayerHandUnblocked;

public override void Initialize()
{
base.Initialize();
Expand All @@ -49,6 +49,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);

OnHandSetActive += OnHandActivated;
}
Expand Down Expand Up @@ -236,8 +238,38 @@ public void UIHandAltActivateItem(string handName)
RaisePredictiveEvent(new RequestHandAltInteractEvent(handName));
}

#region pulling

#endregion

#region visuals

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))
return;

var location = part.Comp.Symmetry switch
{
BodyPartSymmetry.None => HandLocation.Middle,
BodyPartSymmetry.Left => HandLocation.Left,
BodyPartSymmetry.Right => HandLocation.Right,
_ => throw new ArgumentOutOfRangeException(nameof(part.Comp.Symmetry))
};

if (component.RevealedLayers.TryGetValue(location, out var revealedLayers))
{
foreach (var key in revealedLayers)
sprite.RemoveLayer(key);

revealedLayers.Clear();
}
}

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

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

protected override void HandleEntityInserted(EntityUid uid, HandsComponent hands, EntInsertedIntoContainerMessage args)
{
base.HandleEntityInserted(uid, hands, args);
Expand All @@ -262,6 +294,7 @@ protected override void HandleEntityRemoved(EntityUid uid, HandsComponent hands,

if (!hands.Hands.TryGetValue(args.Container.ID, out var hand))
return;

UpdateHandVisuals(uid, args.Entity, hand);
_stripSys.UpdateUi(uid);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.MedicalScanner;
using Content.Shared.Targeting;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

Expand All @@ -22,6 +23,7 @@ protected override void Open()
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName,
};
_window.OnClose += Close;
_window.OnBodyPartSelected += SendBodyPartMessage;
_window.OpenCentered();
}

Expand All @@ -36,14 +38,19 @@ protected override void ReceiveMessage(BoundUserInterfaceMessage message)
_window.Populate(cast);
}

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();
}
Expand Down
Loading
Loading