Experimental Anomaly Vessel (#22233)

* experimental anomaly vessel

* sprote changes
This commit is contained in:
Nemanja
2023-12-08 13:50:41 -05:00
committed by GitHub
parent ea441ae876
commit e7e7974a24
20 changed files with 112 additions and 33 deletions

View File

@@ -20,7 +20,6 @@ public sealed partial class AnomalySystem
{
SubscribeLocalEvent<AnomalyVesselComponent, ComponentShutdown>(OnVesselShutdown);
SubscribeLocalEvent<AnomalyVesselComponent, MapInitEvent>(OnVesselMapInit);
SubscribeLocalEvent<AnomalyVesselComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<AnomalyVesselComponent, UpgradeExamineEvent>(OnUpgradeExamine);
SubscribeLocalEvent<AnomalyVesselComponent, InteractUsingEvent>(OnVesselInteractUsing);
SubscribeLocalEvent<AnomalyVesselComponent, ExaminedEvent>(OnExamined);
@@ -68,12 +67,6 @@ public sealed partial class AnomalySystem
UpdateVesselAppearance(uid, component);
}
private void OnRefreshParts(EntityUid uid, AnomalyVesselComponent component, RefreshPartsEvent args)
{
var modifierRating = args.PartRatings[component.MachinePartPointModifier] - 1;
component.PointMultiplier = MathF.Pow(component.PartRatingPointModifier, modifierRating);
}
private void OnUpgradeExamine(EntityUid uid, AnomalyVesselComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("anomaly-vessel-component-upgrade-output", component.PointMultiplier);
@@ -93,6 +86,7 @@ public sealed partial class AnomalySystem
component.Anomaly = scanner.ScannedAnomaly;
anomalyComponent.ConnectedVessel = uid;
_radiation.SetSourceEnabled(uid, true);
UpdateVesselAppearance(uid, component);
Popup.PopupEntity(Loc.GetString("anomaly-vessel-component-anomaly-assigned"), uid);
}
@@ -120,6 +114,7 @@ public sealed partial class AnomalySystem
component.Anomaly = null;
UpdateVesselAppearance(ent, component);
_radiation.SetSourceEnabled(ent, false);
if (!args.Supercritical)
continue;

View File

@@ -3,13 +3,13 @@ using Content.Server.Atmos.EntitySystems;
using Content.Server.Audio;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Materials;
using Content.Server.Radiation.Systems;
using Content.Server.Radio.EntitySystems;
using Content.Server.Station.Systems;
using Content.Shared.Anomaly;
using Content.Shared.Anomaly.Components;
using Content.Shared.DoAfter;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Physics.Events;
@@ -33,6 +33,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem
[Dependency] private readonly SharedPointLightSystem _pointLight = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly RadioSystem _radio = default!;
[Dependency] private readonly RadiationSystem _radiation = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;

View File

@@ -1,8 +1,6 @@
using Content.Shared.Anomaly;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Anomaly.Components;
@@ -25,22 +23,9 @@ public sealed partial class AnomalyVesselComponent : Component
/// <summary>
/// A multiplier applied to the amount of points generated.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float PointMultiplier = 1;
/// <summary>
/// The machine part that affects the point multiplier of the vessel
/// </summary>
[DataField("machinePartPointModifier", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartPointModifier = "Capacitor";
/// <summary>
/// A value used to scale the point multiplier
/// with the corresponding part rating.
/// </summary>
[DataField("partRatingPointModifier")]
public float PartRatingPointModifier = 1.25f;
/// <summary>
/// The maximum time between each beep
/// </summary>