Files
crystall-punk-14/Content.Server/Tools/ToolSystem.cs

64 lines
2.2 KiB
C#
Raw Normal View History

using Content.Server.Atmos.EntitySystems;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.FixedPoint;
using Content.Shared.Tools.Components;
Refactors the AtmosphereSystem public-facing API to allow for multiple atmos backends. (#8134) * Refactors the entirety of the AtmosphereSystem public-facing API to allow for multiple atmos backends. * actually compiles * Remove commented out code * funny bracket * Move archived moles, temperature from GasMixture to TileAtmosphere. * WIP customizable map default mixture still VERY buggy * broken mess aaaaaaaaaaaaa * Fix lattice, etc not being considered space * visualization for "IsSpace" * help * Update Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs Co-authored-by: Moony <moonheart08@users.noreply.github.com> * Holy SHIT it compiles AGAIN * Fix AtmosDeviceSystem crash at shutdown * Fix immutable tiles on map blueprints not being fixed by fixgridatmos/revalidate. * Use space instead of gasmixture immutable for heat capacity calculations * Remove all LINDA-specific code from GasMixture, move it to TileAtmosphere/AtmosphereSystem instead. * Fix roundstart tiles not processing * Update Content.Server/Atmos/Commands/SetTemperatureCommand.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs Changed Files tab is so large I can't commit both suggestions at once mfw Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Moony <moonheart08@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2022-07-04 16:51:34 +02:00
using Robust.Server.GameObjects;
2023-10-24 00:20:33 +11:00
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
namespace Content.Server.Tools;
public sealed class ToolSystem : SharedToolSystem
{
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
public override void TurnOn(Entity<WelderComponent> entity, EntityUid? user)
{
base.TurnOn(entity, user);
var xform = Transform(entity);
if (xform.GridUid is { } gridUid)
{
var position = _transformSystem.GetGridOrMapTilePosition(entity.Owner, xform);
_atmosphereSystem.HotspotExpose(gridUid, position, 700, 50, entity.Owner, true);
}
}
public override void Update(float frameTime)
{
base.Update(frameTime);
UpdateWelders(frameTime);
}
2023-06-28 01:46:48 +00:00
//todo move to shared once you can remove reagents from shared without it freaking out.
private void UpdateWelders(float frameTime)
{
var query = EntityQueryEnumerator<WelderComponent, SolutionContainerManagerComponent>();
while (query.MoveNext(out var uid, out var welder, out var solutionContainer))
2023-06-28 01:46:48 +00:00
{
if (!welder.Enabled)
continue;
welder.WelderTimer += frameTime;
if (welder.WelderTimer < welder.WelderUpdateTimer)
continue;
if (!SolutionContainerSystem.ResolveSolution((uid, solutionContainer), welder.FuelSolutionName, ref welder.FuelSolution, out var solution))
continue;
SolutionContainerSystem.RemoveReagent(welder.FuelSolution.Value, welder.FuelReagent, welder.FuelConsumption * welder.WelderTimer);
if (solution.GetTotalPrototypeQuantity(welder.FuelReagent) <= FixedPoint2.Zero)
{
ItemToggle.Toggle(uid, predicted: false);
}
Dirty(uid, welder);
welder.WelderTimer -= welder.WelderUpdateTimer;
2023-06-28 01:46:48 +00:00
}
}
}