Skip to content

Commit

Permalink
Merge branch 'master' of github.com:space-wizards/space-station-14
Browse files Browse the repository at this point in the history
  • Loading branch information
moonheart08 committed Jun 9, 2023
2 parents 0ca7ba1 + 64d0e32 commit 79ede9c
Show file tree
Hide file tree
Showing 493 changed files with 201,207 additions and 192,099 deletions.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
use flake
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/Content.*/Station/ @moonheart08
/Content.*/Maps/ @moonheart08
/Content.*/GameTicking/ @moonheart08
/Resources/Server\ Info/ @moonheart08
/Resources/ServerInfo/ @moonheart08
/Resources/engineCommandPerms.yml @moonheart08
/Resources/clientCommandPerms.yml @moonheart08
/Resources/Prototypes/species.yml @moonheart08
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void UnlinkAllActions()
public void LinkAllActions(ActionsComponent? actions = null)
{
var player = _playerManager.LocalPlayer?.ControlledEntity;
if (player == null || !Resolve(player.Value, ref actions))
if (player == null || !Resolve(player.Value, ref actions, false))
{
return;
}
Expand Down
29 changes: 29 additions & 0 deletions Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Shared.Chemistry;

namespace Content.Client.Chemistry.EntitySystems;

/// <inheritdoc/>
public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem
{
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();

SubscribeNetworkEvent<ReagentGuideRegistryChangedEvent>(OnReceiveRegistryUpdate);
}

private void OnReceiveRegistryUpdate(ReagentGuideRegistryChangedEvent message)
{
var data = message.Changeset;
foreach (var remove in data.Removed)
{
Registry.Remove(remove);
}

foreach (var (key, val) in data.GuideEntries)
{
Registry[key] = val;
}
}
}
86 changes: 56 additions & 30 deletions Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,15 @@ public override void Initialize()
private void OnAppearanceUpdate(EntityUid uid, InventoryComponent component, ref AppearanceChangeEvent args)
{
// May need to update jumpsuit stencils if the sex changed. Also required to properly set the stencil on init
// when sex is first loaded from the profile.
if (!TryComp(uid, out SpriteComponent? sprite) || !sprite.LayerMapTryGet(HumanoidVisualLayers.StencilMask, out var layer))
return;
// This is when sex is first loaded from the profile.

if (!TryComp(uid, out HumanoidAppearanceComponent? humanoid)
|| humanoid.Sex != Sex.Female
|| !_inventorySystem.TryGetSlotEntity(uid, "jumpsuit", out var suit, component)
|| !TryComp(suit, out ClothingComponent? clothing))
{
sprite.LayerSetVisible(layer, false);
if (!TryComp(uid, out SpriteComponent? sprite) ||
!TryComp(uid, out HumanoidAppearanceComponent? humanoid) ||
!_inventorySystem.TryGetSlotEntity(uid, "jumpsuit", out var suit, component) ||
!TryComp(suit, out ClothingComponent? clothing))
return;
}

sprite.LayerSetState(layer, clothing.FemaleMask switch
{
FemaleClothingMask.NoMask => "female_none",
FemaleClothingMask.UniformTop => "female_top",
_ => "female_full",
});
sprite.LayerSetVisible(layer, true);
SetGenderedMask(sprite, humanoid, clothing);
}

private void OnGetVisuals(EntityUid uid, ClothingComponent item, GetEquipmentVisualsEvent args)
Expand Down Expand Up @@ -225,20 +214,12 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
return;
}

if (slot == "jumpsuit" && sprite.LayerMapTryGet(HumanoidVisualLayers.StencilMask, out var suitLayer))
if (slot == "jumpsuit")
{
if (TryComp(equipee, out HumanoidAppearanceComponent? humanoid) && humanoid.Sex == Sex.Female)
{
sprite.LayerSetState(suitLayer, clothingComponent.FemaleMask switch
{
FemaleClothingMask.NoMask => "female_none",
FemaleClothingMask.UniformTop => "female_top",
_ => "female_full",
});
sprite.LayerSetVisible(suitLayer, true);
}
else
sprite.LayerSetVisible(suitLayer, false);
if (!TryComp(equipee, out HumanoidAppearanceComponent? humanoid))
return;

SetGenderedMask(sprite, humanoid, clothingComponent);
}

if (!_inventorySystem.TryGetSlot(equipee, slot, out var slotDef, inventory))
Expand Down Expand Up @@ -315,4 +296,49 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot

RaiseLocalEvent(equipment, new EquipmentVisualsUpdatedEvent(equipee, slot, revealedLayers), true);
}


