基于SFM的MEK灌注工厂自动化

test.png (446.16 KB, 下载次数: 694)

下载附件  

2025-2-23 13:59 上传

说明
支持配方
红石:铁锭、饿锭
碳:铁锭、富集铁
钻石:灌注合金、黑曜石粉
强化黑曜石:强化合金


工厂数量:8
红石驱动频率:每游戏刻(20次/秒),根据需要可降频运行。
每次最多移动27个同分类物品,且工厂里的物品不会超过27个。
如果工厂已有灌注物质,只会输入符合的物品。
灌注物质可存储,输入多少物品就输出相应消耗量。
铁锭默认灌注红石,同时输入圆石和铁锭时,相应数量的铁锭灌注碳。
注意事项:因数据过大,管理器日志使用DEBUG以上级别时可能导致游戏崩溃。
标签

fe_in 能量输入
item_in 物品输入
item_out 物品输出
factory_infusion 用于将物品转换为灌注类型
infusion_in 存储各个的灌注类型,每个请至少存有3mB
factory 灌注工厂
0,1,2,3,4,5,6,7 每个工厂独立的标签,用于索引
item_redstone 输入物品需要灌注红石
item_carborn 输入物品需要灌注碳
item_diamond 输入物品需要灌注钻石
item_obsidian 输入物品需要灌注强化黑曜石
item_infusion 输入物品为灌注物质,用于输出到factory_infusion
item_type 包含上面5个
item_iron 输入物品为铁锭,暂存
item_stone 输入物品为圆石,与铁锭同时输入时将相应数量的铁锭分类到item_carborn,否则为item_redstone
item_holder 填满圆石
infusion1,infusion2,infusion3 空,临时化学品变量
item1 空,临时物品变量
clock 循环变量,流体时钟,每次运行流体量+1,为工厂索引值
clock_holder 填入足量的流体,比工厂数多就行
item_cost10 输入物品消耗10mB灌注物质
item_cost20 输入物品消耗20mB灌注物质
item_cost40 输入物品消耗40mB灌注物质
item_cost 包含上面3个
item_try10 尝试输入消耗10mB的物品
item_try20 尝试输入消耗20mB的物品
item_try40 尝试输入消耗40mB的物品
item_try 包含上面3个


输入输出配置
所有机器、容器顶部都为输入/输出面
factory_infusion还要将顶部设置为额外面
所有工厂开启自动整理。
原理说明
将输入物品分类,铁锭与圆石一起输入时为碳。
输入灌注物品到灌注机转化为灌注物质,然后存储到infusion_in。
循环变量+1,从对应工厂提取灌注物质,根据灌注物品将相应物品移至item1,如果为空则依次检测各种物品移至item1。
将item1的物品根据消耗的灌注量分类到item_cost。
根据各item_cost的物品数量和灌注物质存量infusion1,将对应数量的物品和灌注物质移至item_try和infusion2。
用圆石填充各item_try的物品到32个,然后输出item_try到对应工厂。
根据item_try与32相差的物品数量输出相应灌注物质到工厂。
恢复各变量。
代码
SFM灌注工厂.txt (13.13 KB, 下载次数: 68)

2025-2-23 14:52 上传

点击文件名下载附件



every tick do

    input fe:: from fe_in top side

    output fe:: to factory top side

end


