Initial commit to correct branch...

This commit is contained in:
bzoss 2020-06-08 17:47:53 -04:00
parent 02540a5193
commit a5dc19cd7c
44 changed files with 1487 additions and 299 deletions

View file

@ -1,4 +1,4 @@
Waterlib
Flowlib
================
Simple flow functions for use in Minetest mods by Qwertymine3

View file

@ -36,9 +36,10 @@ local N_EXPOSURE_RAYS = 16
minetest.register_on_mods_loaded(function()
-- Store blast resistance values by content ids to improve performance.
for name, def in pairs(minetest.registered_nodes) do
node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0
node_on_blast[minetest.get_content_id(name)] = def.on_blast
node_walkable[minetest.get_content_id(name)] = def.walkable
local id = minetest.get_content_id(name)
node_blastres[id] = def._mcl_blast_resistance or 0
node_on_blast[id] = def.on_blast
node_walkable[id] = def.walkable
end
end)
@ -183,9 +184,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire,
local cid = data[idx]
local br = node_blastres[cid]
local hash = (npos_z + 32768) * 65536 * 65536 +
(npos_y + 32768) * 65536 +
npos_x + 32768
local hash = minetest.hash_node_position({x=npos_x, y=npos_y, z=npos_z})
rpos_x = rpos_x + STEP_LENGTH * rdir_x
rpos_y = rpos_y + STEP_LENGTH * rdir_y
@ -305,6 +304,8 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire,
end
end
local airs, fires = {}, {}
-- Remove destroyed blocks and drop items
for hash, idx in pairs(destroy) do
local do_drop = not creative_mode and math.random() <= drop_chance
@ -314,7 +315,8 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire,
if do_drop or on_blast ~= nil then
local npos = minetest.get_position_from_hash(hash)
if on_blast ~= nil then
remove = on_blast(npos, 1.0)
on_blast(npos, 1.0)
remove = false
else
local name = minetest.get_name_from_content_id(data[idx])
local drop = minetest.get_node_drops(name, "")
@ -329,21 +331,34 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire,
end
if remove then
if mod_fire and fire and math.random(1, 3) == 1 then
data[idx] = CONTENT_FIRE
table.insert(fires, minetest.get_position_from_hash(hash))
else
data[idx] = minetest.CONTENT_AIR
table.insert(airs, minetest.get_position_from_hash(hash))
end
end
end
-- We use bulk_set_node instead of LVM because we want to have on_destruct and
-- on_construct being called
if #airs > 0 then
minetest.bulk_set_node(airs, {name="air"})
end
if #fires > 0 then
minetest.bulk_set_node(fires, {name="mcl_core:fire"})
end
-- Update falling nodes
for a=1, #airs do
local p = airs[a]
minetest.check_for_falling({x=p.x, y=p.y+1, z=p.z})
end
for f=1, #fires do
local p = fires[f]
minetest.check_for_falling({x=p.x, y=p.y+1, z=p.z})
end
-- Log explosion
minetest.log('action', 'Explosion at ' .. minetest.pos_to_string(pos) ..
' with strength ' .. strength .. ' and radius ' .. radius)
-- Update environment
vm:set_data(data)
vm:write_to_map(data)
vm:update_liquids()
end
-- Create an explosion with strength at pos.

View file