/// <summary>
/// Sets a sprite's gendered mask based on gender (obviously).
/// </summary>
/// <param name="sprite">Sprite to modify</param>
/// <param name="humanoid">Humanoid, to get gender from</param>
/// <param name="clothing">Clothing component, to get mask sprite type</param>
private static void SetGenderedMask(SpriteComponent sprite, HumanoidAppearanceComponent humanoid, ClothingComponent clothing)
{
if (!sprite.LayerMapTryGet(HumanoidVisualLayers.StencilMask, out var layer))
return;

ClothingMask? mask = null;
var prefix = "";

switch (humanoid.Sex)
{
case Sex.Male:
mask = clothing.MaleMask;
prefix = "male_";
break;
case Sex.Female:
mask = clothing.FemaleMask;
prefix = "female_";
break;
case Sex.Unsexed:
mask = clothing.UnisexMask;
prefix = "unisex_";
break;
}

if (mask != null)
{
sprite.LayerSetState(layer, mask switch
{
ClothingMask.NoMask => $"{prefix}none",
ClothingMask.UniformTop => $"{prefix}top",
_ => $"{prefix}full",
});
sprite.LayerSetVisible(layer, true);
}
else
sprite.LayerSetVisible(layer, false);
}
}
4 changes: 3 additions & 1 deletion Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Content.Client.Players.PlayTimeTracking;
using Content.Client.Preferences;
using Content.Client.Radiation.Overlays;
using Content.Client.Replay;
using Content.Client.Screenshot;
using Content.Client.Singularity;
using Content.Client.Stylesheets;
Expand Down Expand Up @@ -62,6 +63,7 @@ public sealed class EntryPoint : GameClient
[Dependency] private readonly ExtendedDisconnectInformationManager _extendedDisconnectInformation = default!;
[Dependency] private readonly JobRequirementsManager _jobRequirements = default!;
[Dependency] private readonly ContentLocalizationManager _contentLoc = default!;
[Dependency] private readonly ContentReplayPlaybackManager _playbackMan = default!;

public override void Init()
{
Expand Down Expand Up @@ -131,6 +133,7 @@ public override void Init()
_ghostKick.Initialize();
_extendedDisconnectInformation.Initialize();
_jobRequirements.Initialize();
_playbackMan.Initialize();

//AUTOSCALING default Setup!
_configManager.SetCVar("interface.resolutionAutoScaleUpperCutoffX", 1080);
Expand All @@ -154,7 +157,6 @@ public override void PostInit()
_overlayManager.AddOverlay(new SingularityOverlay());
_overlayManager.AddOverlay(new FlashOverlay());
_overlayManager.AddOverlay(new RadiationPulseOverlay());

_chatManager.Initialize();
_clientPreferencesManager.Initialize();
_euiManager.Initialize();
Expand Down
10 changes: 6 additions & 4 deletions Content.Client/Examine/ExamineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Linq;
using System.Threading;
using Content.Shared.Eye.Blinding.Components;
using Robust.Client;
using static Content.Shared.Interaction.SharedInteractionSystem;
using static Robust.Client.UserInterface.Controls.BoxContainer;

Expand All @@ -28,6 +29,7 @@ public sealed class ExamineSystem : ExamineSystemShared
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly VerbSystem _verbSystem = default!;
[Dependency] private readonly IBaseClient _client = default!;

public const string StyleClassEntityTooltip = "entity-tooltip";

Expand Down Expand Up @@ -327,9 +329,9 @@ public void VerbButtonPressed(BaseButton.ButtonEventArgs obj)
}
}

