Garbage delete (#1284)
* fuck this * and this * aaand this * content fix * Update base.yml * Update physical.yml * kill bob
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
namespace Content.Client._CP14.WorldSprite;
|
||||
|
||||
/// <summary>
|
||||
/// RUN, IF YOU SEE THE CODE TO THIS FUCKING THING, YOU'LL DIE ON THE SPOT.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class CP14WorldSpriteComponent : Component
|
||||
{
|
||||
public bool Inited;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using Content.Shared._CP14.WorldSprite;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Client._CP14.WorldSprite;
|
||||
|
||||
public sealed class CP14WorldSpriteSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
#if DEBUG
|
||||
SubscribeLocalEvent<CP14WorldSpriteComponent, ComponentInit>(OnComponentInit);
|
||||
#endif
|
||||
|
||||
SubscribeLocalEvent<CP14WorldSpriteComponent, EntParentChangedMessage>(OnParentChanged);
|
||||
SubscribeLocalEvent<CP14WorldSpriteComponent, ThrownEvent>(OnThrown);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
var query = EntityQueryEnumerator<CP14WorldSpriteComponent>();
|
||||
while (query.MoveNext(out var uid, out var worldSpriteComponent))
|
||||
{
|
||||
if (worldSpriteComponent.Inited)
|
||||
continue;
|
||||
|
||||
Update(uid);
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
private void OnComponentInit(Entity<CP14WorldSpriteComponent> entity, ref ComponentInit args)
|
||||
{
|
||||
if (!HasComp<AppearanceComponent>(entity))
|
||||
Log.Error($"Requires an {nameof(AppearanceComponent)} for {entity}");
|
||||
}
|
||||
#endif
|
||||
|
||||
private void OnParentChanged(Entity<CP14WorldSpriteComponent> entity, ref EntParentChangedMessage args)
|
||||
{
|
||||
Update(entity);
|
||||
}
|
||||
|
||||
private void OnThrown(Entity<CP14WorldSpriteComponent> entity, ref ThrownEvent args)
|
||||
{
|
||||
// Idk, but throw don't call reparent
|
||||
Update(entity, args.User);
|
||||
}
|
||||
|
||||
private void Update(EntityUid entity, EntityUid? parent = null)
|
||||
{
|
||||
parent ??= Transform(entity).ParentUid;
|
||||
|
||||
var inWorld = HasComp<MapComponent>(parent) || HasComp<MapGridComponent>(parent);
|
||||
|
||||
_appearance.SetData(entity, WorldSpriteVisualLayers.Layer, inWorld);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ namespace Content.Server.Entry
|
||||
{
|
||||
public static string[] List => new[] {
|
||||
"CP14WaveShader", // CP14 Wave shader
|
||||
"CP14WorldSprite", // CP14 World Sprite
|
||||
"ConstructionGhost",
|
||||
"IconSmooth",
|
||||
"InteractionOutline",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server._CP14.Objectives.Systems;
|
||||
using Content.Server._CP14.StealArea;
|
||||
using Content.Server.Objectives.Systems;
|
||||
using Content.Server.Thief.Systems;
|
||||
|
||||
@@ -8,7 +7,7 @@ namespace Content.Server.Objectives.Components;
|
||||
/// <summary>
|
||||
/// An abstract component that allows other systems to count adjacent objects as "stolen" when controlling other systems
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(StealConditionSystem), typeof(ThiefBeaconSystem), typeof(CP14CurrencyCollectConditionSystem), typeof(CP14StealAreaAutoJobConnectSystem))] //CP14 add currency condition access
|
||||
[RegisterComponent, Access(typeof(StealConditionSystem), typeof(ThiefBeaconSystem), typeof(CP14CurrencyCollectConditionSystem))]
|
||||
public sealed partial class StealAreaComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
|
||||
@@ -115,8 +115,6 @@ public sealed partial class CP14DemiplaneSystem
|
||||
demiplane = ev.Demiplane;
|
||||
}
|
||||
|
||||
_statistic.TrackAdd(generator.Comp.Statistic, 1);
|
||||
|
||||
if (demiplane is null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server._CP14.Demiplane.Components;
|
||||
using Content.Server._CP14.RoundStatistic;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Flash;
|
||||
@@ -33,7 +32,6 @@ public sealed partial class CP14DemiplaneSystem : CP14SharedDemiplaneSystem
|
||||
[Dependency] private readonly FlashSystem _flash = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly CP14RoundStatTrackerSystem _statistic = default!;
|
||||
[Dependency] private readonly ChatSystem _chat = default!;
|
||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server._CP14.DemiplaneTraveling;
|
||||
using Content.Shared._CP14.Demiplane.Prototypes;
|
||||
using Content.Shared._CP14.RoundStatistic;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.Demiplane.Components;
|
||||
@@ -17,9 +16,6 @@ public sealed partial class CP14DemiplaneDataComponent : Component
|
||||
[DataField]
|
||||
public List<ProtoId<CP14DemiplaneModifierPrototype>> SelectedModifiers = new();
|
||||
|
||||
[DataField]
|
||||
public ProtoId<CP14RoundStatTrackerPrototype> Statistic = "DemiplaneOpen";
|
||||
|
||||
[DataField]
|
||||
public List<EntProtoId> AutoRifts = new() { "CP14DemiplaneTimedRadiusPassway", "CP14DemiplanRiftCore" };
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using Content.Server._CP14.Objectives.Systems;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server._CP14.Objectives.Components;
|
||||
|
||||
/// <summary>
|
||||
/// The player must be the richest among the players among the specified list of roles
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14RichestJobConditionSystem))]
|
||||
public sealed partial class CP14RichestJobConditionComponent : Component
|
||||
{
|
||||
[DataField(required: true)]
|
||||
public ProtoId<JobPrototype> Job;
|
||||
|
||||
[DataField(required: true)]
|
||||
public LocId ObjectiveText;
|
||||
|
||||
[DataField(required: true)]
|
||||
public LocId ObjectiveDescription;
|
||||
|
||||
[DataField(required: true)]
|
||||
public SpriteSpecifier ObjectiveSprite;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using Content.Server._CP14.Objectives.Systems;
|
||||
using Content.Shared._CP14.RoundStatistic;
|
||||
using Content.Shared.Destructible.Thresholds;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server._CP14.Objectives.Components;
|
||||
|
||||
[RegisterComponent, Access(typeof(CP14StatisticRangeConditionSystem))]
|
||||
public sealed partial class CP14StatisticRangeConditionComponent : Component
|
||||
{
|
||||
[DataField(required: true)]
|
||||
public ProtoId<CP14RoundStatTrackerPrototype> Statistic;
|
||||
|
||||
[DataField(required: true)]
|
||||
public MinMax Range;
|
||||
|
||||
[DataField(required: true)]
|
||||
public LocId ObjectiveText;
|
||||
|
||||
[DataField(required: true)]
|
||||
public LocId ObjectiveDescription;
|
||||
|
||||
[DataField(required: true)]
|
||||
public SpriteSpecifier? ObjectiveSprite;
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
using Content.Server._CP14.Objectives.Components;
|
||||
using Content.Shared._CP14.Currency;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Components;
|
||||
using Content.Shared.Objectives.Systems;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.Objectives.Systems;
|
||||
|
||||
public sealed class CP14RichestJobConditionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
||||
[Dependency] private readonly CP14SharedCurrencySystem _currency = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
[Dependency] private readonly SharedJobSystem _job = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14RichestJobConditionComponent, ObjectiveAfterAssignEvent>(OnCollectAfterAssign);
|
||||
SubscribeLocalEvent<CP14RichestJobConditionComponent, ObjectiveGetProgressEvent>(OnCollectGetProgress);
|
||||
}
|
||||
|
||||
private void OnCollectAfterAssign(Entity<CP14RichestJobConditionComponent> condition, ref ObjectiveAfterAssignEvent args)
|
||||
{
|
||||
if (!_proto.TryIndex(condition.Comp.Job, out var indexedJob))
|
||||
return;
|
||||
|
||||
_metaData.SetEntityName(condition.Owner, Loc.GetString(condition.Comp.ObjectiveText), args.Meta);
|
||||
_metaData.SetEntityDescription(condition.Owner, Loc.GetString(condition.Comp.ObjectiveDescription), args.Meta);
|
||||
_objectives.SetIcon(condition.Owner, condition.Comp.ObjectiveSprite);
|
||||
}
|
||||
|
||||
private void OnCollectGetProgress(Entity<CP14RichestJobConditionComponent> condition, ref ObjectiveGetProgressEvent args)
|
||||
{
|
||||
args.Progress = GetProgress(args.MindId, args.Mind, condition);
|
||||
}
|
||||
|
||||
private float GetProgress(EntityUid mindId, MindComponent mind, CP14RichestJobConditionComponent condition)
|
||||
{
|
||||
if (mind.OwnedEntity is null)
|
||||
return 0;
|
||||
|
||||
var ourValue = _currency.GetTotalCurrencyRecursive(mind.OwnedEntity.Value);
|
||||
var otherMaxValue = 0;
|
||||
|
||||
var allHumans = _mind.GetAliveHumans(mindId);
|
||||
if (allHumans.Count == 0)
|
||||
return 1; // No one to compare to, so we're the richest.
|
||||
|
||||
foreach (var otherHuman in allHumans)
|
||||
{
|
||||
if (!_job.MindTryGetJob(otherHuman, out var otherJob))
|
||||
continue;
|
||||
|
||||
if (otherJob != condition.Job)
|
||||
continue;
|
||||
|
||||
if (otherHuman.Comp.OwnedEntity is null)
|
||||
continue;
|
||||
|
||||
var otherValue = _currency.GetTotalCurrencyRecursive(otherHuman.Comp.OwnedEntity.Value);
|
||||
if (otherValue > otherMaxValue)
|
||||
otherMaxValue = otherValue;
|
||||
}
|
||||
|
||||
// if several players have the same amount of money, no one wins.
|
||||
return ourValue == otherMaxValue ? 0.99f : Math.Clamp(ourValue / (float)otherMaxValue, 0, 1);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using Content.Server._CP14.Objectives.Components;
|
||||
using Content.Server._CP14.RoundStatistic;
|
||||
using Content.Shared.Objectives.Components;
|
||||
using Content.Shared.Objectives.Systems;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server._CP14.Objectives.Systems;
|
||||
|
||||
public sealed class CP14StatisticRangeConditionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
||||
[Dependency] private readonly CP14RoundStatTrackerSystem _statistic = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14StatisticRangeConditionComponent, ObjectiveAfterAssignEvent>(OnAfterAssign);
|
||||
SubscribeLocalEvent<CP14StatisticRangeConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress);
|
||||
}
|
||||
|
||||
private void OnAfterAssign(Entity<CP14StatisticRangeConditionComponent> condition, ref ObjectiveAfterAssignEvent args)
|
||||
{
|
||||
var title = Loc.GetString(condition.Comp.ObjectiveText,
|
||||
("min", condition.Comp.Range.Min),
|
||||
("max", condition.Comp.Range.Max));
|
||||
|
||||
var description = Loc.GetString(condition.Comp.ObjectiveDescription,
|
||||
("min", condition.Comp.Range.Min),
|
||||
("max", condition.Comp.Range.Max));
|
||||
|
||||
_metaData.SetEntityName(condition.Owner, title, args.Meta);
|
||||
_metaData.SetEntityDescription(condition.Owner, description, args.Meta);
|
||||
if (condition.Comp.ObjectiveSprite is not null)
|
||||
_objectives.SetIcon(condition.Owner, condition.Comp.ObjectiveSprite, args.Objective);
|
||||
}
|
||||
|
||||
private void OnGetProgress(Entity<CP14StatisticRangeConditionComponent> ent, ref ObjectiveGetProgressEvent args)
|
||||
{
|
||||
var statValue = _statistic.GetTrack(ent.Comp.Statistic);
|
||||
|
||||
if (statValue is null || statValue > ent.Comp.Range.Max || statValue < ent.Comp.Range.Min)
|
||||
{
|
||||
args.Progress = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
args.Progress = 1;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Content.Server._CP14.RoleSalary;
|
||||
|
||||
[RegisterComponent, Access(typeof(CP14SalarySystem))]
|
||||
public sealed partial class CP14SalarySpawnerComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
using System.Text;
|
||||
using Content.Server._CP14.Cargo;
|
||||
using Content.Server._CP14.Currency;
|
||||
using Content.Server.Station.Events;
|
||||
using Content.Shared.Paper;
|
||||
using Content.Shared.Station.Components;
|
||||
using Content.Shared.Storage.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server._CP14.RoleSalary;
|
||||
|
||||
/// <summary>
|
||||
/// A system that periodically sends paychecks to certain roles through the cargo ship system
|
||||
/// </summary>
|
||||
public sealed partial class CP14SalarySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly CP14CargoSystem _cargo = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly PaperSystem _paper = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly CP14CurrencySystem _currency = default!;
|
||||
[Dependency] private readonly SharedStorageSystem _storage = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14StationSalaryComponent, StationPostInitEvent>(OnStationPostInit);
|
||||
SubscribeLocalEvent<CP14SalarySpawnerComponent, MapInitEvent>(OnSalaryInit);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
//var query = EntityQueryEnumerator<CP14StationSalaryComponent, CP14StationTravelingStoreShipTargetComponent>();
|
||||
//while (query.MoveNext(out var uid, out var salary, out var store))
|
||||
//{
|
||||
// if (_timing.CurTime < salary.NextSalaryTime)
|
||||
// continue;
|
||||
//
|
||||
// salary.NextSalaryTime = _timing.CurTime + salary.SalaryFrequency;
|
||||
// _cargo.AddBuyQueue((uid, store), new List<EntProtoId> {salary.SalaryProto});
|
||||
//}
|
||||
}
|
||||
|
||||
private void OnSalaryInit(Entity<CP14SalarySpawnerComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
GenerateSalary(ent);
|
||||
QueueDel(ent);
|
||||
}
|
||||
|
||||
private void GenerateSalary(Entity<CP14SalarySpawnerComponent> ent)
|
||||
{
|
||||
//Hardcode warning! ^-^
|
||||
var xform = Transform(ent);
|
||||
|
||||
//First we need found a station
|
||||
if (!TryComp<StationMemberComponent>(xform.GridUid, out var member))
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14StationSalaryComponent>(member.Station, out var stationSalaryComponent))
|
||||
return;
|
||||
|
||||
var paper = Spawn("CP14Paper"); //TODO Special named paper
|
||||
_transform.PlaceNextTo(paper, (ent, xform));
|
||||
if (TryComp<PaperComponent>(paper, out var paperComp))
|
||||
{
|
||||
paperComp.Content = GenerateSalaryText((member.Station, stationSalaryComponent)) ?? "";
|
||||
_paper.TryStamp((paper, paperComp),
|
||||
new StampDisplayInfo
|
||||
{
|
||||
StampedColor = Color.Red,
|
||||
StampedName = Loc.GetString("cp14-stamp-salary"),
|
||||
},
|
||||
"red_on_paper");
|
||||
}
|
||||
|
||||
var wallet = Spawn("CP14Wallet");
|
||||
_transform.PlaceNextTo(wallet, (ent, xform));
|
||||
|
||||
foreach (var salary in stationSalaryComponent.Salary)
|
||||
{
|
||||
var coins = _currency.GenerateMoney(salary.Value, xform.Coordinates);
|
||||
foreach (var coin in coins)
|
||||
{
|
||||
_storage.Insert(wallet, coin, out _);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string? GenerateSalaryText(Entity<CP14StationSalaryComponent> station)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.Append(Loc.GetString("cp14-salary-title") + "\n");
|
||||
foreach (var salary in station.Comp.Salary)
|
||||
{
|
||||
sb.Append("\n");
|
||||
if (!_proto.TryIndex(salary.Key, out var indexedDep))
|
||||
continue;
|
||||
|
||||
var name = Loc.GetString(indexedDep.Name);
|
||||
sb.Append(Loc.GetString("cp14-salary-entry",
|
||||
("dep", name),
|
||||
("total", _currency.GetCurrencyPrettyString(salary.Value))));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private void OnStationPostInit(Entity<CP14StationSalaryComponent> ent, ref StationPostInitEvent args)
|
||||
{
|
||||
ent.Comp.NextSalaryTime = _timing.CurTime + ent.Comp.SalaryFrequency;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.RoleSalary;
|
||||
|
||||
[RegisterComponent, Access(typeof(CP14SalarySystem)), AutoGenerateComponentPause]
|
||||
public sealed partial class CP14StationSalaryComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// listing all the departments and their salaries
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public Dictionary<ProtoId<DepartmentPrototype>, int> Salary = new();
|
||||
|
||||
[DataField, AutoPausedField]
|
||||
public TimeSpan NextSalaryTime = TimeSpan.Zero;
|
||||
|
||||
[DataField]
|
||||
public TimeSpan SalaryFrequency = TimeSpan.FromMinutes(18);
|
||||
|
||||
[DataField]
|
||||
public EntProtoId SalaryProto = "CP14SalarySpawner";
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Content.Server._CP14.RoundRemoveShuttle;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class CP14RoundRemoveShuttleComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public EntityUid Station;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Shuttles.Events;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.StationRecords;
|
||||
using Content.Server.StationRecords.Systems;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.StationRecords;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.RoundRemoveShuttle;
|
||||
|
||||
public sealed partial class CP14RoundRemoveShuttleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
|
||||
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly StationJobsSystem _stationJobs = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
|
||||
private readonly HashSet<Entity<MindContainerComponent>> _mindSet = new();
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14RoundRemoveShuttleComponent, FTLStartedEvent>(OnFTL);
|
||||
}
|
||||
|
||||
private void OnFTL(Entity<CP14RoundRemoveShuttleComponent> ent, ref FTLStartedEvent args)
|
||||
{
|
||||
_mindSet.Clear();
|
||||
_lookup.GetChildEntities(ent, _mindSet);
|
||||
|
||||
if (!TryComp<StationRecordsComponent>(ent.Comp.Station, out var stationRecords))
|
||||
return;
|
||||
|
||||
HashSet<EntityUid> toDelete = new();
|
||||
var query = EntityQueryEnumerator<MindContainerComponent>();
|
||||
while (query.MoveNext(out var uid, out var mindContainer))
|
||||
{
|
||||
if (Transform(uid).GridUid != ent)
|
||||
continue;
|
||||
|
||||
if (!_mind.TryGetMind(uid, out _, out var mindComp, container: mindContainer))
|
||||
continue;
|
||||
|
||||
var name = Name(uid);
|
||||
var recordId = _stationRecords.GetRecordByName(ent.Comp.Station, name);
|
||||
|
||||
if (recordId is null)
|
||||
return;
|
||||
|
||||
var key = new StationRecordKey(recordId.Value, ent.Comp.Station);
|
||||
if (!_stationRecords.TryGetRecord<GeneralStationRecord>(key, out var entry, stationRecords))
|
||||
return;
|
||||
|
||||
_stationRecords.RemoveRecord(key, stationRecords);
|
||||
//Trying return all jobs roles
|
||||
var userId = mindComp.UserId;
|
||||
string? jobName = entry.JobTitle;
|
||||
if (userId is not null)
|
||||
{
|
||||
_stationJobs.TryAdjustJobSlot(ent.Comp.Station, entry.JobPrototype, 1, clamp: true);
|
||||
if (_proto.TryIndex(entry.JobPrototype, out var indexedJob))
|
||||
{
|
||||
jobName = Loc.GetString(indexedJob.Name);
|
||||
}
|
||||
}
|
||||
|
||||
_adminLog.Add(LogType.Action,
|
||||
LogImpact.High,
|
||||
$"{ToPrettyString(uid):player} was leave the round on traveling merchant ship");
|
||||
|
||||
_chatSystem.DispatchStationAnnouncement(ent.Comp.Station,
|
||||
Loc.GetString(
|
||||
_mobState.IsDead(uid) ? "cp14-earlyleave-ship-announcement-dead" : "cp14-earlyleave-ship-announcement",
|
||||
("character", mindComp.CharacterName ?? "Unknown"),
|
||||
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName ?? "Unknown"))
|
||||
),
|
||||
Loc.GetString("cp14-ship-sender"),
|
||||
playDefaultSound: false
|
||||
);
|
||||
toDelete.Add(uid);
|
||||
}
|
||||
|
||||
while (toDelete.Count > 0)
|
||||
{
|
||||
var r = toDelete.First();
|
||||
toDelete.Remove(r);
|
||||
QueueDel(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
using System.Text;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared._CP14.RoundStatistic;
|
||||
using Content.Shared.GameTicking;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.RoundStatistic;
|
||||
|
||||
public sealed partial class CP14RoundStatTrackerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
|
||||
private readonly Dictionary<ProtoId<CP14RoundStatTrackerPrototype>, int> _tracking = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
InitializeDemiplaneDeath();
|
||||
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundReset);
|
||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndTextAppend);
|
||||
ClearStatistic();
|
||||
}
|
||||
|
||||
private void OnRoundReset(RoundRestartCleanupEvent ev)
|
||||
{
|
||||
ClearStatistic();
|
||||
}
|
||||
|
||||
private void OnRoundEndTextAppend(RoundEndTextAppendEvent ev)
|
||||
{
|
||||
//TODO: Move to separate UI Text block
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.Append($"[head=3]{Loc.GetString("cp14-tracker-header")}[/head] \n");
|
||||
foreach (var pair in _tracking)
|
||||
{
|
||||
if (!_proto.TryIndex(pair.Key, out var indexedTracker))
|
||||
continue;
|
||||
|
||||
sb.Append($"- {Loc.GetString(indexedTracker.Text)}: {pair.Value}\n");
|
||||
}
|
||||
ev.AddLine(sb.ToString());
|
||||
}
|
||||
|
||||
private void ClearStatistic()
|
||||
{
|
||||
_tracking.Clear();
|
||||
|
||||
foreach (var statTracker in _proto.EnumeratePrototypes<CP14RoundStatTrackerPrototype>())
|
||||
{
|
||||
_tracking.Add(statTracker.ID, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void TrackAdd(ProtoId<CP14RoundStatTrackerPrototype> proto, int dif)
|
||||
{
|
||||
_tracking[proto] += Math.Max(dif, 0);
|
||||
}
|
||||
|
||||
public int? GetTrack(ProtoId<CP14RoundStatTrackerPrototype> proto)
|
||||
{
|
||||
if (!_tracking.TryGetValue(proto, out var stat))
|
||||
{
|
||||
Log.Error($"Failed to get round statistic: {proto}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return stat;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Content.Shared._CP14.RoundStatistic;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.RoundStatistic.DemiplaneDeath;
|
||||
|
||||
/// <summary>
|
||||
/// Tracks the destruction or full-blown death of this entity.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class CP14DeathDemiplaneStatisticComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public ProtoId<CP14RoundStatTrackerPrototype> Statistic = "DemiplaneDeaths";
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using Content.Server._CP14.Demiplane;
|
||||
using Content.Server._CP14.RoundStatistic.DemiplaneDeath;
|
||||
using Content.Shared._CP14.Demiplane.Components;
|
||||
using Content.Shared.GameTicking;
|
||||
|
||||
namespace Content.Server._CP14.RoundStatistic;
|
||||
|
||||
public sealed partial class CP14RoundStatTrackerSystem
|
||||
{
|
||||
private void InitializeDemiplaneDeath()
|
||||
{
|
||||
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnSpawnComplete);
|
||||
SubscribeLocalEvent<CP14DeathDemiplaneStatisticComponent, EntityTerminatingEvent>(OnEntityTerminated);
|
||||
SubscribeLocalEvent<CP14DeathDemiplaneStatisticComponent, CP14DemiplaneUnsafeExit>(OnDemiplaneUnsafeExit);
|
||||
}
|
||||
|
||||
private void OnSpawnComplete(PlayerSpawnCompleteEvent ev)
|
||||
{
|
||||
EnsureComp<CP14DeathDemiplaneStatisticComponent>(ev.Mob);
|
||||
}
|
||||
|
||||
private void OnDemiplaneUnsafeExit(Entity<CP14DeathDemiplaneStatisticComponent> ent, ref CP14DemiplaneUnsafeExit args)
|
||||
{
|
||||
TrackAdd(ent.Comp.Statistic, 1);
|
||||
}
|
||||
|
||||
//For round remove variants, like gibs or chasm falls
|
||||
private void OnEntityTerminated(Entity<CP14DeathDemiplaneStatisticComponent> ent, ref EntityTerminatingEvent args)
|
||||
{
|
||||
if (!HasComp<CP14DemiplaneComponent>(Transform(ent).MapUid))
|
||||
return;
|
||||
|
||||
TrackAdd(ent.Comp.Statistic, 1);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.StealArea;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[RegisterComponent, AutoGenerateComponentPause]
|
||||
public sealed partial class CP14StealAreaAutoJobConnectComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public HashSet<ProtoId<JobPrototype>> Jobs = new();
|
||||
|
||||
[DataField]
|
||||
public HashSet<ProtoId<DepartmentPrototype>> Departments = new();
|
||||
|
||||
[DataField]
|
||||
public bool Stations = true;
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
using Content.Server._CP14.StationCommonObjectives;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.StealArea;
|
||||
|
||||
public sealed class CP14StealAreaAutoJobConnectSystem : EntitySystem
|
||||
{
|
||||
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly SharedJobSystem _job = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14StealAreaAutoJobConnectComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawning);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<CP14StealAreaAutoJobConnectComponent> autoConnect, ref MapInitEvent args)
|
||||
{
|
||||
if (!TryComp<StealAreaComponent>(autoConnect, out var stealArea))
|
||||
return;
|
||||
|
||||
if (autoConnect.Comp.Stations)
|
||||
{
|
||||
var query = EntityQueryEnumerator<CP14StationCommonObjectivesComponent>();
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
stealArea.Owners.Add(uid);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var player in _playerManager.Sessions)
|
||||
{
|
||||
if (!_mind.TryGetMind(player.UserId, out var playerMind))
|
||||
continue;
|
||||
|
||||
if (!_job.MindTryGetJob(playerMind, out var playerJob))
|
||||
continue;
|
||||
|
||||
if (stealArea.Owners.Contains(playerMind.Value))
|
||||
continue;
|
||||
|
||||
if (autoConnect.Comp.Jobs.Contains(playerJob))
|
||||
{
|
||||
stealArea.Owners.Add(playerMind.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var depObj in autoConnect.Comp.Departments)
|
||||
{
|
||||
if (!_proto.TryIndex(depObj, out var indexedDepart))
|
||||
continue;
|
||||
|
||||
if (!indexedDepart.Roles.Contains(playerJob))
|
||||
continue;
|
||||
|
||||
stealArea.Owners.Add(playerMind.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayerSpawning(PlayerSpawnCompleteEvent ev)
|
||||
{
|
||||
if (!_mind.TryGetMind(ev.Player.UserId, out var mind))
|
||||
return;
|
||||
|
||||
var query = EntityQueryEnumerator<StealAreaComponent, CP14StealAreaAutoJobConnectComponent>();
|
||||
while (query.MoveNext(out var uid, out var stealArea, out var autoConnect))
|
||||
{
|
||||
if (stealArea.Owners.Contains(mind.Value))
|
||||
continue;
|
||||
|
||||
if (ev.JobId is null)
|
||||
continue;
|
||||
|
||||
if (autoConnect.Jobs.Contains(ev.JobId))
|
||||
{
|
||||
stealArea.Owners.Add(mind.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var depObj in autoConnect.Departments)
|
||||
{
|
||||
if (!_proto.TryIndex(depObj, out var indexedDepart))
|
||||
continue;
|
||||
|
||||
if (!indexedDepart.Roles.Contains(ev.JobId))
|
||||
continue;
|
||||
|
||||
stealArea.Owners.Add(mind.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Content.Shared.DoAfter;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._CP14.Decals;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class CP14DecalCleanerDoAfterEvent : DoAfterEvent
|
||||
{
|
||||
public NetCoordinates ClickLocation;
|
||||
|
||||
public CP14DecalCleanerDoAfterEvent(NetCoordinates click)
|
||||
{
|
||||
ClickLocation = click;
|
||||
}
|
||||
|
||||
public override DoAfterEvent Clone() => this;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace Content.Shared._CP14.MagicAttuning;
|
||||
|
||||
/// <summary>
|
||||
/// Reflects the fact that this subject can be focused on (Magical attune as a mechanic from DnD.)
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SharedMagicAttuningSystem))]
|
||||
public sealed partial class CP14MagicAttuningItemComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// how long it takes to focus on that object
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan FocusTime = TimeSpan.FromSeconds(5f);
|
||||
|
||||
public Entity<CP14MagicAttuningMindComponent>? Link = null;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._CP14.MagicAttuning;
|
||||
|
||||
/// <summary>
|
||||
/// A mind that can focus on objects
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(CP14SharedMagicAttuningSystem))]
|
||||
public sealed partial class CP14MagicAttuningMindComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public int MaxAttuning = 3;
|
||||
/// <summary>
|
||||
/// The entities that this being is focused on
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public List<EntityUid> AttunedTo = new();
|
||||
|
||||
/// <summary>
|
||||
/// cheat: if added to an entity with MindContainer, automatically copied to the mind, removing it from the body. This is to make it easy to add the component to prototype creatures.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool AutoCopyToMind = false;
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._CP14.MagicAttuning;
|
||||
|
||||
/// <summary>
|
||||
/// This system controls the customization to magic items by the players.
|
||||
/// </summary>
|
||||
public sealed partial class CP14SharedMagicAttuningSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14MagicAttuningItemComponent, GetVerbsEvent<InteractionVerb>>(OnInteractionVerb);
|
||||
SubscribeLocalEvent<CP14MagicAttuningMindComponent, CP14MagicAttuneDoAfterEvent>(OnAttuneDoAfter);
|
||||
SubscribeLocalEvent<CP14MagicAttuningMindComponent, MindAddedMessage>(OnMindAdded);
|
||||
}
|
||||
|
||||
private void OnMindAdded(Entity<CP14MagicAttuningMindComponent> ent, ref MindAddedMessage args)
|
||||
{
|
||||
if (!ent.Comp.AutoCopyToMind)
|
||||
return;
|
||||
|
||||
if (HasComp<MindComponent>(ent))
|
||||
return;
|
||||
|
||||
if (!_mind.TryGetMind(ent, out var mindId, out var mind))
|
||||
return;
|
||||
|
||||
if (!HasComp<CP14MagicAttuningMindComponent>(mindId))
|
||||
{
|
||||
var attuneMind = AddComp<CP14MagicAttuningMindComponent>(mindId);
|
||||
attuneMind.MaxAttuning = ent.Comp.MaxAttuning;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAttunedTo(EntityUid mind, EntityUid item)
|
||||
{
|
||||
if (!TryComp<CP14MagicAttuningItemComponent>(item, out var attuningItem))
|
||||
return false;
|
||||
|
||||
if (!TryComp<CP14MagicAttuningMindComponent>(mind, out var attuningMind))
|
||||
return false;
|
||||
|
||||
return attuningMind.AttunedTo.Contains(item);
|
||||
}
|
||||
|
||||
private void OnInteractionVerb(Entity<CP14MagicAttuningItemComponent> attuningItem, ref GetVerbsEvent<InteractionVerb> args)
|
||||
{
|
||||
if (!args.CanAccess || !args.CanInteract)
|
||||
return;
|
||||
|
||||
if (!_mind.TryGetMind(args.User, out var mindId, out var mind))
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14MagicAttuningMindComponent>(mindId, out var attumingMind))
|
||||
return;
|
||||
|
||||
var user = args.User;
|
||||
if (attumingMind.AttunedTo.Contains(args.Target))
|
||||
{
|
||||
args.Verbs.Add(new()
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
RemoveAttune((mindId, attumingMind), attuningItem);
|
||||
},
|
||||
Text = Loc.GetString("cp14-magic-deattuning-verb-text"),
|
||||
Message = Loc.GetString("cp14-magic-attuning-verb-message"),
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Verbs.Add(new()
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
TryStartAttune(user, attuningItem);
|
||||
},
|
||||
Text = Loc.GetString("cp14-magic-attuning-verb-text"),
|
||||
Message = Loc.GetString("cp14-magic-attuning-verb-message"),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryStartAttune(EntityUid user, Entity<CP14MagicAttuningItemComponent> item)
|
||||
{
|
||||
if (!_mind.TryGetMind(user, out var mindId, out var mind))
|
||||
return false;
|
||||
|
||||
if (!TryComp<CP14MagicAttuningMindComponent>(mindId, out var attuningMind))
|
||||
return false;
|
||||
|
||||
if (attuningMind.MaxAttuning <= 0)
|
||||
return false;
|
||||
|
||||
//if there's an overabundance of ties, we report that the oldest one is torn.
|
||||
if (attuningMind.AttunedTo.Count >= attuningMind.MaxAttuning)
|
||||
{
|
||||
var oldestAttune = attuningMind.AttunedTo[0];
|
||||
_popup.PopupEntity(Loc.GetString("cp14-magic-attune-oldest-forgot", ("item", MetaData(oldestAttune).EntityName)), user, user);
|
||||
}
|
||||
|
||||
//we notify the current owner of the item that someone is cutting ties.
|
||||
if (item.Comp.Link is not null &&
|
||||
item.Comp.Link.Value.Owner != mindId &&
|
||||
TryComp<MindComponent>(item.Comp.Link.Value.Owner, out var ownerMind) &&
|
||||
ownerMind.OwnedEntity is not null)
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("cp14-magic-attune-oldest-forgot", ("item", MetaData(item).EntityName)), ownerMind.OwnedEntity.Value, ownerMind.OwnedEntity.Value);
|
||||
}
|
||||
|
||||
var doAfterArgs = new DoAfterArgs(EntityManager,
|
||||
user,
|
||||
item.Comp.FocusTime,
|
||||
new CP14MagicAttuneDoAfterEvent(),
|
||||
mindId,
|
||||
item)
|
||||
{
|
||||
BreakOnDamage = true,
|
||||
BreakOnMove = true,
|
||||
DistanceThreshold = 2f,
|
||||
BlockDuplicate = true,
|
||||
};
|
||||
|
||||
_doAfter.TryStartDoAfter(doAfterArgs);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnAttuneDoAfter(Entity<CP14MagicAttuningMindComponent> ent, ref CP14MagicAttuneDoAfterEvent args)
|
||||
{
|
||||
if (args.Cancelled || args.Handled || args.Target is null)
|
||||
return;
|
||||
|
||||
if (ent.Comp.AttunedTo.Count >= ent.Comp.MaxAttuning)
|
||||
{
|
||||
var oldestAttune = ent.Comp.AttunedTo[0];
|
||||
RemoveAttune(ent, oldestAttune);
|
||||
}
|
||||
|
||||
AddAttune(ent, args.Target.Value);
|
||||
}
|
||||
|
||||
private void RemoveAttune(Entity<CP14MagicAttuningMindComponent> attuningMind, EntityUid item)
|
||||
{
|
||||
if (!attuningMind.Comp.AttunedTo.Contains(item))
|
||||
return;
|
||||
|
||||
attuningMind.Comp.AttunedTo.Remove(item);
|
||||
|
||||
if (!TryComp<CP14MagicAttuningItemComponent>(item, out var attuningItem))
|
||||
return;
|
||||
|
||||
if (!TryComp<MindComponent>(attuningMind, out var mind))
|
||||
return;
|
||||
|
||||
attuningItem.Link = null;
|
||||
|
||||
var ev = new RemovedAttuneFromMindEvent(attuningMind, mind.OwnedEntity, item);
|
||||
RaiseLocalEvent(attuningMind, ev);
|
||||
RaiseLocalEvent(item, ev);
|
||||
|
||||
if (mind.OwnedEntity is not null)
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("cp14-magic-attune-oldest-forgot-end", ("item", MetaData(item).EntityName)), mind.OwnedEntity.Value, mind.OwnedEntity.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddAttune(Entity<CP14MagicAttuningMindComponent> attuningMind, EntityUid item)
|
||||
{
|
||||
if (attuningMind.Comp.AttunedTo.Contains(item))
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14MagicAttuningItemComponent>(item, out var attuningItem))
|
||||
return;
|
||||
|
||||
if (!TryComp<MindComponent>(attuningMind, out var mind))
|
||||
return;
|
||||
|
||||
if (attuningItem.Link is not null)
|
||||
RemoveAttune(attuningItem.Link.Value, item);
|
||||
|
||||
attuningMind.Comp.AttunedTo.Add(item);
|
||||
attuningItem.Link = attuningMind;
|
||||
|
||||
|
||||
var ev = new AddedAttuneToMindEvent(attuningMind, mind.OwnedEntity, item);
|
||||
RaiseLocalEvent(attuningMind, ev);
|
||||
RaiseLocalEvent(item, ev);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class CP14MagicAttuneDoAfterEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// is evoked on both the item and the mind when a new connection between them appears.
|
||||
/// </summary>
|
||||
public sealed class AddedAttuneToMindEvent : EntityEventArgs
|
||||
{
|
||||
public readonly EntityUid Mind;
|
||||
public readonly EntityUid? User;
|
||||
public readonly EntityUid Item;
|
||||
|
||||
public AddedAttuneToMindEvent(EntityUid mind, EntityUid? user, EntityUid item)
|
||||
{
|
||||
Mind = mind;
|
||||
User = user;
|
||||
Item = item;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// is evoked on both the item and the mind when the connection is broken
|
||||
/// </summary>
|
||||
public sealed class RemovedAttuneFromMindEvent : EntityEventArgs
|
||||
{
|
||||
public readonly EntityUid Mind;
|
||||
public readonly EntityUid? User;
|
||||
public readonly EntityUid Item;
|
||||
|
||||
public RemovedAttuneFromMindEvent(EntityUid mind, EntityUid? user, EntityUid item)
|
||||
{
|
||||
Mind = mind;
|
||||
User = user;
|
||||
Item = item;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using Content.Shared._CP14.MagicAttuning;
|
||||
using Content.Shared._CP14.MagicSpellStorage.Components;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Hands;
|
||||
|
||||
namespace Content.Shared._CP14.MagicSpellStorage;
|
||||
@@ -11,9 +9,7 @@ public sealed partial class CP14SpellStorageSystem
|
||||
private void InitializeAccess()
|
||||
{
|
||||
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, GotEquippedHandEvent>(OnEquippedHand);
|
||||
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, AddedAttuneToMindEvent>(OnHandAddedAttune);
|
||||
|
||||
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, AddedAttuneToMindEvent>(OnClothingAddedAttune);
|
||||
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, ClothingGotEquippedEvent>(OnClothingEquipped);
|
||||
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, ClothingGotUnequippedEvent>(OnClothingUnequipped);
|
||||
}
|
||||
@@ -26,40 +22,6 @@ public sealed partial class CP14SpellStorageSystem
|
||||
TryGrantAccess((ent, spellStorage), args.User);
|
||||
}
|
||||
|
||||
private void OnHandAddedAttune(Entity<CP14SpellStorageAccessHoldingComponent> ent, ref AddedAttuneToMindEvent args)
|
||||
{
|
||||
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
|
||||
return;
|
||||
|
||||
if (args.User is null)
|
||||
return;
|
||||
|
||||
if (!_hands.IsHolding(args.User.Value, ent))
|
||||
return;
|
||||
|
||||
TryGrantAccess((ent, spellStorage), args.User.Value);
|
||||
}
|
||||
|
||||
private void OnClothingAddedAttune(Entity<CP14SpellStorageAccessWearingComponent> ent, ref AddedAttuneToMindEvent args)
|
||||
{
|
||||
if (!ent.Comp.Wearing)
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
|
||||
return;
|
||||
|
||||
if (args.User is null)
|
||||
return;
|
||||
|
||||
if (!TryComp<ClothingComponent>(ent, out var clothing))
|
||||
return;
|
||||
|
||||
if (Transform(ent).ParentUid != args.User)
|
||||
return;
|
||||
|
||||
TryGrantAccess((ent, spellStorage), args.User.Value);
|
||||
}
|
||||
|
||||
private void OnClothingEquipped(Entity<CP14SpellStorageAccessWearingComponent> ent, ref ClothingGotEquippedEvent args)
|
||||
{
|
||||
ent.Comp.Wearing = true;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Content.Shared._CP14.MagicAttuning;
|
||||
using Content.Shared._CP14.MagicSpell.Components;
|
||||
using Content.Shared._CP14.MagicSpell.Events;
|
||||
using Content.Shared._CP14.MagicSpellStorage.Components;
|
||||
@@ -18,7 +17,6 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
|
||||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
[Dependency] private readonly CP14SharedMagicAttuningSystem _attuning = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||
[Dependency] private readonly INetManager _net = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
@@ -31,7 +29,6 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
|
||||
SubscribeLocalEvent<CP14SpellStorageComponent, ComponentShutdown>(OnMagicStorageShutdown);
|
||||
|
||||
SubscribeLocalEvent<CP14SpellStorageUseDamageComponent, CP14SpellFromSpellStorageUsedEvent>(OnSpellUsed);
|
||||
SubscribeLocalEvent<CP14SpellStorageRequireAttuneComponent, RemovedAttuneFromMindEvent>(OnRemovedAttune);
|
||||
}
|
||||
|
||||
private void OnSpellUsed(Entity<CP14SpellStorageUseDamageComponent> ent, ref CP14SpellFromSpellStorageUsedEvent args)
|
||||
@@ -81,21 +78,7 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
|
||||
if (mind.OwnedEntity is null)
|
||||
return false;
|
||||
|
||||
if (TryComp<CP14SpellStorageRequireAttuneComponent>(storage, out var reqAttune))
|
||||
{
|
||||
if (!_attuning.IsAttunedTo(mindId, storage))
|
||||
return false;
|
||||
}
|
||||
|
||||
_actions.GrantActions(user, storage.Comp.SpellEntities, storage);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnRemovedAttune(Entity<CP14SpellStorageRequireAttuneComponent> ent, ref RemovedAttuneFromMindEvent args)
|
||||
{
|
||||
if (args.User is null)
|
||||
return;
|
||||
|
||||
_actions.RemoveProvidedActions(args.User.Value, ent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Content.Shared._CP14.MagicSpellStorage.Components;
|
||||
|
||||
/// <summary>
|
||||
/// The ability to access spellcasting is limited by the attuning requirement
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SpellStorageSystem))]
|
||||
public sealed partial class CP14SpellStorageRequireAttuneComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._CP14.RoundStatistic;
|
||||
|
||||
[Prototype("statisticTracker")]
|
||||
public sealed partial class CP14RoundStatTrackerPrototype : IPrototype
|
||||
{
|
||||
[IdDataField] public string ID { get; } = default!;
|
||||
|
||||
[DataField(required: true)]
|
||||
public LocId Text;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Content.Shared._CP14.WorldSprite;
|
||||
|
||||
public enum WorldSpriteVisualLayers : byte
|
||||
{
|
||||
Layer,
|
||||
}
|
||||
@@ -1165,7 +1165,7 @@ ent-CP14ClothingShoesArtifactFrogs = жаботапы
|
||||
|
||||
ent-CP14Mist = облако
|
||||
|
||||
ent-CP14SkyLightning = освещение неба
|
||||
ent-CP14SkyLightning = молния с небес
|
||||
|
||||
ent-CP14DemiplaneEntryPointMarker = точка входа в демиплан
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
- type: entity
|
||||
id: CP14SalarySpawner
|
||||
categories: [ ForkFiltered ]
|
||||
parent: BaseItem
|
||||
name: station salary spawner
|
||||
components:
|
||||
- type: CP14SalarySpawner
|
||||
- type: Sprite
|
||||
layers:
|
||||
- sprite: /Textures/_CP14/Objects/Economy/jewelry.rsi
|
||||
state: ruby1
|
||||
@@ -57,8 +57,6 @@
|
||||
delay: 3 # 5m to full restore
|
||||
- type: CP14MagicUnsafeDamage
|
||||
- type: CP14MagicUnsafeSleep
|
||||
- type: CP14MagicAttuningMind
|
||||
autoCopyToMind: true
|
||||
|
||||
|
||||
- type: entity
|
||||
|
||||
@@ -55,8 +55,6 @@
|
||||
collection: MetalThud
|
||||
cPAnimationLength: 0.3
|
||||
cPAnimationOffset: -1.3
|
||||
- type: CP14SpellStorageRequireAttune
|
||||
- type: CP14MagicAttuningItem
|
||||
- type: CP14SpellStorageAccessHolding
|
||||
- type: CP14SpellStorage
|
||||
spells:
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
- CP14BaseTownAlerts
|
||||
- BaseStationRecords # Required for lobby manifest + cryo leave
|
||||
- CP14BaseStationCommonObjectives
|
||||
- CP14BaseStationSalary
|
||||
- CP14BaseStationDemiplaneMap
|
||||
|
||||
- type: entity
|
||||
@@ -17,15 +16,6 @@
|
||||
components:
|
||||
- type: CP14StationCommonObjectives
|
||||
|
||||
- type: entity
|
||||
id: CP14BaseStationSalary
|
||||
abstract: true
|
||||
components:
|
||||
- type: CP14StationSalary
|
||||
#frequency: every 20 minutes
|
||||
salary:
|
||||
CP14Guard: 550
|
||||
|
||||
- type: entity
|
||||
id: CP14BaseTownAlerts
|
||||
abstract: true
|
||||
|
||||
@@ -19,14 +19,8 @@
|
||||
id: CP14RoundObjectivesRule
|
||||
parent: CP14BaseGameRule
|
||||
components:
|
||||
#- type: CP14CommonObjectivesRule
|
||||
# departmentObjectives:
|
||||
# CP14Command:
|
||||
# - CP14TownSendObjectiveGroup
|
||||
- type: CP14PersonalObjectivesRule
|
||||
roleObjectives:
|
||||
CP14Guildmaster:
|
||||
- CP14GuildmasterNoDemiplaneObjectiveGroup
|
||||
CP14Adventurer:
|
||||
- CP14PersonalCurrencyCollectObjectiveGroup
|
||||
CP14Alchemist:
|
||||
@@ -37,8 +31,6 @@
|
||||
- CP14PersonalCurrencyCollectObjectiveGroup
|
||||
CP14Innkeeper:
|
||||
- CP14PersonalCurrencyCollectObjectiveGroup
|
||||
CP14Merchant:
|
||||
- CP14PersonalObjectiveRichestMerchantGroup
|
||||
|
||||
# event schedulers
|
||||
|
||||
|
||||
@@ -53,25 +53,4 @@
|
||||
weights:
|
||||
CP14TownSendDinoObjective: 1
|
||||
CP14TownSendMoleObjective: 1
|
||||
CP14TownSendBoarObjective: 1
|
||||
|
||||
# No Demiplane death objective
|
||||
- type: entity
|
||||
parent: CP14BaseTownObjective
|
||||
id: CP14GuildmasterNoDemiplaneDeathObjective
|
||||
components:
|
||||
- type: CP14StatisticRangeCondition
|
||||
statistic: DemiplaneDeaths
|
||||
range:
|
||||
min: 0
|
||||
max: 3 #TODO Adaptive to player count
|
||||
objectiveText: cp14-objective-no-demiplane-death-title
|
||||
objectiveDescription: cp14-objective-no-demiplane-death-desc
|
||||
objectiveSprite:
|
||||
sprite: /Textures/_CP14/Objects/ModularTools/Blade/Shovel/metall_shovel.rsi
|
||||
state: tool
|
||||
|
||||
- type: weightedRandom
|
||||
id: CP14GuildmasterNoDemiplaneObjectiveGroup
|
||||
weights:
|
||||
CP14GuildmasterNoDemiplaneDeathObjective: 1
|
||||
CP14TownSendBoarObjective: 1
|
||||
@@ -36,22 +36,4 @@
|
||||
- type: weightedRandom
|
||||
id: CP14PersonalCurrencyCollectObjectiveGroup
|
||||
weights:
|
||||
CP14PersonalCurrencyCollectObjective: 1
|
||||
|
||||
#Richest merchant objective
|
||||
- type: entity
|
||||
parent: CP14BasePersonalObjective
|
||||
id: CP14PersonalObjectiveRichestMerchant
|
||||
components:
|
||||
- type: CP14RichestJobCondition
|
||||
job: CP14Merchant
|
||||
objectiveText: cp14-objective-personal-richest-merchant-title
|
||||
objectiveDescription: cp14-objective-personal-richest-merchant-desc
|
||||
objectiveSprite:
|
||||
sprite: /Textures/_CP14/Objects/Economy/pp_coin.rsi
|
||||
state: coin10
|
||||
|
||||
- type: weightedRandom
|
||||
id: CP14PersonalObjectiveRichestMerchantGroup
|
||||
weights:
|
||||
CP14PersonalObjectiveRichestMerchant: 1
|
||||
CP14PersonalCurrencyCollectObjective: 1
|
||||
@@ -29,7 +29,6 @@
|
||||
- type: CP14MagicEnergyDraw
|
||||
- type: CP14MagicUnsafeDamage
|
||||
- type: CP14MagicUnsafeSleep
|
||||
- type: CP14MagicAttuningMind
|
||||
|
||||
# -1
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#- type: entity
|
||||
# parent: BaseItem
|
||||
# id: CP14DebugWorldSprite
|
||||
# name: strange copper bar
|
||||
# suffix: CP, DEBUG
|
||||
# categories: [ ForkFiltered ]
|
||||
# components:
|
||||
# # Just copy me, I am block with name Bob
|
||||
# - type: Appearance
|
||||
# - type: CP14WorldSprite
|
||||
# - type: GenericVisualizer
|
||||
# visuals:
|
||||
# enum.WorldSpriteVisualLayers.Layer:
|
||||
# world:
|
||||
# True:
|
||||
# visible: true
|
||||
# False:
|
||||
# visible: false
|
||||
# content:
|
||||
# True:
|
||||
# visible: false
|
||||
# False:
|
||||
# visible: true
|
||||
# # Just copy me, I am block with name Bob
|
||||
#
|
||||
# - type: Sprite
|
||||
# sprite: /Textures/_CP14/Objects/Materials/copper_bar.rsi
|
||||
# layers:
|
||||
# - map: ["world"]
|
||||
# state: bar
|
||||
# - map: ["content"]
|
||||
# state: bar_2
|
||||
#
|
||||
@@ -1,7 +0,0 @@
|
||||
- type: statisticTracker
|
||||
id: DemiplaneOpen
|
||||
text: cp14-tracker-demiplane-open
|
||||
|
||||
- type: statisticTracker
|
||||
id: DemiplaneDeaths
|
||||
text: cp14-tracker-demiplane-deaths
|
||||
Reference in New Issue
Block a user