mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 22:33:16 -04:00
Merge remote-tracking branch 'upstream/master' into sponge
This commit is contained in:
commit
09be5d3d5f
12 changed files with 115 additions and 78 deletions
|
@ -44,6 +44,15 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
if user and not user:get_player_control().sneak then
|
||||||
|
local n = minetest.get_node(pointed_thing.under)
|
||||||
|
local nn = n.name
|
||||||
|
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].on_rightclick then
|
||||||
|
return minetest.registered_nodes[nn].on_rightclick(pointed_thing.under, n, user, itemstack) or itemstack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local place_liquid = function(pos, node, source, flowing, fullness)
|
local place_liquid = function(pos, node, source, flowing, fullness)
|
||||||
if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then
|
if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then
|
||||||
|
|
|
@ -127,15 +127,16 @@ if minetest.setting_getbool("creative_mode") then
|
||||||
type = "none",
|
type = "none",
|
||||||
wield_image = "wieldhand.png",
|
wield_image = "wieldhand.png",
|
||||||
wield_scale = {x=1,y=1,z=2.5},
|
wield_scale = {x=1,y=1,z=2.5},
|
||||||
|
range = 10,
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
max_drop_level = 3,
|
max_drop_level = 3,
|
||||||
groupcaps = {
|
groupcaps = {
|
||||||
crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
crumbly = {times={[1]=0.0, [2]=0.0, [3]=0.0}, uses=0, maxlevel=3},
|
||||||
cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
cracky = {times={[1]=0.0, [2]=0.0, [3]=0.0}, uses=0, maxlevel=3},
|
||||||
snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
snappy = {times={[1]=0.0, [2]=0.0, [3]=0.0}, uses=0, maxlevel=3},
|
||||||
choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
choppy = {times={[1]=0.0, [2]=0.0, [3]=0.0}, uses=0, maxlevel=3},
|
||||||
oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
oddly_breakable_by_hand = {times={[1]=0.0, [2]=0.0, [3]=0.0}, uses=0, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy = 10},
|
damage_groups = {fleshy = 10},
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,10 +132,12 @@ minetest.register_on_punchnode(on_punchnode)
|
||||||
|
|
||||||
default.cool_lava_source = function(pos)
|
default.cool_lava_source = function(pos)
|
||||||
minetest.set_node(pos, {name="default:obsidian"})
|
minetest.set_node(pos, {name="default:obsidian"})
|
||||||
|
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||||
end
|
end
|
||||||
|
|
||||||
default.cool_lava_flowing = function(pos)
|
default.cool_lava_flowing = function(pos)
|
||||||
minetest.set_node(pos, {name="default:stone"})
|
minetest.set_node(pos, {name="default:stone"})
|
||||||
|
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
-- Aliases for map generator outputs
|
-- Aliases for map generator outputs
|
||||||
--
|
--
|
||||||
|
|
||||||
minetest.register_alias("mapgen_air", "air")
|
|
||||||
minetest.register_alias("mapgen_stone", "default:stone")
|
minetest.register_alias("mapgen_stone", "default:stone")
|
||||||
minetest.register_alias("mapgen_tree", "default:tree")
|
minetest.register_alias("mapgen_tree", "default:tree")
|
||||||
minetest.register_alias("mapgen_leaves", "default:leaves")
|
minetest.register_alias("mapgen_leaves", "default:leaves")
|
||||||
|
@ -26,6 +25,7 @@ minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
|
||||||
minetest.register_alias("mapgen_mese", "default:mese")
|
minetest.register_alias("mapgen_mese", "default:mese")
|
||||||
minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
|
minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
|
||||||
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
|
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
|
||||||
|
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Ore generation
|
-- Ore generation
|
||||||
|
|
|
@ -48,7 +48,7 @@ minetest.register_node("default:stone_with_copper", {
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_mese", {
|
minetest.register_node("default:stone_with_mese", {
|
||||||
description = "Mese Crystals in Stone",
|
description = "Mese Ore",
|
||||||
tiles = {"default_stone.png^default_mineral_mese.png"},
|
tiles = {"default_stone.png^default_mineral_mese.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
|
@ -66,7 +66,7 @@ minetest.register_node("default:stone_with_gold", {
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_diamond", {
|
minetest.register_node("default:stone_with_diamond", {
|
||||||
description = "Diamonds in Stone",
|
description = "Diamond Ore",
|
||||||
tiles = {"default_stone.png^default_mineral_diamond.png"},
|
tiles = {"default_stone.png^default_mineral_diamond.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
|
@ -427,17 +427,20 @@ minetest.register_node("default:water_flowing", {
|
||||||
},
|
},
|
||||||
alpha = WATER_ALPHA,
|
alpha = WATER_ALPHA,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "flowingliquid",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
pointable = false,
|
pointable = false,
|
||||||
diggable = false,
|
diggable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
drop = "",
|
drop = "",
|
||||||
|
drowning = 1,
|
||||||
liquidtype = "flowing",
|
liquidtype = "flowing",
|
||||||
liquid_alternative_flowing = "default:water_flowing",
|
liquid_alternative_flowing = "default:water_flowing",
|
||||||
liquid_alternative_source = "default:water_source",
|
liquid_alternative_source = "default:water_source",
|
||||||
liquid_viscosity = WATER_VISC,
|
liquid_viscosity = WATER_VISC,
|
||||||
|
freezemelt = "default:snow",
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:water_source", {
|
minetest.register_node("default:water_source", {
|
||||||
|
@ -462,12 +465,14 @@ minetest.register_node("default:water_source", {
|
||||||
diggable = false,
|
diggable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
drop = "",
|
drop = "",
|
||||||
|
drowning = 1,
|
||||||
liquidtype = "source",
|
liquidtype = "source",
|
||||||
liquid_alternative_flowing = "default:water_flowing",
|
liquid_alternative_flowing = "default:water_flowing",
|
||||||
liquid_alternative_source = "default:water_source",
|
liquid_alternative_source = "default:water_source",
|
||||||
liquid_viscosity = WATER_VISC,
|
liquid_viscosity = WATER_VISC,
|
||||||
|
freezemelt = "default:ice",
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
groups = {water=3, liquid=3, puts_out_fire=1, freezes=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:lava_flowing", {
|
minetest.register_node("default:lava_flowing", {
|
||||||
|
@ -488,12 +493,14 @@ minetest.register_node("default:lava_flowing", {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "flowingliquid",
|
||||||
light_source = LIGHT_MAX - 1,
|
light_source = LIGHT_MAX - 1,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
pointable = false,
|
pointable = false,
|
||||||
diggable = false,
|
diggable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
drop = "",
|
drop = "",
|
||||||
|
drowning = 1,
|
||||||
liquidtype = "flowing",
|
liquidtype = "flowing",
|
||||||
liquid_alternative_flowing = "default:lava_flowing",
|
liquid_alternative_flowing = "default:lava_flowing",
|
||||||
liquid_alternative_source = "default:lava_source",
|
liquid_alternative_source = "default:lava_source",
|
||||||
|
@ -526,6 +533,7 @@ minetest.register_node("default:lava_source", {
|
||||||
diggable = false,
|
diggable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
drop = "",
|
drop = "",
|
||||||
|
drowning = 1,
|
||||||
liquidtype = "source",
|
liquidtype = "source",
|
||||||
liquid_alternative_flowing = "default:lava_flowing",
|
liquid_alternative_flowing = "default:lava_flowing",
|
||||||
liquid_alternative_source = "default:lava_source",
|
liquid_alternative_source = "default:lava_source",
|
||||||
|
@ -558,7 +566,7 @@ minetest.register_node("default:torch", {
|
||||||
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
|
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
|
||||||
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
|
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
|
||||||
},
|
},
|
||||||
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1},
|
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,hot=2},
|
||||||
legacy_wallmounted = true,
|
legacy_wallmounted = true,
|
||||||
sounds = default.node_sound_defaults(),
|
sounds = default.node_sound_defaults(),
|
||||||
})
|
})
|
||||||
|
@ -833,7 +841,7 @@ minetest.register_node("default:furnace_active", {
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
light_source = 8,
|
light_source = 8,
|
||||||
drop = "default:furnace",
|
drop = "default:furnace",
|
||||||
groups = {cracky=2, not_in_creative_inventory=1},
|
groups = {cracky=2, not_in_creative_inventory=1,hot=1},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
@ -1272,7 +1280,8 @@ minetest.register_node("default:ice", {
|
||||||
tiles = {"default_ice.png"},
|
tiles = {"default_ice.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {cracky=3},
|
freezemelt = "default:water_source",
|
||||||
|
groups = {cracky=3, melts=1},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1284,14 +1293,16 @@ minetest.register_node("default:snow", {
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
|
leveled = 7,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
freezemelt = "default:water_flowing",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "leveled",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
|
{-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {crumbly=3,falling_node=1},
|
groups = {crumbly=3,falling_node=1, melts=1, float=1},
|
||||||
sounds = default.node_sound_dirt_defaults({
|
sounds = default.node_sound_dirt_defaults({
|
||||||
footstep = {name="default_snow_footstep", gain=0.25},
|
footstep = {name="default_snow_footstep", gain=0.25},
|
||||||
dug = {name="default_snow_footstep", gain=0.75},
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
|
@ -1309,7 +1320,8 @@ minetest.register_node("default:snowblock", {
|
||||||
description = "Snow Block",
|
description = "Snow Block",
|
||||||
tiles = {"default_snow.png"},
|
tiles = {"default_snow.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3},
|
freezemelt = "default:water_source",
|
||||||
|
groups = {crumbly=3, melts=1},
|
||||||
sounds = default.node_sound_dirt_defaults({
|
sounds = default.node_sound_dirt_defaults({
|
||||||
footstep = {name="default_snow_footstep", gain=0.25},
|
footstep = {name="default_snow_footstep", gain=0.25},
|
||||||
dug = {name="default_snow_footstep", gain=0.75},
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
|
|
BIN
mods/default/sounds/default_cool_lava.1.ogg
Normal file
BIN
mods/default/sounds/default_cool_lava.1.ogg
Normal file
Binary file not shown.
BIN
mods/default/sounds/default_cool_lava.2.ogg
Normal file
BIN
mods/default/sounds/default_cool_lava.2.ogg
Normal file
Binary file not shown.
BIN
mods/default/sounds/default_cool_lava.3.ogg
Normal file
BIN
mods/default/sounds/default_cool_lava.3.ogg
Normal file
Binary file not shown.
|
@ -30,7 +30,10 @@ minetest.register_abm({
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
local nn = minetest.get_node(pos).name
|
local nn = minetest.get_node(pos).name
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
if minetest.registered_nodes[nn] and
|
||||||
|
minetest.registered_nodes[nn].walkable and
|
||||||
|
minetest.get_item_group(nn, "plant") == 0
|
||||||
|
then
|
||||||
minetest.set_node(pos, {name="default:dirt"})
|
minetest.set_node(pos, {name="default:dirt"})
|
||||||
end
|
end
|
||||||
-- check if there is water nearby
|
-- check if there is water nearby
|
||||||
|
|
|
@ -9,7 +9,7 @@ minetest.register_node("fire:basic_flame", {
|
||||||
}},
|
}},
|
||||||
inventory_image = "fire_basic_flame.png",
|
inventory_image = "fire_basic_flame.png",
|
||||||
light_source = 14,
|
light_source = 14,
|
||||||
groups = {igniter=2,dig_immediate=3},
|
groups = {igniter=2,dig_immediate=3,hot=3},
|
||||||
drop = '',
|
drop = '',
|
||||||
walkable = false,
|
walkable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
|
|
|
@ -46,7 +46,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
elseif flower_choice == 4 then
|
elseif flower_choice == 4 then
|
||||||
flower = "flowers:dandelion_white"
|
flower = "flowers:dandelion_white"
|
||||||
elseif flower_choice == 5 then
|
elseif flower_choice == 5 then
|
||||||
flower = "flowers:flower_geranium"
|
flower = "flowers:geranium"
|
||||||
elseif flower_choice == 6 then
|
elseif flower_choice == 6 then
|
||||||
flower = "flowers:viola"
|
flower = "flowers:viola"
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,36 +28,35 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||||
|
|
||||||
local p0 = pointed_thing.under
|
local p0 = pointed_thing.under
|
||||||
local p1 = pointed_thing.above
|
local p1 = pointed_thing.above
|
||||||
|
local param2 = 0
|
||||||
|
|
||||||
|
local placer_pos = placer:getpos()
|
||||||
|
if placer_pos then
|
||||||
|
local dir = {
|
||||||
|
x = p1.x - placer_pos.x,
|
||||||
|
y = p1.y - placer_pos.y,
|
||||||
|
z = p1.z - placer_pos.z
|
||||||
|
}
|
||||||
|
param2 = minetest.dir_to_facedir(dir)
|
||||||
|
end
|
||||||
|
|
||||||
if p0.y-1 == p1.y then
|
if p0.y-1 == p1.y then
|
||||||
local fakestack = ItemStack("stairs:stair_" .. subname.."upside_down")
|
param2 = param2 + 20
|
||||||
local ret = minetest.item_place(fakestack, placer, pointed_thing)
|
if param2 == 21 then
|
||||||
if ret:is_empty() then
|
param2 = 23
|
||||||
itemstack:take_item()
|
elseif param2 == 23 then
|
||||||
return itemstack
|
param2 = 21
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Otherwise place regularly
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- for replace ABM
|
||||||
minetest.register_node(":stairs:stair_" .. subname.."upside_down", {
|
minetest.register_node(":stairs:stair_" .. subname.."upside_down", {
|
||||||
drop = "stairs:stair_" .. subname,
|
replace_name = "stairs:stair_" .. subname,
|
||||||
drawtype = "nodebox",
|
groups = {slabs_replace=1},
|
||||||
tiles = images,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = groups,
|
|
||||||
sounds = sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, 0, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
{-0.5, -0.5, 0, 0.5, 0, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -87,6 +86,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = images,
|
tiles = images,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = groups,
|
groups = groups,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
|
@ -106,21 +106,32 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
local p0 = pointed_thing.under
|
local p0 = pointed_thing.under
|
||||||
local p1 = pointed_thing.above
|
local p1 = pointed_thing.above
|
||||||
local n0 = minetest.get_node(p0)
|
local n0 = minetest.get_node(p0)
|
||||||
if n0.name == "stairs:slab_" .. subname and
|
local n1 = minetest.get_node(p1)
|
||||||
p0.y+1 == p1.y then
|
local param2 = 0
|
||||||
|
|
||||||
|
local n0_is_upside_down = (n0.name == "stairs:slab_" .. subname and
|
||||||
|
n0.param2 >= 20)
|
||||||
|
|
||||||
|
if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then
|
||||||
slabpos = p0
|
slabpos = p0
|
||||||
slabnode = n0
|
slabnode = n0
|
||||||
|
elseif n1.name == "stairs:slab_" .. subname then
|
||||||
|
slabpos = p1
|
||||||
|
slabnode = n1
|
||||||
end
|
end
|
||||||
if slabpos then
|
if slabpos then
|
||||||
-- Remove the slab at slabpos
|
-- Remove the slab at slabpos
|
||||||
minetest.remove_node(slabpos)
|
minetest.remove_node(slabpos)
|
||||||
-- Make a fake stack of a single item and try to place it
|
-- Make a fake stack of a single item and try to place it
|
||||||
local fakestack = ItemStack(recipeitem)
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
pointed_thing.above = slabpos
|
pointed_thing.above = slabpos
|
||||||
fakestack = minetest.item_place(fakestack, placer, pointed_thing)
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
-- If the item was taken from the fake stack, decrement original
|
-- If the item was taken from the fake stack, decrement original
|
||||||
if not fakestack or fakestack:is_empty() then
|
if success then
|
||||||
itemstack:take_item(1)
|
itemstack:set_count(fakestack:get_count())
|
||||||
-- Else put old node back
|
-- Else put old node back
|
||||||
else
|
else
|
||||||
minetest.set_node(slabpos, slabnode)
|
minetest.set_node(slabpos, slabnode)
|
||||||
|
@ -131,16 +142,19 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
-- Upside down slabs
|
-- Upside down slabs
|
||||||
if p0.y-1 == p1.y then
|
if p0.y-1 == p1.y then
|
||||||
-- Turn into full block if pointing at a existing slab
|
-- Turn into full block if pointing at a existing slab
|
||||||
if n0.name == "stairs:slab_" .. subname.."upside_down" then
|
if n0_is_upside_down then
|
||||||
-- Remove the slab at the position of the slab
|
-- Remove the slab at the position of the slab
|
||||||
minetest.remove_node(p0)
|
minetest.remove_node(p0)
|
||||||
-- Make a fake stack of a single item and try to place it
|
-- Make a fake stack of a single item and try to place it
|
||||||
local fakestack = ItemStack(recipeitem)
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
pointed_thing.above = p0
|
pointed_thing.above = p0
|
||||||
fakestack = minetest.item_place(fakestack, placer, pointed_thing)
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
-- If the item was taken from the fake stack, decrement original
|
-- If the item was taken from the fake stack, decrement original
|
||||||
if not fakestack or fakestack:is_empty() then
|
if success then
|
||||||
itemstack:take_item(1)
|
itemstack:set_count(fakestack:get_count())
|
||||||
-- Else put old node back
|
-- Else put old node back
|
||||||
else
|
else
|
||||||
minetest.set_node(p0, n0)
|
minetest.set_node(p0, n0)
|
||||||
|
@ -149,43 +163,22 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Place upside down slab
|
-- Place upside down slab
|
||||||
local fakestack = ItemStack("stairs:slab_" .. subname.."upside_down")
|
param2 = 20
|
||||||
local ret = minetest.item_place(fakestack, placer, pointed_thing)
|
|
||||||
if ret:is_empty() then
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If pointing at the side of a upside down slab
|
-- If pointing at the side of a upside down slab
|
||||||
if n0.name == "stairs:slab_" .. subname.."upside_down" and
|
if n0_is_upside_down and p0.y+1 ~= p1.y then
|
||||||
p0.y+1 ~= p1.y then
|
param2 = 20
|
||||||
-- Place upside down slab
|
|
||||||
local fakestack = ItemStack("stairs:slab_" .. subname.."upside_down")
|
|
||||||
local ret = minetest.item_place(fakestack, placer, pointed_thing)
|
|
||||||
if ret:is_empty() then
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Otherwise place regularly
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- for replace ABM
|
||||||
minetest.register_node(":stairs:slab_" .. subname.."upside_down", {
|
minetest.register_node(":stairs:slab_" .. subname.."upside_down", {
|
||||||
drop = "stairs:slab_"..subname,
|
replace_name = "stairs:slab_"..subname,
|
||||||
drawtype = "nodebox",
|
groups = {slabs_replace=1},
|
||||||
tiles = images,
|
|
||||||
paramtype = "light",
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = groups,
|
|
||||||
sounds = sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.5, 0, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -196,6 +189,23 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Replace old "upside_down" nodes with new param2 versions
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"group:slabs_replace"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node)
|
||||||
|
node.name = minetest.registered_nodes[node.name].replace_name
|
||||||
|
node.param2 = node.param2 + 20
|
||||||
|
if node.param2 == 21 then
|
||||||
|
node.param2 = 23
|
||||||
|
elseif node.param2 == 23 then
|
||||||
|
node.param2 = 21
|
||||||
|
end
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Nodes will be called stairs:{stair,slab}_<subname>
|
-- Nodes will be called stairs:{stair,slab}_<subname>
|
||||||
function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
|
function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
|
||||||
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
|
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
|
||||||
|
|
Loading…
Add table
Reference in a new issue