设为首页收藏本站 天气与日历

异星工厂 制作MOD教程 异星工厂怎么制作MOD

[复制链接]
查看29 | 回复0 | 2023-3-1 13:54:50 | 显示全部楼层 |阅读模式
异星工厂 制作MOD教程 异星工厂怎么制作MOD
首先,游戏目录下有个【mods】文件夹,
在【mods】文件夹下面再建一个【MyMods】文件夹,
在【MyMods】文件夹里面用记事本之类的编辑器新建一个【info.json】文件,
【info.json】文件的内容是:
{
  • "name":"MyMods",  "author":"MyMods",
  • "version":"0.0.1",  "title":"MyMods",
  • "homepage":"http://www..com",  "description":"MyMods",
  • "dependencies": ["base"] } [/ol]
    然后再新建一个目录【Items】,什么名称的目录都可以,
    把【\Factorio\data\base\prototypes\item\demo-mining-tools.lua】这个官方文件复制到【Items】文件夹里面,
    好了,回到【MyMods】文件夹,新建一个【data.lua】文件
    【data.lua】文件的内容是:
    -- Items 这里是注释
  • require("Items.demo-mining-tools ") [/ol]
    这里解释一下,require("目录.文件名"),就是启用这个文件里面的物品啦。
    好了,抛砖引玉,举一反三,大伙疯狂的制作Mod吧,顺便有时间也写个跟详细的教程出来,谢谢~~
    官方【demo-mining-tools.lua】文件的内容是:
    data:extend(
  • {   {
  •     type = "mining-tool",     name = "iron-axe",
  •     icon = "__base__/graphics/icons/iron-axe.png",     flags = {"goes-to-main-inventory"},
  •     action =     {
  •       type="direct",       action_delivery =
  •       {         type = "instant",
  •         target_effects =         {
  •             type = "damage",             damage = { amount = 5 , type = "physical"}
  •         }       }
  •     },     durability = 4000,
  •     subgroup = "tool",     order = "a[mining]-a[iron-axe]",
  •     speed = 2.5,     stack_size = 32
  •   } }
  • ) [/ol]
    durability = 4000 这里是耐久度。 speed=2.5 这里是采矿速度。
    知道怎么改了吧,呵呵~~
    这里是添加新物品的教程:
    新建了一个【MyMods\Items\MineralResource.lua】文件,专门放原料物品;
    data:extend(
  • {   {
  •     -- 这里是原版煤矿的内容;     type = "item",
  •     name = "coal",     icon = "__base__/graphics/icons/coal.png",
  •     flags = {"goes-to-main-inventory"},     fuel_value = "8MJ",
  •     subgroup = "raw-material", -- 这里表示原材料;     order = "b[coal]",
  •     stack_size = 64   },
  •   {     -- 这里是新建物品的内容;
  •     type = "item",     name = "PrimaryCompressCoal",
  •     icon = "__base__/graphics/icons/coal.png", -- 这里表示物品的图片,自己美化也行的;     flags = {"goes-to-main-inventory"}, -- 这里表示放入物品栏,不是武器栏;
  •     fuel_value = "16MJ", -- 这里表示燃烧值;     subgroup = "intermediate-product", -- 这里表示手工制品,当然工厂也可以制造;
  •     order = "b[coal]",     stack_size = 128 -- 这里表示堆积数量;
  •   },   {
  •     -- 这里是新建物品的内容;     type = "item",
  •     name = "AdvancedCompressCoal",     icon = "__base__/graphics/icons/coal.png",
  •     flags = {"goes-to-main-inventory"},     fuel_value = "32MJ",
  •     subgroup = "intermediate-product",     order = "b[coal]",
  •     stack_size = 256   },
  •   {     -- 这里是新建物品的内容;
  •     type = "item",     name = "Coke",
  •     icon = "__base__/graphics/icons/coal.png",     flags = {"goes-to-main-inventory"},
  •     fuel_value = "64MJ",     subgroup = "intermediate-product",
  •     order = "b[coal]",     stack_size = 256
  •   } }
  • ) [/ol]
    新物品要有名称吧,新建【MyMods\locale\ch\ItemNames.cfg】文件;
    [item-name]
  • #这里是原版翻译,可以自己润色;# coal=煤矿
  • #这里是新建物品的名称翻译;# PrimaryCompressCoal=初压煤
  • AdvancedCompressCoal=高压煤 Coke=焦煤 [/ol]
    新物品要有配方,新建【\MyMods\Recipe\ItemRecipe.lua】
    data:extend(
  • {   {
  •     type = "recipe",     name = "PrimaryCompressCoal",
  •     ingredients = {{"coal", 1}}, -- 这里是原料以及数量;     result = "PrimaryCompressCoal" -- 这里是产品;
  •   },   {
  •     type = "recipe",     name = "AdvancedCompressCoal",
  •     ingredients = {{"PrimaryCompressCoal", 1}},     result = "AdvancedCompressCoal"
  •   },   {
  •     type = "recipe",     name = "Coke",
  •     ingredients = {{"AdvancedCompressCoal", 1}},     result = "Coke"
  •   } }
  • ) [/ol]
    完成之后记得在【\MyMods\data.lua】里面添加信息,否则不起作用的~~
    -- Items
  • require("Items.MineralResource") --
  • require("Recipe.ItemRecipe") [/ol]
    好了,进游戏玩自己的去吧~

    点击进入3DMGAME《异星工厂》游戏论坛专区
  • 回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则