Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix stuffs #127

Merged
merged 12 commits into from
Jan 12, 2025
2 changes: 1 addition & 1 deletion .github/workflows/build-docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-map-renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.x

- name: Get Engine Tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yaml-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ await server.WaitAssertion(() =>
{
playerUid = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(playerUid, Is.Not.EqualTo(default));
Assert.That(playerUid, Is.Not.EqualTo(default(EntityUid)));
// Making sure it exists
Assert.That(entManager.HasComponent<AlertsComponent>(playerUid));
#pragma warning restore NUnit2045
Expand Down
6 changes: 3 additions & 3 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
using Content.Server.Spawners.Components;
using Content.Server.Station.Components;
using Content.Shared.CCVar;
using Content.Shared.Roles;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using FastAccessors;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;

Expand Down Expand Up @@ -65,7 +63,8 @@ public sealed class PostMapInitTest
"Submarine", //DeltaV
"Gax",
"Rad",
"Europa"
"Europa",
"Meta"
};

/// <summary>
Expand Down Expand Up @@ -253,6 +252,7 @@ await server.WaitPost(() =>
// This is done inside gamemap test because loading the map takes ages and we already have it.
var spawnPoints = entManager.EntityQuery<SpawnPointComponent>()
.Where(x => x.SpawnType == SpawnPointType.Job)
.Where(x => x.Job!.JobEntity == null)
.Select(x => x.Job!.ID);

jobs.ExceptWith(spawnPoints);
Expand Down
2 changes: 1 addition & 1 deletion Content.PatreonParser/Content.PatreonParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,11 @@ public partial class UpstreamMerge : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("DROP TABLE IF EXISTS ProileLoadouts;");

migrationBuilder.AddForeignKey(
name: "FK_loadout_profile_profile_id",
table: "loadout",
column: "profile_id",
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_loadout_profile_profile_id",
table: "loadout");

migrationBuilder.CreateTable(
name: "ProfileLoadout",
columns: table => new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,11 @@ public partial class UpstreamMerge : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("DROP TABLE IF EXISTS ProileLoadouts;");

migrationBuilder.AddForeignKey(
name: "FK_loadout_profile_profile_id",
table: "loadout",
column: "profile_id",
principalTable: "profile",
principalColumn: "profile_id",
onDelete: ReferentialAction.Cascade);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_loadout_profile_profile_id",
table: "loadout");

migrationBuilder.CreateTable(
name: "ProfileLoadout",
columns: table => new
Expand Down
128 changes: 128 additions & 0 deletions Content.Server/Administration/Commands/PlayTimeUnlockCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
using System.Linq;
using Content.Server.Players.PlayTimeTracking;
using Content.Shared.Administration;
using Content.Shared.Customization.Systems;
using Content.Shared.Roles;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;


namespace Content.Server.Administration.Commands;

[AdminCommand(AdminFlags.Admin)]
public sealed class PlayTimeUnlockCommands : IConsoleCommand
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly PlayTimeTrackingManager _playTimeTracking = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;

public string Command => "playtime_unlock";
public string Description => Loc.GetString("cmd-playtime_unlock-desc");
public string Help => Loc.GetString("cmd-playtime_unlock-help", ("command", Command));

private Dictionary<string, string> _departmentToTrackers = new();

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (_departmentToTrackers.Count == 0)
PopulateDepartmentConversions();

if (args.Length != 2)
{
shell.WriteError(Loc.GetString("cmd-playtime_addoverall-error-args"));
return;
}

if (!_playerManager.TryGetSessionByUsername(args[0], out var player))
{
shell.WriteError(Loc.GetString("parse-session-fail", ("username", args[0])));
return;
}

var jobName = args[1];
var jobExists = _prototypeManager.TryIndex<JobPrototype>(jobName, out var job);

if (!jobExists)
{
shell.WriteError(Loc.GetString("cmd-playtime_unlock-error-job", ("invalidJob", jobName)));
return;
}

if (job == null || job.Requirements == null)
{
shell.WriteError(Loc.GetString("cmd-playtime_unlock-error-no-requirements"));
return;
}

var jobPlaytimeRequirements = job.Requirements
.Where(r => r is CharacterPlaytimeRequirement)
.Cast<CharacterPlaytimeRequirement>()
.ToList();

var jobDepartmentRequirements = job.Requirements
.Where(r => r is CharacterDepartmentTimeRequirement)
.Cast<CharacterDepartmentTimeRequirement>()
.ToList();

if (!jobPlaytimeRequirements.Any() && !jobDepartmentRequirements.Any())
{
shell.WriteError(Loc.GetString("cmd-playtime_unlock-error-no-requirements"));
return;
}

foreach (var jobPlaytimeRequirement in jobPlaytimeRequirements)
_playTimeTracking.AddTimeToTracker(player, jobPlaytimeRequirement.Tracker, jobPlaytimeRequirement.Min);

foreach (var jobDepartmentRequirement in jobDepartmentRequirements)
{
if (!_departmentToTrackers.TryGetValue(jobDepartmentRequirement.Department, out var jobId))
continue;

var exists = _prototypeManager.TryIndex<JobPrototype>(jobId, out var jobPrototype);

if (!exists)
continue;

_playTimeTracking.AddTimeToTracker(player, jobPrototype!.PlayTimeTracker, jobDepartmentRequirement.Min);
}

shell.WriteLine(Loc.GetString("shell-command-success"));
}

public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
if (args.Length == 1)
{
return CompletionResult.FromHintOptions(
CompletionHelper.SessionNames(players: _playerManager),
Loc.GetString("cmd-playtime_unlock-arg-user"));
}

if (args.Length == 2)
{
return CompletionResult.FromHintOptions(
CompletionHelper.PrototypeIDs<JobPrototype>(),
Loc.GetString("cmd-playtime_unlock-arg-job"));
}

return CompletionResult.Empty;
}

private void PopulateDepartmentConversions()
{
var allDepartments = _prototypeManager.EnumeratePrototypes<DepartmentPrototype>()
.ToList();

foreach (var department in allDepartments)
{
if (_departmentToTrackers.ContainsKey(department.ID))
continue;

if (department.Roles.Count == 0)
continue;

_departmentToTrackers.Add(department.ID, department.Roles[0]);
}
}
}
2 changes: 1 addition & 1 deletion Content.Server/Animals/Components/UdderComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal sealed partial class UdderComponent : Component
/// <summary>
/// The solution to add reagent to.
/// </summary>
[DataField]
[ViewVariables]
public Entity<SolutionComponent>? Solution = null;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Animals/Components/WoolyComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public sealed partial class WoolyComponent : Component
/// <summary>
/// The solution to add reagent to.
/// </summary>
[DataField]
[ViewVariables(VVAccess.ReadOnly)]
public Entity<SolutionComponent>? Solution;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ public sealed partial class ReagentProducerAnomalyComponent : Component
/// <summary>
/// Solution where the substance is generated
/// </summary>
[DataField("solutionRef")]
[ViewVariables]
public Entity<SolutionComponent>? Solution = null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public sealed partial class GasCondenserComponent : Component
/// <summary>
/// The solution that gases are condensed into.
/// </summary>
[DataField]
[ViewVariables]
public Entity<SolutionComponent>? Solution = null;

