Ejemplo n.º 1
0
        public void Fire()
        {
            if (Delay > .0)
            {
                Time.QueueTimeDelayedExecution(Time.FrameStartTime + Delay, Fire);
                Delay = 0;
                return;
            }
            Project.RemoveEntity(Entity, true);
            var p = Terrain.ToCell(ComponentBody.Position);

            Utils.SubsystemExplosions.AddExplosion(p.X, p.Y, p.Z, ExplosionPressure, (MineType & MineType.Incendiary) != 0, false);
        }
Ejemplo n.º 2
0
 public void AddExperience(int count, bool playSound)
 {
     if (playSound)
     {
         m_subsystemAudio.PlaySound("Audio/ExperienceCollected", 0.2f, m_random.Float(-0.1f, 0.4f), 0f, 0f);
     }
     for (int i = 0; i < count; i++)
     {
         float num = 0.012f / MathUtils.Pow(1.08f, MathUtils.Floor(m_componentPlayer.PlayerData.Level - 1f));
         if (MathUtils.Floor(m_componentPlayer.PlayerData.Level + num) > MathUtils.Floor(m_componentPlayer.PlayerData.Level))
         {
             Time.QueueTimeDelayedExecution(Time.FrameStartTime + 0.5 + 0.0, delegate
             {
                 m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 1), Color.White, blinking: true, playNotificationSound: false);
             });
             Time.QueueTimeDelayedExecution(Time.FrameStartTime + 0.5 + 0.0, delegate
             {
                 m_subsystemAudio.PlaySound("Audio/ExperienceCollected", 1f, -0.2f, 0f, 0f);
             });
             Time.QueueTimeDelayedExecution(Time.FrameStartTime + 0.5 + 0.15000000596046448, delegate
             {
                 m_subsystemAudio.PlaySound("Audio/ExperienceCollected", 1f, -0.03333333f, 0f, 0f);
             });
             Time.QueueTimeDelayedExecution(Time.FrameStartTime + 0.5 + 0.30000001192092896, delegate
             {
                 m_subsystemAudio.PlaySound("Audio/ExperienceCollected", 1f, 142f / (339f * (float)Math.PI), 0f, 0f);
             });
             Time.QueueTimeDelayedExecution(Time.FrameStartTime + 0.5 + 0.45000001788139343, delegate
             {
                 m_subsystemAudio.PlaySound("Audio/ExperienceCollected", 1f, 23f / 60f, 0f, 0f);
             });
             Time.QueueTimeDelayedExecution(Time.FrameStartTime + 0.5 + 0.75, delegate
             {
                 m_subsystemAudio.PlaySound("Audio/ExperienceCollected", 1f, -0.03333333f, 0f, 0f);
             });
             Time.QueueTimeDelayedExecution(Time.FrameStartTime + 0.5 + 0.90000003576278687, delegate
             {
                 m_subsystemAudio.PlaySound("Audio/ExperienceCollected", 1f, 23f / 60f, 0f, 0f);
             });
         }
         m_componentPlayer.PlayerData.Level += num;
     }
 }
