Merge remote-tracking branch 'upstream/master' into upstream

# Conflicts:
#	Content.Client/_Ohio/UI/AnimatedBackgroundControl.cs
#	Resources/Prototypes/_White/AnimatedLobbyScreens/lobbyScreens.yml
This commit is contained in:
2024-03-17 15:51:30 +03:00
187 changed files with 2301 additions and 292 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Humanoid;
using Content.Shared.Humanoid;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
@@ -9,7 +9,7 @@ namespace Content.Shared.Changeling;
public sealed partial class ChangelingComponent : Component
{
[DataField("chemRegenRate")]
public int ChemicalRegenRate = 2;
public int ChemicalRegenRate = 4;
[DataField("chemicalCap")]
public int ChemicalCapacity = 75;
@@ -24,7 +24,7 @@ public sealed partial class ChangelingComponent : Component
public float Accumulator;
[ViewVariables(VVAccess.ReadOnly)]
public float UpdateDelay = 6f;
public float UpdateDelay = 4f;
[ViewVariables(VVAccess.ReadOnly)]
public bool IsRegenerating;
@@ -48,13 +48,13 @@ public sealed partial class ChangelingComponent : Component
public float AbsorbDnaDelay = 10f;
[ViewVariables(VVAccess.ReadWrite), DataField("TransformDelay")]
public float TransformDelay = 2f;
public float TransformDelay;
[ViewVariables(VVAccess.ReadWrite), DataField("RegenerateDelay")]
public float RegenerateDelay = 60f;
[ViewVariables(VVAccess.ReadWrite), DataField("LesserFormDelay")]
public float LesserFormDelay = 5f;
public float LesserFormDelay;
public bool IsInited;
}

View File

@@ -1,4 +1,5 @@
using Content.Shared.Alert;
using Content.Shared.Alert;
using Content.Shared.Inventory;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Network;
@@ -10,24 +11,38 @@ public sealed class ChemicalsSystem : EntitySystem
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly INetManager _net = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ClothingModifyChemicalRegenComponent, InventoryRelayedEvent<ChemRegenModifyEvent>>(
OnChemRegenModify);
SubscribeLocalEvent<VoidAdaptationComponent, ChemRegenModifyEvent>(OnVoidAdaptationChemRegenModify);
}
private void OnVoidAdaptationChemRegenModify(Entity<VoidAdaptationComponent> ent, ref ChemRegenModifyEvent args)
{
args.Multiplier *= ent.Comp.ChemMultiplier;
ent.Comp.ChemMultiplier = 1f;
}
private void OnChemRegenModify(Entity<ClothingModifyChemicalRegenComponent> ent,
ref InventoryRelayedEvent<ChemRegenModifyEvent> args)
{
args.Args.Multiplier *= ent.Comp.Multiplier;
}
public bool AddChemicals(EntityUid uid, ChangelingComponent component, int quantity)
{
var capacity = component.ChemicalCapacity;
if (_mobStateSystem.IsDead(uid))
capacity /= 2;
if (component.ChemicalsBalance >= capacity)
return false;
var toAdd = quantity;
component.ChemicalsBalance = Math.Min(component.ChemicalsBalance + quantity, capacity);
if (component.ChemicalsBalance == component.ChemicalCapacity)
return false;
if (component.ChemicalsBalance + toAdd > component.ChemicalCapacity)
{
var overflow = component.ChemicalsBalance + toAdd - component.ChemicalCapacity;
toAdd -= overflow;
component.ChemicalsBalance += toAdd;
}
component.ChemicalsBalance += toAdd;
Dirty(uid, component);
UpdateAlert(uid, component);
@@ -69,11 +84,11 @@ public sealed class ChemicalsSystem : EntitySystem
if(component.Accumulator < component.UpdateDelay)
continue;
if (component.IsRegenerating)
continue;
component.Accumulator = 0;
AddChemicals(uid, component, component.ChemicalRegenRate);
var ev = new ChemRegenModifyEvent();
RaiseLocalEvent(uid, ev);
var chemicals = (int) MathF.Round(component.ChemicalRegenRate * ev.Multiplier);
AddChemicals(uid, component, chemicals);
}
}

View File

@@ -0,0 +1,8 @@
namespace Content.Shared.Changeling;
[RegisterComponent]
public sealed partial class ClothingModifyChemicalRegenComponent : Component
{
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float Multiplier = 0.75f;
}

View File

