Skip to content

Commit

Permalink
Merge branch 'master' into Carrying_system
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian16199 authored Oct 22, 2023
2 parents 53a64d3 + 43f4441 commit bed1112
Show file tree
Hide file tree
Showing 128 changed files with 232,711 additions and 371 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Linq;
using System.Numerics;
using Content.Client.Nyanotrasen.UserInterface;
using Robust.Client.AutoGenerated;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Content.Client.Nyanotrasen.UserInterface.CustomControls;

namespace Content.Client.Nyanotrasen.CartridgeLoader.Cartridges;

Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Nyanotrasen/UserInterface/GlimmerGraph.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Numerics;
using Robust.Client.UserInterface;
using Content.Client.Resources;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Content.Client.Resources;
using Robust.Client.UserInterface;

namespace Content.Client.Nyanotrasen.UserInterface.CustomControls;
namespace Content.Client.Nyanotrasen.UserInterface;

public sealed class GlimmerGraph : Control
{
Expand Down
72 changes: 72 additions & 0 deletions Content.IntegrationTests/Tests/Nyanotrasen/Oracle/OracleTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#nullable enable
using NUnit.Framework;
using System.Threading.Tasks;
using Content.Shared.Item;
using Content.Shared.Mobs.Components;
using Content.Server.Research.Oracle;
using Content.Shared.Chemistry.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;


/// <summary>
/// The oracle's request pool is huge.
/// We need to test everything that the oracle could request can be turned in.
/// </summary>
namespace Content.IntegrationTests.Tests.Oracle
{
[TestFixture]
[TestOf(typeof(OracleSystem))]
public sealed class OracleTest
{
[Test]
public async Task AllOracleItemsCanBeTurnedIn()
{
await using var pairTracker = await PoolManager.GetServerClient();
var server = pairTracker.Server;
// Per RobustIntegrationTest.cs, wait until state is settled to access it.
await server.WaitIdleAsync();

var mapManager = server.ResolveDependency<IMapManager>();
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();

var oracleSystem = entitySystemManager.GetEntitySystem<OracleSystem>();
var oracleComponent = new OracleComponent();

var testMap = await pairTracker.CreateTestMap();

await server.WaitAssertion(() =>
{
var allProtos = oracleSystem.GetAllProtos(oracleComponent);
var coordinates = testMap.GridCoords;

Assert.That((allProtos.Count > 0), "Oracle has no valid prototypes!");

foreach (var proto in allProtos)
{
var spawned = entityManager.SpawnEntity(proto, coordinates);

Assert.That(entityManager.HasComponent<ItemComponent>(spawned),
$"Oracle can request non-item {proto}");

Assert.That(!entityManager.HasComponent<SolutionTransferComponent>(spawned),
$"Oracle can request reagent container {proto} that will conflict with the fountain");

Assert.That(!entityManager.HasComponent<MobStateComponent>(spawned),
$"Oracle can request mob {proto} that could potentially have a player-set name.");
}

// Because Server/Client pairs can be re-used between Tests, we
// need to clean up anything that might affect other tests,
// otherwise this pair cannot be considered clean, and the
// CleanReturnAsync call would need to be removed.
mapManager.DeleteMap(testMap.MapId);
});

await pairTracker.CleanReturnAsync();
}
}
}
3 changes: 2 additions & 1 deletion Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public sealed class PostMapInitTest
"Kettle",
"MeteorArena",
"Pebble", //DeltaV
"Edge" //DeltaV
"Edge", //DeltaV
"Tortuga" //DeltaV
};

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions Content.Server/DeltaV/NPC/Roboisseur/RoboisseurComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ public sealed partial class RoboisseurComponent : Component
[DataField("barkTime")]
public TimeSpan BarkTime = TimeSpan.FromMinutes(1);

/// <summary>
/// Antispam.
/// </summary>
public TimeSpan StateTime = default!;

[DataField("stateCD")]
public TimeSpan StateCD = TimeSpan.FromSeconds(5);

[ViewVariables(VVAccess.ReadWrite)]
public EntityPrototype DesiredPrototype = default!;

Expand Down
8 changes: 7 additions & 1 deletion Content.Server/DeltaV/NPC/Roboisseur/RoboisseurSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Shared.Kitchen;
using Robust.Server.GameObjects;
using Content.Server.Materials;
using Robust.Shared.Timing;

namespace Content.Server.Roboisseur.Roboisseur
{
Expand All @@ -17,7 +18,7 @@ public sealed partial class RoboisseurSystem : EntitySystem
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly MaterialStorageSystem _material = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;

[Dependency] private readonly IGameTiming _timing = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -88,6 +89,11 @@ private void OnInteractHand(EntityUid uid, RoboisseurComponent component, Intera
if (!TryComp<ActorComponent>(args.User, out var actor))
return;

if (_timing.CurTime < component.StateTime) // Literally stolen from the sophie code
return;

component.StateTime = _timing.CurTime + component.StateCD;

string message = Loc.GetString(_random.Pick(component.DemandMessages), ("item", component.DesiredPrototype.Name));
if (CheckTier(component.DesiredPrototype.ID, component) > 1)
message = Loc.GetString(_random.Pick(component.DemandMessagesTier2), ("item", component.DesiredPrototype.Name));
Expand Down
79 changes: 79 additions & 0 deletions Content.Server/Nyanotrasen/Research/Oracle/OracleComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Robust.Shared.Prototypes;

namespace Content.Server.Research.Oracle;

[RegisterComponent]
public sealed partial class OracleComponent : Component
{
public const string SolutionName = "fountain";

[ViewVariables]
[DataField("accumulator")]
public float Accumulator;

[ViewVariables]
[DataField("resetTime")]
public TimeSpan ResetTime = TimeSpan.FromMinutes(10);

[DataField("barkAccumulator")]
public float BarkAccumulator;

[DataField("barkTime")]
public TimeSpan BarkTime = TimeSpan.FromMinutes(1);

[ViewVariables(VVAccess.ReadWrite)]
public EntityPrototype DesiredPrototype = default!;

[ViewVariables(VVAccess.ReadWrite)]
public EntityPrototype? LastDesiredPrototype = default!;

[DataField("rewardReagents")]
public static IReadOnlyList<string> RewardReagents = new[]
{
"LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "Wine", "Blood", "Ichor"
};

[DataField("demandMessages")]
public IReadOnlyList<string> DemandMessages = new[]
{
"oracle-demand-1",
"oracle-demand-2",
"oracle-demand-3",
"oracle-demand-4",
"oracle-demand-5",
"oracle-demand-6",
"oracle-demand-7",
"oracle-demand-8",
"oracle-demand-9",
"oracle-demand-10",
"oracle-demand-11",
"oracle-demand-12"
};

[DataField("rejectMessages")]
public IReadOnlyList<string> RejectMessages = new[]
{
"ἄγνοια",
"υλικό",
"ἀγνωσία",
"γήινος",
"σάκλας"
};

[DataField("blacklistedPrototypes")]
[ViewVariables(VVAccess.ReadOnly)]
public IReadOnlyList<string> BlacklistedPrototypes = new[]
{
"Drone",
"QSI",
"HandTeleporter",
"BluespaceBeaker",
"ClothingBackpackHolding",
"ClothingBackpackSatchelHolding",
"ClothingBackpackDuffelHolding",
"TrashBagOfHolding",
"BluespaceCrystal",
"InsulativeHeadcage",
"CrystalNormality",
};
}
Loading

0 comments on commit bed1112

Please sign in to comment.