Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Up250624 #340

Merged
merged 19 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Content.Server/Access/Systems/IdCardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Content.Shared.Popups;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Content.Server.Kitchen.EntitySystems;

namespace Content.Server.Access.Systems;

Expand All @@ -18,6 +19,7 @@ public sealed class IdCardSystem : SharedIdCardSystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly MicrowaveSystem _microwave = default!;

public override void Initialize()
{
Expand All @@ -27,9 +29,13 @@ public override void Initialize()

private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowavedEvent args)
{
if (!component.CanMicrowave || !TryComp<MicrowaveComponent>(args.Microwave, out var micro) || micro.Broken)
return;

if (TryComp<AccessComponent>(uid, out var access))
{
float randomPick = _random.NextFloat();

// if really unlucky, burn card
if (randomPick <= 0.15f)
{
Expand All @@ -46,6 +52,14 @@ private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowa
EntityManager.QueueDeleteEntity(uid);
return;
}

//Explode if the microwave can't handle it
if (!micro.CanMicrowaveIdsSafely)
{
_microwave.Explode((args.Microwave, micro));
return;
}

// If they're unlucky, brick their ID
if (randomPick <= 0.25f)
{
Expand All @@ -70,6 +84,7 @@ private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowa

_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}");

}
}
}
10 changes: 0 additions & 10 deletions Content.Server/Body/Components/MetabolizerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ public sealed partial class MetabolizerComponent : Component
[DataField("maxReagents")]
public int MaxReagentsProcessable = 3;

/// <summary>
/// Frontier
///
/// How many poisons can this metabolizer process at once?
/// Used to nerf 'stacked poisons' where having 5+ different poisons in a syringe, even at low
/// quantity, would be muuuuch better than just one poison acting.
/// </summary>
[DataField("maxPoisons")]
public int MaxPoisonsProcessable = 3;

