mt-mods / technic

Technic mod for Minetest
18 stars 25 forks source link

i3 integration #319

Closed beepbopbeepboop closed 1 year ago

beepbopbeepboop commented 1 year ago

i3 integration is nice:

$ git diff

diff --git a/mods/technic_plus/technic/machines/register/alloy_recipes.lua b/mods/technic_plus/technic/machines/register/alloy_recipes.lua
index 0165ad9..6285e06 100644
--- a/mods/technic_plus/technic/machines/register/alloy_recipes.lua
+++ b/mods/technic_plus/technic/machines/register/alloy_recipes.lua
@@ -4,6 +4,7 @@ local S = technic.getter
 technic.register_recipe_type("alloy", {
    description = S("Alloying"),
    input_size = 2,
+   icon = "technic_lv_alloy_furnace_front_active.png",
 })

 function technic.register_alloy_recipe(data)
diff --git a/mods/technic_plus/technic/machines/register/centrifuge_recipes.lua b/mods/technic_plus/technic/machines/register/centrifuge_recipes.lua
index a20b3b1..7b677d5 100644
--- a/mods/technic_plus/technic/machines/register/centrifuge_recipes.lua
+++ b/mods/technic_plus/technic/machines/register/centrifuge_recipes.lua
@@ -3,6 +3,7 @@ local S = technic.getter
 technic.register_recipe_type("separating", {
    description = S("Separating"),
    output_size = 2,
+   icon = "technic_mv_centrifuge_front_active.png",
 })

 function technic.register_separating_recipe(data)
diff --git a/mods/technic_plus/technic/machines/register/compressor_recipes.lua b/mods/technic_plus/technic/machines/register/compressor_recipes.lua
index 1946a26..ea06526 100644
--- a/mods/technic_plus/technic/machines/register/compressor_recipes.lua
+++ b/mods/technic_plus/technic/machines/register/compressor_recipes.lua
@@ -1,7 +1,10 @@

 local S = technic.getter

-technic.register_recipe_type("compressing", { description = S("Compressing") })
+technic.register_recipe_type("compressing", {
+   description = S("Compressing"),
+   icon = "technic_lv_compressor_front_active.png",
+})

 function technic.register_compressor_recipe(data)
    data.time = data.time or 4
diff --git a/mods/technic_plus/technic/machines/register/extractor_recipes.lua b/mods/technic_plus/technic/machines/register/extractor_recipes.lua
index 6f8dd25..9aba9c1 100644
--- a/mods/technic_plus/technic/machines/register/extractor_recipes.lua
+++ b/mods/technic_plus/technic/machines/register/extractor_recipes.lua
@@ -1,7 +1,10 @@

 local S = technic.getter

-technic.register_recipe_type("extracting", { description = S("Extracting") })
+technic.register_recipe_type("extracting", {
+   description = S("Extracting"),
+   icon = "technic_lv_extractor_front_active.png",
+})

 function technic.register_extractor_recipe(data)
    data.time = data.time or 4
diff --git a/mods/technic_plus/technic/machines/register/freezer_recipes.lua b/mods/technic_plus/technic/machines/register/freezer_recipes.lua
index 641b28a..f8aa7b6 100644
--- a/mods/technic_plus/technic/machines/register/freezer_recipes.lua
+++ b/mods/technic_plus/technic/machines/register/freezer_recipes.lua
@@ -1,7 +1,10 @@

 local S = technic.getter

-technic.register_recipe_type("freezing", { description = S("Freezing") })
+technic.register_recipe_type("freezing", {
+   description = S("Freezing"),
+   icon = "technic_mv_freezer_front_active.png",
+})

 function technic.register_freezer_recipe(data)
    data.time = data.time or 5
diff --git a/mods/technic_plus/technic/machines/register/grinder_recipes.lua b/mods/technic_plus/technic/machines/register/grinder_recipes.lua
index 670372f..a0ab156 100644
--- a/mods/technic_plus/technic/machines/register/grinder_recipes.lua
+++ b/mods/technic_plus/technic/machines/register/grinder_recipes.lua
@@ -1,7 +1,10 @@

 local S = technic.getter

-technic.register_recipe_type("grinding", { description = S("Grinding") })
+technic.register_recipe_type("grinding", {
+   description = S("Grinding"),
+   icon = "technic_lv_grinder_front_active.png",
+})

 function technic.register_grinder_recipe(data)
    data.time = data.time or 3
diff --git a/mods/technic_plus/technic/machines/register/recipes.lua b/mods/technic_plus/technic/machines/register/recipes.lua
index 3afe765..9b875ba 100644
--- a/mods/technic_plus/technic/machines/register/recipes.lua
+++ b/mods/technic_plus/technic/machines/register/recipes.lua
@@ -1,4 +1,5 @@
 local have_ui = minetest.get_modpath("unified_inventory")
+local have_i3 = minetest.get_modpath("i3")

 technic.recipes = { cooking = { input_size = 1, output_size = 1 } }
 function technic.register_recipe_type(typename, origdata)
@@ -13,6 +14,12 @@ function technic.register_recipe_type(typename, origdata)
            height = 1,
        })
    end
+   if have_i3 and i3.register_craft_type and data.output_size == 1 then
+       i3.register_craft_type(typename, {
+           description = data.description,
+           icon = data.icon
+       })
+   end
    data.recipes = {}
    technic.recipes[typename] = data
 end
@@ -59,6 +66,13 @@ local function register_recipe(typename, data)
            width = 0,
        })
    end
+   if have_i3 and technic.recipes[typename].output_size == 1 then
+       i3.register_craft({
+           type = typename,
+           result = data.output,
+           items = data.input,
+       })
+   end
 end

 function technic.register_recipe(typename, data)
S-S-X commented 1 year ago

Unclear what you're asking, fix issue formatting by editing it.

Athozus commented 1 year ago

If you know i3 integration, just open a PR. Btw, sending a diff like that is unreadable.

OgelGames commented 1 year ago

Seems like you're asking for what was added in https://github.com/mt-mods/technic/commit/6c09f739c4d831df8d9243d1e9981fd8ab805a96 and https://github.com/mt-mods/technic/commit/a4a3be5466cf0e30020b8cda93e08a4aff493bdf

You should check what version of technic you're using, as technic_plus on ContentDB does not yet have these changes, but technic_plus_beta does (https://content.minetest.net/packages/mt-mods/technic_plus_beta/). We're working on releasing v2.0.0 soon though, after which technic_plus will have everything technic_plus_beta already has.