@@ -0,0 +1,6 @@
namespace Content.Shared.Changeling;
[RegisterComponent]
public sealed partial class DeleteOnChangelingRefundComponent : Component
{
}

View File

@@ -1,5 +1,6 @@
using Content.Shared.Actions;
using Content.Shared.Actions;
using Content.Shared.DoAfter;
using Content.Shared.Inventory;
using Robust.Shared.Serialization;
namespace Content.Shared.Changeling;
@@ -97,3 +98,34 @@ public sealed partial class BiodegradeActionEvent : InstantActionEvent
{
}
public sealed partial class AugmentedEyesightActionEvent : InstantActionEvent
{
}
[Serializable, NetSerializable]
public sealed class AugmentedEyesightPurchasedEvent : EntityEventArgs
{
}
public sealed partial class DissonantShriekActionEvent : InstantActionEvent
{
}
[Serializable, NetSerializable]
public sealed class VoidAdaptationPurchasedEvent : EntityEventArgs
{
}
public sealed class ChemRegenModifyEvent : EntityEventArgs, IInventoryRelayEvent
{
public SlotFlags TargetSlots => ~SlotFlags.POCKET;
public float Multiplier = 1f;
}
public sealed class ChangelingRefundEvent : EntityEventArgs, IInventoryRelayEvent
{
public SlotFlags TargetSlots => SlotFlags.All;
public EntityUid Store;
}

View File

@@ -0,0 +1,7 @@
namespace Content.Shared.Changeling;
[RegisterComponent]
public sealed partial class VoidAdaptationComponent : Component
{
public float ChemMultiplier = 1f;
}

View File

@@ -1,4 +1,5 @@
using Content.Shared._White.StaminaProtection;
using Content.Shared.Changeling;
using Content.Shared.Chemistry;
using Content.Shared.Damage;
using Content.Shared.Electrocution;
@@ -29,6 +30,8 @@ public partial class InventorySystem
SubscribeLocalEvent<InventoryComponent, ModifyChangedTemperatureEvent>(RelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, AdjustTemperatureEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, StaminaDamageModifyEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, ChemRegenModifyEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, ChangelingRefundEvent>(RelayInventoryEvent); // WD
SubscribeLocalEvent<InventoryComponent, GetDefaultRadioChannelEvent>(RelayInventoryEvent);
// by-ref events

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using Content.Shared._White.ShitSilo;
using Content.Shared.Emag.Systems;
using Content.Shared.Materials;
using Content.Shared.Research.Prototypes;
@@ -44,9 +45,21 @@ public abstract class SharedLatheSystem : EntitySystem
{
var adjustedAmount = AdjustMaterial(needed, recipe.ApplyMaterialDiscount, component.MaterialUseMultiplier);
if (_materialStorage.GetMaterialAmount(uid, material) < adjustedAmount * amount)
var gridUid =
HasComp<BluespaceSiloComponent>(uid) &&
TryComp<TransformComponent>(uid, out var transformComponent)
? transformComponent.GridUid
: null;
var gridStorage = gridUid.HasValue &&
TryComp<MaterialStorageComponent>(gridUid, out var materialStorageComponent)
? materialStorageComponent
: null;
if (_materialStorage.GetMaterialAmount(uid, material, gridUid: gridUid, gridStorage: gridStorage) < adjustedAmount * amount)
return false;
}
return true;
}

View File

