More (IComponent) shenanigans and also some contaminated IoCManager.Resolve<IEntityManager>() very long yes calls

This commit is contained in:
metalgearsloth
2021-12-07 22:22:34 +11:00
parent 373b5988d7
commit 8af335097f
55 changed files with 176 additions and 172 deletions

View File

@@ -57,7 +57,7 @@ public class LungSystem : EntitySystem
if (!Resolve(uid, ref lung, ref mech))
return;
if (mech.Body != null && EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out MobStateComponent? mobState) && mobState.IsCritical())
if (mech.Body != null && EntityManager.TryGetComponent((mech.Body).Owner, out MobStateComponent? mobState) && mobState.IsCritical())
{
return;
}
@@ -111,7 +111,7 @@ public class LungSystem : EntitySystem
// TODO Jesus Christ make this event based.
if (mech.Body != null &&
EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out InternalsComponent? internals) &&
EntityManager.TryGetComponent((mech.Body).Owner, out InternalsComponent? internals) &&
internals.BreathToolEntity != null &&
internals.GasTankEntity != null &&
IoCManager.Resolve<IEntityManager>().TryGetComponent(internals.BreathToolEntity, out BreathToolComponent? breathTool) &&
@@ -148,7 +148,7 @@ public class LungSystem : EntitySystem
if (mech.Body == null)
return;
if (!EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out BloodstreamComponent? bloodstream))
if (!EntityManager.TryGetComponent((mech.Body).Owner, out BloodstreamComponent? bloodstream))
return;
var to = bloodstream.Air;
@@ -189,10 +189,10 @@ public class LungSystem : EntitySystem
if (mech.Body == null)
return;
if (!EntityManager.TryGetComponent(((IComponent) mech.Body).Owner, out BloodstreamComponent? bloodstream))
if (!EntityManager.TryGetComponent((mech.Body).Owner, out BloodstreamComponent? bloodstream))
return;
_bloodstreamSystem.PumpToxins(((IComponent) mech.Body).Owner, lung.Air, bloodstream);
_bloodstreamSystem.PumpToxins((mech.Body).Owner, lung.Air, bloodstream);
var lungRemoved = lung.Air.RemoveRatio(0.5f);
_atmosSys.Merge(to, lungRemoved);