Skip to content

Commit

Permalink
Merge branch 'master' into Languages
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus authored May 12, 2024
2 parents 0fa806c + c23aff0 commit dea18f0
Show file tree
Hide file tree
Showing 352 changed files with 14,895 additions and 7,577 deletions.
1 change: 1 addition & 0 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, Ba
component.Container = EnsureEntity<T>(state.Container, uid);
component.EntityIcon = EnsureEntity<T>(state.EntityIcon, uid);
component.CheckCanInteract = state.CheckCanInteract;
component.CheckConsciousness = state.CheckConsciousness;
component.ClientExclusive = state.ClientExclusive;
component.Priority = state.Priority;
component.AttachedEntity = EnsureEntity<T>(state.AttachedEntity, uid);
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ protected override Control BuildBubble(ChatMessage message, string speechStyleCl
var bubbleContent = new RichTextLabel
{
MaxWidth = SpeechMaxWidth,
Margin = new Thickness(2, 6, 2, 2)
Margin = new Thickness(2, 6, 2, 2),
StyleClasses = { "bubbleContent" }
};

//We'll be honest. *Yes* this is hacky. Doing this in a cleaner way would require a bottom-up refactor of how saycode handles sending chat messages. -Myr
Expand Down
25 changes: 16 additions & 9 deletions Content.Client/Overlays/ShowHealthIconsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Shared.Atmos.Rotting;
using Content.Shared.Damage;
using Content.Shared.Inventory.Events;
using Content.Shared.Mobs.Components;
using Content.Shared.Overlays;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
Expand All @@ -17,9 +19,6 @@ public sealed class ShowHealthIconsSystem : EquipmentHudSystem<ShowHealthIconsCo

public HashSet<string> DamageContainers = new();

[ValidatePrototypeId<StatusIconPrototype>]
private const string HealthIconFine = "HealthIconFine";

public override void Initialize()
{
base.Initialize();
Expand All @@ -45,18 +44,20 @@ protected override void DeactivateInternal()
DamageContainers.Clear();
}

private void OnGetStatusIconsEvent(EntityUid uid, DamageableComponent damageableComponent, ref GetStatusIconsEvent args)
private void OnGetStatusIconsEvent(Entity<DamageableComponent> entity, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
return;

var healthIcons = DecideHealthIcons(damageableComponent);
var healthIcons = DecideHealthIcons(entity);

args.StatusIcons.AddRange(healthIcons);
}

private IReadOnlyList<StatusIconPrototype> DecideHealthIcons(DamageableComponent damageableComponent)
private IReadOnlyList<StatusIconPrototype> DecideHealthIcons(Entity<DamageableComponent> entity)
{
var damageableComponent = entity.Comp;

if (damageableComponent.DamageContainerID == null ||
!DamageContainers.Contains(damageableComponent.DamageContainerID))
{
Expand All @@ -66,10 +67,16 @@ private IReadOnlyList<StatusIconPrototype> DecideHealthIcons(DamageableComponent
var result = new List<StatusIconPrototype>();

// Here you could check health status, diseases, mind status, etc. and pick a good icon, or multiple depending on whatever.
if (damageableComponent?.DamageContainerID == "Biological" &&
_prototypeMan.TryIndex<StatusIconPrototype>(HealthIconFine, out var healthyIcon))
if (damageableComponent?.DamageContainerID == "Biological")
{
result.Add(healthyIcon);
if (TryComp<MobStateComponent>(entity, out var state))
{
// Since there is no MobState for a rotting mob, we have to deal with this case first.
if (HasComp<RottingComponent>(entity) && _prototypeMan.TryIndex(damageableComponent.RottingIcon, out var rottingIcon))
result.Add(rottingIcon);
else if (damageableComponent.HealthIcons.TryGetValue(state.CurrentState, out var value) && _prototypeMan.TryIndex(value, out var icon))
result.Add(icon);
}
}

return result;
Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Stylesheets/StyleNano.cs
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,14 @@ public StyleNano(IResourceCache resCache) : base(resCache)
new StyleProperty(PanelContainer.StylePropertyPanel, whisperBox)
}),

new StyleRule(new SelectorChild(
new SelectorElement(typeof(PanelContainer), new[] {"speechBox", "whisperBox"}, null, null),
new SelectorElement(typeof(RichTextLabel), new[] {"bubbleContent"}, null, null)),
new[]
{
new StyleProperty("font", notoSansItalic12),
}),

new StyleRule(new SelectorChild(
new SelectorElement(typeof(PanelContainer), new[] {"speechBox", "emoteBox"}, null, null),
new SelectorElement(typeof(RichTextLabel), null, null, null)),
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/Access/Systems/PresetIdCardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ private void OnMapInit(EntityUid uid, PresetIdCardComponent id, MapInitEvent arg

var station = _stationSystem.GetOwningStation(uid);
var extended = false;
if (station != null)
extended = Comp<StationJobsComponent>(station.Value).ExtendedAccess;

// Station not guaranteed to have jobs (e.g. nukie outpost).
if (TryComp(station, out StationJobsComponent? stationJobs))
extended = stationJobs.ExtendedAccess;

SetupIdAccess(uid, id, extended);
SetupIdName(uid, id);
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ public float GetFeltLowPressure(EntityUid uid, BarotraumaComponent barotrauma, f
return Atmospherics.OneAtmosphere;
}

return (environmentPressure + barotrauma.LowPressureModifier) * (barotrauma.LowPressureMultiplier);
var modified = (environmentPressure + barotrauma.LowPressureModifier) * (barotrauma.LowPressureMultiplier);
return Math.Min(modified, Atmospherics.OneAtmosphere);
}

/// <summary>
Expand All @@ -162,7 +163,8 @@ public float GetFeltHighPressure(EntityUid uid, BarotraumaComponent barotrauma,
return Atmospherics.OneAtmosphere;
}

return (environmentPressure + barotrauma.HighPressureModifier) * (barotrauma.HighPressureMultiplier);
var modified = (environmentPressure + barotrauma.HighPressureModifier) * (barotrauma.HighPressureMultiplier);
return Math.Max(modified, Atmospherics.OneAtmosphere);
}

public bool TryGetPressureProtectionValues(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent the
_atmosphereSystem.AddHeat(heatExchangeGasMixture, dQPipe);
thermoMachine.LastEnergyDelta = dQPipe;

if (dQLeak != 0f && _atmosphereSystem.GetContainingMixture(uid) is { } containingMixture)
if (dQLeak != 0f && _atmosphereSystem.GetContainingMixture(uid, excite: true) is { } containingMixture)
_atmosphereSystem.AddHeat(containingMixture, dQLeak);
}

Expand All @@ -126,7 +126,7 @@ private void GetHeatExchangeGasMixture(EntityUid uid, GasThermoMachineComponent
heatExchangeGasMixture = null;
if (thermoMachine.Atmospheric)
{
heatExchangeGasMixture = _atmosphereSystem.GetContainingMixture(uid);
heatExchangeGasMixture = _atmosphereSystem.GetContainingMixture(uid, excite: true);
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions Content.Server/Bed/Sleep/SleepingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Slippery;
Expand Down Expand Up @@ -45,6 +46,7 @@ public override void Initialize()
SubscribeLocalEvent<SleepingComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<SleepingComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<SleepingComponent, SlipAttemptEvent>(OnSlip);
SubscribeLocalEvent<SleepingComponent, ConsciousAttemptEvent>(OnConsciousAttempt);
SubscribeLocalEvent<ForcedSleepingComponent, ComponentInit>(OnInit);
}

Expand Down Expand Up @@ -173,6 +175,12 @@ private void OnSlip(EntityUid uid, SleepingComponent component, SlipAttemptEvent
args.Cancel();
}

private void OnConsciousAttempt(EntityUid uid, SleepingComponent component, ConsciousAttemptEvent args)
{
args.Cancel();
}


private void OnInit(EntityUid uid, ForcedSleepingComponent component, ComponentInit args)
{
TrySleeping(uid);
Expand Down
6 changes: 2 additions & 4 deletions Content.Server/Chemistry/EntitySystems/VaporSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ internal sealed class VaporSystem : EntitySystem

private const float ReactTime = 0.125f;

private ISawmill _sawmill = default!;

public override void Initialize()
{
base.Initialize();
_sawmill = Logger.GetSawmill("vapor");

SubscribeLocalEvent<VaporComponent, StartCollideEvent>(HandleCollide);
}

Expand Down Expand Up @@ -128,7 +126,7 @@ private void Update(float frameTime, Entity<VaporComponent> ent, Entity<Solution

if (reaction > reagentQuantity.Quantity)
{
_sawmill.Error($"Tried to tile react more than we have for reagent {reagentQuantity}. Found {reaction} and we only have {reagentQuantity.Quantity}");
Log.Error($"Tried to tile react more than we have for reagent {reagentQuantity}. Found {reaction} and we only have {reagentQuantity.Quantity}");
reaction = reagentQuantity.Quantity;
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Chemistry/TileReactions/SpillTileReaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2
var step = entityManager.EnsureComponent<StepTriggerComponent>(puddleUid);
entityManager.EntitySysManager.GetEntitySystem<StepTriggerSystem>().SetRequiredTriggerSpeed(puddleUid, _requiredSlipSpeed, step);

var slow = entityManager.EnsureComponent<SlowContactsComponent>(puddleUid);
var slow = entityManager.EnsureComponent<SpeedModifierContactsComponent>(puddleUid);
var speedModifier = 1 - reagent.Viscosity;
entityManager.EntitySysManager.GetEntitySystem<SlowContactsSystem>().ChangeModifiers(puddleUid, speedModifier, slow);
entityManager.EntitySysManager.GetEntitySystem<SpeedModifierContactsSystem>().ChangeModifiers(puddleUid, speedModifier, slow);

return reactVolume;
}
Expand Down
7 changes: 2 additions & 5 deletions Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Content.Server.DeviceNetwork.Components;
using Content.Shared.DeviceNetwork;
using Content.Shared.DeviceNetwork.Components;
Expand All @@ -12,8 +12,6 @@ namespace Content.Server.DeviceNetwork.Systems;
[UsedImplicitly]
public sealed class DeviceListSystem : SharedDeviceListSystem
{
private ISawmill _sawmill = default!;

[Dependency] private readonly NetworkConfiguratorSystem _configurator = default!;

public override void Initialize()
Expand All @@ -23,7 +21,6 @@ public override void Initialize()
SubscribeLocalEvent<DeviceListComponent, BeforeBroadcastAttemptEvent>(OnBeforeBroadcast);
SubscribeLocalEvent<DeviceListComponent, BeforePacketSentEvent>(OnBeforePacketSent);
SubscribeLocalEvent<BeforeSaveEvent>(OnMapSave);
_sawmill = Logger.GetSawmill("devicelist");
}

private void OnShutdown(EntityUid uid, DeviceListComponent component, ComponentShutdown args)
Expand Down Expand Up @@ -154,7 +151,7 @@ private void OnMapSave(BeforeSaveEvent ev)
// TODO full game saves.
// when full saves are supported, this should instead add data to the BeforeSaveEvent informing the
// saving system that this map (or null-space entity) also needs to be included in the save.
_sawmill.Error(
Log.Error(
$"Saving a device list ({ToPrettyString(uid)}) that has a reference to an entity on another map ({ToPrettyString(ent)}). Removing entity from list.");
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Disposal/Tube/DisposalTubeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void OnUiAction(EntityUid uid, DisposalRouterComponent router, SharedDis
if (trimmed == "")
continue;

router.Tags.Add(tag.Trim());
router.Tags.Add(trimmed);
}

_audioSystem.PlayPvs(router.ClickSound, uid, AudioParams.Default.WithVolume(-2f));
Expand Down
8 changes: 4 additions & 4 deletions Content.Server/Fluids/EntitySystems/PuddleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
[Dependency] private readonly SharedPopupSystem _popups = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly StepTriggerSystem _stepTrigger = default!;
[Dependency] private readonly SlowContactsSystem _slowContacts = default!;
[Dependency] private readonly SpeedModifierContactsSystem _speedModContacts = default!;
[Dependency] private readonly TileFrictionController _tile = default!;

[ValidatePrototypeId<ReagentPrototype>]
Expand Down Expand Up @@ -435,13 +435,13 @@ private void UpdateSlow(EntityUid uid, Solution solution)

if (maxViscosity > 0)
{
var comp = EnsureComp<SlowContactsComponent>(uid);
var comp = EnsureComp<SpeedModifierContactsComponent>(uid);
var speed = 1 - maxViscosity;
_slowContacts.ChangeModifiers(uid, speed, comp);
_speedModContacts.ChangeModifiers(uid, speed, comp);
}
else
{
RemComp<SlowContactsComponent>(uid);
RemComp<SpeedModifierContactsComponent>(uid);
}
}

Expand Down
10 changes: 3 additions & 7 deletions Content.Server/Forensics/Systems/ForensicScannerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ public sealed class ForensicScannerSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;

private ISawmill _sawmill = default!;

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

_sawmill = Logger.GetSawmill("forensics.scanner");

SubscribeLocalEvent<ForensicScannerComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<ForensicScannerComponent, AfterInteractUsingEvent>(OnAfterInteractUsing);
SubscribeLocalEvent<ForensicScannerComponent, BeforeActivatableUIOpenEvent>(OnBeforeActivatableUIOpen);
Expand All @@ -57,7 +53,7 @@ private void UpdateUserInterface(EntityUid uid, ForensicScannerComponent compone
component.PrintReadyAt);

if (!_uiSystem.TrySetUiState(uid, ForensicScannerUiKey.Key, state))
_sawmill.Warning($"{ToPrettyString(uid)} was unable to set UI state.");
Log.Warning($"{ToPrettyString(uid)} was unable to set UI state.");
}

private void OnDoAfter(EntityUid uid, ForensicScannerComponent component, DoAfterEvent args)
Expand Down Expand Up @@ -180,7 +176,7 @@ private void OnPrint(EntityUid uid, ForensicScannerComponent component, Forensic
{
if (!args.Session.AttachedEntity.HasValue)
{
_sawmill.Warning($"{ToPrettyString(uid)} got OnPrint without Session.AttachedEntity");
Log.Warning($"{ToPrettyString(uid)} got OnPrint without Session.AttachedEntity");
return;
}

Expand All @@ -200,7 +196,7 @@ private void OnPrint(EntityUid uid, ForensicScannerComponent component, Forensic

if (!HasComp<PaperComponent>(printed))
{
_sawmill.Error("Printed paper did not have PaperComponent.");
Log.Error("Printed paper did not have PaperComponent.");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Kitchen/EntitySystems/SharpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private bool TryStartButcherDoAfter(EntityUid knife, EntityUid target, EntityUid
if (TryComp<MobStateComponent>(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState))
return false;

if (butcher.Type != ButcheringType.Knife)
if (butcher.Type != ButcheringType.Knife && target != user)
{
_popupSystem.PopupEntity(Loc.GetString("butcherable-different-tool", ("target", target)), knife, user);
return true;
Expand Down
14 changes: 6 additions & 8 deletions Content.Server/Mapping/MappingSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.CCVar;
Expand Down Expand Up @@ -32,7 +32,6 @@ public sealed class MappingSystem : EntitySystem
/// <returns></returns>
private Dictionary<MapId, (TimeSpan next, string fileName)> _currentlyAutosaving = new();

private ISawmill _sawmill = default!;
private bool _autosaveEnabled;

public override void Initialize()
Expand All @@ -44,7 +43,6 @@ public override void Initialize()
"autosave <map> <path if enabling>",
ToggleAutosaveCommand);

_sawmill = Logger.GetSawmill("autosave");
Subs.CVar(_cfg, CCVars.AutosaveEnabled, SetAutosaveEnabled, true);
}

Expand All @@ -69,7 +67,7 @@ public override void Update(float frameTime)

if (!_mapManager.MapExists(map) || _mapManager.IsMapInitialized(map))
{
_sawmill.Warning($"Can't autosave map {map}; it doesn't exist, or is initialized. Removing from autosave.");
Log.Warning($"Can't autosave map {map}; it doesn't exist, or is initialized. Removing from autosave.");
_currentlyAutosaving.Remove(map);
return;
}
Expand All @@ -79,7 +77,7 @@ public override void Update(float frameTime)

var path = Path.Combine(saveDir, $"{DateTime.Now.ToString("yyyy-M-dd_HH.mm.ss")}-AUTO.yml");
_currentlyAutosaving[map] = (CalculateNextTime(), name);
_sawmill.Info($"Autosaving map {name} ({map}) to {path}. Next save in {ReadableTimeLeft(map)} seconds.");
Log.Info($"Autosaving map {name} ({map}) to {path}. Next save in {ReadableTimeLeft(map)} seconds.");
_map.SaveMap(map, path);
}
}
Expand All @@ -105,17 +103,17 @@ public void ToggleAutosave(MapId map, string? path=null)
{
if (!_mapManager.MapExists(map) || _mapManager.IsMapInitialized(map))
{
_sawmill.Warning("Tried to enable autosaving on non-existant or already initialized map!");
Log.Warning("Tried to enable autosaving on non-existant or already initialized map!");
_currentlyAutosaving.Remove(map);
return;
}

_sawmill.Info($"Started autosaving map {path} ({map}). Next save in {ReadableTimeLeft(map)} seconds.");
Log.Info($"Started autosaving map {path} ({map}). Next save in {ReadableTimeLeft(map)} seconds.");
}
else
{
_currentlyAutosaving.Remove(map);
_sawmill.Info($"Stopped autosaving on map {map}");
Log.Info($"Stopped autosaving on map {map}");
}
}

Expand Down
Loading

0 comments on commit dea18f0

Please sign in to comment.