Such Optimization Much Wow
This commit is contained in:
parent
3e051535e5
commit
a8e9699334
37
cooking.lua
37
cooking.lua
@ -1,6 +1,8 @@
|
|||||||
-- makes a cooking recipe
|
-- makes a cooking recipe
|
||||||
-- pretty self explainable
|
-- pretty self explainable
|
||||||
|
|
||||||
|
--[[ here is the original way to do it
|
||||||
|
|
||||||
-- make coal with wood stuffz
|
-- make coal with wood stuffz
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = 'cooking',
|
type = 'cooking',
|
||||||
@ -8,21 +10,28 @@ minetest.register_craft({
|
|||||||
output = 'random_cool_stuff:charcoal',
|
output = 'random_cool_stuff:charcoal',
|
||||||
cooktime = 12,
|
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({
|
minetest.register_craft({
|
||||||
type = 'cooking',
|
type = tp,
|
||||||
recipe = 'group:tree',
|
recipe = recp,
|
||||||
output = 'random_cool_stuff:charcoal',
|
output = outpt,
|
||||||
cooktime = 10,
|
cooktime = cktime,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
-- 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,
|
|
||||||
})
|
|
@ -1,25 +1,32 @@
|
|||||||
-- crafitem crafts items, its basically a tool, but with no effects!
|
-- 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
|
-- here we are making a salt lump
|
||||||
minetest.register_craftitem('random_cool_stuff:salt_lump', {
|
minetest.register_craftitem('random_cool_stuff:salt_lump', {
|
||||||
description = 'a salt made of lumps',
|
description = 'a salt made of lumps',
|
||||||
inventory_image = 'random_salt_lump.png',
|
inventory_image = 'random_salt_lump.png',
|
||||||
})
|
})
|
||||||
|
--]]
|
||||||
|
|
||||||
-- here we are making salt
|
-- in this table, you put in items XD
|
||||||
minetest.register_craftitem('random_cool_stuff:salt', {
|
local craftitem_table = { -- craft, desc, invimg
|
||||||
description = 'salt, what more can I say?',
|
{'charcoal', 'great fuel', 'random_charcoal.png'},
|
||||||
inventory_image = 'random_salt.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,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
-- 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'
|
|
||||||
})
|
|
16
foods.lua
16
foods.lua
@ -1,11 +1,5 @@
|
|||||||
-- the comment below shows the original way to make food
|
-- 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', {
|
minetest.register_craftitem('random_cool_stuff:cooked_kebab', {
|
||||||
description = 'still looks disgusting',
|
description = 'still looks disgusting',
|
||||||
inventory_image = 'random_cooked_kebab.png',
|
inventory_image = 'random_cooked_kebab.png',
|
||||||
@ -16,13 +10,9 @@ minetest.register_craftitem('random_cool_stuff:cooked_kebab', {
|
|||||||
|
|
||||||
--[[
|
--[[
|
||||||
creates a table called food table
|
creates a table called food table
|
||||||
the first thing, as defined in for i in ipairs function is what we craft
|
local creates local variables to be used in that table
|
||||||
the seconds thing is the description
|
original functions such as 'description' will not work, you will have to rename them, such as to 'desc'
|
||||||
the third thing is the inventory image, does not need .png but lets add it for clarification
|
it needs to have the i in ipairs so it has the index of information,
|
||||||
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
|
|
||||||
use this method because it is more efficent
|
use this method because it is more efficent
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
41
fuels.lua
41
fuels.lua
@ -2,30 +2,35 @@
|
|||||||
-- recipe is basically fuel
|
-- recipe is basically fuel
|
||||||
-- burntime is seconds
|
-- burntime is seconds
|
||||||
|
|
||||||
|
--[[ here is the original way to do it
|
||||||
|
|
||||||
-- cook stuff with charcoal
|
-- cook stuff with charcoal
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = 'fuel',
|
type = 'fuel',
|
||||||
recipe = 'random_cool_stuff:charcoal',
|
recipe = 'random_cool_stuff:charcoal',
|
||||||
burntime = 22
|
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({
|
minetest.register_craft({
|
||||||
type = 'fuel',
|
type = tp,
|
||||||
recipe = 'default:stick',
|
recipe = recp,
|
||||||
burntime = 4
|
burntime = brntime,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
-- 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
|
|
||||||
})
|
|
@ -14,6 +14,7 @@ Tutorial within the code
|
|||||||
Config.txt to make code editable easily :)
|
Config.txt to make code editable easily :)
|
||||||
poo block and poo lump(wtf)
|
poo block and poo lump(wtf)
|
||||||
salt stuffz
|
salt stuffz
|
||||||
|
Optimization
|
||||||
|
|
||||||
TODO:
|
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
|
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
|
When you break beds you get 2 sticks 2 wood and 2 wool
|
||||||
Give use to salt
|
Give use to salt
|
||||||
Optimization
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user