Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Guloveos committed Aug 20, 2024
2 parents 8be0587 + 2839c62 commit 7463f5e
Show file tree
Hide file tree
Showing 412 changed files with 23,304 additions and 11,756 deletions.
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"args": [
"build",
"/property:GenerateFullPaths=true", // Ask dotnet build to generate full paths for file names.
"/consoleloggerparameters:NoSummary" // Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:'ForceNoAlign;NoSummary'" // Do not generate summary otherwise it leads to duplicate errors in Problems panel
],
"group": {
"kind": "build",
Expand All @@ -29,9 +29,9 @@
"build",
"${workspaceFolder}/Content.YAMLLinter/Content.YAMLLinter.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"/consoleloggerparameters:'ForceNoAlign;NoSummary'"
],
"problemMatcher": "$msCompile"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Client.Administration.Managers;
using Content.Client.Administration.Managers;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
Expand All @@ -13,6 +13,7 @@ public sealed partial class ObjectsTabEntry : PanelContainer

public Action<NetEntity>? OnTeleport;
public Action<NetEntity>? OnDelete;
private readonly Dictionary<Button, ConfirmationData> _confirmations = new();

public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent, StyleBox styleBox)
{
Expand All @@ -27,6 +28,13 @@ public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent,
DeleteButton.Disabled = !manager.CanCommand("delete");

TeleportButton.OnPressed += _ => OnTeleport?.Invoke(nent);
DeleteButton.OnPressed += _ => OnDelete?.Invoke(nent);
DeleteButton.OnPressed += _ =>
{
if (!AdminUIHelpers.TryConfirm(DeleteButton, _confirmations))
{
return;
}
OnDelete?.Invoke(nent);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
MinSize="400 225">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="5">
<TextEdit Name="MessageInput" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 0 5" MinHeight="100" />
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="BroadcastButton" Text="{Loc 'comms-console-menu-broadcast-button'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" ToolTip="{Loc 'comms-console-menu-announcement-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="BroadcastButton" Text="{Loc 'comms-console-menu-broadcast-button'}" ToolTip="{Loc 'comms-console-menu-broadcast-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />

<OptionButton Name="AlertLevelButton" StyleClasses="OpenRight" Access="Public" />
<OptionButton Name="AlertLevelButton" ToolTip="{Loc 'comms-console-menu-alert-level-button-tooltip'}" StyleClasses="OpenRight" Access="Public" />

<Control MinSize="10 10" />

<RichTextLabel Name="CountdownLabel" VerticalExpand="True" />
<Button Name="EmergencyShuttleButton" Text="Placeholder Text" Access="Public" />
<Button Name="EmergencyShuttleButton" Text="Placeholder Text" ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}" Access="Public" />
</BoxContainer>
</controls:FancyWindow>
4 changes: 2 additions & 2 deletions Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ private void OnToggleGhosts(EntityUid uid, GhostComponent component, ToggleGhost
if (args.Handled)
return;

Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-ghost-visibility-popup"), args.Performer);

var locId = GhostVisibility ? "ghost-gui-toggle-ghost-visibility-popup-off" : "ghost-gui-toggle-ghost-visibility-popup-on";
Popup.PopupEntity(Loc.GetString(locId), args.Performer);
if (uid == _playerManager.LocalEntity)
ToggleGhostVisibility();

Expand Down
10 changes: 10 additions & 0 deletions Content.Client/Lathe/UI/LatheMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public void SetEntity(EntityUid uid)
MaterialsList.SetOwner(Entity);
}

protected override void Opened()
{
base.Opened();

if (_entityManager.TryGetComponent<LatheComponent>(Entity, out var latheComp))
{
AmountLineEdit.SetText(latheComp.DefaultProductionAmount.ToString());
}
}

/// <summary>
/// Populates the list of all the recipes
/// </summary>
Expand Down
27 changes: 27 additions & 0 deletions Content.Client/Materials/RecyclerVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Content.Shared.Conveyor;
using Content.Shared.Materials;
using Robust.Client.GameObjects;

namespace Content.Client.Materials;

public sealed class RecyclerVisualizerSystem : VisualizerSystem<RecyclerVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, RecyclerVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null || !args.Sprite.LayerMapTryGet(RecyclerVisualLayers.Main, out var layer))
return;

AppearanceSystem.TryGetData<ConveyorState>(uid, ConveyorVisuals.State, out var running);
AppearanceSystem.TryGetData<bool>(uid, RecyclerVisuals.Bloody, out var bloody);
AppearanceSystem.TryGetData<bool>(uid, RecyclerVisuals.Broken, out var broken);

var activityState = running == ConveyorState.Off ? 0 : 1;
if (broken) //breakage overrides activity
activityState = 2;

var bloodyKey = bloody ? component.BloodyKey : string.Empty;

var state = $"{component.BaseKey}{activityState}{bloodyKey}";
args.Sprite.LayerSetState(layer, state);
}
}
17 changes: 17 additions & 0 deletions Content.Client/Materials/RecyclerVisualsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Content.Client.Materials;