/// <summary>
Expand Down
12 changes: 6 additions & 6 deletions Content.Server/Body/Components/BloodstreamComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,22 @@ public sealed partial class BloodstreamComponent : Component
/// <summary>
/// Internal solution for blood storage
/// </summary>
[DataField]
public Entity<SolutionComponent>? BloodSolution = null;
[ViewVariables]
public Entity<SolutionComponent>? BloodSolution;

/// <summary>
/// Internal solution for reagent storage
/// </summary>
[DataField]
public Entity<SolutionComponent>? ChemicalSolution = null;
[ViewVariables]
public Entity<SolutionComponent>? ChemicalSolution;

/// <summary>
/// Temporary blood solution.
/// When blood is lost, it goes to this solution, and when this
/// solution hits a certain cap, the blood is actually spilled as a puddle.
/// </summary>
[DataField]
public Entity<SolutionComponent>? TemporarySolution = null;
[ViewVariables]
public Entity<SolutionComponent>? TemporarySolution;

/// <summary>
/// Variable that stores the amount of status time added by having a low blood level.
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Body/Components/LungComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed partial class LungComponent : Component
/// <summary>
/// The solution on this entity that these lungs act on.
/// </summary>
[DataField]
[ViewVariables]
public Entity<SolutionComponent>? Solution = null;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Body/Components/StomachComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public sealed partial class StomachComponent : Component
/// <summary>
/// The solution inside of this stomach this transfers reagents to the body.
/// </summary>
[DataField]
public Entity<SolutionComponent>? Solution = null;
[ViewVariables]
public Entity<SolutionComponent>? Solution;

/// <summary>
/// What solution should this stomach push reagents into, on the body?
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Botany/Components/PlantHolderComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ public sealed partial class PlantHolderComponent : Component
[ViewVariables(VVAccess.ReadWrite), DataField("solution")]
public string SoilSolutionName = "soil";

[DataField]
[ViewVariables]
public Entity<SolutionComponent>? SoilSolution = null;
}
1 change: 0 additions & 1 deletion Content.Server/Botany/Systems/MutationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Content.Shared.Chemistry.Reagent;
using System.Linq;
using Content.Shared.Atmos;
using FastAccessors;

namespace Content.Server.Botany;

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Cargo/Systems/PricingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public record struct PriceCalculationEvent()
[ByRefEvent]
public record struct EstimatedPriceCalculationEvent()
{
public EntityPrototype Prototype;
public required EntityPrototype Prototype;

/// <summary>
/// The total price of the entity.
Expand Down
Loading
Loading