Skip to content

Commit

Permalink
Merge branch 'master' into sml-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
pxc1984 authored Jun 16, 2024
2 parents f7ddde2 + 118909f commit 5cf0ef0
Show file tree
Hide file tree
Showing 103 changed files with 14,653 additions and 1,102 deletions.
1 change: 1 addition & 0 deletions Content.Benchmarks/EntityManagerGetAllComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void Setup()

var componentFactory = new Mock<IComponentFactory>();
componentFactory.Setup(p => p.GetComponent<DummyComponent>()).Returns(new DummyComponent());
componentFactory.Setup(m => m.GetIndex(typeof(DummyComponent))).Returns(CompIdx.Index<DummyComponent>());
componentFactory.Setup(p => p.GetRegistration(It.IsAny<DummyComponent>())).Returns(dummyReg);
componentFactory.Setup(p => p.GetAllRegistrations()).Returns(new[] { dummyReg });
componentFactory.Setup(p => p.GetAllRefTypes()).Returns(new[] { CompIdx.Index<DummyComponent>() });
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public BwoinkControl()
if (info.Antag && info.ActiveThisRound)
sb.Append(new Rune(0x1F5E1)); // 🗡

if (info.OverallPlaytime <= TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.NewPlayerThreshold)))
if (info.OverallPlaytime <= TimeSpan.FromMinutes(_cfg.GetCVar(CCVars.NewPlayerThreshold)))
sb.Append(new Rune(0x23F2)); // ⏲

sb.AppendFormat("\"{0}\"", text);
Expand Down Expand Up @@ -226,7 +226,7 @@ private string FormatTabTitle(ItemList.Item li, PlayerInfo? pl = default)
if (pl.Antag)
sb.Append(new Rune(0x1F5E1)); // 🗡

if (pl.OverallPlaytime <= TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.NewPlayerThreshold)))
if (pl.OverallPlaytime <= TimeSpan.FromMinutes(_cfg.GetCVar(CCVars.NewPlayerThreshold)))
sb.Append(new Rune(0x23F2)); // ⏲

