Esempio n. 1
0
        public override bool OnInteract(TerrainRaycastResult raycastResult, ComponentMiner componentMiner)
        {
            var blockEntity = Utils.GetBlockEntity(raycastResult.CellFace.Point);

            if (blockEntity == null || componentMiner.ComponentPlayer == null)
            {
                return(false);
            }
            switch (Terrain.ExtractContents(raycastResult.Value))
            {
            case BlastFurnaceBlock.Index:
                componentMiner.ComponentPlayer.ComponentGui.ModalPanelWidget = new BlastFurnaceWidget(componentMiner.Inventory, blockEntity.Entity.FindComponent <ComponentBlastFurnace>(true));
                break;

            case CovenBlock.Index:
                componentMiner.ComponentPlayer.ComponentGui.ModalPanelWidget = new CovenWidget(componentMiner.Inventory, blockEntity.Entity.FindComponent <ComponentCoven>(true));
                break;

            case HearthFurnaceBlock.Index:
                componentMiner.ComponentPlayer.ComponentGui.ModalPanelWidget = new CovenWidget(componentMiner.Inventory, blockEntity.Entity.FindComponent <ComponentHearthFurnace>(true), "Widgets/HearthFurnaceWidget");
                break;

            case TankBlock.Index:
                if (TankBlock.GetType(raycastResult.Value) == TankBlock.Type.FractionatingTower)
                {
                    componentMiner.ComponentPlayer.ComponentGui.ModalPanelWidget = new FractionalTowerWidget(componentMiner.Inventory, blockEntity.Entity.FindComponent <ComponentFractionalTower>(true));
                    break;
                }
                return(false);

            default: return(false);
            }
            AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f);
            return(true);
        }
Esempio n. 2
0
        public override void OnBlockAdded(int value, int oldValue, int x, int y, int z)
        {
            string name;

            switch (Terrain.ExtractContents(value))
            {
            case BlastFurnaceBlock.Index: name = "BlastFurnace"; break;

            case CovenBlock.Index: name = "CokeOven"; break;

            case HearthFurnaceBlock.Index: name = "HearthFurnace"; break;

            case TankBlock.Index:
                if (TankBlock.GetType(value) == TankBlock.Type.FractionatingTower)
                {
                    name = "FractionalTower"; break;
                }
                return;

            default: return;
            }
            var vd = new ValuesDictionary();

            vd.PopulateFromDatabaseObject(Project.GameDatabase.Database.FindDatabaseObject(name, Project.GameDatabase.EntityTemplateType, true));
            vd.GetValue <ValuesDictionary>("BlockEntity").SetValue("Coordinates", new Point3(x, y, z));
            Project.AddEntity(Project.CreateEntity(vd));
        }