[RegisterComponent]
public sealed partial class RecyclerVisualsComponent : Component
{
/// <summary>
/// Key appended to state string if bloody.
/// </summary>
[DataField]
public string BloodyKey = "bld";

/// <summary>
/// Base key for the visual state.
/// </summary>
[DataField]
public string BaseKey = "grinder-o";
}
2 changes: 1 addition & 1 deletion Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public MiscTab()
var layoutEntries = new List<OptionDropDownCVar<string>.ValueOption>();
foreach (var layout in Enum.GetValues(typeof(ScreenType)))
{
layoutEntries.Add(new OptionDropDownCVar<string>.ValueOption(layout.ToString()!, layout.ToString()!));
layoutEntries.Add(new OptionDropDownCVar<string>.ValueOption(layout.ToString()!, Loc.GetString($"ui-options-hud-layout-{layout.ToString()!.ToLower()}")));
}

// Channel can be null in replays so.
Expand Down
10 changes: 6 additions & 4 deletions Content.Client/Radiation/Overlays/RadiationDebugOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Content.Client.Radiation.Overlays;
public sealed class RadiationDebugOverlay : Overlay
{
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly SharedMapSystem _mapSystem;
private readonly RadiationSystem _radiation;

private readonly Font _font;
Expand All @@ -21,6 +22,7 @@ public RadiationDebugOverlay()
{
IoCManager.InjectDependencies(this);
_radiation = _entityManager.System<RadiationSystem>();
_mapSystem = _entityManager.System<SharedMapSystem>();

var cache = IoCManager.Resolve<IResourceCache>();
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
Expand Down Expand Up @@ -67,7 +69,7 @@ private void DrawScreenRays(OverlayDrawArgs args)

foreach (var (tile, rads) in blockers)
{
var worldPos = grid.GridTileToWorldPos(tile);
var worldPos = _mapSystem.GridTileToWorldPos(gridUid, grid, tile);
var screenCenter = args.ViewportControl.WorldToScreen(worldPos);
handle.DrawString(_font, screenCenter, rads.ToString("F2"), 1.5f, Color.White);
}
Expand Down Expand Up @@ -95,8 +97,8 @@ private void DrawScreenResistance(OverlayDrawArgs args)
var offset = new Vector2(grid.TileSize, -grid.TileSize) * 0.25f;
foreach (var (tile, value) in resMap)
{
var localPos = grid.GridTileToLocal(tile).Position + offset;
var worldPos = grid.LocalToWorld(localPos);
var localPos = _mapSystem.GridTileToLocal(gridUid, grid, tile).Position + offset;
var worldPos = _mapSystem.LocalToWorld(gridUid, grid, localPos);
var screenCenter = args.ViewportControl.WorldToScreen(worldPos);
handle.DrawString(_font, screenCenter, value.ToString("F2"), color: Color.White);
}
Expand Down Expand Up @@ -129,7 +131,7 @@ private void DrawWorld(in OverlayDrawArgs args)
if (!_entityManager.TryGetComponent<MapGridComponent>(gridUid, out var grid))
continue;
var (destTile, _) = blockers.Last();
var destWorld = grid.GridTileToWorldPos(destTile);
var destWorld = _mapSystem.GridTileToWorldPos(gridUid, grid, destTile);
handle.DrawLine(ray.Source, destWorld, Color.Red);
}
}
Expand Down
27 changes: 26 additions & 1 deletion Content.Client/Salvage/UI/SalvageMagnetBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Content.Client.Message;
using Content.Shared.Salvage;
using Content.Shared.Salvage.Magnet;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -99,7 +100,31 @@ protected override void UpdateState(BoundUserInterfaceState state)