@ -1,3 +1,5 @@
local mods_loaded = false
mcl_weather.skycolor = {
-- Should be activated before do any effect.
active = true,
@ -169,7 +171,11 @@ mcl_weather.skycolor = {
-- Simply getter. Ether returns user given players list or get all connected players if none provided
get_players = function(players)
if players == nil or #players == 0 then
if mods_loaded then
players = minetest.get_connected_players()
elseif players == nil then
players = {}
end
end
return players
end,
@ -222,3 +228,7 @@ minetest.register_on_respawnplayer(initsky)
mcl_worlds.register_on_dimension_change(function(player)
mcl_weather.skycolor.update_sky_color({player})
end)
minetest.register_on_mods_loaded(function()
mods_loaded = true
end)

View file

@ -1088,7 +1088,9 @@ if progressive_mode then
M.after(POLL_FREQ, poll_new_items)
end
poll_new_items()
M.register_on_mods_loaded(function()
M.after(1, poll_new_items)
end)
mcl_craftguide.add_recipe_filter("Default progressive filter", progressive_filter)

View file

@ -236,6 +236,7 @@ mesecon.register_node("mcl_observers:observer_up",
-- Regularily check the observer nodes.
-- TODO: This is rather slow and clunky. Find a more efficient way to do this.
minetest.register_abm({
label = "Observer node check",
nodenames = {"mcl_observers:observer_off", "mcl_observers:observer_down_off", "mcl_observers:observer_up_off"},
interval = 1,
chance = 1,

View file

@ -0,0 +1,7 @@
mcl_init
mcl_formspec
mcl_sounds
mcl_potions
mcl_mobitems
mcl_core?
screwdriver?

838
mods/ITEMS/mcl_brewing/init.lua Normal file → Executable file
View file

@ -1,9 +1,10 @@
local S = minetest.get_translator("mcl_brewing_stand")
local function active_brewing_formspec(fuel_percent, item_percent)
local function active_brewing_formspec(fuel_percent, brew_percent)
return "size[9,8.75]"..
"background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]"..
-- "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory_active.png]"..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
@ -24,7 +25,7 @@ local function active_brewing_formspec(fuel_percent, item_percent)
(100-fuel_percent)..":mcl_brewing_burner_active.png^[transformR270]"..
"image[2.76,1.4;1,2.15;mcl_brewing_bubbles.png^[lowpart:"..
(item_percent)..":mcl_brewing_bubbles_active.png]"..
(brew_percent)..":mcl_brewing_bubbles_active.png]"..
"listring[current_player;main]"..
"listring[current_name;fuel]"..
@ -102,20 +103,17 @@ local function brewing_stand_timer(pos, elapsed)
-- Inizialize metadata
local meta = minetest.get_meta(pos)
local fuel_time = meta:get_float("fuel_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
local BREW_TIME = 30 -- all brews take max of 10
local fuel_timer = meta:get_float("fuel_timer") or 0
local BREW_TIME = 20 -- all brews brew the same
local BURN_TIME = BREW_TIME * 10
local input_item = meta:get_string("input_item") or ""
local stand_timer = meta:get_float("stand_timer") or 0
local fuel = meta:get_float("fuel") or 0
local inv = meta:get_inventory()
local input_list, stand_list, fuel_list
local fuel
local update = true
while update do
@ -136,16 +134,17 @@ local function brewing_stand_timer(pos, elapsed)
-- return 1
-- end
-- end
brew_output = brewable(inv)
if fuel ~= 0 and brew_output then
local brew_output = brewable(inv)
if fuel_time < fuel_totaltime then
fuel_time = fuel_time + elapsed
if brew_output then
fuel_timer = fuel_timer + elapsed
stand_timer = stand_timer + elapsed
if fuel_timer >= BURN_TIME then --replace with more fuel
fuel = 0 --force a new fuel grab
fuel_timer = 0
end
-- Replace the stand item with the brew result
if stand_timer >= BREW_TIME then
@ -158,7 +157,7 @@ local function brewing_stand_timer(pos, elapsed)
for i=1, inv:get_size("stand") do
if brew_output[i] then
minetest.sound_play("mcl_potions_bottle_fill", {pos=pos, gain=0.4, max_hear_range=16}, true)
minetest.sound_play("mcl_brewing_complete", {pos=pos, gain=0.4, max_hear_range=16}, true)
inv:set_stack("stand", i, brew_output[i])
minetest.sound_play("mcl_potions_bottle_pour", {pos=pos, gain=0.6, max_hear_range=16}, true)
end
@ -167,62 +166,48 @@ local function brewing_stand_timer(pos, elapsed)
update = false -- stop the update if brew is complete
end
end
else --get more fuel from fuel_list
local after_fuel
fuel, after_fuel = minetest.get_craft_result({method="fuel", width=1, items=fuel_list})
if brew_output then
if fuel.time == 0 then --no valid fuel, reset timers
fuel_totaltime = 0
stand_timer = 0
elseif fuel == 0 then --get more fuel from fuel_list
-- only allow blaze powder fuel
elseif inv:get_stack("fuel",1):get_name() == "mcl_mobitems:blaze_powder" then -- Grab another fuel
inv:set_stack("fuel", 1, after_fuel.items[1])
local fuel_name = inv:get_stack("fuel",1):get_name()
local fuel_count = inv:get_stack("fuel",1):get_count()
if fuel_name == "mcl_mobitems:blaze_powder" then -- Grab another fuel
if (fuel_count-1) ~= 0 then
inv:set_stack("fuel",1,fuel_name.." "..(fuel_count-1))
else
inv:set_stack("fuel",1,"")
end
update = true
fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime)
stand_timer = stand_timer + elapsed
fuel = 1
else -- no fuel available
update = false
end
end
else --if no output potion, stop the process
fuel_total_time = 0
stand_timer = 0
end
fuel_time = 0
end
elapsed = 0
end
if fuel and fuel_totaltime > fuel.time then
fuel_totaltime = fuel.time
end
--update formspec
local formspec = brewing_formspec
local result = false
if fuel_totaltime ~= 0 then
local fuel_percent = math.floor(fuel_time/fuel_totaltime*100)
if fuel_timer ~= 0 then
local fuel_percent = math.floor(fuel_timer/BURN_TIME*100 % BURN_TIME)
local brew_percent = math.floor(stand_timer/BREW_TIME*100)
formspec = active_brewing_formspec(fuel_percent, brew_percent*4 % 100)
formspec = active_brewing_formspec(fuel_percent, brew_percent*1 % 100)
result = true
else
minetest.get_node_timer(pos):stop()
end
meta:set_float("fuel_totaltime", fuel_totaltime)
meta:set_float("fuel_time", fuel_time)
meta:set_float("fuel_timer", fuel_timer)
meta:set_float("stand_timer", stand_timer)
meta:set_float("fuel", fuel)
-- meta:set_list("stand_items", stand_list)
meta:set_string("formspec", formspec)
return result
@ -300,14 +285,677 @@ if minetest.get_modpath("screwdriver") then
on_rotate = screwdriver.rotate_simple
end
local brewing_stand_def = {
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1},
tiles = {"mcl_brewing_top.png", --top
local doc_string =
S("To use an brewing_stand, rightclick it. An brewing_stand has 2 input slots (on the left) and one output slot.").."\n"..
S("To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.").."\n"..
S("There are two possibilities to repair tools (and armor):").."\n"..
S("• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.").."\n"..
S("• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.").."\n"..
S("Armor counts as a tool. It is possible to repair and rename a tool in a single step.").."\n\n"..
S("The brewing_stand has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the brewing_stand gets damaged. brewing_stand also have a chance of being damaged when they fall by more than 1 block. If a very damaged brewing_stand is damaged again, it is destroyed.")
local tiles = {"mcl_brewing_top.png", --top
"mcl_brewing_base.png", --bottom
"mcl_brewing_side.png", --right
"mcl_brewing_side.png", --left
"mcl_brewing_side.png", --back
"mcl_brewing_side.png^[transformFX"}, --front
"mcl_brewing_side.png^[transformFX"} --front
local allow_put = function(pos, listname, index, stack, player)
local name = player:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return 0
else
return stack:get_count()
end
end
local on_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local str = ""
for i=1, inv:get_size("stand") do
local stack = inv:get_stack("stand", i)
if not stack:is_empty() then
str = str.."1"
else str = str.."0"
end
end
minetest.swap_node(pos, {name = "mcl_brewing:stand_"..str})
minetest.get_node_timer(pos):start(1.0)
--some code here to enforce only potions getting placed on stands
end
local after_dig = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
drop_brewing_stand_items(pos, meta)
meta:from_table(meta2:to_table())
end
local allow_take = function(pos, listname, index, stack, player)
local name = player:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return 0
else
return stack:get_count()
end
end
local on_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
end
minetest.register_node("mcl_brewing:stand_000", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 0, not_in_craft_guide = 0},
tiles = tiles,
drop = {"mcl_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
{ 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
}
},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
on_receive_fields = function(pos, formname, fields, sender)
local sender_name = sender:get_player_name()
if minetest.is_protected(pos, sender_name) then
minetest.record_protection_violation(pos, sender_name)
return
end
end,
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
})
minetest.register_alias("mcl_brewing:stand", "mcl_brewing:stand_000")
minetest.register_node("mcl_brewing:stand_100", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = {"mlc_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
{ 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
{-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
{-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
{-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
{-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
{-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
}
},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
on_receive_fields = function(pos, formname, fields, sender)
local sender_name = sender:get_player_name()
if minetest.is_protected(pos, sender_name) then
minetest.record_protection_violation(pos, sender_name)
return
end
end,
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
})
minetest.register_node("mcl_brewing:stand_010", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = {"mlc_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
{ 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
{7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
{6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
{5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
{4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
{3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
}
},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
on_receive_fields = function(pos, formname, fields, sender)
local sender_name = sender:get_player_name()
if minetest.is_protected(pos, sender_name) then
minetest.record_protection_violation(pos, sender_name)
return
end
end,
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
})
minetest.register_node("mcl_brewing:stand_001", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = {"mlc_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
{ 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
{0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
{0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
}
},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
on_receive_fields = function(pos, formname, fields, sender)
local sender_name = sender:get_player_name()
if minetest.is_protected(pos, sender_name) then
minetest.record_protection_violation(pos, sender_name)
return
end
end,
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
})
minetest.register_node("mcl_brewing:stand_110", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = {"mlc_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
{ 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
{-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
{-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
{-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
{-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
{-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
{7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
{6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
{5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
{4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
{3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
}
},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
on_receive_fields = function(pos, formname, fields, sender)
local sender_name = sender:get_player_name()
if minetest.is_protected(pos, sender_name) then
minetest.record_protection_violation(pos, sender_name)
return
end
end,
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
})
minetest.register_node("mcl_brewing:stand_101", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = {"mlc_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
{ 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
{-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
{-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
{-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
{-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
{-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
{0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
{0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
}
},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
on_receive_fields = function(pos, formname, fields, sender)
local sender_name = sender:get_player_name()
if minetest.is_protected(pos, sender_name) then
minetest.record_protection_violation(pos, sender_name)
return
end
end,
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
})
minetest.register_node("mcl_brewing:stand_011", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = {"mlc_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
{ 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
{7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
{6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
{5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
{4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
{3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
{0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
{0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
}
},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
on_receive_fields = function(pos, formname, fields, sender)
local sender_name = sender:get_player_name()
if minetest.is_protected(pos, sender_name) then
minetest.record_protection_violation(pos, sender_name)
return
end
end,
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
})
minetest.register_node("mcl_brewing:stand_111", {
description = S("Brewing Stand"),
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = {"mlc_brewing:stand"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
@ -357,43 +1005,11 @@ local brewing_stand_def = {
_mcl_blast_resistance = 1200,
_mcl_hardness = 5,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
drop_brewing_stand_items(pos, meta)
meta:from_table(meta2:to_table())
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local name = player:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return 0
else
return stack:get_count()
end
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local name = player:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return 0
else
return stack:get_count()
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
minetest.get_node_timer(pos):start(1.0)
--some code here to enforce only potions getting placed on stands
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
end,
after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put,
on_metadata_inventory_take = on_take,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
@ -401,6 +1017,8 @@ local brewing_stand_def = {
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("stand", 3)
-- inv:set_size("stand2", 1)
-- inv:set_size("stand3", 1)
local form = brewing_formspec
meta:set_string("formspec", form)
end,
@ -415,28 +1033,8 @@ local brewing_stand_def = {
on_timer = brewing_stand_timer,
on_rotate = on_rotate,
}
})
if minetest.get_modpath("screwdriver") then
brewing_stand_def.on_rotate = screwdriver.rotate_simple
end
brewing_stand_def.description = S("Brewing Stand")
brewing_stand_def._doc_items_longdesc = S("The stand allows you to brew potions!")
brewing_stand_def._doc_items_usagehelp =
S("To use an brewing_stand, rightclick it. An brewing_stand has 2 input slots (on the left) and one output slot.").."\n"..
S("To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.").."\n"..
S("There are two possibilities to repair tools (and armor):").."\n"..
S("• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.").."\n"..
S("• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.").."\n"..
S("Armor counts as a tool. It is possible to repair and rename a tool in a single step.").."\n\n"..
S("The brewing_stand has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the brewing_stand gets damaged. brewing_stand also have a chance of being damaged when they fall by more than 1 block. If a very damaged brewing_stand is damaged again, it is destroyed.")
brewing_stand_def._tt_help = S("Repair and rename items")
minetest.register_node("mcl_brewing:stand", brewing_stand_def)
if minetest.get_modpath("mcl_core") then
minetest.register_craft({
output = "mcl_brewing:stand",
recipe = {
@ -444,5 +1042,15 @@ if minetest.get_modpath("mcl_core") then
{ "mcl_core:stone_smooth", "mcl_core:stone_smooth", "mcl_core:stone_smooth" },
}
})
end
-- Legacy
minetest.register_lbm({
label = "Update brewing_stand formspecs (0.60.0",
name = "mcl_brewing:update_formspec_0_60_0",
--nodenames = { "group:brewing_stand" },
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", brewing_formspec)
end,
})

0
mods/ITEMS/mcl_brewing/locale/template.txt Normal file → Executable file
View file

2
mods/ITEMS/mcl_brewing/mod.conf Normal file → Executable file
View file

@ -1,3 +1 @@
name = mcl_brewing
depends = mcl_init, mcl_formspec, mcl_sounds, mcl_potions, mcl_mobitems
optional_depends = mcl_core, screwdriver

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

After

Width:  |  Height:  |  Size: 157 B

BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_fuel_bg.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

After

Width:  |  Height:  |  Size: 250 B

BIN
mods/ITEMS/mcl_brewing/textures/mcl_brewing_inventory.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 404 B

View file

@ -190,6 +190,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
_doc_items_usagehelp = S("Punch a liquid source to collect it. You can then use the filled bucket to place the liquid somewhere else."),
_tt_help = S("Collects liquids"),
liquids_pointable = true,
inventory_image = "bucket.png",
stack_max = 16,
on_place = function(itemstack, user, pointed_thing)

View file

@ -123,6 +123,29 @@ local double_chest_add_item = function(top_inv, bottom_inv, listname, stack)
end
end
local drop_items_chest = function(pos, oldnode, oldmetadata)
local meta = minetest.get_meta(pos)
local meta2 = meta
if oldmetadata then
meta:from_table(oldmetadata)
end
local inv = meta:get_inventory()
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
meta:from_table(meta2:to_table())
end
local on_chest_blast = function(pos)
local node = minetest.get_node(pos)
drop_items_chest(pos, node)
minetest.remove_node(pos)
end
minetest.register_node("mcl_chests:"..basename, {
description = desc,
_tt_help = tt_help,
@ -174,20 +197,8 @@ minetest.register_node("mcl_chests:"..basename, {
minetest.swap_node(pos, { name = "mcl_chests:"..canonical_basename, param2 = param2 })
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
meta:from_table(meta2:to_table())
end,
after_dig_node = drop_items_chest,
on_blast = on_chest_blast,
allow_metadata_inventory_move = protection_check_move,
allow_metadata_inventory_take = protection_check_put_take,
allow_metadata_inventory_put = protection_check_put_take,
@ -280,20 +291,8 @@ minetest.register_node("mcl_chests:"..basename.."_left", {
end
minetest.swap_node(p, { name = "mcl_chests:"..basename, param2 = param2 })
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
meta:from_table(meta2:to_table())
end,
after_dig_node = drop_items_chest,
on_blast = on_chest_blast,
allow_metadata_inventory_move = protection_check_move,
allow_metadata_inventory_take = protection_check_put_take,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
@ -414,21 +413,10 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
minetest.close_formspec(players[pl]:get_player_name(), "mcl_chests:"..canonical_basename.."_"..p.x.."_"..p.y.."_"..p.z)
end
minetest.swap_node(p, { name = "mcl_chests:"..basename, param2 = param2 })
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
meta:from_table(meta2:to_table())
end,
after_dig_node = drop_items_chest,
on_blast = on_chest_blast,
allow_metadata_inventory_move = protection_check_move,
allow_metadata_inventory_take = protection_check_put_take,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
@ -903,8 +891,8 @@ for color, desc in pairs(boxtypes) do
return 0
end
end,
_mcl_blast_resistance = 30,
_mcl_hardness = 6,
_mcl_blast_resistance = 6,
_mcl_hardness = 2,
})
if mod_doc and not is_canonical then

View file

@ -4,6 +4,13 @@
local mg_name = minetest.get_mapgen_setting("mg_name")
local OAK_TREE_ID = 1
local DARK_OAK_TREE_ID = 2
local SPRUCE_TREE_ID = 3
local ACACIA_TREE_ID = 4
local JUNGLE_TREE_ID = 5
local BIRCH_TREE_ID = 6
minetest.register_abm({
label = "Lava cooling",
nodenames = {"group:lava"},
@ -221,7 +228,97 @@ local function air_leaf(leaftype)
end
end
function mcl_core.generate_tree(pos, tree_type, two_by_two)
-- Check if a node stops a tree from growing. Torches, plants, wood, tree,
-- leaves and dirt does not affect tree growth.
local function node_stops_growth(node)
if node.name == 'air' then
return false
end
local def = minetest.registered_nodes[node.name]
if not def then
return true
end
local groups = def.groups
if not groups then
return true
end
if groups.plant or groups.torch or groups.dirt or groups.tree
or groups.bark or groups.leaves or groups.wood then
return false
end
return true
end
-- Check if a tree can grow at position. The width is the width to check
-- around the tree. A width of 3 and height of 5 will check a 3x3 area, 5
-- nodes above the sapling. If any walkable node other than dirt, wood or
-- leaves occurs in those blocks the tree cannot grow.
local function check_growth_width(pos, width, height)
-- Huge tree (with even width to check) will check one more node in
-- positive x and y directions.
local neg_space = math.min((width - 1) / 2)
local pos_space = math.max((width - 1) / 2)
for x = -neg_space, pos_space do
for z = -neg_space, pos_space do
for y = 1, height do
local np = vector.new(
pos.x + x,
pos.y + y,
pos.z + z)
if node_stops_growth(minetest.get_node(np)) then
return false
end
end
end
end
return true
end
-- Check if a tree with id can grow at a position. Options is a table of flags
-- for varieties of trees. The 'two_by_two' option is used to check if there is
-- room to generate huge trees for spruce and jungle. The 'balloon' option is
-- used to check if there is room to generate a balloon tree for oak.
local function check_tree_growth(pos, tree_id, options)
local two_by_two = options and options.two_by_two
local balloon = options and options.balloon
if tree_id == OAK_TREE_ID then
if balloon then
return check_growth_width(pos, 7, 11)
else
return check_growth_width(pos, 3, 5)
end
elseif tree_id == BIRCH_TREE_ID then
return check_growth_width(pos, 3, 6)
elseif tree_id == SPRUCE_TREE_ID then
if two_by_two then
return check_growth_width(pos, 6, 20)
else
return check_growth_width(pos, 5, 11)
end
elseif tree_id == JUNGLE_TREE_ID then
if two_by_two then
return check_growth_width(pos, 8, 23)
else
return check_growth_width(pos, 3, 8)
end
elseif tree_id == ACACIA_TREE_ID then
return check_growth_width(pos, 7, 8)
elseif tree_id == DARK_OAK_TREE_ID and two_by_two then
return check_growth_width(pos, 4, 7)
end
return false
end
-- Generates a tree with a type. Options is a table of flags for varieties of
-- trees. The 'two_by_two' option is used by jungle and spruce trees to
-- generate huge trees. The 'balloon' option is used by oak to generate a balloon
-- oak tree.
function mcl_core.generate_tree(pos, tree_type, options)
pos.y = pos.y-1
local nodename = minetest.get_node(pos).name
@ -231,15 +328,22 @@ function mcl_core.generate_tree(pos, tree_type, two_by_two)
end
local node
if tree_type == nil or tree_type == 1 then
local two_by_two = options and options.two_by_two
local balloon = options and options.balloon
if tree_type == nil or tree_type == OAK_TREE_ID then
if mg_name == "v6" then
mcl_core.generate_v6_oak_tree(pos)
else
if balloon then
mcl_core.generate_balloon_oak_tree(pos)
else
mcl_core.generate_oak_tree(pos)
end
elseif tree_type == 2 and two_by_two then
end
elseif tree_type == DARK_OAK_TREE_ID then
mcl_core.generate_dark_oak_tree(pos)
elseif tree_type == 3 then
elseif tree_type == SPRUCE_TREE_ID then
if two_by_two then
mcl_core.generate_huge_spruce_tree(pos)
else
@ -249,9 +353,9 @@ function mcl_core.generate_tree(pos, tree_type, two_by_two)
mcl_core.generate_spruce_tree(pos)
end
end
elseif tree_type == 4 then
elseif tree_type == ACACIA_TREE_ID then
mcl_core.generate_acacia_tree(pos)
elseif tree_type == 5 then
elseif tree_type == JUNGLE_TREE_ID then
if two_by_two then
mcl_core.generate_huge_jungle_tree(pos)
else
@ -261,7 +365,7 @@ function mcl_core.generate_tree(pos, tree_type, two_by_two)
mcl_core.generate_jungle_tree(pos)
end
end
elseif tree_type == 6 then
elseif tree_type == BIRCH_TREE_ID then
mcl_core.generate_birch_tree(pos)
end
end
@ -331,13 +435,10 @@ function mcl_core.generate_v6_oak_tree(pos)
end
end
-- Oak
function mcl_core.generate_oak_tree(pos)
local r = math.random(1, 12)
-- Ballon Oak
function mcl_core.generate_balloon_oak_tree(pos)
local path
local offset
-- Balloon oak
if r == 1 then
local s = math.random(1, 12)
if s == 1 then
-- Small balloon oak
@ -353,12 +454,14 @@ function mcl_core.generate_oak_tree(pos)
offset = { x = -4, y = -1, z = -4 }
end
end
-- Classic oak
else
path = minetest.get_modpath("mcl_core") .. "/schematics/mcl_core_oak_classic.mts"
offset = { x = -2, y = -1, z = -2 }
minetest.place_schematic(vector.add(pos, offset), path, "random", nil, false)
end
-- Oak
function mcl_core.generate_oak_tree(pos)
local path = minetest.get_modpath("mcl_core") .. "/schematics/mcl_core_oak_classic.mts"
local offset = { x = -2, y = -1, z = -2 }
minetest.place_schematic(vector.add(pos, offset), path, "random", nil, false)
end
@ -833,41 +936,55 @@ local sapling_grow_action = function(tree_id, soil_needed, one_by_one, two_by_tw
local s8 = is_sapling(p8, sapling)
local s9 = is_sapling(p9, sapling)
-- In a 9×9 field there are 4 possible 2×2 squares. We check them all.
if s2 and s3 and s4 then
if s2 and s3 and s4 and check_tree_growth(pos, tree_id, { two_by_two = true }) then
-- Success: Remove saplings and place tree
minetest.remove_node(pos)
minetest.remove_node(p2)
minetest.remove_node(p3)
minetest.remove_node(p4)
mcl_core.generate_tree(pos, tree_id, true)
mcl_core.generate_tree(pos, tree_id, { two_by_two = true })
return
elseif s3 and s5 and s6 then
elseif s3 and s5 and s6 and check_tree_growth(p6, tree_id, { two_by_two = true }) then
minetest.remove_node(pos)
minetest.remove_node(p3)
minetest.remove_node(p5)
minetest.remove_node(p6)
mcl_core.generate_tree(p6, tree_id, true)
mcl_core.generate_tree(p6, tree_id, { two_by_two = true })
return
elseif s6 and s7 and s8 then
elseif s6 and s7 and s8 and check_tree_growth(p7, tree_id, { two_by_two = true }) then
minetest.remove_node(pos)
minetest.remove_node(p6)
minetest.remove_node(p7)
minetest.remove_node(p8)
mcl_core.generate_tree(p7, tree_id, true)
mcl_core.generate_tree(p7, tree_id, { two_by_two = true })
return
elseif s2 and s8 and s9 then
elseif s2 and s8 and s9 and check_tree_growth(p8, tree_id, { two_by_two = true }) then
minetest.remove_node(pos)
minetest.remove_node(p2)
minetest.remove_node(p8)
minetest.remove_node(p9)
mcl_core.generate_tree(p8, tree_id, true)
mcl_core.generate_tree(p8, tree_id, { two_by_two = true })
return
end
end
if one_by_one and tree_id == OAK_TREE_ID then
-- There is a chance that this tree wants to grow as a balloon oak
if math.random(1, 12) == 1 then
-- Check if there is room for that
if check_tree_growth(pos, tree_id, { balloon = true }) then
minetest.set_node(pos, {name="air"})
mcl_core.generate_tree(pos, tree_id, { balloon = true })
return
end
end
end
-- If this sapling can grow alone
if one_by_one then
if one_by_one and check_tree_growth(pos, tree_id) then
-- Single sapling
minetest.set_node(pos, {name="air"})
local r = math.random(1, 12)
mcl_core.generate_tree(pos, tree_id)
return
end
@ -878,12 +995,12 @@ local sapling_grow_action = function(tree_id, soil_needed, one_by_one, two_by_tw
end
end
local grow_oak = sapling_grow_action(1, 1, true, false)
local grow_dark_oak = sapling_grow_action(2, 2, false, true, "mcl_core:darksapling")
local grow_jungle_tree = sapling_grow_action(5, 1, true, true, "mcl_core:junglesapling")
local grow_acacia = sapling_grow_action(4, 2, true, false)
local grow_spruce = sapling_grow_action(3, 1, true, true, "mcl_core:sprucesapling")
local grow_birch = sapling_grow_action(6, 1, true, false)
local grow_oak = sapling_grow_action(OAK_TREE_ID, 1, true, false)
local grow_dark_oak = sapling_grow_action(DARK_OAK_TREE_ID, 2, false, true, "mcl_core:darksapling")
local grow_jungle_tree = sapling_grow_action(JUNGLE_TREE_ID, 1, true, true, "mcl_core:junglesapling")
local grow_acacia = sapling_grow_action(ACACIA_TREE_ID, 2, true, false)
local grow_spruce = sapling_grow_action(SPRUCE_TREE_ID, 1, true, true, "mcl_core:sprucesapling")
local grow_birch = sapling_grow_action(BIRCH_TREE_ID, 1, true, false)
-- Attempts to grow the sapling at the specified position
-- pos: Position

View file

@ -33,6 +33,7 @@ minetest.register_node("mcl_core:water_flowing", {
},
},
sounds = mcl_sounds.node_sound_water_defaults(),
is_ground_content = false,
alpha = WATER_ALPHA,
paramtype = "light",
paramtype2 = "flowingliquid",
@ -77,6 +78,7 @@ S("• When water is directly below lava, the water turns into stone."),
}
},
sounds = mcl_sounds.node_sound_water_defaults(),
is_ground_content = false,
alpha = WATER_ALPHA,
paramtype = "light",
walkable = false,
@ -119,6 +121,7 @@ minetest.register_node("mcl_core:lava_flowing", {
paramtype = "light",
paramtype2 = "flowingliquid",
light_source = minetest.LIGHT_MAX,
is_ground_content = false,
sounds = mcl_sounds.node_sound_lava_defaults(),
walkable = false,
pointable = false,
@ -176,6 +179,7 @@ S("• When lava is directly above water, the water turns into stone."),
},
paramtype = "light",
light_source = minetest.LIGHT_MAX,
is_ground_content = false,
sounds = mcl_sounds.node_sound_lava_defaults(),
walkable = false,
pointable = false,

View file

@ -111,6 +111,7 @@ mcl_end.check_detach_chorus_plant = function(pos, oldnode, oldmetadata, digger)
end
mcl_end.check_blast_chorus_plant = function(pos)
minetest.remove(pos)
mcl_end.detach_chorus_plant(pos)
end

View file

@ -439,3 +439,4 @@ minetest.register_craft({
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",},
{"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",}},
})

View file

@ -1,3 +1,5 @@
mcl_core
mcl_farming
mcl_mobitems
mcl_fishing
playerphysics

View file

@ -130,7 +130,14 @@ local potion_image = function(colorstring, opacity)
if not opacity then
opacity = 127
end
return "mcl_potions_potion_bottle_drinkable.png^(mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")"
return "mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_potion_bottle_drinkable.png"
end
local splash_image = function(colorstring, opacity)
if not opacity then
opacity = 127
end
return "mcl_potions_splash_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_splash_bottle.png"
end
-- Cauldron fill up rules:
@ -321,24 +328,99 @@ minetest.register_craftitem("mcl_potions:dragon_breath", {
stack_max = 1,
})
local function _use_potion()
minetest.item_eat(0, "mcl_potions:glass_bottle")
minetest.sound_play("mcl_potions_drinking")
end
local healing_func = function(player, hp) player:set_hp(player:get_hp() + hp) end
minetest.register_craftitem("mcl_potions:healing", {
description = S("Healing Potion"),
_doc_items_longdesc = brewhelp,
wield_image = "mcl_potions_healing.png",
inventory_image = "mcl_potions_healing.png",
groups = { brewitem = 1, food=5},
wield_image = potion_image("#CC0000"),
inventory_image = potion_image("#CC0000"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
healing_func(user, 4)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
healing_func(user, 4)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:weakness", {
description = S("Weakness Potion"),
minetest.register_craftitem("mcl_potions:healing_2", {
description = S("Healing Potion II"),
_doc_items_longdesc = brewhelp,
wield_image = "mcl_potions_weakness.png",
inventory_image = "mcl_potions_weakness.png",
groups = { brewitem = 1, food=-5},
wield_image = potion_image("#DD0000"),
inventory_image = potion_image("#DD0000"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
healing_func(user, 8)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
healing_func(user, 8)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:harming", {
description = S("Harming Potion"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#660099"),
inventory_image = potion_image("#660099"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
healing_func(user, -6)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
healing_func(user, -6)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:harming_2", {
description = S("Harming Potion II"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#330066"),
inventory_image = potion_image("#330066"),
groups = { brewitem = 1, food=3, can_eat_when_full=1 },
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
healing_func(user, -12)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
healing_func(user, -12)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:night_vision", {
description = S("Night Vision Potion"),
_doc_items_longdesc = brewhelp,
@ -348,36 +430,396 @@ minetest.register_craftitem("mcl_potions:night_vision", {
stack_max = 1,
})
local swiftness_func = function(player, factor, duration)
playerphysics.add_physics_factor(player, "speed", "swiftness", factor)
minetest.after(duration, function() playerphysics.remove_physics_factor(player, "speed", "swiftness") end )
end
minetest.register_craftitem("mcl_potions:swiftness", {
description = S("Swiftness Potion"),
_doc_items_longdesc = brewhelp,
wield_image = "mcl_potions_swiftness.png",
inventory_image = "mcl_potions_swiftness.png",
wield_image = potion_image("#009999"),
inventory_image = potion_image("#009999"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
swiftness_func(user, 1.2, 180)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
swiftness_func(user, 1.2, 180)
_use_potion()
return itemstack
end,
})
mcl_potions = {}
minetest.register_craftitem("mcl_potions:swiftness_2", {
description = S("Swiftness Potion II"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00BBBB"),
inventory_image = potion_image("#00BBBB"),
groups = { brewitem = 1, food=0},
stack_max = 1,
function key_in_table(table,key)
return table[key] ~= nil
on_place = function(itemstack, user, pointed_thing)
swiftness_func(user, 1.4, 90)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
swiftness_func(user, 1.4, 90)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:swiftness_plus", {
description = S("Swiftness Potion +"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00AAAA"),
inventory_image = potion_image("#00AAAA"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
swiftness_func(user, 1.2, 480)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
swiftness_func(user, 1.2, 480)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:slowness", {
description = S("Slowness Potion"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#000080"),
inventory_image = potion_image("#000080"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
swiftness_func(user, 0.85, 90)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
swiftness_func(user, 0.85, 90)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:slowness_plus", {
description = S("Slowness Potion +"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#000066"),
inventory_image = potion_image("#000066"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
swiftness_func(user, 0.85, 240)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
swiftness_func(user, 0.85, 240)
_use_potion()
return itemstack
end,
})
local leaping_func = function(player, factor, duration)
playerphysics.add_physics_factor(player, "jump", "leaping", factor)
minetest.after(duration, function() playerphysics.remove_physics_factor(player, "jump", "leaping") end )
end
minetest.register_craftitem("mcl_potions:leaping", {
description = S("Leaping Potion"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00CC33"),
inventory_image = potion_image("#00CC33"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
leaping_func(user, 1.2, 180)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
leaping_func(user, 1.2, 180)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:leaping_2", {
description = S("Leaping Potion II"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00EE33"),
inventory_image = potion_image("#00EE33"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
leaping_func(user, 1.4, 90)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
leaping_func(user, 1.4, 90)
_use_potion()
return itemstack
end,
})
minetest.register_craftitem("mcl_potions:leaping_plus", {
description = S("Leaping Potion +"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#00DD33"),
inventory_image = potion_image("#00DD33"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
leaping_func(user, 1.2, 480)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
leaping_func(user, 1.2, 480)
_use_potion()
return itemstack
end,
})
local weakness_func = function(player, factor, duration)
player:set_attribute("weakness", tostring(factor))
print(player:get_player_name().." ".."weakness = "..player:get_attribute("weakness"))
minetest.after(duration, function() player:set_attribute("weakness", tostring(0)) end )
end
minetest.register_craftitem("mcl_potions:weakness", {
description = S("Weakness Potion"),
_doc_items_longdesc = brewhelp,
wield_image = potion_image("#6600AA"),
inventory_image = potion_image("#6600AA"),
groups = { brewitem = 1, food=0},
stack_max = 1,
on_place = function(itemstack, user, pointed_thing)
weakness_func(user, 1.2, 180)
_use_potion()
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
weakness_func(user, 1.2, 180)
_use_potion()
return itemstack
end
})
-- Look into reducing attack on punch
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if puncher:get_attribute("weakness") then
print("Weakness Active")
end
end)
function register_splash(name, descr, color, def)
local id = "mcl_potions:"..name.."_splash"
minetest.register_craftitem(id, {
description = descr,
inventory_image = splash_image(color),
on_use = function(itemstack, placer, pointed_thing)
--weapons_shot(itemstack, placer, pointed_thing, def.velocity, name)
local velocity = 10
local dir = placer:get_look_dir();
local pos = placer:getpos();
local obj = minetest.env:add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
obj:setacceleration({x=0, y=-9.8, z=0})
itemstack:take_item()
return itemstack
end,
})
local w = 0.35
minetest.register_entity(id.."_flying",{
textures = {splash_image(color)},
hp_max = 1,
visual_size = {x=w,y=w},
collisionbox = {-w,-w,-w, w,w,w},
on_step = function(self, dtime)
local pos = self.object:getpos()
local node = minetest.get_node(pos)
local n = node.name
local d = 1.5
if n ~= "air" then
minetest.sound_play("mcl_potions_breaking_glass")
minetest.add_particlespawner({
amount = 40,
time = 2,
minpos = {x=pos.x-d, y=pos.y, z=pos.z-d},
maxpos = {x=pos.x+d, y=pos.y+1, z=pos.z+d},
minvel = {x=-1, y=0, z=-1},
maxvel = {x=1, y=0.5, z=1},
minacc = {x=-0.5, y=0, z=-0.5},
maxacc = {x=0.5, y=.2, z=0.5},
minexptime = 1,
maxexptime = 5,
minsize = 2,
maxsize = 4,
collisiondetection = true,
vertical = false,
texture = "mcl_potions_sprite.png^[colorize:"..color..":127",
})
self.object:remove()
for i, obj in ipairs(minetest.get_objects_inside_radius(pos, 2)) do
if minetest.is_player(obj) then def.potion_fun(obj) end
end
end
end,
})
end
register_splash("healing", "Splash Healing", "#AA0000", {
potion_fun = function(player) player:set_hp(player:get_hp() + 3) end,
})
register_splash("healing_2", "Splash Healing II", "#DD0000", {
potion_fun = function(player) player:set_hp(player:get_hp() + 6) end,
})
register_splash("harming", "Splash Harming", "#660099", {
potion_fun = function(player) healing_func(player, -4) end,
})
register_splash("harming_2", "Splash Harming II", "#330066", {
potion_fun = function(player) healing_func(player, -6) end,
})
register_splash("leaping", "Splash Leaping", "#00CC33", {
potion_fun = function(player) leaping_func(player, 1.2, 135) end
})
register_splash("leaping_2", "Splash Leaping II", "#00EE33", {
potion_fun = function(player) leaping_func(player, 1.4, 135) end
})
register_splash("leaping_plus", "Splash Leaping +", "#00DD33", {
potion_fun = function(player) leaping_func(player, 1.2, 360) end
})
register_splash("swiftness", "Splash Swiftness", "#009999", {
potion_fun = function(player) swiftness_func(player, 1.2, 135) end
})
register_splash("swiftness_2", "Splash Swiftness II", "#00BBBB", {
potion_fun = function(player) swiftness_func(player, 1.4, 135) end
})
register_splash("swiftness_plus", "Splash Swiftness +", "#00BBBB", {
potion_fun = function(player) swiftness_func(player, 1.2, 360) end
})
register_splash("slowness", "Splash Slowness ", "#000080", {
potion_fun = function(player) swiftness_func(player, 0.85, 68) end
})
register_splash("slowness_plus", "Splash Slowness +", "#000066", {
potion_fun = function(player) swiftness_func(player, 0.85, 180) end
})
-- duration effects of redstone are a factor of 8/3
-- duration effects of glowstone are a time factor of 1/2 and effect of 14/12
-- splash potion effects are reduced by a factor of 3/4
local water_table = {
["mcl_nether:nether_wart_item"] = "mcl_potions:potion_awkward",
["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness",
}
local awkward_table = {
["mcl_potions:speckled_melon"] = "mcl_potions:healing",
["mcl_farming:carrot_item_gold"] = "mcl_potions:night_vision",
["mcl_core:sugar"] = "mcl_potions:swiftness",
["mcl_mobitems:magma_cream"] = "mcl_potions:fire_resistance", --add craft
["mcl_mobitems:blaze_powder"] = "mcl_potions:strength", --add craft
["mcl_fishing:pufferfish_raw"] = "mcl_potions:water_breathing", --add craft
["mcl_mobitems:ghast_tear"] = "mcl_potions:regeneration", --add craft
["mcl_mobitems:spider_eye"] = "mcl_potions:poison", --add craft
["mcl_mobitems:rabbit_foot"] = "mcl_potions:leaping", --add craft
}
local output_table = {
["mcl_potions:potion_river_water"] = water_table,
["mcl_potions:potion_water"] = water_table,
["mcl_potions:potion_awkward"] = awkward_table,
}
local enhancement_table = {
["mcl_potions:healing"] = "mcl_potions:healing_2",
["mcl_potions:harming"] = "mcl_potions:harming_2",
["mcl_potions:swiftness"] = "mcl_potions:swiftness_2",
["mcl_potions:leaping"] = "mcl_potions:leaping_2",
}
local extension_table = {
["mcl_potions:swiftness"] = "mcl_potions:swiftness_plus",
["mcl_potions:leaping"] = "mcl_potions:leaping_plus",
}
local inversion_table = {
["mcl_potions:healing"] = "mcl_potions:harming",
["mcl_potions:healing_2"] = "mcl_potions:harming_2",
["mcl_potions:swiftness"] = "mcl_potions:slowness",
["mcl_potions:swiftness_2"] = "mcl_potions:slowness_plus",
["mcl_potions:swiftness_plus"] = "mlc_potions:slowness_plus",
["mcl_potions:leaping"] = "mcl_potions:slowness",
["mcl_potions:leaping_2"] = "mcl_potions:slowness_plus",
["mcl_potions:leaping_plus"] = "mlc_potions:slowness_plus",
}
local potions = {"healing", "healing_2",
"harming", "harming_2", "slowness", "slowness_plus",
"leaping", "leaping_2", "leaping_plus",
"swiftness", "swiftness_2", "swiftness_plus",
}
local splash_table = {}
for i, potion in ipairs(potions) do
splash_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_splash"
end
local mod_table = {
["mesecons:redstone"] = extension_table,
["mcl_potions:fermented_spider_eye"] = inversion_table,
["mcl_nether:glowstone_dust"] = enhancement_table,
["mcl_mobitems:gunpowder"] = splash_table,
}
mcl_potions = {}
-- Compare two ingredients for compatable alchemy
function mcl_potions.get_alchemy(ingr, pot)
@ -386,6 +828,18 @@ function mcl_potions.get_alchemy(ingr, pot)
if brew_table[ingr] ~= nil then
return brew_table[ingr]
end
elseif mod_table[ingr] ~= nil then
local brew_table = mod_table[ingr]
if brew_table[pot] ~= nil then
return brew_table[pot]
end
elseif splash_table[ingr] ~= nil then
local brew_table = mod_table[ingr]
if brew_table[pot] ~= nil then
return brew_table[pot]
end
end
return false
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -13,8 +13,9 @@ end
tnt = {}
tnt.ignite = function(pos)
minetest.remove_node(pos)
spawn_tnt(pos, "mcl_tnt:tnt")
local e = spawn_tnt(pos, "mcl_tnt:tnt")
minetest.check_for_falling(pos)
return e
end
-- Add smoke particle of entity at pos.
@ -70,9 +71,8 @@ minetest.register_node("mcl_tnt:tnt", {
groups = { dig_immediate = 3, tnt = 1, enderman_takable=1, flammable=-1 },
mesecons = tnt_mesecons,
on_blast = function(pos)
local e = spawn_tnt(pos, "mcl_tnt:tnt")
local e = tnt.ignite(pos)
e:get_luaentity().timer = tnt.BOOMTIMER - (0.5 + math.random())
return true
end,
_on_ignite = function(player, pointed_thing)
tnt.ignite(pointed_thing.under)

View file

@ -36,9 +36,7 @@ mcl_structures.call_struct = function(pos, struct_style, rotation)
if not rotation then
rotation = "random"
end
if struct_style == "village" then
return mcl_structures.generate_village(pos, rotation)
elseif struct_style == "desert_temple" then
if struct_style == "desert_temple" then
return mcl_structures.generate_desert_temple(pos, rotation)
elseif struct_style == "desert_well" then
return mcl_structures.generate_desert_well(pos, rotation)
@ -61,14 +59,6 @@ mcl_structures.call_struct = function(pos, struct_style, rotation)
end
end
mcl_structures.generate_village = function(pos)
-- No generating for the moment, only place it :D
-- TODO: Do complete overhaul of the algorithm
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_village.mts"
return minetest.place_schematic(newpos, path, "random", nil, true)
end
mcl_structures.generate_desert_well = function(pos)
local newpos = {x=pos.x,y=pos.y-2,z=pos.z}
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_well.mts"
@ -482,7 +472,7 @@ end
-- Debug command
minetest.register_chatcommand("spawnstruct", {
params = "desert_temple | desert_well | igloo | village | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine",
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine",
description = S("Generate a pre-defined structure near your position."),
privs = {debug = true},
func = function(name, param)
@ -493,10 +483,7 @@ minetest.register_chatcommand("spawnstruct", {
pos = vector.round(pos)
local errord = false
local message = S("Structure placed.")
if param == "village" then
mcl_structures.generate_village(pos)
message = S("Village built. WARNING: Villages are experimental and might have bugs.")
elseif param == "desert_temple" then
if param == "desert_temple" then
mcl_structures.generate_desert_temple(pos)
elseif param == "desert_well" then
mcl_structures.generate_desert_well(pos)

View file

@ -1,7 +1,6 @@
# textdomain: mcl_structures
Generate a pre-defined structure near your position.=Erzeugt ein vordefiniertes Gebäude in Ihrer Nähe.
Structure placed.=Gebäude platziert.
Village built. WARNING: Villages are experimental and might have bugs.=Dorf gebaut. ACHTUNG: Dörfer sind experimentell und können fehlerhaft sein.
Error: No structure type given. Please use “/spawnstruct <type>”.=Fehler: Kein Gebäudetyp angegeben. Bitte benutzen Sie „/spawnstruct <Typ>“.
Error: Unknown structure type. Please use “/spawnstruct <type>”.=Fehler: Unbekannter Gebäudetyp. Bitte benutzen Sie „/spawnstruct <Typ>“.
Use /help spawnstruct to see a list of avaiable types.=Benutzen Sie „/help spawnstruct“, um eine Liste der vorhandenen Typen zu sehen.

View file

@ -1,7 +1,6 @@
# textdomain: mcl_structures
Generate a pre-defined structure near your position.=Genere una estructura predefinida cerca de su posición.
Structure placed.=Estructura colocada.
Village built. WARNING: Villages are experimental and might have bugs.=Pueblo construido. ADVERTENCIA: los pueblos son experimentales y pueden tener errores.
Error: No structure type given. Please use “/spawnstruct <type>”.=Error: no se especifica ningún tipo de estructura. Utilice "/spawnstruct <Tipo>".
Error: Unknown structure type. Please use “/spawnstruct <type>”.=Error: tipo de estructura desconocido. Utilice "/spawnstruct <Tipo>".
Use /help spawnstruct to see a list of avaiable types.=Utiliza "/help spawnstruct" para ver una lista de los tipos disponibles.

View file

@ -1,7 +1,6 @@
# textdomain: mcl_structures
Generate a pre-defined structure near your position.=Générez une structure prédéfinie près de votre position.
Structure placed.=Structure placée.
Village built. WARNING: Villages are experimental and might have bugs.=Village construit. AVERTISSEMENT: les villages sont expérimentaux et peuvent avoir des bugs.
Error: No structure type given. Please use “/spawnstruct <type>”.=Erreur: Aucun type de structure indiqué. Veuillez utiliser "/spawnstruct <type>".
Error: Unknown structure type. Please use “/spawnstruct <type>”.=Erreur: Type de structure inconnu. Veuillez utiliser "/spawnstruct <type>".
Use /help spawnstruct to see a list of avaiable types.=Utilisez /help spawnstruct pour voir une liste des types disponibles.

View file

@ -6,5 +6,4 @@ doc_identifier
mobs_mc
mcl_comparators
mcl_minecarts
mcl_potions
mcl_brewing
mcl_paintings

View file

@ -13,12 +13,8 @@ local wip_items = {
"mobs_mc:wither",
"mobs_mc:parrot",
"mobs_mc:witch",
"mcl_brewing:stand",
"mcl_potions:healing",
"mcl_potions:night_vision",
"mcl_potions:swiftness",
"mcl_potions:weakness",
"screwdriver:screwdriver",
"mcl_paintings:painting",
}
local experimental_items = {
}