Skip to content

Commit

Permalink
updated to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Eagle-0 committed Sep 22, 2024
2 parents 1bd302f + 900630c commit c291764
Show file tree
Hide file tree
Showing 117 changed files with 2,397 additions and 243 deletions.
5 changes: 5 additions & 0 deletions Content.Client/Store/Ui/StoreMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Client.Message;
using Content.Shared.FixedPoint;
using Content.Shared.Store;
using Content.Client.Stylesheets;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
Expand Down Expand Up @@ -147,6 +148,10 @@ private void AddListingGui(ListingData listing)
}

var newListing = new StoreListingControl(listing, GetListingPriceString(listing), hasBalance, texture);

if (listing.DiscountValue > 0)
newListing.StoreItemBuyButton.AddStyleClass(StyleNano.ButtonColorDangerDefault.ToString());

newListing.StoreItemBuyButton.OnButtonDown += args
=> OnListingButtonPressed?.Invoke(args, listing);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ public async Task ChangeMachine()
AssertPrototype("Autolathe");
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

namespace Content.IntegrationTests.Tests.Interaction;

// This partial class contains various constant prototype IDs common to interaction tests.
Expand Down Expand Up @@ -27,8 +28,6 @@ public abstract partial class InteractionTest

// Parts
protected const string Bin1 = "MatterBinStockPart";
protected const string Cap1 = "CapacitorStockPart";
protected const string Manipulator1 = "MicroManipulatorStockPart";
protected const string Battery1 = "PowerCellSmall";
protected const string Battery4 = "PowerCellHyper";
}

152 changes: 152 additions & 0 deletions Content.Server/Abilities/Psionics/Abilities/HealOtherPowerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
using Robust.Shared.Player;
using Content.Server.DoAfter;
using Content.Shared.Abilities.Psionics;
using Content.Shared.Damage;
using Content.Shared.DoAfter;
using Content.Shared.Popups;
using Content.Shared.Psionics.Events;
using Content.Shared.Examine;
using static Content.Shared.Examine.ExamineSystemShared;
using Robust.Shared.Timing;
using Content.Shared.Actions.Events;
using Robust.Server.Audio;
using Content.Server.Atmos.Rotting;
using Content.Shared.Mobs.Systems;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Psionics.Glimmer;

namespace Content.Server.Abilities.Psionics;

public sealed class RevivifyPowerSystem : EntitySystem
{
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedPsionicAbilitiesSystem _psionics = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ExamineSystemShared _examine = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly RottingSystem _rotting = default!;
[Dependency] private readonly MobThresholdSystem _mobThreshold = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly GlimmerSystem _glimmer = default!;


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

SubscribeLocalEvent<PsionicComponent, PsionicHealOtherPowerActionEvent>(OnPowerUsed);
SubscribeLocalEvent<PsionicComponent, DispelledEvent>(OnDispelled);
SubscribeLocalEvent<PsionicComponent, PsionicHealOtherDoAfterEvent>(OnDoAfter);
}


private void OnPowerUsed(EntityUid uid, PsionicComponent component, PsionicHealOtherPowerActionEvent args)
{
if (component.DoAfter is not null)
return;

if (!args.Immediate)
AttemptDoAfter(uid, component, args);
else ActivatePower(uid, component, args);

if (args.PopupText is not null
&& _glimmer.Glimmer > args.GlimmerObviousPopupThreshold * component.CurrentDampening)
_popupSystem.PopupEntity(Loc.GetString(args.PopupText, ("entity", uid)), uid,
Filter.Pvs(uid).RemoveWhereAttachedEntity(entity => !_examine.InRangeUnOccluded(uid, entity, ExamineRange, null)),
true,
args.PopupType);

if (args.PlaySound
&& _glimmer.Glimmer > args.GlimmerObviousSoundThreshold * component.CurrentDampening)
_audioSystem.PlayPvs(args.SoundUse, uid, args.AudioParams);

// Sanitize the Glimmer inputs because otherwise the game will crash if someone makes MaxGlimmer lower than MinGlimmer.
var minGlimmer = (int) Math.Round(MathF.MinMagnitude(args.MinGlimmer, args.MaxGlimmer)
+ component.CurrentAmplification - component.CurrentDampening);
var maxGlimmer = (int) Math.Round(MathF.MaxMagnitude(args.MinGlimmer, args.MaxGlimmer)
+ component.CurrentAmplification - component.CurrentDampening);

_psionics.LogPowerUsed(uid, args.PowerName, minGlimmer, maxGlimmer);
args.Handled = true;
}

