Compare commits

..

1 Commits

Author SHA1 Message Date
Dieter44 f79cdba7f5 ITEMS/mcl_anvils: fix renaming items w/o desc… 2021-11-20 15:03:31 +01:00
41 changed files with 178 additions and 246 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 KiB

View File

@ -58,27 +58,26 @@ function mcl_loot.get_loot(loot_definitions, pr)
end
if item then
local itemstring = item.itemstring
local itemstack = item.itemstack
if itemstring then
local stack = ItemStack(itemstring)
if item.amount_min and item.amount_max then
stack:set_count(pr:next(item.amount_min, item.amount_max))
itemstring = itemstring .. " " .. pr:next(item.amount_min, item.amount_max)
end
if item.wear_min and item.wear_max then
-- Sadly, PseudoRandom only allows very narrow ranges, so we set wear in steps of 10
local wear_min = math.floor(item.wear_min / 10)
local wear_max = math.floor(item.wear_max / 10)
local wear = pr:next(wear_min, wear_max) * 10
stack:set_wear(pr:next(wear_min, wear_max) * 10)
if not item.amount_min and not item.amount_max then
itemstring = itemstring .. " 1"
end
itemstring = itemstring .. " " .. tostring(wear)
end
if item.func then
item.func(stack, pr)
end
table.insert(items, stack)
table.insert(items, itemstring)
elseif itemstack then
table.insert(items, itemstack)
else
minetest.log("error", "[mcl_loot] INTERNAL ERROR! Failed to select random loot item!")
end

View File

@ -478,9 +478,7 @@ function mcl_util.calculate_durability(itemstack)
end
end
end
local _, groupcap = next(itemstack:get_tool_capabilities().groupcaps)
uses = uses or (groupcap or {}).uses
uses = uses or (next(itemstack:get_tool_capabilities().groupcaps) or {}).uses
end
return uses or 0

View File

@ -31,14 +31,12 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
speed_penalty = 0.5
end
local mob = minetest.add_entity(newpos, child_mob)
if mob then
if (not mother_stuck) then
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
end
mob:set_yaw(angle - math.pi/2)
table.insert(children, mob)
angle = angle + (math.pi*2)/children_count
if (not mother_stuck) then
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
end
mob:set_yaw(angle - math.pi/2)
table.insert(children, mob)
angle = angle + (math.pi*2)/children_count
end
-- If mother was murdered, children attack the killer after 1 second
if self.state == "attack" then

View File

@ -409,7 +409,7 @@ local init_trades = function(self, inv)
local offered_stack = ItemStack({name = offered_item, count = offered_count})
if mcl_enchanting.is_enchanted(offered_item) then
if mcl_enchanting.is_book(offered_item) then
mcl_enchanting.enchant_uniform_randomly(offered_stack, {"soul_speed"})
offered_stack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"})
else
mcl_enchanting.enchant_randomly(offered_stack, math.random(5, 19), false, false, true)
mcl_enchanting.unload_enchantments(offered_stack)

View File

@ -76,8 +76,6 @@ function tt.reload_itemstack_description(itemstack)
orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name"))
end
local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack)
if desc ~= orig_desc then
meta:set_string("description", desc)
end
meta:set_string("description", desc)
end
end

View File