public void DoExamine(EntityUid entity, bool centeredOnCursor=true)
public void DoExamine(EntityUid entity, bool centeredOnCursor = true, EntityUid? userOverride = null)
{
var playerEnt = _playerManager.LocalPlayer?.ControlledEntity;
var playerEnt = userOverride ?? _playerManager.LocalPlayer?.ControlledEntity;
if (playerEnt == null)
return;

Expand All @@ -341,10 +343,10 @@ public void DoExamine(EntityUid entity, bool centeredOnCursor=true)
canSeeClearly = false;

OpenTooltip(playerEnt.Value, entity, centeredOnCursor, false, knowTarget: canSeeClearly);
if (entity.IsClientSide())
if (entity.IsClientSide()
|| _client.RunLevel == ClientRunLevel.SinglePlayerGame) // i.e. a replay
{
message = GetExamineText(entity, playerEnt);

UpdateTooltipInfo(playerEnt.Value, entity, message);
}
else
Expand Down
17 changes: 14 additions & 3 deletions Content.Client/GameTicking/Managers/ClientGameTicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ public sealed class ClientGameTicker : SharedGameTicker
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly BackgroundAudioSystem _backgroundAudio = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;

[ViewVariables] private bool _initialized;
private Dictionary<EntityUid, Dictionary<string, uint?>> _jobsAvailable = new();
private Dictionary<EntityUid, string> _stationNames = new();

/// <summary>
/// The current round-end window. Could be used to support re-opening the window after closing it.
/// </summary>
private RoundEndSummaryWindow? _window;

[ViewVariables] public bool AreWeReady { get; private set; }
[ViewVariables] public bool IsGameStarted { get; private set; }
[ViewVariables] public string? LobbySong { get; private set; }
Expand Down Expand Up @@ -127,13 +134,17 @@ private void RoundEnd(RoundEndMessageEvent message)
if (message.LobbySong != null)
{
LobbySong = message.LobbySong;
Get<BackgroundAudioSystem>().StartLobbyMusic();
_backgroundAudio.StartLobbyMusic();
}

RestartSound = message.RestartSound;

// Don't open duplicate windows (mainly for replays).
if (_window?.RoundId == message.RoundId)
return;

//This is not ideal at all, but I don't see an immediately better fit anywhere else.
var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
_window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
}

private void RoundRestartCleanup(RoundRestartCleanupEvent ev)
Expand All @@ -147,7 +158,7 @@ private void RoundRestartCleanup(RoundRestartCleanupEvent ev)
return;
}

SoundSystem.Play(RestartSound, Filter.Empty());
_audio.PlayGlobal(RestartSound, Filter.Local(), false);

// Cleanup the sound, we only want it to play when the round restarts after it ends normally.
RestartSound = null;
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Gameplay/GameplayState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

namespace Content.Client.Gameplay
{
public sealed class GameplayState : GameplayStateBase, IMainViewportState
[Virtual]
public class GameplayState : GameplayStateBase, IMainViewportState
{
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IOverlayManager _overlayManager = default!;
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Guidebook/Controls/GuideEntityEmbed.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ protected override void KeyBindDown(GUIBoundKeyEventArgs args)
// do examination?
if (args.Function == ContentKeyFunctions.ExamineEntity)
{
_examineSystem.DoExamine(entity.Value);
_examineSystem.DoExamine(entity.Value,
userOverride: _guidebookSystem.GetGuidebookUser());
args.Handle();
return;
}
Expand Down
58 changes: 58 additions & 0 deletions Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Orientation="Vertical"
Margin="5 5 5 5">
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="1" BorderColor="#777777"/>
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical">
<PanelContainer Name="NameBackground" HorizontalExpand="True" VerticalExpand="False">
<RichTextLabel Name="ReagentName" HorizontalAlignment="Center"/>
</PanelContainer>
<BoxContainer Name="RecipesContainer" HorizontalExpand="True">
<Collapsible Orientation="Vertical" HorizontalExpand="True">
<CollapsibleHeading Title="{Loc 'guidebook-reagent-recipes-header'}"/>
<CollapsibleBody>
<BoxContainer Name="RecipesDescriptionContainer"
Margin="10 0 10 0"
Orientation="Horizontal"
HorizontalAlignment="Stretch"
HorizontalExpand="True">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
<RichTextLabel Name="ReactantsLabel"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalAlignment="Center">
<TextureRect TexturePath="/Textures/Interface/Misc/beakerlarge.png"/>
<Label Text="{Loc 'guidebook-reagent-recipes-mix'}"
HorizontalAlignment="Center"/>
</BoxContainer>
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
<RichTextLabel Name="ProductsLabel"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</BoxContainer>
</BoxContainer>
</CollapsibleBody>
</Collapsible>
</BoxContainer>
<BoxContainer Name="EffectsContainer" HorizontalExpand="True">
<Collapsible Orientation="Vertical">
<CollapsibleHeading Title="{Loc 'guidebook-reagent-effects-header'}"/>
<CollapsibleBody>
<BoxContainer Name="EffectsDescriptionContainer"
Orientation="Vertical"
Margin="10 0 10 0"
HorizontalExpand="True"/>
</CollapsibleBody>
</Collapsible>
</BoxContainer>
<BoxContainer Margin="10 5 10 10" HorizontalExpand="True">
<!-- The troublemaker !-->
<RichTextLabel Name="ReagentDescription" HorizontalAlignment="Left"/>
</BoxContainer>
</BoxContainer>
</PanelContainer>
</BoxContainer>
Loading

0 comments on commit 79ede9c

Please sign in to comment.