Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychpsyo committed Sep 11, 2024
2 parents 78f0a13 + 01713ac commit eb87a68
Show file tree
Hide file tree
Showing 145 changed files with 46,424 additions and 4,297 deletions.
2 changes: 1 addition & 1 deletion Content.Client/VendingMachines/UI/VendingMachineItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
SeparationOverride="4">
<EntityPrototypeView
Name="ItemPrototype"
Margin="4 4"
Margin="4 0 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MinSize="32 32"
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/VendingMachines/UI/VendingMachineMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:co="clr-namespace:Content.Client.UserInterface.Controls">
<BoxContainer Name="MainContainer" Orientation="Vertical">
<LineEdit Name="SearchBar" PlaceHolder="{Loc 'vending-machine-component-search-filter'}" HorizontalExpand="True" Margin ="4 4"/>
<co:SearchListContainer Name="VendingContents" VerticalExpand="True" Margin="4 0"/>
<co:SearchListContainer Name="VendingContents" VerticalExpand="True" Margin="4 4"/>
<!-- Footer -->
<BoxContainer Orientation="Vertical">
<PanelContainer StyleClasses="LowDivider" />
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Anomaly/Effects/TechAnomalySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public override void Update(float frameTime)
while (query.MoveNext(out var uid, out var tech, out var anom))
{
if (_timing.CurTime < tech.NextTimer)
return;
continue;

tech.NextTimer = _timing.CurTime + TimeSpan.FromSeconds(tech.TimerFrequency * anom.Stability);
tech.NextTimer += TimeSpan.FromSeconds(tech.TimerFrequency * anom.Stability);

_signal.InvokePort(uid, tech.TimerPort);
}
Expand All @@ -61,7 +61,7 @@ private void CreateNewRandomLink(Entity<TechAnomalyComponent> tech, int count)
var devices = _lookup.GetEntitiesInRange<DeviceLinkSinkComponent>(Transform(tech).Coordinates, range);
if (devices.Count < 1)
return;