Ejemplo n.º 3
0
        public void UpdateWetness()
        {
            float gameTimeDelta = m_subsystemTime.GameTimeDelta;

            if (m_componentPlayer.ComponentBody.ImmersionFactor > 0.2f && m_componentPlayer.ComponentBody.ImmersionFluidBlock is WaterBlock)
            {
                float num = 2f * m_componentPlayer.ComponentBody.ImmersionFactor;
                Wetness += MathUtils.Saturate(3f * gameTimeDelta) * (num - Wetness);
            }
            int x    = Terrain.ToCell(m_componentPlayer.ComponentBody.Position.X);
            int num2 = Terrain.ToCell(m_componentPlayer.ComponentBody.Position.Y + 0.1f);
            int z    = Terrain.ToCell(m_componentPlayer.ComponentBody.Position.Z);
            PrecipitationShaftInfo precipitationShaftInfo = m_subsystemWeather.GetPrecipitationShaftInfo(x, z);

            if (num2 >= precipitationShaftInfo.YLimit && precipitationShaftInfo.Type == PrecipitationType.Rain)
            {
                Wetness += 0.05f * precipitationShaftInfo.Intensity * gameTimeDelta;
            }
            float num3 = 180f;

            if (m_environmentTemperature > 8f)
            {
                num3 = 120f;
            }
            if (m_environmentTemperature > 16f)
            {
                num3 = 60f;
            }
            if (m_environmentTemperature > 24f)
            {
                num3 = 30f;
            }
            Wetness -= gameTimeDelta / num3;
            if (Wetness > 0.8f && m_lastWetness <= 0.8f)
            {
                Time.QueueTimeDelayedExecution(Time.FrameStartTime + 2.0, delegate
                {
                    if (Wetness > 0.8f)
                    {
                        m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 38), Color.White, blinking: true, playNotificationSound: true);
                    }
                });
            }
            else if (Wetness > 0.2f && m_lastWetness <= 0.2f)
            {
                Time.QueueTimeDelayedExecution(Time.FrameStartTime + 2.0, delegate
                {
                    if (Wetness > 0.2f && Wetness <= 0.8f && Wetness > m_lastWetness)
                    {
                        m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 39), Color.White, blinking: true, playNotificationSound: true);
                    }
                });
            }
            else if (Wetness <= 0f && m_lastWetness > 0f)
            {
                Time.QueueTimeDelayedExecution(Time.FrameStartTime + 2.0, delegate
                {
                    if (Wetness <= 0f)
                    {
                        m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 40), Color.White, blinking: true, playNotificationSound: true);
                    }
                });
            }
            m_lastWetness = Wetness;
        }
