add a method other mods can use to create hot rock variants easily

This commit is contained in:
FaceDeer 2019-07-07 12:33:53 -06:00
parent 9a21f59d29
commit 6623ebecf9
3 changed files with 55 additions and 27 deletions

@ -3,32 +3,6 @@ if magma_conduits.config.glowing_rock then
local modpath = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(modpath.."/intllib.lua")
minetest.register_node("magma_conduits:hot_cobble", {
description = S("Hot Cobble"),
_doc_items_longdesc = S("Hot stone riven with cracks and seeping traces of lava."),
_doc_items_usagehelp = S("When normal stone is heated by lava it is converted into this. Beware when digging here!"),
tiles = {"magma_conduits_hot_cobble.png"},
is_ground_content = false,
groups = {cracky = 3, stone = 2, lava_heated=1},
_magma_conduits_cools_to = "default:cobble",
sounds = default.node_sound_stone_defaults(),
light_source = 6,
drop = "default:cobble",
})
minetest.register_node("magma_conduits:glow_obsidian", {
description = S("Hot Obsidian"),
_doc_items_longdesc = S("Obsidian heated to a dull red glow."),
_doc_items_usagehelp = S("When normal obsidian is heated by lava it is converted into this. Beware when digging here!"),
tiles = {"magma_conduits_glow_obsidian.png"},
is_ground_content = true,
sounds = default.node_sound_stone_defaults(),
groups = {cracky=1, lava_heated=1, level=2},
_magma_conduits_cools_to = "default:obsidian",
light_source = 6,
drop = "default:obsidian",
})
local simple_copy
simple_copy = function(t)
local r = {}
@ -42,6 +16,56 @@ simple_copy = function(t)
return r
end
magma_conduits.make_hot_node_def = function(name, original_def)
original_def.groups = original_def.groups or {}
local hot_node_def = simple_copy(original_def)
local hot_name = name .. "_glowing"
original_def.groups.lava_heatable = 1
original_def._magma_conduits_heats_to = hot_name
hot_node_def.groups.lava_heated = 1
hot_node_def.groups.not_in_creative_inventory = 1
hot_node_def._magma_conduits_cools_to = name
hot_node_def.description = S("Hot @1", hot_node_def.description)
for k, v in ipairs(hot_node_def.tiles) do
hot_node_def.tiles[k] = v .. "^magma_conduits_lava_overlay.png"
end
hot_node_def.light_source = 6
if hot_node_def.drop == nil then
hot_node_def.drop = name
end
return hot_name, hot_node_def
end
minetest.register_node("magma_conduits:hot_cobble", {
description = S("Hot Cobble"),
_doc_items_longdesc = S("Hot stone riven with cracks and seeping traces of lava."),
_doc_items_usagehelp = S("When normal stone is heated by lava it is converted into this. Beware when digging here!"),
tiles = {"magma_conduits_hot_cobble.png"},
is_ground_content = false,
groups = {cracky = 3, stone = 2, lava_heated=1, not_in_creative_inventory=1},
_magma_conduits_cools_to = "default:cobble",
sounds = default.node_sound_stone_defaults(),
light_source = 6,
drop = "default:cobble",
})
minetest.register_node("magma_conduits:glow_obsidian", {
description = S("Hot Obsidian"),
_doc_items_longdesc = S("Obsidian heated to a dull red glow."),
_doc_items_usagehelp = S("When normal obsidian is heated by lava it is converted into this. Beware when digging here!"),
tiles = {"magma_conduits_glow_obsidian.png"},
is_ground_content = true,
sounds = default.node_sound_stone_defaults(),
groups = {cracky=1, lava_heated=1, level=2, not_in_creative_inventory=1},
_magma_conduits_cools_to = "default:obsidian",
light_source = 6,
drop = "default:obsidian",
})
-- can't use minetest.override_item to change group memberships here due to issue https://github.com/minetest/minetest/issues/5518
local make_heatable = function(nodename, heats_to)

@ -1,3 +1,7 @@
The following are from the Caverealms mod by HeroOfTheWinds, licensed under the WTFPL:
magma_conduits_hot_cobble.png
The following is derived from the default mod under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0):
magma_conduits_lava_overlay.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B