public void Reinitialize(Heightmap.Biome biome, int treasureMapInterval, bool hasBeenFound, long ownerPlayerId) { Biome = biome; Interval = treasureMapInterval; gameObject.layer = 12; var container = GetComponent <Container>(); if (container != null) { var label = Localization.instance.Localize("$mod_epicloot_treasurechest_name", $"$biome_{Biome.ToString().ToLower()}", (treasureMapInterval + 1).ToString()); container.m_name = Localization.instance.Localize(label); container.m_privacy = hasBeenFound ? Container.PrivacySetting.Public : Container.PrivacySetting.Private; } var piece = GetComponent <Piece>(); if (piece != null) { piece.m_creator = ownerPlayerId; } if (!hasBeenFound) { var beacon = gameObject.AddComponent <Beacon>(); beacon.m_range = EpicLoot.GetAndvaranautRange(); } // TODO Figure out why this damn thing won't float /*var rigidbody = gameObject.AddComponent<Rigidbody>(); * rigidbody.constraints = * RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation; | rigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete; | | var floating = gameObject.AddComponent<Floating>(); | floating.m_waterLevelOffset = 0.3f; | floating.TerrainCheck();*/ Destroy(gameObject.GetComponent <WearNTear>()); }