Ejemplo n.º 4
0
        public void ScanDesign(CellFace start, Vector3 direction, ComponentMiner componentMiner)
        {
            FurnitureDesign          design           = null;
            FurnitureDesign          furnitureDesign  = null;
            Dictionary <Point3, int> valuesDictionary = new Dictionary <Point3, int>();
            Point3 point      = start.Point;
            Point3 point2     = start.Point;
            int    startValue = base.SubsystemTerrain.Terrain.GetCellValue(start.Point.X, start.Point.Y, start.Point.Z);
            int    num        = Terrain.ExtractContents(startValue);

            if (BlocksManager.Blocks[num] is FurnitureBlock)
            {
                int designIndex = FurnitureBlock.GetDesignIndex(Terrain.ExtractData(startValue));
                furnitureDesign = GetDesign(designIndex);
                if (furnitureDesign == null)
                {
                    componentMiner.ComponentPlayer?.ComponentGui.DisplaySmallMessage("Unsuitable block found", Color.White, blinking: true, playNotificationSound: false);
                    return;
                }
                design = furnitureDesign.Clone();
                design.LinkedDesign    = null;
                design.InteractionMode = FurnitureInteractionMode.None;
                valuesDictionary.Add(start.Point, startValue);
            }
            else
            {
                Stack <Point3> val = new Stack <Point3>();
                val.Push(start.Point);
                while (val.Count > 0)
                {
                    Point3 key = val.Pop();
                    if (valuesDictionary.ContainsKey(key))
                    {
                        continue;
                    }
                    int cellValue = base.SubsystemTerrain.Terrain.GetCellValue(key.X, key.Y, key.Z);
                    if (IsValueDisallowed(cellValue))
                    {
                        componentMiner.ComponentPlayer?.ComponentGui.DisplaySmallMessage("Unsuitable block found", Color.White, blinking: true, playNotificationSound: false);
                        return;
                    }
                    if (IsValueAllowed(cellValue))
                    {
                        if (key.X < point.X)
                        {
                            point.X = key.X;
                        }
                        if (key.Y < point.Y)
                        {
                            point.Y = key.Y;
                        }
                        if (key.Z < point.Z)
                        {
                            point.Z = key.Z;
                        }
                        if (key.X > point2.X)
                        {
                            point2.X = key.X;
                        }
                        if (key.Y > point2.Y)
                        {
                            point2.Y = key.Y;
                        }
                        if (key.Z > point2.Z)
                        {
                            point2.Z = key.Z;
                        }
                        if (MathUtils.Abs(point.X - point2.X) >= 16 || MathUtils.Abs(point.Y - point2.Y) >= 16 || MathUtils.Abs(point.Z - point2.Z) >= 16)
                        {
                            componentMiner.ComponentPlayer?.ComponentGui.DisplaySmallMessage("Furniture design is too large", Color.White, blinking: true, playNotificationSound: false);
                            return;
                        }
                        valuesDictionary[key] = cellValue;
                        val.Push(new Point3(key.X - 1, key.Y, key.Z));
                        val.Push(new Point3(key.X + 1, key.Y, key.Z));
                        val.Push(new Point3(key.X, key.Y - 1, key.Z));
                        val.Push(new Point3(key.X, key.Y + 1, key.Z));
                        val.Push(new Point3(key.X, key.Y, key.Z - 1));
                        val.Push(new Point3(key.X, key.Y, key.Z + 1));
                    }
                }
                if (valuesDictionary.Count == 0)
                {
                    componentMiner.ComponentPlayer?.ComponentGui.DisplaySmallMessage("No suitable blocks found", Color.White, blinking: true, playNotificationSound: false);
                    return;
                }
                design = new FurnitureDesign(base.SubsystemTerrain);
                Point3 point3 = point2 - point;
                int    num2   = MathUtils.Max(MathUtils.Max(point3.X, point3.Y, point3.Z) + 1, 2);
                int[]  array  = new int[num2 * num2 * num2];
                foreach (KeyValuePair <Point3, int> item in valuesDictionary)
                {
                    Point3 point4 = item.Key - point;
                    array[point4.X + point4.Y * num2 + point4.Z * num2 * num2] = item.Value;
                }
                design.SetValues(num2, array);
                int steps = (start.Face > 3) ? CellFace.Vector3ToFace(direction, 3) : CellFace.OppositeFace(start.Face);
                design.Rotate(1, steps);
                Point3 location = design.Box.Location;
                Point3 point5   = new Point3(design.Resolution) - (design.Box.Location + design.Box.Size);
                Point3 delta    = new Point3((point5.X - location.X) / 2, -location.Y, (point5.Z - location.Z) / 2);
                design.Shift(delta);
            }
            BuildFurnitureDialog dialog = new BuildFurnitureDialog(design, furnitureDesign, delegate(bool result)
            {
                if (result)
                {
                    design = TryAddDesign(design);
                    if (design == null)
                    {
                        componentMiner.ComponentPlayer?.ComponentGui.DisplaySmallMessage("Too many different furniture designs", Color.White, blinking: true, playNotificationSound: false);
                    }
                    else
                    {
                        if (m_subsystemGameInfo.WorldSettings.GameMode != 0)
                        {
                            foreach (KeyValuePair <Point3, int> item2 in valuesDictionary)
                            {
                                base.SubsystemTerrain.DestroyCell(0, item2.Key.X, item2.Key.Y, item2.Key.Z, 0, noDrop: true, noParticleSystem: true);
                            }
                        }
                        int value        = Terrain.MakeBlockValue(227, 0, FurnitureBlock.SetDesignIndex(0, design.Index, design.ShadowStrengthFactor, design.IsLightEmitter));
                        int num3         = MathUtils.Clamp(design.Resolution, 4, 8);
                        Matrix matrix    = componentMiner.ComponentCreature.ComponentBody.Matrix;
                        Vector3 position = matrix.Translation + 1f * matrix.Forward + 1f * Vector3.UnitY;
                        m_subsystemPickables.AddPickable(value, num3, position, null, null);
                        componentMiner.DamageActiveTool(1);
                        componentMiner.Poke(forceRestart: false);
                        for (int i = 0; i < 3; i++)
                        {
                            Time.QueueTimeDelayedExecution(Time.FrameStartTime + (double)((float)i * 0.25f), delegate
                            {
                                m_subsystemSoundMaterials.PlayImpactSound(startValue, new Vector3(start.Point), 1f);
                            });
                        }
                        if (componentMiner.ComponentCreature.PlayerStats != null)
                        {
                            componentMiner.ComponentCreature.PlayerStats.FurnitureItemsMade += num3;
                        }
                    }
                }
            });

            if (componentMiner.ComponentPlayer != null)
            {
                DialogsManager.ShowDialog(componentMiner.ComponentPlayer.GuiWidget, dialog);
            }
        }
