1
0

OnMapGrid.cs 509 B

12345678910111213141516171819
  1. namespace Content.Shared.Random.Rules;
  2. /// <summary>
  3. /// Returns true if griduid and mapuid match (AKA on 'planet').
  4. /// </summary>
  5. public sealed partial class OnMapGridRule : RulesRule
  6. {
  7. public override bool Check(EntityManager entManager, EntityUid uid)
  8. {
  9. if (!entManager.TryGetComponent(uid, out TransformComponent? xform) ||
  10. xform.GridUid != xform.MapUid ||
  11. xform.MapUid == null)
  12. {
  13. return Inverted;
  14. }
  15. return !Inverted;
  16. }
  17. }