private void AttemptDoAfter(EntityUid uid, PsionicComponent component, PsionicHealOtherPowerActionEvent args)
{
var ev = new PsionicHealOtherDoAfterEvent(_gameTiming.CurTime);
ev.HealingAmount = args.HealingAmount;
ev.RotReduction = args.RotReduction;
ev.DoRevive = args.DoRevive;
var doAfterArgs = new DoAfterArgs(EntityManager, uid, args.UseDelay, ev, uid, target: args.Target)
{
BreakOnUserMove = args.BreakOnUserMove,
BreakOnTargetMove = args.BreakOnTargetMove,
};

if (!_doAfterSystem.TryStartDoAfter(doAfterArgs, out var doAfterId))
return;

component.DoAfter = doAfterId;
}

private void OnDispelled(EntityUid uid, PsionicComponent component, DispelledEvent args)
{
if (component.DoAfter is null)
return;

_doAfterSystem.Cancel(component.DoAfter);
component.DoAfter = null;
args.Handled = true;
}

private void OnDoAfter(EntityUid uid, PsionicComponent component, PsionicHealOtherDoAfterEvent args)
{
// It's entirely possible for the caster to stop being Psionic(due to mindbreaking) mid cast
if (component is null)
return;
component.DoAfter = null;

// The target can also cease existing mid-cast
if (args.Target is null)
return;

_rotting.ReduceAccumulator(args.Target.Value, TimeSpan.FromSeconds(args.RotReduction * component.CurrentAmplification));

if (!TryComp<DamageableComponent>(args.Target.Value, out var damageableComponent))
return;

_damageable.TryChangeDamage(args.Target.Value, args.HealingAmount * component.CurrentAmplification, true, false, damageableComponent, uid);

if (!args.DoRevive
|| !TryComp<MobStateComponent>(args.Target, out var mob)
|| !_mobThreshold.TryGetThresholdForState(args.Target.Value, MobState.Dead, out var threshold)
|| damageableComponent.TotalDamage > threshold)
return;

_mobState.ChangeMobState(args.Target.Value, MobState.Critical, mob, uid);
}

