public bool CanWearClothing(int value) { ClothingData clothingData = ClothingBlock.GetClothingData(Terrain.ExtractData(value)); IList <int> list = GetClothes(clothingData.Slot); if (list.Count == 0) { return(true); } ClothingData clothingData2 = ClothingBlock.GetClothingData(Terrain.ExtractData(list[list.Count - 1])); return(clothingData.Layer > clothingData2.Layer); }
public void ProcessSlotItems(int slotIndex, int value, int count, int processCount, out int processedValue, out int processedCount) { processedCount = 0; processedValue = 0; if (processCount != 1) { return; } Block block = BlocksManager.Blocks[Terrain.ExtractContents(value)]; if (block.GetNutritionalValue(value) > 0f) { if (block is BucketBlock) { processedValue = Terrain.MakeBlockValue(90, 0, Terrain.ExtractData(value)); processedCount = 1; } if (count > 1 && processedCount > 0 && processedValue != value) { processedValue = value; processedCount = processCount; } else if (!m_componentVitalStats.Eat(value)) { processedValue = value; processedCount = processCount; } } if (block is ClothingBlock) { ClothingData clothingData = ClothingBlock.GetClothingData(Terrain.ExtractData(value)); List <int> list = new List <int>(GetClothes(clothingData.Slot)); list.Add(value); SetClothes(clothingData.Slot, list); } }
public void UpdateRenderTargets() { if (m_skinTexture == null || m_componentPlayer.PlayerData.CharacterSkinName != m_skinTextureName) { m_skinTexture = CharacterSkinsManager.LoadTexture(m_componentPlayer.PlayerData.CharacterSkinName); m_skinTextureName = m_componentPlayer.PlayerData.CharacterSkinName; Utilities.Dispose(ref m_innerClothedTexture); Utilities.Dispose(ref m_outerClothedTexture); } if (m_innerClothedTexture == null || m_innerClothedTexture.Width != m_skinTexture.Width || m_innerClothedTexture.Height != m_skinTexture.Height) { m_innerClothedTexture = new RenderTarget2D(m_skinTexture.Width, m_skinTexture.Height, ColorFormat.Rgba8888, DepthFormat.None); m_componentHumanModel.TextureOverride = m_innerClothedTexture; m_clothedTexturesValid = false; } if (m_outerClothedTexture == null || m_outerClothedTexture.Width != m_skinTexture.Width || m_outerClothedTexture.Height != m_skinTexture.Height) { m_outerClothedTexture = new RenderTarget2D(m_skinTexture.Width, m_skinTexture.Height, ColorFormat.Rgba8888, DepthFormat.None); m_componentOuterClothingModel.TextureOverride = m_outerClothedTexture; m_clothedTexturesValid = false; } if (DrawClothedTexture && !m_clothedTexturesValid) { m_clothedTexturesValid = true; Rectangle scissorRectangle = Display.ScissorRectangle; RenderTarget2D renderTarget = Display.RenderTarget; try { Display.RenderTarget = m_innerClothedTexture; Display.Clear(new Vector4(Color.Transparent)); int num = 0; TexturedBatch2D texturedBatch2D = m_primitivesRenderer.TexturedBatch(m_skinTexture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp); texturedBatch2D.QueueQuad(Vector2.Zero, new Vector2(m_innerClothedTexture.Width, m_innerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, Color.White); ClothingSlot[] innerSlotsOrder = m_innerSlotsOrder; foreach (ClothingSlot slot in innerSlotsOrder) { foreach (int clothe in GetClothes(slot)) { int data = Terrain.ExtractData(clothe); MekClothData clothingData = MekClothingBlock.GetClothingData(data); Color fabricColor = SubsystemPalette.GetFabricColor(m_subsystemTerrain, ClothingBlock.GetClothingColor(data)); texturedBatch2D = m_primitivesRenderer.TexturedBatch(clothingData.Texture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp); if (!clothingData.IsOuter) { texturedBatch2D.QueueQuad(new Vector2(0f, 0f), new Vector2(m_innerClothedTexture.Width, m_innerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, fabricColor); } } } m_primitivesRenderer.Flush(); Display.RenderTarget = m_outerClothedTexture; Display.Clear(new Vector4(Color.Transparent)); num = 0; innerSlotsOrder = m_outerSlotsOrder; foreach (ClothingSlot slot2 in innerSlotsOrder) { foreach (int clothe2 in GetClothes(slot2)) { int data2 = Terrain.ExtractData(clothe2); ClothingData clothingData2 = ClothingBlock.GetClothingData(data2); Color fabricColor2 = SubsystemPalette.GetFabricColor(m_subsystemTerrain, ClothingBlock.GetClothingColor(data2)); texturedBatch2D = m_primitivesRenderer.TexturedBatch(clothingData2.Texture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp); if (clothingData2.IsOuter) { texturedBatch2D.QueueQuad(new Vector2(0f, 0f), new Vector2(m_outerClothedTexture.Width, m_outerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, fabricColor2); } } } m_primitivesRenderer.Flush(); } finally { Display.RenderTarget = renderTarget; Display.ScissorRectangle = scissorRectangle; } } }