diff options
| author | 2424barrier <2424barrier.minetest@gmail.com> | 2026-03-14 00:33:43 +0000 |
|---|---|---|
| committer | 2424barrier <2424barrier.minetest@gmail.com> | 2026-03-14 00:33:43 +0000 |
| commit | aa62f26a7fe4557748f5ca1c1bd47264bd015130 (patch) | |
| tree | 786fc3f0b24c257a686ddb25486143e132f391ed | |
| parent | 97f1f74d48b1be9d9ecfbc72900cf3d290730994 (diff) | |
| download | plasticbox-aa62f26a7fe4557748f5ca1c1bd47264bd015130.tar plasticbox-aa62f26a7fe4557748f5ca1c1bd47264bd015130.tar.gz plasticbox-aa62f26a7fe4557748f5ca1c1bd47264bd015130.tar.bz2 plasticbox-aa62f26a7fe4557748f5ca1c1bd47264bd015130.tar.xz plasticbox-aa62f26a7fe4557748f5ca1c1bd47264bd015130.zip | |
* Switch to newer 'core' namespace
* Move away from deprecated 'unifieddyes.on_dig'
* Update .luacheckrc
* Minor formatting changes
| -rw-r--r-- | .luacheckrc | 2 | ||||
| -rw-r--r-- | init.lua | 31 |
2 files changed, 16 insertions, 17 deletions
diff --git a/.luacheckrc b/.luacheckrc index 4dca9a8..6553cca 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,7 +1,7 @@ max_line_length = 160 read_globals = { - "minetest", + "core", "unifieddyes", "stairsplus", "default", @@ -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 = minetest.global_exists("default") and 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 = minetest.global_exists("default") and 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, }) - |