@ -82,7 +82,7 @@ local dispenserdef = {
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for i=1, inv:get_size("main") do
@ -92,7 +92,7 @@ local dispenserdef = {
minetest.add_item(p, stack)
end
end
meta:from_table(meta2)
meta:from_table(meta2:to_table())
end,
_mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5,

View File

@ -55,7 +55,7 @@ local dropperdef = {
sounds = mcl_sounds.node_sound_stone_defaults(),
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for i=1, inv:get_size("main") do
@ -65,7 +65,7 @@ local dropperdef = {
minetest.add_item(p, stack)
end
end
meta:from_table(meta2)
meta:from_table(meta2:to_table())
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local name = player:get_player_name()

View File

@ -53,7 +53,7 @@ local dropperdef = {
sounds = mcl_sounds.node_sound_stone_defaults(),
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for i=1, inv:get_size("main") do
@ -63,7 +63,7 @@ local dropperdef = {
minetest.add_item(p, stack)
end
end
meta:from_table(meta2)
meta:from_table(meta2:to_table())
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local name = player:get_player_name()

View File

@ -73,7 +73,7 @@ local ARROW_ENTITY={
_stuckin=nil, --Position of node in which arow is stuck.
_shooter=nil, -- ObjectRef of player or mob who shot it
_is_arrow = true,
_in_player = false,
_viscosity=0, -- Viscosity of node the arrow is currently in
_deflection_cooloff=0, -- Cooloff timer after an arrow deflection, to prevent many deflections in quick succession
}
@ -439,7 +439,6 @@ function ARROW_ENTITY.get_staticdata(self)
is_critical = self._is_critical,
stuck = self._stuck,
stuckin = self._stuckin,
stuckin_player = self._in_player,
}
if self._stuck then
-- If _stucktimer is missing for some reason, assume the maximum
@ -456,6 +455,7 @@ end
function ARROW_ENTITY.on_activate(self, staticdata, dtime_s)
self._time_in_air = 1.0
self._in_player = false
local data = minetest.deserialize(staticdata)
if data then
self._stuck = data.stuck
@ -488,23 +488,10 @@ function ARROW_ENTITY.on_activate(self, staticdata, dtime_s)
self._shooter = shooter
end
end
if data.stuckin_player then
self.object:remove()
end
end
self.object:set_armor_groups({ immortal = 1 })
end
minetest.register_on_respawnplayer(function(player)
for _, obj in pairs(player:get_children()) do
local ent = obj:get_luaentity()
if ent and ent.name and string.find(ent.name, "mcl_bows:arrow_entity") then
obj:remove()
end
end
end)
minetest.register_entity("mcl_bows:arrow_entity", ARROW_ENTITY)
if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_mobitems") then

View File

@ -1055,20 +1055,6 @@ minetest.register_on_joinplayer(function(player)
inv:set_size("enderchest", 9*3)
end)
minetest.register_allow_player_inventory_action(function(player, action, inv, info)
if inv:get_location().type == "player" and (
action == "move" and (info.from_list == "enderchest" or info.to_list == "enderchest")
or action == "put" and info.listname == "enderchest"
or action == "take" and info.listname == "enderchest"
) then
local def = player:get_wielded_item():get_definition()
if not minetest.find_node_near(player:get_pos(), def and def.range or ItemStack():get_definition().range, "mcl_chests:ender_chest_small", true) then
return 0
end
end
end)
minetest.register_craft({
output = "mcl_chests:ender_chest",
recipe = {

View File

@ -5,11 +5,10 @@ local mod_doc = minetest.get_modpath("doc")
minetest.register_node("mcl_core:glass", {
description = S("Glass"),
_doc_items_longdesc = S("A decorative and mostly transparent block."),
drawtype = "glasslike_framed_optional",
drawtype = "glasslike",
is_ground_content = false,
tiles = {"default_glass.png", "default_glass_detail.png"},
tiles = {"default_glass.png"},
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
sunlight_propagates = true,
stack_max = 64,
groups = {handy=1, glass=1, building_block=1, material_glass=1},
@ -40,11 +39,10 @@ function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color)
_doc_items_create_entry = create_entry,
_doc_items_entry_name = entry_name,
_doc_items_longdesc = longdesc,
drawtype = "glasslike_framed_optional",
drawtype = "glasslike",
is_ground_content = false,
tiles = {"mcl_core_glass_"..color..".png", "mcl_core_glass_"..color.."_detail.png"},
tiles = {"mcl_core_glass_"..color..".png"},
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
sunlight_propagates = true,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true,
stack_max = 64,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -123,7 +123,7 @@ function mcl_enchanting.can_enchant(itemstack, enchantment, level)
if itemname == "" then
return false, "item missing"
end
local supported, primary = mcl_enchanting.item_supports_enchantment(itemname, enchantment)
local supported, primary = mcl_enchanting.item_supports_enchantment(itemstack:get_name(), enchantment)
if not supported then
return false, "item not supported"
end
@ -132,7 +132,7 @@ function mcl_enchanting.can_enchant(itemstack, enchantment, level)
end
if level > enchantment_def.max_level then
return false, "level too high", enchantment_def.max_level
elseif level < 1 then
elseif level < 1 then
return false, "level too small", 1
end
local item_enchantments = mcl_enchanting.get_enchantments(itemstack)
@ -295,125 +295,115 @@ function mcl_enchanting.initialize()
end
end
function mcl_enchanting.random(pr, ...)
local r = pr and pr:next(...) or math.random(...)
if pr and not ({...})[1] then
r = r / 32767
end
return r
end
function mcl_enchanting.get_random_enchantment(itemstack, treasure, weighted, exclude, pr)
local possible = {}
function mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
local possible_enchantments, weights, accum_weight = {}, {}, 0
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
local can_enchant, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
if can_enchant and (primary or treasure) and (not exclude or table.indexof(exclude, enchantment) == -1) then
local weight = weighted and enchantment_def.weight or 1
for i = 1, weight do
table.insert(possible, enchantment)
end
local _, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
if primary or treasure then
table.insert(possible_enchantments, enchantment)
accum_weight = accum_weight + enchantment_def.weight
weights[enchantment] = accum_weight
end
end
return #possible > 0 and possible[mcl_enchanting.random(pr, 1, #possible)]
return possible_enchantments, weights, accum_weight
end
function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
local itemname = itemstack:get_name()
if not mcl_enchanting.can_enchant_freshly(itemname) and not ignore_already_enchanted then
return
end
itemstack = ItemStack(itemstack)
local enchantability = minetest.get_item_group(itemname, "enchantability")
enchantability = 1 + mcl_enchanting.random(pr, 0, math.floor(enchantability / 4)) + mcl_enchanting.random(pr, 0, math.floor(enchantability / 4))
enchantability = 1 + math.random(0, math.floor(enchantability / 4)) + math.random(0, math.floor(enchantability / 4))
enchantment_level = enchantment_level + enchantability
enchantment_level = enchantment_level + enchantment_level * (mcl_enchanting.random(pr) + mcl_enchanting.random(pr) - 1) * 0.15
enchantment_level = enchantment_level + enchantment_level * (math.random() + math.random() - 1) * 0.15
enchantment_level = math.max(math.floor(enchantment_level + 0.5), 1)
local enchantments = {}
local description
enchantment_level = enchantment_level * 2
repeat
enchantment_level = math.floor(enchantment_level / 2)
if enchantment_level == 0 then
break
end
local selected_enchantment = mcl_enchanting.get_random_enchantment(itemstack, treasure, true, nil, pr)
if not selected_enchantment then
local possible, weights, accum_weight = mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
local selected_enchantment, enchantment_power
if #possible > 0 then
local r = math.random(accum_weight)
for _, enchantment in ipairs(possible) do
if weights[enchantment] >= r then
selected_enchantment = enchantment
break
end
end
local enchantment_def = mcl_enchanting.enchantments[selected_enchantment]
local power_range_table = enchantment_def.power_range_table
for i = enchantment_def.max_level, 1, -1 do
local power_range = power_range_table[i]
if enchantment_level >= power_range[1] and enchantment_level <= power_range[2] then
enchantment_power = i
break
end
end
if not description then
if not enchantment_power then
return
end
description = mcl_enchanting.get_enchantment_description(selected_enchantment, enchantment_power)
end
if enchantment_power then
enchantments[selected_enchantment] = enchantment_power
mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power)
end
else
break
end
local enchantment_def = mcl_enchanting.enchantments[selected_enchantment]
local power_range_table = enchantment_def.power_range_table
local enchantment_power
for i = enchantment_def.max_level, 1, -1 do
local power_range = power_range_table[i]
if enchantment_level >= power_range[1] and enchantment_level <= power_range[2] then
enchantment_power = i
break
end
end
if not description then
if not enchantment_power then
return
end
description = mcl_enchanting.get_enchantment_description(selected_enchantment, enchantment_power)
end
if enchantment_power then
enchantments[selected_enchantment] = enchantment_power
mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power)
end
until not no_reduced_bonus_chance and mcl_enchanting.random(pr) >= (enchantment_level + 1) / 50
until not no_reduced_bonus_chance and math.random() >= (enchantment_level + 1) / 50
return enchantments, description
end
function mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
function mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
local enchantments
repeat
enchantments = mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
enchantments = mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
until enchantments
return enchantments
end
function mcl_enchanting.enchant_randomly(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
local enchantments = mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
function mcl_enchanting.enchant_randomly(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
mcl_enchanting.set_enchanted_itemstring(itemstack)
mcl_enchanting.set_enchantments(itemstack, enchantments)
mcl_enchanting.set_enchantments(itemstack, mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted))
return itemstack
end
function mcl_enchanting.enchant_uniform_randomly(stack, exclude, pr)
local enchantment = mcl_enchanting.get_random_enchantment(stack, true, false, exclude, pr)
function mcl_enchanting.get_randomly_enchanted_book(enchantment_level, treasure, no_reduced_bonus_chance)
return mcl_enchanting.enchant_randomly(ItemStack("mcl_books:book"), enchantment_level, treasure, no_reduced_bonus_chance, true)
end
if enchantment then
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(pr, 1, mcl_enchanting.enchantments[enchantment].max_level))
function mcl_enchanting.get_uniform_randomly_enchanted_book(except, pr)
except = except or except
local stack = ItemStack("mcl_enchanting:book_enchanted")
local list = {}
for enchantment in pairs(mcl_enchanting.enchantments) do
if table.indexof(except, enchantment) == -1 then
table.insert(list, enchantment)
end
end
local index, level
if pr then
index = pr:next(1,#list)
else
index = math.random(#list)
end
local enchantment = list[index]
local enchantment_def = mcl_enchanting.enchantments[enchantment]
if pr then
level = pr:next(1, enchantment_def.max_level)
else
level = math.random(enchantment_def.max_level)
end
mcl_enchanting.enchant(stack, enchantment, level)
return stack
end

View File

@ -129,7 +129,7 @@ if minetest.get_modpath("mcl_armor") then
pumpkin_blur = player:hud_add({
hud_elem_type = "image",
position = {x = 0.5, y = 0.5},
scale = {x = -101, y = -101},
scale = {x = -100, y = -100},
text = "mcl_farming_pumpkin_hud.png",
z_index = -200
}),

View File

@ -71,9 +71,7 @@ local fish = function(itemstack, player, pointed_thing)
{ itemstring = "mcl_fishing:salmon_raw", weight = 25 },
{ itemstring = "mcl_fishing:clownfish_raw", weight = 2 },
{ itemstring = "mcl_fishing:pufferfish_raw", weight = 13 },
},
stacks_min = 1,
stacks_max = 1,
}
}, pr)
elseif r <= junk_value then
-- Junk
@ -90,29 +88,21 @@ local fish = function(itemstack, player, pointed_thing)
{ itemstring = "mcl_mobitems:bone", weight = 10 },
{ itemstring = "mcl_dye:black", weight = 1, amount_min = 10, amount_max = 10 },
{ itemstring = "mcl_mobitems:string", weight = 10 }, -- TODO: Tripwire Hook
},
stacks_min = 1,
stacks_max = 1,
}
}, pr)
else
-- Treasure
items = mcl_loot.get_loot({
items = {
{ itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535, func = function(stack, pr)
mcl_enchanting.enchant_randomly(stack, 30, true, false, false, pr)
end }, -- 75%-100% damage
{ itemstring = "mcl_books:book", func = function(stack, pr)
mcl_enchanting.enchant_randomly(stack, 30, true, true, false, pr)
end },
{ itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535, func = function(stack, pr)
mcl_enchanting.enchant_randomly(stack, 30, true, false, false, pr)
end }, -- 75%-100% damage
-- TODO: Enchanted Bow
{ itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
{ itemstack = mcl_enchanting.get_randomly_enchanted_book(30, true, true)},
-- TODO: Enchanted Fishing Rod
{ itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
{ itemstring = "mcl_mobs:nametag", },
{ itemstring = "mcl_mobitems:saddle", },
{ itemstring = "mcl_flowers:waterlily", },
},
stacks_min = 1,
stacks_max = 1,
}
}, pr)
end
local item

View File

@ -350,7 +350,7 @@ minetest.register_abm({
local inv = meta:get_inventory()
for _,object in pairs(minetest.get_objects_inside_radius(pos, 2)) do
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and not object:get_luaentity()._removed then
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
-- Item must get sucked in when the item just TOUCHES the block above the hopper
-- This is the reason for the Y calculation.

View File

@ -230,7 +230,7 @@ local function spawn_mobs(pos, elapsed)
-- spawn up to 4 mobs in random air blocks
if air then
local max = 4
local max = 200
if spawn_count_overrides[mob] then
max = spawn_count_overrides[mob]
end

View File

@ -237,11 +237,6 @@ local function destroy_nether_portal(pos, node)
check_remove({x = pos.x, y = pos.y + 1, z = pos.z})
end
local on_rotate
if minetest.get_modpath("screwdriver") then
on_rotate = screwdriver.disallow
end
minetest.register_node(PORTAL, {
description = S("Nether Portal"),
_doc_items_longdesc = S("A Nether portal teleports creatures and objects to the hot and dangerous Nether dimension (and back!). Enter at your own risk!"),
@ -291,7 +286,6 @@ minetest.register_node(PORTAL, {
groups = { creative_breakable = 1, portal = 1, not_in_creative_inventory = 1 },
sounds = mcl_sounds.node_sound_glass_defaults(),
after_destruct = destroy_nether_portal,
on_rotate = on_rotate,
_mcl_hardness = -1,
_mcl_blast_resistance = 0,

View File

@ -63,67 +63,6 @@ local surround_vectors = {
{ x=0, y=0, z=1 },
}
local loottable =
{
{
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobs:nametag", weight = 20 },
{ itemstring = "mcl_mobitems:saddle", weight = 20 },
{ itemstring = "mcl_jukebox:record_1", weight = 15 },
{ itemstring = "mcl_jukebox:record_4", weight = 15 },
{ itemstring = "mobs_mc:iron_horse_armor", weight = 15 },
{ itemstring = "mcl_core:apple_gold", weight = 15 },
{ itemstring = "mcl_books:book", weight = 10, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
end },
{ itemstring = "mobs_mc:gold_horse_armor", weight = 10 },
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 5 },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2 },
}
},
{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:bread", weight = 20 },
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mesecons:redstone", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:melon_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:pumpkin_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_buckets:bucket_empty", weight = 10 },
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 },
},
},
{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
},
}
}
-- Bonus loot for v6 mapgen: Otherwise unobtainable saplings.
if mg_name == "v6" then
table.insert(loottable, {
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "mcl_core:acaciasapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "", weight = 6 },
},
})
end
local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
if calls_remaining >= 1 then return end
@ -371,6 +310,66 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
set_node(pos, {name="mcl_chests:chest", param2=facedir})
local meta = get_meta(pos)
local loottable =
{
{
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobs:nametag", weight = 20 },
{ itemstring = "mcl_mobitems:saddle", weight = 20 },
{ itemstring = "mcl_jukebox:record_1", weight = 15 },
{ itemstring = "mcl_jukebox:record_4", weight = 15 },
{ itemstring = "mobs_mc:iron_horse_armor", weight = 15 },
{ itemstring = "mcl_core:apple_gold", weight = 15 },
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 10 },
{ itemstring = "mobs_mc:gold_horse_armor", weight = 10 },
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 5 },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2 },
}
},
{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:bread", weight = 20 },
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mesecons:redstone", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:melon_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:pumpkin_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_buckets:bucket_empty", weight = 10 },
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 },
},
},
{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
},
}
}
-- Bonus loot for v6 mapgen: Otherwise unobtainable saplings.
if mg_name == "v6" then
table_insert(loottable, {
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "mcl_core:acaciasapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "", weight = 6 },
},
})
end
minetest.log("action", "[mcl_dungeons] Filling chest " .. tostring(c) .. " at " .. minetest.pos_to_string(pos))
mcl_loot.fill_inventory(meta:get_inventory(), "main", mcl_loot.get_multi_loot(loottable, pr), pr)
end

View File

@ -454,9 +454,7 @@ local function temple_placement_callback(p1, p2, size, rotation, pr)
{ itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 },
{ itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 },
{ itemstring = "mcl_books:book", weight = 20, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
end },
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 20, },
{ itemstring = "mcl_mobitems:saddle", weight = 20, },
{ itemstring = "mcl_core:apple_gold", weight = 20, },
{ itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 },

View File

@ -66,9 +66,7 @@ function tsm_railcorridors.get_treasures(pr)
items = {
{ itemstring = "mcl_mobs:nametag", weight = 30 },
{ itemstring = "mcl_core:apple_gold", weight = 20 },
{ itemstring = "mcl_books:book", weight = 10, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
end },
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 10 },
{ itemstring = "", weight = 5},
{ itemstring = "mcl_core:pick_iron", weight = 5 },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 1 },

View File

@ -550,8 +550,7 @@ mcl_damage.register_modifier(function(obj, damage, reason)
node = minetest.get_node(pos)
end
if node then
local def = minetest.registered_nodes[node.name]
if not def or def.walkable then
if minetest.registered_nodes[node.name].walkable then
return
end
if minetest.get_item_group(node.name, "water") ~= 0 then