@@ -7,7 +7,6 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Materials;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SharedMaterialStorageSystem))]
public sealed partial class MaterialStorageComponent : Component
{
[DataField, AutoNetworkedField]

View File

@@ -1,6 +1,8 @@
using System.Linq;
using Content.Shared._White.ShitSilo;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Components;
using Content.Shared.Lathe;
using Content.Shared.Stacks;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
@@ -77,10 +79,19 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
/// <param name="material"></param>
/// <param name="component"></param>
/// <returns>The volume of the material</returns>
public int GetMaterialAmount(EntityUid uid, string material, MaterialStorageComponent? component = null)
public int GetMaterialAmount(EntityUid uid, string material, MaterialStorageComponent? component = null, EntityUid? gridUid = null, MaterialStorageComponent? gridStorage = null)
{
if (gridUid.HasValue && gridStorage != null)
{
if (!Resolve(gridUid.Value, ref gridStorage))
return 0; //you have nothing
return gridStorage.Storage.GetValueOrDefault(material, 0);
}
if (!Resolve(uid, ref component))
return 0; //you have nothing
return component.Storage.GetValueOrDefault(material, 0);
}
@@ -104,10 +115,19 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
/// <param name="volume"></param>
/// <param name="component"></param>
/// <returns>If the specified volume will fit</returns>
public bool CanTakeVolume(EntityUid uid, int volume, MaterialStorageComponent? component = null)
public bool CanTakeVolume(EntityUid uid, int volume, MaterialStorageComponent? component = null, EntityUid? gridUid = null, MaterialStorageComponent? gridStorage = null)
{
if (gridUid.HasValue && gridStorage != null)
{
if (!Resolve(gridUid.Value, ref gridStorage))
return false;
return gridStorage.StorageLimit == null || GetTotalMaterialAmount(gridUid.Value, gridStorage) + volume <= gridStorage.StorageLimit;
}
if (!Resolve(uid, ref component))
return false;
return false;
return component.StorageLimit == null || GetTotalMaterialAmount(uid, component) + volume <= component.StorageLimit;
}
@@ -119,18 +139,21 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
/// <param name="volume"></param>
/// <param name="component"></param>
/// <returns>If the amount can be changed</returns>
public bool CanChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent? component = null)
public bool CanChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent? component, EntityUid? gridUid = null, MaterialStorageComponent? gridStorage = null)
{
if (!Resolve(uid, ref component))
return false;
if (!CanTakeVolume(uid, volume, component))
if (!CanTakeVolume(uid, volume, component, gridUid:gridUid, gridStorage:gridStorage))
return false;
if (component.MaterialWhiteList != null && !component.MaterialWhiteList.Contains(materialId))
return false;
var amount = component.Storage.GetValueOrDefault(materialId);
var amount = gridStorage != null
? gridStorage.Storage.GetValueOrDefault(materialId)
: component.Storage.GetValueOrDefault(materialId);
return amount + volume >= 0;
}
@@ -164,21 +187,37 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
/// <param name="component"></param>
/// <param name="dirty"></param>
/// <returns>If it was successful</returns>
public bool TryChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent? component = null, bool dirty = true)
public bool TryChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent? component = null, bool dirty = true, EntityUid? gridUid = null, MaterialStorageComponent? gridStorage = null)
{
if (!Resolve(uid, ref component))
return false;
if (!CanChangeMaterialAmount(uid, materialId, volume, component))
if (!CanChangeMaterialAmount(uid, materialId, volume, component, gridUid:gridUid, gridStorage:gridStorage))
return false;
component.Storage.TryAdd(materialId, 0);
component.Storage[materialId] += volume;
var rightStorage = gridStorage ?? component;
rightStorage.Storage.TryAdd(materialId, 0);
rightStorage.Storage[materialId] += volume;
var ev = new MaterialAmountChangedEvent();
RaiseLocalEvent(uid, ref ev);
if (dirty)
Dirty(uid, component);
// ShitSilo
if (!gridUid.HasValue || gridStorage == null)
return true; // Early return if conditions aren't met
var eventGrid = new MaterialAmountChangedEvent();
RaiseLocalEvent(gridUid.Value, ref eventGrid);
if (dirty)
Dirty(gridUid.Value, gridStorage);
return true;
}
/// <summary>
@@ -248,6 +287,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
if (storage.Whitelist?.IsValid(toInsert) == false)
return false;
if (HasComp<UnremoveableComponent>(toInsert))
return false;
@@ -255,21 +295,34 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
var multiplier = TryComp<StackComponent>(toInsert, out var stackComponent) ? stackComponent.Count : 1;
var totalVolume = 0;
var gridUid = HasComp<BluespaceSiloComponent>(receiver) &&
TryComp<TransformComponent>(receiver, out var transformComponent)
? transformComponent.GridUid
: null;
var gridStorage = gridUid.HasValue && TryComp<MaterialStorageComponent>(gridUid,
out var materialStorageComponent)
? materialStorageComponent
: null;
foreach (var (mat, vol) in composition.MaterialComposition)
{
if (!CanChangeMaterialAmount(receiver, mat, vol * multiplier, storage))
if (!CanChangeMaterialAmount(receiver, mat, vol * multiplier, storage, gridUid:gridUid, gridStorage:gridStorage))
return false;
totalVolume += vol * multiplier;
}
if (!CanTakeVolume(receiver, totalVolume, storage))
if (!CanTakeVolume(receiver, totalVolume, storage, gridUid:gridUid, gridStorage: gridStorage))
return false;
foreach (var (mat, vol) in composition.MaterialComposition)
{
TryChangeMaterialAmount(receiver, mat, vol * multiplier, storage);
TryChangeMaterialAmount(receiver, mat, vol * multiplier, gridUid:gridUid, gridStorage:gridStorage);
}
var insertingComp = EnsureComp<InsertingMaterialStorageComponent>(receiver);
insertingComp.EndTime = _timing.CurTime + storage.InsertionTime;
if (!storage.IgnoreColor)

