Fucking big refactor

This commit is contained in:
Ed
2024-04-20 11:51:04 +03:00
parent 1eba437555
commit ca01030da1
98 changed files with 610 additions and 555 deletions

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Audio;
public sealed class ContentAudioSystem : SharedContentAudioSystem
{
[ValidatePrototypeId<SoundCollectionPrototype>]
private const string LobbyMusicCollection = "CPLobbyMusic";
private const string LobbyMusicCollection = "CP14LobbyMusic";
[Dependency] private readonly AudioSystem _serverAudio = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Damage.Systems
//CrystallPunk Melee upgrade
var damage = component.Damage;
if (TryComp<CPSharpenedComponent>(uid, out var sharp))
if (TryComp<CP14SharpenedComponent>(uid, out var sharp))
damage *= sharp.Sharpness;
var dmg = _damageable.TryChangeDamage(args.Target, damage, component.IgnoreResistances, origin: args.Component.Thrower);
@@ -69,7 +69,7 @@ namespace Content.Server.Damage.Systems
{
var damage = component.Damage;
if (TryComp<CPSharpenedComponent>(uid, out var sharp))
if (TryComp<CP14SharpenedComponent>(uid, out var sharp))
damage *= sharp.Sharpness;
_damageExamine.AddDamageExamine(args.Message, damage, Loc.GetString("damage-throw"));

View File

@@ -1,9 +1,9 @@
using System.Diagnostics.CodeAnalysis;
using Content.Server._CP14.LockKey;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Systems;
using Content.Server.Construction;
using Content.Server.Construction.Components;
using Content.Server.CrystallPunk.LockKey;
using Content.Server.Storage.Components;
using Content.Shared.Destructible;
using Content.Shared.Explosion;
@@ -37,7 +37,7 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem
SubscribeLocalEvent<EntityStorageComponent, EntityUnpausedEvent>(OnEntityUnpausedEvent);
SubscribeLocalEvent<EntityStorageComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<EntityStorageComponent, ComponentStartup>(OnComponentStartup);
SubscribeLocalEvent<EntityStorageComponent, ActivateInWorldEvent>(OnInteract, after: new[] { typeof(LockSystem), typeof(KeyholeGenerationSystem) });
SubscribeLocalEvent<EntityStorageComponent, ActivateInWorldEvent>(OnInteract, after: new[] { typeof(LockSystem), typeof(CP14KeyholeGenerationSystem) });
SubscribeLocalEvent<EntityStorageComponent, LockToggleAttemptEvent>(OnLockToggleAttempt);
SubscribeLocalEvent<EntityStorageComponent, DestructionEventArgs>(OnDestruction);
SubscribeLocalEvent<EntityStorageComponent, GetVerbsEvent<InteractionVerb>>(AddToggleOpenVerb);

View File

@@ -1,21 +1,18 @@
using System.Linq;
using Content.Server.GameTicking.Events;
using Content.Shared._CP14.LockKey;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.CrystallPunk.LockKey;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Lock;
using Content.Shared.Verbs;
using Content.Shared.Popups;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using CP14KeyComponent = Content.Shared._CP14.LockKey.Components.CP14KeyComponent;
using CP14LockComponent = Content.Shared._CP14.LockKey.Components.CP14LockComponent;
namespace Content.Server.CrystallPunk.LockKey;
namespace Content.Server._CP14.LockKey;
public sealed partial class KeyholeGenerationSystem : EntitySystem
public sealed partial class CP14KeyholeGenerationSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
@@ -23,7 +20,7 @@ public sealed partial class KeyholeGenerationSystem : EntitySystem
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
[Dependency] private readonly LockSystem _lock = default!;
private Dictionary<ProtoId<CPLockCategoryPrototype>, List<int>> _roundKeyData = new();
private Dictionary<ProtoId<CP14LockCategoryPrototype>, List<int>> _roundKeyData = new();
private const int DepthCompexity = 2;
@@ -33,10 +30,10 @@ public sealed partial class KeyholeGenerationSystem : EntitySystem
SubscribeLocalEvent<RoundStartingEvent>(OnRoundStart);
SubscribeLocalEvent<CPLockComponent, MapInitEvent>(OnLockInit);
SubscribeLocalEvent<CPKeyComponent, MapInitEvent>(OnKeyInit);
SubscribeLocalEvent<CP14LockComponent, MapInitEvent>(OnLockInit);
SubscribeLocalEvent<CP14KeyComponent, MapInitEvent>(OnKeyInit);
SubscribeLocalEvent<CPKeyComponent, ExaminedEvent>(OnKeyExamine);
SubscribeLocalEvent<CP14KeyComponent, ExaminedEvent>(OnKeyExamine);
}
#region Init
@@ -45,7 +42,7 @@ public sealed partial class KeyholeGenerationSystem : EntitySystem
_roundKeyData = new();
}
private void OnKeyInit(Entity<CPKeyComponent> keyEnt, ref MapInitEvent args)
private void OnKeyInit(Entity<CP14KeyComponent> keyEnt, ref MapInitEvent args)
{
if (keyEnt.Comp.AutoGenerateShape != null)
{
@@ -53,7 +50,7 @@ public sealed partial class KeyholeGenerationSystem : EntitySystem
}
}
private void OnLockInit(Entity<CPLockComponent> lockEnt, ref MapInitEvent args)
private void OnLockInit(Entity<CP14LockComponent> lockEnt, ref MapInitEvent args)
{
if (lockEnt.Comp.AutoGenerateShape != null)
{
@@ -62,7 +59,7 @@ public sealed partial class KeyholeGenerationSystem : EntitySystem
}
#endregion
private void OnKeyExamine(Entity<CPKeyComponent> key, ref ExaminedEvent args)
private void OnKeyExamine(Entity<CP14KeyComponent> key, ref ExaminedEvent args)
{
var parent = Transform(key).ParentUid;
if (parent != args.Examiner)
@@ -81,7 +78,7 @@ public sealed partial class KeyholeGenerationSystem : EntitySystem
args.PushMarkup(markup);
}
private List<int> GetKeyLockData(ProtoId<CPLockCategoryPrototype> category)
private List<int> GetKeyLockData(ProtoId<CP14LockCategoryPrototype> category)
{
if (_roundKeyData.ContainsKey(category))
return _roundKeyData[category];
@@ -93,7 +90,7 @@ public sealed partial class KeyholeGenerationSystem : EntitySystem
}
}
private List<int> GenerateNewUniqueLockData(ProtoId<CPLockCategoryPrototype> category)
private List<int> GenerateNewUniqueLockData(ProtoId<CP14LockCategoryPrototype> category)
{
List<int> newKeyData = new List<int>();
var categoryData = _proto.Index(category);

View File

@@ -4,8 +4,8 @@ namespace Content.Server._CP14.MeleeWeapon;
/// <summary>
/// allows the object to become blunt with use
/// </summary>
[RegisterComponent, Access(typeof(CPSharpeningSystem))]
public sealed partial class CPSharpenedComponent : Component
[RegisterComponent, Access(typeof(CP14SharpeningSystem))]
public sealed partial class CP14SharpenedComponent : Component
{
[DataField]
public float Sharpness = 1f;

View File

@@ -6,8 +6,8 @@ namespace Content.Server._CP14.MeleeWeapon;
/// <summary>
/// component allows you to sharpen objects by restoring their damage.
/// </summary>
[RegisterComponent, Access(typeof(CPSharpeningSystem))]
public sealed partial class CPSharpeningStoneComponent : Component
[RegisterComponent, Access(typeof(CP14SharpeningSystem))]
public sealed partial class CP14SharpeningStoneComponent : Component
{
/// <summary>
/// the amount of acuity recoverable per use

View File

@@ -10,7 +10,7 @@ using Robust.Shared.Audio.Systems;
namespace Content.Server._CP14.MeleeWeapon;
public sealed class CPSharpeningSystem : EntitySystem
public sealed class CP14SharpeningSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly UseDelaySystem _useDelay = default!;
@@ -20,15 +20,15 @@ public sealed class CPSharpeningSystem : EntitySystem
{
base.Initialize();
SubscribeLocalEvent<CPSharpenedComponent, GetMeleeDamageEvent>(OnGetMeleeDamage, after: new[] { typeof(WieldableSystem) });
SubscribeLocalEvent<CPSharpenedComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<CPSharpenedComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<CP14SharpenedComponent, GetMeleeDamageEvent>(OnGetMeleeDamage, after: new[] { typeof(WieldableSystem) });
SubscribeLocalEvent<CP14SharpenedComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<CP14SharpenedComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<CPSharpeningStoneComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<CPSharpeningStoneComponent, ActivateInWorldEvent>(OnInteract);
SubscribeLocalEvent<CP14SharpeningStoneComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<CP14SharpeningStoneComponent, ActivateInWorldEvent>(OnInteract);
}
private void OnMeleeHit(Entity<CPSharpenedComponent> sharpened, ref MeleeHitEvent args)
private void OnMeleeHit(Entity<CP14SharpenedComponent> sharpened, ref MeleeHitEvent args)
{
if (!args.HitEntities.Any())
return;
@@ -36,7 +36,7 @@ public sealed class CPSharpeningSystem : EntitySystem
sharpened.Comp.Sharpness = MathHelper.Clamp(sharpened.Comp.Sharpness - sharpened.Comp.SharpnessDamageByHit, 0.1f, 1f);
}
private void OnInteract(Entity<CPSharpeningStoneComponent> stone, ref ActivateInWorldEvent args)
private void OnInteract(Entity<CP14SharpeningStoneComponent> stone, ref ActivateInWorldEvent args)
{
if (args.Handled)
return;
@@ -49,7 +49,7 @@ public sealed class CPSharpeningSystem : EntitySystem
foreach (var item in itemPlacer.PlacedEntities)
{
if (!TryComp<CPSharpenedComponent>(item, out var sharpened))
if (!TryComp<CP14SharpenedComponent>(item, out var sharpened))
continue;
SharpThing(stone, item, sharpened);
@@ -57,9 +57,9 @@ public sealed class CPSharpeningSystem : EntitySystem
}
}
private void OnAfterInteract(Entity<CPSharpeningStoneComponent> stone, ref AfterInteractEvent args)
private void OnAfterInteract(Entity<CP14SharpeningStoneComponent> stone, ref AfterInteractEvent args)
{
if (!args.CanReach || args.Target == null || !TryComp<CPSharpenedComponent>(args.Target, out var sharpened))
if (!args.CanReach || args.Target == null || !TryComp<CP14SharpenedComponent>(args.Target, out var sharpened))
return;
if (TryComp<UseDelayComponent>(stone, out var useDelay) && _useDelay.IsDelayed( new Entity<UseDelayComponent>(stone, useDelay)))
@@ -68,7 +68,7 @@ public sealed class CPSharpeningSystem : EntitySystem
SharpThing(stone, args.Target.Value, sharpened);
}
private void SharpThing(Entity<CPSharpeningStoneComponent> stone, EntityUid target, CPSharpenedComponent component)
private void SharpThing(Entity<CP14SharpeningStoneComponent> stone, EntityUid target, CP14SharpenedComponent component)
{
_audio.PlayPvs(stone.Comp.SharpeningSound, target);
Spawn("EffectSparks", Transform(target).Coordinates);
@@ -81,7 +81,7 @@ public sealed class CPSharpeningSystem : EntitySystem
_useDelay.TryResetDelay(stone);
}
private void OnExamined(Entity<CPSharpenedComponent> sharpened, ref ExaminedEvent args)
private void OnExamined(Entity<CP14SharpenedComponent> sharpened, ref ExaminedEvent args)
{
if (sharpened.Comp.Sharpness > 0.95f)
@@ -104,7 +104,7 @@ public sealed class CPSharpeningSystem : EntitySystem
args.PushMarkup(Loc.GetString("sharpening-examined-25"));
}
private void OnGetMeleeDamage(Entity<CPSharpenedComponent> sharpened, ref GetMeleeDamageEvent args)
private void OnGetMeleeDamage(Entity<CP14SharpenedComponent> sharpened, ref GetMeleeDamageEvent args)
{
args.Damage *= sharpened.Comp.Sharpness;
}

View File

@@ -1,14 +1,14 @@
using Content.Shared.Parallax.Biomes;
using Robust.Shared.Prototypes;
namespace Content.Server.CrystallPunk.SpawnMapBiome;
namespace Content.Server._CP14.StationBiome;
/// <summary>
/// allows you to initialize a planet on a specific map at initialization time.
/// </summary>
[RegisterComponent, Access(typeof(StationBiomeSystem))]
public sealed partial class StationBiomeComponent : Component
[RegisterComponent, Access(typeof(CP14StationBiomeSystem))]
public sealed partial class CP14StationBiomeComponent : Component
{
[DataField]
public ProtoId<BiomeTemplatePrototype> Biome = "Grasslands";

View File

@@ -5,8 +5,8 @@ using Content.Server.Station.Systems;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Server.CrystallPunk.SpawnMapBiome;
public sealed partial class StationBiomeSystem : EntitySystem
namespace Content.Server._CP14.StationBiome;
public sealed partial class CP14StationBiomeSystem : EntitySystem
{
[Dependency] private readonly BiomeSystem _biome = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
@@ -16,10 +16,10 @@ public sealed partial class StationBiomeSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<StationBiomeComponent, StationPostInitEvent>(OnStationPostInit);
SubscribeLocalEvent<CP14StationBiomeComponent, StationPostInitEvent>(OnStationPostInit);
}
private void OnStationPostInit(Entity<StationBiomeComponent> map, ref StationPostInitEvent args)
private void OnStationPostInit(Entity<CP14StationBiomeComponent> map, ref StationPostInitEvent args)
{
if (!TryComp(map, out StationDataComponent? dataComp))
return;