circular saw flag

This commit is contained in:
BuckarooBanzay 2021-03-24 18:20:36 +01:00
parent d711fd5f33
commit 2906e9e8b9
5 changed files with 16 additions and 6 deletions

View File

@ -15,6 +15,6 @@ read_globals = {
"dump",
-- optional deps
"technic"
"technic", "circular_saw"
}

View File

@ -33,6 +33,7 @@ Vue.component("item-detail", {
<span v-if="item.pointable" class="badge badge-success">Pointable</span>
<span v-if="item.airlike" class="badge badge-success">Airlike</span>
<span v-if="item.walkable" class="badge badge-success">Walkable</span>
<span v-if="item.circular_saw" class="badge badge-primary">Circular-saw compatible</span>
<p>Stack-max: <span class="badge badge-primary">{{ item.stack_max }}</span></p>
<p v-if="item.light_source">Light-source: <span class="badge badge-primary">{{ item.light_source }}</span></p>
<p v-if="item.damage_per_second">Damage per second: <span class="badge badge-warning">{{ item.damage_per_second }}</span></p>

View File

@ -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

View File

@ -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

View File

@ -1,2 +1,2 @@
name = mtinfo
optional_depends = technic
optional_depends = technic, moreblocks