private void OnDeserialized() { if (ElementID == (SimHashes)351109216) { ElementID = SimHashes.Creature; } SanitizeMassAndTemperature(); float temperature = _Temperature; if (float.IsNaN(temperature) || float.IsInfinity(temperature) || temperature < 0f || 10000f < temperature) { DeserializeWarnings.Instance.PrimaryElementTemperatureIsNan.Warn($"{base.name} has invalid temperature of {Temperature}. Resetting temperature.", null); temperature = Element.defaultValues.temperature; } _Temperature = temperature; Temperature = temperature; if (Element == null) { DeserializeWarnings.Instance.PrimaryElementHasNoElement.Warn(base.name + "Primary element has no element.", null); } if (Mass < 0f) { DebugUtil.DevLogError(base.gameObject, "deserialized ore with less than 0 mass. Error! Destroying"); Util.KDestroyGameObject(base.gameObject); } else { if (onDataChanged != null) { onDataChanged(this); } byte index = Db.Get().Diseases.GetIndex(diseaseID); if (index == 255 || diseaseCount <= 0) { if (diseaseHandle.IsValid()) { GameComps.DiseaseContainers.Remove(base.gameObject); diseaseHandle.Clear(); } } else if (diseaseHandle.IsValid()) { DiseaseHeader header = GameComps.DiseaseContainers.GetHeader(diseaseHandle); header.diseaseIdx = index; header.diseaseCount = diseaseCount; GameComps.DiseaseContainers.SetHeader(diseaseHandle, header); } else { diseaseHandle = GameComps.DiseaseContainers.Add(base.gameObject, index, diseaseCount); } } }
public void CancelClearing() { if (isMarkedForClear) { isMarkedForClear = false; GetComponent <KPrefabID>().RemoveTag(GameTags.Garbage); Prioritizable.RemoveRef(base.gameObject); if (clearHandle.IsValid()) { GlobalChoreProvider.Instance.UnregisterClearable(clearHandle); clearHandle.Clear(); } RefreshClearableStatus(); SimAndRenderScheduler.instance.Remove(this); } }
protected override void OnCleanUp() { GameScenePartitioner.Instance.Free(ref partitionerEntry); partitionerEntry.Clear(); ReleaseAstronaut(false); base.smi.StopSM("cleanup"); }
public void Free(ref HandleVector <int> .Handle handle) { if (handle.IsValid()) { ScenePartitionerEntry data = scenePartitionerEntries.GetData(handle); data.Release(); scenePartitionerEntries.Free(handle); handle.Clear(); } }
protected override void OnCleanUp() { Game.Instance.massEmitCallbackManager.Release(simEmitCBHandle, "coldbreather"); simEmitCBHandle.Clear(); if ((bool)storage) { storage.DropAll(true, false, default(Vector3), true); } base.OnCleanUp(); }
protected void Clear() { dataHandleIndices.Clear(); handles.Clear(); }