Version MFF.

This commit is contained in:
sys4-fr 2018-09-06 20:22:59 +02:00
parent 2c536663e6
commit 395fbad5a1
38 changed files with 213 additions and 796 deletions

857
blocks.lua Normal file → Executable file
View File

@ -1,347 +1,136 @@
-- BobBlocks mod by RabbiBob -- BobBlocks mod by RabbiBob
-- State Changes -- State Changes
local update_bobblock = function (pos, node) local bobblock_colours = {"red", "orange", "yellow", "green", "blue", "indigo", "violet", "white"}
local nodename=""
local param2="" local function update_bobblock(pos, node)
--Switch Block State --Switch Block State
if minetest.add_node(pos, {name = 'bobblocks:'..node})
-- Start Blocks minetest.sound_play("bobblocks_glassblock", {
node.name == 'bobblocks:redblock_off' then nodename = 'bobblocks:redblock' pos = pos,
elseif node.name == 'bobblocks:redblock' then nodename = 'bobblocks:redblock_off' gain = 1.0,
elseif node.name == 'bobblocks:orangeblock_off' then nodename = 'bobblocks:orangeblock' max_hear_distance = 32,
elseif node.name == 'bobblocks:orangeblock' then nodename = 'bobblocks:orangeblock_off' })
elseif node.name == 'bobblocks:yellowblock_off' then nodename = 'bobblocks:yellowblock'
elseif node.name == 'bobblocks:yellowblock' then nodename = 'bobblocks:yellowblock_off'
elseif node.name == 'bobblocks:greenblock_off' then nodename = 'bobblocks:greenblock'
elseif node.name == 'bobblocks:greenblock' then nodename = 'bobblocks:greenblock_off'
elseif node.name == 'bobblocks:blueblock_off' then nodename = 'bobblocks:blueblock'
elseif node.name == 'bobblocks:blueblock' then nodename = 'bobblocks:blueblock_off'
elseif node.name == 'bobblocks:indigoblock_off' then nodename = 'bobblocks:indigoblock'
elseif node.name == 'bobblocks:indigoblock' then nodename = 'bobblocks:indigoblock_off'
elseif node.name == 'bobblocks:violetblock_off' then nodename = 'bobblocks:violetblock'
elseif node.name == 'bobblocks:violetblock' then nodename = 'bobblocks:violetblock_off'
elseif node.name == 'bobblocks:whiteblock_off' then nodename = 'bobblocks:whiteblock'
elseif node.name == 'bobblocks:whiteblock' then nodename = 'bobblocks:whiteblock_off'
-- Start Poles
elseif node.name == 'bobblocks:redpole_off' then nodename = 'bobblocks:redpole'
elseif node.name == 'bobblocks:redpole' then nodename = 'bobblocks:redpole_off'
elseif node.name == 'bobblocks:orangepole_off' then nodename = 'bobblocks:orangepole'
elseif node.name == 'bobblocks:orangepole' then nodename = 'bobblocks:orangepole_off'
elseif node.name == 'bobblocks:yellowpole_off' then nodename = 'bobblocks:yellowpole'
elseif node.name == 'bobblocks:yellowpole' then nodename = 'bobblocks:yellowpole_off'
elseif node.name == 'bobblocks:greenpole_off' then nodename = 'bobblocks:greenpole'
elseif node.name == 'bobblocks:greenpole' then nodename = 'bobblocks:greenpole_off'
elseif node.name == 'bobblocks:bluepole_off' then nodename = 'bobblocks:bluepole'
elseif node.name == 'bobblocks:bluepole' then nodename = 'bobblocks:bluepole_off'
elseif node.name == 'bobblocks:indigopole_off' then nodename = 'bobblocks:indigopole'
elseif node.name == 'bobblocks:indigopole' then nodename = 'bobblocks:indigopole_off'
elseif node.name == 'bobblocks:violetpole_off' then nodename = 'bobblocks:violetpole'
elseif node.name == 'bobblocks:violetpole' then nodename = 'bobblocks:violetpole_off'
elseif node.name == 'bobblocks:whitepole_off' then nodename = 'bobblocks:whitepole'
elseif node.name == 'bobblocks:whitepole' then nodename = 'bobblocks:whitepole_off'
end
minetest.add_node(pos, {name = nodename})
minetest.sound_play("bobblocks_glassblock",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
end end
-- Punch Blocks
local on_bobblock_punched = function (pos, node, puncher)
if
-- Start Blocks
node.name == 'bobblocks:redblock_off' or node.name == 'bobblocks:redblock' or
node.name == 'bobblocks:orangeblock_off' or node.name == 'bobblocks:orangeblock' or
node.name == 'bobblocks:yellowblock_off' or node.name == 'bobblocks:yellowblock' or
node.name == 'bobblocks:greenblock_off' or node.name == 'bobblocks:greenblock' or
node.name == 'bobblocks:blueblock_off' or node.name == 'bobblocks:blueblock' or
node.name == 'bobblocks:indigoblock_off' or node.name == 'bobblocks:indigoblock' or
node.name == 'bobblocks:violetblock_off' or node.name == 'bobblocks:violetblock' or
node.name == 'bobblocks:whiteblock_off' or node.name == 'bobblocks:whiteblock' or
--Start Poles
node.name == 'bobblocks:redpole_off' or node.name == 'bobblocks:redpole' or
node.name == 'bobblocks:orangepole_off' or node.name == 'bobblocks:orangepole' or
node.name == 'bobblocks:yellowpole_off' or node.name == 'bobblocks:yellowpole' or
node.name == 'bobblocks:greenpole_off' or node.name == 'bobblocks:greenpole' or
node.name == 'bobblocks:bluepole_off' or node.name == 'bobblocks:bluepole' or
node.name == 'bobblocks:indigopole_off' or node.name == 'bobblocks:indigopole' or
node.name == 'bobblocks:violetpole_off' or node.name == 'bobblocks:violetpole' or
node.name == 'bobblocks:whitepole_off' or node.name == 'bobblocks:whitepole'
then
update_bobblock(pos, node)
end
end
minetest.register_on_punchnode(on_bobblock_punched)
-- Nodes -- Nodes
-- Misc Node -- Misc Node
minetest.register_node("bobblocks:btm", { minetest.register_node("bobblocks:btm", {
description = "Bobs TransMorgifier v5", description = "Bobs TransMorgifier v5",
tiles = {"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm_sides.png", tiles = {"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm_sides.png",
"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm.png"}, "bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm.png"},
inventory_image = "bobblocks_btm.png", inventory_image = "bobblocks_btm.png",
paramtype2 = "facedir", paramtype2 = "facedir",
material = minetest.digprop_dirtlike(1.0),
legacy_facedir_simple = true, 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},
}) })
-- Start Block Nodes
minetest.register_node("bobblocks:redblock", { for _, colour in ipairs(bobblock_colours) do
description = "Red Block",
--Blocks
minetest.register_node("bobblocks:"..colour.."block", {
description = colour.." Block",
drawtype = "glasslike", drawtype = "glasslike",
tiles = {"bobblocks_redblock.png"}, tiles = {"bobblocks_"..colour.."block.png"},
inventory_image = minetest.inventorycube("bobblocks_redblock.png"), inventory_image = minetest.inventorycube("bobblocks_"..colour.."block.png"),
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = true, is_ground_content = true,
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0, light_source = default.LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={ on_punch = function(pos)
update_bobblock(pos, colour.."block_off")
end,
mesecons = {
conductor={
state = mesecon.state.on, state = mesecon.state.on,
offstate = "bobblocks:redblock_off" offstate = "bobblocks:"..colour.."block_off"
}} }
}
}) })
minetest.register_node("bobblocks:redblock_off", { minetest.register_node("bobblocks:"..colour.."block_off", {
description = "Red Block", description = colour.." Block",
tiles = {"bobblocks_redblock.png"}, tiles = {"bobblocks_"..colour.."block.png"},
is_ground_content = true, is_ground_content = true,
alpha = WATER_ALPHA, alpha = 160,
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},
drop = 'bobblocks:redblock', drop = 'bobblocks:'..colour..'block',
mesecons = {conductor={ on_punch = function(pos)
update_bobblock(pos, colour.."block")
end,
mesecons = {
conductor={
state = mesecon.state.off, state = mesecon.state.off,
onstate = "bobblocks:redblock" onstate = "bobblocks:"..colour.."block"
}} }
}
}) })
minetest.register_node("bobblocks:orangeblock", {
description = "Orange Block", --Poles
drawtype = "glasslike",
tiles = {"bobblocks_orangeblock.png"}, minetest.register_node("bobblocks:"..colour.."pole", {
inventory_image = minetest.inventorycube("bobblocks_orangeblock.png"), description = colour.." Pole",
drawtype = "fencelike",
tiles = {"bobblocks_"..colour.."block.png"},
inventory_image = ("bobblocks_inv"..colour.."pole.png"),
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = true, is_ground_content = true,
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0, light_source = default.LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={ on_punch = function(pos)
update_bobblock(pos, colour.."pole_off")
end,
mesecons = {conductor={
state = mesecon.state.on, state = mesecon.state.on,
offstate = "bobblocks:orangeblock_off" offstate = "bobblocks:"..colour.."pole_off"
}} }}
}) })
minetest.register_node("bobblocks:orangeblock_off", { minetest.register_node("bobblocks:"..colour.."pole_off", {
description = "Orange Block", description = colour.." Pole",
tiles = {"bobblocks_orangeblock.png"}, drawtype = "fencelike",
is_ground_content = true, tiles = {"bobblocks_"..colour.."block.png"},
alpha = WATER_ALPHA, inventory_image = ("bobblocks_inv"..colour.."pole.png"),
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:orangeblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:orangeblock"
}}
})
minetest.register_node("bobblocks:yellowblock", {
description = "Yellow Block",
drawtype = "glasslike",
tiles = {"bobblocks_yellowblock.png"},
inventory_image = minetest.inventorycube("bobblocks_yellowblock.png"),
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = true, is_ground_content = true,
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0, light_source = default.LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
mesecons = {conductor={ drop = 'bobblocks:'..colour..'pole',
state = mesecon.state.on, on_punch = function(pos)
offstate = "bobblocks:yellowblock_off" update_bobblock(pos, colour.."pole")
}} end,
}) mesecons = {conductor={
minetest.register_node("bobblocks:yellowblock_off", {
description = "Yellow Block",
tiles = {"bobblocks_yellowblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:yellowblock',
mesecons = {conductor={
state = mesecon.state.off, state = mesecon.state.off,
onstate = "bobblocks:yellowblock" onstate = "bobblocks:"..colour.."pole"
}}
})
minetest.register_node("bobblocks:greenblock", {
description = "Green Block",
drawtype = "glasslike",
tiles = {"bobblocks_greenblock.png"},
inventory_image = minetest.inventorycube("bobblocks_greenblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:greenblock_off"
}}
})
minetest.register_node("bobblocks:greenblock_off", {
description = "Green Block",
tiles = {"bobblocks_greenblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:greenblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:greenblock"
}} }}
}) })
minetest.register_node("bobblocks:blueblock", { --Crafts
description = "Blue Block",
drawtype = "glasslike", minetest.register_craft({
tiles = {"bobblocks_blueblock.png"}, output = "bobblocks:"..colour.."pole",
inventory_image = minetest.inventorycube("bobblocks_blueblock.png"), recipe = {
paramtype = "light", {"bobblocks:"..colour.."block", "default:stick"},
sunlight_propagates = true,
is_ground_content = true, },
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:blueblock_off"
}}
}) })
end
minetest.register_node("bobblocks:blueblock_off", {
description = "Blue Block",
tiles = {"bobblocks_blueblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:blueblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:blueblock"
}}
})
minetest.register_node("bobblocks:indigoblock", {
description = "Indigo Block",
drawtype = "glasslike",
tiles = {"bobblocks_indigoblock.png"},
inventory_image = minetest.inventorycube("bobblocks_indigoblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:indigoblock_off"
}}
})
minetest.register_node("bobblocks:indigoblock_off", {
description = "Indigo Block",
tiles = {"bobblocks_indigoblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:indigoblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:indigoblock"
}}
})
minetest.register_node("bobblocks:violetblock", {
description = "Violet Block",
drawtype = "glasslike",
tiles = {"bobblocks_violetblock.png"},
inventory_image = minetest.inventorycube("bobblocks_violetblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:violetblock_off"
}}
})
minetest.register_node("bobblocks:violetblock_off", {
description = "Violet Block",
tiles = {"bobblocks_violetblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:violetblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:violetblock"
}}
})
minetest.register_node("bobblocks:whiteblock", {
description = "White Block",
drawtype = "glasslike",
tiles = {"bobblocks_whiteblock.png"},
inventory_image = minetest.inventorycube("bobblocks_whiteblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:whiteblock_off"
}}
})
minetest.register_node("bobblocks:whiteblock_off", {
description = "White Block",
tiles = {"bobblocks_whiteblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:whiteblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:whiteblock"
}}
})
minetest.register_node("bobblocks:greyblock", { minetest.register_node("bobblocks:greyblock", {
description = "Grey Block", description = "Grey Block",
@ -352,9 +141,9 @@ minetest.register_node("bobblocks:greyblock", {
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = true, is_ground_content = true,
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0, light_source = default.LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={ mesecons = {conductor={
state = mesecon.state.on, state = mesecon.state.on,
offstate = "bobblocks:greyblock_off" offstate = "bobblocks:greyblock_off"
}} }}
@ -362,308 +151,18 @@ minetest.register_node("bobblocks:greyblock", {
minetest.register_node("bobblocks:greyblock_off", { minetest.register_node("bobblocks:greyblock_off", {
description = "Grey Block", description = "Grey Block",
tiles = {"bobblocks_greyblock.png"}, tiles = {"bobblocks_greyblock.png"},
is_ground_content = true, is_ground_content = true,
alpha = WATER_ALPHA, alpha = 160,
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},
drop = 'bobblocks:greyblock', drop = 'bobblocks:greyblock',
mesecons = {conductor={ mesecons = {conductor={
state = mesecon.state.off, state = mesecon.state.off,
onstate = "bobblocks:greyblock" onstate = "bobblocks:greyblock"
}} }}
}) })
-- Block Poles
minetest.register_node("bobblocks:redpole", {
description = "Red Pole",
drawtype = "fencelike",
tiles = {"bobblocks_redblock.png"},
inventory_image = ("bobblocks_invredpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:redpole_off"
}}
})
minetest.register_node("bobblocks:redpole_off", {
description = "Red Pole",
drawtype = "fencelike",
tiles = {"bobblocks_redblock.png"},
inventory_image = ("bobblocks_invredpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:redpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:redpole"
}}
})
minetest.register_node("bobblocks:orangepole", {
description = "Orange Pole",
drawtype = "fencelike",
tiles = {"bobblocks_orangeblock.png"},
inventory_image = ("bobblocks_invorangepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:orangepole_off"
}}
})
minetest.register_node("bobblocks:orangepole_off", {
description = "Orange Pole",
drawtype = "fencelike",
tiles = {"bobblocks_orangeblock.png"},
inventory_image = ("bobblocks_invorangepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:orangepole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:orangepole"
}}
})
minetest.register_node("bobblocks:yellowpole", {
description = "Yellow Pole",
drawtype = "fencelike",
tiles = {"bobblocks_yellowblock.png"},
inventory_image = ("bobblocks_invyellowpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:yellowpole_off"
}}
})
minetest.register_node("bobblocks:yellowpole_off", {
description = "Yellow Pole",
drawtype = "fencelike",
tiles = {"bobblocks_yellowblock.png"},
inventory_image = ("bobblocks_invyellowpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:yellowpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:yellowpole"
}}
})
minetest.register_node("bobblocks:greenpole", {
description = "Green Pole",
drawtype = "fencelike",
tiles = {"bobblocks_greenblock.png"},
inventory_image = ("bobblocks_invgreenpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:greenpole_off"
}}
})
minetest.register_node("bobblocks:greenpole_off", {
description = "Green Pole",
drawtype = "fencelike",
tiles = {"bobblocks_greenblock.png"},
inventory_image = ("bobblocks_invgreenpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:greenpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:greenpole"
}}
})
minetest.register_node("bobblocks:bluepole", {
description = "Blue Pole",
drawtype = "fencelike",
tiles = {"bobblocks_blueblock.png"},
inventory_image = ("bobblocks_invbluepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:bluepole_off"
}}
})
minetest.register_node("bobblocks:bluepole_off", {
description = "Blue Pole",
drawtype = "fencelike",
tiles = {"bobblocks_blueblock.png"},
inventory_image = ("bobblocks_invbluepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:bluepole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:bluepole"
}}
})
minetest.register_node("bobblocks:indigopole", {
description = "Indigo Pole",
drawtype = "fencelike",
tiles = {"bobblocks_indigoblock.png"},
inventory_image = ("bobblocks_invindigopole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:indigopole_off"
}}
})
minetest.register_node("bobblocks:indigopole_off", {
description = "Indigo Pole",
drawtype = "fencelike",
tiles = {"bobblocks_indigoblock.png"},
inventory_image = ("bobblocks_invindigopole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:indigopole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:indigopole"
}}
})
minetest.register_node("bobblocks:violetpole", {
description = "Violet Pole",
drawtype = "fencelike",
tiles = {"bobblocks_violetblock.png"},
inventory_image = ("bobblocks_invvioletpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:violetpole_off"
}}
})
minetest.register_node("bobblocks:violetpole_off", {
description = "Violet Pole",
drawtype = "fencelike",
tiles = {"bobblocks_violetblock.png"},
inventory_image = ("bobblocks_invvioletpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:violetpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:violetpole"
}}
})
minetest.register_node("bobblocks:whitepole", {
description = "White Pole",
drawtype = "fencelike",
tiles = {"bobblocks_whiteblock.png"},
inventory_image = ("bobblocks_invwhitepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:whitepole_off"
}}
})
minetest.register_node("bobblocks:whitepole_off", {
description = "White Pole",
drawtype = "fencelike",
tiles = {"bobblocks_whiteblock.png"},
inventory_image = ("bobblocks_invwhitepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = 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},
drop = 'bobblocks:whitepole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:whitepole"
}}
})
minetest.register_node("bobblocks:greypole", { minetest.register_node("bobblocks:greypole", {
description = "Grey Pole", description = "Grey Pole",
drawtype = "fencelike", drawtype = "fencelike",
@ -673,8 +172,8 @@ minetest.register_node("bobblocks:greypole", {
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = true, is_ground_content = true,
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
--light_source = LIGHT_MAX-0, --light_source = default.LIGHT_MAX-0,
}) })
@ -685,81 +184,49 @@ minetest.register_craft({
output = 'NodeItem "bobblocks:btm" 1', output = 'NodeItem "bobblocks:btm" 1',
recipe = { recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:leaves" 1', {'node "default:glass" 1', 'node "default:torch" 1', 'node "default:leaves" 1',
'node "default:mese" 1','node "default:rat" 1'}, 'node "default:mese" 1','node "default:rat" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:greyblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:cobble" 1'},
},
})
-- Red / Yellow / Blue / White
-- Red / Yellow -> Orange
-- Red / Blue -> Violet
-- Blue / Yellow -> Green
-- Red / Yellow / White -> Indigo
minetest.register_craft({
output = 'NodeItem "bobblocks:redblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:brick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:yellowblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:sand" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:blueblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:gravel" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:whiteblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:dirt" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:orangeblock" 2',
recipe = {
{'node "bobblocks:redblock" 1', 'node "bobblocks:yellowblock" 1'},
}, },
}) })
minetest.register_craft({ local bobblocks_crafts_list = {
output = 'NodeItem "bobblocks:violetblock" 2', {
recipe = { {"grey", "cobble"},
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1'}, {"red", "brick"},
{"yellow", "sand"},
{"blue", "gravel"},
{"white", "dirt"},
}, },
}) {
{"orange", "red", "yellow"},
minetest.register_craft({ {"violet", "red", "blue"},
output = 'NodeItem "bobblocks:greenblock" 2', {"green", "blue", "yellow"},
recipe = {
{'node "bobblocks:blueblock" 1', 'node "bobblocks:yellowblock" 1'},
}, },
}) }
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]},
},
})
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_craft({ minetest.register_craft({
output = 'NodeItem "bobblocks:indigoblock" 3', output = "bobblocks:indigoblock 3",
recipe = { recipe = {
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1', 'node "bobblocks:whiteblock" 1'}, {"bobblocks:redblock", "bobblocks:blueblock", "bobblocks:whiteblock"},
}, },
}) })
@ -767,73 +234,9 @@ minetest.register_craft({
-- Poles -- Poles
minetest.register_craft({ minetest.register_craft({
output = 'NodeItem "bobblocks:redpole" 1', output = 'bobblocks:greypole',
recipe = { recipe = {
{'node "bobblocks:redblock" 1', 'node "default:stick" 1'}, {"bobblocks:greyblock", "default:stick"},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:yellowpole" 1',
recipe = {
{'node "bobblocks:yellowblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:bluepole" 1',
recipe = {
{'node "bobblocks:blueblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:whitepole" 1',
recipe = {
{'node "bobblocks:whiteblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:orangepole" 1',
recipe = {
{'node "bobblocks:orangeblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:violetpole" 1',
recipe = {
{'node "bobblocks:violetblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:greenpole" 1',
recipe = {
{'node "bobblocks:greenblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:indigopole" 1',
recipe = {
{'node "bobblocks:indigoblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:greypole" 1',
recipe = {
{'node "bobblocks:greyblock" 1', 'node "default:stick" 1'},
}, },
}) })

0
depends.txt Normal file → Executable file
View File

10
health.lua Normal file → Executable file
View File

@ -51,7 +51,7 @@ minetest.register_node("bobblocks:health_on", {
tiles = {"bobblocks_health_on.png"}, tiles = {"bobblocks_health_on.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
legacy_facedir_simple = true, legacy_facedir_simple = true,
light_source = LIGHT_MAX-0, light_source = default.LIGHT_MAX-1,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
is_ground_content = true, is_ground_content = true,
walkable = false, walkable = false,
@ -73,7 +73,7 @@ minetest.register_abm(
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
minetest.sound_play("bobblocks_health", minetest.sound_play("bobblocks_health",
{pos = pos, gain = 1.0, max_hear_distance = 32,}) {pos = pos, gain = 1.0, max_hear_distance = 32,})
obj:set_hp(obj:get_hp()+10) -- give 10HP obj:set_hp(obj:get_hp()+5) -- give 2.5HP
minetest.remove_node(pos) -- remove the node after use minetest.remove_node(pos) -- remove the node after use
end end
end, end,
@ -83,10 +83,10 @@ minetest.register_abm(
--- Health --- Health
minetest.register_craft({ minetest.register_craft({
output = 'NodeItem "bobblocks:health_off" 1', output = "bobblocks:health_off",
type = "shapeless",
recipe = { recipe = {
{'node "default:dirt" 1', 'node "default:paper" 1', 'node "default:apple" 2'}, "default:dirt", "default:paper", "default:apple", "default:apple"
}, },
}) })

13
init.lua Normal file → Executable file
View File

@ -1,11 +1,8 @@
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loading....") minetest.log("action", "[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loading....")
print("[BobBlocks] loading Blocks")
dofile(minetest.get_modpath("bobblocks") .. "/blocks.lua") dofile(minetest.get_modpath("bobblocks") .. "/blocks.lua")
print("[BobBlocks] loaded Blocks") minetest.log("action", "[BobBlocks] loaded Blocks")
print("[BobBlocks] loading Health")
dofile(minetest.get_modpath("bobblocks") .. "/health.lua") dofile(minetest.get_modpath("bobblocks") .. "/health.lua")
print("[BobBlocks] loaded Health") minetest.log("action", "[BobBlocks] loaded Health")
print("[BobBlocks] loading Traps")
dofile(minetest.get_modpath("bobblocks") .. "/trap.lua") dofile(minetest.get_modpath("bobblocks") .. "/trap.lua")
print("[BobBlocks] loaded Traps") minetest.log("action", "[BobBlocks] loaded Traps")
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loaded!") minetest.log("action", "[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loaded!")

0
readme.txt Normal file → Executable file
View File

BIN
sounds/bobblocks_glassblock.ogg Normal file → Executable file

Binary file not shown.

BIN
sounds/bobblocks_health.ogg Normal file → Executable file

Binary file not shown.

BIN
sounds/bobblocks_trap_fall.ogg Normal file → Executable file

Binary file not shown.

BIN
sounds/bobblocks_trap_fall_major.ogg Normal file → Executable file

Binary file not shown.

BIN
textures/bobblocks_blueblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
textures/bobblocks_btm.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
textures/bobblocks_btm_sides.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
textures/bobblocks_greenblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
textures/bobblocks_greyblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
textures/bobblocks_health_off.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
textures/bobblocks_health_on.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
textures/bobblocks_health_one_sides.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 154 B

BIN
textures/bobblocks_indigoblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
textures/bobblocks_invbluepole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1018 B

BIN
textures/bobblocks_invgreenpole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1016 B

BIN
textures/bobblocks_invgreypole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 853 B

BIN
textures/bobblocks_invindigopole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
textures/bobblocks_invorangepole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
textures/bobblocks_invredpole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1015 B

BIN
textures/bobblocks_invvioletpole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
textures/bobblocks_invwhitepole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 993 B

BIN
textures/bobblocks_invyellowpole.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
textures/bobblocks_majorspike.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
textures/bobblocks_minorspike.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 667 B

BIN
textures/bobblocks_orangeblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
textures/bobblocks_redblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
textures/bobblocks_redblock_off.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
textures/bobblocks_trap_set.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 162 B

BIN
textures/bobblocks_violetblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
textures/bobblocks_whiteblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
textures/bobblocks_yellowblock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

105
trap.lua Normal file → Executable file
View File

@ -73,73 +73,60 @@ minetest.register_node("bobblocks:trap_grass", {
climbable = false, climbable = false,
}) })
minetest.register_node("bobblocks:trap_spike", { local function spikenode(name, desc, texture, drop, groups, drawtype)
description = "Trap Spike Minor", minetest.register_node("bobblocks:trap_"..name, {
drawtype = "plantlike", description = desc,
visual_scale = 1, drawtype = drawtype,
tiles = {"bobblocks_minorspike.png"}, tiles = {"bobblocks_"..texture..".png"},
inventory_image = ("bobblocks_minorspike.png"), inventory_image = ("bobblocks_"..texture..".png"),
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
sunlight_propagates = true, sunlight_propagates = true,
groups = {cracky=3,melty=3}, groups = groups,
drop = drop,
}) })
end
minetest.register_node("bobblocks:trap_spike_set", { local function spike1(name, desc, texture)
description = "Trap Spike Minor Set", spikenode(name, desc, texture, "bobblocks:trap_"..name, {cracky=3,melty=3}, "plantlike")
drawtype = "raillike", end
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
minetest.register_node("bobblocks:trap_spike_major", { spike1("spike", "Trap Spike Minor", "minorspike")
description = "Trap Spike Major", 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",
drawtype = "plantlike", drawtype = "plantlike",
visual_scale = 1, visual_scale = 1,
tiles = {"bobblocks_majorspike.png"}, tiles = {"bobblocks_majorspike_reverse.png"},
inventory_image = ("bobblocks_majorspike.png"), inventory_image = ("bobblocks_majorspike_reverse.png"),
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
sunlight_propagates = true, sunlight_propagates = true,
groups = {cracky=2,melty=2}, 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 -- Crafting
minetest.register_craft({ minetest.register_craft({
output = 'bobblocks:trap_spike', output = 'bobblocks:trap_spike 3',
recipe = { recipe = {
{'', '', ''}, {'', 'default:obsidian_shard', ''},
{'', 'default:cobble', ''}, {'', 'default:steel_ingot', ''},
{'default:cobble', 'default:apple', 'default:cobble'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'bobblocks:trap_spike_major', output = 'bobblocks:trap_spike_major',
recipe = { recipe = {
{'', 'default:cobble', ''}, {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'},
{'', 'default:apple', ''}, {'', 'default:steel_ingot', ''},
{'default:cobble', 'default:apple', 'default:cobble'},
} }
}) })
@ -152,6 +139,14 @@ 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 -- ABM
minetest.register_abm( minetest.register_abm(
{nodenames = {"bobblocks:trap_spike"}, {nodenames = {"bobblocks:trap_spike"},
@ -160,7 +155,9 @@ minetest.register_abm(
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.get_objects_inside_radius(pos, 1) local objs = minetest.get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
obj:set_hp(obj:get_hp()-1) if obj:get_hp() > 0 then --MFF (crabman 8/1/2016) dont re-kill dead player
obj:set_hp(obj:get_hp()-1)
end
minetest.sound_play("bobblocks_trap_fall", 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
@ -174,10 +171,30 @@ minetest.register_abm(
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.get_objects_inside_radius(pos, 1) local objs = minetest.get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
obj:set_hp(obj:get_hp()-100) 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", 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
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,
})