Use Transform instead of TryComp<TransformComponent> (#32170)
Use Transform instead of TryComp
This commit is contained in:
@@ -36,8 +36,10 @@ public sealed class GravityGeneratorSystem : EntitySystem
|
||||
private void OnActivated(Entity<GravityGeneratorComponent> ent, ref ChargedMachineActivatedEvent args)
|
||||
{
|
||||
ent.Comp.GravityActive = true;
|
||||
if (TryComp<TransformComponent>(ent, out var xform) &&
|
||||
TryComp(xform.ParentUid, out GravityComponent? gravity))
|
||||
|
||||
var xform = Transform(ent);
|
||||
|
||||
if (TryComp(xform.ParentUid, out GravityComponent? gravity))
|
||||
{
|
||||
_gravitySystem.EnableGravity(xform.ParentUid, gravity);
|
||||
}
|
||||
@@ -46,8 +48,10 @@ public sealed class GravityGeneratorSystem : EntitySystem
|
||||
private void OnDeactivated(Entity<GravityGeneratorComponent> ent, ref ChargedMachineDeactivatedEvent args)
|
||||
{
|
||||
ent.Comp.GravityActive = false;
|
||||
if (TryComp<TransformComponent>(ent, out var xform) &&
|
||||
TryComp(xform.ParentUid, out GravityComponent? gravity))
|
||||
|
||||
var xform = Transform(ent);
|
||||
|
||||
if (TryComp(xform.ParentUid, out GravityComponent? gravity))
|
||||
{
|
||||
_gravitySystem.RefreshGravity(xform.ParentUid, gravity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user