Power Cell Refactor (#5943)

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
This commit is contained in:
Leon Friedrich
2022-01-05 17:20:25 +13:00
committed by GitHub
parent 4eddefdda1
commit 0aa4f9efbe
37 changed files with 673 additions and 987 deletions

View File

@@ -10,6 +10,7 @@ namespace Content.Client.Entry
"Pickaxe",
"IngestionBlocker",
"Interactable",
"Charger",
"CloningPod",
"Destructible",
"Temperature",
@@ -35,11 +36,6 @@ namespace Content.Client.Entry
"Material",
"RangedMagazine",
"Ammo",
"HitscanWeaponCapacitor",
"PowerCell",
"PowerCellCharger",
"PowerCellSlot",
"WeaponCapacitorCharger",
"AiController",
"Computer",
"AsteroidRock",

View File

@@ -16,8 +16,6 @@ namespace Content.Client.Light.Components
[Friend(typeof(HandheldLightSystem))]
public sealed class HandheldLightComponent : SharedHandheldLightComponent, IItemStatus
{
[ViewVariables] protected override bool HasCell => Level != null;
public byte? Level;
public Control MakeControl()
@@ -69,9 +67,6 @@ namespace Content.Client.Light.Components
{
base.FrameUpdate(args);
if (!_parent.HasCell)
return;
_timer += args.DeltaSeconds;
_timer %= TimerCycle;
@@ -81,7 +76,7 @@ namespace Content.Client.Light.Components
{
if (i == 0)
{
if (level == 0)
if (level == 0 || level == null)
{
_sections[0].PanelOverride = StyleBoxUnlit;
}

View File

@@ -0,0 +1,7 @@
using Content.Shared.PowerCell;
using JetBrains.Annotations;
namespace Content.Client.PowerCell;
[UsedImplicitly]
public sealed class PowerCellSystem : SharedPowerCellSystem { }

View File

@@ -23,9 +23,6 @@ namespace Content.Client.Weapons.Ranged.Barrels.Components
private StatusControl? _statusControl;
[DataField("cellSlot", required: true)]
public ItemSlot CellSlot = default!;
/// <summary>
/// Count of bullets in the magazine.
/// </summary>
@@ -35,18 +32,6 @@ namespace Content.Client.Weapons.Ranged.Barrels.Components
[ViewVariables]
public (int count, int max)? MagazineCount { get; private set; }
protected override void Initialize()
{
base.Initialize();
EntitySystem.Get<ItemSlotsSystem>().AddItemSlot(Owner, $"{Name}-powercell-container", CellSlot);
}
protected override void OnRemove()
{
base.OnRemove();
EntitySystem.Get<ItemSlotsSystem>().RemoveItemSlot(Owner, CellSlot);
}
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
base.HandleComponentState(curState, nextState);