2017-07-07 16:52:28 +02:00
-- Other nodes
2019-03-07 23:40:43 +01:00
local S = minetest.get_translator ( " mcl_core " )
2017-07-07 16:52:28 +02:00
2019-12-14 23:42:17 +01:00
local mod_screwdriver = minetest.get_modpath ( " screwdriver " ) ~= nil
local on_rotate
if mod_screwdriver then
on_rotate = screwdriver.rotate_3way
end
2020-11-13 22:59:03 +01:00
local alldirs = { { x = 0 , y = 0 , z = 1 } , { x = 1 , y = 0 , z = 0 } , { x = 0 , y = 0 , z =- 1 } , { x =- 1 , y = 0 , z = 0 } , { x = 0 , y =- 1 , z = 0 } , { x = 0 , y = 1 , z = 0 } }
2019-12-14 23:42:17 +01:00
2017-07-07 16:37:05 +02:00
minetest.register_node ( " mcl_core:bone_block " , {
2019-03-07 23:40:43 +01:00
description = S ( " Bone Block " ) ,
2019-03-09 17:01:36 +01:00
_doc_items_longdesc = S ( " Bone blocks are decorative blocks and a compact storage of bone meal. " ) ,
2017-07-07 16:37:05 +02:00
tiles = { " mcl_core_bone_block_top.png " , " mcl_core_bone_block_top.png " , " mcl_core_bone_block_side.png " } ,
is_ground_content = false ,
paramtype2 = " facedir " ,
on_place = mcl_util.rotate_axis ,
groups = { pickaxey = 1 , building_block = 1 , material_stone = 1 } ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
2019-12-14 23:42:17 +01:00
on_rotate = on_rotate ,
2020-04-15 13:27:29 +02:00
_mcl_blast_resistance = 2 ,
2017-07-07 16:37:05 +02:00
_mcl_hardness = 2 ,
} )
minetest.register_node ( " mcl_core:slimeblock " , {
2019-03-07 23:40:43 +01:00
description = S ( " Slime Block " ) ,
_doc_items_longdesc = S ( " Slime blocks are very bouncy and prevent fall damage. " ) ,
2017-07-07 16:37:05 +02:00
drawtype = " nodebox " ,
paramtype = " light " ,
is_ground_content = false ,
node_box = {
type = " fixed " ,
fixed = {
{ - 0.25 , - 0.25 , - 0.25 , 0.25 , 0.25 , 0.25 } ,
{ - 0.5 , - 0.5 , - 0.5 , 0.5 , 0.5 , 0.5 } ,
}
} ,
2017-09-01 20:55:33 +02:00
selection_box = {
type = " regular " ,
} ,
2017-07-07 16:37:05 +02:00
tiles = { " mcl_core_slime.png " } ,
paramtype = " light " ,
use_texture_alpha = true ,
stack_max = 64 ,
-- According to Minecraft Wiki, bouncing off a slime block from a height off 255 blocks should result in a bounce height of 50 blocks
-- bouncy=44 makes the player bounce up to 49.6. This value was chosen by experiment.
-- bouncy=80 was chosen because it is higher than 66 (bounciness of bed)
groups = { dig_immediate = 3 , bouncy = 80 , fall_damage_add_percent =- 100 , deco_block = 1 } ,
sounds = {
dug = { name = " slimenodes_dug " , gain = 0.6 } ,
place = { name = " slimenodes_place " , gain = 0.6 } ,
footstep = { name = " slimenodes_step " , gain = 0.3 } ,
} ,
_mcl_blast_resistance = 0 ,
_mcl_hardness = 0 ,
2020-11-13 22:59:03 +01:00
mvps_sticky = function ( pos , node , piston_pos )
2020-10-04 22:27:08 +02:00
local connected = { }
2020-11-13 22:59:03 +01:00
for n , v in ipairs ( alldirs ) do
local neighbor_pos = vector.add ( pos , v )
local neighbor_node = minetest.get_node ( neighbor_pos )
if neighbor_node then
if neighbor_node.name == " ignore " then
minetest.get_voxel_manip ( ) : read_from_map ( neighbor_pos , neighbor_pos )
neighbor_node = minetest.get_node ( neighbor_pos )
end
local name = neighbor_node.name
if name ~= " air " and name ~= " ignore " then
local piston , piston_side , piston_up , piston_down = false , false , false , false
if name == " mesecons_pistons:piston_sticky_off " or name == " mesecons_pistons:piston_normal_off " then
piston , piston_side = true , true
elseif name == " mesecons_pistons:piston_up_sticky_off " or name == " mesecons_pistons:piston_up_normal_off " then
piston , piston_up = true , true
elseif name == " mesecons_pistons:piston_down_sticky_off " or name == " mesecons_pistons:piston_down_normal_off " then
piston , piston_down = true , true
end
if not ( ( piston_side and ( n - 1 == neighbor_node.param2 ) ) or ( piston_up and ( n == 5 ) ) or ( piston_down and ( n == 6 ) ) ) then
if piston and piston_pos then
if piston_pos.x == neighbor_pos.x and piston_pos.y == neighbor_pos.y and piston_pos.z == neighbor_pos.z then
-- Loopback to the same piston! Preventing unwanted behavior:
return { } , true
end
end
table.insert ( connected , neighbor_pos )
end
end
2020-10-04 22:27:08 +02:00
end
end
2020-11-13 22:59:03 +01:00
return connected , false
2020-10-04 22:27:08 +02:00
end ,
2017-07-07 16:37:05 +02:00
} )
minetest.register_node ( " mcl_core:cobweb " , {
2019-03-07 23:40:43 +01:00
description = S ( " Cobweb " ) ,
2020-02-19 04:54:17 +01:00
_tt_help = S ( " Slows down movement " ) ,
2019-03-07 23:40:43 +01:00
_doc_items_longdesc = S ( " Cobwebs can be walked through, but significantly slow you down. " ) ,
2017-07-07 16:37:05 +02:00
drawtype = " plantlike " ,
paramtype2 = " degrotate " ,
visual_scale = 1.1 ,
stack_max = 64 ,
tiles = { " mcl_core_web.png " } ,
inventory_image = " mcl_core_web.png " ,
paramtype = " light " ,
liquid_viscosity = 14 ,
liquidtype = " source " ,
liquid_alternative_flowing = " mcl_core:cobweb " ,
liquid_alternative_source = " mcl_core:cobweb " ,
liquid_renewable = false ,
liquid_range = 0 ,
walkable = false ,
2020-01-30 16:36:28 +01:00
groups = { swordy_cobweb = 1 , shearsy = 1 , fake_liquid = 1 , disable_jump = 1 , deco_block = 1 , dig_by_piston = 1 , dig_by_water = 1 , destroy_by_lava_flow = 1 , } ,
2017-07-07 16:37:05 +02:00
drop = " mcl_mobitems:string " ,
2017-08-03 03:41:08 +02:00
_mcl_shears_drop = true ,
2017-07-07 16:37:05 +02:00
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
2020-04-15 13:27:29 +02:00
_mcl_blast_resistance = 4 ,
2017-07-07 16:37:05 +02:00
_mcl_hardness = 4 ,
} )
2017-07-07 16:52:28 +02:00
minetest.register_node ( " mcl_core:deadbush " , {
2019-03-07 23:40:43 +01:00
description = S ( " Dead Bush " ) ,
_doc_items_longdesc = S ( " Dead bushes are unremarkable plants often found in dry areas. They can be harvested for sticks. " ) ,
2017-07-07 16:52:28 +02:00
_doc_items_hidden = false ,
drawtype = " plantlike " ,
2017-09-13 06:50:54 +02:00
waving = 1 ,
2017-07-07 16:52:28 +02:00
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 ,
2020-04-18 23:24:42 +02:00
groups = { handy = 1 , shearsy = 1 , flammable = 3 , attached_node = 1 , plant = 1 , non_mycelium_plant = 1 , dig_by_water = 1 , destroy_by_lava_flow = 1 , deco_block = 1 , fire_encouragement = 60 , fire_flammability = 100 } ,
2017-07-07 16:52:28 +02:00
drop = {
max_items = 1 ,
items = {
{
items = { " mcl_core:stick 2 " } ,
rarity = 2 ,
} ,
{
items = { " mcl_core:stick 1 " } ,
rarity = 2 ,
} ,
}
} ,
2017-08-03 02:27:55 +02:00
_mcl_shears_drop = true ,
2017-07-07 16:52:28 +02:00
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
selection_box = {
type = " fixed " ,
2017-11-15 04:40:29 +01:00
fixed = { - 5 / 16 , - 8 / 16 , - 5 / 16 , 5 / 16 , 1 / 16 , 5 / 16 } ,
2017-07-07 16:52:28 +02:00
} ,
_mcl_blast_resistance = 0 ,
_mcl_hardness = 0 ,
} )
2017-07-07 16:37:05 +02:00
minetest.register_node ( " mcl_core:barrier " , {
2019-03-07 23:40:43 +01:00
description = S ( " Barrier " ) ,
_doc_items_longdesc = S ( " 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. " ) ,
_doc_items_usagehelp = S ( " When you hold a barrier in hand, you reveal all placed barriers in a short distance around you. " ) ,
2017-07-07 16:37:05 +02:00
drawtype = " airlike " ,
paramtype = " light " ,
inventory_image = " mcl_core_barrier.png " ,
wield_image = " mcl_core_barrier.png " ,
tiles = { " blank.png " } ,
stack_max = 64 ,
sunlight_propagates = true ,
is_ground_content = false ,
groups = { creative_breakable = 1 , not_in_creative_inventory = 1 , not_solid = 1 } ,
on_blast = function ( ) end ,
drop = " " ,
2020-04-15 13:27:29 +02:00
_mcl_blast_resistance = 36000008 ,
2017-07-07 16:37:05 +02:00
_mcl_hardness = - 1 ,
after_place_node = function ( pos , placer , itemstack , pointed_thing )
if placer == nil then
return
end
minetest.add_particle ( {
pos = pos ,
expirationtime = 1 ,
size = 8 ,
texture = " mcl_core_barrier.png " ,
2019-03-08 03:47:14 +01:00
glow = 14 ,
2017-07-07 16:37:05 +02:00
playername = placer : get_player_name ( )
} )
end ,
2017-12-13 00:30:23 +01:00
on_place = function ( itemstack , placer , pointed_thing )
if pointed_thing.type ~= " node " then
return itemstack
end
-- Use pointed node's on_rightclick function first, if present
local node = minetest.get_node ( pointed_thing.under )
if placer and not placer : get_player_control ( ) . sneak then
if minetest.registered_nodes [ node.name ] and minetest.registered_nodes [ node.name ] . on_rightclick then
return minetest.registered_nodes [ node.name ] . on_rightclick ( pointed_thing.under , node , placer , itemstack ) or itemstack
end
end
local name = placer : get_player_name ( )
local privs = minetest.get_player_privs ( name )
if not privs.maphack then
minetest.chat_send_player ( name , " Placement denied. You need the “maphack” privilege to place barriers. " )
return itemstack
end
local new_itemstack = minetest.item_place ( itemstack , placer , pointed_thing )
return new_itemstack
end ,
2017-07-07 16:37:05 +02:00
} )
2017-07-07 16:52:28 +02:00
2017-08-08 23:19:44 +02:00
-- Same as barrier, but non-pointable. This node is only to be used internally to separate realms.
-- It must NOT be used for anything else.
-- This node only exists because Minetest does not have support for “dimensions” yet and needs to
-- be removed when support for this is implemented.
minetest.register_node ( " mcl_core:realm_barrier " , {
2019-03-07 23:40:43 +01:00
description = S ( " Realm Barrier " ) ,
2017-08-08 23:19:44 +02:00
_doc_items_create_entry = false ,
drawtype = " airlike " ,
paramtype = " light " ,
inventory_image = " mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX " ,
wield_image = " mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX " ,
tiles = { " blank.png " } ,
stack_max = 64 ,
2017-08-17 19:59:43 +02:00
-- To avoid players getting stuck forever between realms
damage_per_second = 8 ,
2017-08-08 23:19:44 +02:00
sunlight_propagates = true ,
is_ground_content = false ,
pointable = false ,
groups = { not_in_creative_inventory = 1 , not_solid = 1 } ,
on_blast = function ( ) end ,
drop = " " ,
2020-04-15 13:27:29 +02:00
_mcl_blast_resistance = 36000008 ,
2017-08-08 23:19:44 +02:00
_mcl_hardness = - 1 ,
2017-08-08 23:28:06 +02:00
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
node_placement_prediction = " " ,
on_place = function ( pos , placer , itemstack , pointed_thing )
2020-01-06 13:02:30 +01:00
minetest.chat_send_player ( placer : get_player_name ( ) , minetest.colorize ( " #FF0000 " , " You can't just place a realm barrier by hand! " ) )
2017-08-08 23:28:06 +02:00
return
2017-08-08 23:19:44 +02:00
end ,
} )
2017-07-07 16:52:28 +02:00
-- 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 " , {
2019-03-07 23:40:43 +01:00
description = S ( " Void " ) ,
2017-07-07 16:52:28 +02:00
_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 ,
2017-08-08 23:28:06 +02:00
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
node_placement_prediction = " " ,
on_place = function ( pos , placer , itemstack , pointed_thing )
2020-01-06 13:02:30 +01:00
minetest.chat_send_player ( placer : get_player_name ( ) , m inetest.colorize ( " #FF0000 " , " You can't just place the void by hand! " ) )
2017-08-08 23:28:06 +02:00
return
end ,
2017-07-07 16:52:28 +02:00
drop = " " ,
-- Infinite blast resistance; it should never be destroyed by explosions
_mcl_blast_resistance = - 1 ,
_mcl_hardness = - 1 ,
2017-08-03 02:27:55 +02:00
} )