// This would be the same thing as OnDoAfter, except that here the target isn't nullable, so I have to reuse code with different arguments.
private void ActivatePower(EntityUid uid, PsionicComponent component, PsionicHealOtherPowerActionEvent args)
{
if (component is null)
return;

_rotting.ReduceAccumulator(args.Target, TimeSpan.FromSeconds(args.RotReduction * component.CurrentAmplification));

if (!TryComp<DamageableComponent>(args.Target, out var damageableComponent))
return;

_damageable.TryChangeDamage(args.Target, args.HealingAmount * component.CurrentAmplification, true, false, damageableComponent, uid);

if (!args.DoRevive
|| !TryComp<MobStateComponent>(args.Target, out var mob)
|| !_mobThreshold.TryGetThresholdForState(args.Target, MobState.Dead, out var threshold)
|| damageableComponent.TotalDamage > threshold)
return;

_mobState.ChangeMobState(args.Target, MobState.Critical, mob, uid);
}
}
7 changes: 7 additions & 0 deletions Content.Server/Anomaly/AnomalySystem.Vessel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Anomaly.Components;
using Content.Server.Construction;
using Content.Server.Power.EntitySystems;
using Content.Shared.Anomaly;
using Content.Shared.Anomaly.Components;
Expand All @@ -20,6 +21,7 @@ private void InitializeVessel()
{
SubscribeLocalEvent<AnomalyVesselComponent, ComponentShutdown>(OnVesselShutdown);
SubscribeLocalEvent<AnomalyVesselComponent, MapInitEvent>(OnVesselMapInit);
SubscribeLocalEvent<AnomalyVesselComponent, UpgradeExamineEvent>(OnUpgradeExamine);
SubscribeLocalEvent<AnomalyVesselComponent, InteractUsingEvent>(OnVesselInteractUsing);
SubscribeLocalEvent<AnomalyVesselComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<AnomalyVesselComponent, ResearchServerGetPointsPerSecondEvent>(OnVesselGetPointsPerSecond);
Expand Down Expand Up @@ -65,6 +67,11 @@ private void OnVesselMapInit(EntityUid uid, AnomalyVesselComponent component, Ma
UpdateVesselAppearance(uid, component);
}

private void OnUpgradeExamine(EntityUid uid, AnomalyVesselComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("anomaly-vessel-component-upgrade-output", component.PointMultiplier);
}

private void OnVesselInteractUsing(EntityUid uid, AnomalyVesselComponent component, InteractUsingEvent args)
{
if (component.Anomaly != null ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Content.Shared.Atmos;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Atmos.Piping.Binary.Components
{
[RegisterComponent]
public sealed partial class GasRecyclerComponent : Component
{
[ViewVariables(VVAccess.ReadOnly)]
[DataField("reacting")]
public Boolean Reacting { get; set; } = false;

Expand All @@ -17,10 +18,28 @@ public sealed partial class GasRecyclerComponent : Component
[DataField("outlet")]
public string OutletName { get; set; } = "outlet";

[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float MinTemp = 300 + Atmospherics.T0C;

[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float BaseMinTemp = 300 + Atmospherics.T0C;

[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartMinTemp = "Capacitor";

[DataField]
public float PartRatingMinTempMultiplier = 0.95f;

[ViewVariables(VVAccess.ReadWrite)]
public float MinPressure = 30 * Atmospherics.OneAtmosphere;

[DataField]
public float BaseMinPressure = 30 * Atmospherics.OneAtmosphere;

[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartMinPressure = "Manipulator";

[DataField]
public float PartRatingMinPressureMultiplier = 0.8f;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Binary.Components;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Construction;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
Expand Down Expand Up @@ -28,6 +29,8 @@ public override void Initialize()
SubscribeLocalEvent<GasRecyclerComponent, AtmosDeviceUpdateEvent>(OnUpdate);
SubscribeLocalEvent<GasRecyclerComponent, AtmosDeviceDisabledEvent>(OnDisabled);
SubscribeLocalEvent<GasRecyclerComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<GasRecyclerComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<GasRecyclerComponent, UpgradeExamineEvent>(OnUpgradeExamine);
}

private void OnEnabled(EntityUid uid, GasRecyclerComponent comp, ref AtmosDeviceEnabledEvent args)
Expand Down Expand Up @@ -116,5 +119,20 @@ private void UpdateAppearance(EntityUid uid, GasRecyclerComponent? comp = null)

_appearance.SetData(uid, PumpVisuals.Enabled, comp.Reacting);
}

private void OnRefreshParts(EntityUid uid, GasRecyclerComponent component, RefreshPartsEvent args)
{
var ratingTemp = args.PartRatings[component.MachinePartMinTemp];
var ratingPressure = args.PartRatings[component.MachinePartMinPressure];

component.MinTemp = component.BaseMinTemp * MathF.Pow(component.PartRatingMinTempMultiplier, ratingTemp - 1);
component.MinPressure = component.BaseMinPressure * MathF.Pow(component.PartRatingMinPressureMultiplier, ratingPressure - 1);
}

private void OnUpgradeExamine(EntityUid uid, GasRecyclerComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("gas-recycler-upgrade-min-temp", component.MinTemp / component.BaseMinTemp);
args.AddPercentageUpgrade("gas-recycler-upgrade-min-pressure", component.MinPressure / component.BaseMinPressure);
}
}
}
46 changes: 43 additions & 3 deletions Content.Server/Atmos/Portable/PortableScrubberComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Content.Shared.Atmos;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Atmos.Portable
{
Expand Down Expand Up @@ -37,13 +39,51 @@ public sealed partial class PortableScrubberComponent : Component
/// <summary>
/// Maximum internal pressure before it refuses to take more.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float MaxPressure = 2500;

/// <summary>
/// The speed at which gas is scrubbed from the environment.
/// The base amount of maximum internal pressure
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float BaseMaxPressure = 2500;

/// <summary>
/// The machine part that modifies the maximum internal pressure
/// </summary>
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartMaxPressure = "MatterBin";

/// <summary>
/// How much the <see cref="MachinePartMaxPressure"/> will affect the pressure.
/// The value will be multiplied by this amount for each increasing part tier.
/// </summary>
[DataField]
public float PartRatingMaxPressureModifier = 1.5f;

/// <summary>
/// The speed at which gas is scrubbed from the environment.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float TransferRate = 800;

/// <summary>
/// The base speed at which gas is scrubbed from the environment.
/// </summary>
[DataField]
public float BaseTransferRate = 800;

/// <summary>
/// The machine part which modifies the speed of <see cref="TransferRate"/>
/// </summary>
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartTransferRate = "Manipulator";

/// <summary>
/// How much the <see cref="MachinePartTransferRate"/> will modify the rate.
/// The value will be multiplied by this amount for each increasing part tier.
/// </summary>
[DataField]
public float PartRatingTransferRateModifier = 1.4f;
}
}
Loading

0 comments on commit c291764

Please sign in to comment.