From ed7b346bde53b009205e73a9f32d4bc234deac22 Mon Sep 17 00:00:00 2001
From: flux <25628292+fluxionary@users.noreply.github.com>
Date: Fri, 17 Jun 2022 10:16:24 -0700
Subject: [PATCH] add compatability with reworked moreblocks/stairplus
---
app/index.html | 1 +
app/js/components/item-detail.js | 3 ++
app/js/components/nav-bar.js | 8 +++++
app/js/components/stairsplus-list.js | 47 ++++++++++++++++++++++++++++
app/js/main.js | 3 ++
items.lua | 11 +++++--
mod.conf | 2 +-
readme.md | 1 +
8 files changed, 72 insertions(+), 4 deletions(-)
create mode 100644 app/js/components/stairsplus-list.js
diff --git a/app/index.html b/app/index.html
index 622f1fd..26255a6 100644
--- a/app/index.html
+++ b/app/index.html
@@ -39,6 +39,7 @@
+
diff --git a/app/js/components/item-detail.js b/app/js/components/item-detail.js
index 746702c..194be6b 100644
--- a/app/js/components/item-detail.js
+++ b/app/js/components/item-detail.js
@@ -44,6 +44,9 @@ Vue.component("item-detail", {
Circular-saw
+
+ Circular-saw
+
Technic CNC
diff --git a/app/js/components/nav-bar.js b/app/js/components/nav-bar.js
index 36cd087..e4f2a61 100644
--- a/app/js/components/nav-bar.js
+++ b/app/js/components/nav-bar.js
@@ -3,6 +3,9 @@ Vue.component("nav-bar", {
has_moreblocks: function(){
return mtinfo.items["moreblocks:circular_saw"];
},
+ has_stairsplus: function(){
+ return mtinfo.items["stairsplus:circular_saw"];
+ },
has_technic_cnc: function(){
return mtinfo.items["technic:cnc"];
}
@@ -36,6 +39,11 @@ Vue.component("nav-bar", {
Moreblocks
+
+
+
+ Stairs+
+
diff --git a/app/js/components/stairsplus-list.js b/app/js/components/stairsplus-list.js
new file mode 100644
index 0000000..3f11160
--- /dev/null
+++ b/app/js/components/stairsplus-list.js
@@ -0,0 +1,47 @@
+
+Vue.component("stairsplus-list", {
+ data: function(){
+ return {
+ page: +this.$route.query.page || 1
+ };
+ },
+ watch: {
+ $route: function(){
+ this.page = +this.$route.query.page || 1;
+ }
+ },
+ computed: {
+ list: function(){
+ return Object.keys(mtinfo.items)
+ .map(name => mtinfo.items[name])
+ .filter(item => item.new_circular_saw);
+ }
+ },
+ template:`
+
+
Circular saw compatible nodes
+
+
+ Mod |
+ Type |
+ Image |
+ Nodename |
+
+
+ {{ item.name.substring(0, item.name.indexOf(":")) }} |
+
+ {{ item.type }}
+ |
+
+
+ |
+
+
+ {{ item.name }}
+
+ |
+
+
+
+ `
+});
diff --git a/app/js/main.js b/app/js/main.js
index 250fc59..b13dd62 100644
--- a/app/js/main.js
+++ b/app/js/main.js
@@ -17,6 +17,9 @@ const router = new VueRouter({
}, {
path: "/moreblocks",
component: { template: `` }
+ }, {
+ path: "/stairsplus",
+ component: { template: `` }
}, {
path: "/cnc",
component: { template: `` }
diff --git a/items.lua b/items.lua
index cafa503..eb1142e 100644
--- a/items.lua
+++ b/items.lua
@@ -32,10 +32,12 @@ local item_mapped_keys = {
"mtinfo"
}
+local has_old_moreblocks = minetest.get_modpath("moreblocks") and minetest.global_exists("circular_saw")
+local has_new_stairsplus = minetest.get_modpath("stairsplus") and stairsplus.api
+local has_technic_cnc = minetest.get_modpath("technic_cnc")
+
function mtinfo.export_items()
local data = {}
- local has_moreblocks = minetest.get_modpath("moreblocks")
- local has_technic_cnc = minetest.get_modpath("technic_cnc")
mtinfo.map_list(data, minetest.registered_items, item_mapped_keys, function(def)
if def.groups and def.groups.not_in_creative_inventory then
@@ -44,10 +46,13 @@ function mtinfo.export_items()
return true
end
end, function(name, item, def)
- if has_moreblocks and circular_saw.known_nodes[name] then
+ if has_old_moreblocks and circular_saw.known_nodes[name] then
-- moreblocks enabled
item.circular_saw = true
end
+ if has_new_stairsplus and stairsplus.api.get_shapes_hash(name) then
+ item.new_circular_saw = true
+ end
if has_technic_cnc and minetest.registered_items[name .. "_technic_cnc_slope"] then
-- partial or full cnc support
item.cnc = true
diff --git a/mod.conf b/mod.conf
index efeed0c..3be83eb 100644
--- a/mod.conf
+++ b/mod.conf
@@ -1,2 +1,2 @@
name = mtinfo
-optional_depends = technic, moreblocks
+optional_depends = technic, moreblocks, stairsplus
diff --git a/readme.md b/readme.md
index 0f9f622..b128a07 100644
--- a/readme.md
+++ b/readme.md
@@ -24,6 +24,7 @@ Generates a static info-page about the world, stats include:
## Usage
* Install the mod
+* Enable the setting in minetest.conf (`mtinfo.enabled = true`)
* Start the world
* Open the generated `index.html` in the world-folder `mtinfo` with a web-browser