From 2906e9e8b986e33bd793d46c52d4c7c2ba268449 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Wed, 24 Mar 2021 18:20:36 +0100 Subject: [PATCH] circular saw flag --- .luacheckrc | 2 +- app/js/components/item-detail.js | 1 + common.lua | 6 +++++- items.lua | 11 ++++++++--- mod.conf | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index ac94689..1a52cef 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -15,6 +15,6 @@ read_globals = { "dump", -- optional deps - "technic" + "technic", "circular_saw" } diff --git a/app/js/components/item-detail.js b/app/js/components/item-detail.js index c1d28d1..73d68a8 100644 --- a/app/js/components/item-detail.js +++ b/app/js/components/item-detail.js @@ -33,6 +33,7 @@ Vue.component("item-detail", { Pointable Airlike Walkable + Circular-saw compatible

Stack-max: {{ item.stack_max }}

Light-source: {{ item.light_source }}

Damage per second: {{ item.damage_per_second }}

diff --git a/common.lua b/common.lua index c3d0e2c..c2c4571 100644 --- a/common.lua +++ b/common.lua @@ -1,10 +1,13 @@ -function mtinfo.map_list(target, list, keys, filter) +function mtinfo.map_list(target, list, keys, filter, enhancefn) filter = filter or function() -- show all return true end + -- no-op + enhancefn = enhancefn or function() end + for name, def in pairs(list) do if filter(def) then local item = {} @@ -18,6 +21,7 @@ function mtinfo.map_list(target, list, keys, filter) end end end + enhancefn(name, item) target[name] = item end end diff --git a/items.lua b/items.lua index 174e0a2..f371a6d 100644 --- a/items.lua +++ b/items.lua @@ -32,14 +32,19 @@ local item_mapped_keys = { } function mtinfo.export_items() - local data = {} + local data = {} + local has_moreblocks = minetest.get_modpath("moreblocks") - mtinfo.map_list(data, minetest.registered_items, item_mapped_keys, function(def) + mtinfo.map_list(data, minetest.registered_items, item_mapped_keys, function(def) if def.groups and def.groups.not_in_creative_inventory then return false else return true end + end, function(name, item) + if has_moreblocks and circular_saw.known_nodes[name] then + item.circular_saw = true + end end) - mtinfo.export_json(mtinfo.basepath.."/data/items.js", data, "mtinfo.items") + mtinfo.export_json(mtinfo.basepath.."/data/items.js", data, "mtinfo.items") end diff --git a/mod.conf b/mod.conf index 1961257..efeed0c 100644 --- a/mod.conf +++ b/mod.conf @@ -1,2 +1,2 @@ name = mtinfo -optional_depends = technic +optional_depends = technic, moreblocks