for (var i = 0; i < count; i++)
{
var device = _random.Pick(devices);
Expand Down
19 changes: 13 additions & 6 deletions Content.Server/Atmos/EntitySystems/GasTankSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
using Content.Server.Body.Systems;
using Content.Server.Cargo.Systems;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Storage.Components;
using Content.Shared.UserInterface;
using Content.Shared.Actions;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.CCVar;
using Content.Shared.Examine;
using Content.Shared.Throwing;
using Content.Shared.Toggleable;
Expand All @@ -17,7 +19,7 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Random;
using Content.Server.Storage.Components;
using Robust.Shared.Configuration;

namespace Content.Server.Atmos.EntitySystems
{
Expand All @@ -33,10 +35,12 @@ public sealed class GasTankSystem : EntitySystem
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

private const float TimerDelay = 0.5f;
private float _timer = 0f;
private const float MinimumSoundValvePressure = 10.0f;
private float _maxExplosionRange;

public override void Initialize()
{
Expand All @@ -52,6 +56,12 @@ public override void Initialize()
SubscribeLocalEvent<GasTankComponent, GasAnalyzerScanEvent>(OnAnalyzed);
SubscribeLocalEvent<GasTankComponent, PriceCalculationEvent>(OnGasTankPrice);
SubscribeLocalEvent<GasTankComponent, GetVerbsEvent<AlternativeVerb>>(OnGetAlternativeVerb);
Subs.CVar(_cfg, CCVars.AtmosTankFragment, UpdateMaxRange, true);
}

private void UpdateMaxRange(float value)
{
_maxExplosionRange = value;
}

private void OnGasShutdown(Entity<GasTankComponent> gasTank, ref ComponentShutdown args)
Expand Down Expand Up @@ -325,7 +335,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)

var pressure = internalAir.Air.Pressure;

if (pressure > component.TankFragmentPressure)
if (pressure > component.TankFragmentPressure && _maxExplosionRange > 0)
{
// Give the gas a chance to build up more pressure.
for (var i = 0; i < 3; i++)
Expand All @@ -338,10 +348,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)

// Let's cap the explosion, yeah?
// !1984
if (range > GasTankComponent.MaxExplosionRange)
{
range = GasTankComponent.MaxExplosionRange;
}
range = Math.Min(Math.Min(range, GasTankComponent.MaxExplosionRange), _maxExplosionRange);

_explosions.TriggerExplosive(owner, radius: range);

Expand Down
10 changes: 2 additions & 8 deletions Content.Server/Nutrition/EntitySystems/FoodSequenceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,8 @@ private bool TryAddFoodElement(Entity<FoodSequenceStartPointComponent> start, En
return false;

//looking for a suitable FoodSequence prototype
ProtoId<FoodSequenceElementPrototype> elementProto = string.Empty;
foreach (var pair in element.Comp.Entries)
{
if (pair.Key == start.Comp.Key)
{
elementProto = pair.Value;
}
}
if (!element.Comp.Entries.TryGetValue(start.Comp.Key, out var elementProto))
return false;
if (!_proto.TryIndex(elementProto, out var elementIndexed))
return false;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Numerics;
using System.Threading.Tasks;
using Content.Shared.Maps;
using Content.Shared.Procedural;
using Content.Shared.Procedural.DungeonGenerators;

Expand All @@ -10,7 +11,7 @@ public sealed partial class DungeonJob
/// <summary>
/// <see cref="FillGridDunGen"/>
/// </summary>
private async Task<Dungeon> GenerateFillDunGen(DungeonData data, HashSet<Vector2i> reservedTiles)
private async Task<Dungeon> GenerateFillDunGen(FillGridDunGen fill, DungeonData data, HashSet<Vector2i> reservedTiles)
{
if (!data.Entities.TryGetValue(DungeonDataKey.Fill, out var fillEnt))
{
Expand All @@ -28,6 +29,9 @@ private async Task<Dungeon> GenerateFillDunGen(DungeonData data, HashSet<Vector2
if (reservedTiles.Contains(tile))
continue;

if (fill.AllowedTiles != null && !fill.AllowedTiles.Contains(((ContentTileDefinition) _tileDefManager[tileRef.Value.Tile.TypeId]).ID))
continue;

if (!_anchorable.TileFree(_grid, tile, DungeonSystem.CollisionLayer, DungeonSystem.CollisionMask))
continue;

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Procedural/DungeonJob/DungeonJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private async Task RunLayer(
dungeons.AddRange(await GenerateExteriorDungen(position, exterior, reservedTiles, random));
break;
case FillGridDunGen fill:
dungeons.Add(await GenerateFillDunGen(data, reservedTiles));
dungeons.Add(await GenerateFillDunGen(fill, data, reservedTiles));
break;
case JunctionDunGen junc:
await PostGen(junc, data, dungeons[^1], reservedTiles, random);
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Revenant/EntitySystems/RevenantSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private bool TryUseAbility(EntityUid uid, RevenantComponent component, FixedPoin
}
}

ChangeEssenceAmount(uid, abilityCost, component, false);
ChangeEssenceAmount(uid, -abilityCost, component, false);

_statusEffects.TryAddStatusEffect<CorporealComponent>(uid, "Corporeal", TimeSpan.FromSeconds(debuffs.Y), false);
_stun.TryStun(uid, TimeSpan.FromSeconds(debuffs.X), false);
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Shuttles/Systems/ArrivalsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Movement.Components;
using Content.Shared.Parallax.Biomes;
using Content.Shared.Preferences;
using Content.Shared.Salvage;
using Content.Shared.Shuttles.Components;
using Content.Shared.Tiles;
Expand Down Expand Up @@ -334,6 +335,9 @@ public void HandlePlayerSpawning(PlayerSpawningEvent ev)
if (ev.SpawnResult != null)
return;

if (ev.HumanoidCharacterProfile?.SpawnPriority != SpawnPriorityPreference.Arrivals)
return;

// Only works on latejoin even if enabled.
if (!Enabled || _ticker.RunLevel != GameRunLevel.InRound)
return;
Expand Down
11 changes: 11 additions & 0 deletions Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using Content.Server.GameTicking;
using Content.Server.Spawners.Components;
using Content.Server.Station.Systems;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Robust.Server.Containers;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;

namespace Content.Server.Spawners.EntitySystems;
Expand All @@ -11,6 +14,7 @@ public sealed class ContainerSpawnPointSystem : EntitySystem
{
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
Expand All @@ -26,6 +30,13 @@ public void HandlePlayerSpawning(PlayerSpawningEvent args)
if (args.SpawnResult != null)
return;

// If it's just a spawn pref check if it's for cryo (silly).
if (args.HumanoidCharacterProfile?.SpawnPriority != SpawnPriorityPreference.Cryosleep &&
(!_proto.TryIndex(args.Job?.Prototype, out var jobProto) || jobProto.JobEntity == null))
{
return;
}

var query = EntityQueryEnumerator<ContainerSpawnPointComponent, ContainerManagerComponent, TransformComponent>();
var possibleContainers = new List<Entity<ContainerSpawnPointComponent, ContainerManagerComponent, TransformComponent>>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
using Content.Server.StationEvents.Events;
using Content.Server.StationEvents.Events;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;

namespace Content.Server.StationEvents.Components;

[RegisterComponent, Access(typeof(BureaucraticErrorRule))]
public sealed partial class BureaucraticErrorRuleComponent : Component
{

/// <summary>
/// The jobs that are ignored by this rule and won't have their slots changed.
/// </summary>
[DataField]
public List<ProtoId<JobPrototype>> IgnoredJobs = new();
}
5 changes: 4 additions & 1 deletion Content.Server/StationEvents/Events/BureaucraticErrorRule.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Linq;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Server.StationEvents.Components;
using Content.Shared.GameTicking.Components;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Shared.Random;

Expand All @@ -23,6 +23,9 @@ protected override void Started(EntityUid uid, BureaucraticErrorRuleComponent co

var jobList = _stationJobs.GetJobs(chosenStation.Value).Keys.ToList();

foreach(var job in component.IgnoredJobs)
jobList.Remove(job);

if (jobList.Count == 0)
return;

Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Atmos/Rotting/PerishableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public sealed partial class PerishableComponent : Component

[DataField, AutoNetworkedField]
public int Stage;

/// <summary>
/// If true, rot will always progress.
/// </summary>
[DataField, AutoNetworkedField]
public bool ForceRotProgression;
}


Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/Atmos/Rotting/SharedRottingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public bool IsRotProgressing(EntityUid uid, PerishableComponent? perishable)
if (!Resolve(uid, ref perishable, false))
return false;

// Overrides all the other checks.
if (perishable.ForceRotProgression)
return true;

// only dead things or inanimate objects can rot
if (TryComp<MobStateComponent>(uid, out var mobState) && !_mobState.IsDead(uid, mobState))
return false;
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,13 @@ public static readonly CVarDef<bool>
public static readonly CVarDef<float> AtmosHeatScale =
CVarDef.Create("atmos.heat_scale", 8f, CVar.SERVERONLY);

/// <summary>
/// Maximum explosion radius for explosions caused by bursting a gas tank ("max caps").
/// Setting this to zero disables the explosion but still allows the tank to burst and leak.
/// </summary>
public static readonly CVarDef<float> AtmosTankFragment =
CVarDef.Create("atmos.max_explosion_range", 26f, CVar.SERVERONLY);

/*
* MIDI instruments
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Damage.Components;

/// <summary>
/// This is used for an effect that nullifies <see cref="SlowOnDamageComponent"/> and adds an alert.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SlowOnDamageSystem))]
public sealed partial class IgnoreSlowOnDamageComponent : Component;
19 changes: 19 additions & 0 deletions Content.Shared/Damage/Systems/SlowOnDamageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public override void Initialize()
SubscribeLocalEvent<ClothingSlowOnDamageModifierComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<ClothingSlowOnDamageModifierComponent, ClothingGotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<ClothingSlowOnDamageModifierComponent, ClothingGotUnequippedEvent>(OnGotUnequipped);

SubscribeLocalEvent<IgnoreSlowOnDamageComponent, ComponentStartup>(OnIgnoreStartup);
SubscribeLocalEvent<IgnoreSlowOnDamageComponent, ComponentShutdown>(OnIgnoreShutdown);
SubscribeLocalEvent<IgnoreSlowOnDamageComponent, ModifySlowOnDamageSpeedEvent>(OnIgnoreModifySpeed);
}

private void OnRefreshMovespeed(EntityUid uid, SlowOnDamageComponent component, RefreshMovementSpeedModifiersEvent args)
Expand Down Expand Up @@ -84,6 +88,21 @@ private void OnGotUnequipped(Entity<ClothingSlowOnDamageModifierComponent> ent,
{
_movementSpeedModifierSystem.RefreshMovementSpeedModifiers(args.Wearer);
}

private void OnIgnoreStartup(Entity<IgnoreSlowOnDamageComponent> ent, ref ComponentStartup args)
{
_movementSpeedModifierSystem.RefreshMovementSpeedModifiers(ent);
}

private void OnIgnoreShutdown(Entity<IgnoreSlowOnDamageComponent> ent, ref ComponentShutdown args)
{
_movementSpeedModifierSystem.RefreshMovementSpeedModifiers(ent);
}

private void OnIgnoreModifySpeed(Entity<IgnoreSlowOnDamageComponent> ent, ref ModifySlowOnDamageSpeedEvent args)
{
args.Speed = 1f;
}
}

[ByRefEvent]
Expand Down
12 changes: 11 additions & 1 deletion Content.Shared/Procedural/DungeonGenerators/FillGridDunGen.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using Content.Shared.Maps;
using Robust.Shared.Prototypes;

namespace Content.Shared.Procedural.DungeonGenerators;

/// <summary>
Expand All @@ -7,4 +10,11 @@ namespace Content.Shared.Procedural.DungeonGenerators;
/// DungeonData keys are:
/// - Fill
/// </remarks>
public sealed partial class FillGridDunGen : IDunGenLayer;
public sealed partial class FillGridDunGen : IDunGenLayer
{
/// <summary>
/// Tiles the fill can occur on.
/// </summary>
[DataField]
public HashSet<ProtoId<ContentTileDefinition>>? AllowedTiles;
}
8 changes: 4 additions & 4 deletions Content.Shared/Revenant/Components/RevenantComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public sealed partial class RevenantComponent : Component
/// The amount of essence that is needed to use the ability.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("defileCost")]
public FixedPoint2 DefileCost = -30;
public FixedPoint2 DefileCost = 30;

/// <summary>
/// The status effects applied after the ability
Expand Down Expand Up @@ -121,7 +121,7 @@ public sealed partial class RevenantComponent : Component
/// The amount of essence that is needed to use the ability.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("overloadCost")]
public FixedPoint2 OverloadCost = -40;
public FixedPoint2 OverloadCost = 40;

/// <summary>
/// The status effects applied after the ability
Expand Down Expand Up @@ -149,7 +149,7 @@ public sealed partial class RevenantComponent : Component
/// The amount of essence that is needed to use the ability.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("blightCost")]
public float BlightCost = -50;
public float BlightCost = 50;

/// <summary>
/// The status effects applied after the ability
Expand All @@ -171,7 +171,7 @@ public sealed partial class RevenantComponent : Component
/// The amount of essence that is needed to use the ability.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("malfunctionCost")]
public FixedPoint2 MalfunctionCost = -60;
public FixedPoint2 MalfunctionCost = 60;

/// <summary>
/// The status effects applied after the ability
Expand Down
Loading

0 comments on commit eb87a68

Please sign in to comment.