Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-station-14 into 2024-06-03_mail-table
  • Loading branch information
Whatstone committed Jun 14, 2024
2 parents eaeb7cf + b94e1b8 commit fa3848f
Show file tree
Hide file tree
Showing 286 changed files with 23,333 additions and 2,562 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ public sealed partial class GasPressurePumpComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxTargetPressure")]
public float MaxTargetPressure = Atmospherics.MaxOutputPressure;

/// <summary>
/// Frontier - Start the pump with the map.
/// </summary>
[DataField]
public bool StartOnMapInit { get; set; } = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ public sealed partial class GasVolumePumpComponent : Component

[DataField("lastMolesTransferred")]
public float LastMolesTransferred;

/// <summary>
/// Frontier - Start the pump with the map.
/// </summary>
[DataField]
public bool StartOnMapInit { get; set; } = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public override void Initialize()
// Bound UI subscriptions
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpChangeOutputPressureMessage>(OnOutputPressureChangeMessage);
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasPressurePumpComponent, MapInitEvent>(OnMapInit); // Frontier
}

private void OnInit(EntityUid uid, GasPressurePumpComponent pump, ComponentInit args)
Expand Down Expand Up @@ -153,5 +155,17 @@ private void UpdateAppearance(EntityUid uid, GasPressurePumpComponent? pump = nu

_appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance);
}

private void OnMapInit(EntityUid uid, GasPressurePumpComponent pump, MapInitEvent args) // Frontier - Init on map
{
if (pump.StartOnMapInit)
{
pump.Enabled = true;
UpdateAppearance(uid, pump);

DirtyUI(uid, pump);
_userInterfaceSystem.CloseUi(uid, GasPressurePumpUiKey.Key);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public override void Initialize()
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasVolumePumpComponent, DeviceNetworkPacketEvent>(OnPacketRecv);

SubscribeLocalEvent<GasVolumePumpComponent, MapInitEvent>(OnMapInit); // Frontier
}

private void OnInit(EntityUid uid, GasVolumePumpComponent pump, ComponentInit args)
Expand Down Expand Up @@ -206,5 +208,17 @@ private void OnPacketRecv(EntityUid uid, GasVolumePumpComponent component, Devic
return;
}
}

private void OnMapInit(EntityUid uid, GasVolumePumpComponent pump, MapInitEvent args) // Frontier - Init on map
{
if (pump.StartOnMapInit)
{
pump.Enabled = true;
UpdateAppearance(uid, pump);

DirtyUI(uid, pump);
_userInterfaceSystem.CloseUi(uid, GasVolumePumpUiKey.Key);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ public sealed partial class GasMixerComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField("inletTwoConcentration")]
public float InletTwoConcentration = 0.5f;

/// <summary>
/// Frontier - Start the pump with the map.
/// </summary>
[DataField]
public bool StartOnMapInit { get; set; } = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public override void Initialize()
SubscribeLocalEvent<GasMixerComponent, GasMixerToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasMixerComponent, AtmosDeviceDisabledEvent>(OnMixerLeaveAtmosphere);

SubscribeLocalEvent<GasMixerComponent, MapInitEvent>(OnMapInit); // Frontier
}

private void OnInit(EntityUid uid, GasMixerComponent mixer, ComponentInit args)
Expand Down Expand Up @@ -232,5 +234,17 @@ private void OnMixerAnalyzed(EntityUid uid, GasMixerComponent component, GasAnal

args.DeviceFlipped = inletOne != null && inletTwo != null && inletOne.CurrentPipeDirection.ToDirection() == inletTwo.CurrentPipeDirection.ToDirection().GetClockwise90Degrees();
}

private void OnMapInit(EntityUid uid, GasMixerComponent mixer, MapInitEvent args) // Frontier - Init on map
{
if (mixer.StartOnMapInit)
{
mixer.Enabled = true;
DirtyUI(uid, mixer);

UpdateAppearance(uid, mixer);
_userInterfaceSystem.CloseUi(uid, GasFilterUiKey.Key);
}
}
}
}
38 changes: 35 additions & 3 deletions Content.Server/Bible/BibleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using Content.Server.Bible.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Ghost.Roles.Events;
using Content.Server.Popups;
using Content.Shared.ActionBlocker;
using Content.Shared.Actions;
using Content.Shared.Bible;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Damage;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
Expand Down Expand Up @@ -38,7 +41,8 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BibleComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<BibleComponent, MixingAttemptEvent>(OnMixingAttempt); // Frontier: restrict solution blessing to bible users
SubscribeLocalEvent<BibleComponent, AfterInteractEvent>(OnAfterInteract, before: [typeof(ReactionMixerSystem)]); // Frontier: add before parameter
SubscribeLocalEvent<SummonableComponent, GetVerbsEvent<AlternativeVerb>>(AddSummonVerb);
SubscribeLocalEvent<SummonableComponent, GetItemActionsEvent>(GetSummonAction);
SubscribeLocalEvent<SummonableComponent, SummonActionEvent>(OnSummon);
Expand Down Expand Up @@ -91,6 +95,19 @@ public override void Update(float frameTime)
}
}

