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

Fixes the master branch failing tests #376

Merged
merged 4 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed partial class ContractCriteriaControlComponent : Component
/// Additional criteria effects, on top of the ones the groups already have.
/// </summary>
[DataField("criteriaEffects")]
public Dictionary<string, List<CriteriaGroupEffectEvent>> CriteriaEffects = default!;
public Dictionary<string, List<CriteriaGroupEffectEvent>> CriteriaEffects = new();

/// <summary>
/// The actual criteria entities.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
using Content.Server._Citadel.Contracts.Components;
using Content.Shared._Citadel.CitVars;
using Content.Server._Citadel.Contracts.Components;
using Content.Shared._Citadel.Contracts;
using Robust.Shared.Configuration;

namespace Content.Server._Citadel.Contracts.Systems;

// SHITCODESHITCODESHITCODESHITCODESHITCODE
// Whoever touches this next, REPLACE IT.

//we cri ; m; -bhijn
public sealed class DefaultContractSpawningSystem : EntitySystem
{
[Dependency] private readonly ContractManagementSystem _contract = default!;
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;

public Dictionary<string, EntityUid> Contracts = new ()
{
Expand All @@ -17,6 +22,9 @@ public sealed class DefaultContractSpawningSystem : EntitySystem

public override void Update(float frameTime)
{
if (!ConfigManager.GetCVar(CitVars.CitDebugContractSpawning))
return;

foreach (var (contract, ent) in Contracts)
{
if (Deleted(ent) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public sealed class CriteriaMaterialStorageHasMaterialsSystem : EntitySystem
[Dependency] private readonly MaterialStorageSystem _material = default!;
[Dependency] private readonly ContractVesselManagementSystem _contractVessel = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -66,7 +67,10 @@ public override void Update(float frameTime)

while (q.MoveNext(out var uid, out var cc, out var criteria))
{
if (Comp<ContractComponent>(cc.OwningContract).OwningContractor is not {} owningContractor)
if (!_entityManager.TryGetComponent<ContractComponent>(cc.OwningContract, out var owningContractComponent))
continue;

if (owningContractComponent.OwningContractor is not {} owningContractor)
continue;

if (_contractVessel.LocateUserVesselContract(new Entity<MindComponent>(owningContractor.Owner, owningContractor)) is not
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/_Citadel/Thalers/Toolshed/BankCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Content.Shared.FixedPoint;
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.FixedPoint;
using Robust.Shared.Toolshed;
using Robust.Shared.Toolshed.Syntax;

namespace Content.Server._Citadel.Thalers.Toolshed;

[ToolshedCommand]
[ToolshedCommand, AdminCommand(AdminFlags.Debug)]
public sealed class BankCommand : ToolshedCommand
{
private PersonalBankSystem? _bank;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public override void Initialize()

private void OnVesselContractShutdown(EntityUid uid, VesselContractComponent component, ComponentShutdown args)
{
if (component.Vessel == null)
return;
_station.DeleteStation(component.Vessel!.Value);
}

Expand Down
15 changes: 15 additions & 0 deletions Content.Shared/_Citadel/CitVars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Robust.Shared;
using Robust.Shared.Configuration;

namespace Content.Shared._Citadel.CitVars
{
[CVarDefs]
public sealed class CitVars : CVars
{
/// <summary>
/// Automatically spawns more contracts as contracts are cleared
/// </summary>
public static readonly CVarDef<bool>
CitDebugContractSpawning = CVarDef.Create("debug.citadel.contractspawning", false, CVar.ARCHIVE | CVar.SERVERONLY);
}
}
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_citadel/cartridges.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
contracts-program-name = Contracts
12 changes: 12 additions & 0 deletions Resources/Locale/en-US/_citadel/citadel-toolshed.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
command-description-bank-getthalers = Returns the Thaler count of the target bank account.
command-description-bank-adjust = Adjusts the Thaler count of the target bank account.

command-description-contract-new = Creates a new contract of the specified type.
command-description-contract-bindto = Binds a contract to the mind of a given session.
command-description-contract-owningnew = Creates a new contract of a specified type and ties it to the mind of a given session.
command-description-contract-list = Lists contracts.
command-description-contract-detail = Provides detail of the status of a given contract.
command-description-contract-activate = Attempts to activate a contract.
command-description-contract-finalize = Attempts to finalize a contract.
command-description-contract-breach = Attempts to breach a contract.
command-description-contract-cancel = Makes the contract loudly complain on social media.
1 change: 1 addition & 0 deletions Resources/Prototypes/_Citadel/Contracts/Criteria/base.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- type: entity
id: CitadelBaseContractCriteria
abstract: true
save: false
components:
- type: ContractCriteria
1 change: 1 addition & 0 deletions Resources/Prototypes/_Citadel/Contracts/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
A contract controller entity, manages some given contract.
You probably shouldn't be seeing this.
abstract: true
save: false
components:
- type: Contract
- type: ContractCriteriaControl
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/_Citadel/PDA/cartridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- type: UIFragment
ui: !type:ContractsCartridgeUi
- type: Cartridge
programName: Contracts
programName: contracts-program-name
icon:
sprite: Objects/Misc/books.rsi
state: book6
Expand Down
Loading