break;
case SalvageOffering salvage:
option.Title = Loc.GetString($"salvage-map-proto-{salvage.SalvageMap.ID}");
option.Title = Loc.GetString($"salvage-map-wreck");

var salvContainer = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
HorizontalExpand = true,
};

var sizeLabel = new Label
{
Text = Loc.GetString("salvage-map-wreck-desc-size"),
HorizontalAlignment = Control.HAlignment.Left,
};

var sizeValueLabel = new RichTextLabel
{
HorizontalAlignment = Control.HAlignment.Right,
HorizontalExpand = true,
};
sizeValueLabel.SetMarkup(Loc.GetString(salvage.SalvageMap.SizeString));

salvContainer.AddChild(sizeLabel);
salvContainer.AddChild(sizeValueLabel);

option.AddContent(salvContainer);
break;
default:
throw new ArgumentOutOfRangeException();
Expand Down
17 changes: 1 addition & 16 deletions Content.Server/Actions/ActionOnInteractSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,6 @@ private void OnAfterInteract(EntityUid uid, ActionOnInteractComponent component,
args.Handled = true;
}

private bool ValidAction(BaseActionComponent action, bool canReach = true)
{
if (!action.Enabled)
return false;

if (action.Charges.HasValue && action.Charges <= 0)
return false;

var curTime = _timing.CurTime;
if (action.Cooldown.HasValue && action.Cooldown.Value.End > curTime)
return false;

return canReach || action is BaseTargetActionComponent { CheckCanAccess: false };
}

