Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
7ad7a5e842 | |||
eed93cbc5d | |||
31f5af2c58 | |||
0f2b5b7b2f | |||
a16e960ac1 | |||
270da9bf78 | |||
003fe506b7 | |||
ef8a1c1fb8 | |||
56beb55b63 | |||
afc0917979 | |||
f0fdcb4e08 | |||
84e05d2a2a | |||
31bdd56979 | |||
c1911548bb | |||
fc72bff4c0 | |||
819effe640 | |||
8f085b2c7f | |||
02ed4189dc |
514
blocks.lua
Executable file → Normal file
@ -1,21 +1,129 @@
|
||||
-- BobBlocks mod by RabbiBob
|
||||
-- State Changes
|
||||
|
||||
local bobblock_colours = {"red", "orange", "yellow", "green", "blue", "indigo", "violet", "white"}
|
||||
bobblocks = {}
|
||||
bobblocks.old_static_nodes = {}
|
||||
|
||||
local function update_bobblock(pos, node)
|
||||
--Switch Block State
|
||||
minetest.add_node(pos, {name = 'bobblocks:'..node})
|
||||
minetest.sound_play("bobblocks_glassblock", {
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 32,
|
||||
})
|
||||
bobblocks.colorlist = {
|
||||
"red",
|
||||
"orange",
|
||||
"yellow",
|
||||
"green",
|
||||
"blue",
|
||||
"indigo",
|
||||
"violet",
|
||||
"white",
|
||||
"grey"
|
||||
}
|
||||
|
||||
bobblocks.opacity = 150 -- Opacity: 0-255; 0 Full transparent, 255 Full opaque
|
||||
|
||||
bobblocks.update_bobblock = function (pos, node)
|
||||
local newnode = node
|
||||
if string.find(newnode.name, "_off") then
|
||||
newnode.name = string.sub(newnode.name, 1, -5)
|
||||
else
|
||||
newnode.name = newnode.name.."_off"
|
||||
end
|
||||
|
||||
minetest.swap_node(pos, newnode)
|
||||
minetest.sound_play("bobblocks_glassblock",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
end
|
||||
|
||||
|
||||
-- Nodes
|
||||
-- Misc Node
|
||||
|
||||
minetest.register_node("bobblocks:block", {
|
||||
description = "Bobblocks Plain Block",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"bobblocks_block.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "color",
|
||||
palette = "unifieddyes_palette_extended.png",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
||||
mesecons = {conductor={
|
||||
state = mesecon.state.on,
|
||||
offstate = "bobblocks:block_off"
|
||||
}
|
||||
},
|
||||
on_rightclick = bobblocks.update_bobblock,
|
||||
on_construct = unifieddyes.on_construct,
|
||||
on_dig = unifieddyes.on_dig,
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:block_off", {
|
||||
description = "Bobblocks Plain Block (off)",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity},
|
||||
paramtype2 = "color",
|
||||
palette = "unifieddyes_palette_extended.png",
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||
drop = "bobblocks:block",
|
||||
mesecons = {conductor={
|
||||
state = mesecon.state.off,
|
||||
onstate = "bobblocks:block"
|
||||
}
|
||||
},
|
||||
on_rightclick = bobblocks.update_bobblock,
|
||||
on_construct = unifieddyes.on_construct,
|
||||
on_dig = unifieddyes.on_dig,
|
||||
})
|
||||
|
||||
-- Block Poles
|
||||
minetest.register_node("bobblocks:pole", {
|
||||
description = "Bobblocks Pole",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"bobblocks_block.png"},
|
||||
inventory_image = ("bobblocks_pole_inv.png"),
|
||||
paramtype = "light",
|
||||
paramtype2 = "color",
|
||||
palette = "unifieddyes_palette_extended.png",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
||||
mesecons = {conductor={
|
||||
state = mesecon.state.on,
|
||||
offstate = "bobblocks:pole_off"
|
||||
}
|
||||
},
|
||||
on_rightclick = bobblocks.update_bobblock,
|
||||
on_construct = unifieddyes.on_construct,
|
||||
on_dig = unifieddyes.on_dig,
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:pole_off", {
|
||||
description = "Bobblocks Pole (off)",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity},
|
||||
paramtype = "light",
|
||||
paramtype2 = "color",
|
||||
palette = "unifieddyes_palette_extended.png",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = LIGHT_MAX-10,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||
drop = 'bobblocks:pole',
|
||||
mesecons = {conductor={
|
||||
state = mesecon.state.off,
|
||||
onstate = "bobblocks:pole"
|
||||
}
|
||||
},
|
||||
on_rightclick = bobblocks.update_bobblock,
|
||||
on_construct = unifieddyes.on_construct,
|
||||
on_dig = unifieddyes.on_dig,
|
||||
})
|
||||
|
||||
-- old nodes grandfathered-in because they have a different texture or usage than the colored ones.
|
||||
|
||||
minetest.register_node("bobblocks:btm", {
|
||||
description = "Bobs TransMorgifier v5",
|
||||
@ -24,224 +132,234 @@ minetest.register_node("bobblocks:btm", {
|
||||
inventory_image = "bobblocks_btm.png",
|
||||
paramtype2 = "facedir",
|
||||
legacy_facedir_simple = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
|
||||
|
||||
for _, colour in ipairs(bobblock_colours) do
|
||||
|
||||
|
||||
--Blocks
|
||||
|
||||
minetest.register_node("bobblocks:"..colour.."block", {
|
||||
description = colour.." Block",
|
||||
minetest.register_node("bobblocks:wavyblock", {
|
||||
description = "Bobblocks Wavy-textured Block",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"bobblocks_"..colour.."block.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_"..colour.."block.png"),
|
||||
tiles = {"bobblocks_wavyblock.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "color",
|
||||
palette = "unifieddyes_palette_extended.png",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = default.LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
on_punch = function(pos)
|
||||
update_bobblock(pos, colour.."block_off")
|
||||
end,
|
||||
mesecons = {
|
||||
conductor={
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
||||
mesecons = {conductor=
|
||||
{
|
||||
state = mesecon.state.on,
|
||||
offstate = "bobblocks:"..colour.."block_off"
|
||||
offstate = "bobblocks:wavyblock_off"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:"..colour.."block_off", {
|
||||
description = colour.." Block",
|
||||
tiles = {"bobblocks_"..colour.."block.png"},
|
||||
is_ground_content = true,
|
||||
alpha = 160,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||
drop = 'bobblocks:'..colour..'block',
|
||||
on_punch = function(pos)
|
||||
update_bobblock(pos, colour.."block")
|
||||
end,
|
||||
mesecons = {
|
||||
conductor={
|
||||
state = mesecon.state.off,
|
||||
onstate = "bobblocks:"..colour.."block"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
--Poles
|
||||
|
||||
minetest.register_node("bobblocks:"..colour.."pole", {
|
||||
description = colour.." Pole",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"bobblocks_"..colour.."block.png"},
|
||||
inventory_image = ("bobblocks_inv"..colour.."pole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = default.LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
on_punch = function(pos)
|
||||
update_bobblock(pos, colour.."pole_off")
|
||||
end,
|
||||
mesecons = {conductor={
|
||||
state = mesecon.state.on,
|
||||
offstate = "bobblocks:"..colour.."pole_off"
|
||||
}}
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:"..colour.."pole_off", {
|
||||
description = colour.." Pole",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"bobblocks_"..colour.."block.png"},
|
||||
inventory_image = ("bobblocks_inv"..colour.."pole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = default.LIGHT_MAX-10,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||
drop = 'bobblocks:'..colour..'pole',
|
||||
on_punch = function(pos)
|
||||
update_bobblock(pos, colour.."pole")
|
||||
end,
|
||||
mesecons = {conductor={
|
||||
state = mesecon.state.off,
|
||||
onstate = "bobblocks:"..colour.."pole"
|
||||
}}
|
||||
|
||||
})
|
||||
|
||||
|
||||
--Crafts
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:"..colour.."pole",
|
||||
recipe = {
|
||||
{"bobblocks:"..colour.."block", "default:stick"},
|
||||
|
||||
},
|
||||
on_rightclick = bobblocks.update_bobblock,
|
||||
on_construct = unifieddyes.on_construct,
|
||||
on_dig = unifieddyes.on_dig,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("bobblocks:greyblock", {
|
||||
description = "Grey Block",
|
||||
minetest.register_node("bobblocks:wavyblock_off", {
|
||||
description = "Bobblocks Wavy-textured Block (off)",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"bobblocks_greyblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_greyblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = default.LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
mesecons = {conductor={
|
||||
state = mesecon.state.on,
|
||||
offstate = "bobblocks:greyblock_off"
|
||||
}}
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:greyblock_off", {
|
||||
description = "Grey Block",
|
||||
tiles = {"bobblocks_greyblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = 160,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||
drop = 'bobblocks:greyblock',
|
||||
mesecons = {conductor={
|
||||
tiles = {"bobblocks_wavyblock.png^[opacity:"..bobblocks.opacity},
|
||||
paramtype2 = "color",
|
||||
palette = "unifieddyes_palette_extended.png",
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||
drop = "bobblocks:wavyblock",
|
||||
mesecons = {conductor=
|
||||
{
|
||||
state = mesecon.state.off,
|
||||
onstate = "bobblocks:greyblock"
|
||||
}}
|
||||
|
||||
onstate = "bobblocks:wavyblock"
|
||||
}
|
||||
},
|
||||
on_rightclick = bobblocks.update_bobblock,
|
||||
on_construct = unifieddyes.on_construct,
|
||||
on_dig = unifieddyes.on_dig,
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:greypole", {
|
||||
description = "Grey Pole",
|
||||
minetest.register_node("bobblocks:wavypole", {
|
||||
description = "Wavy-textured Pole",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"bobblocks_greyblock.png"},
|
||||
inventory_image = ("bobblocks_invgreypole.png"),
|
||||
tiles = {"bobblocks_wavyblock.png"},
|
||||
inventory_image = ("bobblocks_wavypole_inv.png"),
|
||||
paramtype = "light",
|
||||
paramtype2 = "color",
|
||||
palette = "unifieddyes_palette_extended.png",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
--light_source = default.LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
||||
on_construct = unifieddyes.on_construct,
|
||||
on_dig = unifieddyes.on_dig,
|
||||
--light_source = LIGHT_MAX-0,
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- Crafts
|
||||
-- BTM
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:btm" 1',
|
||||
recipe = {
|
||||
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:leaves" 1',
|
||||
'node "default:mese" 1','node "default:rat" 1'},
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:btm",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"default:glass",
|
||||
"default:torch",
|
||||
"group:leaves",
|
||||
"default:mese_crystal",
|
||||
"default:diamond"
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:block 2",
|
||||
recipe = {
|
||||
{ "default:glass", "default:torch", "default:cobble" },
|
||||
},
|
||||
})
|
||||
|
||||
unifieddyes.register_color_craft({
|
||||
output = "bobblocks:block",
|
||||
palette = "extended",
|
||||
type = "shapeless",
|
||||
neutral_node = "bobblocks:block",
|
||||
recipe = {
|
||||
"NEUTRAL_NODE",
|
||||
"MAIN_DYE"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:pole",
|
||||
recipe = {
|
||||
{ "bobblocks:block", "group:stick" },
|
||||
}
|
||||
})
|
||||
|
||||
unifieddyes.register_color_craft({
|
||||
output = "bobblocks:pole",
|
||||
palette = "extended",
|
||||
type = "shapeless",
|
||||
neutral_node = "bobblocks:pole",
|
||||
recipe = {
|
||||
"NEUTRAL_NODE",
|
||||
"MAIN_DYE"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:wavyblock 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"bobblocks:block",
|
||||
"default:cobble"
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
local bobblocks_crafts_list = {
|
||||
{
|
||||
{"grey", "cobble"},
|
||||
{"red", "brick"},
|
||||
{"yellow", "sand"},
|
||||
{"blue", "gravel"},
|
||||
{"white", "dirt"},
|
||||
},
|
||||
{
|
||||
{"orange", "red", "yellow"},
|
||||
{"violet", "red", "blue"},
|
||||
{"green", "blue", "yellow"},
|
||||
},
|
||||
}
|
||||
unifieddyes.register_color_craft({
|
||||
output = "bobblocks:wavyblock 2",
|
||||
palette = "extended",
|
||||
type = "shapeless",
|
||||
neutral_node = "bobblocks:block",
|
||||
recipe = {
|
||||
"MAIN_DYE",
|
||||
"NEUTRAL_NODE",
|
||||
"default:cobble"
|
||||
}
|
||||
})
|
||||
|
||||
for _,items in ipairs(bobblocks_crafts_list[1]) do
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:"..items[1].."block 2",
|
||||
recipe = {
|
||||
{"default:glass", "default:torch", "default:"..items[2]},
|
||||
},
|
||||
})
|
||||
unifieddyes.register_color_craft({
|
||||
output = "bobblocks:wavyblock",
|
||||
palette = "extended",
|
||||
type = "shapeless",
|
||||
neutral_node = "bobblocks:wavyblock",
|
||||
recipe = {
|
||||
"MAIN_DYE",
|
||||
"NEUTRAL_NODE"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:wavypole",
|
||||
recipe = {
|
||||
{ "bobblocks:wavyblock", "group:stick" },
|
||||
}
|
||||
})
|
||||
|
||||
unifieddyes.register_color_craft({
|
||||
output = "bobblocks:wavypole",
|
||||
palette = "extended",
|
||||
type = "shapeless",
|
||||
neutral_node = "bobblocks:wavypole",
|
||||
recipe = {
|
||||
"NEUTRAL_NODE",
|
||||
"MAIN_DYE"
|
||||
}
|
||||
})
|
||||
|
||||
-- Convert old static nodes to the param2 scheme
|
||||
|
||||
for _, i in ipairs(bobblocks.colorlist) do
|
||||
table.insert(bobblocks.old_static_nodes, "bobblocks:"..i.."block")
|
||||
table.insert(bobblocks.old_static_nodes, "bobblocks:"..i.."block_off")
|
||||
table.insert(bobblocks.old_static_nodes, "bobblocks:"..i.."pole")
|
||||
table.insert(bobblocks.old_static_nodes, "bobblocks:"..i.."pole_off")
|
||||
end
|
||||
|
||||
for _,items in ipairs(bobblocks_crafts_list[2]) do
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:"..items[1].."block 2",
|
||||
recipe = {
|
||||
{"bobblocks:"..items[2].."block", "bobblocks:"..items[3].."block"},
|
||||
},
|
||||
})
|
||||
end
|
||||
minetest.register_lbm({
|
||||
name = "bobblocks:convert",
|
||||
label = "Convert bobblocks nodes to use param2 color",
|
||||
run_at_every_load = false,
|
||||
nodenames = bobblocks.old_static_nodes,
|
||||
action = function(pos, node)
|
||||
local basename = node.name
|
||||
local color = string.sub(node.name, 11) -- delete the mod name
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:indigoblock 3",
|
||||
recipe = {
|
||||
{"bobblocks:redblock", "bobblocks:blueblock", "bobblocks:whiteblock"},
|
||||
if string.find(color, "_off") then -- delete "_off" if it exists
|
||||
color = string.sub(color, 1, -5)
|
||||
end
|
||||
if string.find(color, "pole") then
|
||||
color = string.sub(color, 1, -5) -- delete "pole"...
|
||||
else
|
||||
color = string.sub(color, 1, -6) -- or delete "block"
|
||||
end
|
||||
|
||||
},
|
||||
local newcolor = "medium_"..color -- the result of the above should be just the hue
|
||||
|
||||
-- custom re-mappings to use unified dyes' colors that are most similar to the originals
|
||||
if color == "blue" then
|
||||
newcolor = "medium_azure"
|
||||
end
|
||||
if color == "indigo" then
|
||||
newcolor = "light_violet"
|
||||
end
|
||||
if color == "violet" then
|
||||
newcolor = "violet_s50"
|
||||
end
|
||||
if color == "white" then
|
||||
newcolor = "light_grey"
|
||||
end
|
||||
|
||||
local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..newcolor, "extended")
|
||||
local newnode = "bobblocks:block"
|
||||
|
||||
if string.find(basename, "grey") then
|
||||
paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:grey", "extended")
|
||||
if string.find(basename, "pole") then
|
||||
newnode = "bobblocks:wavypole"
|
||||
else
|
||||
newnode = "bobblocks:wavyblock"
|
||||
end
|
||||
else
|
||||
if string.find(basename, "pole") then
|
||||
newnode = "bobblocks:pole"
|
||||
end
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
minetest.set_node(pos, { name = newnode, param2 = paletteidx })
|
||||
meta:set_string("dye", "unifieddyes:"..newcolor)
|
||||
meta:set_string("palette", "ext")
|
||||
end
|
||||
})
|
||||
|
||||
-- Poles
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'bobblocks:greypole',
|
||||
recipe = {
|
||||
{"bobblocks:greyblock", "default:stick"},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- MESECON
|
||||
-- Add jeija to bobblocks\default.txt and paste the below in at the bottom of bobblocks\blocks.lua
|
||||
|
||||
|
1
depends.txt
Executable file → Normal file
@ -1,2 +1,3 @@
|
||||
default
|
||||
mesecons
|
||||
unifieddyes
|
||||
|
1
description.txt
Normal file
@ -0,0 +1 @@
|
||||
Add some colorful nodes to building and also to add light.
|
18
health.lua
Executable file → Normal file
@ -21,7 +21,7 @@ local toggle_healthpack = function (pos, node)
|
||||
if not is_healthgate(node) then return end
|
||||
update_healthpack (pos, node, state)
|
||||
end
|
||||
|
||||
|
||||
local on_healthpack_punched = function (pos, node, puncher)
|
||||
if node.name == 'bobblocks:health_off' or node.name == 'bobblocks:health_on' then
|
||||
update_healthpack(pos, node)
|
||||
@ -37,7 +37,7 @@ minetest.register_node("bobblocks:health_off", {
|
||||
paramtype2 = "facedir",
|
||||
legacy_facedir_simple = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
climbable = false,
|
||||
mesecons = {conductor={
|
||||
@ -51,9 +51,9 @@ minetest.register_node("bobblocks:health_on", {
|
||||
tiles = {"bobblocks_health_on.png"},
|
||||
paramtype2 = "facedir",
|
||||
legacy_facedir_simple = true,
|
||||
light_source = default.LIGHT_MAX-1,
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
climbable = false,
|
||||
drop = "bobblocks:health_off",
|
||||
@ -73,20 +73,20 @@ minetest.register_abm(
|
||||
for k, obj in pairs(objs) do
|
||||
minetest.sound_play("bobblocks_health",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
obj:set_hp(obj:get_hp()+5) -- give 2.5HP
|
||||
obj:set_hp(obj:get_hp()+10) -- give 10HP
|
||||
minetest.remove_node(pos) -- remove the node after use
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
})
|
||||
|
||||
--- Health
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bobblocks:health_off",
|
||||
type = "shapeless",
|
||||
output = 'NodeItem "bobblocks:health_off" 1',
|
||||
recipe = {
|
||||
"default:dirt", "default:paper", "default:apple", "default:apple"
|
||||
{'node "default:dirt" 1', 'node "default:paper" 1', 'node "default:apple" 2'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
13
init.lua
Executable file → Normal file
@ -1,8 +1,11 @@
|
||||
minetest.log("action", "[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loading....")
|
||||
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loading....")
|
||||
print("[BobBlocks] loading Blocks")
|
||||
dofile(minetest.get_modpath("bobblocks") .. "/blocks.lua")
|
||||
minetest.log("action", "[BobBlocks] loaded Blocks")
|
||||
print("[BobBlocks] loaded Blocks")
|
||||
print("[BobBlocks] loading Health")
|
||||
dofile(minetest.get_modpath("bobblocks") .. "/health.lua")
|
||||
minetest.log("action", "[BobBlocks] loaded Health")
|
||||
print("[BobBlocks] loaded Health")
|
||||
print("[BobBlocks] loading Traps")
|
||||
dofile(minetest.get_modpath("bobblocks") .. "/trap.lua")
|
||||
minetest.log("action", "[BobBlocks] loaded Traps")
|
||||
minetest.log("action", "[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loaded!")
|
||||
print("[BobBlocks] loaded Traps")
|
||||
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loaded!")
|
0
readme.txt
Executable file → Normal file
BIN
sounds/bobblocks_glassblock.ogg
Executable file → Normal file
BIN
sounds/bobblocks_health.ogg
Executable file → Normal file
BIN
sounds/bobblocks_trap_fall.ogg
Executable file → Normal file
BIN
sounds/bobblocks_trap_fall_major.ogg
Executable file → Normal file
BIN
textures/bobblocks_block.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
textures/bobblocks_block_off.png
Normal file
After Width: | Height: | Size: 604 B |
Before Width: | Height: | Size: 1.3 KiB |
BIN
textures/bobblocks_btm.png
Executable file → Normal file
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
textures/bobblocks_btm_sides.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
BIN
textures/bobblocks_health_off.png
Executable file → Normal file
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
textures/bobblocks_health_on.png
Executable file → Normal file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
textures/bobblocks_health_one_sides.png
Executable file → Normal file
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1018 B |
Before Width: | Height: | Size: 1016 B |
Before Width: | Height: | Size: 853 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1015 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 993 B |
Before Width: | Height: | Size: 1.1 KiB |
BIN
textures/bobblocks_majorspike.png
Executable file → Normal file
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
BIN
textures/bobblocks_minorspike.png
Executable file → Normal file
Before Width: | Height: | Size: 667 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
BIN
textures/bobblocks_pole_inv.png
Normal file
After Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB |
BIN
textures/bobblocks_trap_set.png
Executable file → Normal file
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
BIN
textures/bobblocks_wavyblock.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
textures/bobblocks_wavypole_inv.png
Normal file
After Width: | Height: | Size: 747 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
123
trap.lua
Executable file → Normal file
@ -4,7 +4,7 @@ local update_bobtrap = function (pos, node)
|
||||
local nodename=""
|
||||
local param2=""
|
||||
--Switch Trap State
|
||||
if
|
||||
if
|
||||
-- Swap Traps
|
||||
node.name == 'bobblocks:trap_spike' then nodename = 'bobblocks:trap_spike_set'
|
||||
elseif node.name == 'bobblocks:trap_spike_set' then nodename = 'bobblocks:trap_spike'
|
||||
@ -14,12 +14,12 @@ local update_bobtrap = function (pos, node)
|
||||
minetest.add_node(pos, {name = nodename})
|
||||
end
|
||||
|
||||
-- Punch Traps
|
||||
-- Punch Traps
|
||||
local on_bobtrap_punched = function (pos, node, puncher)
|
||||
if
|
||||
if
|
||||
-- Start Traps
|
||||
node.name == 'bobblocks:trap_spike' or node.name == 'bobblocks:trap_spike_set' or
|
||||
node.name == 'bobblocks:trap_spike_major' or node.name == 'bobblocks:trap_spike_major_set'
|
||||
node.name == 'bobblocks:trap_spike_major' or node.name == 'bobblocks:trap_spike_major_set'
|
||||
then
|
||||
update_bobtrap(pos, node)
|
||||
end
|
||||
@ -37,11 +37,11 @@ minetest.register_abm(
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
|
||||
|
||||
update_bobtrap(pos, node)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
@ -51,11 +51,11 @@ minetest.register_abm(
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
|
||||
|
||||
update_bobtrap(pos, node)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
@ -73,60 +73,73 @@ minetest.register_node("bobblocks:trap_grass", {
|
||||
climbable = false,
|
||||
})
|
||||
|
||||
local function spikenode(name, desc, texture, drop, groups, drawtype)
|
||||
minetest.register_node("bobblocks:trap_"..name, {
|
||||
description = desc,
|
||||
drawtype = drawtype,
|
||||
tiles = {"bobblocks_"..texture..".png"},
|
||||
inventory_image = ("bobblocks_"..texture..".png"),
|
||||
minetest.register_node("bobblocks:trap_spike", {
|
||||
description = "Trap Spike Minor",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1,
|
||||
tiles = {"bobblocks_minorspike.png"},
|
||||
inventory_image = ("bobblocks_minorspike.png"),
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
drop = drop,
|
||||
groups = {cracky=3,melty=3},
|
||||
})
|
||||
end
|
||||
|
||||
local function spike1(name, desc, texture)
|
||||
spikenode(name, desc, texture, "bobblocks:trap_"..name, {cracky=3,melty=3}, "plantlike")
|
||||
end
|
||||
minetest.register_node("bobblocks:trap_spike_set", {
|
||||
description = "Trap Spike Minor Set",
|
||||
drawtype = "raillike",
|
||||
visual_scale = 1,
|
||||
tiles = {"bobblocks_trap_set.png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=3,melty=3,not_in_creative_inventory=1},
|
||||
drop = 'bobblocks:trap_spike',
|
||||
})
|
||||
|
||||
local function spike2(name, desc, texture, drop)
|
||||
spikenode(name, desc, texture, drop, {cracky=3,melty=3,not_in_creative_inventory=1}, "raillike")
|
||||
end
|
||||
|
||||
spike1("spike", "Trap Spike Minor", "minorspike")
|
||||
spike2("spike_set", "Trap Spike Minor Set", "trap_set", 'bobblocks:trap_spike')
|
||||
spike1("spike_major", "Trap Spike Major", "majorspike")
|
||||
spike2("spike_major_set", "Trap Spike Major Set", "trap_set", 'bobblocks:trap_spike_major')
|
||||
|
||||
minetest.register_node("bobblocks:spike_major_reverse", {
|
||||
description = "Trap Spike Major Reverse",
|
||||
minetest.register_node("bobblocks:trap_spike_major", {
|
||||
description = "Trap Spike Major",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1,
|
||||
tiles = {"bobblocks_majorspike_reverse.png"},
|
||||
inventory_image = ("bobblocks_majorspike_reverse.png"),
|
||||
tiles = {"bobblocks_majorspike.png"},
|
||||
inventory_image = ("bobblocks_majorspike.png"),
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=2,melty=2},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:trap_spike_major_set", {
|
||||
description = "Trap Spike Major Set",
|
||||
drawtype = "raillike",
|
||||
visual_scale = 1,
|
||||
tiles = {"bobblocks_trap_set.png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=3,melty=3,not_in_creative_inventory=1},
|
||||
drop = 'bobblocks:trap_spike_major',
|
||||
})
|
||||
|
||||
|
||||
-- Crafting
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'bobblocks:trap_spike 3',
|
||||
output = 'bobblocks:trap_spike',
|
||||
recipe = {
|
||||
{'', 'default:obsidian_shard', ''},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
{'', '', ''},
|
||||
{'', 'default:cobble', ''},
|
||||
{'default:cobble', 'default:apple', 'default:cobble'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'bobblocks:trap_spike_major',
|
||||
recipe = {
|
||||
{'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
{'', 'default:cobble', ''},
|
||||
{'', 'default:apple', ''},
|
||||
{'default:cobble', 'default:apple', 'default:cobble'},
|
||||
}
|
||||
})
|
||||
|
||||
@ -139,14 +152,6 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'bobblocks:spike_major_reverse',
|
||||
recipe = {
|
||||
{'', 'default:steel_ingot', ''},
|
||||
{'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
-- ABM
|
||||
minetest.register_abm(
|
||||
{nodenames = {"bobblocks:trap_spike"},
|
||||
@ -155,9 +160,7 @@ minetest.register_abm(
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_hp() > 0 then --MFF (crabman 8/1/2016) dont re-kill dead player
|
||||
obj:set_hp(obj:get_hp()-1)
|
||||
end
|
||||
obj:set_hp(obj:get_hp()-1)
|
||||
minetest.sound_play("bobblocks_trap_fall",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 3,})
|
||||
end
|
||||
@ -171,30 +174,10 @@ minetest.register_abm(
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_hp() > 0 then --MFF (crabman 8/1/2016) dont re-kill dead player
|
||||
obj:set_hp(obj:get_hp()-100)
|
||||
end
|
||||
obj:set_hp(obj:get_hp()-100)
|
||||
minetest.sound_play("bobblocks_trap_fall",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 3,})
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 3,})
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"bobblocks:spike_major_reverse"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
pos.y = pos.y-1.2
|
||||
local objs = minetest.get_objects_inside_radius(pos, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_hp() > 0 then --MFF (crabman 8/1/2016) dont re-kill dead player
|
||||
obj:set_hp(obj:get_hp()-100)
|
||||
end
|
||||
minetest.sound_play("bobblocks_trap_fall",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 3,})
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|