From e53d7576c3e5267495ac7c6cab6e46d5562d9579 Mon Sep 17 00:00:00 2001 From: Michieal Date: Mon, 19 Dec 2022 13:44:24 -0500 Subject: [PATCH] Made bamboo buttons flammable, and made them into a fuel source. Converted commented code snippet, addgroups() into global function. Stairs will be a fuel source in part 2. --- mods/ITEMS/mcl_bamboo/init.lua | 45 +++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/init.lua b/mods/ITEMS/mcl_bamboo/init.lua index 99b7c28db..a61eca59e 100644 --- a/mods/ITEMS/mcl_bamboo/init.lua +++ b/mods/ITEMS/mcl_bamboo/init.lua @@ -26,6 +26,25 @@ local USE_END_CAPS = false local BROKEN_DOORS = true -- LOCAL FUNCTIONS + +-- Add Groups function, courtesy of Warr1024. +function addgroups(name, ...) + local def = minetest.registered_items[name] or error(name .. " not found") + local groups = {} + for k, v in pairs(def.groups) do + groups[k] = v + end + local function addall(x, ...) + if not x then + return + end + groups[x] = 1 + return addall(...) + end + addall(...) + return minetest.override_item(name, {groups = groups}) +end + local function create_nodes() local bamboo_def = { @@ -467,7 +486,7 @@ local function create_nodes() "mcl_bamboo_bamboo_plank.png", "mcl_bamboo:bamboo_plank", node_sound, - {material_wood = 1, handy = 1, pickaxey = 1}, + {material_wood = 1, handy = 1, pickaxey = 1, flammable = 3, fire_flammability = 20, fire_encouragement = 5, }, 1, false, S("A bamboo button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."), @@ -727,6 +746,11 @@ local function register_craftings() type = "fuel", recipe = "mcl_stairs:slab_bamboo_stripped", burntime = 7.5, + }) "mesecons_button:button_bamboo_off" + minetest.register_craft({ + type = "fuel", + recipe = "mesecons_button:button_bamboo_off", + burntime = 5, }) end @@ -815,22 +839,3 @@ todo -- add in fuel recipes for: [-] bamboo stair + stripped bamboo stair + bamboo plank stair [-] bamboo button --]] - ---[[ -Useful code snippit for dealing with updating groups on already defined objects, such as api created items. -I think that this will be implemented, as time goes on, to deal with adding groups to slabs and the like. -local function addgroups(name, ...) - local def = minetest.registered_items[name] or error(name .. " not found") - local groups = {} - for k, v in pairs(def.groups) do - groups[k] = v - end - local function addall(x, ...) - if not x then return end - groups[x] = 1 - return addall(...) - end - addall(...) - return minetest.override_item(name, {groups = groups}) -end ---]]