1 Commits

Author SHA1 Message Date
395fbad5a1 Version MFF. 2018-09-06 20:22:59 +02:00
45 changed files with 287 additions and 394 deletions

522
blocks.lua Normal file → Executable file
View File

@ -1,129 +1,21 @@
-- BobBlocks mod by RabbiBob -- BobBlocks mod by RabbiBob
-- State Changes -- State Changes
bobblocks = {} local bobblock_colours = {"red", "orange", "yellow", "green", "blue", "indigo", "violet", "white"}
bobblocks.old_static_nodes = {}
bobblocks.colorlist = { local function update_bobblock(pos, node)
"red", --Switch Block State
"orange", minetest.add_node(pos, {name = 'bobblocks:'..node})
"yellow", minetest.sound_play("bobblocks_glassblock", {
"green", pos = pos,
"blue", gain = 1.0,
"indigo", max_hear_distance = 32,
"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 end
-- Nodes -- 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", { minetest.register_node("bobblocks:btm", {
description = "Bobs TransMorgifier v5", description = "Bobs TransMorgifier v5",
@ -133,233 +25,223 @@ minetest.register_node("bobblocks:btm", {
paramtype2 = "facedir", paramtype2 = "facedir",
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},
}) })
minetest.register_node("bobblocks:wavyblock", {
description = "Bobblocks Wavy-textured Block",
for _, colour in ipairs(bobblock_colours) do
--Blocks
minetest.register_node("bobblocks:"..colour.."block", {
description = colour.." Block",
drawtype = "glasslike", drawtype = "glasslike",
tiles = {"bobblocks_wavyblock.png"}, tiles = {"bobblocks_"..colour.."block.png"},
inventory_image = minetest.inventorycube("bobblocks_"..colour.."block.png"),
paramtype = "light", paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, 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, ud_param2_colorable = 1}, 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:wavyblock_off" offstate = "bobblocks:"..colour.."block_off"
}
} }
},
on_rightclick = bobblocks.update_bobblock,
on_construct = unifieddyes.on_construct,
on_dig = unifieddyes.on_dig,
}) })
minetest.register_node("bobblocks:wavyblock_off", { minetest.register_node("bobblocks:"..colour.."block_off", {
description = "Bobblocks Wavy-textured Block (off)", description = colour.." Block",
drawtype = "glasslike", tiles = {"bobblocks_"..colour.."block.png"},
tiles = {"bobblocks_wavyblock.png^[opacity:"..bobblocks.opacity}, is_ground_content = true,
paramtype2 = "color", alpha = 160,
palette = "unifieddyes_palette_extended.png", groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
is_ground_content = false, drop = 'bobblocks:'..colour..'block',
use_texture_alpha = true, on_punch = function(pos)
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1}, update_bobblock(pos, colour.."block")
drop = "bobblocks:wavyblock", end,
mesecons = {conductor= mesecons = {
{ conductor={
state = mesecon.state.off, state = mesecon.state.off,
onstate = "bobblocks:wavyblock" onstate = "bobblocks:"..colour.."block"
}
} }
},
on_rightclick = bobblocks.update_bobblock,
on_construct = unifieddyes.on_construct,
on_dig = unifieddyes.on_dig,
}) })
minetest.register_node("bobblocks:wavypole", {
description = "Wavy-textured Pole", --Poles
minetest.register_node("bobblocks:"..colour.."pole", {
description = colour.." Pole",
drawtype = "fencelike", drawtype = "fencelike",
tiles = {"bobblocks_wavyblock.png"}, tiles = {"bobblocks_"..colour.."block.png"},
inventory_image = ("bobblocks_wavypole_inv.png"), inventory_image = ("bobblocks_inv"..colour.."pole.png"),
paramtype = "light", paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, 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, ud_param2_colorable = 1}, light_source = default.LIGHT_MAX-0,
on_construct = unifieddyes.on_construct, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
on_dig = unifieddyes.on_dig, on_punch = function(pos)
--light_source = LIGHT_MAX-0, update_bobblock(pos, colour.."pole_off")
end,
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:"..colour.."pole_off"
}}
}) })
-- Crafts 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({ minetest.register_craft({
output = "bobblocks:btm", output = "bobblocks:"..colour.."pole",
type = "shapeless",
recipe = { recipe = {
"default:glass", {"bobblocks:"..colour.."block", "default:stick"},
"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"
},
})
unifieddyes.register_color_craft({
output = "bobblocks:wavyblock 2",
palette = "extended",
type = "shapeless",
neutral_node = "bobblocks:block",
recipe = {
"MAIN_DYE",
"NEUTRAL_NODE",
"default:cobble"
}
})
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 end
minetest.register_lbm({ minetest.register_node("bobblocks:greyblock", {
name = "bobblocks:convert", description = "Grey Block",
label = "Convert bobblocks nodes to use param2 color", drawtype = "glasslike",
run_at_every_load = false, tiles = {"bobblocks_greyblock.png"},
nodenames = bobblocks.old_static_nodes, inventory_image = minetest.inventorycube("bobblocks_greyblock.png"),
action = function(pos, node) paramtype = "light",
local basename = node.name sunlight_propagates = true,
local color = string.sub(node.name, 11) -- delete the mod name is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
if string.find(color, "_off") then -- delete "_off" if it exists light_source = default.LIGHT_MAX-0,
color = string.sub(color, 1, -5) groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
end mesecons = {conductor={
if string.find(color, "pole") then state = mesecon.state.on,
color = string.sub(color, 1, -5) -- delete "pole"... offstate = "bobblocks:greyblock_off"
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
}) })
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={
state = mesecon.state.off,
onstate = "bobblocks:greyblock"
}}
})
minetest.register_node("bobblocks:greypole", {
description = "Grey Pole",
drawtype = "fencelike",
tiles = {"bobblocks_greyblock.png"},
inventory_image = ("bobblocks_invgreypole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
--light_source = default.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'},
},
})
local bobblocks_crafts_list = {
{
{"grey", "cobble"},
{"red", "brick"},
{"yellow", "sand"},
{"blue", "gravel"},
{"white", "dirt"},
},
{
{"orange", "red", "yellow"},
{"violet", "red", "blue"},
{"green", "blue", "yellow"},
},
}
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({
output = "bobblocks:indigoblock 3",
recipe = {
{"bobblocks:redblock", "bobblocks:blueblock", "bobblocks:whiteblock"},
},
})
-- 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 Normal file → Executable file
View File

@ -1,3 +1,2 @@
default default
mesecons mesecons
unifieddyes

View File

@ -1 +0,0 @@
Add some colorful nodes to building and also to add light.

14
health.lua Normal file → Executable file
View File

@ -37,7 +37,7 @@ minetest.register_node("bobblocks:health_off", {
paramtype2 = "facedir", paramtype2 = "facedir",
legacy_facedir_simple = true, legacy_facedir_simple = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
is_ground_content = false, is_ground_content = true,
walkable = false, walkable = false,
climbable = false, climbable = false,
mesecons = {conductor={ mesecons = {conductor={
@ -51,9 +51,9 @@ 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 = false, is_ground_content = true,
walkable = false, walkable = false,
climbable = false, climbable = false,
drop = "bobblocks:health_off", drop = "bobblocks:health_off",
@ -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!")

View File

@ -1 +0,0 @@
name = bobblocks

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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

BIN
textures/bobblocks_blueblock.png Executable file

Binary file not shown.

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 Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
textures/bobblocks_greyblock.png Executable file

Binary file not shown.

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
textures/bobblocks_invredpole.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

BIN
textures/bobblocks_redblock.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

BIN
textures/bobblocks_whiteblock.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

101
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
if obj:get_hp() > 0 then --MFF (crabman 8/1/2016) dont re-kill dead player
obj:set_hp(obj:get_hp()-1) 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,7 +171,27 @@ 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
if obj:get_hp() > 0 then --MFF (crabman 8/1/2016) dont re-kill dead player
obj:set_hp(obj:get_hp()-100) 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,
})
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", 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