diff --git a/cooking.lua b/cooking.lua index 5d0ffcd..ab4480d 100644 --- a/cooking.lua +++ b/cooking.lua @@ -1,6 +1,8 @@ -- makes a cooking recipe -- pretty self explainable +--[[ here is the original way to do it + -- make coal with wood stuffz minetest.register_craft({ type = 'cooking', @@ -8,21 +10,28 @@ minetest.register_craft({ output = 'random_cool_stuff:charcoal', cooktime = 12, }) +--]] + +-- in this table, you put in cooking (???) +local cooking_table = { -- craft, desc, invimg + {'cooking', 'group:wood', 'random_cool_stuff:charcoal', 20}, + {'cooking', 'group:tree', 'random_cool_stuff:charcoal', 20}, + {'cooking', 'random_cool_stuff:raw_kebab', 'random_cool_stuff:cooked_kebab', 10}, +} --- make coal with tree stuffz +-- here we order the order of what we put where +for i in ipairs(cooking_table) do + local tp = cooking_table[i][1] + local recp = cooking_table[i][2] + local outpt = cooking_table[i][3] + local cktime = cooking_table[i][3] + +-- here we tell what does desc mean and what it does on use, and what does craft mean... minetest.register_craft({ - type = 'cooking', - recipe = 'group:tree', - output = 'random_cool_stuff:charcoal', - cooktime = 10, + type = tp, + recipe = recp, + output = outpt, + cooktime = cktime, }) - --- cook a kebab with a raw kebab --- cook time is seconds -minetest.register_craft({ - type = 'cooking', - recipe = 'random_cool_stuff:raw_kebab', - output = 'random_cool_stuff:cooked_kebab', - cooktime = 5, -}) \ No newline at end of file +end \ No newline at end of file diff --git a/craftitem.lua b/craftitem.lua index ed20990..b8743a5 100644 --- a/craftitem.lua +++ b/craftitem.lua @@ -1,25 +1,32 @@ -- crafitem crafts items, its basically a tool, but with no effects! +--[[ here is the original way to do it + -- here we are making a salt lump minetest.register_craftitem('random_cool_stuff:salt_lump', { description = 'a salt made of lumps', inventory_image = 'random_salt_lump.png', }) +--]] --- here we are making salt -minetest.register_craftitem('random_cool_stuff:salt', { - description = 'salt, what more can I say?', - inventory_image = 'random_salt.png', +-- in this table, you put in items XD +local craftitem_table = { -- craft, desc, invimg + {'charcoal', 'great fuel', 'random_charcoal.png'}, + {'poo_lump', 'for smearing on people', 'poo_lump.png'}, + {'salt', 'what more can i say?', 'random_salt.png'}, + {'salt_lump', 'a salt made of lumps', 'random_salt_lump.png'}, +} + + +-- here we order the order of what we put where +for i in ipairs(craftitem_table) do + local item = craftitem_table[i][1] + local desc = craftitem_table[i][2] + local invimg = craftitem_table[i][3] + +-- here we tell what does desc mean and what it does on use, and what does craft mean... +minetest.register_craftitem('random_cool_stuff:'..item, { + description = desc, + inventory_image = invimg, }) - --- here we make the cutting knife -minetest.register_craftitem('random_cool_stuff:poo_lump', { - description = 'for smearing on people', - inventory_image = 'poo_lump.png', -}) - --- here we are making the charcoal -minetest.register_craftitem('random_cool_stuff:charcoal', { - description = 'great fuel', - inventory_image = 'random_charcoal.png' -}) \ No newline at end of file +end \ No newline at end of file diff --git a/foods.lua b/foods.lua index 5fa96ff..5df4ecf 100644 --- a/foods.lua +++ b/foods.lua @@ -1,11 +1,5 @@ -- the comment below shows the original way to make food --[[ -minetest.register_craftitem('random_cool_stuff:raw_kebab', { - description = 'raw indonesion food', - inventory_image = 'random_raw_kebab.png', - on_use = minetest.item_eat(2) -}) - minetest.register_craftitem('random_cool_stuff:cooked_kebab', { description = 'still looks disgusting', inventory_image = 'random_cooked_kebab.png', @@ -16,13 +10,9 @@ minetest.register_craftitem('random_cool_stuff:cooked_kebab', { --[[ creates a table called food table -the first thing, as defined in for i in ipairs function is what we craft -the seconds thing is the description -the third thing is the inventory image, does not need .png but lets add it for clarification -if you want dont add an inventory image -the 4th thing is the amount of health you get after eating it -you can create tables like these for other things too... -like fuel recipes, cooking +local creates local variables to be used in that table +original functions such as 'description' will not work, you will have to rename them, such as to 'desc' +it needs to have the i in ipairs so it has the index of information, use this method because it is more efficent ]]-- diff --git a/fuels.lua b/fuels.lua index b028a4c..071d401 100644 --- a/fuels.lua +++ b/fuels.lua @@ -2,30 +2,35 @@ -- recipe is basically fuel -- burntime is seconds +--[[ here is the original way to do it + -- cook stuff with charcoal minetest.register_craft({ type = 'fuel', recipe = 'random_cool_stuff:charcoal', burntime = 22 }) +--]] --- cook stuff with sticks +-- in this table, you put in fuel XD +local fuel_table = { -- craft, desc, invimg + {'fuel', 'random_cool_stuff:charcoal', 22}, + {'fuel', 'default:stick', 5}, + {'fuel', 'farming:cotton', 7}, + {'fuel', 'group:wool', 10}, +} + + +-- here we order the order of what we put where +for i in ipairs(fuel_table) do + local tp = fuel_table[i][1] + local recp = fuel_table[i][2] + local brntime = fuel_table[i][3] + +-- here we tell what does desc mean and what it does on use, and what does craft mean... minetest.register_craft({ - type = 'fuel', - recipe = 'default:stick', - burntime = 4 + type = tp, + recipe = recp, + burntime = brntime, }) - --- cook stuff with cotton -minetest.register_craft({ - type = 'fuel', - recipe = 'farming:cotton', - burntime = 6 -}) - --- cook stuff with wool -minetest.register_craft({ - type = 'fuel', - recipe = 'group:wool', - burntime = 9 -}) \ No newline at end of file +end \ No newline at end of file diff --git a/readme.txt b/readme.txt index a71cf89..36ca7df 100644 --- a/readme.txt +++ b/readme.txt @@ -14,6 +14,7 @@ Tutorial within the code Config.txt to make code editable easily :) poo block and poo lump(wtf) salt stuffz +Optimization TODO: @@ -22,4 +23,3 @@ Add (if possible) maple tree Add maple Syrup which you can get by right clicking a tool knife on a tree When you break beds you get 2 sticks 2 wood and 2 wool Give use to salt -Optimization