View File

@@ -19,6 +19,7 @@ public abstract class SharedPowerCellSystem : EntitySystem
SubscribeLocalEvent<PowerCellSlotComponent, EntInsertedIntoContainerMessage>(OnCellInserted);
SubscribeLocalEvent<PowerCellSlotComponent, EntRemovedFromContainerMessage>(OnCellRemoved);
SubscribeLocalEvent<PowerCellSlotComponent, ContainerIsInsertingAttemptEvent>(OnCellInsertAttempt);
SubscribeLocalEvent<PowerCellSlotComponent, PowerCellChangedEvent>(OnPowerChanged);
}
private void OnRejuvenate(EntityUid uid, PowerCellSlotComponent component, RejuvenateEvent args)
@@ -30,6 +31,16 @@ public abstract class SharedPowerCellSystem : EntitySystem
RaiseLocalEvent(itemSlot.Item.Value, args);
}
private void OnPowerChanged(EntityUid uid, PowerCellSlotComponent component, PowerCellChangedEvent _)
{
if (!component.Initialized)
return;
var charged = HasDrawCharge(uid);
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, charged);
}
private void OnCellInsertAttempt(EntityUid uid, PowerCellSlotComponent component, ContainerIsInsertingAttemptEvent args)
{
if (!component.Initialized)
@@ -51,14 +62,18 @@ public abstract class SharedPowerCellSystem : EntitySystem
if (args.Container.ID != component.CellSlotId)
return;
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, true);
RaiseLocalEvent(uid, new PowerCellChangedEvent(false), false);
var charged = HasDrawCharge(uid);
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, charged);
RaiseLocalEvent(uid, new PowerCellChangedEvent(false));
}
protected virtual void OnCellRemoved(EntityUid uid, PowerCellSlotComponent component, EntRemovedFromContainerMessage args)
{
if (args.Container.ID != component.CellSlotId)
return;
_appearance.SetData(uid, PowerCellSlotVisuals.Enabled, false);
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
}

View File

@@ -132,7 +132,6 @@ public partial class ListingData : IEquatable<ListingData>, ICloneable
Description != listing.Description ||
ProductEntity != listing.ProductEntity ||
ProductAction != listing.ProductAction ||
ProductEvent != listing.ProductEvent ||
RestockTime != listing.RestockTime)
return false;

View File

@@ -23,12 +23,20 @@ public abstract class SharedNightVisionSystem : EntitySystem
private void OnRemove(EntityUid uid, NightVisionComponent component, ComponentRemove args)
{
_actions.RemoveAction(uid, component.ToggleActionEntity);
if (HasComp<TemporaryNightVisionComponent>(uid))
return;
UpdateNightVision(uid, false);
}
private void OnInit(EntityUid uid, NightVisionComponent component, ComponentInit args)
{
_actions.AddAction(uid, ref component.ToggleActionEntity, component.ToggleAction);
if (!component.IsActive && HasComp<TemporaryNightVisionComponent>(uid))
return;
UpdateNightVision(uid, component.IsActive);
}
@@ -41,8 +49,12 @@ public abstract class SharedNightVisionSystem : EntitySystem
component.IsActive = !component.IsActive;
_audio.PlayPredicted(component.ToggleSound, uid, uid);
UpdateNightVision(uid, component.IsActive);
args.Handled = true;
if (!component.IsActive && HasComp<TemporaryNightVisionComponent>(uid))
return;
UpdateNightVision(uid, component.IsActive);
}
}

View File

@@ -0,0 +1,19 @@
using Robust.Shared.GameStates;
namespace Content.Shared._White.Overlays;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TemporaryNightVisionComponent : Component
{
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public Vector3 Tint = new(0.3f, 0.3f, 0.3f);
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public float Strength = 2f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public float Noise = 0.5f;
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public Color Color = Color.FromHex("#FB9898");
}

View File

@@ -0,0 +1,9 @@
using Robust.Shared.GameStates;
namespace Content.Shared._White.ShitSilo;
[RegisterComponent, NetworkedComponent]
public sealed partial class BluespaceSiloComponent : Component
{
}