public Vector2 PowerOutput() { if (IsClosed()) { return(Vector2.Zero); } if (IsParentEntityGrid) { var grid = ParentEntity as IMyCubeGrid; if (grid == null) { return(Vector2.Zero); } return(EntityEvaluator.GridPowerOutput(LinkedGrids)); } else { var character = ParentEntity as IMyCharacter; if (character == null) { return(Vector2.Zero); } if (MyVisualScriptLogicProvider.GetPlayersEnergyLevel(Player.IdentityId) < 1) { return(Vector2.Zero); } return(new Vector2(0.009f, 0.009f)); } }
public static OwnerTypeEnum GetOwnersFromList(List <long> owners) { var result = OwnerTypeEnum.Unowned; if (owners.Count == 0) { return(result); } foreach (var owner in owners) { if (EntityEvaluator.IsIdentityNPC(owner)) { result |= OwnerTypeEnum.NPC; result &= ~OwnerTypeEnum.Unowned; } else { result |= OwnerTypeEnum.Player; result &= ~OwnerTypeEnum.Unowned; } } return(result); }
public Vector2 PowerOutput() { if (IsClosed()) { return(Vector2.Zero); } if (IsParentEntityGrid) { var grid = ParentEntity as IMyCubeGrid; if (grid == null) { return(Vector2.Zero); } var result = EntityEvaluator.GridPowerOutput(LinkedGrids); if (result.Y > 0) { return(result); } if (!IsParentEntitySeat) { return(Vector2.Zero); } var controller = Entity as IMyCockpit; if (controller?.Pilot == null) { return(Vector2.Zero); } if (controller.Pilot.SuitEnergyLevel < 0.01) { return(Vector2.Zero); } return(new Vector2(0.009f, 0.009f)); } else { var character = ParentEntity as IMyCharacter; if (character == null) { return(Vector2.Zero); } if (character.SuitEnergyLevel < 0.01) { return(Vector2.Zero); } return(new Vector2(0.009f, 0.009f)); } }
public int MovementScore() { if (!ActiveEntity()) { return(0); } return(EntityEvaluator.GridMovementScore(LinkedGrids)); }
public Vector2 PowerOutput() { if (!ActiveEntity()) { return(Vector2.Zero); } return(EntityEvaluator.GridPowerOutput(LinkedGrids)); }
public int WeaponCount() { if (!ActiveEntity()) { return(0); } return(EntityEvaluator.GridWeaponCount(LinkedGrids)); }
public float TargetValue() { if (!ActiveEntity()) { return(0); } return(EntityEvaluator.GridTargetValue(LinkedGrids)); }
public bool InSafeZone() { if (Entity?.PositionComp == null) { return(false); } return(EntityEvaluator.IsPositionInSafeZone(Entity.PositionComp.WorldAABB.Center)); }
public double CurrentAltitude() { if (Entity?.PositionComp == null) { return(0); } return(EntityEvaluator.AltitudeAtPosition(Entity.PositionComp.WorldAABB.Center)); }
public double BroadcastRange(bool onlyAntenna = false) { if (!ActiveEntity()) { return(0); } return(EntityEvaluator.GridBroadcastRange(LinkedGrids)); }
public double CurrentGravity() { if (Entity?.PositionComp == null) { return(0); } return(EntityEvaluator.GravityAtPosition(Entity.PositionComp.WorldAABB.Center)); }
public void RefreshSubGrids() { if (IsParentEntityGrid) { var grid = ParentEntity as IMyCubeGrid; if (grid == null) { return; } LinkedGrids = EntityEvaluator.GetAttachedGrids(grid); } }
public bool PlayerControlled() { foreach (var grid in LinkedGrids) { if (!grid.ActiveEntity()) { continue; } if (EntityEvaluator.IsPlayerControlled(grid)) { return(true); } } return(false); }
public int WeaponCount() { if (IsParentEntityGrid) { var grid = ParentEntity as IMyCubeGrid; if (grid == null) { return(0); } return(EntityEvaluator.GridWeaponCount(EntityEvaluator.GetAttachedGrids(grid))); } else { var character = ParentEntity as IMyCharacter; if (character == null) { return(0); } float count = 0; if (!character.HasInventory) { return(0); } var items = new List <VRage.Game.ModAPI.Ingame.MyInventoryItem>(); character.GetInventory().GetItems(items); foreach (var item in items) { if (item.Type.TypeId.EndsWith("PhysicalGunObject")) { count++; continue; } } } return(0); }
public bool IsPowered() { if (IsClosed() || !Functional) { return(false); } if (FunctionalBlock != null) { if (Enabled) { return(Working && Functional); } else { return(EntityEvaluator.GridPowered(LinkedGrids)); } } return(Working && Functional); }
public double BroadcastRange(bool onlyAntenna = false) { if (IsClosed()) { return(0); } if (IsParentEntityGrid) { var grid = ParentEntity as IMyCubeGrid; if (grid == null) { return(0); } return(EntityEvaluator.GridBroadcastRange(LinkedGrids)); } else { var character = ParentEntity as IMyCharacter; if (character == null) { return(0); } var controlledEntity = character as Sandbox.Game.Entities.IMyControllableEntity; if (controlledEntity == null || !controlledEntity.EnabledBroadcasting) { return(0); } return(200); //200 is max range of suit antenna } }
public OwnerTypeEnum OwnerTypes(bool onlyGetCurrentEntity = false, bool includeMinorityOwners = false) { var owners = GetOwners(onlyGetCurrentEntity, includeMinorityOwners); return(EntityEvaluator.GetOwnersFromList(owners)); }
public double BroadcastRange(bool onlyAntenna = false) { return(EntityEvaluator.GridBroadcastRange(LinkedGrids, onlyAntenna)); }
//--------------------------------------------------- //-----------Start Interface Methods----------------- //--------------------------------------------------- public Vector3D CurrentAcceleration() { return(EntityEvaluator.EntityAcceleration(ParentEntity)); }
public virtual bool ProtectedByShields() { return(EntityEvaluator.EntityShielded(Entity)); }
public double MaxSpeed() { return(EntityEvaluator.EntityMaxSpeed(ParentEntity)); }
public Vector2 PowerOutput() { return(EntityEvaluator.GridPowerOutput(LinkedGrids)); }
public float TargetValue() { if (IsClosed()) { return(0); } if (IsParentEntityGrid) { var grid = ParentEntity as IMyCubeGrid; if (grid == null) { return(0); } return(EntityEvaluator.GridTargetValue(LinkedGrids)); } else { var character = ParentEntity as IMyCharacter; if (character == null) { return(0); } float threat = 0; if (!character.HasInventory) { return(0); } var items = new List <VRage.Game.ModAPI.Ingame.MyInventoryItem>(); character.GetInventory().GetItems(items); foreach (var item in items) { if (item.Type.TypeId.EndsWith("PhysicalGunObject")) { threat += 25; continue; } if (item.Type.TypeId.EndsWith("AmmoMagazine")) { threat += 3; continue; } if (item.Type.TypeId.EndsWith("ContainerObject")) { threat += 10; continue; } } return(threat); } }
public RelationTypeEnum RelationTypes(long ownerId, bool onlyGetCurrentEntity = false, bool includeMinorityOwners = false) { var owners = GetOwners(onlyGetCurrentEntity, includeMinorityOwners); return(EntityEvaluator.GetRelationsFromList(ownerId, owners)); }
public int WeaponCount() { return(EntityEvaluator.GridWeaponCount(LinkedGrids)); }
public double CurrentSpeed() { return(EntityEvaluator.EntitySpeed(ParentEntity)); }
public void RefreshSubGrids() { LinkedGrids = EntityEvaluator.GetAttachedGrids(CubeGrid); }
public Vector3D CurrentVelocity() { return(EntityEvaluator.EntityVelocity(ParentEntity)); }
public float TargetValue() { return(EntityEvaluator.GridTargetValue(LinkedGrids)); }