refactor: Magic system (#1138)

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
This commit is contained in:
Tornado Tech
2025-04-15 00:32:41 +10:00
committed by GitHub
parent e7cd69e383
commit 52f31e4403
14 changed files with 266 additions and 262 deletions

View File

@@ -47,9 +47,12 @@ public partial class CP14MagicEssenceSystem : EntitySystem
private void OnPowerChanged(Entity<CP14MagicEssenceCollectorComponent> ent, ref CP14SlotCrystalPowerChangedEvent args)
{
if (args.Powered)
{
EnsureComp<CP14MagicEssenceAttractorComponent>(ent);
else
RemCompDeferred<CP14MagicEssenceAttractorComponent>(ent);
return;
}
RemCompDeferred<CP14MagicEssenceAttractorComponent>(ent);
}
private void OnCollectorCollide(Entity<CP14MagicEssenceCollectorComponent> ent, ref StartCollideEvent args)
@@ -86,7 +89,7 @@ public partial class CP14MagicEssenceSystem : EntitySystem
if (!TryComp<CP14MagicEnergyContainerComponent>(ent, out var energyContainer))
return;
_magicEnergy.ChangeEnergy(ent, -energyContainer.Energy, out _, out _, energyContainer, safe: true);
_magicEnergy.ChangeEnergy((ent, energyContainer), -energyContainer.Energy, out _, out _, safe: true);
//TODO move to server
if (_net.IsClient)