2021年1月22日金曜日

Minetestに黒い液体・紫の液体を追加するmodを作成する

Minetestではmodによりブロックを追加する事ができます。

〇作成したmodで追加した黒い液体・紫の液体

作成手順

1. mod用フォルダの作成
mkdir ~/.minetest/mods/liquids
mkdir ~/.minetest/mods/liquids/textures

2. 以下の画像ファイルをtexturesに配置

gray_liquid.png

purple_liquid.png

3. テキストエディタなどで、以下の内容をinit.luaとして保存
creativeモードなどに切り替え、gray liquid source/purple liquid sourceがインベントリに追加されるのを確認します。
minetest.register_node("liquids:gray_liquid_source", {
    tiles = {
        {
            name = "gray_liquid.png",
            backface_culling = false,
            animation = {
                type = "vertical_frames",
                aspect_w = 16,
                aspect_h = 16,
                length = 2.0,
            },
        },
        {
            name = "gray_liquid.png",
            backface_culling = true,
            animation = {
                type = "vertical_frames",
                aspect_w = 16,
                aspect_h = 16,
                length = 2.0,
            },
        },
    },
    description = "gray liquid source",
    drawtype = "liquid",
    waving=3,
    alpha = 200,
        paramtype = "light",
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        is_ground_content = false,
        drop = "",
        drowning = 1,
        liquidtype = "source",
    liquid_alternative_flowing = "liquids:gray_liquid_flowing",
        liquid_alternative_source = "liquids:gray_liquid_source",
        liquid_viscosity = 1,
        post_effect_color = {a = 203, r = 10, g = 10, b = 10},
        groups = {water = 3, liquid = 3,
                cools_lava = 1},
})

minetest.register_node("liquids:gray_liquid_flowing", {
    tiles = {
        "gray_liquid.png"
    },
            special_tiles = {
                {
                        name = "gray_liquid.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
                                length = 0.8,
                        },
                },
                {
                        name = "gray_liquid.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
                                length = 0.8,
                        },
                },
        },
    description = "gray liquid flowing",
    drawtype = "flowingliquid",
    waving=3,
    paramtype = "light",
    paramtype2 = "flowingliquid",
    alpha = 200,
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        is_ground_content = false,
        drop = "",
        drowning = 1,
        liquidtype = "flowing",
    liquid_alternative_flowing = "liquids:gray_liquid_flowing",
        liquid_alternative_source = "liquids:gray_liquid_source",
        liquid_viscosity = 1,
        post_effect_color = {a = 203, r = 10, g = 10, b = 10},
        groups = {water = 3, liquid = 3,  not_in_creative_inventory = 1,
                cools_lava = 1},
})


minetest.register_node("liquids:purple_liquid_source", {
    tiles = {
        {
            name = "purple_liquid.png",
            backface_culling = false,
            animation = {
                type = "vertical_frames",
                aspect_w = 16,
                aspect_h = 16,
                length = 2.0,
            },
        },
        {
            name = "purple_liquid.png",
            backface_culling = true,
            animation = {
                type = "vertical_frames",
                aspect_w = 16,
                aspect_h = 16,
                length = 2.0,
            },
        },
    },
    description = "purple liquid source",
    drawtype = "liquid",
    waving=3,
    alpha = 200,
        paramtype = "light",
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        is_ground_content = false,
        drop = "",
        drowning = 1,
        liquidtype = "source",
    liquid_alternative_flowing = "liquids:purple_liquid_flowing",
        liquid_alternative_source = "liquids:purple_liquid_source",
        liquid_viscosity = 1,
        post_effect_color = {a = 203, r = 50, g = 10, b = 40},
        groups = {water = 3, liquid = 3,
                cools_lava = 1},
})

minetest.register_node("liquids:purple_liquid_flowing", {
    tiles = {
        "purple_liquid.png"
    },
            special_tiles = {
                {
                        name = "purple_liquid.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
                                length = 0.8,
                        },
                },
                {
                        name = "purple_liquid.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
                                length = 0.8,
                        },
                },
        },
    description = "purple liquid flowing",
    drawtype = "flowingliquid",
    waving=3,
    paramtype = "light",
    paramtype2 = "flowingliquid",
    alpha = 200,
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        is_ground_content = false,
        drop = "",
        drowning = 1,
        liquidtype = "flowing",
    liquid_alternative_flowing = "liquids:purple_liquid_flowing",
        liquid_alternative_source = "liquids:purple_liquid_source",
        liquid_viscosity = 1,
        post_effect_color = {a = 203, r = 50, g = 10, b = 40},
        groups = {water = 3, liquid = 3,  not_in_creative_inventory = 1,
                cools_lava = 1},
})

4. ワールドの世界画面でliquids modを有効化して、ゲーム開始

関連情報

・Minetestに関する他の記事はこちらを参照してください。

0 件のコメント:

コメントを投稿