-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c774034
commit eca0f6e
Showing
24 changed files
with
1,815 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Content.Server/_Citadel/Contracts/Components/ContractGroupsComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Content.Server._Citadel.Contracts.Components; | ||
|
||
/// <summary> | ||
/// This is used for contract groups. simpl. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class ContractGroupsComponent : Component | ||
{ | ||
[DataField("groups")] | ||
public HashSet<string> Groups = new(); | ||
} |
13 changes: 13 additions & 0 deletions
13
Content.Server/_Citadel/Contracts/Components/FinalizeContractsCriteriaComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Content.Server._Citadel.Contracts.Components; | ||
|
||
/// <summary> | ||
/// This is used for contracts that are advanced by finalizing other contracts. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class FinalizeContractsCriteriaComponent : Component | ||
{ | ||
[DataField("toClear")] | ||
public int ContractsToClear; | ||
|
||
public int ContractsCleared; | ||
} |
13 changes: 0 additions & 13 deletions
13
Content.Server/_Citadel/Contracts/Components/SubcontractingComponent.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Content.Server/_Citadel/Contracts/Systems/DefaultContractSpawningSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Content.Server._Citadel.Contracts.Components; | ||
using Content.Shared._Citadel.Contracts; | ||
|
||
namespace Content.Server._Citadel.Contracts.Systems; | ||
|
||
// SHITCODESHITCODESHITCODESHITCODESHITCODE | ||
// Whoever touches this next, REPLACE IT. | ||
public sealed class DefaultContractSpawningSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly ContractManagementSystem _contract = default!; | ||
|
||
public Dictionary<string, EntityUid> Contracts = new () | ||
{ | ||
{"CitadelMiningVesselContract", EntityUid.Invalid}, | ||
{"CitadelPlasmaMiningContract", EntityUid.Invalid}, | ||
}; | ||
|
||
public override void Update(float frameTime) | ||
{ | ||
foreach (var (contract, ent) in Contracts) | ||
{ | ||
if (Deleted(ent) || | ||
Comp<ContractComponent>(ent).Status is not ContractStatus.Initiating and not ContractStatus.Uninitialized) | ||
{ | ||
Contracts[contract] = _contract.CreateUnboundContract(contract); | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Content.Server/_Citadel/Contracts/Systems/FinalizeContractsCriteriaSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Linq; | ||
using Content.Server._Citadel.Contracts.Components; | ||
using Content.Shared._Citadel.Contracts; | ||
using Content.Shared._Citadel.Contracts.BUI; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Server._Citadel.Contracts.Systems; | ||
|
||
/// <summary> | ||
/// This handles... | ||
/// </summary> | ||
public sealed class FinalizeContractsCriteriaSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly ContractCriteriaSystem _criteria = default!; | ||
|
||
|
||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<ContractStatusChangedEvent>(Handler); | ||
SubscribeLocalEvent<FinalizeContractsCriteriaComponent, CriteriaGetDisplayInfo>(OnGetDisplayInfo); | ||
} | ||
|
||
private void OnGetDisplayInfo(EntityUid uid, FinalizeContractsCriteriaComponent component, ref CriteriaGetDisplayInfo args) | ||
{ | ||
var desc = FormattedMessage.FromMarkup($"Complete {component.ContractsToClear} contracts successfully while this one is active."); | ||
if (Comp<ContractCriteriaComponent>(uid).Satisfied) | ||
desc.AddText(" [COMPLETE]"); | ||
args.Info = new CriteriaDisplayData(desc); | ||
} | ||
|
||
private void Handler(ContractStatusChangedEvent ev) | ||
{ | ||
var contractComp = Comp<ContractComponent>(ev.Contract); | ||
|
||
if (ev.New != ContractStatus.Finalized) | ||
return; | ||
|
||
foreach (var contractor in contractComp.SubContractors.Append(contractComp.OwningContractor)) | ||
{ | ||
var contracts = contractor!.Contracts.SelectMany(x => Comp<ContractCriteriaControlComponent>(x).Criteria.Values) | ||
.SelectMany(x => x) | ||
.Where(HasComp<FinalizeContractsCriteriaComponent>); | ||
|
||
foreach (var contract in contracts) | ||
{ | ||
var finalize = Comp<FinalizeContractsCriteriaComponent>(contract); | ||
finalize.ContractsCleared++; | ||
if (finalize.ContractsCleared >= finalize.ContractsToClear) | ||
_criteria.SetCriteriaStatus(contract, true, Comp<ContractCriteriaComponent>(contract)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.