aboutsummaryrefslogtreecommitdiff
path: root/stairsplus.lua
diff options
context:
space:
mode:
Diffstat (limited to 'stairsplus.lua')
-rw-r--r--stairsplus.lua86
1 files changed, 23 insertions, 63 deletions
diff --git a/stairsplus.lua b/stairsplus.lua
index c99ffd2..cd902d9 100644
--- a/stairsplus.lua
+++ b/stairsplus.lua
@@ -8,28 +8,12 @@ else
stairsplus_expect_infinite_stacks = true
end
--- these vales are in order: facedir in degrees = 90, 0, 270, 180, 90
+-- These vales are in order: facedir in degrees = 90, 0, 270, 180, 90
local dirs1 = { 21, 20, 23, 22, 21 }
local dirs2 = { 15, 8, 17, 6, 15 }
local dirs3 = { 14, 11, 16, 5, 14 }
-stairsplus_players_onwall = {}
-
-minetest.register_chatcommand("st", {
- params = "",
- description = "Toggle stairsplus between placing wall/vertical stairs/panels and normal.",
- func = function(name, param)
- stairsplus_players_onwall[name] = not stairsplus_players_onwall[name]
-
- if stairsplus_players_onwall[name] then
- minetest.chat_send_player(name, "Stairsplus: Placing wall stairs/vertical panels.")
- else
- minetest.chat_send_player(name, "Stairsplus: Placing floor/ceiling stairs/panels.")
- end
- end
-})
-
stairsplus_can_it_stack = function(itemstack, placer, pointed_thing)
return false
--[[
@@ -100,54 +84,23 @@ local function get_nodedef_field(nodename, fieldname)
return minetest.registered_nodes[nodename][fieldname]
end
-function stairsplus_rotate_and_place(itemstack, placer, pointed_thing, onwall)
-
- local node = minetest.env:get_node(pointed_thing.under)
-
- if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
-
- local above = pointed_thing.above
- local under = pointed_thing.under
- local top = {x=under.x, y=under.y+1, z=under.z}
-
- local pitch = placer:get_look_pitch()
- local node = minetest.env:get_node(above)
- local fdir = minetest.dir_to_facedir(placer:get_look_dir())
- local wield_name = itemstack:get_name()
-
- local slab = string.find(wield_name, "slab")
- local panel = string.find(wield_name, "panel")
- local micro = string.find(wield_name, "micro")
- local iswall = (above.x ~= under.x) or (above.z ~= under.z)
- local isceiling = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
-
- if get_nodedef_field(minetest.env:get_node(under).name, "buildable_to") then
- if slab then fdir = 0 end
- minetest.env:add_node(under, {name = wield_name, param2 = fdir }) -- place right side up
- elseif not get_nodedef_field(minetest.env:get_node(above).name, "buildable_to") then
- return
- elseif onwall or (iswall and (slab or panel)) then
- if slab then
- minetest.env:add_node(above, {name = wield_name, param2 = dirs2[fdir+2] }) -- place with wall slab rotation
- else
- minetest.env:add_node(above, {name = wield_name, param2 = dirs3[fdir+2] }) -- place with wall panel/micro rotation
- end
- elseif isceiling then
- local nfdir = dirs1[fdir+2]
- if slab then nfdir = 22 end
- minetest.env:add_node(above, {name = wield_name, param2 = nfdir }) -- place upside down variant
- else
- if slab then fdir = 0 end
- minetest.env:add_node(above, {name = wield_name, param2 = fdir }) -- place right side up
- end
+--[[
- if not stairsplus_expect_infinite_stacks then
- itemstack:take_item()
+function(itemstack, placer, pointed_thing)
+ local keys=placer:get_player_control()
+ stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"])
return itemstack
end
- else
- minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
+
+]]--
+
+function stairsplus_rotate_and_place(itemstack, placer, pointed_thing)
+ if not moreblocks.node_is_owned(pointed_thing.under, placer) then
+ local keys=placer:get_player_control()
+ minetest.rotate_and_place(itemstack, placer, pointed_thing,
+ stairsplus_expect_infinite_stacks, {force_wall = keys.sneak})
end
+ return itemstack
end
function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light)
@@ -163,7 +116,7 @@ function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, i
register_6dfacedir_conversion(modname, subname)
end
--- Default stairs/slabs/panels/microblocks
+-- Default stairs/slabs/panels/microblocks.
register_stair_slab_panel_micro("moreblocks", "wood", "default:wood",
{snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
@@ -288,7 +241,7 @@ register_stair_slab_panel_micro("moreblocks", "stonebrick", "default:stonebrick"
{cracky=3},
{"default_stone_brick.png"},
"Stone Bricks",
- "stone_bricks",
+ "stonebrick",
0)
register_stair_slab_panel_micro("moreblocks", "desert_stonebrick", "default:desert_stonebrick",
@@ -314,6 +267,13 @@ register_stair_slab_panel_micro("moreblocks", "circle_stone_bricks", "moreblocks
"circle_stone_bricks",
0)
+register_stair_slab_panel_micro("moreblocks", "coal_stone_bricks", "moreblocks:coal_stone_bricks",
+ {cracky=3},
+ {"moreblocks_coal_stone_bricks.png"},
+ "Coal Stone Bricks",
+ "Coal_stone_bricks",
+ 0)
+
register_stair_slab_panel_micro("moreblocks", "iron_stone_bricks", "moreblocks:iron_stone_bricks",
{cracky=3},
{"moreblocks_iron_stone_bricks.png"},