public static int AvailableMedicalRoomsCount(long playerId) { int ret = 0; List <MyCubeGrid> cubeGrids = MyEntities.GetEntities().OfType <MyCubeGrid>().ToList(); foreach (var grid in cubeGrids) { grid.GridSystems.UpdatePower(); foreach (var slimBlock in grid.GetBlocks()) { MyMedicalRoom medicalRoom = slimBlock.FatBlock as MyMedicalRoom; if (medicalRoom != null) { medicalRoom.UpdateIsWorking(); if (medicalRoom.IsWorking && medicalRoom.HasPlayerAccess(playerId)) { ret++; } } } } return(ret); }
public override void Use(UseActionEnum actionEnum, IMyEntity entity) { var user = entity as MyCharacter; var relation = Block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId); if (!relation.IsFriendly()) { if (user.ControllerInfo.IsLocallyHumanControlled()) { MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied); } return; } switch (actionEnum) { case UseActionEnum.Manipulate: if (Block is MyMedicalRoom) { MyMedicalRoom medRoom = (MyMedicalRoom)Block; if (!medRoom.SuitChangeAllowed) { MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied); break; } if (medRoom.CustomWardrobesEnabled) { MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = new MyGuiScreenWardrobe(user, medRoom.CustomWardrobeNames)); break; } } MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = new MyGuiScreenWardrobe(user)); break; } }
public MyUseObjectMedicalRoom(IMyEntity owner, string dummyName, MyModelDummy dummyData, uint key) { m_medicalRoom = (MyMedicalRoom)owner; m_localMatrix = dummyData.Matrix; }
public SyncClass(MyMedicalRoom block) { m_block = block; }
private static StringBuilder GetOwnerDisplayName(MyMedicalRoom medRoom) { long owner = medRoom.IDModule.Owner; if (owner == 0) return MyTexts.Get(MySpaceTexts.BlockOwner_Nobody); var identity = Sync.Players.TryGetIdentity(owner); if (identity != null) return new StringBuilder(identity.DisplayName); else return MyTexts.Get(MySpaceTexts.BlockOwner_Unknown); }
private static void StartSurprise(object senderEvent) { BoundingSphereD sphere = new BoundingSphereD(new Vector3D(-18.75f, -2.5f, -1.25f), 2); m_getEntities.Clear(); MyGamePruningStructure.GetAllEntitiesInSphere(ref sphere, m_getEntities); m_spawnMedical = null; foreach (var entity in m_getEntities) { m_spawnMedical = entity as MyMedicalRoom; if (m_spawnMedical != null) { m_spawnMedical.OnClose += delegate { m_spawnMedical = null; }; break; } } m_started = true; }
protected override void UnloadData() { m_getEntities.Clear(); m_lemmings.Clear(); m_timeToNextSpawn = -1; m_timeToNextChange = -1; m_spawnMedical = null; m_spawnCount = SPAWN_COUNT; MyLemmingCharacter.Positions.Clear(); m_started = false; m_globalEvent = null; m_timeToEnd = LIFE_TIME; if (m_notification != null) { MyHud.Notifications.Remove(m_notification); m_notification = null; } base.UnloadData(); }
public MyUseObjectMedicalRoom(MyCubeBlock owner, string dummyName, MyModelDummy dummyData, int key) { m_medicalRoom = (MyMedicalRoom)owner; m_localMatrix = dummyData.Matrix; }