sb.AppendFormat("\"{0}\"", pl.CharacterName);
Expand All @@ -243,9 +243,9 @@ private void SwitchToChannel(NetUserId? ch)
{
UpdateButtons();

AHelpHelper.HideAllPanels();
if (ch != null)
{
AHelpHelper.HideAllPanels();
var panel = AHelpHelper.EnsurePanel(ch.Value);
panel.Visible = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public BwoinkWindow()
{
if (sel is null)
{
Title = Loc.GetString("bwoink-none-selected");
Title = Loc.GetString("bwoink-title-none-selected");
return;
}

Expand Down
15 changes: 6 additions & 9 deletions Content.Client/Doors/FirelockSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ private void OnAppearanceChange(EntityUid uid, FirelockComponent comp, ref Appea
if (!_appearanceSystem.TryGetData<DoorState>(uid, DoorVisuals.State, out var state, args.Component))
state = DoorState.Closed;

if (_appearanceSystem.TryGetData<bool>(uid, DoorVisuals.Powered, out var powered, args.Component) && powered)
{
boltedVisible = _appearanceSystem.TryGetData<bool>(uid, DoorVisuals.BoltLights, out var lights, args.Component) && lights;
unlitVisible =
state == DoorState.Closing
|| state == DoorState.Opening
|| state == DoorState.Denying
|| (_appearanceSystem.TryGetData<bool>(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights);
}
boltedVisible = _appearanceSystem.TryGetData<bool>(uid, DoorVisuals.BoltLights, out var lights, args.Component) && lights;
unlitVisible =
state == DoorState.Closing
|| state == DoorState.Opening
|| state == DoorState.Denying
|| (_appearanceSystem.TryGetData<bool>(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights);

args.Sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible && !boltedVisible);
args.Sprite.LayerSetVisible(DoorVisualLayers.BaseBolted, boltedVisible);
Expand Down
37 changes: 30 additions & 7 deletions Content.Client/Lobby/LobbyUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Content.Shared.Preferences.Loadouts;
using Content.Shared.Roles;
using Content.Shared.Traits;
using Content.Sunrise.Interfaces.Client;
using Robust.Client.Player;
using Robust.Client.ResourceManagement;
using Robust.Client.State;
Expand Down Expand Up @@ -46,6 +47,7 @@ public sealed partial class LobbyUIController : UIController, IOnStateEntered<Lo

private CharacterSetupGui? _characterSetup;
private HumanoidProfileEditor? _profileEditor;
private IClientSponsorsManager? _sponsorsManager; // Sunrise-Sponsors

/// <summary>
/// This is the characher preview panel in the chat. This should only update if their character updates.
Expand All @@ -62,6 +64,7 @@ public sealed partial class LobbyUIController : UIController, IOnStateEntered<Lo
public override void Initialize()
{
base.Initialize();
IoCManager.Instance!.TryResolveType(out _sponsorsManager); // Sunrise-Sponsors
_prototypeManager.PrototypesReloaded += OnProtoReload;
_preferencesManager.OnServerDataLoaded += PreferencesDataLoaded;
_requirements.Updated += OnRequirementsUpdated;
Expand Down Expand Up @@ -292,10 +295,14 @@ public void GiveDummyJobClothesLoadout(EntityUid dummy, JobPrototype? jobProto,
var job = jobProto ?? GetPreferredJob(profile);
GiveDummyJobClothes(dummy, profile, job);

// Sunrise-Start
var sponsorPrototypes = _sponsorsManager?.GetClientPrototypes().ToArray() ?? [];
// Sunrise-End

if (_prototypeManager.HasIndex<RoleLoadoutPrototype>(LoadoutSystem.GetJobPrototype(job.ID)))
{
var loadout = profile.GetLoadoutOrDefault(LoadoutSystem.GetJobPrototype(job.ID), profile.Species, EntityManager, _prototypeManager);
GiveDummyLoadout(dummy, loadout);
var loadout = profile.GetLoadoutOrDefault(LoadoutSystem.GetJobPrototype(job.ID), _playerManager.LocalSession, profile.Species, EntityManager, _prototypeManager, sponsorPrototypes);
GiveDummyLoadout(dummy, loadout, true);
}
}

Expand All @@ -309,19 +316,31 @@ public JobPrototype GetPreferredJob(HumanoidCharacterProfile profile)
return _prototypeManager.Index<JobPrototype>(highPriorityJob.Id ?? SharedGameTicker.FallbackOverflowJob);
}

public void GiveDummyLoadout(EntityUid uid, RoleLoadout? roleLoadout)
public void GiveDummyLoadout(EntityUid uid, RoleLoadout? roleLoadout, bool outerwear)
{
if (roleLoadout == null)
return;

var undervearSlots = new List<string> { "bra", "pants", "socks" };

foreach (var group in roleLoadout.SelectedLoadouts.Values)
{
foreach (var loadout in group)
{
var wear = true;
if (!_prototypeManager.TryIndex(loadout.Prototype, out var loadoutProto))
continue;

_spawn.EquipStartingGear(uid, _prototypeManager.Index(loadoutProto.Equipment));
var startingGear = _prototypeManager.Index(loadoutProto.Equipment);

foreach (var keyValuePair in startingGear.Equipment)
{
if (!undervearSlots.Contains(keyValuePair.Key) && !outerwear)
wear = false;
}

if (wear)
_spawn.EquipStartingGear(uid, startingGear);
}
}
}
Expand Down Expand Up @@ -395,6 +414,10 @@ public EntityUid LoadProfileEntity(HumanoidCharacterProfile? humanoid, JobProtot
{
EntityUid dummyEnt;

// Sunrise-Start
var sponsorPrototypes = _sponsorsManager?.GetClientPrototypes().ToArray() ?? [];
// Sunrise-End

if (humanoid is not null)
{
var dummy = _prototypeManager.Index<SpeciesPrototype>(humanoid.Species).DollPrototype;
Expand All @@ -407,15 +430,15 @@ public EntityUid LoadProfileEntity(HumanoidCharacterProfile? humanoid, JobProtot

_humanoid.LoadProfile(dummyEnt, humanoid);

if (humanoid != null && jobClothes)
if (humanoid != null)
{
job ??= GetPreferredJob(humanoid);
GiveDummyJobClothes(dummyEnt, humanoid, job);

if (_prototypeManager.HasIndex<RoleLoadoutPrototype>(LoadoutSystem.GetJobPrototype(job.ID)))
{
var loadout = humanoid.GetLoadoutOrDefault(LoadoutSystem.GetJobPrototype(job.ID), humanoid.Species, EntityManager, _prototypeManager);
GiveDummyLoadout(dummyEnt, loadout);
var loadout = humanoid.GetLoadoutOrDefault(LoadoutSystem.GetJobPrototype(job.ID), _playerManager.LocalSession, humanoid.Species, EntityManager, _prototypeManager, sponsorPrototypes);
GiveDummyLoadout(dummyEnt, loadout, jobClothes);
}
}

Expand Down
7 changes: 6 additions & 1 deletion Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,10 @@ public void RefreshJobs()
departments.Add(department);
}

// Sunrise-Start
var sponsorPrototypes = _sponsorsMgr?.GetClientPrototypes().ToArray() ?? [];
// Sunrise-End

departments.Sort(DepartmentUIComparer.Instance);

var items = new[]
Expand Down Expand Up @@ -964,7 +968,7 @@ public void RefreshJobs()
if (loadout == null)
{
loadout = new RoleLoadout(roleLoadoutProto.ID);
loadout.SetDefault(_prototypeManager);
loadout.SetDefault(Profile, _playerManager.LocalSession, _prototypeManager, sponsorPrototypes);
}

OpenLoadout(job, loadout, roleLoadoutProto);
Expand Down Expand Up @@ -1170,6 +1174,7 @@ private void SetSex(Sex newSex)

UpdateGenderControls();
UpdateTTSVoicesControls(); // Sunrise-TTS
RefreshLoadouts(); // Sunrise-Sex restrictions
Markings.SetSex(newSex);
ReloadPreview();
SetDirty();
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Lobby/UI/LobbyGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<!-- <Label Margin="8 0 0 0" StyleClasses="LabelHeadingBigger" VAlign="Center"
Text="{Loc 'ui-lobby-title'}" /> -->
<Label Name="ServerName" Access="Public" StyleClasses="LabelHeadingBigger" VAlign="Center"
HorizontalExpand="True" HorizontalAlignment="Center" Text="Добро пожаловать в ЫЫ14" />
HorizontalExpand="True" HorizontalAlignment="Center" Text="Добро пожаловать на Sunrise" />
<!-- Sunrise-end -->
</BoxContainer>
<!-- Gold line -->
Expand Down
5 changes: 2 additions & 3 deletions Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Decals;
using Content.Shared.Damage.ForceSay;
using Content.Shared.Examine;
using Content.Shared.Decals;
using Content.Shared.Input;
using Content.Shared.Radio;
using Robust.Client.GameObjects;
Expand Down Expand Up @@ -626,7 +625,7 @@ private void UpdateQueuedSpeechBubbles(FrameEventArgs delta)
var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
=> uid == data.compOwner || uid == data.attachedEntity;
var playerPos = player != null
? _transform?.GetMapCoordinates(player.Value) ?? MapCoordinates.Nullspace
? _eye.CurrentEye.Position
: MapCoordinates.Nullspace;

var occluded = player != null && _examine.IsOccluded(player.Value);
Expand Down
30 changes: 21 additions & 9 deletions Content.Client/UserInterface/Systems/Info/InfoUIController.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
using Content.Client.Gameplay;
using Content.Client.Info;
using Content.Shared.CCVar;
using Content.Shared.Guidebook;
using Content.Shared.Info;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;

namespace Content.Client.UserInterface.Systems.Info;

public sealed class InfoUIController : UIController, IOnStateExited<GameplayState>
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly ILogManager _logMan = default!;

private RulesPopup? _rulesPopup;
private RulesAndInfoWindow? _infoWindow;
private ISawmill _sawmill = default!;

[ValidatePrototypeId<GuideEntryPrototype>]
private const string DefaultRuleset = "DefaultRuleset";

public ProtoId<GuideEntryPrototype> RulesEntryId = DefaultRuleset;

public override void Initialize()
{
base.Initialize();


_sawmill = _logMan.GetSawmill("rules");
_netManager.RegisterNetMessage<RulesAcceptedMessage>();
_netManager.RegisterNetMessage<ShowRulesPopupMessage>(OnShowRulesPopupMessage);
_netManager.RegisterNetMessage<SendRulesInformationMessage>(OnRulesInformationMessage);

_consoleHost.RegisterCommand("fuckrules",
"",
Expand All @@ -39,9 +43,12 @@ public override void Initialize()
});
}

private void OnShowRulesPopupMessage(ShowRulesPopupMessage message)
private void OnRulesInformationMessage(SendRulesInformationMessage message)
{
ShowRules(message.PopupTime);
RulesEntryId = message.CoreRules;

if (message.ShouldShowRules)
ShowRules(message.PopupTime);
}

public void OnStateExited(GameplayState state)
Expand Down Expand Up @@ -84,8 +91,13 @@ private void OnAcceptPressed()

public GuideEntryPrototype GetCoreRuleEntry()
{
var guide = _cfg.GetCVar(CCVars.RulesFile);
var guideEntryPrototype = _prototype.Index<GuideEntryPrototype>(guide);
if (!_prototype.TryIndex(RulesEntryId, out var guideEntryPrototype))
{
guideEntryPrototype = _prototype.Index<GuideEntryPrototype>(DefaultRuleset);
_sawmill.Error($"Couldn't find the following prototype: {RulesEntryId}. Falling back to {DefaultRuleset}, please check that the server has the rules set up correctly");
return guideEntryPrototype;
}

return guideEntryPrototype;
}

Expand Down
49 changes: 49 additions & 0 deletions Content.Server/Chemistry/ReagentEffectConditions/JobCondition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.Linq;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Localizations;
using Robust.Shared.Prototypes;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
using Content.Shared.Station;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.IoC;

namespace Content.Server.Chemistry.ReagentEffectConditions
{
public sealed partial class JobCondition : ReagentEffectCondition
{
[DataField(required: true)] public List<ProtoId<JobPrototype>> Job;

public override bool Condition(ReagentEffectArgs args)
{
args.EntityManager.TryGetComponent<MindContainerComponent>(args.SolutionEntity, out var mindContainer);
if (mindContainer != null && mindContainer.Mind != null)
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
if (args.EntityManager.TryGetComponent<JobComponent>(mindContainer?.Mind, out var comp) && prototypeManager.TryIndex(comp.Prototype, out var prototype))
{
foreach (var jobId in Job)
{
if (prototype.ID == jobId)
{
return true;
}
}
}
}

return false;
}

public override string GuidebookExplanation(IPrototypeManager prototype)
{
var localizedNames = Job.Select(jobId => prototype.Index(jobId).LocalizedName).ToList();
return Loc.GetString("reagent-effect-condition-guidebook-job-condition", ("job", ContentLocalizationManager.FormatListToOr(localizedNames)));
}
}
}

9 changes: 8 additions & 1 deletion Content.Server/Doors/Systems/FirelockSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using Content.Server.Shuttles.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Doors;
using Content.Shared.Doors.Components;
using Content.Shared.Doors.Systems;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;

namespace Content.Server.Doors.Systems
Expand All @@ -20,6 +20,7 @@ public sealed class FirelockSystem : SharedFirelockSystem
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedMapSystem _mapping = default!;
[Dependency] private readonly PointLightSystem _pointLight = default!;

private const int UpdateInterval = 30;
private int _accumulatedTicks;
Expand Down Expand Up @@ -53,6 +54,7 @@ public override void Update(float frameTime)
var airtightQuery = GetEntityQuery<AirtightComponent>();
var appearanceQuery = GetEntityQuery<AppearanceComponent>();
var xformQuery = GetEntityQuery<TransformComponent>();
var pointLightQuery = GetEntityQuery<PointLightComponent>();

var query = EntityQueryEnumerator<FirelockComponent, DoorComponent>();
while (query.MoveNext(out var uid, out var firelock, out var door))
Expand All @@ -74,6 +76,11 @@ public override void Update(float frameTime)
firelock.Temperature = fire;
firelock.Pressure = pressure;
Dirty(uid, firelock);

if (pointLightQuery.TryComp(uid, out var pointLight))
{
_pointLight.SetEnabled(uid, fire | pressure, pointLight);
}
}
}
}
Expand Down
Loading

0 comments on commit 5cf0ef0

Please sign in to comment.