summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.luacheckrc8
-rw-r--r--depends.txt2
-rw-r--r--init.lua31
-rw-r--r--mod.conf4
4 files changed, 27 insertions, 18 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..6553cca
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,8 @@
+max_line_length = 160
+
+read_globals = {
+ "core",
+ "unifieddyes",
+ "stairsplus",
+ "default",
+}
diff --git a/depends.txt b/depends.txt
deleted file mode 100644
index b46e7ca..0000000
--- a/depends.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-moreblocks?
-unifieddyes
diff --git a/init.lua b/init.lua
index 1b4fe18..564429a 100644
--- a/init.lua
+++ b/init.lua
@@ -1,31 +1,32 @@
-minetest.register_node("plasticbox:plasticbox", {
+core.register_node("plasticbox:plasticbox", {
description = "Plastic Box",
tiles = {"plasticbox_white.png"},
is_ground_content = false,
groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1},
- sounds = default.node_sound_stone_defaults(),
+ sounds = core.global_exists("default") and default.node_sound_stone_defaults(),
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
on_construct = unifieddyes.on_construct,
- on_dig = unifieddyes.on_dig,
+ on_dig = not unifieddyes.preserve_metadata and unifieddyes.on_dig or nil,
+ preserve_metadata = unifieddyes.preserve_metadata,
})
-if minetest.global_exists("stairsplus") then
+if core.global_exists("stairsplus") then
stairsplus:register_all("plasticbox", "plasticbox", "plasticbox:plasticbox", {
description = "Plastic",
tiles = {"plasticbox_white.png"},
groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1},
- sounds = default.node_sound_stone_defaults(),
+ sounds = core.global_exists("default") and default.node_sound_stone_defaults(),
})
end
-minetest.register_craft( {
- output = "plasticbox:plasticbox 4",
- recipe = {
- { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
- { "basic_materials:plastic_sheet", "", "basic_materials:plastic_sheet" },
- { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
- },
+core.register_craft( {
+ output = "plasticbox:plasticbox 4",
+ recipe = {
+ { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
+ { "basic_materials:plastic_sheet", "", "basic_materials:plastic_sheet" },
+ { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
+ },
})
unifieddyes.register_color_craft({
@@ -36,7 +37,6 @@ unifieddyes.register_color_craft({
{ "NEUTRAL_NODE", "NEUTRAL_NODE", "NEUTRAL_NODE" },
{ "NEUTRAL_NODE", "MAIN_DYE", "NEUTRAL_NODE" },
{ "NEUTRAL_NODE", "NEUTRAL_NODE", "NEUTRAL_NODE" },
-
}
})
@@ -51,7 +51,7 @@ unifieddyes.register_color_craft({
}
})
-minetest.register_lbm({
+core.register_lbm({
name = "plasticbox:convert_colors",
label = "Convert plastic boxes to use param2 color",
nodenames = {
@@ -93,7 +93,6 @@ minetest.register_lbm({
local oldcolor = string.sub(name,string.len("plasticbox:plasticbox_-"),-1)
node.name = "plasticbox:plasticbox"
if conv[oldcolor] then node.param2 = conv[oldcolor] end
- minetest.set_node(pos,node)
+ core.set_node(pos,node)
end,
})
-
diff --git a/mod.conf b/mod.conf
new file mode 100644
index 0000000..ef22f44
--- /dev/null
+++ b/mod.conf
@@ -0,0 +1,4 @@
+name = plasticbox
+description = Plastic Box
+depends = unifieddyes
+optional_depends = moreblocks,default