/// <summary>
/// A list of metabolism groups that this metabolizer will act on, in order of precedence.
/// </summary>
Expand Down
17 changes: 9 additions & 8 deletions Content.Server/Body/Systems/MetabolizerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private void TryMetabolize(Entity<MetabolizerComponent, OrganComponent?, Solutio
var list = solution.Contents.ToArray();
_random.Shuffle(list);

int poisons = 0; // frontier modified
int reagents = 0;
foreach (var (reagent, quantity) in list)
{
if (!_prototypeManager.TryIndex<ReagentPrototype>(reagent.Prototype, out var proto))
Expand All @@ -158,10 +158,11 @@ private void TryMetabolize(Entity<MetabolizerComponent, OrganComponent?, Solutio

continue;
}
// frontier modified
// Already processed all poisons, skip to the next reagent.
if (poisons >= ent.Comp1.MaxPoisonsProcessable && proto.Metabolisms.ContainsKey("Poison"))

// Frontier: all cryogenic reagents in the solution should be processed, others should be limited (buff cryo meds)
if (reagents >= ent.Comp1.MaxReagentsProcessable && !proto.Metabolisms.ContainsKey("Cryogenic"))
continue;
// End Frontier


// loop over all our groups and see which ones apply
Expand Down Expand Up @@ -219,10 +220,10 @@ private void TryMetabolize(Entity<MetabolizerComponent, OrganComponent?, Solutio
if (mostToRemove > FixedPoint2.Zero)
{
solution.RemoveReagent(reagent, mostToRemove);
// frontier modified
// We have processed a poison, so count it towards the cap
if (proto.Metabolisms.ContainsKey("Poison"))
poisons++;
// Frontier: do not count cryogenics chems against the reagent limit (to buff cryo meds)
if (!proto.Metabolisms.ContainsKey("Cryogenic"))
reagents++;
// End Frontier
}
}

Expand Down
6 changes: 6 additions & 0 deletions Content.Server/Kitchen/Components/MicrowaveComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ public sealed partial class MicrowaveComponent : Component
/// Chance of lightning occurring when we microwave a metallic object
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float LightningChance = .75f;

/// <summary>
/// If this microwave can give ids accesses without exploding
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool CanMicrowaveIdsSafely = true;
}

public sealed class BeingMicrowavedEvent : HandledEntityEventArgs
Expand Down
30 changes: 27 additions & 3 deletions Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Server.Administration.Logs;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Construction;
Expand All @@ -15,6 +16,7 @@
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Construction.EntitySystems;
using Content.Shared.Database;
using Content.Shared.Destructible;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
Expand All @@ -35,7 +37,8 @@
using System.Linq;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Shared.Access.Components;
using Content.Shared.Stacks;
using Content.Server.Construction.Components;

namespace Content.Server.Kitchen.EntitySystems
{
Expand All @@ -59,6 +62,9 @@ public sealed class MicrowaveSystem : EntitySystem
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
[Dependency] private readonly HandsSystem _handsSystem = default!;
[Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedStackSystem _stack = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;

[ValidatePrototypeId<EntityPrototype>]
private const string MalfunctionSpark = "Spark";
Expand Down Expand Up @@ -394,6 +400,23 @@ public static bool HasContents(MicrowaveComponent component)
return component.Storage.ContainedEntities.Any();
}

/// <summary>
/// Explodes the microwave internally, turning it into a broken state, destroying its board, and spitting out its machine parts
/// </summary>
/// <param name="ent"></param>
public void Explode(Entity<MicrowaveComponent> ent)
{
ent.Comp.Broken = true; // Make broken so we stop processing stuff
_explosion.TriggerExplosive(ent);
if (TryComp<MachineComponent>(ent, out var machine))
{
_container.CleanContainer(machine.BoardContainer);
_container.EmptyContainer(machine.PartContainer);
}

_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(ent)} exploded from unsafe cooking!");
}
/// <summary>
/// Handles the attempted cooking of unsafe objects
/// </summary>
Expand All @@ -411,7 +434,7 @@ private void RollMalfunction(Entity<ActiveMicrowaveComponent, MicrowaveComponent
ent.Comp1.MalfunctionTime = _gameTiming.CurTime + TimeSpan.FromSeconds(ent.Comp2.MalfunctionInterval);
if (_random.Prob(ent.Comp2.ExplosionChance))
{
_explosion.TriggerExplosive(ent);
Explode((ent, ent.Comp2));
return; // microwave is fucked, stop the cooking.
}

Expand Down Expand Up @@ -500,7 +523,8 @@ public void Wzhzhzh(EntityUid uid, MicrowaveComponent component, EntityUid? user
activeComp.CookTimeRemaining = component.CurrentCookTimerTime * component.CookTimeMultiplier;
activeComp.TotalTime = component.CurrentCookTimerTime; //this doesn't scale so that we can have the "actual" time
activeComp.PortionedRecipe = portionedRecipe;
component.CurrentCookTimeEnd = _gameTiming.CurTime + TimeSpan.FromSeconds(component.CurrentCookTimerTime);
//Scale tiems with cook times
component.CurrentCookTimeEnd = _gameTiming.CurTime + TimeSpan.FromSeconds(component.CurrentCookTimerTime * component.CookTimeMultiplier);
if (malfunctioning)
activeComp.MalfunctionTime = _gameTiming.CurTime + TimeSpan.FromSeconds(component.MalfunctionInterval);
UpdateUserInterfaceState(uid, component);
Expand Down
13 changes: 8 additions & 5 deletions Content.Server/Medical/CryoPodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;

// Frontier: keep a list of cryogenics reagents. The pod will only filter these out from the provided solution.
private static readonly string[] CryogenicsReagents = ["Cryoxadone", "Aloxadone", "Doxarubixadone", "Opporozidone", "Necrosol", "Traumoxadone", "Stelloxadone"];

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -115,14 +118,14 @@ public override void Update(float frameTime)
continue;
}

// frontier

// Frontier
// Filter out a fixed amount of each reagent from the cryo pod's beaker
var solutionToInject = _solutionContainerSystem.SplitSolutionReagentsEvenly(containerSolution.Value, cryoPod.BeakerTransferAmount);
// for every .25 units used, .5 units per second are added to the body, making cryo-pod more efficient than injections
solutionToInject.ScaleSolution(cryoPod.PotencyMultiplier);
var solutionToInject = _solutionContainerSystem.SplitSolutionPerReagentWithOnly(containerSolution.Value, cryoPod.BeakerTransferAmount, CryogenicsReagents);

// End frontier
// For every .25 units used, .5 units per second are added to the body, making cryo-pod more efficient than injections.
solutionToInject.ScaleSolution(cryoPod.PotencyMultiplier);
// End Frontier

_bloodstreamSystem.TryAddToChemicals(patient.Value, solutionToInject, bloodstream);
_reactiveSystem.DoEntityReaction(patient.Value, solutionToInject, ReactionMethod.Injection);
Expand Down
6 changes: 5 additions & 1 deletion Content.Shared/Access/Components/IdCardComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public sealed partial class IdCardComponent : Component
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool BypassLogging;

[DataField]
public LocId FullNameLocId = "access-id-card-component-owner-full-name-job-title-text";

[DataField]
public bool CanMicrowave = true;

// Frontier
[DataField("soundError")]
Expand All @@ -59,5 +64,4 @@ public sealed partial class IdCardComponent : Component
[DataField("soundInsert")]
public SoundSpecifier InsertSound =
new SoundPathSpecifier("/Audio/Machines/id_insert.ogg");

}
Loading
Loading