Add support for MineClone2-derived mods #10

Merged
erle merged 7 commits from add-mcl-compatibility into master 2021-08-30 01:52:39 +02:00
2 changed files with 412 additions and 15 deletions

View File

@ -1,3 +1,7 @@
default default?
mcl_colorblocks?
mcl_core?
mcl_formspec?
mcl_player?
wordedit? wordedit?
intllib? intllib?

421
init.lua
View File

@ -4,9 +4,42 @@ if minetest.get_modpath("intllib") then
S = intllib.Getter() S = intllib.Getter()
end end
local function mod_loaded(modname)
if minetest.get_modpath(modname) then
return true
end
return false
end
local has_default = mod_loaded("default")
local has_mcl = mod_loaded("mcl_core") and
mod_loaded("mcl_colorblocks") and
mod_loaded("mcl_formspec") and
mod_loaded("mcl_player")
if not (has_default or has_mcl) then
error(
"\n\n" ..
"mcl_meshnode requires a supported base game to run.\n" ..
"The following games should satisfy the requirement:\n" ..
"• Minetest Game\n" ..
"• MineClone2\n" ..
"• MineClone5\n" ..
"• Mineclonia\n"
)
end
local player_mod = default
if has_mcl then
player_mod = mcl_player
end
dofile(minetest.get_modpath(minetest.get_current_modname()).."/api.lua") dofile(minetest.get_modpath(minetest.get_current_modname()).."/api.lua")
local ctrl_groups = {choppy=2, oddly_breakable_by_hand=2} local ctrl_groups = {choppy=2, oddly_breakable_by_hand=2}
if has_mcl then
ctrl_groups = {axey=2, handy=1}
end
local has_worldedit = minetest.global_exists("worldedit") local has_worldedit = minetest.global_exists("worldedit")
local is_singleplayer = minetest.is_singleplayer() local is_singleplayer = minetest.is_singleplayer()
local control_textures = { local control_textures = {
@ -16,6 +49,15 @@ local control_textures = {
"default_obsidian_block.png", "default_obsidian_block.png",
"default_gold_block.png", "default_gold_block.png",
} }
if has_mcl then
control_textures = {
"default_steel_block.png",
"default_diamond_block.png",
"mcl_colorblocks_concrete_orange.png",
"default_obsidian.png",
"default_gold_block.png",
}
end
if is_singleplayer then if is_singleplayer then
meshnode.config.max_radius = 16 meshnode.config.max_radius = 16
@ -29,6 +71,331 @@ else
meshnode.blacklist["default:water_source"] = true meshnode.blacklist["default:water_source"] = true
meshnode.blacklist["default:river_water_source"] = true meshnode.blacklist["default:river_water_source"] = true
meshnode.blacklist["default:lava_source"] = true meshnode.blacklist["default:lava_source"] = true
if has_mcl then
meshnode.blacklist = {}
-- Nodes similar to default blacklist
meshnode.blacklist["mcl_core:water_source"] = true
meshnode.blacklist["mclx_core:river_water_source"] = true
meshnode.blacklist["mcl_core:lava_source"] = true
meshnode.blacklist["mcl_nether:nether_lava_source"] = true
-- Unmovable by design (taken from mesecons)
meshnode.blacklist["mcl_core:barrier"] = true
meshnode.blacklist["mcl_core:realm_barrier"] = true
meshnode.blacklist["mcl_core:void"] = true
meshnode.blacklist["mcl_core:bedrock"] = true
meshnode.blacklist["mcl_core:obsidian"] = true
meshnode.blacklist["mcl_chests:ender_chest"] = true
meshnode.blacklist["mcl_mobspawners:spawner"] = true
meshnode.blacklist["mesecons_commandblock:commandblock_off"] = true
meshnode.blacklist["mesecons_commandblock:commandblock_on"] = true
meshnode.blacklist["mcl_portals:portal"] = true
meshnode.blacklist["mcl_portals:portal_end"] = true
meshnode.blacklist["mcl_portals:end_portal_frame"] = true
meshnode.blacklist["mcl_portals:end_portal_frame_eye"] = true
-- Half-piston nodes (taken from mesecons)
meshnode.blacklist["mesecons_pistons:piston_pusher_normal"] = true
meshnode.blacklist["mesecons_pistons:piston_pusher_sticky"] = true
meshnode.blacklist["mesecons_pistons:piston_up_pusher_normal"] = true
meshnode.blacklist["mesecons_pistons:piston_up_pusher_sticky"] = true
meshnode.blacklist["mesecons_pistons:piston_down_pusher_normal"] = true
meshnode.blacklist["mesecons_pistons:piston_down_pusher_sticky"] = true
meshnode.blacklist["mesecons_pistons:piston_normal_on"] = true
meshnode.blacklist["mesecons_pistons:piston_sticky_on"] = true
meshnode.blacklist["mesecons_pistons:piston_up_normal_on"] = true
meshnode.blacklist["mesecons_pistons:piston_up_sticky_on"] = true
meshnode.blacklist["mesecons_pistons:piston_down_normal_on"] = true
meshnode.blacklist["mesecons_pistons:piston_down_sticky_on"] = true
-- Banners (are implemented as node + entity)
meshnode.blacklist["mcl_banners:hanging_banner"] = true
meshnode.blacklist["mcl_banners:standing_banner"] = true
-- Beds (should not oe be cut in half)
meshnode.blacklist["mcl_beds:bed_black_bottom"] = true
meshnode.blacklist["mcl_beds:bed_black_top"] = true
meshnode.blacklist["mcl_beds:bed_blue_bottom"] = true
meshnode.blacklist["mcl_beds:bed_blue_top"] = true
meshnode.blacklist["mcl_beds:bed_brown_bottom"] = true
meshnode.blacklist["mcl_beds:bed_brown_top"] = true
meshnode.blacklist["mcl_beds:bed_cyan_bottom"] = true
meshnode.blacklist["mcl_beds:bed_cyan_top"] = true
meshnode.blacklist["mcl_beds:bed_green_bottom"] = true
meshnode.blacklist["mcl_beds:bed_green_top"] = true
meshnode.blacklist["mcl_beds:bed_grey_bottom"] = true
meshnode.blacklist["mcl_beds:bed_grey_top"] = true
meshnode.blacklist["mcl_beds:bed_light_blue_bottom"] = true
meshnode.blacklist["mcl_beds:bed_light_blue_top"] = true
meshnode.blacklist["mcl_beds:bed_lime_bottom"] = true
meshnode.blacklist["mcl_beds:bed_lime_top"] = true
meshnode.blacklist["mcl_beds:bed_magenta_bottom"] = true
meshnode.blacklist["mcl_beds:bed_magenta_top"] = true
meshnode.blacklist["mcl_beds:bed_orange_bottom"] = true
meshnode.blacklist["mcl_beds:bed_orange_top"] = true
meshnode.blacklist["mcl_beds:bed_pink_bottom"] = true
meshnode.blacklist["mcl_beds:bed_pink_top"] = true
meshnode.blacklist["mcl_beds:bed_purple_bottom"] = true
meshnode.blacklist["mcl_beds:bed_purple_top"] = true
meshnode.blacklist["mcl_beds:bed_red_bottom"] = true
meshnode.blacklist["mcl_beds:bed_red_top"] = true
meshnode.blacklist["mcl_beds:bed_silver_bottom"] = true
meshnode.blacklist["mcl_beds:bed_silver_top"] = true
meshnode.blacklist["mcl_beds:bed_white_bottom"] = true
meshnode.blacklist["mcl_beds:bed_white_top"] = true
meshnode.blacklist["mcl_beds:bed_yellow_bottom"] = true
meshnode.blacklist["mcl_beds:bed_yellow_top"] = true
-- FIXME: Chests turn invisible in meshnode entity and
-- stay invisible when restored; double chests seem to
-- turn into a single chest and a half-chest. The bugs
-- are mostly due to chest entities not being spawned,
-- the chest inventory seems to be restored properly …
--
-- TODO: Take chests off the blacklist once they work.
meshnode.blacklist["mcl_chests:black_shulker_box"] = true
meshnode.blacklist["mcl_chests:black_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:blue_shulker_box"] = true
meshnode.blacklist["mcl_chests:blue_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:brown_shulker_box"] = true
meshnode.blacklist["mcl_chests:brown_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:chest"] = true
meshnode.blacklist["mcl_chests:chest_left"] = true
meshnode.blacklist["mcl_chests:chest_right"] = true
meshnode.blacklist["mcl_chests:chest_small"] = true
meshnode.blacklist["mcl_chests:cyan_shulker_box"] = true
meshnode.blacklist["mcl_chests:cyan_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:dark_green_shulker_box"] = true
meshnode.blacklist["mcl_chests:dark_green_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:dark_grey_shulker_box"] = true
meshnode.blacklist["mcl_chests:dark_grey_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:ender_chest"] = true
meshnode.blacklist["mcl_chests:ender_chest_small"] = true
meshnode.blacklist["mcl_chests:green_shulker_box"] = true
meshnode.blacklist["mcl_chests:green_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:grey_shulker_box"] = true
meshnode.blacklist["mcl_chests:grey_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:lightblue_shulker_box"] = true
meshnode.blacklist["mcl_chests:lightblue_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:magenta_shulker_box"] = true
meshnode.blacklist["mcl_chests:magenta_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:orange_shulker_box"] = true
meshnode.blacklist["mcl_chests:orange_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:pink_shulker_box"] = true
meshnode.blacklist["mcl_chests:pink_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:red_shulker_box"] = true
meshnode.blacklist["mcl_chests:red_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:trapped_chest"] = true
meshnode.blacklist["mcl_chests:trapped_chest_left"] = true
meshnode.blacklist["mcl_chests:trapped_chest_on"] = true
meshnode.blacklist["mcl_chests:trapped_chest_on_left"] = true
meshnode.blacklist["mcl_chests:trapped_chest_on_right"] = true
meshnode.blacklist["mcl_chests:trapped_chest_on_small"] = true
meshnode.blacklist["mcl_chests:trapped_chest_right"] = true
meshnode.blacklist["mcl_chests:trapped_chest_small"] = true
meshnode.blacklist["mcl_chests:violet_shulker_box"] = true
meshnode.blacklist["mcl_chests:violet_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:white_shulker_box"] = true
meshnode.blacklist["mcl_chests:white_shulker_box_small"] = true
meshnode.blacklist["mcl_chests:yellow_shulker_box"] = true
meshnode.blacklist["mcl_chests:yellow_shulker_box_small"] = true
-- Doors
meshnode.blacklist["mcl_doors:acacia_door_b_2"] = true
meshnode.blacklist["mcl_doors:acacia_door_t_1"] = true
meshnode.blacklist["mcl_doors:acacia_door_t_2"] = true
meshnode.blacklist["mcl_doors:acacia_trapdoor"] = true
meshnode.blacklist["mcl_doors:acacia_trapdoor_open"] = true
meshnode.blacklist["mcl_doors:birch_door_b_1"] = true
meshnode.blacklist["mcl_doors:birch_door_b_2"] = true
meshnode.blacklist["mcl_doors:birch_door_t_1"] = true
meshnode.blacklist["mcl_doors:birch_door_t_2"] = true
meshnode.blacklist["mcl_doors:birch_trapdoor"] = true
meshnode.blacklist["mcl_doors:birch_trapdoor_open"] = true
meshnode.blacklist["mcl_doors:dark_oak_door_b_1"] = true
meshnode.blacklist["mcl_doors:dark_oak_door_b_2"] = true
meshnode.blacklist["mcl_doors:dark_oak_door_t_1"] = true
meshnode.blacklist["mcl_doors:dark_oak_door_t_2"] = true
meshnode.blacklist["mcl_doors:dark_oak_trapdoor"] = true
meshnode.blacklist["mcl_doors:dark_oak_trapdoor_open"] = true
meshnode.blacklist["mcl_doors:iron_door_b_1"] = true
meshnode.blacklist["mcl_doors:iron_door_b_2"] = true
meshnode.blacklist["mcl_doors:iron_door_t_1"] = true
meshnode.blacklist["mcl_doors:iron_door_t_2"] = true
meshnode.blacklist["mcl_doors:iron_trapdoor"] = true
meshnode.blacklist["mcl_doors:iron_trapdoor_open"] = true
meshnode.blacklist["mcl_doors:jungle_door_b_1"] = true
meshnode.blacklist["mcl_doors:jungle_door_b_2"] = true
meshnode.blacklist["mcl_doors:jungle_door_t_1"] = true
meshnode.blacklist["mcl_doors:jungle_door_t_2"] = true
meshnode.blacklist["mcl_doors:jungle_trapdoor"] = true
meshnode.blacklist["mcl_doors:jungle_trapdoor_open"] = true
meshnode.blacklist["mcl_doors:spruce_door_b_1"] = true
meshnode.blacklist["mcl_doors:spruce_door_b_2"] = true
meshnode.blacklist["mcl_doors:spruce_door_t_1"] = true
meshnode.blacklist["mcl_doors:spruce_door_t_2"] = true
meshnode.blacklist["mcl_doors:spruce_trapdoor"] = true
meshnode.blacklist["mcl_doors:spruce_trapdoor_open"] = true
meshnode.blacklist["mcl_doors:trapdoor"] = true
meshnode.blacklist["mcl_doors:trapdoor_open"] = true
meshnode.blacklist["mcl_doors:wooden_door_b_1"] = true
meshnode.blacklist["mcl_doors:wooden_door_b_2"] = true
meshnode.blacklist["mcl_doors:wooden_door_t_1"] = true
meshnode.blacklist["mcl_doors:wooden_door_t_2"] = true
-- Flowerpots (grow to gigantic size)
meshnode.blacklist["mcl_flowerpots:flower_pot"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_acaciasapling"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_allium"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_azure_bluet"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_birchsapling"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_blue_orchid"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_cactus"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_dandelion"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_darksapling"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_deadbush"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_fern"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_junglesapling"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_mushroom_brown"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_mushroom_red"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_oxeye_daisy"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_poppy"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_sapling"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_sprucesapling"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_tulip_orange"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_tulip_pink"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_tulip_red"] = true
meshnode.blacklist["mcl_flowerpots:flower_pot_tulip_white"] = true
-- Double plant nodes
meshnode.blacklist["mcl_flowers:double_fern"] = true
meshnode.blacklist["mcl_flowers:double_fern_top"] = true
meshnode.blacklist["mcl_flowers:double_grass"] = true
meshnode.blacklist["mcl_flowers:double_grass_top"] = true
meshnode.blacklist["mcl_flowers:lilac"] = true
meshnode.blacklist["mcl_flowers:lilac_top"] = true
meshnode.blacklist["mcl_flowers:peony"] = true
meshnode.blacklist["mcl_flowers:peony_top"] = true
meshnode.blacklist["mcl_flowers:rose_bush"] = true
meshnode.blacklist["mcl_flowers:rose_bush_top"] = true
meshnode.blacklist["mcl_flowers:sunflower"] = true
meshnode.blacklist["mcl_flowers:sunflower_top"] = true
-- Item frame (lose content entity)
meshnode.blacklist["mcl_itemframes:item_frame"] = true
-- Signs (lose text entity)
meshnode.blacklist["mcl_signs:standing_sign"] = true
meshnode.blacklist["mcl_signs:standing_sign22_5"] = true
meshnode.blacklist["mcl_signs:standing_sign45"] = true
meshnode.blacklist["mcl_signs:standing_sign67_5"] = true
meshnode.blacklist["mcl_signs:wall_sign"] = true
-- Walls (connect weirdly upon restore)
meshnode.blacklist["mcl_walls:andesite"] = true
meshnode.blacklist["mcl_walls:andesite_0"] = true
meshnode.blacklist["mcl_walls:andesite_1"] = true
meshnode.blacklist["mcl_walls:andesite_10"] = true
meshnode.blacklist["mcl_walls:andesite_11"] = true
meshnode.blacklist["mcl_walls:andesite_12"] = true
meshnode.blacklist["mcl_walls:andesite_13"] = true
meshnode.blacklist["mcl_walls:andesite_14"] = true
meshnode.blacklist["mcl_walls:andesite_15"] = true
meshnode.blacklist["mcl_walls:andesite_16"] = true
meshnode.blacklist["mcl_walls:andesite_2"] = true
meshnode.blacklist["mcl_walls:andesite_21"] = true
meshnode.blacklist["mcl_walls:andesite_3"] = true
meshnode.blacklist["mcl_walls:andesite_4"] = true
meshnode.blacklist["mcl_walls:andesite_5"] = true
meshnode.blacklist["mcl_walls:andesite_6"] = true
meshnode.blacklist["mcl_walls:andesite_7"] = true
meshnode.blacklist["mcl_walls:andesite_8"] = true
meshnode.blacklist["mcl_walls:andesite_9"] = true
meshnode.blacklist["mcl_walls:brick"] = true
meshnode.blacklist["mcl_walls:brick_0"] = true
meshnode.blacklist["mcl_walls:brick_1"] = true
meshnode.blacklist["mcl_walls:brick_10"] = true
meshnode.blacklist["mcl_walls:brick_11"] = true
meshnode.blacklist["mcl_walls:brick_12"] = true
meshnode.blacklist["mcl_walls:brick_13"] = true
meshnode.blacklist["mcl_walls:brick_14"] = true
meshnode.blacklist["mcl_walls:brick_15"] = true
meshnode.blacklist["mcl_walls:brick_16"] = true
meshnode.blacklist["mcl_walls:brick_2"] = true
meshnode.blacklist["mcl_walls:brick_21"] = true
meshnode.blacklist["mcl_walls:brick_3"] = true
meshnode.blacklist["mcl_walls:brick_4"] = true
meshnode.blacklist["mcl_walls:brick_5"] = true
meshnode.blacklist["mcl_walls:brick_6"] = true
meshnode.blacklist["mcl_walls:brick_7"] = true
meshnode.blacklist["mcl_walls:brick_8"] = true
meshnode.blacklist["mcl_walls:brick_9"] = true
meshnode.blacklist["mcl_walls:cobble"] = true
meshnode.blacklist["mcl_walls:cobble_0"] = true
meshnode.blacklist["mcl_walls:cobble_1"] = true
meshnode.blacklist["mcl_walls:cobble_10"] = true
meshnode.blacklist["mcl_walls:cobble_11"] = true
meshnode.blacklist["mcl_walls:cobble_12"] = true
meshnode.blacklist["mcl_walls:cobble_13"] = true
meshnode.blacklist["mcl_walls:cobble_14"] = true
meshnode.blacklist["mcl_walls:cobble_15"] = true
meshnode.blacklist["mcl_walls:cobble_16"] = true
meshnode.blacklist["mcl_walls:cobble_2"] = true
meshnode.blacklist["mcl_walls:cobble_21"] = true
meshnode.blacklist["mcl_walls:cobble_3"] = true
meshnode.blacklist["mcl_walls:cobble_4"] = true
meshnode.blacklist["mcl_walls:cobble_5"] = true
meshnode.blacklist["mcl_walls:cobble_6"] = true
meshnode.blacklist["mcl_walls:cobble_7"] = true
meshnode.blacklist["mcl_walls:cobble_8"] = true
meshnode.blacklist["mcl_walls:cobble_9"] = true
meshnode.blacklist["mcl_walls:diorite"] = true
meshnode.blacklist["mcl_walls:diorite_0"] = true
meshnode.blacklist["mcl_walls:diorite_1"] = true
meshnode.blacklist["mcl_walls:diorite_10"] = true
meshnode.blacklist["mcl_walls:diorite_11"] = true
meshnode.blacklist["mcl_walls:diorite_12"] = true
meshnode.blacklist["mcl_walls:diorite_13"] = true
meshnode.blacklist["mcl_walls:diorite_14"] = true
meshnode.blacklist["mcl_walls:diorite_15"] = true
meshnode.blacklist["mcl_walls:diorite_16"] = true
meshnode.blacklist["mcl_walls:diorite_2"] = true
meshnode.blacklist["mcl_walls:diorite_21"] = true
meshnode.blacklist["mcl_walls:diorite_3"] = true
meshnode.blacklist["mcl_walls:diorite_4"] = true
meshnode.blacklist["mcl_walls:diorite_5"] = true
meshnode.blacklist["mcl_walls:diorite_6"] = true
meshnode.blacklist["mcl_walls:diorite_7"] = true
meshnode.blacklist["mcl_walls:diorite_8"] = true
meshnode.blacklist["mcl_walls:diorite_9"] = true
meshnode.blacklist["mcl_walls:endbricks"] = true
meshnode.blacklist["mcl_walls:endbricks_0"] = true
meshnode.blacklist["mcl_walls:endbricks_1"] = true
meshnode.blacklist["mcl_walls:endbricks_10"] = true
meshnode.blacklist["mcl_walls:endbricks_11"] = true
meshnode.blacklist["mcl_walls:endbricks_12"] = true
meshnode.blacklist["mcl_walls:endbricks_13"] = true
meshnode.blacklist["mcl_walls:endbricks_14"] = true
meshnode.blacklist["mcl_walls:endbricks_15"] = true
meshnode.blacklist["mcl_walls:endbricks_16"] = true
meshnode.blacklist["mcl_walls:endbricks_2"] = true
meshnode.blacklist["mcl_walls:endbricks_21"] = true
meshnode.blacklist["mcl_walls:endbricks_3"] = true
meshnode.blacklist["mcl_walls:endbricks_4"] = true
meshnode.blacklist["mcl_walls:endbricks_5"] = true
meshnode.blacklist["mcl_walls:endbricks_6"] = true
meshnode.blacklist["mcl_walls:endbricks_7"] = true
meshnode.blacklist["mcl_walls:endbricks_8"] = true
meshnode.blacklist["mcl_walls:endbricks_9"] = true
meshnode.blacklist["mcl_walls:granite"] = true
meshnode.blacklist["mcl_walls:granite_0"] = true
meshnode.blacklist["mcl_walls:granite_1"] = true
meshnode.blacklist["mcl_walls:granite_10"] = true
meshnode.blacklist["mcl_walls:granite_11"] = true
meshnode.blacklist["mcl_walls:granite_12"] = true
meshnode.blacklist["mcl_walls:granite_13"] = true
meshnode.blacklist["mcl_walls:granite_14"] = true
meshnode.blacklist["mcl_walls:granite_15"] = true
meshnode.blacklist["mcl_walls:granite_16"] = true
meshnode.blacklist["mcl_walls:granite_2"] = true
meshnode.blacklist["mcl_walls:granite_21"] = true
meshnode.blacklist["mcl_walls:granite_3"] = true
meshnode.blacklist["mcl_walls:granite_4"] = true
meshnode.blacklist["mcl_walls:granite_5"] = true
meshnode.blacklist["mcl_walls:granite_6"] = true
meshnode.blacklist["mcl_walls:granite_7"] = true
meshnode.blacklist["mcl_walls:granite_8"] = true
meshnode.blacklist["mcl_walls:granite_9"] = true
end
end end
for name, config in pairs(meshnode.config) do for name, config in pairs(meshnode.config) do
@ -68,14 +435,26 @@ local function show_meshnode_formspec(pos, player)
local id = minetest.pos_to_string(pos) local id = minetest.pos_to_string(pos)
local entity = meshnode.get_luaentity(id) local entity = meshnode.get_luaentity(id)
local spos = pos.x..","..pos.y..","..pos.z local spos = pos.x..","..pos.y..","..pos.z
local formspec = "size[8,8]".. local formspec = ""
default.gui_bg.. if has_default then
default.gui_bg_img.. formspec = "size[8,8]" ..
default.gui_slots.. default.gui_bg ..
default.get_hotbar_bg(0,4).. default.gui_bg_img ..
"list[current_player;main;0,4;8,1;]".. default.gui_slots ..
"list[current_player;main;0,5.25;8,3;8]".. default.get_hotbar_bg(0,4) ..
"list[nodemeta:"..spos..";tool;0.5,1.5;1,1;]" "list[current_player;main;0,4;8,1;]" ..
"list[current_player;main;0,5.25;8,3;8]" ..
"list[nodemeta:"..spos..";tool;0.5,1.5;1,1;]"
end
if has_mcl then
formspec = "size[9,8.75]" ..
mcl_formspec.get_itemslot_bg(0.5,1.5,1,1) ..
"list[current_player;main;0,4.5;9,3;9]" ..
mcl_formspec.get_itemslot_bg(0,4.5,9,3) ..
"list[current_player;main;0,7.74;9,1;]" ..
mcl_formspec.get_itemslot_bg(0,7.74,9,1) ..
"list[nodemeta:" .. spos .. ";tool;0.5,1.5;1,1;]"
end
local buttons = {} local buttons = {}
if entity and #entity.nodes > 0 then if entity and #entity.nodes > 0 then
if inv:contains_item("tool", "meshnode:glue") then if inv:contains_item("tool", "meshnode:glue") then
@ -119,13 +498,24 @@ register_scaffold("meshnode:scaffold_wall", {wall=1})
register_scaffold("meshnode:scaffold_pane", {pane=1}) register_scaffold("meshnode:scaffold_pane", {pane=1})
if meshnode.config.enable_crafting == true then if meshnode.config.enable_crafting == true then
minetest.register_craft({ local recipe
output = "meshnode:controller", if has_default then
recipe = { recipe = {
{"default:bronzeblock", "default:diamondblock", "default:bronzeblock"}, {"default:bronzeblock", "default:diamondblock", "default:bronzeblock"},
{"default:obsidian_block", "default:steelblock", "default:goldblock"}, {"default:obsidian_block", "default:steelblock", "default:goldblock"},
{"default:bronzeblock", "default:steelblock", "default:bronzeblock"}, {"default:bronzeblock", "default:steelblock", "default:bronzeblock"},
} }
end
if has_mcl then
recipe = {
{"mcl_colorblocks:concrete_orange", "mcl_core:diamondblock", "mcl_colorblocks:concrete_orange"},
{"mcl_core:obsidian", "mcl_core:ironblock", "mcl_core:goldblock"},
{"mcl_colorblocks:concrete_orange", "mcl_core:ironblock", "mcl_colorblocks:concrete_orange"},
}
end
minetest.register_craft({
output = "meshnode:controller",
recipe = recipe
}) })
end end
@ -319,6 +709,9 @@ minetest.register_node("meshnode:controller", {
paramtype2 = "facedir", paramtype2 = "facedir",
tiles = control_textures, tiles = control_textures,
groups = ctrl_groups, groups = ctrl_groups,
-- _mcl_hardness is needed so that the controller is not
-- diggable without a delay in MineClone2-derived games.
_mcl_hardness = 1,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
@ -483,22 +876,22 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
player:set_attach(entity.object, "", {x=0, y=5, z=0}, {x=0, y=0, z=0}) player:set_attach(entity.object, "", {x=0, y=5, z=0}, {x=0, y=0, z=0})
entity.player = player entity.player = player
entity.object:set_animation({x=0, y=0}, 15) entity.object:set_animation({x=0, y=0}, 15)
default.player_attached[name] = true player_mod.player_attached[name] = true
elseif fields.detach and entity.player == player then elseif fields.detach and entity.player == player then
player:set_detach() player:set_detach()
entity.player = nil entity.player = nil
entity.animation = "stand" entity.animation = "stand"
entity.object:set_animation({x=20, y=100}, 15) entity.object:set_animation({x=20, y=100}, 15)
default.player_attached[name] = false player_mod.player_attached[name] = false
local p = player:getpos() local p = player:getpos()
minetest.after(0.1, function() minetest.after(0.1, function()
player:setpos({x=p.x, y=p.y + 1, z=p.z}) player:setpos({x=p.x, y=p.y + 1, z=p.z})
end) end)
elseif fields.animation_sit then elseif fields.animation_sit then
default.player_set_animation(player, "sit", 30) player_mod.player_set_animation(player, "sit", 30)
entity.animation = "sit" entity.animation = "sit"
elseif fields.animation_stand then elseif fields.animation_stand then
default.player_set_animation(player, "stand", 30) player_mod.player_set_animation(player, "stand", 30)
entity.animation = "stand" entity.animation = "stand"
elseif fields.align then elseif fields.align then
entity:set_alignment() entity:set_alignment()