Ejemplo n.º 5
0
        public void Update(float dt)
        {
            PlayerInput playerInput = ComponentInput.PlayerInput;

            if (ComponentInput.IsControlledByTouch && m_aim.HasValue)
            {
                playerInput.Look = Vector2.Zero;
            }
            if (ComponentMiner.Inventory != null)
            {
                ComponentMiner.Inventory.ActiveSlotIndex += playerInput.ScrollInventory;
                if (playerInput.SelectInventorySlot.HasValue)
                {
                    ComponentMiner.Inventory.ActiveSlotIndex = MathUtils.Clamp(playerInput.SelectInventorySlot.Value, 0, 9);
                }
            }
            ComponentSteedBehavior componentSteedBehavior = null;
            ComponentBoat          componentBoat          = null;
            ComponentMount         mount = ComponentRider.Mount;

            if (mount != null)
            {
                componentSteedBehavior = mount.Entity.FindComponent <ComponentSteedBehavior>();
                componentBoat          = mount.Entity.FindComponent <ComponentBoat>();
            }
            if (componentSteedBehavior != null)
            {
                if (playerInput.Move.Z > 0.5f && !m_speedOrderBlocked)
                {
                    if (PlayerData.PlayerClass == PlayerClass.Male)
                    {
                        m_subsystemAudio.PlayRandomSound("Audio/Creatures/MaleYellFast", 0.75f, 0f, base.ComponentBody.Position, 2f, autoDelay: false);
                    }
                    else
                    {
                        m_subsystemAudio.PlayRandomSound("Audio/Creatures/FemaleYellFast", 0.75f, 0f, base.ComponentBody.Position, 2f, autoDelay: false);
                    }
                    componentSteedBehavior.SpeedOrder = 1;
                    m_speedOrderBlocked = true;
                }
                else if (playerInput.Move.Z < -0.5f && !m_speedOrderBlocked)
                {
                    if (PlayerData.PlayerClass == PlayerClass.Male)
                    {
                        m_subsystemAudio.PlayRandomSound("Audio/Creatures/MaleYellSlow", 0.75f, 0f, base.ComponentBody.Position, 2f, autoDelay: false);
                    }
                    else
                    {
                        m_subsystemAudio.PlayRandomSound("Audio/Creatures/FemaleYellSlow", 0.75f, 0f, base.ComponentBody.Position, 2f, autoDelay: false);
                    }
                    componentSteedBehavior.SpeedOrder = -1;
                    m_speedOrderBlocked = true;
                }
                else if (MathUtils.Abs(playerInput.Move.Z) <= 0.25f)
                {
                    m_speedOrderBlocked = false;
                }
                componentSteedBehavior.TurnOrder   = playerInput.Move.X;
                componentSteedBehavior.JumpOrder   = (playerInput.Jump ? 1 : 0);
                base.ComponentLocomotion.LookOrder = new Vector2(playerInput.Look.X, 0f);
            }
            else if (componentBoat != null)
            {
                componentBoat.TurnOrder                   = playerInput.Move.X;
                componentBoat.MoveOrder                   = playerInput.Move.Z;
                base.ComponentLocomotion.LookOrder        = new Vector2(playerInput.Look.X, 0f);
                base.ComponentCreatureModel.RowLeftOrder  = (playerInput.Move.X <-0.2f || playerInput.Move.Z> 0.2f);
                base.ComponentCreatureModel.RowRightOrder = (playerInput.Move.X > 0.2f || playerInput.Move.Z > 0.2f);
            }
            else
            {
                base.ComponentLocomotion.WalkOrder = (base.ComponentBody.IsSneaking ? (0.66f * new Vector2(playerInput.SneakMove.X, playerInput.SneakMove.Z)) : new Vector2(playerInput.Move.X, playerInput.Move.Z));
                base.ComponentLocomotion.FlyOrder  = new Vector3(0f, playerInput.Move.Y, 0f);
                base.ComponentLocomotion.TurnOrder = playerInput.Look * new Vector2(1f, 0f);
                base.ComponentLocomotion.JumpOrder = MathUtils.Max(playerInput.Jump ? 1 : 0, base.ComponentLocomotion.JumpOrder);
            }
            base.ComponentLocomotion.LookOrder  += playerInput.Look * (SettingsManager.FlipVerticalAxis ? new Vector2(0f, -1f) : new Vector2(0f, 1f));
            base.ComponentLocomotion.VrLookOrder = playerInput.VrLook;
            base.ComponentLocomotion.VrMoveOrder = playerInput.VrMove;
            int   num   = Terrain.ExtractContents(ComponentMiner.ActiveBlockValue);
            Block block = BlocksManager.Blocks[num];
            bool  flag  = false;

            if (playerInput.Interact.HasValue && !flag && m_subsystemTime.GameTime - m_lastActionTime > 0.33000001311302185)
            {
                if (!ComponentMiner.Use(playerInput.Interact.Value))
                {
                    TerrainRaycastResult?terrainRaycastResult = ComponentMiner.Raycast <TerrainRaycastResult>(playerInput.Interact.Value, RaycastMode.Interaction);
                    if (terrainRaycastResult.HasValue)
                    {
                        if (!ComponentMiner.Interact(terrainRaycastResult.Value))
                        {
                            if (ComponentMiner.Place(terrainRaycastResult.Value))
                            {
                                m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate();
                                flag           = true;
                                m_isAimBlocked = true;
                            }
                        }
                        else
                        {
                            m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate();
                            flag           = true;
                            m_isAimBlocked = true;
                        }
                    }
                }
                else
                {
                    m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate();
                    flag           = true;
                    m_isAimBlocked = true;
                }
            }
            float num2 = (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative) ? 0.1f : 1.4f;

            if (playerInput.Aim.HasValue && block.IsAimable && m_subsystemTime.GameTime - m_lastActionTime > (double)num2)
            {
                if (!m_isAimBlocked)
                {
                    Ray3    value  = playerInput.Aim.Value;
                    Vector3 vector = GameWidget.ActiveCamera.WorldToScreen(value.Position + value.Direction, Matrix.Identity);
                    Point2  size   = Window.Size;
                    if (ComponentInput.IsControlledByVr || (vector.X >= (float)size.X * 0.02f && vector.X < (float)size.X * 0.98f && vector.Y >= (float)size.Y * 0.02f && vector.Y < (float)size.Y * 0.98f))
                    {
                        m_aim = value;
                        if (ComponentMiner.Aim(value, AimState.InProgress))
                        {
                            ComponentMiner.Aim(m_aim.Value, AimState.Cancelled);
                            m_aim          = null;
                            m_isAimBlocked = true;
                        }
                        else if (!m_aimHintIssued && Time.PeriodicEvent(1.0, 0.0))
                        {
                            Time.QueueTimeDelayedExecution(Time.RealTime + 3.0, delegate
                            {
                                if (!m_aimHintIssued && m_aim.HasValue && !base.ComponentBody.IsSneaking)
                                {
                                    m_aimHintIssued = true;
                                    ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 1), Color.White, blinking: true, playNotificationSound: true);
                                }
                            });
                        }
                    }
                    else if (m_aim.HasValue)
                    {
                        ComponentMiner.Aim(m_aim.Value, AimState.Cancelled);
                        m_aim          = null;
                        m_isAimBlocked = true;
                    }
                }
            }
            else
            {
                m_isAimBlocked = false;
                if (m_aim.HasValue)
                {
                    ComponentMiner.Aim(m_aim.Value, AimState.Completed);
                    m_aim            = null;
                    m_lastActionTime = m_subsystemTime.GameTime;
                }
            }
            flag |= m_aim.HasValue;
            if (playerInput.Hit.HasValue && !flag && m_subsystemTime.GameTime - m_lastActionTime > 0.33000001311302185)
            {
                BodyRaycastResult?bodyRaycastResult = ComponentMiner.Raycast <BodyRaycastResult>(playerInput.Hit.Value, RaycastMode.Interaction);
                if (bodyRaycastResult.HasValue)
                {
                    flag           = true;
                    m_isDigBlocked = true;
                    if (Vector3.Distance(bodyRaycastResult.Value.HitPoint(), base.ComponentCreatureModel.EyePosition) <= 2f)
                    {
                        ComponentMiner.Hit(bodyRaycastResult.Value.ComponentBody, bodyRaycastResult.Value.HitPoint(), playerInput.Hit.Value.Direction);
                    }
                }
            }
            if (playerInput.Dig.HasValue && !flag && !m_isDigBlocked && m_subsystemTime.GameTime - m_lastActionTime > 0.33000001311302185)
            {
                TerrainRaycastResult?terrainRaycastResult2 = ComponentMiner.Raycast <TerrainRaycastResult>(playerInput.Dig.Value, RaycastMode.Digging);
                if (terrainRaycastResult2.HasValue && ComponentMiner.Dig(terrainRaycastResult2.Value))
                {
                    m_lastActionTime = m_subsystemTime.GameTime;
                    m_subsystemTerrain.TerrainUpdater.RequestSynchronousUpdate();
                }
            }
            if (!playerInput.Dig.HasValue)
            {
                m_isDigBlocked = false;
            }
            if (playerInput.Drop && ComponentMiner.Inventory != null)
            {
                IInventory inventory = ComponentMiner.Inventory;
                int        slotValue = inventory.GetSlotValue(inventory.ActiveSlotIndex);
                int        num3      = inventory.RemoveSlotItems(count: inventory.GetSlotCount(inventory.ActiveSlotIndex), slotIndex: inventory.ActiveSlotIndex);
                if (slotValue != 0 && num3 != 0)
                {
                    Vector3 position = base.ComponentBody.Position + new Vector3(0f, base.ComponentBody.BoxSize.Y * 0.66f, 0f) + 0.25f * base.ComponentBody.Matrix.Forward;
                    Vector3 value2   = 8f * Matrix.CreateFromQuaternion(base.ComponentCreatureModel.EyeRotation).Forward;
                    m_subsystemPickables.AddPickable(slotValue, num3, position, value2, null);
                }
            }
            if (!playerInput.PickBlockType.HasValue || flag)
            {
                return;
            }
            ComponentCreativeInventory componentCreativeInventory = ComponentMiner.Inventory as ComponentCreativeInventory;

            if (componentCreativeInventory == null)
            {
                return;
            }
            TerrainRaycastResult?terrainRaycastResult3 = ComponentMiner.Raycast <TerrainRaycastResult>(playerInput.PickBlockType.Value, RaycastMode.Digging, raycastTerrain: true, raycastBodies: false, raycastMovingBlocks: false);

            if (!terrainRaycastResult3.HasValue)
            {
                return;
            }
            int value3 = terrainRaycastResult3.Value.Value;

            value3 = Terrain.ReplaceLight(value3, 0);
            int               num4           = Terrain.ExtractContents(value3);
            Block             block2         = BlocksManager.Blocks[num4];
            int               num5           = 0;
            IEnumerable <int> creativeValues = block2.GetCreativeValues();

            if (block2.GetCreativeValues().Contains(value3))
            {
                num5 = value3;
            }
            if (num5 == 0 && !block2.IsNonDuplicable)
            {
                List <BlockDropValue> list = new List <BlockDropValue>();
                block2.GetDropValues(m_subsystemTerrain, value3, 0, int.MaxValue, list, out bool _);
                if (list.Count > 0 && list[0].Count > 0)
                {
                    num5 = list[0].Value;
                }
            }
            if (num5 == 0)
            {
                num5 = creativeValues.FirstOrDefault();
            }
            if (num5 == 0)
            {
                return;
            }
            int num6 = -1;

            for (int i = 0; i < 10; i++)
            {
                if (componentCreativeInventory.GetSlotCapacity(i, num5) > 0 && componentCreativeInventory.GetSlotCount(i) > 0 && componentCreativeInventory.GetSlotValue(i) == num5)
                {
                    num6 = i;
                    break;
                }
            }
            if (num6 < 0)
            {
                for (int j = 0; j < 10; j++)
                {
                    if (componentCreativeInventory.GetSlotCapacity(j, num5) > 0 && (componentCreativeInventory.GetSlotCount(j) == 0 || componentCreativeInventory.GetSlotValue(j) == 0))
                    {
                        num6 = j;
                        break;
                    }
                }
            }
            if (num6 < 0)
            {
                num6 = componentCreativeInventory.ActiveSlotIndex;
            }
            componentCreativeInventory.RemoveSlotItems(num6, int.MaxValue);
            componentCreativeInventory.AddSlotItems(num6, num5, 1);
            componentCreativeInventory.ActiveSlotIndex = num6;
            ComponentGui.DisplaySmallMessage(block2.GetDisplayName(m_subsystemTerrain, value3), Color.White, blinking: false, playNotificationSound: false);
            m_subsystemAudio.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f, 0f);
        }