18 Commits

Author SHA1 Message Date
7ad7a5e842 Use Unified Dyes on_dig where needed (#3)
Requires Unified Dyes commit 9ff40a7f or later
2019-07-21 12:36:41 +02:00
eed93cbc5d get rid of old 89->256 color LBM
(it'll only crash now, and is obsolete)
also fixed a wrong/outdated color translation.
2018-09-30 20:54:27 -07:00
31f5af2c58 switch to colored itemstacks
with full crafting recipes
(requires Unified Dyes commit 2a816534 or later)
2018-09-30 20:54:27 -07:00
0f2b5b7b2f use unified dyes auto-recolor feature 2017-03-18 05:50:11 -04:00
a16e960ac1 use unified dyes on_construct handler
to set 256-color palette meta key on place
2017-03-14 02:09:15 -04:00
270da9bf78 set "ext" flag for converted old nodes also 2017-02-25 01:00:02 -05:00
003fe506b7 remove a debug print 2017-02-24 21:58:42 -05:00
ef8a1c1fb8 do the same for the old static->param2 LBM 2017-02-24 21:26:31 -05:00
56beb55b63 use new Unified Dyes "extended" palette
requires unified dyes commit d2819353 or newer
2017-02-24 21:18:38 -05:00
afc0917979 Merge pull request #1 from adrido/master
Some bugfixes
2017-02-19 11:58:34 -05:00
f0fdcb4e08 is_ground_content = false 2017-02-19 13:54:41 +01:00
84e05d2a2a Corrected drops 2017-02-19 13:54:40 +01:00
31bdd56979 Change states on rightclick 2017-02-19 13:54:35 +01:00
c1911548bb Make _off boblocks transparent again 2017-02-19 10:47:32 +01:00
fc72bff4c0 don't run the LBM at every load 2017-02-16 16:55:10 -05:00
819effe640 unified dyes uses on_use now, instead of on_rightclick 2017-02-04 19:42:12 -05:00
8f085b2c7f Rewrote the mod to use the new param2 color method
New dependency on Unified Dyes.

This change comes with a few neutral-to-positive side effects:

1) Minor recipe changes were necessary since there are only two blocks and
   two poles now.
2) All recipes, node names, etc. were updated to current minetest API.
3) Where recipes called for leaves or sticks, I used groups.
4) the "wavy" (formerly "grey") block and fence/pole can now be
   colored as well.
5) Inside the conversion LBM, some of the original colors were re-mapped
   to the closest Unified Dyes equivalents, to try to keep the on-screen
   appearance mostly the same after conversion.
6) Aside from "BTM" and "Health", all block and pole nodes can take on the
   entire Unified Dyes palette instead of just the 9 originally offered.

Mod works the same as others that depend on Unified Dyes - craft and place
a block or pole, then right-click on it with dye to colorize it.
2017-01-28 12:40:11 -05:00
02ed4189dc Add standard mod files. 2016-03-27 20:15:13 -07:00
45 changed files with 389 additions and 282 deletions

514
blocks.lua Executable file → Normal file
View 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
View File

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

1
description.txt Normal file
View File

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

18
health.lua Executable file → Normal file
View 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
View 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!")

1
mod.conf Normal file
View File

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

0
readme.txt Executable file → Normal file
View File

BIN
sounds/bobblocks_glassblock.ogg Executable file → Normal file

Binary file not shown.

BIN
sounds/bobblocks_health.ogg Executable file → Normal file

Binary file not shown.

BIN
sounds/bobblocks_trap_fall.ogg Executable file → Normal file

Binary file not shown.

BIN
sounds/bobblocks_trap_fall_major.ogg Executable file → Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

BIN
textures/bobblocks_btm.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
textures/bobblocks_btm_sides.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

BIN
textures/bobblocks_health_off.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
textures/bobblocks_health_on.png Executable file → Normal file

Binary file not shown.

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
textures/bobblocks_majorspike.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

BIN
textures/bobblocks_minorspike.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

BIN
textures/bobblocks_trap_set.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

123
trap.lua Executable file → Normal file
View 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,
})