-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New sticky and slippy blocks #489
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mesecons | ||
mesecons_mvps |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,76 @@ | ||||||
-- Stippy blocks can be used together with pistons or movestones | ||||||
|
||||||
minetest.register_node("mesecons_slippyblocks:slippy_block", { | ||||||
description = "Slippy block)", | ||||||
drawtype = "nodebox", | ||||||
tiles = {"mesecons_slippyblocks.png"}, | ||||||
walkable = true, | ||||||
pointable = true, | ||||||
diggable = true, | ||||||
buildable_to = true, | ||||||
groups = {cracky=3,oddly_breakable_by_hand=3}, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would look nicer:
Suggested change
(Not only here.) |
||||||
drop = "mesecons_slippyblocks:slippy_block", | ||||||
node_box = { | ||||||
type = "fixed", | ||||||
fixed = { | ||||||
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375}, -- MiddleBox | ||||||
{0.4375, 0.4375, -0.5, 0.5, 0.5, 0.5}, -- f1 | ||||||
{0.4375, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- f2 | ||||||
{-0.5, 0.4375, -0.5, -0.4375, 0.5, 0.5}, -- f3 | ||||||
{-0.5, -0.5, -0.5, -0.4375, -0.4375, 0.5}, -- f4 | ||||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, -0.4375}, -- r1 | ||||||
{-0.5, 0.4375, -0.5, 0.5, 0.5, -0.4375}, -- r2 | ||||||
{-0.5, 0.4375, 0.4375, 0.5, 0.5, 0.5}, -- r3 | ||||||
{-0.5, -0.5, 0.4375, 0.5, -0.4375, 0.5}, -- r4 | ||||||
{0.4375, -0.5, -0.5, 0.5, 0.5, -0.4375}, -- t1 | ||||||
{-0.5, -0.5, -0.5, -0.4375, 0.5, -0.4375}, -- t2 | ||||||
{-0.5, -0.5, 0.4375, -0.4375, 0.5, 0.5}, -- t3 | ||||||
{0.4375, -0.5, 0.4375, 0.5, 0.5, 0.5}, -- t4 | ||||||
} | ||||||
}, | ||||||
on_destruct = function(pos) | ||||||
minetest.add_item(pos, "mesecons_slippyblocks:slippy_block") | ||||||
end, | ||||||
-- Swap the node to a normal one while diging or building node. | ||||||
on_dig = function(pos, node, player) | ||||||
minetest.swap_node(pos, {name = "mesecons_slippyblocks:slippy_block_temp" }) | ||||||
minetest.node_dig(pos, node, player) | ||||||
end, | ||||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing) | ||||||
minetest.swap_node(pos, {name = "mesecons_slippyblocks:slippy_block_temp" }) | ||||||
minetest.item_place_node(itemstack, placer, pointed_thing, param2) | ||||||
minetest.swap_node(pos, {name = "mesecons_slippyblocks:slippy_block" }) | ||||||
end, | ||||||
}) | ||||||
|
||||||
minetest.register_node("mesecons_slippyblocks:slippy_block_temp", { | ||||||
description = "Slippy block)", | ||||||
drawtype = "nodebox", | ||||||
tiles = {"mesecons_slippyblocks.png"}, | ||||||
walkable = true, | ||||||
pointable = true, | ||||||
diggable = true, | ||||||
buildable_to = false, | ||||||
groups = {cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory = 1}, | ||||||
drop = "mesecons_slippyblocks:slippy_block", | ||||||
node_box = { | ||||||
type = "fixed", | ||||||
fixed = { | ||||||
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375}, -- MiddleBox | ||||||
{0.4375, 0.4375, -0.5, 0.5, 0.5, 0.5}, -- f1 | ||||||
{0.4375, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- f2 | ||||||
{-0.5, 0.4375, -0.5, -0.4375, 0.5, 0.5}, -- f3 | ||||||
{-0.5, -0.5, -0.5, -0.4375, -0.4375, 0.5}, -- f4 | ||||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, -0.4375}, -- r1 | ||||||
{-0.5, 0.4375, -0.5, 0.5, 0.5, -0.4375}, -- r2 | ||||||
{-0.5, 0.4375, 0.4375, 0.5, 0.5, 0.5}, -- r3 | ||||||
{-0.5, -0.5, 0.4375, 0.5, -0.4375, 0.5}, -- r4 | ||||||
{0.4375, -0.5, -0.5, 0.5, 0.5, -0.4375}, -- t1 | ||||||
{-0.5, -0.5, -0.5, -0.4375, 0.5, -0.4375}, -- t2 | ||||||
{-0.5, -0.5, 0.4375, -0.4375, 0.5, 0.5}, -- t3 | ||||||
{0.4375, -0.5, 0.4375, 0.5, 0.5, 0.5}, -- t4 | ||||||
} | ||||||
}, | ||||||
|
||||||
}) | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mesecons | ||
mesecons_mvps |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
-- Sticky blocks can be used together with pistons or movestones to push / pull | ||
-- structures that are "glued" together using sticky blocks | ||
|
||
-- Flat sticky block not Y | ||
minetest.register_node("mesecons_stickyblocks_flat:sticky_block_xz", { | ||
description = "Flat Sticky Block", | ||
drawtype = "nodebox", | ||
tiles = { | ||
"mesecons_stickyblocks_flat.png", | ||
"mesecons_stickyblocks_flat.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
}, | ||
is_ground_content = false, | ||
groups = {choppy=3, oddly_breakable_by_hand=2, sticky=1}, | ||
mvps_sticky = function (pos, node) | ||
local connected = {} | ||
for _, r in ipairs(mesecon.rules.xz) do | ||
table.insert(connected, vector.add(pos, r)) | ||
end | ||
return connected | ||
end, | ||
node_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375}, | ||
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5}, | ||
{-0.5, -0.5, -0.5, 0.5, 0.5, -0.375}, | ||
{-0.5, -0.5, -0.375, -0.375, 0.5, 0.375}, | ||
{0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, | ||
} | ||
}, | ||
sounds = default.node_sound_wood_defaults(), | ||
on_punch = function(pos, node, player, pointed_thing) | ||
if string.find(player:get_wielded_item():get_name(), "sticky_") then | ||
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_xy" }) | ||
--minetest.chat_send_all("The word sticky_ was found.") | ||
end | ||
end, | ||
}) | ||
|
||
-- Flat sticky block not Z | ||
minetest.register_node("mesecons_stickyblocks_flat:sticky_block_xy", { | ||
description = "Flat XY Sticky Block", | ||
drawtype = "nodebox", | ||
drop = "mesecons_stickyblocks_flat:sticky_block_xz", | ||
tiles = { --+Y, -Y, +X, -X, +Z, -Z | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat.png", | ||
"mesecons_stickyblocks_flat.png", | ||
}, | ||
is_ground_content = false, | ||
groups = {choppy=3, oddly_breakable_by_hand=2, sticky=1, not_in_creative_inventory = 1}, | ||
mvps_sticky = function (pos, node) | ||
local connected = {} | ||
for _, r in ipairs(mesecon.rules.xy) do | ||
table.insert(connected, vector.add(pos, r)) | ||
end | ||
return connected | ||
end, | ||
node_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375}, | ||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, | ||
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, | ||
{-0.5, -0.375, -0.5, -0.375, 0.375, 0.5}, | ||
{0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, | ||
} | ||
}, | ||
sounds = default.node_sound_wood_defaults(), | ||
on_punch = function(pos, node, player, pointed_thing) | ||
if string.find(player:get_wielded_item():get_name(), "sticky_") then | ||
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_yz" }) | ||
end | ||
end, | ||
}) | ||
|
||
-- Flat sticky block not X | ||
minetest.register_node("mesecons_stickyblocks_flat:sticky_block_yz", { | ||
description = "Flat YZ Sticky Block", | ||
drawtype = "nodebox", | ||
drop = "mesecons_stickyblocks_flat:sticky_block_xz", | ||
tiles = { | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat.png", | ||
"mesecons_stickyblocks_flat.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
"mesecons_stickyblocks_flat_sticky.png", | ||
}, | ||
is_ground_content = false, | ||
groups = {choppy=3, oddly_breakable_by_hand=2, sticky=1, not_in_creative_inventory = 1}, | ||
mvps_sticky = function (pos, node) | ||
local connected = {} | ||
for _, r in ipairs(mesecon.rules.yz) do | ||
table.insert(connected, vector.add(pos, r)) | ||
end | ||
return connected | ||
end, | ||
node_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375}, | ||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, | ||
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, | ||
{-0.5, -0.375, 0.375, 0.5, 0.375, 0.5}, | ||
{-0.5, -0.5, -0.5, 0.5, 0.5, -0.375}, | ||
} | ||
}, | ||
sounds = default.node_sound_wood_defaults(), | ||
on_punch = function(pos, node, player, pointed_thing) | ||
local wilded_item_nane = player:get_wielded_item():get_name() | ||
if string.find(player:get_wielded_item():get_name(), "sticky_") then | ||
minetest.swap_node(pos, {name = "mesecons_stickyblocks_flat:sticky_block_xz" }) | ||
end | ||
end, | ||
}) | ||
|
||
|
||
|
||
mesecon.rules.xz = { | ||
{x = 1, y = 0, z = 0}, | ||
{x = -1, y = 0, z = 0}, | ||
{x = 0, y = 0, z = 1}, | ||
{x = 0, y = 0, z = -1}, | ||
} | ||
|
||
mesecon.rules.xy = { | ||
{x = 1, y = 0, z = 0}, | ||
{x = -1, y = 0, z = 0}, | ||
{x = 0, y = 1, z = 0}, | ||
{x = 0, y = -1, z = 0}, | ||
} | ||
|
||
mesecon.rules.yz = { | ||
{x = 0, y = 1, z = 0}, | ||
{x = 0, y = -1, z = 0}, | ||
{x = 0, y = 0, z = 1}, | ||
{x = 0, y = 0, z = -1}, | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe make those tables in this file: https://github.com/minetest-mods/mesecons/blob/master/mesecons/presets.lua There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they want to merge the change it's indeed a good idea to move them back in preset. I placed them there originally. But I moved them so that it can work as stand alone with older/unmodified version of mesecon. |
||
|
||
|
||
|
||
|
||
minetest.register_craft({ | ||
output = "mesecons_stickyblocks_flat:sticky_block_xz", | ||
recipe = { | ||
{"mesecons_materials:glue","group:wood", "mesecons_materials:glue"}, | ||
} | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mesecons | ||
mesecons_mvps |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
-- Sticky blocks can be used together with pistons or movestones to push / pull | ||
-- structures that are "glued" together using sticky blocks | ||
|
||
-- X sticky block linear | ||
minetest.register_node("mesecons_stickyblocks_linear:sticky_block_x", { | ||
description = "X Sticky Block", | ||
drawtype = "nodebox", | ||
drop = "mesecons_stickyblocks_linear:sticky_block_y", | ||
tiles = { | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear_sticky.png", | ||
"mesecons_stickyblocks_linear_sticky.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
}, | ||
is_ground_content = false, | ||
groups = {choppy=3, oddly_breakable_by_hand=2, sticky=1, not_in_creative_inventory = 1}, | ||
mvps_sticky = function (pos, node) | ||
local connected = {} | ||
for _, r in ipairs(mesecon.rules.x) do | ||
table.insert(connected, vector.add(pos, r)) | ||
end | ||
return connected | ||
end, | ||
node_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.375, -0.375, -0.375, 0.375, 0.375, 0.375}, | ||
{0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, | ||
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, | ||
} | ||
}, | ||
sounds = default.node_sound_wood_defaults(), | ||
on_punch = function(pos, node, player, pointed_thing) | ||
if string.find(player:get_wielded_item():get_name(), "sticky_") then | ||
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_y" }) | ||
end | ||
end, | ||
}) | ||
|
||
-- Y sticky block | ||
minetest.register_node("mesecons_stickyblocks_linear:sticky_block_y", { | ||
description = "Linear Sticky Block", | ||
drawtype = "nodebox", | ||
tiles = { | ||
"mesecons_stickyblocks_linear_sticky.png", | ||
"mesecons_stickyblocks_linear_sticky.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
}, | ||
is_ground_content = false, | ||
groups = {choppy=3, oddly_breakable_by_hand=2, sticky=1}, | ||
mvps_sticky = function (pos, node) | ||
local connected = {} | ||
for _, r in ipairs(mesecon.rules.y) do | ||
table.insert(connected, vector.add(pos, r)) | ||
end | ||
return connected | ||
end, | ||
node_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.375, -0.375, -0.375, 0.375, 0.375, 0.375}, | ||
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, | ||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, | ||
} | ||
}, | ||
sounds = default.node_sound_wood_defaults(), | ||
on_punch = function(pos, node, player, pointed_thing) | ||
if string.find(player:get_wielded_item():get_name(), "sticky_") then | ||
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_z" }) | ||
end | ||
end, | ||
}) | ||
|
||
-- Z sticky block | ||
minetest.register_node("mesecons_stickyblocks_linear:sticky_block_z", { | ||
description = "Z Sticky Block", | ||
drawtype = "nodebox", | ||
drop = "mesecons_stickyblocks_linear:sticky_block_y", | ||
tiles = { | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear.png", | ||
"mesecons_stickyblocks_linear_sticky.png", | ||
"mesecons_stickyblocks_linear_sticky.png", | ||
}, | ||
is_ground_content = false, | ||
groups = {choppy=3, oddly_breakable_by_hand=2, sticky=1, not_in_creative_inventory = 1}, | ||
mvps_sticky = function (pos, node) | ||
local connected = {} | ||
for _, r in ipairs(mesecon.rules.z) do | ||
table.insert(connected, vector.add(pos, r)) | ||
end | ||
return connected | ||
end, | ||
node_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.375, -0.375, -0.375, 0.375, 0.375, 0.375}, | ||
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5}, | ||
{-0.5, -0.5, -0.5, 0.5, 0.5, -0.375}, | ||
} | ||
}, | ||
sounds = default.node_sound_wood_defaults(), | ||
on_punch = function(pos, node, player, pointed_thing) | ||
if string.find(player:get_wielded_item():get_name(), "sticky_") then | ||
minetest.swap_node(pos, {name = "mesecons_stickyblocks_linear:sticky_block_x" }) | ||
end | ||
end, | ||
}) | ||
|
||
mesecon.rules.y = { | ||
{x = 0, y = 1, z = 0}, | ||
{x = 0, y = -1, z = 0}, | ||
{x = 0, y = 0, z = 0}, | ||
{x = 0, y = 0, z = 0}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the (0,0,0)? Should it connect to itself? |
||
} | ||
|
||
mesecon.rules.x = { | ||
{x = 1, y = 0, z = 0}, | ||
{x = -1, y = 0, z = 0}, | ||
{x = 0, y = 0, z = 0}, | ||
{x = 0, y = 0, z = 0}, | ||
} | ||
|
||
mesecon.rules.z = { | ||
{x = 0, y = 0, z = 0}, | ||
{x = 0, y = 0, z = 0}, | ||
{x = 0, y = 0, z = 1}, | ||
{x = 0, y = 0, z = -1}, | ||
} | ||
|
||
minetest.register_craft({ | ||
output = "mesecons_stickyblocks_linear:sticky_block_y", | ||
recipe = { | ||
{"group:wood"}, | ||
{"mesecons_materials:glue"}, | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest not to explicitly set all these properties to their default values.