old code added
|
@ -0,0 +1 @@
|
|||
Subproject commit 0f984e86f2b36d1af721a037537823ba952da53d
|
|
@ -0,0 +1,177 @@
|
|||
--[[
|
||||
entertaining alchemistry
|
||||
by Hackeridze
|
||||
hackeridze@gmail.com
|
||||
]]
|
||||
|
||||
math.randomseed(os.time())
|
||||
|
||||
local craftitem_drink = function(hp_change)
|
||||
return function(item, user, pointed_thing)
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
user:add_to_inventory_later('craft "alchemistry:bottle_empty" 1')
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local alchemistry_recipes = {}
|
||||
|
||||
local water_recipe = function(source)
|
||||
return {
|
||||
{source},
|
||||
{source},
|
||||
{'craft "alchemistry:bottle_water"'},
|
||||
}
|
||||
end
|
||||
|
||||
-- add_chim( "bottle_name", {bottle, recipe}, {"with_%some0%","with_%some1%"},
|
||||
-- {"comes_to_%some3","comes_to_%some4"}, on_drinc_function)
|
||||
local add_chim = function(name, brecipe, withSHORT, getSHORT, on_drink)
|
||||
local bname = "alchemistry:bottle_" .. name
|
||||
local with = "alchemistry:bottle_" .. withSHORT
|
||||
local get = "alchemistry:bottle_" .. getSHORT
|
||||
|
||||
|
||||
alchemistry_recipes[get] = {with, bname} -- adding recipe to recipes table
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft ' .. bname .. '',
|
||||
recipe = brecipe,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("alchemistry:bottle_water", {
|
||||
image = "alchemistry_bottle_water.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = on_drink,
|
||||
})
|
||||
end
|
||||
|
||||
local get_result = function(ing1,ing2)
|
||||
for result,ingredients in pairs(alchemistry_recipes) do
|
||||
if (ingredients[1] == ing1) and (ingredients[2] == ing[2]) or
|
||||
(ingredients[1] == ing2) and (ingredients[2] == ing[1]) then
|
||||
return result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------ Bottles ------------------------------
|
||||
minetest.register_craft({
|
||||
output = 'craft "alchemistry:bottle_empty" 3',
|
||||
recipe = {
|
||||
{'node "default:glass"', '', 'node "default:glass"'},
|
||||
{'', 'node "default:glass"', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("alchemistry:bottle_empty", {
|
||||
image = "alchemistry_bottle_empty.png",
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "default:water_source" or n.name == "default:water_flowing" then
|
||||
player:add_to_inventory_later('craft "alchemistry:bottle_water" 1')
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("alchemistry:bottle_water", {
|
||||
image = "alchemistry_bottle_water.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(0),
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
if newnode.name == "alchemistry:alchemistry_table" then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:inventory_set_list("ing", {"", ""})
|
||||
meta:inventory_set_list("pot", {"", ""})
|
||||
meta:set_inventory_draw_spec(
|
||||
"invsize[8,9;]"
|
||||
.."list[current_name;pot;3,2;2,1;]"
|
||||
.."list[current_name;ing;3,0;2,1;]"
|
||||
.."list[current_player;main;0,4;8,4;]"
|
||||
)
|
||||
|
||||
meta:set_infotext("Alchemistry table")
|
||||
meta:set_string("timer", "-999")
|
||||
meta:set_string("ings", "")
|
||||
meta:set_string("pots", "")
|
||||
end
|
||||
end)
|
||||
------------------------------ Bottles end ------------------------------
|
||||
|
||||
|
||||
------------------------------ Alch table ------------------------------
|
||||
minetest.register_node("alchemistry:alchemistry_table", {
|
||||
tile_images = {"default_stone.png^alchemistry_alchemistry_table.png", "default_stone.png",
|
||||
"default_stone.png", "default_stone.png",
|
||||
"default_stone.png", "default_stone.png"},
|
||||
inventory_image = "default_stone.png^alchemistry_alchemistry_table.png",
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
material = minetest.digprop_stonelike(3.0),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"alchemistry:alchemistry_table"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local potlist = meta:inventory_get_list("pot")
|
||||
local inglist = meta:inventory_get_list("ing")
|
||||
local timer = tonumber(meta:get_string("timer"))
|
||||
if potlist == nil or inglist == nil then
|
||||
meta:set_string("timer", "-999")
|
||||
return
|
||||
end
|
||||
_, ing1 = stackstring_take_item(inglist[1])
|
||||
_, ing2 = stackstring_take_item(inglist[2])
|
||||
_, pot1 = stackstring_take_item(potlist[1])
|
||||
_, pot2 = stackstring_take_item(potlist[2])
|
||||
|
||||
if pot1 == nil and pot2 == nil then meta:set_string("timer", -999) meta:set_infotext("Alchemistry table") return end
|
||||
if ing1 == nil and ing2 == nil then meta:set_string("timer", -999) meta:set_infotext("Alchemistry table") return end
|
||||
|
||||
if timer > 0 then
|
||||
meta:set_string("timer", timer-1)
|
||||
meta:set_infotext("Alchemistry table, working, "..100-(2*timer).."%")
|
||||
else
|
||||
if timer == 0 then
|
||||
local changed = false
|
||||
if pot1.name ~= nil and pot2.name ~= nil then
|
||||
res = get_result(ing1.name, ing2.name)
|
||||
if res ~= nil then
|
||||
potlist[1] = ""
|
||||
potlist[1], success = stackstring_put_stackstring(potlist[1], res[1])
|
||||
potlist[2] = ""
|
||||
potlist[2], success = stackstring_put_stackstring(potlist[2], res[2])
|
||||
changed = true
|
||||
end
|
||||
end
|
||||
|
||||
if changed == true then
|
||||
if ing1.name ~= nil then inglist[1], _ = stackstring_take_item(inglist[1]) end
|
||||
if ing2.name ~= nil then inglist[2], _ = stackstring_take_item(inglist[2]) end
|
||||
end
|
||||
meta:set_string("timer", -999)
|
||||
meta:set_infotext("Alchemistry table")
|
||||
else if timer < 0 then
|
||||
meta:set_string("timer", 50)
|
||||
meta:set_infotext("Alchemistry table, working, "..100-(2*timer).."%")
|
||||
end
|
||||
end
|
||||
end
|
||||
meta:inventory_set_list("pot", potlist)
|
||||
meta:inventory_set_list("ing", inglist)
|
||||
end
|
||||
})
|
||||
------------------------------ Alch table end ------------------------------
|
||||
|
||||
print("[alchemistry] Loaded!")
|
After Width: | Height: | Size: 338 B |
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 396 B |
|
@ -0,0 +1,4 @@
|
|||
default
|
||||
growing
|
||||
bucket
|
||||
wheat
|
|
@ -0,0 +1,292 @@
|
|||
|
||||
minetest.register_craftitem("baking:flour", {
|
||||
image = "baking_flour.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item
|
||||
})
|
||||
|
||||
minetest.register_craftitem("baking:bread", {
|
||||
image = "baking_bread.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = minetest.craftitem_eat(6)
|
||||
})
|
||||
|
||||
minetest.register_craftitem("baking:ratburger", {
|
||||
image = "baking_ratburger.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = minetest.craftitem_eat(11)
|
||||
})
|
||||
|
||||
minetest.register_craftitem("baking:bread_dough", {
|
||||
image = "baking_bread_dough.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
cookresult_itemstring = 'craft "baking:bread" 1',
|
||||
furnace_cooktime = 10.0
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "baking:flour" 1',
|
||||
recipe = {
|
||||
{'craft "wheat:wheat_seeds"', 'craft "wheat:wheat_seeds"'},
|
||||
{'craft "wheat:wheat_seeds"', 'craft "wheat:wheat_seeds"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "baking:ratburger" 1',
|
||||
recipe = {
|
||||
{'craft "baking:bread"'},
|
||||
{'craft "cooked_rat"'},
|
||||
{'craft "baking:bread"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "baking:bread_dough" 1',
|
||||
recipe = {
|
||||
{'craft "baking:flour"', 'craft "baking:flour"', 'craft "baking:flour"'},
|
||||
{'craft "baking:flour"', 'craft "baking:baking_form_water"', 'craft "baking:flour"'},
|
||||
{'craft "baking:flour"', 'craft "baking:flour"', 'craft "baking:flour"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "baking:baking_form_empty" 1',
|
||||
recipe = {
|
||||
{'node "default:wood"', '', 'node "default:wood"'},
|
||||
{'', 'node "default:wood"', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("baking:baking_form_empty", {
|
||||
image = "baking_baking_form.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "default:water_source" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
player:add_to_inventory_later('craft "baking:baking_form_water" 1')
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("baking:baking_form_water", {
|
||||
image = "baking_baking_form_water.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "default:water_source" then
|
||||
-- unchanged
|
||||
elseif n.name == "default:lava_source" or n.name == "default:lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="default:cobble"})
|
||||
else
|
||||
minetest.env:add_node(pointed_thing.above, {name="default:water_flowing"})
|
||||
end
|
||||
player:add_to_inventory_later('craft "baking:baking_form_empty" 1')
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
|
||||
--[[
|
||||
add_grow_type("baking:wheat", {
|
||||
{name = "default:dirt", odds = 50, max_height = 3},
|
||||
{name = "default:dirt_with_grass", odds = 50, max_height = 3}, <<<--- NOT NEDED
|
||||
{name = "default:dirt_with_grass_footsteps", odds = 50, max_height = 3}
|
||||
})]]
|
||||
|
||||
|
||||
-- brick_oven
|
||||
|
||||
minetest.register_node("baking:brick_oven", {
|
||||
tile_images = {"default_brick.png", "default_brick.png",
|
||||
"default_brick.png", "default_brick.png",
|
||||
"default_brick.png", "default_furnace_front.png"},
|
||||
--inventory_image = "furnace_front.png",
|
||||
inventory_image = minetest.inventorycube("default_brick.png", "default_furnace_front.png"),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
material = minetest.digprop_stonelike(3.0),
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
if newnode.name == "baking:brick_oven" then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:inventory_set_list("fuel", {""})
|
||||
meta:inventory_set_list("src", {""})
|
||||
meta:inventory_set_list("dst", {"","","",""})
|
||||
meta:set_inventory_draw_spec(
|
||||
"invsize[8,9;]"
|
||||
.."list[current_name;fuel;2,3;1,1;]"
|
||||
.."list[current_name;src;2,1;1,1;]"
|
||||
.."list[current_name;dst;5,1;2,2;]"
|
||||
.."list[current_player;main;0,5;8,4;]"
|
||||
)
|
||||
|
||||
meta:set_infotext("Oven: inactive")
|
||||
meta:set_string("cur_fuel", "")
|
||||
meta:set_string("cur_src", "")
|
||||
meta:set_string("cook_timer", "0")
|
||||
meta:set_string("fuel_timer", "0")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
baking_food_items = {"baking:bread_dough", "rat", ":rat"} --,"corn:corn_seeds","corn:corn_bowl"}
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"baking:brick_oven"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local fuellist = meta:inventory_get_list("fuel")
|
||||
local srclist = meta:inventory_get_list("src")
|
||||
local dstlist = meta:inventory_get_list("dst")
|
||||
local cook_timer = tonumber(meta:get_string("cook_timer"))
|
||||
|
||||
if fuellist == nil or srclist == nil or dstlist == nil then
|
||||
if cook_timer ~= -1 then
|
||||
meta:set_infotext("Oven: inactive")
|
||||
meta:set_string("cook_timer", "-1")
|
||||
end
|
||||
return
|
||||
end
|
||||
_, srcitem = stackstring_take_item(srclist[1])
|
||||
_, fuelitem = stackstring_take_item(fuellist[1])
|
||||
|
||||
if not srcitem or not fuelitem then
|
||||
if cook_timer ~= -1 then
|
||||
meta:set_infotext("Oven: inactive")
|
||||
meta:set_string("cook_timer", "-1")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local fuel_burntime = 0
|
||||
|
||||
if fuelitem.type == "node" then
|
||||
local prop = minetest.registered_nodes[fuelitem.name]
|
||||
if prop == nil then
|
||||
if cook_timer ~= -1 then
|
||||
meta:set_infotext("Oven: inactive")
|
||||
meta:set_string("cook_timer", "-1")
|
||||
end
|
||||
return
|
||||
end
|
||||
if prop.furnace_burntime < 0 then return end
|
||||
fuel_burntime = prop.furnace_burntime
|
||||
elseif fuelitem.type == "craft" then
|
||||
local prop = minetest.registered_craftitems[fuelitem.name]
|
||||
if prop == nil then
|
||||
if cook_timer ~= -1 then
|
||||
meta:set_infotext("Oven: inactive")
|
||||
meta:set_string("cook_timer", "-1")
|
||||
end
|
||||
return
|
||||
end
|
||||
if prop.furnace_burntime < 0 then return end
|
||||
fuel_burntime = prop.furnace_burntime
|
||||
else
|
||||
if cook_timer ~= -1 then
|
||||
meta:set_infotext("Oven: inactive")
|
||||
meta:set_string("cook_timer", "-1")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local cur_fuel = meta:get_string("cur_fuel")
|
||||
local cur_src = meta:get_string("cur_src")
|
||||
|
||||
if cur_fuel ~= fuelitem.name or cur_src ~= srcitem.name then
|
||||
if cur_fuel ~= fuelitem.name then
|
||||
meta:set_string("fuel_timer", "0")
|
||||
end
|
||||
meta:set_string("cur_fuel", fuelitem.name)
|
||||
meta:set_string("cur_src", srcitem.name)
|
||||
meta:set_string("cook_timer", "0")
|
||||
meta:set_infotext("Oven: inactive")
|
||||
return
|
||||
end
|
||||
|
||||
local resultstack = nil
|
||||
if srcitem.type == "craft" then
|
||||
local prop = minetest.registered_craftitems[srcitem.name]
|
||||
if prop == nil then
|
||||
if cook_timer ~= -1 then
|
||||
meta:set_infotext("Oven: inactive")
|
||||
meta:set_string("cook_timer", "-1")
|
||||
end
|
||||
return
|
||||
end
|
||||
if prop.cookresult_itemstring == "" then return end
|
||||
if prop.furnace_cooktime == nil then prop.furnace_cooktime = 1.0 end
|
||||
|
||||
-- check if food type
|
||||
for _, n in pairs(baking_food_items) do
|
||||
if srcitem.name == n then
|
||||
local fuel_timer = tonumber(meta:get_string("fuel_timer"))
|
||||
fuel_timer = fuel_timer + 1
|
||||
meta:set_string("fuel_timer", fuel_timer)
|
||||
|
||||
-- here is why you would use the oven instead of the normal furnace
|
||||
-- cooktime is cut in half, but it only works for items listed in baking_food_items
|
||||
if cook_timer >= math.ceil(prop.furnace_cooktime/2) then
|
||||
resultstack = prop.cookresult_itemstring
|
||||
else
|
||||
meta:set_infotext("Oven: cooking "..math.abs(100*(cook_timer/math.ceil(prop.furnace_cooktime/2))).."%")
|
||||
cook_timer = cook_timer + 1
|
||||
meta:set_string("cook_timer", cook_timer)
|
||||
return
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
if resultstack == nil then
|
||||
return
|
||||
end
|
||||
|
||||
dstlist[1], success = stackstring_put_stackstring(dstlist[1], resultstack)
|
||||
if not success then
|
||||
return
|
||||
end
|
||||
|
||||
local fuel_timer = tonumber(meta:get_string("fuel_timer"))
|
||||
if fuel_timer > fuel_burntime then
|
||||
fuellist[1], _ = stackstring_take_item(fuellist[1])
|
||||
meta:set_string("fuel_timer", "0")
|
||||
end
|
||||
srclist[1], _ = stackstring_take_item(srclist[1])
|
||||
|
||||
meta:inventory_set_list("fuel", fuellist)
|
||||
meta:inventory_set_list("src", srclist)
|
||||
meta:inventory_set_list("dst", dstlist)
|
||||
|
||||
meta:set_string("cook_timer", "0")
|
||||
meta:set_infotext("Oven: cooking ")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'node "baking:brick_oven" 1',
|
||||
recipe = {
|
||||
{'node "default:brick"', 'node "default:brick"', 'node "default:brick"'},
|
||||
{'node "default:brick"', '', 'node "default:brick"'},
|
||||
{'node "default:brick"', 'node "default:brick"', 'node "default:brick"'},
|
||||
}
|
||||
})
|
||||
|
||||
print("[Baking] Loaded!")
|
After Width: | Height: | Size: 329 B |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 415 B |
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 267 B |
After Width: | Height: | Size: 485 B |
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
local craftitem_place_item = function(item, player, pos)
|
||||
minetest.env:add_item(pos, 'CraftItem "' .. item .. '" 1')
|
||||
return true
|
||||
end
|
||||
|
||||
local craftitem_drink = function(hp_change)
|
||||
return function(item, user, pointed_thing)
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
user:add_to_inventory_later('CraftItem "bottle:bottle_empty" 1')
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_empty" 3',
|
||||
recipe = {
|
||||
{'NodeItem "default:glass"', '', 'NodeItem "default:glass"'},
|
||||
{'', 'NodeItem "default:glass"', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_empty", {
|
||||
image = "bottle_empty.png",
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "default:water_source" or n.name == "default:water_flowing" then
|
||||
player:add_to_inventory_later('CraftItem "bottle:bottle_water" 1')
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_water", {
|
||||
image = "bottle_water.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(0),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_applejuice" 1',
|
||||
recipe = {
|
||||
{'CraftItem "default:apple"'},
|
||||
{'CraftItem "default:apple"'},
|
||||
{'CraftItem "bottle:bottle_water"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_caoh2", {
|
||||
image = "bottle_CaOH2.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(-2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_caoh2" 1',
|
||||
recipe = {
|
||||
{'CraftItem "moreores:calcium_oxide"'},
|
||||
{'CraftItem "moreores:calcium_oxide"'},
|
||||
{'CraftItem "bottle:bottle_water"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_hcn", {
|
||||
image = "bottle_HCN.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(-3),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_hcn" 1',
|
||||
recipe = {
|
||||
{'node "default:junglegrass"'},
|
||||
{'node "default:junglegrass"'},
|
||||
{'CraftItem "bottle:bottle_water"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_cacn2", {
|
||||
image = "bottle_CaCN2.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(-999),
|
||||
})
|
||||
--===
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_cacn2" 2',
|
||||
recipe = {
|
||||
{'craft "bottle:bottle_caoh2" 1'},
|
||||
{'craft "bottle:bottle_hcn" 1'},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_cacn2" 2',
|
||||
recipe = {
|
||||
{'craft "bottle:bottle_hcn" 1'},
|
||||
{'craft "bottle:bottle_caoh2" 1'},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_cacn2" 2',
|
||||
recipe = {
|
||||
{'craft "bottle:bottle_hcn" 1','craft "bottle:bottle_caoh2" 1'},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_cacn2" 2',
|
||||
recipe = {
|
||||
{'craft "bottle:bottle_caoh2" 1','craft "bottle:bottle_hcn" 1'},
|
||||
}
|
||||
})
|
||||
--===
|
||||
minetest.register_craftitem("bottle:bottle_applejuice", {
|
||||
image = "bottle_applejuice.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(4),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_watermelonjuice" 1',
|
||||
recipe = {
|
||||
{'CraftItem "watermelon:watermelon_slice"'},
|
||||
{'CraftItem "watermelon:watermelon_slice"'},
|
||||
{'CraftItem "bottle:bottle_water"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_watermelonjuice", {
|
||||
image = "bottle_watermelonjuice.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(5),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_cactusjuice" 1',
|
||||
recipe = {
|
||||
{'NodeItem "default:cactus"'},
|
||||
{'NodeItem "default:cactus"'},
|
||||
{'CraftItem "bottle:bottle_water"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_cactusjuice", {
|
||||
image = "bottle_cactusjuice.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(3),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bottle:bottle_dirtywater" 1',
|
||||
recipe = {
|
||||
{'NodeItem "default:dirt"'},
|
||||
{'NodeItem "default:dirt"'},
|
||||
{'CraftItem "bottle:bottle_water"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bottle:bottle_dirtywater", {
|
||||
image = "bottle_dirtywater.png",
|
||||
on_place_on_ground = craftitem_place_item,
|
||||
on_use = craftitem_drink(-1),
|
||||
})
|
||||
|
||||
print("[Bottle] Loaded!")
|
After Width: | Height: | Size: 668 B |
After Width: | Height: | Size: 639 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 443 B |
After Width: | Height: | Size: 497 B |
After Width: | Height: | Size: 362 B |
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 396 B |
After Width: | Height: | Size: 417 B |
After Width: | Height: | Size: 860 KiB |
|
@ -0,0 +1,4 @@
|
|||
bucket
|
||||
default
|
||||
flowers
|
||||
home_mod
|
|
@ -0,0 +1,199 @@
|
|||
local CEMENT = {
|
||||
"normal",
|
||||
"rose",
|
||||
"dandelion_yellow",
|
||||
"dandelion_white",
|
||||
"tulip",
|
||||
"viola",
|
||||
}
|
||||
|
||||
minetest.alias_node("home_mod:normal_stone", "default:stone")
|
||||
minetest.alias_node("home_mod:rose_stone", "home_mod:red_stone")
|
||||
minetest.alias_node("home_mod:dandelion_yellow_stone", "home_mod:yellow_stone")
|
||||
minetest.alias_node("home_mod:dandelion_white_stone", "home_mod:white_stone")
|
||||
minetest.alias_node("home_mod:tulip_stone", "home_mod:orange_stone")
|
||||
minetest.alias_node("home_mod:viola_stone", "home_mod:violet_stone")
|
||||
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'node "cement:aggregate_cement_normal" 1',
|
||||
recipe = {
|
||||
{'craft "moreores:calcium_oxide"', 'craft "moreores:calcium_oxide"', 'craft "moreores:calcium_oxide"'},
|
||||
{'craft "moarcraft:ash"', 'craft "moarcraft:ash"', 'craft "moarcraft:ash"'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'node "cement:aggregate_cement_normal" 1',
|
||||
recipe = {
|
||||
{'craft "moarcraft:ash"', 'craft "moarcraft:ash"', 'craft "moarcraft:ash"'},
|
||||
{'craft "moreores:calcium_oxide"', 'craft "moreores:calcium_oxide"', 'craft "moreores:calcium_oxide"'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node('cement:aggregate_cement_normal', {
|
||||
tile_images = { 'cement_normal_aggregate.png'},
|
||||
inventory_image = minetest.inventorycube( 'cement_normal_aggregate.png'),
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_gravellike(1.5),
|
||||
})
|
||||
|
||||
-- registering falling nodes
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
default.register_falling_node("cement:aggregate_" .. cname, "cement_" .. cname .. "aggregate.png")
|
||||
end -- registering falling nodes end
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "cement:bucket_cement_normal" 1',
|
||||
recipe = {
|
||||
{'node "default:gravel" 1','node "cement:aggregate_cement_normal" 1','node "default:sand" 1'},
|
||||
{'node "default:gravel" 1','node "cement:aggregate_cement_normal"','node "default:sand" 1'},
|
||||
{'','craft "bucket:bucket_water" 1',''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "cement:bucket_cement_normal" 1',
|
||||
recipe = {
|
||||
{'node "default:sand" 1','node "cement:aggregate_cement_normal" 1','node "default:gravel" 1'},
|
||||
{'node "default:sand" 1','node "cement:aggregate_cement_normal"','node "default:gravel" 1'},
|
||||
{'','craft "bucket:bucket_water" 1',''},
|
||||
}
|
||||
})
|
||||
|
||||
-- registering cement buckets crafts nodes
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "cement:bucket_' .. cname .. '" 1',
|
||||
recipe = {
|
||||
{'craft "home_mod:' .. color .. '_petal"'},
|
||||
{'craft "cement:bucket_cement_normal"'},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'craft "cement:bucket_' .. cname .. '" 1',
|
||||
recipe = {
|
||||
{'craft "cement:bucket_cement_normal"'},
|
||||
{'craft "home_mod:' .. color .. '_petal"'},
|
||||
}
|
||||
})
|
||||
end -- registering cement buckets crafts end
|
||||
|
||||
-- registering cement buckets
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
|
||||
minetest.register_craftitem("cement:bucket_".. cname, {
|
||||
image = cname .. "_bucket.png",
|
||||
stack_max = 1,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
minetest.env:add_node(pointed_thing.above, {name="cement:" .. cname .. "source"})
|
||||
player:add_to_inventory_later('craft "bucket:bucket_empty" 1')
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
end -- registering cement buckets end
|
||||
|
||||
|
||||
CEMENT_VISC = 20
|
||||
|
||||
-- registering cement sources
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
minetest.register_node("cement:" .. cname .. "source", {
|
||||
drawtype = "liquid",
|
||||
tile_images = {"cement_" .. color .. "_block.png"},
|
||||
inventory_image = minetest.inventorycube("cement_" .. color .. "_block.png"),
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "cement:" .. cname .. "flowing",
|
||||
liquid_alternative_source = "cement:" .. cname .. "source",
|
||||
liquid_viscosity = CEMENT_VISC,
|
||||
special_materials = {
|
||||
-- New-style cement source material (WTF does this even mean?)
|
||||
{image= cname .. "_block.png", backface_culling=false},
|
||||
},
|
||||
})
|
||||
end -- registering cement sources end
|
||||
|
||||
-- registering cement flowing
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
minetest.register_node("cement:" .. cname .. "flowing", {
|
||||
drawtype = "flowingliquid",
|
||||
tile_images = {"cement_" .. color .. "_block.png"},
|
||||
inventory_image = minetest.inventorycube("cement_" .. color .. "_block.png"),
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "cement:".. cname .. "flowing",
|
||||
liquid_alternative_source = "cement:" .. cname .. "source",
|
||||
liquid_viscosity = CEMENT_VISC,
|
||||
damage_per_second = CEMENT_DAMAGE,
|
||||
special_materials = {
|
||||
-- I do not understand this and I won't even try.
|
||||
{image= cname .. "_block.png", backface_culling=false},
|
||||
{image= cname .. "_block.png", backface_culling=true},
|
||||
},
|
||||
})
|
||||
end -- registering cement flowing end
|
||||
|
||||
-- registering cement abms flowing
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"cement:" .. cname .. "flowing"},
|
||||
interval = 15.0, -- fast-setting cement should hinder griefing
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if (node.param2 > 1) then
|
||||
minetest.env:add_node(pos, {name="home_mod:" .. color .. "_stone"})
|
||||
end
|
||||
end
|
||||
})
|
||||
end -- registering cement abms flowing end
|
||||
|
||||
-- registering cement abms source
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"cement:" .. cname .."source"},
|
||||
interval = 15,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node(pos, {name="home_mod:" .. color .. "_stone"})
|
||||
end
|
||||
})
|
||||
end -- registering cement abms flowing end
|
||||
--[[
|
||||
-- registering cement concrete
|
||||
for _, color in ipairs(CEMENT) do
|
||||
local cname = 'cement_' .. color
|
||||
|
||||
minetest.register_node("cement:concrete_" .. color .."_block", {
|
||||
tile_images = { cname .. "_concrete.png"},
|
||||
inventory_image = minetest.inventorycube( cname .. "_concrete.png"),
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_stonelike(3.0),
|
||||
dug_item = 'node "cobble" 2',
|
||||
})
|
||||
end -- registering cement concrete end ]]
|
||||
print("[Cement] Loaded!")
|
After Width: | Height: | Size: 476 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 490 B |
After Width: | Height: | Size: 445 B |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 453 B |
After Width: | Height: | Size: 824 B |
After Width: | Height: | Size: 426 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 506 B |
After Width: | Height: | Size: 342 B |
After Width: | Height: | Size: 328 B |
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 314 B |
After Width: | Height: | Size: 453 B |
After Width: | Height: | Size: 438 B |
After Width: | Height: | Size: 316 B |
After Width: | Height: | Size: 443 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 292 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 449 B |
After Width: | Height: | Size: 319 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 646 B |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 650 B |
After Width: | Height: | Size: 584 B |
After Width: | Height: | Size: 613 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 210 B |
After Width: | Height: | Size: 118 B |
After Width: | Height: | Size: 240 B |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 498 B |
After Width: | Height: | Size: 300 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 452 B |
After Width: | Height: | Size: 560 B |
After Width: | Height: | Size: 342 B |
After Width: | Height: | Size: 789 B |
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 672 B |
After Width: | Height: | Size: 628 B |
After Width: | Height: | Size: 664 B |
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 730 B |
After Width: | Height: | Size: 937 B |
After Width: | Height: | Size: 652 B |
After Width: | Height: | Size: 853 B |
After Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 410 B |
After Width: | Height: | Size: 203 B |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 366 B |
After Width: | Height: | Size: 507 B |
After Width: | Height: | Size: 555 B |
After Width: | Height: | Size: 545 B |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 682 B |
After Width: | Height: | Size: 735 B |
After Width: | Height: | Size: 683 B |
After Width: | Height: | Size: 233 B |
After Width: | Height: | Size: 508 B |