every redstone pulse do

    input 1 fluid:: from clock_holder top side

    output 1 fluid:: to clock top side

    forget

    if clock has > 7 fluid:: then

        input fluid:: from clock top side

        output fluid:: to clock_holder top side

        forget

    end


    input from factory top side

    output to item_out

    forget


    input from item_in

    output "ingot_osmium" to item_redstone

    output "enriched_iron" to item_carbon

    output "alloy_infused|dust_obsidian" to item_diamond

    output "alloy_reinforced" to item_obsidian

    output "enriched_(?!iron).+" to item_infusion

    output iron_ingot to item_iron

    output cobblestone to item_stone

    forget


    input from item_iron

    if item_stone has > 0 then

        input from item_stone

        if item_stone has >= 64 then

            output 64 cobblestone to item_out

            output 64 except cobblestone to item_carbon end

        if item_stone has >= 8 then

            output 8 cobblestone to item_out

            output 8 except cobblestone to item_carbon end

        if item_stone has >= 1 then

            output 1 cobblestone to item_out

            output 1 except cobblestone to item_carbon

        end

    else

        output to item_redstone

    end


    input infusion:: from factory_infusion top side

    output retain 4096000 infusion:: to each infusion_in top side

    forget


    if item_type has > 0 then

        input from item_infusion

        output 1 to each factory_infusion top side


        if clock has = 0 fluid:: then input infusion:: from "0" top side

        else if clock has = 1 fluid:: then input infusion:: from "1" top side

        else if clock has = 2 fluid:: then input infusion:: from "2" top side

        else if clock has = 3 fluid:: then input infusion:: from "3" top side

        else if clock has = 4 fluid:: then input infusion:: from "4" top side

        else if clock has = 5 fluid:: then input infusion:: from "5" top side

        else if clock has = 6 fluid:: then input infusion:: from "6" top side

        else if clock has = 7 fluid:: then input infusion:: from "7" top side

        end

        output infusion:: to infusion1 top side

        forget

        input infusion:: from infusion_in top side

        if infusion1 has = 0 infusion:: and each infusion_in has > 2 infusion:: then

            if item_redstone has > 0 then input from item_redstone output 1 infusion::redstone to infusion1 top side

            else if item_carbon has > 0 then input from item_carbon output 1 infusion::carbon to infusion1 top side

            else if item_diamond has > 0 then input from item_diamond output 1 infusion::diamond to infusion1 top side

            else if item_obsidian has > 0 then input from item_obsidian output 1 infusion::refined_obsidian to infusion1 top side

            end

        else

            output 1 infusion:: to infusion1 top side

            if infusion1 has > 0 infusion::redstone then input from item_redstone

            else if infusion1 has > 0 infusion::carbon then input from item_carbon

            else if infusion1 has > 0 infusion::diamond then input from item_diamond

            else if infusion1 has > 0 infusion::refined_obsidian then input from item_obsidian

            end

        end

        output 27 to item1

        forget

        input retain 1 infusion:: from infusion1 top side

        output infusion:: to infusion3 top side

        forget


        if item1 has > 0 then

            input from item1

            output "alloy_infused|ingot_osmium" to item_cost20

            output "alloy_reinforced" to item_cost40

            output to item_cost10


            input retain 1 infusion:: from each infusion_in top side

            output infusion:: to infusion1 top side

            forget

            if infusion1 has > 1 infusion:: then

                input infusion:: from infusion1 top side

                input from item_cost10

                if item_cost10 has > 0 and infusion1 has > 10 infusion:: then

                    if item_cost10 has >= 16 and infusion1 has > 160 infusion:: then

                        output 16 to item_try10

                        output 160 infusion:: to infusion2 top side end

                    if item_cost10 has >= 8 and infusion1 has > 80 infusion:: then

                        output 8 to item_try10

                        output 80 infusion:: to infusion2 top side end

                    if item_cost10 has >= 4 and infusion1 has > 40 infusion:: then

                        output 4 to item_try10

                        output 40 infusion:: to infusion2 top side end

                    if item_cost10 has >= 2 and infusion1 has > 20 infusion:: then

                        output 2 to item_try10

                        output 20 infusion:: to infusion2 top side end

                    if item_cost10 has >= 1 and infusion1 has > 10 infusion:: then

                        output 1 to item_try10

                        output 10 infusion:: to infusion2 top side

                    end

                end

                forget item_cost10


                input from item_cost20

                if item_cost20 has > 0 and infusion1 has > 20 infusion:: then

                    if item_cost20 has >= 16 and infusion1 has > 320 infusion:: then

                        output 16 to item_try20

                        output 320 infusion:: to infusion2 top side end

                    if item_cost20 has >= 8 and infusion1 has > 160 infusion:: then

                        output 8 to item_try20

                        output 160 infusion:: to infusion2 top side end

                    if item_cost20 has >= 4 and infusion1 has > 80 infusion:: then

                        output 4 to item_try20

                        output 80 infusion:: to infusion2 top side end

                    if item_cost20 has >= 2 and infusion1 has > 40 infusion:: then

                        output 2 to item_try20

                        output 40 infusion:: to infusion2 top side end

                    if item_cost20 has >= 1 and infusion1 has > 20 infusion:: then

                        output 1 to item_try20

                        output 20 infusion:: to infusion2 top side

                    end

                end

                forget item_cost20


                input from item_cost40

                if item_cost40 has > 0 and infusion1 has > 40 infusion:: then

                    if item_cost40 has >= 16 and infusion1 has > 640 infusion:: then

                        output 16 to item_try40

                        output 640 infusion:: to infusion2 top side end

                    if item_cost40 has >= 8 and infusion1 has > 320 infusion:: then

                        output 8 to item_try40

                        output 320 infusion:: to infusion2 top side end

                    if item_cost40 has >= 4 and infusion1 has > 160 infusion:: then

                        output 4 to item_try40

                        output 160 infusion:: to infusion2 top side end

                    if item_cost40 has >= 2 and infusion1 has > 80 infusion:: then

                        output 2 to item_try40

                        output 80 infusion:: to infusion2 top side end

                    if item_cost40 has >= 1 and infusion1 has > 40 infusion:: then

                        output 1 to item_try40

                        output 40 infusion:: to infusion2 top side

                    end

                end

                forget


                input from item_holder

                output retain 32 to each item_try

                forget

                input except cobblestone from item_try

                if clock has = 0 fluid:: then output retain 27 to "0" top side

                else if clock has = 1 fluid:: then output retain 27 to "1" top side

                else if clock has = 2 fluid:: then output retain 27 to "2" top side

                else if clock has = 3 fluid:: then output retain 27 to "3" top side

                else if clock has = 4 fluid:: then output retain 27 to "4" top side

                else if clock has = 5 fluid:: then output retain 27 to "5" top side

                else if clock has = 6 fluid:: then output retain 27 to "6" top side

                else if clock has = 7 fluid:: then output retain 27 to "7" top side

                end

                forget

                if some item_try has < 32 then

                    input from item_holder

                    input infusion:: from infusion2 top side

                    if item_try10 has < 32 then

                        if item_try10 has <= 16 then

                            output 160 infusion:: to infusion3 top side

                            output 16 to item_try10

                        end

                        if item_try10 has <= 24 then

                            output 80 infusion:: to infusion3 top side

                            output 8 to item_try10

                        end

                        if item_try10 has <= 28 then

                            output 40 infusion:: to infusion3 top side

                            output 4 to item_try10

                        end

                        if item_try10 has <= 30 then

                            output 20 infusion:: to infusion3 top side

                            output 2 to item_try10

                        end

                        if item_try10 has <= 31 then

                            output 10 infusion:: to infusion3 top side

                            output 1 to item_try10

                        end

                    end

                    if item_try20 has < 32 then

                        if item_try20 has <= 16 then

                            output 320 infusion:: to infusion3 top side

                            output 16 to item_try20

                        end

                        if item_try20 has <= 24 then

                            output 160 infusion:: to infusion3 top side

                            output 8 to item_try20

                        end

                        if item_try20 has <= 28 then

                            output 80 infusion:: to infusion3 top side

                            output 4 to item_try20

                        end

                        if item_try20 has <= 30 then

                            output 40 infusion:: to infusion3 top side

                            output 2 to item_try20

                        end

                        if item_try20 has <= 31 then

                            output 20 infusion:: to infusion3 top side

                            output 1 to item_try20

                        end

                    end

                    if item_try40 has < 32 then

                        if item_try40 has <= 16 then

                            output 640 infusion:: to infusion3 top side

                            output 16 to item_try40

                        end

                        if item_try40 has <= 24 then

                            output 320 infusion:: to infusion3 top side

                            output 8 to item_try40

                        end

                        if item_try40 has <= 28 then

                            output 160 infusion:: to infusion3 top side

                            output 4 to item_try40

                        end

                        if item_try40 has <= 30 then

                            output 80 infusion:: to infusion3 top side

                            output 2 to item_try40

                        end

                        if item_try40 has <= 31 then

                            output 40 infusion:: to infusion3 top side

                            output 1 to item_try40

                        end

                    end

                    forget

                end

            end

        end


        input from item1,item_cost,item_try

        output cobblestone to item_holder

        if infusion1 has > 0 infusion::redstone then output to item_redstone

        else if infusion1 has > 0 infusion::carbon then output to item_carbon

        else if infusion1 has > 0 infusion::diamond then output to item_diamond

        else if infusion1 has > 0 infusion::refined_obsidian then output to item_obsidian

        end

        input infusion:: from infusion3 top side

        if clock has = 0 fluid:: then output infusion:: to "0" top side

        else if clock has = 1 fluid:: then output infusion:: to "1" top side

        else if clock has = 2 fluid:: then output infusion:: to "2" top side

        else if clock has = 3 fluid:: then output infusion:: to "3" top side

        else if clock has = 4 fluid:: then output infusion:: to "4" top side

        else if clock has = 5 fluid:: then output infusion:: to "5" top side

        else if clock has = 6 fluid:: then output infusion:: to "6" top side

        else if clock has = 7 fluid:: then output infusion:: to "7" top side

        end

        forget

    end

    input infusion:: from infusion1,infusion2,infusion3 top side

    output infusion:: to infusion_in top side

end

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://acg.inmoke.com/zixun/Jk/30043.html