public void InitFromCheckpoint(MyObjectBuilder_Checkpoint checkpoint) { var cooldowns = checkpoint.RespawnCooldowns; m_lastUpdate = MySandboxGame.TotalGamePlayTimeInMilliseconds; m_globalRespawnTimesMs.Clear(); if (cooldowns == null) { return; } foreach (var item in cooldowns) { var controllerId = new MyPlayer.PlayerId() { SteamId = item.PlayerSteamId, SerialId = item.PlayerSerialId }; var key = new RespawnKey() { ControllerId = controllerId, RespawnShipId = item.RespawnShipId }; m_globalRespawnTimesMs.Add(key, item.Cooldown + m_lastUpdate, immediate: true); } }
public void UnloadDataComponents(bool beforeLoadWorld = false) { // Unload in reverse so dependencies can be relied on. for (int i = m_loadOrder.Count - 1; i >= 0; --i) { m_loadOrder[i].UnloadDataConditional(); } //foreach (var component in m_sessionComponents) //{ // component.UnloadDataConditional(); //} MySessionComponentMapping.Clear(); m_sessionComponents.Clear(); m_loadOrder.Clear(); foreach (var compList in m_sessionComponentsForUpdate.Values) { compList.Clear(); } if (!beforeLoadWorld) { Sync.Players.UnregisterEvents(); Sync.Clients.Clear(); MyNetworkReader.Clear(); } m_lasers.Clear(); Ready = false; }
protected override void UnloadData() { base.UnloadData(); m_piratesIdentityId = 0; m_definitionsByAntennaName = null; foreach (var entry in m_droneInfos) { MyEntity entity; MyEntities.TryGetEntityById(entry.Key, out entity); if (entity != null) { UnregisterDrone(entity, immediate: false); } } m_droneInfos.Clear(); m_droneInfos = null; m_pirateAntennas = null; }