// Frontier: only bible users can bless water/blood
private void OnMixingAttempt(EntityUid uid, BibleComponent component, ref MixingAttemptEvent args)
{
// Block water/blood blessing attempts by non-bible users
if (component.BlockMix)
{
_popupSystem.PopupEntity(Loc.GetString("bible-bless-solution-failed"), component.LastInteractingUser, component.LastInteractingUser, PopupType.Small);
args.Cancelled = true;
return;
}
}
// End Frontier

private void OnAfterInteract(EntityUid uid, BibleComponent component, AfterInteractEvent args)
{
if (!args.CanReach)
Expand All @@ -99,12 +116,24 @@ private void OnAfterInteract(EntityUid uid, BibleComponent component, AfterInter
if (!TryComp(uid, out UseDelayComponent? useDelay) || _delay.IsDelayed((uid, useDelay)))
return;

if (args.Target == null || args.Target == args.User || !_mobStateSystem.IsAlive(args.Target.Value))
// Frontier: only bible users can bless water/blood
if (args.Target == null)
{
return;
}

if (!HasComp<BibleUserComponent>(args.User))
// In case the user is trying to mix something, store who's using it and whether or not they're a bible user.
component.LastInteractingUser = args.User;
var hasBibleUserComponent = HasComp<BibleUserComponent>(args.User);
component.BlockMix = !hasBibleUserComponent;

if (args.Target == args.User || !_mobStateSystem.IsAlive(args.Target.Value))
{
return;
}
// End Frontier

if (!hasBibleUserComponent) // Frontier: cache bible component lookup
{
_popupSystem.PopupEntity(Loc.GetString("bible-sizzle"), args.User, args.User);

Expand Down Expand Up @@ -226,7 +255,10 @@ private void AttemptSummon(Entity<SummonableComponent> ent, EntityUid user, Tran
if (component.AlreadySummoned || component.SpecialItemPrototype == null)
return;
if (component.RequiresBibleUser && !HasComp<BibleUserComponent>(user))
{
_popupSystem.PopupEntity(Loc.GetString("bible-summon-request-failed"), user, user, PopupType.Small); // Frontier: better summon feedback
return;
}
if (!Resolve(user, ref position))
return;
if (component.Deleted || Deleted(uid))
Expand Down
15 changes: 15 additions & 0 deletions Content.Server/Bible/Components/BibleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,20 @@ public sealed partial class BibleComponent : Component

[DataField("locPrefix")]
public string LocPrefix = "bible";

// Frontier: prevent non-bible users from blessing water/blood.

/// <summary>
/// Whether or not a mixing attempt from this bible should be blocked.
/// </summary>
[ViewVariables]
public bool BlockMix = false;

/// <summary>
/// The last user that interacted using the bible.
/// </summary>
[ViewVariables]
public EntityUid LastInteractingUser;
//End Frontier
}
}
3 changes: 2 additions & 1 deletion Content.Server/Materials/MaterialReclaimerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ private void OnInteractUsing(Entity<MaterialReclaimerComponent> entity, ref Inte
return;

// if we're trying to get a solution out of the reclaimer, don't destroy it
if (_solutionContainer.TryGetSolution(entity.Owner, entity.Comp.SolutionContainerId, out _, out var outputSolution) && outputSolution.Contents.Any())
// if (_solutionContainer.TryGetSolution(entity.Owner, entity.Comp.SolutionContainerId, out _, out var outputSolution) && outputSolution.Contents.Any()) // Frontier: previous implementation
if (_solutionContainer.TryGetSolution(entity.Owner, entity.Comp.SolutionContainerId, out _, out var outputSolution)) // Frontier: do not trash solution containers if the reclaimer is empty
{
if (TryComp<SolutionContainerManagerComponent>(args.Used, out var managerComponent) &&
_solutionContainer.EnumerateSolutions((args.Used, managerComponent)).Any(s => s.Solution.Comp.Solution.AvailableVolume > 0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ namespace Content.Server.Abilities.Oni
public sealed partial class HeldByOniComponent : Component
{
public EntityUid Holder = default!;

// Frontier: wield accuracy fix
public double minAngleAdded = 0.0;
public double maxAngleAdded = 0.0;
public double angleIncreaseAdded = 0.0;
// End Frontier
}
}
40 changes: 32 additions & 8 deletions Content.Server/Nyanotrasen/Abilities/Oni/OniSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Shared.Containers;
using Content.Shared.Weapons.Ranged.Systems;

namespace Content.Server.Abilities.Oni
{
public sealed class OniSystem : EntitySystem
{
[Dependency] private readonly ToolSystem _toolSystem = default!;
[Dependency] private readonly SharedGunSystem _gunSystem = default!;

private const double GunInaccuracyFactor = 17.0; // Frontier (20x<18x -> 10% buff)

public override void Initialize()
{
Expand All @@ -28,21 +32,41 @@ private void OnEntInserted(EntityUid uid, OniComponent component, EntInsertedInt

if (TryComp<GunComponent>(args.Entity, out var gun))
{
gun.MinAngle *= 20f;
gun.AngleIncrease *= 20f;
gun.MaxAngle *= 20f;
// Frontier: adjust penalty for wielded malus
if (TryComp<GunWieldBonusComponent>(args.Entity, out var bonus))
{
//GunWieldBonus values are stored as negative.
heldComp.minAngleAdded = (gun.MinAngle + bonus.MinAngle) * GunInaccuracyFactor;
heldComp.angleIncreaseAdded = (gun.AngleIncrease + bonus.AngleIncrease) * GunInaccuracyFactor;
heldComp.maxAngleAdded = (gun.MaxAngle + bonus.MaxAngle) * GunInaccuracyFactor;
}
else
{
heldComp.minAngleAdded = gun.MinAngle * GunInaccuracyFactor;
heldComp.angleIncreaseAdded = gun.AngleIncrease * GunInaccuracyFactor;
heldComp.maxAngleAdded = gun.MaxAngle * GunInaccuracyFactor;
}

gun.MinAngle += heldComp.minAngleAdded;
gun.AngleIncrease += heldComp.angleIncreaseAdded;
gun.MaxAngle += heldComp.maxAngleAdded;
_gunSystem.RefreshModifiers(args.Entity); // Make sure values propagate to modified values (this also dirties the gun for us)
// End Frontier
}
}

private void OnEntRemoved(EntityUid uid, OniComponent component, EntRemovedFromContainerMessage args)
{

if (TryComp<GunComponent>(args.Entity, out var gun))
// Frontier: angle manipulation stored in HeldByOniComponent
if (TryComp<GunComponent>(args.Entity, out var gun) &&
TryComp<HeldByOniComponent>(args.Entity, out var heldComp))
{
gun.MinAngle /= 20f;
gun.AngleIncrease /= 20f;
gun.MaxAngle /= 20f;
gun.MinAngle -= heldComp.minAngleAdded;
gun.AngleIncrease -= heldComp.angleIncreaseAdded;
gun.MaxAngle -= heldComp.maxAngleAdded;
_gunSystem.RefreshModifiers(args.Entity); // Make sure values propagate to modified values (this also dirties the gun for us)
}
// End Frontier

RemComp<HeldByOniComponent>(args.Entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace Content.Server.StationEvents.Components;
public sealed partial class BluespaceErrorRuleComponent : Component
{
/// <summary>
/// Path to the grid that gets bluspaced in
/// List of paths to the grids that can be bluespaced in.
/// </summary>
[DataField("gridPath")]
public string GridPath = "";
[DataField("gridPaths")]
public List<string> GridPaths = new();

/// <summary>
/// The color of your thing. the name should be set by the mapper when mapping.
/// The color of your thing. The name should be set by the mapper when mapping.
/// </summary>
[DataField("color")]
public Color Color = new Color(225, 15, 155);
Expand All @@ -31,7 +31,7 @@ public sealed partial class BluespaceErrorRuleComponent : Component
public EntityUid? GridUid = null;

/// <summary>
/// How much the grid is appraised at upon entering into existance, set after starting the event
/// How much the grid is appraised at upon entering into existence, set after starting the event
/// </summary>
[DataField("startingValue")]
public double startingValue = 0;
Expand Down
Loading

0 comments on commit fa3848f

Please sign in to comment.