異星工廠 製作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"]
- }
然後再新建一個目錄【Items】,什麽名稱的目錄都可以,
把【\Factorio\data\base\prototypes\item\demo-mining-tools.lua】這個官方檔案複製到【Items】檔案夾裡面,
好了,回到【MyMods】檔案夾,新建一個【data.lua】檔案
【data.lua】檔案的內容是:
- -- Items 這裡是注釋
- require("Items.demo-mining-tools ")
這裡解釋一下,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
- }
- }
- )
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
- }
- }
- )
新物品要有名稱吧,新建【MyMods\locale\ch\ItemNames.cfg】檔案;
- [item-name]
- #這裡是原版翻譯,可以自己潤色;#
- coal=煤礦
- #這裡是新建物品的名稱翻譯;#
- PrimaryCompressCoal=初壓煤
- AdvancedCompressCoal=高壓煤
- Coke=焦煤
新物品要有配方,新建【\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"
- }
- }
- )
完成之後記得在【\MyMods\data.lua】裡面添加訊息,否則不起作用的~~
- -- Items
- require("Items.MineralResource")
- --
- require("Recipe.ItemRecipe")
好了,進遊戲玩自己的去吧~
點擊進入3DMGAME《異星工廠》遊戲論壇專區