mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
More mcl_core refactoring
This commit is contained in:
parent
722d4cb500
commit
7d2ffe1c92
6 changed files with 420 additions and 412 deletions
|
@ -4,11 +4,14 @@ mcl_core = {}
|
|||
mcl_core.repair = 0.05
|
||||
|
||||
-- Load files
|
||||
dofile(minetest.get_modpath("mcl_core").."/functions.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/nodes_base.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/nodes_cactuscane.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/nodes_trees.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/nodes_glass.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/nodes_misc.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/craftitems.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/crafting.lua")
|
||||
local modpath = minetest.get_modpath("mcl_core")
|
||||
dofile(modpath.."/functions.lua")
|
||||
dofile(modpath.."/nodes_base.lua") -- Simple solid cubic nodes with simple definitions
|
||||
dofile(modpath.."/nodes_liquid.lua") -- Liquids
|
||||
dofile(modpath.."/nodes_cactuscane.lua") -- Cactus and sugar canes
|
||||
dofile(modpath.."/nodes_trees.lua") -- Tree nodes: Wood, Planks, Sapling, Leaves
|
||||
dofile(modpath.."/nodes_glass.lua") -- Glass
|
||||
dofile(modpath.."/nodes_climb.lua") -- Climbable nodes
|
||||
dofile(modpath.."/nodes_misc.lua") -- Other and special nodes
|
||||
dofile(modpath.."/craftitems.lua")
|
||||
dofile(modpath.."/crafting.lua")
|
||||
|
|
|
@ -1,35 +1,4 @@
|
|||
local WATER_ALPHA = 179
|
||||
local WATER_VISC = 1
|
||||
local LAVA_VISC = 7
|
||||
|
||||
--
|
||||
-- Node definitions
|
||||
--
|
||||
|
||||
-- The void below the bedrock. Void damage is handled in mcl_playerplus.
|
||||
-- The void does not exist as a block in Minecraft but we register it as a
|
||||
-- block here to make things easier for us.
|
||||
minetest.register_node("mcl_core:void", {
|
||||
description = "Void",
|
||||
_doc_items_create_entry = false,
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
pointable = false,
|
||||
walkable = false,
|
||||
floodable = false,
|
||||
buildable_to = false,
|
||||
inventory_image = "mcl_core_void.png",
|
||||
wield_image = "mcl_core_void.png",
|
||||
stack_max = 64,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = { not_in_creative_inventory = 1 },
|
||||
on_blast = function() end,
|
||||
drop = "",
|
||||
-- Infinite blast resistance; it should never be destroyed by explosions
|
||||
_mcl_blast_resistance = -1,
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
-- Simple solid cubic nodes, most of them are the ground materials and simple building blocks
|
||||
|
||||
minetest.register_node("mcl_core:stone", {
|
||||
description = "Stone",
|
||||
|
@ -638,341 +607,6 @@ minetest.register_node("mcl_core:bedrock", {
|
|||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:ladder", {
|
||||
description = "Ladder",
|
||||
_doc_items_longdesc = "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks and not on glass, leaves, ice, slabs, glowstone, nor sea lanterns.",
|
||||
drawtype = "signlike",
|
||||
is_ground_content = false,
|
||||
tiles = {"default_ladder.png"},
|
||||
inventory_image = "default_ladder.png",
|
||||
wield_image = "default_ladder.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = true,
|
||||
climbable = true,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 },
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 },
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1, attached_node=1, deco_block=1, dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
node_placement_prediction = "",
|
||||
-- Restrict placement of ladders
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
-- no interaction possible with entities
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not def then
|
||||
return itemstack
|
||||
end
|
||||
local groups = def.groups
|
||||
|
||||
-- Don't allow to place the ladder at particular nodes
|
||||
if (groups and (groups.glass or groups.leaves or groups.slab)) or
|
||||
node.name == "mcl_core:ladder" or node.name == "mcl_core:ice" or node.name == "mcl_nether:glowstone" or node.name == "mcl_ocean:sea_lantern" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Check special rightclick action of pointed node
|
||||
if def and def.on_rightclick then
|
||||
if not placer:get_player_control().sneak then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack, false
|
||||
end
|
||||
end
|
||||
local above = pointed_thing.above
|
||||
|
||||
-- Ladders may not be placed on ceiling or floor
|
||||
if under.y ~= above.y then
|
||||
return itemstack
|
||||
end
|
||||
local idef = itemstack:get_definition()
|
||||
local success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
|
||||
if success then
|
||||
if idef.sounds and idef.sounds.place then
|
||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1})
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 0.4,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("mcl_core:vine", {
|
||||
description = "Vines",
|
||||
_doc_items_longdesc = "Vines are climbable blocks which can be placed on the sides solid full-cube blocks. Vines very slowly grow upwards and downwards.",
|
||||
drawtype = "signlike",
|
||||
tiles = {"mcl_core_vine.png"},
|
||||
inventory_image = "mcl_core_vine.png",
|
||||
wield_image = "mcl_core_vine.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
buildable_to = true,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
drop = "",
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
||||
local item = user:get_wielded_item()
|
||||
if item:get_name() == "mcl_tools:shears" then
|
||||
minetest.add_item(pos, oldnode.name)
|
||||
end
|
||||
end,
|
||||
node_placement_prediction = "",
|
||||
-- Restrict placement of vines
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
-- no interaction possible with entities
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not def then return itemstack end
|
||||
local groups = def.groups
|
||||
|
||||
-- Check special rightclick action of pointed node
|
||||
if def and def.on_rightclick then
|
||||
if not placer:get_player_control().sneak then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack, false
|
||||
end
|
||||
end
|
||||
|
||||
-- Only allow placement on solid nodes
|
||||
if (not groups) or (not groups.solid) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Only place on full cubes
|
||||
if not mcl_core.supports_vines(node.name) then
|
||||
return
|
||||
end
|
||||
|
||||
local above = pointed_thing.above
|
||||
|
||||
-- Vines may not be placed on top or below another block
|
||||
if under.y ~= above.y then
|
||||
return itemstack
|
||||
end
|
||||
local idef = itemstack:get_definition()
|
||||
local itemstack, success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
|
||||
if success then
|
||||
if idef.sounds and idef.sounds.place then
|
||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1})
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 0.2,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("mcl_core:water_flowing", {
|
||||
description = "Flowing Water",
|
||||
_doc_items_create_entry = false,
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {name="default_water_flowing_animated.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=2.0}},
|
||||
special_tiles = {
|
||||
{
|
||||
image="default_water_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=2.0}
|
||||
},
|
||||
{
|
||||
image="default_water_flowing_animated.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=2.0}
|
||||
},
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_water_defaults(table),
|
||||
alpha = WATER_ALPHA,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mcl_core:water_flowing",
|
||||
liquid_alternative_source = "mcl_core:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
post_effect_color = {a=192, r=15, g=22, b=77},
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:water_source", {
|
||||
description = "Still Water",
|
||||
_doc_items_entry_name = "Water",
|
||||
_doc_items_longdesc =
|
||||
[[Water is abundant in oceans and also appears in a few springs in the ground. You can swim easily in water, but you need to catch your breath from time to time.
|
||||
Water interacts with lava in various ways:
|
||||
• When water is directly above or horizontally next to still lava, the lava turns into obsidian.
|
||||
• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.
|
||||
• When water is directly below lava, the water turns into stone.]],
|
||||
_doc_items_hidden = false,
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=5.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name="default_water_source_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=5.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_water_defaults(table),
|
||||
alpha = WATER_ALPHA,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mcl_core:water_flowing",
|
||||
liquid_alternative_source = "mcl_core:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
post_effect_color = {a=192, r=15, g=22, b=77},
|
||||
stack_max = 64,
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:lava_flowing", {
|
||||
description = "Flowing Lava",
|
||||
_doc_items_create_entry = false,
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_lava.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=3.3}
|
||||
},
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=3.3}
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "flowingliquid",
|
||||
-- Real light level: 15 (but Minetest caps at 14)
|
||||
light_source = 14,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
--[[ Drowning in Minecraft deals 2 damage per second.
|
||||
In Minetest, drowning damage is dealt every 2 seconds so this
|
||||
translates to 4 drowning damage ]]
|
||||
drowning = 4,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mcl_core:lava_flowing",
|
||||
liquid_alternative_source = "mcl_core:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 3,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=255, r=208, g=73, b=10},
|
||||
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:lava_source", {
|
||||
description = "Still Lava",
|
||||
_doc_items_entry_name = "Lava",
|
||||
_doc_items_longdesc =
|
||||
[[Lava is hot and rather dangerous. Don't touch it, it will hurt you a lot and it is hard to get out.
|
||||
Still lava sets fire to a couple of air blocks above when they're next to a flammable block.
|
||||
Lava interacts with water various ways:
|
||||
• When still lava is directly below or horizontally next to water, the lava turns into obsidian.
|
||||
• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.
|
||||
• When lava is directly above water, the water turns into stone.]],
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style lava source material (mostly unused)
|
||||
{
|
||||
name="default_lava_source_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=3.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
-- Real light level: 15 (but Minetest caps at 14)
|
||||
light_source = 14,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mcl_core:lava_flowing",
|
||||
liquid_alternative_source = "mcl_core:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 3,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=255, r=208, g=73, b=10},
|
||||
stack_max = 64,
|
||||
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:cobble", {
|
||||
description = "Cobblestone",
|
||||
_doc_items_longdesc = doc.sub.items.temp.build,
|
||||
|
@ -1082,43 +716,6 @@ minetest.register_node("mcl_core:obsidian", {
|
|||
_mcl_hardness = 50,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:deadbush", {
|
||||
description = "Dead Bush",
|
||||
_doc_items_longdesc = "Dead bushes are unremarkable plants often found in dry areas. They can be harvested for sticks.",
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_dry_shrub.png"},
|
||||
inventory_image = "default_dry_shrub.png",
|
||||
wield_image = "default_dry_shrub.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
stack_max = 64,
|
||||
buildable_to = true,
|
||||
groups = {dig_immediate=3, flammable=3,attached_node=1,plant=1,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {"mcl_core:stick 2"},
|
||||
rarity = 2,
|
||||
},
|
||||
{
|
||||
items = {"mcl_core:stick 1"},
|
||||
rarity = 2,
|
||||
},
|
||||
}
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-6/16, -8/16, -6/16, 6/16, 8/16, 6/16},
|
||||
},
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:ice", {
|
||||
description = "Ice",
|
||||
_doc_items_longdesc = "Ice is a translucent solid block usually found in cold areas.",
|
||||
|
|
156
mods/ITEMS/mcl_core/nodes_climb.lua
Normal file
156
mods/ITEMS/mcl_core/nodes_climb.lua
Normal file
|
@ -0,0 +1,156 @@
|
|||
-- Climbable nodes
|
||||
|
||||
minetest.register_node("mcl_core:ladder", {
|
||||
description = "Ladder",
|
||||
_doc_items_longdesc = "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks and not on glass, leaves, ice, slabs, glowstone, nor sea lanterns.",
|
||||
drawtype = "signlike",
|
||||
is_ground_content = false,
|
||||
tiles = {"default_ladder.png"},
|
||||
inventory_image = "default_ladder.png",
|
||||
wield_image = "default_ladder.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = true,
|
||||
climbable = true,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 },
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 },
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1, attached_node=1, deco_block=1, dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
node_placement_prediction = "",
|
||||
-- Restrict placement of ladders
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
-- no interaction possible with entities
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not def then
|
||||
return itemstack
|
||||
end
|
||||
local groups = def.groups
|
||||
|
||||
-- Don't allow to place the ladder at particular nodes
|
||||
if (groups and (groups.glass or groups.leaves or groups.slab)) or
|
||||
node.name == "mcl_core:ladder" or node.name == "mcl_core:ice" or node.name == "mcl_nether:glowstone" or node.name == "mcl_ocean:sea_lantern" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Check special rightclick action of pointed node
|
||||
if def and def.on_rightclick then
|
||||
if not placer:get_player_control().sneak then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack, false
|
||||
end
|
||||
end
|
||||
local above = pointed_thing.above
|
||||
|
||||
-- Ladders may not be placed on ceiling or floor
|
||||
if under.y ~= above.y then
|
||||
return itemstack
|
||||
end
|
||||
local idef = itemstack:get_definition()
|
||||
local success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
|
||||
if success then
|
||||
if idef.sounds and idef.sounds.place then
|
||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1})
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 0.4,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("mcl_core:vine", {
|
||||
description = "Vines",
|
||||
_doc_items_longdesc = "Vines are climbable blocks which can be placed on the sides solid full-cube blocks. Vines very slowly grow upwards and downwards.",
|
||||
drawtype = "signlike",
|
||||
tiles = {"mcl_core_vine.png"},
|
||||
inventory_image = "mcl_core_vine.png",
|
||||
wield_image = "mcl_core_vine.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
buildable_to = true,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
drop = "",
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
||||
local item = user:get_wielded_item()
|
||||
if item:get_name() == "mcl_tools:shears" then
|
||||
minetest.add_item(pos, oldnode.name)
|
||||
end
|
||||
end,
|
||||
node_placement_prediction = "",
|
||||
-- Restrict placement of vines
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
-- no interaction possible with entities
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not def then return itemstack end
|
||||
local groups = def.groups
|
||||
|
||||
-- Check special rightclick action of pointed node
|
||||
if def and def.on_rightclick then
|
||||
if not placer:get_player_control().sneak then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack, false
|
||||
end
|
||||
end
|
||||
|
||||
-- Only allow placement on solid nodes
|
||||
if (not groups) or (not groups.solid) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Only place on full cubes
|
||||
if not mcl_core.supports_vines(node.name) then
|
||||
return
|
||||
end
|
||||
|
||||
local above = pointed_thing.above
|
||||
|
||||
-- Vines may not be placed on top or below another block
|
||||
if under.y ~= above.y then
|
||||
return itemstack
|
||||
end
|
||||
local idef = itemstack:get_definition()
|
||||
local itemstack, success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
|
||||
if success then
|
||||
if idef.sounds and idef.sounds.place then
|
||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1})
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 0.2,
|
||||
})
|
|
@ -1,3 +1,5 @@
|
|||
-- Glass nodes
|
||||
|
||||
minetest.register_node("mcl_core:glass", {
|
||||
description = "Glass",
|
||||
_doc_items_longdesc = "A decorational and mostly transparent block.",
|
||||
|
|
184
mods/ITEMS/mcl_core/nodes_liquid.lua
Normal file
184
mods/ITEMS/mcl_core/nodes_liquid.lua
Normal file
|
@ -0,0 +1,184 @@
|
|||
-- Liquids: Water and lava
|
||||
|
||||
local WATER_ALPHA = 179
|
||||
local WATER_VISC = 1
|
||||
local LAVA_VISC = 7
|
||||
|
||||
minetest.register_node("mcl_core:water_flowing", {
|
||||
description = "Flowing Water",
|
||||
_doc_items_create_entry = false,
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {name="default_water_flowing_animated.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=2.0}},
|
||||
special_tiles = {
|
||||
{
|
||||
image="default_water_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=2.0}
|
||||
},
|
||||
{
|
||||
image="default_water_flowing_animated.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=2.0}
|
||||
},
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_water_defaults(table),
|
||||
alpha = WATER_ALPHA,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mcl_core:water_flowing",
|
||||
liquid_alternative_source = "mcl_core:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
post_effect_color = {a=192, r=15, g=22, b=77},
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:water_source", {
|
||||
description = "Still Water",
|
||||
_doc_items_entry_name = "Water",
|
||||
_doc_items_longdesc =
|
||||
[[Water is abundant in oceans and also appears in a few springs in the ground. You can swim easily in water, but you need to catch your breath from time to time.
|
||||
Water interacts with lava in various ways:
|
||||
• When water is directly above or horizontally next to still lava, the lava turns into obsidian.
|
||||
• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.
|
||||
• When water is directly below lava, the water turns into stone.]],
|
||||
_doc_items_hidden = false,
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=5.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name="default_water_source_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=5.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_water_defaults(table),
|
||||
alpha = WATER_ALPHA,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mcl_core:water_flowing",
|
||||
liquid_alternative_source = "mcl_core:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
post_effect_color = {a=192, r=15, g=22, b=77},
|
||||
stack_max = 64,
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:lava_flowing", {
|
||||
description = "Flowing Lava",
|
||||
_doc_items_create_entry = false,
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_lava.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=3.3}
|
||||
},
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=3.3}
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "flowingliquid",
|
||||
-- Real light level: 15 (but Minetest caps at 14)
|
||||
light_source = 14,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
--[[ Drowning in Minecraft deals 2 damage per second.
|
||||
In Minetest, drowning damage is dealt every 2 seconds so this
|
||||
translates to 4 drowning damage ]]
|
||||
drowning = 4,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mcl_core:lava_flowing",
|
||||
liquid_alternative_source = "mcl_core:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 3,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=255, r=208, g=73, b=10},
|
||||
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:lava_source", {
|
||||
description = "Still Lava",
|
||||
_doc_items_entry_name = "Lava",
|
||||
_doc_items_longdesc =
|
||||
[[Lava is hot and rather dangerous. Don't touch it, it will hurt you a lot and it is hard to get out.
|
||||
Still lava sets fire to a couple of air blocks above when they're next to a flammable block.
|
||||
Lava interacts with water various ways:
|
||||
• When still lava is directly below or horizontally next to water, the lava turns into obsidian.
|
||||
• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.
|
||||
• When lava is directly above water, the water turns into stone.]],
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style lava source material (mostly unused)
|
||||
{
|
||||
name="default_lava_source_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=3.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
-- Real light level: 15 (but Minetest caps at 14)
|
||||
light_source = 14,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 4,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mcl_core:lava_flowing",
|
||||
liquid_alternative_source = "mcl_core:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 3,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=255, r=208, g=73, b=10},
|
||||
stack_max = 64,
|
||||
groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 500,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
})
|
|
@ -1,3 +1,5 @@
|
|||
-- Other nodes
|
||||
|
||||
minetest.register_node("mcl_core:bone_block", {
|
||||
description = "Bone Block",
|
||||
_doc_items_longdesc = "Bone blocks are decorational blocks and a compact storage of bone meal.",
|
||||
|
@ -67,6 +69,44 @@ minetest.register_node("mcl_core:cobweb", {
|
|||
_mcl_hardness = 4,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("mcl_core:deadbush", {
|
||||
description = "Dead Bush",
|
||||
_doc_items_longdesc = "Dead bushes are unremarkable plants often found in dry areas. They can be harvested for sticks.",
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_dry_shrub.png"},
|
||||
inventory_image = "default_dry_shrub.png",
|
||||
wield_image = "default_dry_shrub.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
stack_max = 64,
|
||||
buildable_to = true,
|
||||
groups = {dig_immediate=3, flammable=3,attached_node=1,plant=1,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {"mcl_core:stick 2"},
|
||||
rarity = 2,
|
||||
},
|
||||
{
|
||||
items = {"mcl_core:stick 1"},
|
||||
rarity = 2,
|
||||
},
|
||||
}
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-6/16, -8/16, -6/16, 6/16, 8/16, 6/16},
|
||||
},
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:barrier", {
|
||||
description = "Barrier",
|
||||
_doc_items_longdesc = "Barriers are invisble walkable blocks. They are used to create boundaries of adventure maps and the like. Monsters and animals won't appear on barriers, and fences do not connect to barriers. Other blocks can be built on barriers like on any other block.",
|
||||
|
@ -97,3 +137,29 @@ minetest.register_node("mcl_core:barrier", {
|
|||
})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- The void below the bedrock. Void damage is handled in mcl_playerplus.
|
||||
-- The void does not exist as a block in Minecraft but we register it as a
|
||||
-- block here to make things easier for us.
|
||||
minetest.register_node("mcl_core:void", {
|
||||
description = "Void",
|
||||
_doc_items_create_entry = false,
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
pointable = false,
|
||||
walkable = false,
|
||||
floodable = false,
|
||||
buildable_to = false,
|
||||
inventory_image = "mcl_core_void.png",
|
||||
wield_image = "mcl_core_void.png",
|
||||
stack_max = 64,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = { not_in_creative_inventory = 1 },
|
||||
on_blast = function() end,
|
||||
drop = "",
|
||||
-- Infinite blast resistance; it should never be destroyed by explosions
|
||||
_mcl_blast_resistance = -1,
|
||||
_mcl_hardness = -1,
|
||||
})
|
Loading…
Reference in a new issue