Fix tests (#3707)
* First pass * Fix access and rename banananium to bananium * Fix captialization of CookTimeInfoLabel * Fix InteractUsing calls * Remove unused [Dependency] * Replace obsolete references to Anchored with BodyType * Assign default value to shoving someone in disposals * Fix naming * Replace Initialize TryGetComponents with EnsureComponent * Rework AnchorableComponent * Fix singularity component * Replace obsolete usages of Angle.South * Fix efcore warning * Fix container tests * Fix DebugPressurePump invalid PressurePump yaml * Fix getting pathfinding region of grid 0 * Fix atmos plaque missing layer and add info message when it happens * Fix AiSteeringSystem steering in an invalid grid in entity test * Make content able to choose which log level leads to test failures * Revert container test fix for Acruid * Fix sprite, pipe and saving errors Make EntityTest print all errors instead of stopping on the first * Reorder singularity visualizer * Disable pvs for container occlusion adn simple predict reconcile, they use entities other than map ones Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.Atmos;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Client.GameObjects.Components.Atmos
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class AtmosPlaqueVisualizer : AppearanceVisualizer
|
||||||
|
{
|
||||||
|
[field: DataField("layer")]
|
||||||
|
private int Layer { get; }
|
||||||
|
|
||||||
|
public override void InitializeEntity(IEntity entity)
|
||||||
|
{
|
||||||
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
entity.GetComponentOrNull<SpriteComponent>()?.LayerMapReserveBlank(Layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!component.TryGetData(AtmosPlaqueVisuals.State, out string state))
|
||||||
|
{
|
||||||
|
sprite.LayerSetState(Layer, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.Kitchen;
|
using Content.Shared.Kitchen;
|
||||||
@@ -90,7 +90,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
var currentlySelectedTimeButton = (Button) _menu.CookTimeButtonVbox.GetChild(cState.ActiveButtonIndex);
|
var currentlySelectedTimeButton = (Button) _menu.CookTimeButtonVbox.GetChild(cState.ActiveButtonIndex);
|
||||||
currentlySelectedTimeButton.Pressed = true;
|
currentlySelectedTimeButton.Pressed = true;
|
||||||
var label = cState.ActiveButtonIndex <= 0 ? Loc.GetString("INSTANT") : cState.CurrentCookTime.ToString();
|
var label = cState.ActiveButtonIndex <= 0 ? Loc.GetString("INSTANT") : cState.CurrentCookTime.ToString();
|
||||||
_menu._cookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {label}";
|
_menu.CookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {label}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
public ItemList IngredientsList { get; }
|
public ItemList IngredientsList { get; }
|
||||||
|
|
||||||
public ItemList IngredientsListReagents { get; }
|
public ItemList IngredientsListReagents { get; }
|
||||||
public Label _cookTimeInfoLabel { get; }
|
public Label CookTimeInfoLabel { get; }
|
||||||
|
|
||||||
public MicrowaveMenu(MicrowaveBoundUserInterface owner)
|
public MicrowaveMenu(MicrowaveBoundUserInterface owner)
|
||||||
{
|
{
|
||||||
@@ -283,7 +283,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
var cookTimeOneSecondButton = (Button) CookTimeButtonVbox.GetChild(0);
|
var cookTimeOneSecondButton = (Button) CookTimeButtonVbox.GetChild(0);
|
||||||
cookTimeOneSecondButton.Pressed = true;
|
cookTimeOneSecondButton.Pressed = true;
|
||||||
|
|
||||||
_cookTimeInfoLabel = new Label
|
CookTimeInfoLabel = new Label
|
||||||
{
|
{
|
||||||
Text = Loc.GetString("COOK TIME: 1"),
|
Text = Loc.GetString("COOK TIME: 1"),
|
||||||
Align = Label.AlignMode.Center,
|
Align = Label.AlignMode.Center,
|
||||||
@@ -310,7 +310,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
Children =
|
Children =
|
||||||
{
|
{
|
||||||
_cookTimeInfoLabel
|
CookTimeInfoLabel
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.MachineLinking;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Client.GameObjects.Components.MachineLinking
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class SignalSwitchVisualizer : AppearanceVisualizer
|
||||||
|
{
|
||||||
|
[field: DataField("layer")]
|
||||||
|
private int Layer { get; }
|
||||||
|
|
||||||
|
public override void InitializeEntity(IEntity entity)
|
||||||
|
{
|
||||||
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
if (entity.TryGetComponent(out SpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
sprite.LayerMapReserveBlank(Layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!component.TryGetData(SignalSwitchVisuals.On, out bool on))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprite.LayerSetState(0, on ? "on" : "off");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.Mining;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Client.GameObjects.Components.Mining
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class AsteroidRockVisualizer : AppearanceVisualizer
|
||||||
|
{
|
||||||
|
[field: DataField("layer")]
|
||||||
|
private int Layer { get; } = 0;
|
||||||
|
|
||||||
|
public override void InitializeEntity(IEntity entity)
|
||||||
|
{
|
||||||
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
entity.GetComponentOrNull<SpriteComponent>()?.LayerMapReserveBlank(Layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component.TryGetData(AsteroidRockVisuals.State, out string state))
|
||||||
|
{
|
||||||
|
sprite.LayerMapReserveBlank(Layer);
|
||||||
|
sprite.LayerSetState(0, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.Singularity;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Client.GameObjects.Components.Singularity
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class SingularityVisualizer : AppearanceVisualizer
|
||||||
|
{
|
||||||
|
[field: DataField("layer")]
|
||||||
|
private int Layer { get; } = 0;
|
||||||
|
|
||||||
|
public override void InitializeEntity(IEntity entity)
|
||||||
|
{
|
||||||
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
entity.GetComponentOrNull<SpriteComponent>()?.LayerMapReserveBlank(Layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!component.TryGetData(SingularityVisuals.Level, out int level))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprite.LayerSetRSI(Layer, "Constructible/Power/Singularity/singularity_" + level + ".rsi");
|
||||||
|
sprite.LayerSetState(Layer, "singularity_" + level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -37,15 +37,31 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
private async Task<(ClientIntegrationInstance c, ServerIntegrationInstance s)> Start()
|
private async Task<(ClientIntegrationInstance c, ServerIntegrationInstance s)> Start()
|
||||||
{
|
{
|
||||||
var optsServer = new ServerIntegrationOptions {ExtraPrototypes = ExtraPrototypes};
|
var optsServer = new ServerIntegrationOptions
|
||||||
var optsClient = new ClientIntegrationOptions {ExtraPrototypes = ExtraPrototypes};
|
{
|
||||||
|
CVarOverrides =
|
||||||
|
{
|
||||||
|
{CVars.NetPVS.Name, "false"}
|
||||||
|
},
|
||||||
|
ExtraPrototypes = ExtraPrototypes
|
||||||
|
};
|
||||||
|
var optsClient = new ClientIntegrationOptions
|
||||||
|
{
|
||||||
|
|
||||||
|
CVarOverrides =
|
||||||
|
{
|
||||||
|
{CVars.NetPVS.Name, "false"}
|
||||||
|
},
|
||||||
|
ExtraPrototypes = ExtraPrototypes
|
||||||
|
};
|
||||||
|
|
||||||
var (c, s) = await StartConnectedServerDummyTickerClientPair(optsClient, optsServer);
|
var (c, s) = await StartConnectedServerDummyTickerClientPair(optsClient, optsServer);
|
||||||
|
|
||||||
s.Post(() =>
|
s.Post(() =>
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IPlayerManager>()
|
IoCManager.Resolve<IPlayerManager>()
|
||||||
.GetAllPlayers().Single()
|
.GetAllPlayers()
|
||||||
|
.Single()
|
||||||
.JoinGame();
|
.JoinGame();
|
||||||
|
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|||||||
@@ -71,19 +71,22 @@ namespace Content.IntegrationTests.Tests
|
|||||||
prototypes.Add(prototype);
|
prototypes.Add(prototype);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Iterate list of prototypes to spawn
|
Assert.Multiple(() =>
|
||||||
foreach (var prototype in prototypes)
|
|
||||||
{
|
{
|
||||||
Assert.DoesNotThrow(() =>
|
//Iterate list of prototypes to spawn
|
||||||
{
|
foreach (var prototype in prototypes)
|
||||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}");
|
{
|
||||||
testEntity = entityMan.SpawnEntity(prototype.ID, testLocation);
|
Assert.DoesNotThrow(() =>
|
||||||
server.RunTicks(2);
|
{
|
||||||
Assert.That(testEntity.Initialized);
|
Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}");
|
||||||
entityMan.DeleteEntity(testEntity.Uid);
|
testEntity = entityMan.SpawnEntity(prototype.ID, testLocation);
|
||||||
}, "Entity '{0}' threw an exception.",
|
server.RunTicks(2);
|
||||||
prototype.ID);
|
Assert.That(testEntity.Initialized);
|
||||||
}
|
entityMan.DeleteEntity(testEntity.Uid);
|
||||||
|
}, "Entity '{0}' threw an exception.",
|
||||||
|
prototype.ID);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
@@ -106,7 +109,11 @@ namespace Content.IntegrationTests.Tests
|
|||||||
- type: entity
|
- type: entity
|
||||||
id: AllComponentsOneToOneDeleteTestEntity";
|
id: AllComponentsOneToOneDeleteTestEntity";
|
||||||
|
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption {ExtraPrototypes = testEntity});
|
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||||
|
{
|
||||||
|
ExtraPrototypes = testEntity,
|
||||||
|
FailureLogLevel = LogLevel.Error
|
||||||
|
});
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
@@ -142,43 +149,46 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
var testLocation = grid.ToCoordinates();
|
Assert.Multiple(() =>
|
||||||
|
|
||||||
foreach (var type in componentFactory.AllRegisteredTypes)
|
|
||||||
{
|
{
|
||||||
var component = (Component) componentFactory.GetComponent(type);
|
var testLocation = grid.ToCoordinates();
|
||||||
|
|
||||||
// If this component is ignored
|
foreach (var type in componentFactory.AllRegisteredTypes)
|
||||||
if (skipComponents.Contains(component.Name))
|
|
||||||
{
|
{
|
||||||
continue;
|
var component = (Component) componentFactory.GetComponent(type);
|
||||||
}
|
|
||||||
|
|
||||||
var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation);
|
// If this component is ignored
|
||||||
|
if (skipComponents.Contains(component.Name))
|
||||||
Assert.That(entity.Initialized);
|
|
||||||
|
|
||||||
// The component may already exist if it is a mandatory component
|
|
||||||
// such as MetaData or Transform
|
|
||||||
if (entity.HasComponent(type))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
component.Owner = entity;
|
|
||||||
|
|
||||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
|
||||||
|
|
||||||
Assert.DoesNotThrow(() =>
|
|
||||||
{
|
{
|
||||||
entityManager.ComponentManager.AddComponent(entity, component);
|
continue;
|
||||||
}, "Component '{0}' threw an exception.",
|
}
|
||||||
component.Name);
|
|
||||||
|
|
||||||
server.RunTicks(2);
|
var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation);
|
||||||
|
|
||||||
entityManager.DeleteEntity(entity.Uid);
|
Assert.That(entity.Initialized);
|
||||||
}
|
|
||||||
|
// The component may already exist if it is a mandatory component
|
||||||
|
// such as MetaData or Transform
|
||||||
|
if (entity.HasComponent(type))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
component.Owner = entity;
|
||||||
|
|
||||||
|
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
||||||
|
|
||||||
|
Assert.DoesNotThrow(() =>
|
||||||
|
{
|
||||||
|
entityManager.ComponentManager.AddComponent(entity, component);
|
||||||
|
}, "Component '{0}' threw an exception.",
|
||||||
|
component.Name);
|
||||||
|
|
||||||
|
server.RunTicks(2);
|
||||||
|
|
||||||
|
entityManager.DeleteEntity(entity.Uid);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
@@ -201,7 +211,11 @@ namespace Content.IntegrationTests.Tests
|
|||||||
- type: entity
|
- type: entity
|
||||||
id: AllComponentsOneEntityDeleteTestEntity";
|
id: AllComponentsOneEntityDeleteTestEntity";
|
||||||
|
|
||||||
var server = StartServerDummyTicker(new ServerContentIntegrationOption {ExtraPrototypes = testEntity});
|
var server = StartServerDummyTicker(new ServerContentIntegrationOption
|
||||||
|
{
|
||||||
|
ExtraPrototypes = testEntity,
|
||||||
|
FailureLogLevel = LogLevel.Error
|
||||||
|
});
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
@@ -271,44 +285,46 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
foreach (var distinct in distinctComponents)
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
var testLocation = grid.ToCoordinates();
|
foreach (var distinct in distinctComponents)
|
||||||
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
|
||||||
|
|
||||||
Assert.That(entity.Initialized);
|
|
||||||
|
|
||||||
foreach (var type in distinct.components)
|
|
||||||
{
|
{
|
||||||
var component = (Component) componentFactory.GetComponent(type);
|
var testLocation = grid.ToCoordinates();
|
||||||
|
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
||||||
|
|
||||||
// If the entity already has this component, if it was ensured or added by another
|
Assert.That(entity.Initialized);
|
||||||
if (entity.HasComponent(component.GetType()))
|
|
||||||
|
foreach (var type in distinct.components)
|
||||||
{
|
{
|
||||||
continue;
|
var component = (Component) componentFactory.GetComponent(type);
|
||||||
}
|
|
||||||
|
|
||||||
// If this component is ignored
|
// If the entity already has this component, if it was ensured or added by another
|
||||||
if (skipComponents.Contains(component.Name))
|
if (entity.HasComponent(component.GetType()))
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
component.Owner = entity;
|
|
||||||
|
|
||||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
|
||||||
|
|
||||||
Assert.DoesNotThrow(() =>
|
|
||||||
{
|
{
|
||||||
entityManager.ComponentManager.AddComponent(entity, component);
|
continue;
|
||||||
}, "Component '{0}' threw an exception.",
|
}
|
||||||
component.Name);
|
|
||||||
|
// If this component is ignored
|
||||||
|
if (skipComponents.Contains(component.Name))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
component.Owner = entity;
|
||||||
|
|
||||||
|
Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}");
|
||||||
|
|
||||||
|
Assert.DoesNotThrow(() =>
|
||||||
|
{
|
||||||
|
entityManager.ComponentManager.AddComponent(entity, component);
|
||||||
|
}, "Component '{0}' threw an exception.",
|
||||||
|
component.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
server.RunTicks(2);
|
||||||
|
entityManager.DeleteEntity(entity.Uid);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
server.RunTicks(2);
|
|
||||||
|
|
||||||
entityManager.DeleteEntity(entity.Uid);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.GameObjects.Components.Movement;
|
using Content.Server.GameObjects.Components.Movement;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.GameStates;
|
using Robust.Client.GameStates;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -43,7 +44,11 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
// This test is designed around specific timing values and when I wrote it interpolation was off.
|
// This test is designed around specific timing values and when I wrote it interpolation was off.
|
||||||
// As such, I would have to update half this test to make sure it works with interpolation.
|
// As such, I would have to update half this test to make sure it works with interpolation.
|
||||||
// I'm kinda lazy.
|
// I'm kinda lazy.
|
||||||
CVarOverrides = {{"net.interp", "false"}},
|
CVarOverrides =
|
||||||
|
{
|
||||||
|
{CVars.NetInterp.Name, "false"},
|
||||||
|
{CVars.NetPVS.Name, "false"}
|
||||||
|
},
|
||||||
ContentBeforeIoC = () =>
|
ContentBeforeIoC = () =>
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
|
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
|
||||||
@@ -52,6 +57,10 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
},
|
},
|
||||||
new ServerContentIntegrationOption
|
new ServerContentIntegrationOption
|
||||||
{
|
{
|
||||||
|
CVarOverrides =
|
||||||
|
{
|
||||||
|
{CVars.NetPVS.Name, "false"}
|
||||||
|
},
|
||||||
ContentBeforeIoC = () =>
|
ContentBeforeIoC = () =>
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
|
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests
|
namespace Content.IntegrationTests.Tests
|
||||||
{
|
{
|
||||||
@@ -89,6 +90,12 @@ namespace Content.IntegrationTests.Tests
|
|||||||
nodeGroupID: Apc
|
nodeGroupID: Apc
|
||||||
- type: SnapGrid
|
- type: SnapGrid
|
||||||
offset: Center
|
offset: Center
|
||||||
|
- type: UserInterface
|
||||||
|
interfaces:
|
||||||
|
- key: enum.ApcUiKey.Key
|
||||||
|
type: ApcBoundUserInterface
|
||||||
|
- type: AccessReader
|
||||||
|
access: [['Engineering']]
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: ApcExtensionCableDummy
|
name: ApcExtensionCableDummy
|
||||||
@@ -138,7 +145,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
if (generatorEnt.TryGetComponent(out PhysicsComponent? physics))
|
if (generatorEnt.TryGetComponent(out PhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
physics.Anchored = true;
|
physics.BodyType = BodyType.Static;
|
||||||
}
|
}
|
||||||
|
|
||||||
supplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
supplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Robust.Server.Maps;
|
|||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -18,7 +19,10 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
const string mapPath = @"/Maps/Test/TestMap.yml";
|
const string mapPath = @"/Maps/Test/TestMap.yml";
|
||||||
|
|
||||||
var server = StartServer();
|
var server = StartServer(new ServerContentIntegrationOption
|
||||||
|
{
|
||||||
|
FailureLogLevel = LogLevel.Error
|
||||||
|
});
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
var mapLoader = server.ResolveDependency<IMapLoader>();
|
var mapLoader = server.ResolveDependency<IMapLoader>();
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Server.GameObjects.Components;
|
using Content.Server.GameObjects.Components;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
@@ -83,9 +83,9 @@ namespace Content.Server.Commands.GameTicking
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (childEntity.Transform.LocalRotation != Angle.South)
|
if (childEntity.Transform.LocalRotation != Angle.Zero)
|
||||||
{
|
{
|
||||||
childEntity.Transform.LocalRotation = Angle.South;
|
childEntity.Transform.LocalRotation = Angle.Zero;
|
||||||
changed++;
|
changed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
|
using Content.Server.GameObjects.Components;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
|
|
||||||
namespace Content.Server.Commands
|
namespace Content.Server.Commands
|
||||||
{
|
{
|
||||||
@@ -13,7 +15,7 @@ namespace Content.Server.Commands
|
|||||||
public string Command => "setanchor";
|
public string Command => "setanchor";
|
||||||
public string Description => "Sets the anchoring state of an entity.";
|
public string Description => "Sets the anchoring state of an entity.";
|
||||||
public string Help => "setanchor <entity id> <value (optional)>";
|
public string Help => "setanchor <entity id> <value (optional)>";
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length == 0 || args.Length > 2)
|
if (args.Length == 0 || args.Length > 2)
|
||||||
{
|
{
|
||||||
@@ -31,7 +33,7 @@ namespace Content.Server.Commands
|
|||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
if (!entityManager.TryGetEntity(entId, out var entity) || entity.Deleted || !entity.TryGetComponent(out PhysicsComponent? physics))
|
if (!entityManager.TryGetEntity(entId, out var entity) || entity.Deleted || !entity.TryGetComponent(out AnchorableComponent? anchorable))
|
||||||
{
|
{
|
||||||
shell.WriteLine("Invalid entity specified!");
|
shell.WriteLine("Invalid entity specified!");
|
||||||
return;
|
return;
|
||||||
@@ -45,11 +47,14 @@ namespace Content.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
physics.Anchored = value;
|
if (value)
|
||||||
|
await anchorable.TryAnchor(default, force: true);
|
||||||
|
else
|
||||||
|
await anchorable.TryUnAnchor(default, force: true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
physics.Anchored = !physics.Anchored;
|
await anchorable.TryToggleAnchor(default, force: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace Content.Server.Database
|
|||||||
.Preference
|
.Preference
|
||||||
.Include(p => p.Profiles).ThenInclude(h => h.Jobs)
|
.Include(p => p.Profiles).ThenInclude(h => h.Jobs)
|
||||||
.Include(p => p.Profiles).ThenInclude(h => h.Antags)
|
.Include(p => p.Profiles).ThenInclude(h => h.Antags)
|
||||||
|
.AsSingleQuery()
|
||||||
.SingleOrDefaultAsync(p => p.UserId == userId.UserId);
|
.SingleOrDefaultAsync(p => p.UserId == userId.UserId);
|
||||||
|
|
||||||
if (prefs is null) return null;
|
if (prefs is null) return null;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -20,6 +20,8 @@ namespace Content.Server.GameObjects.Components
|
|||||||
{
|
{
|
||||||
public override string Name => "Anchorable";
|
public override string Name => "Anchorable";
|
||||||
|
|
||||||
|
[ComponentDependency] private PhysicsComponent? _physicsComponent = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
[DataField("tool")]
|
[DataField("tool")]
|
||||||
public ToolQuality Tool { get; private set; } = ToolQuality.Anchoring;
|
public ToolQuality Tool { get; private set; } = ToolQuality.Anchoring;
|
||||||
@@ -31,6 +33,12 @@ namespace Content.Server.GameObjects.Components
|
|||||||
[DataField("snap")]
|
[DataField("snap")]
|
||||||
public bool Snap { get; private set; }
|
public bool Snap { get; private set; }
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
Owner.EnsureComponent<PhysicsComponent>(out _physicsComponent);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a tool can change the anchored status.
|
/// Checks if a tool can change the anchored status.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -38,14 +46,14 @@ namespace Content.Server.GameObjects.Components
|
|||||||
/// <param name="utilizing">The tool being used, can be null if forcing it</param>
|
/// <param name="utilizing">The tool being used, can be null if forcing it</param>
|
||||||
/// <param name="force">Whether or not to check if the tool is valid</param>
|
/// <param name="force">Whether or not to check if the tool is valid</param>
|
||||||
/// <returns>true if it is valid, false otherwise</returns>
|
/// <returns>true if it is valid, false otherwise</returns>
|
||||||
private async Task<bool> Valid(IEntity user, IEntity? utilizing, [NotNullWhen(true)] bool force = false)
|
private async Task<bool> Valid(IEntity? user, IEntity? utilizing, [NotNullWhen(true)] bool force = false)
|
||||||
{
|
{
|
||||||
if (!Owner.HasComponent<IPhysBody>())
|
if (!Owner.HasComponent<IPhysBody>())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force)
|
if (user != null && !force)
|
||||||
{
|
{
|
||||||
if (utilizing == null ||
|
if (utilizing == null ||
|
||||||
!utilizing.TryGetComponent(out ToolComponent? tool) ||
|
!utilizing.TryGetComponent(out ToolComponent? tool) ||
|
||||||
@@ -65,15 +73,17 @@ namespace Content.Server.GameObjects.Components
|
|||||||
/// <param name="utilizing">The tool being used, if any</param>
|
/// <param name="utilizing">The tool being used, if any</param>
|
||||||
/// <param name="force">Whether or not to ignore valid tool checks</param>
|
/// <param name="force">Whether or not to ignore valid tool checks</param>
|
||||||
/// <returns>true if anchored, false otherwise</returns>
|
/// <returns>true if anchored, false otherwise</returns>
|
||||||
public async Task<bool> TryAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
|
public async Task<bool> TryAnchor(IEntity? user, IEntity? utilizing = null, bool force = false)
|
||||||
{
|
{
|
||||||
if (!(await Valid(user, utilizing, force)))
|
if (!(await Valid(user, utilizing, force)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var physics = Owner.GetComponent<IPhysBody>();
|
if (_physicsComponent == null)
|
||||||
physics.BodyType = BodyType.Static;
|
return false;
|
||||||
|
|
||||||
|
_physicsComponent.BodyType = BodyType.Static;
|
||||||
|
|
||||||
// Snap rotation to cardinal (multiple of 90)
|
// Snap rotation to cardinal (multiple of 90)
|
||||||
var rot = Owner.Transform.LocalRotation;
|
var rot = Owner.Transform.LocalRotation;
|
||||||
@@ -100,15 +110,17 @@ namespace Content.Server.GameObjects.Components
|
|||||||
/// <param name="utilizing">The tool being used, if any</param>
|
/// <param name="utilizing">The tool being used, if any</param>
|
||||||
/// <param name="force">Whether or not to ignore valid tool checks</param>
|
/// <param name="force">Whether or not to ignore valid tool checks</param>
|
||||||
/// <returns>true if unanchored, false otherwise</returns>
|
/// <returns>true if unanchored, false otherwise</returns>
|
||||||
public async Task<bool> TryUnAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
|
public async Task<bool> TryUnAnchor(IEntity? user, IEntity? utilizing = null, bool force = false)
|
||||||
{
|
{
|
||||||
if (!(await Valid(user, utilizing, force)))
|
if (!(await Valid(user, utilizing, force)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var physics = Owner.GetComponent<IPhysBody>();
|
if (_physicsComponent == null)
|
||||||
physics.BodyType = BodyType.Dynamic;
|
return false;
|
||||||
|
|
||||||
|
_physicsComponent.BodyType = BodyType.Dynamic;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -120,24 +132,16 @@ namespace Content.Server.GameObjects.Components
|
|||||||
/// <param name="utilizing">The tool being used, if any</param>
|
/// <param name="utilizing">The tool being used, if any</param>
|
||||||
/// <param name="force">Whether or not to ignore valid tool checks</param>
|
/// <param name="force">Whether or not to ignore valid tool checks</param>
|
||||||
/// <returns>true if toggled, false otherwise</returns>
|
/// <returns>true if toggled, false otherwise</returns>
|
||||||
private async Task<bool> TryToggleAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
|
public async Task<bool> TryToggleAnchor(IEntity? user, IEntity? utilizing = null, bool force = false)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IPhysBody? physics))
|
if (_physicsComponent == null)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return physics.BodyType == BodyType.Static ?
|
return _physicsComponent.BodyType == BodyType.Static ?
|
||||||
await TryUnAnchor(user, utilizing, force) :
|
await TryUnAnchor(user, utilizing, force) :
|
||||||
await TryAnchor(user, utilizing, force);
|
await TryAnchor(user, utilizing, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
Owner.EnsureComponent<PhysicsComponent>();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
return await TryToggleAnchor(eventArgs.User, eventArgs.Using);
|
return await TryToggleAnchor(eventArgs.User, eventArgs.Using);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System.Linq;
|
||||||
using Content.Server.GameObjects.Components.NodeContainer;
|
using Content.Server.GameObjects.Components.NodeContainer;
|
||||||
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
@@ -81,13 +81,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_gasPort = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
_gasPort = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||||
if (_gasPort == null)
|
if (_gasPort == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
|
|
||||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||||
{
|
{
|
||||||
Logger.Error($"{typeof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{typeof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
|
|
||||||
if (_inletPipe == null || _filterOutletPipe == null || _outletPipe == null)
|
if (_inletPipe == null || _filterOutletPipe == null || _outletPipe == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,13 +85,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Pipe = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
Pipe = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||||
if (Pipe == null)
|
if (Pipe == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System.Linq;
|
||||||
using Content.Server.GameObjects.Components.NodeContainer;
|
using Content.Server.GameObjects.Components.NodeContainer;
|
||||||
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
@@ -52,13 +52,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_heaterPipe = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
_heaterPipe = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||||
if (_heaterPipe == null)
|
if (_heaterPipe == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
@@ -41,14 +39,14 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
|||||||
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
|
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
[DataField("initialInletDirection")]
|
[DataField("initialInletDirection", required: true)]
|
||||||
private PipeDirection _initialInletDirection = PipeDirection.None;
|
private PipeDirection _initialInletDirection = PipeDirection.None;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
|
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
[DataField("initialOutletDirection")]
|
[DataField("initialOutletDirection", required: true)]
|
||||||
private PipeDirection _initialOutletDirection = PipeDirection.None;
|
private PipeDirection _initialOutletDirection = PipeDirection.None;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
@@ -110,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
|||||||
|
|
||||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var pipeNodes = container.Nodes.OfType<PipeNode>();
|
var pipeNodes = container.Nodes.OfType<PipeNode>();
|
||||||
@@ -118,7 +116,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
|||||||
_outletPipe = pipeNodes.Where(pipe => pipe.PipeDirection == _initialOutletDirection).FirstOrDefault();
|
_outletPipe = pipeNodes.Where(pipe => pipe.PipeDirection == _initialOutletDirection).FirstOrDefault();
|
||||||
if (_inletPipe == null || _outletPipe == null)
|
if (_inletPipe == null || _outletPipe == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,13 +78,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
|||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_scrubberOutlet = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
_scrubberOutlet = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||||
if (_scrubberOutlet == null)
|
if (_scrubberOutlet == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,13 +78,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
|||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_ventInlet = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
_ventInlet = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||||
if (_ventInlet == null)
|
if (_ventInlet == null)
|
||||||
{
|
{
|
||||||
Logger.Error($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
Logger.Warning($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.Atmos;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -10,9 +11,10 @@ namespace Content.Server.GameObjects.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class AtmosPlaqueComponent : Component, IMapInit
|
public sealed class AtmosPlaqueComponent : Component, IMapInit
|
||||||
{
|
{
|
||||||
|
public override string Name => "AtmosPlaque";
|
||||||
|
|
||||||
[DataField("plaqueType")]
|
[DataField("plaqueType")]
|
||||||
private PlaqueType _type = PlaqueType.Unset;
|
private PlaqueType _type = PlaqueType.Unset;
|
||||||
public override string Name => "AtmosPlaque";
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public PlaqueType Type
|
public PlaqueType Type
|
||||||
@@ -82,11 +84,11 @@ namespace Content.Server.GameObjects.Components
|
|||||||
_ => "Uhm",
|
_ => "Uhm",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out SpriteComponent? sprite))
|
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
var state = _type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque";
|
var state = _type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque";
|
||||||
|
|
||||||
sprite.LayerSetState(0, state);
|
appearance.SetData(AtmosPlaqueVisuals.State, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.Botany;
|
using Content.Server.Botany;
|
||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
@@ -16,8 +16,6 @@ namespace Content.Server.GameObjects.Components.Botany
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class ProduceComponent : Component, ISerializationHooks
|
public class ProduceComponent : Component, ISerializationHooks
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Produce";
|
public override string Name => "Produce";
|
||||||
|
|
||||||
[DataField("seed")]
|
[DataField("seed")]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.Botany;
|
using Content.Server.Botany;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -15,8 +15,6 @@ namespace Content.Server.GameObjects.Components.Botany
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class SeedComponent : Component, IExamine
|
public class SeedComponent : Component, IExamine
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Seed";
|
public override string Name => "Seed";
|
||||||
|
|
||||||
[DataField("seed")]
|
[DataField("seed")]
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class PillComponent : FoodComponent, IUse, IAfterInteract
|
public class PillComponent : FoodComponent, IUse, IAfterInteract
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
|
|
||||||
|
|
||||||
public override string Name => "Pill";
|
public override string Name => "Pill";
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ using Robust.Shared.Localization;
|
|||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -461,7 +460,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(_graphIdentifier))
|
if (string.IsNullOrEmpty(_graphIdentifier))
|
||||||
{
|
{
|
||||||
Logger.Error($"Prototype {Owner.Prototype?.ID}'s construction component didn't have a graph identifier!");
|
Logger.Warning($"Prototype {Owner.Prototype?.ID}'s construction component didn't have a graph identifier!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
|
|
||||||
public override string Name => "WelderRefinable";
|
public override string Name => "WelderRefinable";
|
||||||
|
|
||||||
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
// check if object is welder
|
// check if object is welder
|
||||||
if (!eventArgs.Using.TryGetComponent(out ToolComponent? tool))
|
if (!eventArgs.Using.TryGetComponent(out ToolComponent? tool))
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalTaggerComponent;
|
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalTaggerComponent;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Disposal
|
namespace Content.Server.GameObjects.Components.Disposal
|
||||||
{
|
{
|
||||||
@@ -32,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Anchored =>
|
public bool Anchored =>
|
||||||
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
|
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
|
||||||
physics.Anchored;
|
physics.BodyType == BodyType.Static;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using Robust.Shared.Serialization;
|
|||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Disposal
|
namespace Content.Server.GameObjects.Components.Disposal
|
||||||
{
|
{
|
||||||
@@ -43,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool Anchored =>
|
private bool Anchored =>
|
||||||
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
|
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
|
||||||
physics.Anchored;
|
physics.BodyType == BodyType.Static;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The directions that this tube can connect to others from
|
/// The directions that this tube can connect to others from
|
||||||
@@ -196,7 +197,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (physics.Anchored)
|
if (physics.BodyType == BodyType.Static)
|
||||||
{
|
{
|
||||||
OnAnchor();
|
OnAnchor();
|
||||||
}
|
}
|
||||||
@@ -230,7 +231,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
if (!Owner.EnsureComponent<PhysicsComponent>().Anchored)
|
Owner.EnsureComponent<PhysicsComponent>(out var physicsComponent);
|
||||||
|
if (physicsComponent.BodyType != BodyType.Static)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
/// Delay from trying to shove someone else into disposals.
|
/// Delay from trying to shove someone else into disposals.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
private float _draggedEntryDelay;
|
private float _draggedEntryDelay = 0.5f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Token used to cancel the automatic engage of a disposal unit
|
/// Token used to cancel the automatic engage of a disposal unit
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ namespace Content.Server.GameObjects.Components.Items.RCD
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcdComponent.maxAmmo - rcdComponent._ammo < refillAmmo)
|
if (rcdComponent.MaxAmmo - rcdComponent._ammo < refillAmmo)
|
||||||
{
|
{
|
||||||
rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("The RCD is full!"));
|
rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("The RCD is full!"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
rcdComponent._ammo = Math.Min(rcdComponent.maxAmmo, rcdComponent._ammo + refillAmmo);
|
rcdComponent._ammo = Math.Min(rcdComponent.MaxAmmo, rcdComponent._ammo + refillAmmo);
|
||||||
rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("You refill the RCD."));
|
rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("You refill the RCD."));
|
||||||
|
|
||||||
//Deleting a held item causes a lot of errors
|
//Deleting a held item causes a lot of errors
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ namespace Content.Server.GameObjects.Components.Items.RCD
|
|||||||
public override string Name => "RCD";
|
public override string Name => "RCD";
|
||||||
private RcdMode _mode = 0; //What mode are we on? Can be floors, walls, deconstruct.
|
private RcdMode _mode = 0; //What mode are we on? Can be floors, walls, deconstruct.
|
||||||
private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode));
|
private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode));
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("maxAmmo")] public int maxAmmo = 5;
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("maxAmmo")] public int MaxAmmo = 5;
|
||||||
public int _ammo; //How much "ammo" we have left. You can refill this with RCD ammo.
|
public int _ammo; //How much "ammo" we have left. You can refill this with RCD ammo.
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("delay")] private float _delay = 2f;
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("delay")] private float _delay = 2f;
|
||||||
private DoAfterSystem doAfterSystem = default!;
|
private DoAfterSystem _doAfterSystem = default!;
|
||||||
|
|
||||||
///Enum to store the different mode states for clarity.
|
///Enum to store the different mode states for clarity.
|
||||||
private enum RcdMode
|
private enum RcdMode
|
||||||
@@ -48,8 +48,8 @@ namespace Content.Server.GameObjects.Components.Items.RCD
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_ammo = maxAmmo;
|
_ammo = MaxAmmo;
|
||||||
doAfterSystem = EntitySystem.Get<DoAfterSystem>();
|
_doAfterSystem = EntitySystem.Get<DoAfterSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
@@ -113,7 +113,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD
|
|||||||
ExtraCheck = () => IsRCDStillValid(eventArgs, mapGrid, tile, snapPos, startingMode) //All of the sanity checks are here
|
ExtraCheck = () => IsRCDStillValid(eventArgs, mapGrid, tile, snapPos, startingMode) //All of the sanity checks are here
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await doAfterSystem.DoAfter(doAfterEventArgs);
|
var result = await _doAfterSystem.DoAfter(doAfterEventArgs);
|
||||||
if (result == DoAfterStatus.Cancelled)
|
if (result == DoAfterStatus.Cancelled)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -139,7 +139,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD
|
|||||||
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, thus we early return to avoid the tile set code.
|
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, thus we early return to avoid the tile set code.
|
||||||
case RcdMode.Walls:
|
case RcdMode.Walls:
|
||||||
var ent = _serverEntityManager.SpawnEntity("solid_wall", mapGrid.GridTileToLocal(snapPos));
|
var ent = _serverEntityManager.SpawnEntity("solid_wall", mapGrid.GridTileToLocal(snapPos));
|
||||||
ent.Transform.LocalRotation = Angle.South; // Walls always need to point south.
|
ent.Transform.LocalRotation = Angle.Zero; // Walls always need to point south.
|
||||||
break;
|
break;
|
||||||
case RcdMode.Airlock:
|
case RcdMode.Airlock:
|
||||||
var airlock = _serverEntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos));
|
var airlock = _serverEntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos));
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
#region YAMLSERIALIZE
|
#region YAMLSERIALIZE
|
||||||
[DataField("cookTime")]
|
[DataField("cookTime")]
|
||||||
private int _cookTimeDefault = 5;
|
private uint _cookTimeDefault = 5;
|
||||||
[DataField("cookTimeMultiplier")]
|
[DataField("cookTimeMultiplier")]
|
||||||
private int _cookTimeMultiplier = 1000; //For upgrades and stuff I guess?
|
private int _cookTimeMultiplier = 1000; //For upgrades and stuff I guess?
|
||||||
[DataField("failureResult")]
|
[DataField("failureResult")]
|
||||||
@@ -78,6 +78,8 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
|
_currentCookTimerTime = _cookTimeDefault;
|
||||||
|
|
||||||
Owner.EnsureComponent<SolutionContainerComponent>();
|
Owner.EnsureComponent<SolutionContainerComponent>();
|
||||||
|
|
||||||
_storage = ContainerHelpers.EnsureContainer<Container>(Owner, "microwave_entity_container", out var existed);
|
_storage = ContainerHelpers.EnsureContainer<Container>(Owner, "microwave_entity_container", out var existed);
|
||||||
@@ -99,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
switch (message.Message)
|
switch (message.Message)
|
||||||
{
|
{
|
||||||
case MicrowaveStartCookMessage msg :
|
case MicrowaveStartCookMessage msg :
|
||||||
wzhzhzh();
|
Wzhzhzh();
|
||||||
break;
|
break;
|
||||||
case MicrowaveEjectMessage msg :
|
case MicrowaveEjectMessage msg :
|
||||||
if (_hasContents)
|
if (_hasContents)
|
||||||
@@ -251,7 +253,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
// ReSharper disable once IdentifierTypo
|
// ReSharper disable once IdentifierTypo
|
||||||
private void wzhzhzh()
|
private void Wzhzhzh()
|
||||||
{
|
{
|
||||||
if (!_hasContents)
|
if (!_hasContents)
|
||||||
{
|
{
|
||||||
@@ -500,7 +502,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
_currentCookTimerTime = 10;
|
_currentCookTimerTime = 10;
|
||||||
ClickSound();
|
ClickSound();
|
||||||
_uiDirty = true;
|
_uiDirty = true;
|
||||||
wzhzhzh();
|
Wzhzhzh();
|
||||||
return SuicideKind.Heat;
|
return SuicideKind.Heat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
using Content.Shared.GameObjects.Components.MachineLinking;
|
||||||
|
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||||
using Content.Shared.GameObjects.Verbs;
|
using Content.Shared.GameObjects.Verbs;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.MachineLinking
|
namespace Content.Server.GameObjects.Components.MachineLinking
|
||||||
@@ -56,9 +55,9 @@ namespace Content.Server.GameObjects.Components.MachineLinking
|
|||||||
|
|
||||||
private void UpdateSprite()
|
private void UpdateSprite()
|
||||||
{
|
{
|
||||||
if (Owner.TryGetComponent<SpriteComponent>(out var sprite))
|
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
sprite.LayerSetState(0, _on ? "on" : "off");
|
appearance.SetData(SignalSwitchVisuals.On, _on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
public class ConditionalSpawnerComponent : Component, IMapInit
|
public class ConditionalSpawnerComponent : Component, IMapInit
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
||||||
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
public override string Name => "ConditionalSpawner";
|
public override string Name => "ConditionalSpawner";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -27,8 +27,6 @@ namespace Content.Server.GameObjects.Components.Metabolism
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class MetabolismComponent : Component
|
public class MetabolismComponent : Component
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
|
|
||||||
[ComponentDependency] private readonly IBody? _body = default!;
|
[ComponentDependency] private readonly IBody? _body = default!;
|
||||||
|
|
||||||
public override string Name => "Metabolism";
|
public override string Name => "Metabolism";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Threading.Tasks;
|
|||||||
using Content.Server.GameObjects.Components.Weapon.Melee;
|
using Content.Server.GameObjects.Components.Weapon.Melee;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.GameObjects.Components.Damage;
|
using Content.Shared.GameObjects.Components.Damage;
|
||||||
|
using Content.Shared.GameObjects.Components.Mining;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
@@ -24,8 +25,10 @@ namespace Content.Server.GameObjects.Components.Mining
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
var spriteComponent = Owner.EnsureComponent<SpriteComponent>();
|
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||||
spriteComponent.LayerSetState(0, _random.Pick(SpriteStates));
|
{
|
||||||
|
appearance.SetData(AsteroidRockVisuals.State, _random.Pick(SpriteStates));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
@@ -22,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
[ComponentReference(typeof(SharedStunnableComponent))]
|
[ComponentReference(typeof(SharedStunnableComponent))]
|
||||||
public class StunnableComponent : SharedStunnableComponent, IDisarmedAct
|
public class StunnableComponent : SharedStunnableComponent, IDisarmedAct
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
||||||
|
|
||||||
protected override void OnKnockdown()
|
protected override void OnKnockdown()
|
||||||
{
|
{
|
||||||
EntitySystem.Get<StandingStateSystem>().Down(Owner);
|
EntitySystem.Get<StandingStateSystem>().Down(Owner);
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
[ComponentReference(typeof(IAfterInteract))]
|
[ComponentReference(typeof(IAfterInteract))]
|
||||||
public class FoodComponent : Component, IUse, IAfterInteract
|
public class FoodComponent : Component, IUse, IAfterInteract
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
|
|
||||||
|
|
||||||
public override string Name => "Food";
|
public override string Name => "Food";
|
||||||
|
|
||||||
[ViewVariables] [DataField("useSound")] protected virtual string? UseSound { get; set; } = "/Audio/Items/eatfood.ogg";
|
[ViewVariables] [DataField("useSound")] protected virtual string? UseSound { get; set; } = "/Audio/Items/eatfood.ogg";
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Content.Server.GameObjects.Components.PA
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Power receiver for the control console itself.
|
/// Power receiver for the control console itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables] private PowerReceiverComponent? _powerReceiverComponent;
|
[ViewVariables] private PowerReceiverComponent _powerReceiverComponent = default!;
|
||||||
|
|
||||||
[ViewVariables] private ParticleAcceleratorFuelChamberComponent? _partFuelChamber;
|
[ViewVariables] private ParticleAcceleratorFuelChamberComponent? _partFuelChamber;
|
||||||
[ViewVariables] private ParticleAcceleratorEndCapComponent? _partEndCap;
|
[ViewVariables] private ParticleAcceleratorEndCapComponent? _partEndCap;
|
||||||
@@ -104,12 +104,9 @@ namespace Content.Server.GameObjects.Components.PA
|
|||||||
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Owner.TryGetComponent(out _powerReceiverComponent))
|
Owner.EnsureComponent(out _powerReceiverComponent);
|
||||||
{
|
|
||||||
Logger.Error("ParticleAcceleratorControlBox was created without PowerReceiverComponent");
|
_powerReceiverComponent!.Load = 250;
|
||||||
return;
|
|
||||||
}
|
|
||||||
_powerReceiverComponent.Load = 250;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ namespace Content.Server.GameObjects.Components.PA
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
// FIXME: this has to be an entity system, full stop.
|
// FIXME: this has to be an entity system, full stop.
|
||||||
|
|
||||||
if (!Owner.TryGetComponent(out SnapGrid))
|
Owner.EnsureComponent<SnapGridComponent>(out SnapGrid);
|
||||||
{
|
|
||||||
Logger.Error("ParticleAcceleratorControlBox was created without SnapGridComponent");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.Components.Power.PowerNetComponents;
|
using Content.Server.GameObjects.Components.Power.PowerNetComponents;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.PA
|
namespace Content.Server.GameObjects.Components.PA
|
||||||
@@ -16,13 +15,9 @@ namespace Content.Server.GameObjects.Components.PA
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
if (Owner.TryGetComponent(out PowerConsumerComponent))
|
|
||||||
{
|
|
||||||
PowerConsumerComponent.OnReceivedPowerChanged += PowerReceivedChanged;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Error($"ParticleAcceleratorPowerBoxComponent Component initialized without PowerConsumerComponent.");
|
PowerConsumerComponent = Owner.EnsureComponentWarn<PowerConsumerComponent>();
|
||||||
|
PowerConsumerComponent.OnReceivedPowerChanged += PowerReceivedChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PowerReceivedChanged(object? sender, ReceivedPowerChangedEventArgs e)
|
private void PowerReceivedChanged(object? sender, ReceivedPowerChangedEventArgs e)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Power.PowerNetComponents
|
namespace Content.Server.GameObjects.Components.Power.PowerNetComponents
|
||||||
@@ -37,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Power.PowerNetComponents
|
|||||||
|
|
||||||
private void OnAnchoredChanged()
|
private void OnAnchoredChanged()
|
||||||
{
|
{
|
||||||
if(_collidableComponent != null && _collidableComponent.Anchored)
|
if(_collidableComponent != null && _collidableComponent.BodyType == BodyType.Static)
|
||||||
Owner.SnapToGrid();
|
Owner.SnapToGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class ContainmentFieldGeneratorComponent : Component, IStartCollide
|
public class ContainmentFieldGeneratorComponent : Component, IStartCollide
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPhysicsManager _physicsManager = null!;
|
|
||||||
|
|
||||||
public override string Name => "ContainmentFieldGenerator";
|
public override string Name => "ContainmentFieldGenerator";
|
||||||
|
|
||||||
private int _powerBuffer;
|
private int _powerBuffer;
|
||||||
@@ -84,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
|
|
||||||
private void OnAnchoredChanged()
|
private void OnAnchoredChanged()
|
||||||
{
|
{
|
||||||
if(_collidableComponent?.Anchored != true)
|
if(_collidableComponent?.BodyType != BodyType.Static)
|
||||||
{
|
{
|
||||||
_connection1?.Item2.Dispose();
|
_connection1?.Item2.Dispose();
|
||||||
_connection2?.Item2.Dispose();
|
_connection2?.Item2.Dispose();
|
||||||
@@ -106,7 +104,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
private bool TryGenerateFieldConnection([NotNullWhen(true)] ref Tuple<Direction, ContainmentFieldConnection>? propertyFieldTuple)
|
private bool TryGenerateFieldConnection([NotNullWhen(true)] ref Tuple<Direction, ContainmentFieldConnection>? propertyFieldTuple)
|
||||||
{
|
{
|
||||||
if (propertyFieldTuple != null) return false;
|
if (propertyFieldTuple != null) return false;
|
||||||
if(_collidableComponent?.Anchored == false) return false;
|
if(_collidableComponent?.BodyType != BodyType.Static) return false;
|
||||||
|
|
||||||
foreach (var direction in new[] {Direction.North, Direction.East, Direction.South, Direction.West})
|
foreach (var direction in new[] {Direction.North, Direction.East, Direction.South, Direction.West})
|
||||||
{
|
{
|
||||||
@@ -135,7 +133,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
!fieldGeneratorComponent.HasFreeConnections() ||
|
!fieldGeneratorComponent.HasFreeConnections() ||
|
||||||
IsConnectedWith(fieldGeneratorComponent) ||
|
IsConnectedWith(fieldGeneratorComponent) ||
|
||||||
!ent.TryGetComponent<PhysicsComponent>(out var collidableComponent) ||
|
!ent.TryGetComponent<PhysicsComponent>(out var collidableComponent) ||
|
||||||
!collidableComponent.Anchored)
|
collidableComponent.BodyType != BodyType.Static)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -70,11 +71,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
if (!Owner.TryGetComponent(out _powerConsumer!))
|
Owner.EnsureComponent<PowerConsumerComponent>(out _powerConsumer);
|
||||||
{
|
|
||||||
Logger.Error($"EmitterComponent {Owner} created with no PowerConsumerComponent");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_powerConsumer.OnReceivedPowerChanged += OnReceivedPowerChanged;
|
_powerConsumer.OnReceivedPowerChanged += OnReceivedPowerChanged;
|
||||||
}
|
}
|
||||||
@@ -104,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out PhysicsComponent? phys) && phys.Anchored)
|
if (Owner.TryGetComponent(out PhysicsComponent? phys) && phys.BodyType == BodyType.Static)
|
||||||
{
|
{
|
||||||
if (!_isOn)
|
if (!_isOn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.GameObjects.Components.StationEvents;
|
using Content.Server.GameObjects.Components.StationEvents;
|
||||||
|
using Content.Shared.GameObjects.Components.Singularity;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Collision;
|
using Robust.Shared.Physics.Collision;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Content.Shared.GameObjects.Components.Singularity;
|
|
||||||
using Robust.Shared.Physics.Collision.Shapes;
|
using Robust.Shared.Physics.Collision.Shapes;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Singularity
|
namespace Content.Server.GameObjects.Components.Singularity
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
@@ -62,8 +60,10 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
|
|
||||||
if(_radiationPulseComponent != null) _radiationPulseComponent.RadsPerSecond = 10 * value;
|
if(_radiationPulseComponent != null) _radiationPulseComponent.RadsPerSecond = 10 * value;
|
||||||
|
|
||||||
_spriteComponent?.LayerSetRSI(0, "Constructible/Power/Singularity/singularity_" + _level + ".rsi");
|
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||||
_spriteComponent?.LayerSetState(0, "singularity_" + _level);
|
{
|
||||||
|
appearance.SetData(SingularityVisuals.Level, _level);
|
||||||
|
}
|
||||||
|
|
||||||
if (_collidableComponent != null && _collidableComponent.Fixtures.Any() && _collidableComponent.Fixtures[0].Shape is PhysShapeCircle circle)
|
if (_collidableComponent != null && _collidableComponent.Fixtures.Any() && _collidableComponent.Fixtures[0].Shape is PhysShapeCircle circle)
|
||||||
{
|
{
|
||||||
@@ -87,9 +87,9 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
|
|
||||||
private PhysicsComponent? _collidableComponent;
|
private PhysicsComponent _collidableComponent = default!;
|
||||||
private SpriteComponent? _spriteComponent;
|
private RadiationPulseComponent _radiationPulseComponent = default!;
|
||||||
private RadiationPulseComponent? _radiationPulseComponent;
|
private SpriteComponent _spriteComponent = default!;
|
||||||
private IPlayingAudioStream? _playingSound;
|
private IPlayingAudioStream? _playingSound;
|
||||||
|
|
||||||
public override ComponentState GetComponentState(ICommonSession player)
|
public override ComponentState GetComponentState(ICommonSession player)
|
||||||
@@ -101,6 +101,10 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
|
Owner.EnsureComponent(out _radiationPulseComponent);
|
||||||
|
Owner.EnsureComponent(out _collidableComponent);
|
||||||
|
Owner.EnsureComponent(out _spriteComponent);
|
||||||
|
|
||||||
var audioParams = AudioParams.Default;
|
var audioParams = AudioParams.Default;
|
||||||
audioParams.Loop = true;
|
audioParams.Loop = true;
|
||||||
audioParams.MaxDistance = 20f;
|
audioParams.MaxDistance = 20f;
|
||||||
@@ -108,14 +112,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity_form.ogg", Owner);
|
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity_form.ogg", Owner);
|
||||||
Timer.Spawn(5200,() => _playingSound = SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity.ogg", Owner, audioParams));
|
Timer.Spawn(5200,() => _playingSound = SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity.ogg", Owner, audioParams));
|
||||||
|
|
||||||
if (!Owner.TryGetComponent(out _spriteComponent))
|
_collidableComponent!.Hard = false;
|
||||||
Logger.Error("SingularityComponent was spawned without SpriteComponent");
|
|
||||||
if (!Owner.TryGetComponent(out _radiationPulseComponent))
|
|
||||||
Logger.Error("SingularityComponent was spawned without RadiationPulseComponent");
|
|
||||||
if (!Owner.TryGetComponent(out _collidableComponent))
|
|
||||||
Logger.Error("SingularityComponent was spawned without CollidableComponent!");
|
|
||||||
else
|
|
||||||
_collidableComponent.Hard = false;
|
|
||||||
Level = 1;
|
Level = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class MeleeWeaponComponent : Component, IAttack, IHandSelected
|
public class MeleeWeaponComponent : Component, IAttack, IHandSelected
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
|
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
public override string Name => "MeleeWeapon";
|
public override string Name => "MeleeWeapon";
|
||||||
|
|||||||
@@ -423,6 +423,11 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PathfindingRegion? GetRegion(IEntity entity)
|
public PathfindingRegion? GetRegion(IEntity entity)
|
||||||
{
|
{
|
||||||
|
if (!entity.Transform.GridID.IsValid())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates);
|
var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates);
|
||||||
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
||||||
return GetRegion(entityNode);
|
return GetRegion(entityNode);
|
||||||
|
|||||||
@@ -245,7 +245,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
private SteeringStatus Steer(IEntity entity, IAiSteeringRequest steeringRequest, float frameTime)
|
private SteeringStatus Steer(IEntity entity, IAiSteeringRequest steeringRequest, float frameTime)
|
||||||
{
|
{
|
||||||
// Main optimisation to be done below is the redundant calls and adding more variables
|
// Main optimisation to be done below is the redundant calls and adding more variables
|
||||||
if (entity.Deleted || !entity.TryGetComponent(out AiControllerComponent? controller) || !ActionBlockerSystem.CanMove(entity))
|
if (entity.Deleted ||
|
||||||
|
!entity.TryGetComponent(out AiControllerComponent? controller) ||
|
||||||
|
!ActionBlockerSystem.CanMove(entity) ||
|
||||||
|
!entity.Transform.GridID.IsValid())
|
||||||
{
|
{
|
||||||
return SteeringStatus.NoPath;
|
return SteeringStatus.NoPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.GameObjects.Components.Atmos
|
||||||
|
{
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum AtmosPlaqueVisuals
|
||||||
|
{
|
||||||
|
State
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.GameObjects.Components.MachineLinking
|
||||||
|
{
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum SignalSwitchVisuals
|
||||||
|
{
|
||||||
|
On
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.GameObjects.Components.Mining
|
||||||
|
{
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum AsteroidRockVisuals
|
||||||
|
{
|
||||||
|
State
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,11 +92,6 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
Owner.EnsureComponentWarn<SharedPlayerInputMoverComponent>();
|
Owner.EnsureComponentWarn<SharedPlayerInputMoverComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out IPhysBody? body) && body.BodyType != BodyType.KinematicController)
|
|
||||||
{
|
|
||||||
Logger.WarningS("mover", $"Attached {nameof(SharedPlayerMobMoverComponent)} to a mob that's BodyType is not KinematicController!'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ComponentState GetComponentState(ICommonSession session)
|
public override ComponentState GetComponentState(ICommonSession session)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace Content.Shared.GameObjects.Components
|
|||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
if (!_prototypeManager.HasIndex<StackPrototype>(StackTypeId))
|
if (StackTypeId != string.Empty && !_prototypeManager.HasIndex<StackPrototype>(StackTypeId))
|
||||||
{
|
{
|
||||||
Logger.Error($"No {nameof(StackPrototype)} found with id {StackTypeId} for {Owner.Prototype?.ID ?? Owner.Name}");
|
Logger.Error($"No {nameof(StackPrototype)} found with id {StackTypeId} for {Owner.Prototype?.ID ?? Owner.Name}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.GameObjects.Components.Singularity
|
||||||
|
{
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum SingularityVisuals
|
||||||
|
{
|
||||||
|
Level
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -19,7 +19,7 @@ namespace Content.Shared.Maps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
|
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TileRef GetTileRef(this Vector2i Vector2i, GridId gridId, IMapManager? mapManager = null)
|
public static TileRef GetTileRef(this Vector2i vector2i, GridId gridId, IMapManager? mapManager = null)
|
||||||
{
|
{
|
||||||
if (!gridId.IsValid())
|
if (!gridId.IsValid())
|
||||||
return default;
|
return default;
|
||||||
@@ -29,7 +29,7 @@ namespace Content.Shared.Maps
|
|||||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
if (!grid.TryGetTileRef(Vector2i, out var tile))
|
if (!grid.TryGetTileRef(vector2i, out var tile))
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
return tile;
|
return tile;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
- type: PipeConnectorVisualizer
|
- type: PipeConnectorVisualizer
|
||||||
- type: PumpVisualizer
|
- type: PumpVisualizer
|
||||||
- type: PipeNetDevice
|
- type: PipeNetDevice
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: PumpBase
|
parent: PumpBase
|
||||||
id: DebugPressurePump
|
id: DebugPressurePump
|
||||||
@@ -46,5 +46,5 @@
|
|||||||
nodeGroupID: Pipe
|
nodeGroupID: Pipe
|
||||||
pipeDirection: South
|
pipeDirection: South
|
||||||
- type: PressurePump
|
- type: PressurePump
|
||||||
inletDirection: North
|
initialInletDirection: North
|
||||||
outletDirection: South
|
initialOutletDirection: South
|
||||||
|
|||||||
@@ -26,3 +26,6 @@
|
|||||||
sprite: Constructible/Power/Singularity/singularity_1.rsi
|
sprite: Constructible/Power/Singularity/singularity_1.rsi
|
||||||
state: singularity_1
|
state: singularity_1
|
||||||
drawdepth: Items
|
drawdepth: Items
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: SingularityVisualizer
|
||||||
|
|||||||
@@ -8,4 +8,4 @@
|
|||||||
- type: StorageVisualizer
|
- type: StorageVisualizer
|
||||||
state: qm
|
state: qm
|
||||||
- type: AccessReader
|
- type: AccessReader
|
||||||
access: [["Quartermaster"]]
|
access: [["Cargo"]] # TODO access [["Quartermaster"]]
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
- type: StorageVisualizer
|
- type: StorageVisualizer
|
||||||
state: warden
|
state: warden
|
||||||
- type: AccessReader
|
- type: AccessReader
|
||||||
access: [["Brig"]]
|
access: [["Security"]] # TODO access [["Brig"]]
|
||||||
|
|
||||||
# Security Officer
|
# Security Officer
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -48,4 +48,4 @@
|
|||||||
- type: StorageVisualizer
|
- type: StorageVisualizer
|
||||||
state: cabinet
|
state: cabinet
|
||||||
- type: AccessReader
|
- type: AccessReader
|
||||||
access: [["Detective"]]
|
access: [["Service"]] # TODO access [["Detective"]]
|
||||||
|
|||||||
@@ -22,3 +22,6 @@
|
|||||||
- type: Occluder
|
- type: Occluder
|
||||||
sizeX: 32
|
sizeX: 32
|
||||||
sizeY: 32
|
sizeY: 32
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: AsteroidRockVisualizer
|
||||||
|
|||||||
@@ -209,6 +209,7 @@
|
|||||||
- type: DamageStateVisualizer
|
- type: DamageStateVisualizer
|
||||||
normal: 0
|
normal: 0
|
||||||
dead: dead
|
dead: dead
|
||||||
|
- type: AsteroidRockVisualizer
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: goat
|
name: goat
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
- type: stack
|
- type: stack
|
||||||
id: Banananium
|
id: Bananium
|
||||||
name: banananium
|
name: bananium
|
||||||
icon: /Textures/Objects/Materials/materials.rsi/bananium.png
|
icon: /Textures/Objects/Materials/materials.rsi/bananium.png
|
||||||
spawn: MaterialBanananium1
|
spawn: MaterialBananium1
|
||||||
|
|
||||||
- type: stack
|
- type: stack
|
||||||
id: Diamond
|
id: Diamond
|
||||||
|
|||||||
Reference in New Issue
Block a user