private List<(EntityUid Id, T Comp)> GetValidActions<T>(List<EntityUid>? actions, bool canReach = true) where T : BaseActionComponent
{
var valid = new List<(EntityUid Id, T Comp)>();
Expand All @@ -180,7 +165,7 @@ private bool ValidAction(BaseActionComponent action, bool canReach = true)
{
if (!_actions.TryGetActionData(id, out var baseAction) ||
baseAction as T is not { } action ||
!ValidAction(action, canReach))
!_actions.ValidAction(action, canReach))
{
continue;
}
Expand Down
8 changes: 5 additions & 3 deletions Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Content.Shared.Database;
using Content.Shared.Mobs.Components;
using Content.Shared.Teleportation.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Collections;
using Robust.Shared.Random;
Expand Down Expand Up @@ -34,8 +33,11 @@ private void OnPulse(EntityUid uid, BluespaceAnomalyComponent component, ref Ano
var xformQuery = GetEntityQuery<TransformComponent>();
var xform = xformQuery.GetComponent(uid);
var range = component.MaxShuffleRadius * args.Severity * args.PowerModifier;
// get a list of all entities in range with the MobStateComponent
// we filter out those inside a container
// otherwise borg brains get removed from their body, or PAIs from a PDA
var mobs = new HashSet<Entity<MobStateComponent>>();
_lookup.GetEntitiesInRange(xform.Coordinates, range, mobs);
_lookup.GetEntitiesInRange(xform.Coordinates, range, mobs, flags: LookupFlags.Uncontained);
var allEnts = new ValueList<EntityUid>(mobs.Select(m => m.Owner)) { uid };
var coords = new ValueList<Vector2>();
foreach (var ent in allEnts)
Expand All @@ -59,7 +61,7 @@ private void OnSupercritical(EntityUid uid, BluespaceAnomalyComponent component,
var radius = component.SupercriticalTeleportRadius * args.PowerModifier;
var gridBounds = new Box2(mapPos - new Vector2(radius, radius), mapPos + new Vector2(radius, radius));
var mobs = new HashSet<Entity<MobStateComponent>>();
_lookup.GetEntitiesInRange(xform.Coordinates, component.MaxShuffleRadius, mobs);
_lookup.GetEntitiesInRange(xform.Coordinates, component.MaxShuffleRadius, mobs, flags: LookupFlags.Uncontained);
foreach (var comp in mobs)
{
var ent = comp.Owner;
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void TakeSuffocationDamage(Entity<RespiratorComponent> ent)
var organs = _bodySystem.GetBodyOrganEntityComps<LungComponent>((ent, null));
foreach (var entity in organs)
{
_alertsSystem.ShowAlert(entity.Owner, entity.Comp1.Alert);
_alertsSystem.ShowAlert(ent, entity.Comp1.Alert);
}
}

Expand All @@ -306,7 +306,7 @@ private void StopSuffocation(Entity<RespiratorComponent> ent)
var organs = _bodySystem.GetBodyOrganEntityComps<LungComponent>((ent, null));
foreach (var entity in organs)
{
_alertsSystem.ClearAlert(entity.Owner, entity.Comp1.Alert);
_alertsSystem.ClearAlert(ent, entity.Comp1.Alert);
}

_damageableSys.TryChangeDamage(ent, ent.Comp.DamageRecovery);
Expand Down
7 changes: 5 additions & 2 deletions Content.Server/Botany/SeedPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,12 @@ public partial class SeedData

[DataField("plantIconState")] public string PlantIconState { get; set; } = "produce";

/// <summary>
/// Screams random sound, could be strict sound SoundPathSpecifier or collection SoundCollectionSpecifier
/// base class is SoundSpecifier
/// </summary>
[DataField("screamSound")]
public SoundSpecifier ScreamSound = new SoundPathSpecifier("/Audio/Voice/Human/malescream_1.ogg");

public SoundSpecifier ScreamSound = new SoundCollectionSpecifier("PlantScreams", AudioParams.Default.WithVolume(-10));

[DataField("screaming")] public bool CanScream;

Expand Down
22 changes: 20 additions & 2 deletions Content.Server/Botany/Systems/MutationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ private void MutateFloat(ref float val, float min, float max, int bits, int tota
if (!Random(probBitflip))
return;

if (min == max)
{
val = min;
return;
}

// Starting number of bits that are high, between 0 and bits.
// In other words, it's val mapped linearly from range [min, max] to range [0, bits], and then rounded.
int valInt = (int)MathF.Round((val - min) / (max - min) * bits);
Expand Down Expand Up @@ -186,10 +192,22 @@ private void MutateInt(ref int val, int min, int max, int bits, int totalbits, f
if (!Random(probBitflip))
return;

if (min == max)
{
val = min;
return;
}

// Starting number of bits that are high, between 0 and bits.
// In other words, it's val mapped linearly from range [min, max] to range [0, bits], and then rounded.
int valInt = (int)MathF.Round((val - min) / (max - min) * bits);
// val may be outside the range of min/max due to starting prototype values, so clamp.
valInt = Math.Clamp(valInt, 0, bits);

// Probability that the bit flip increases n.
// The higher the current value is, the lower the probability of increasing value is, and the higher the probability of decreasive it it.
// The higher the current value is, the lower the probability of increasing value is, and the higher the probability of decreasing it.
// In other words, it tends to go to the middle.
float probIncrease = 1 - (float)val / bits;
float probIncrease = 1 - (float)valInt / bits;
int valMutated;
if (Random(probIncrease))
{
Expand Down
Loading

0 comments on commit 7463f5e

Please sign in to comment.