MAPS IN ATMOS (#4909)

* COLORIZE!

* ATMOS!

* FUCK

* fix occluders. also supply rates snuck in, broken serv3.
This commit is contained in:
moonheart08
2021-10-16 18:11:06 -05:00
committed by GitHub
parent 7dc6b95a10
commit f1ad199dca
5 changed files with 15670 additions and 162 deletions

View File

@@ -29,9 +29,11 @@ namespace Content.Server.Atmos.Piping.Trinary.Components
public float TargetPressure = Atmospherics.OneAtmosphere; public float TargetPressure = Atmospherics.OneAtmosphere;
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
[DataField("inletOneConcentration")]
public float InletOneConcentration = 0.5f; public float InletOneConcentration = 0.5f;
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
[DataField("inletTwoConcentration")]
public float InletTwoConcentration = 0.5f; public float InletTwoConcentration = 0.5f;
} }
} }

View File

@@ -28,6 +28,7 @@ namespace Content.Server.Atmos.Piping.Unary.Components
public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound; public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound;
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
[DataField("externalPressureBound")]
public float ExternalPressureBound { get; set; } = Atmospherics.OneAtmosphere; public float ExternalPressureBound { get; set; } = Atmospherics.OneAtmosphere;
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]

View File

@@ -24,7 +24,10 @@ namespace Content.Server.Atmos.Piping.Unary.Components
[ViewVariables] [ViewVariables]
public readonly HashSet<Gas> FilterGases = new() public readonly HashSet<Gas> FilterGases = new()
{ {
Gas.CarbonDioxide Gas.CarbonDioxide,
Gas.Plasma,
Gas.Tritium,
Gas.WaterVapor
}; };
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]

View File

@@ -0,0 +1,96 @@
using System;
using Content.Server.Administration;
using Content.Server.Administration.Managers;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.EntitySystems;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Administration;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
namespace Content.Server.Sandbox.Commands
{
[AnyCommand]
public class ColorNetworkCommand : IConsoleCommand
{
public string Command => "colornetwork";
public string Description => Loc.GetString("color-network-command-description");
public string Help => Loc.GetString("color-network-command-help-text", ("command",Command));
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var sandboxManager = IoCManager.Resolve<ISandboxManager>();
var adminManager = IoCManager.Resolve<IAdminManager>();
if (shell.IsClient && (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag((IPlayerSession)shell.Player!, AdminFlags.Mapping)))
{
shell.WriteError("You are not currently able to use mapping commands.");
}
if (args.Length != 3)
{
shell.WriteLine(Loc.GetString("shell-wrong-arguments-number"));
return;
}
var entityManager = IoCManager.Resolve<IEntityManager>();
if (!int.TryParse(args[0], out var targetId))
{
shell.WriteLine(Loc.GetString("shell-argument-must-be-number"));
return;
}
var eUid = new EntityUid(targetId);
if (!eUid.IsValid() || !entityManager.EntityExists(eUid))
{
shell.WriteLine(Loc.GetString("shell-invalid-entity-id"));
return;
}
var target = entityManager.GetEntity(eUid);
if (!target.TryGetComponent(out NodeContainerComponent? nodeContainerComponent))
{
shell.WriteLine(Loc.GetString("shell-entity-is-not-node-container"));
return;
}
if (!Enum.TryParse(args[1], out NodeGroupID nodeGroupId))
{
shell.WriteLine(Loc.GetString("shell-node-group-is-invalid"));
return;
}
var color = Color.TryFromHex(args[2]);
if (!color.HasValue)
{
shell.WriteError(Loc.GetString("shell-invalid-color-hex"));
return;
}
PaintNodes(nodeContainerComponent, nodeGroupId, color.Value);
}
private void PaintNodes(NodeContainerComponent nodeContainerComponent, NodeGroupID nodeGroupId, Color color)
{
var group = nodeContainerComponent.Nodes[nodeGroupId.ToString().ToLower()].NodeGroup;
if (group == null) return;
foreach (var x in group.Nodes)
{
if (!x.Owner.TryGetComponent<AtmosPipeColorComponent>(out var atmosPipeColorComponent)) continue;
EntitySystem.Get<AtmosPipeColorSystem>().SetColor(x.Owner.Uid, atmosPipeColorComponent, color);
}
}
}
}

File diff suppressed because it is too large Load Diff