示例#1
0
    public override void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldForResolving)
    {
        base.FromTreeAttributes(tree, worldForResolving);

        contents           = tree.GetItemstack("contents");
        burning            = tree.GetInt("burning") > 0;
        lastTickTotalHours = tree.GetDouble("lastTickTotalHours");

        if (Api != null)
        {
            if (contents != null)
            {
                contents.ResolveBlockOrItem(Api.World);
            }
        }
        if (renderer != null)
        {
            renderer.SetContents(contents, burning, true);
        }

        if (energyStorage == null)
        {
            energyStorage = new FluxStorage(MyMiniLib.GetAttributeInt(Block, "storage", 10000), MyMiniLib.GetAttributeInt(Block, "input", 1000), 0);
        }
        energyStorage.setEnergy(tree.GetFloat("energy"));
    }
示例#2
0
    public override void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldForResolving)
    {
        base.FromTreeAttributes(tree, worldForResolving);

        if (energyStorage == null)
        {
            energyStorage = new FluxStorage(MyMiniLib.GetAttributeInt(Block, "storage", 10000), MyMiniLib.GetAttributeInt(Block, "input", 10000), 0);
        }
        energyStorage.setEnergy(tree.GetFloat("energy", 0));
    }
示例#3
0
 public EnergyDuctCore CombineCores(EnergyDuctCore core)
 {
     storage.setEnergy(Math.Min(storage.getEnergyStored() + core.storage.getEnergyStored(), storage.getMaxEnergyStored()));
     foreach (IEnergyPoint item in core.ducts)
     {
         item.SetCore(this);
     }
     ducts.AddRange(core.ducts);
     return(this);
 }
示例#4
0
文件: Relay.cs 项目: Niker323/VS-mods
    //public override void GetBlockInfo(IPlayer forPlayer, StringBuilder dsc)
    //{
    //    base.GetBlockInfo(forPlayer, dsc);
    //    if (energyStorage != null)
    //    {
    //        dsc.AppendLine(energyStorage.GetFluxStorageInfo());
    //    }
    //}

    public override void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldForResolving)
    {
        base.FromTreeAttributes(tree, worldForResolving);

        if (energyStorage == null)
        {
            energyStorage = new FluxStorage(MyMiniLib.GetAttributeInt(Block, "transfer", 10000), MyMiniLib.GetAttributeInt(Block, "transfer", 10000), MyMiniLib.GetAttributeInt(Block, "transfer", 10000));
        }
        energyStorage.setEnergy(tree.GetFloat("energy"));
        state = tree.GetBool("state", false);
    }
示例#5
0
    public override void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldForResolving)
    {
        base.FromTreeAttributes(tree, worldForResolving);

        if (energyStorage == null)
        {
            energyStorage = new FluxStorage(MyMiniLib.GetAttributeInt(Block, "storage", 10000), 0, MyMiniLib.GetAttributeInt(Block, "output", 500));
        }
        energyStorage.setEnergy(tree.GetFloat("energy"));
        if (Api != null && Api.World.Side == EnumAppSide.Client)
        {
            generation = tree.GetFloat("gen");
        }
    }
示例#6
0
    public override void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldForResolving)
    {
        base.FromTreeAttributes(tree, worldForResolving);
        inventory.FromTreeAttributes(tree.GetTreeAttribute("inventory"));
        if (Api != null)
        {
            inventory.Api = Api;
            inventory.ResolveBlocksOrItems();
        }

        if (Api is ICoreClientAPI)
        {
            loadToolMeshes();
            Api.World.BlockAccessor.MarkBlockDirty(Pos);
        }

        if (energyStorage == null)
        {
            energyStorage = new FluxStorage(MyMiniLib.GetAttributeInt(Block, "storage", 10000), MyMiniLib.GetAttributeInt(Block, "input", 1000), MyMiniLib.GetAttributeInt(Block, "output", 1000));
        }
        energyStorage.setEnergy(tree.GetFloat("energy"));
    }
示例#7
0
    public override void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldForResolving)
    {
        base.FromTreeAttributes(tree, worldForResolving);
        Inventory.FromTreeAttributes(tree.GetTreeAttribute("inventory"));

        if (Api != null)
        {
            Inventory.AfterBlocksLoaded(Api.World);
        }


        furnaceTemperature    = tree.GetFloat("furnaceTemperature");
        inputStackCookingTime = tree.GetFloat("oreCookingTime");

        if (Api != null)
        {
            if (Api.Side == EnumAppSide.Client)
            {
                if (clientDialog != null)
                {
                    SetDialogValues(clientDialog.Attributes);
                }
            }


            if (Api.Side == EnumAppSide.Client && clientSidePrevBurning != IsBurning)
            {
                clientSidePrevBurning = IsBurning;
                MarkDirty(true);
            }
        }

        if (energyStorage == null)
        {
            energyStorage = new FluxStorage(MyMiniLib.GetAttributeInt(Block, "storage", 10000), MyMiniLib.GetAttributeInt(Block, "input", 1000), 0);
        }
        energyStorage.setEnergy(tree.GetFloat("energy"));
    }