Adds example

This commit is contained in:
AliasAlreadyTaken 2024-06-12 22:42:34 +02:00
parent 4c1822fc4d
commit e6bd3915b1
9 changed files with 73 additions and 5 deletions

View File

@ -19,4 +19,7 @@ read_globals = {
-- MTG
"default", "sfinv", "creative",
-- depency
"yl_api_food"
}

View File

@ -17,7 +17,7 @@ yl_canned_food.worldpath = minetest.get_worldpath() .. DIR_DELIM
dofile(yl_canned_food.modpath .. "texts.lua")
dofile(yl_canned_food.modpath .. "information.lua")
dofile(yl_canned_food.modpath .. "config.lua")
--dofile(yl_canned_food.modpath .. "internal.lua")
dofile(yl_canned_food.modpath .. "internal.lua")
--dofile(yl_canned_food.modpath .. "initialize.lua")
dofile(yl_canned_food.modpath .. "items.lua")

23
internal.lua Normal file
View File

@ -0,0 +1,23 @@
local function get_node_definition()
local t = {
drawtype = "plantlike",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {
attached_node = 1,
dig_immediate = 3,
canned_food = 1,
vessel = 1
}
}
return t
end
function yl_canned_food.get_node_definition()
return get_node_definition()
end

View File

@ -0,0 +1,43 @@
local modname = "canned_food"
local itemname = "melon_jam"
local table_stages = {
{
stage = "1",
next_stage = "2",
duration = 5,
next_stage_chance = {["2"] = 55, ["3"] = 99, ["4"] = 7},
tiles = {"yl_canned_food_melon_jam_1.png"},
description = "Awesome melon jam",
node_definition_overwrite = yl_canned_food.get_node_definition()
},
{
stage = "2",
next_stage = "3",
duration = 10,
next_stage_chance = {["3"] = 99, ["4"] = 7},
tiles = {"yl_canned_food_melon_jam_2.png"},
description = "Awesome melon jam Stage 2",
node_definition_overwrite = yl_canned_food.get_node_definition()
},
{
stage = "3",
next_stage = "4",
duration = 15,
next_stage_chance = {["4"] = 7},
tiles = {"yl_canned_food_melon_jam_3.png"},
description = "Awesome melon jam Stage 3",
node_definition_overwrite = yl_canned_food.get_node_definition()
},
{
stage = "4",
next_stage = "",
duration = 0,
next_stage_chance = {},
tiles = {"yl_canned_food_melon_jam_4.png"},
description = "Awesome melon jam Stage 4",
node_definition_overwrite = yl_canned_food.get_node_definition()
},
}
yl_api_food.register_food(modname, itemname, table_stages)

View File

@ -1,6 +1,5 @@
name = yl_canned_food
description = A template with best practices
depends = default
optional_depends = moreblocks
description = Adds canned food
depends = yl_api_food
author = AliasAlreadyTaken
title = Template
title = Canned Food

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB