Compare commits

..

10 Commits

Author SHA1 Message Date
cora c711380064 reimplement basic minecraft like fire spread 2022-01-15 03:31:15 +01:00
cora b1189433a4 make nodes actually be removed by the fire 2022-01-15 01:00:25 +01:00
cora 2ef8f788c2 Add node timer back in so fires burn out lol 2022-01-14 23:01:12 +01:00
cora 7375cc0706 replace laggy mcl fire with mtg abms 2022-01-14 22:15:44 +01:00
cora 22ec7a65d8 optimize nether porticles 2022-01-14 18:15:11 +01:00
Lizzy Fleckenstein 4cfb65003b Fix reference dupes for droppers and dispensers 2022-01-14 18:15:11 +01:00
Lizzy Fleckenstein 5060e600d7 Fix reference dupe glitches 2022-01-14 18:15:11 +01:00
Lizzy Fleckenstein 20900cccd5 Fix anvil duplication glitch 2022-01-14 18:15:11 +01:00
Lizzy Fleckenstein 51f3869ffe Fix another anvil weirdness and dupe glitch 2022-01-14 18:15:11 +01:00
cora 89d63080be replace nether dust particles with p. spawners
mineclonia uses add_particle for nether dust resulting in a 10-fold
increase in network traffic when in the nether. Nether dust is not
configurable making it impossible to turn this off for server admins.
this commit replaces the add_particle method with particle spawners
2022-01-14 18:15:06 +01:00
45 changed files with 273 additions and 450 deletions

View File

@ -21,7 +21,7 @@ The basic digging time groups determine by which tools a node can be dug.
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb * `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb * `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
* `shearsy=1`: Diggable by shears, and this node is *not* wool * `shearsy=1`: Diggable by shears, and this node is *not* wool
* `shearsy_wool=1`: Diggable by shears, and this node is wool * `shearsy=wool=1`: Diggable by shears, and this node is wool
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess * `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group * `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group

View File

@ -1 +0,0 @@
name = walkover

View File

@ -260,7 +260,7 @@ function boat.on_step(self, dtime, moveresult)
return return
end end
local yaw = self.object:get_yaw() local yaw = self.object:get_yaw()
if ctrl and ctrl.up then if ctrl.up then
-- Forwards -- Forwards
self._v = self._v + 0.1 * v_factor self._v = self._v + 0.1 * v_factor
@ -269,7 +269,7 @@ function boat.on_step(self, dtime, moveresult)
self.object:set_animation({x=0, y=40}, paddling_speed, 0, true) self.object:set_animation({x=0, y=40}, paddling_speed, 0, true)
self._animation = 1 self._animation = 1
end end
elseif ctrl and ctrl.down then elseif ctrl.down then
-- Backwards -- Backwards
self._v = self._v - 0.1 * v_factor self._v = self._v - 0.1 * v_factor

View File

@ -123,10 +123,6 @@ mobs:register_mob("mobs_mc:snowman", {
local pos = self.object:get_pos() local pos = self.object:get_pos()
minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true) minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true)
if minetest.registered_items["mcl_farming:pumpkin_face"] then
minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, "mcl_farming:pumpkin_face")
end
-- Wear out -- Wear out
if not minetest.is_creative_enabled(clicker:get_player_name()) then if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:add_wear(mobs_mc.misc.shears_wear) item:add_wear(mobs_mc.misc.shears_wear)

View File

@ -74,7 +74,7 @@ local professions = {
}, },
{ {
{ { "mcl_farming:pumpkin", 8, 13 }, E1 }, { { "mcl_farming:pumpkin_face", 8, 13 }, E1 },
{ E1, { "mcl_farming:pumpkin_pie", 2, 3} }, { E1, { "mcl_farming:pumpkin_pie", 2, 3} },
}, },

View File

@ -1,36 +1,66 @@
mcl_weather.nether_dust = {} mcl_weather.nether_dust = {}
mcl_weather.nether_dust.particles_count = 99 mcl_weather.nether_dust.particlespawners = {}
-- calculates coordinates and draw particles for Nether dust local psdef= {
mcl_weather.nether_dust.add_dust_particles = function(player) amount = 150,
for i=mcl_weather.nether_dust.particles_count, 1,-1 do time = 0,
local rpx, rpy, rpz = mcl_weather.get_random_pos_by_player_look_dir(player) minpos = vector.new(-15,-15,-15),
minetest.add_particle({ maxpos =vector.new(15,15,15),
pos = {x = rpx, y = rpy - math.random(6, 18), z = rpz}, minvel = vector.new(-0.3,-0.15,-1),
velocity = {x = math.random(-30,30)*0.01, y = math.random(-15,15)*0.01, z = math.random(-30,30)*0.01}, maxvel = vector.new(0.3,0.15,0.3),
acceleration = {x = math.random(-50,50)*0.02, y = math.random(-20,20)*0.02, z = math.random(-50,50)*0.02}, minacc = vector.new(-1,-0.4,-1),
expirationtime = 3, maxacc = vector.new(1,0.4,1),
size = math.random(6,20)*0.01, minexptime = 1,
collisiondetection = false, maxexptime = 10,
object_collision = false, minsize = 0.2,
vertical = false, maxsize = 0.7,
glow = math.random(0,minetest.LIGHT_MAX), collisiondetection = false,
texture = "mcl_particles_nether_dust"..tostring(i%3+1)..".png", collision_removal = false,
playername = player:get_player_name() object_collision = false,
}) vertical = false
}
local function check_player(player)
local name=player:get_player_name()
if mcl_worlds.has_dust(player:get_pos()) and not mcl_weather.nether_dust.particlespawners[name] then
return true
end
end
mcl_weather.nether_dust.add_particlespawners = function(player)
local name=player:get_player_name(name)
mcl_weather.nether_dust.particlespawners[name]={}
psdef.playername = name
psdef.attached = player
psdef.glow = math.random(0,minetest.LIGHT_MAX)
for i=1,3 do
psdef.texture="mcl_particles_nether_dust"..i..".png"
mcl_weather.nether_dust.particlespawners[name][i]=minetest.add_particlespawner(psdef)
end end
end end
local timer = 0 mcl_weather.nether_dust.delete_particlespawners = function(player)
minetest.register_globalstep(function(dtime) local name=player:get_player_name(name)
timer = timer + dtime if mcl_weather.nether_dust.particlespawners[name] then
if timer < 0.7 then return end for i=1,3 do
timer = 0 minetest.delete_particlespawner(mcl_weather.nether_dust.particlespawners[name][i])
for _, player in ipairs(minetest.get_connected_players()) do
if not mcl_worlds.has_dust(player:get_pos()) then
return false
end end
mcl_weather.nether_dust.add_dust_particles(player) mcl_weather.nether_dust.particlespawners[name]=nil
end
end
mcl_worlds.register_on_dimension_change(function(player, dimension)
if check_player(player) then
return mcl_weather.nether_dust.add_particlespawners(player)
end
mcl_weather.nether_dust.delete_particlespawners(player)
end)
minetest.register_on_joinplayer(function(player)
if check_player(player) then
mcl_weather.nether_dust.add_particlespawners(player)
end end
end) end)
minetest.register_on_leaveplayer(function(player)
mcl_weather.nether_dust.delete_particlespawners(player)
end)

View File

@ -1 +0,0 @@
name = mcl_experience

View File

@ -1,2 +1 @@
name = mcl_formspec
description = Helper mod to simplify creation of formspecs a little bit description = Helper mod to simplify creation of formspecs a little bit

View File

@ -117,7 +117,7 @@ local function filter_item(name, description, lang, filter)
else else
desc = string.lower(minetest.get_translated_string(lang, description)) desc = string.lower(minetest.get_translated_string(lang, description))
end end
return string.find(name, filter, nil, true) or string.find(desc, filter, nil, true) return string.find(name, filter) or string.find(desc, filter)
end end
local function set_inv_search(filter, player) local function set_inv_search(filter, player)

View File

@ -1,8 +1,4 @@
mcl_tmp_message = { mcl_tmp_message = {}
hud_hide_timeout = tonumber(
minetest.settings:get("mcl_tmp_message_hud_hide_timeout")
) or 10
}
local huds = {} local huds = {}
local hud_hide_timeouts = {} local hud_hide_timeouts = {}
@ -10,7 +6,7 @@ local hud_hide_timeouts = {}
function mcl_tmp_message.message(player, message) function mcl_tmp_message.message(player, message)
local name = player:get_player_name() local name = player:get_player_name()
player:hud_change(huds[name], "text", message) player:hud_change(huds[name], "text", message)
hud_hide_timeouts[name] = mcl_tmp_message.hud_hide_timeout hud_hide_timeouts[name] = 3
end end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)

View File

@ -1 +0,0 @@
name = mcl_tmp_message

View File

@ -43,20 +43,14 @@ end
local comparator_activate = function(pos, node) local comparator_activate = function(pos, node)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
local onstate = def.comparator_onstate minetest.swap_node(pos, { name = def.comparator_onstate, param2 = node.param2 })
if onstate then
minetest.swap_node(pos, { name = onstate, param2 = node.param2 })
end
minetest.after(0.1, comparator_turnon , {pos = pos, node = node}) minetest.after(0.1, comparator_turnon , {pos = pos, node = node})
end end
local comparator_deactivate = function(pos, node) local comparator_deactivate = function(pos, node)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
local offstate = def.comparator_offstate minetest.swap_node(pos, { name = def.comparator_offstate, param2 = node.param2 })
if offstate then
minetest.swap_node(pos, { name = offstate, param2 = node.param2 })
end
minetest.after(0.1, comparator_turnoff, {pos = pos, node = node}) minetest.after(0.1, comparator_turnoff, {pos = pos, node = node})
end end

View File

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

View File

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

View File

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

View File

@ -101,14 +101,14 @@ local function update_anvil_slots(meta)
end end
local can_combine = mcl_enchanting.combine(input1, input2) local can_combine = mcl_enchanting.combine(input1, input2)
if can_combine then if can_combine then
-- Add tool health together plus a small bonus -- Add tool health together plus a small bonus
if def1.type == "tool" and def2.type == "tool" then if def1.type == "tool" and def2.type == "tool" then
local new_wear = calculate_repair(input1:get_wear(), input2:get_wear(), SAME_TOOL_REPAIR_BOOST) local new_wear = calculate_repair(input1:get_wear(), input2:get_wear(), SAME_TOOL_REPAIR_BOOST)
input1:set_wear(new_wear) input1:set_wear(new_wear)
end end
name_item = input1 name_item = input1
new_output = name_item new_output = name_item
-- Tool + repair item -- Tool + repair item
@ -318,11 +318,11 @@ local anvildef = {
_mcl_after_falling = damage_anvil_by_falling, _mcl_after_falling = damage_anvil_by_falling,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta2 = meta local meta2 = meta:to_table()
meta:from_table(oldmetadata) meta:from_table(oldmetadata)
drop_anvil_items(pos, meta) drop_anvil_items(pos, meta)
meta:from_table(meta2:to_table()) meta:from_table(meta2)
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local name = player:get_player_name() local name = player:get_player_name()

View File

@ -149,8 +149,8 @@ armor.set_player_armor = function(self, player)
if level then if level then
local texture = def.texture or item:gsub("%:", "_") local texture = def.texture or item:gsub("%:", "_")
local enchanted_addition = (mcl_enchanting.is_enchanted(item) and mcl_enchanting.overlay or "") local enchanted_addition = (mcl_enchanting.is_enchanted(item) and mcl_enchanting.overlay or "")
table.insert(textures, texture..".png"..enchanted_addition) table.insert(textures, "("..texture..".png"..enchanted_addition..")")
preview = "player.png^[opacity:0^"..texture.."_preview.png"..enchanted_addition..""..(preview and "^"..preview or "") preview = "(player.png^[opacity:0^"..texture.."_preview.png"..enchanted_addition..")"..(preview and "^"..preview or "")
armor_level = armor_level + level armor_level = armor_level + level
items = items + 1 items = items + 1
mcl_armor_points = mcl_armor_points + (def.groups["mcl_armor_points"] or 0) mcl_armor_points = mcl_armor_points + (def.groups["mcl_armor_points"] or 0)

View File

@ -81,7 +81,7 @@ function mcl_beds.register_bed(name, def)
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
stack_max = 1, stack_max = 1,
groups = {handy=1, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1}, groups = {handy=1, flammable = 3, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1},
_mcl_hardness = 0.2, _mcl_hardness = 0.2,
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
sounds = def.sounds or default_sounds, sounds = def.sounds or default_sounds,
@ -204,7 +204,7 @@ function mcl_beds.register_bed(name, def)
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
-- FIXME: Should be bouncy=66, but this would be a higher bounciness than slime blocks! -- FIXME: Should be bouncy=66, but this would be a higher bounciness than slime blocks!
groups = {handy = 1, flammable = -1, bed = 2, dig_by_piston=1, bouncy=33, fall_damage_add_percent=-50, not_in_creative_inventory = 1}, groups = {handy = 1, flammable = 3, bed = 2, dig_by_piston=1, bouncy=33, fall_damage_add_percent=-50, not_in_creative_inventory = 1},
_mcl_hardness = 0.2, _mcl_hardness = 0.2,
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
sounds = def.sounds or default_sounds, sounds = def.sounds or default_sounds,

View File

@ -346,7 +346,7 @@ end
local drop_items_chest = function(pos, oldnode, oldmetadata) local drop_items_chest = function(pos, oldnode, oldmetadata)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta2 = meta local meta2 = meta:to_table()
if oldmetadata then if oldmetadata then
meta:from_table(oldmetadata) meta:from_table(oldmetadata)
end end
@ -358,7 +358,7 @@ local drop_items_chest = function(pos, oldnode, oldmetadata)
minetest.add_item(p, stack) minetest.add_item(p, stack)
end end
end end
meta:from_table(meta2:to_table()) meta:from_table(meta2)
end end
local on_chest_blast = function(pos) local on_chest_blast = function(pos)

View File

@ -23,7 +23,7 @@ end
function mcl_enchanting.load_enchantments(itemstack, enchantments) function mcl_enchanting.load_enchantments(itemstack, enchantments)
if not mcl_enchanting.is_book(itemstack:get_name()) then if not mcl_enchanting.is_book(itemstack:get_name()) then
mcl_enchanting.unload_enchantments(itemstack) mcl_enchanting.unload_enchantments(itemstack)
for enchantment, level in pairs(enchantments or mcl_enchanting.get_enchantments(itemstack)) do for enchantment, level in pairs(enchantments or mcl_enchanting.get_enchantments(itemstack)) do
local enchantment_def = mcl_enchanting.enchantments[enchantment] local enchantment_def = mcl_enchanting.enchantments[enchantment]
if enchantment_def.on_enchant then if enchantment_def.on_enchant then
@ -160,7 +160,7 @@ function mcl_enchanting.combine(itemstack, combine_with)
local itemname = itemstack:get_name() local itemname = itemstack:get_name()
local combine_name = combine_with:get_name() local combine_name = combine_with:get_name()
local enchanted_itemname = mcl_enchanting.get_enchanted_itemstring(itemname) local enchanted_itemname = mcl_enchanting.get_enchanted_itemstring(itemname)
if enchanted_itemname ~= mcl_enchanting.get_enchanted_itemstring(combine_name) and not mcl_enchanting.is_book(combine_name) then if not enchanted_itemname or enchanted_itemname ~= mcl_enchanting.get_enchanted_itemstring(combine_name) and not mcl_enchanting.is_book(combine_name) then
return false return false
end end
local enchantments = mcl_enchanting.get_enchantments(itemstack) local enchantments = mcl_enchanting.get_enchantments(itemstack)

View File

@ -18,21 +18,19 @@ minetest.register_node("mcl_farming:beetroot_0", {
_doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."), _doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."),
_doc_items_entry_name = S("Premature Beetroot Plant"), _doc_items_entry_name = S("Premature Beetroot Plant"),
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:beetroot_seeds", drop = "mcl_farming:beetroot_seeds",
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_0.png") }, tiles = {"mcl_farming_beetroot_0.png"},
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_0.png", inventory_image = "mcl_farming_beetroot_0.png",
wield_image = "mcl_farming_beetroot_0.png", wield_image = "mcl_farming_beetroot_0.png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -9/16, -0.5, 0.5, -6/16, 0.5} {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -44,21 +42,19 @@ minetest.register_node("mcl_farming:beetroot_1", {
description = S("Premature Beetroot Plant (Stage 2)"), description = S("Premature Beetroot Plant (Stage 2)"),
_doc_items_create_entry = false, _doc_items_create_entry = false,
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:beetroot_seeds", drop = "mcl_farming:beetroot_seeds",
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_1.png") }, tiles = {"mcl_farming_beetroot_1.png"},
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_1.png", inventory_image = "mcl_farming_beetroot_1.png",
wield_image = "mcl_farming_beetroot_1.png", wield_image = "mcl_farming_beetroot_1.png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -9/16, -0.5, 0.5, -4/16, 0.5} {-0.5, -0.5, -0.5, 0.5, -3/16, 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -70,21 +66,19 @@ minetest.register_node("mcl_farming:beetroot_2", {
description = S("Premature Beetroot Plant (Stage 3)"), description = S("Premature Beetroot Plant (Stage 3)"),
_doc_items_create_entry = false, _doc_items_create_entry = false,
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:beetroot_seeds", drop = "mcl_farming:beetroot_seeds",
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_2.png") }, tiles = {"mcl_farming_beetroot_2.png"},
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_2.png", inventory_image = "mcl_farming_beetroot_2.png",
wield_image = "mcl_farming_beetroot_2.png", wield_image = "mcl_farming_beetroot_2.png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -9/16, -0.5, 0.5, 1/16, 0.5} {-0.5, -0.5, -0.5, 0.5, 2/16, 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -97,12 +91,11 @@ minetest.register_node("mcl_farming:beetroot", {
_doc_items_longdesc = S("A mature beetroot plant is a farming plant which is ready to be harvested for a beetroot and some beetroot seeds. It won't grow any further."), _doc_items_longdesc = S("A mature beetroot plant is a farming plant which is ready to be harvested for a beetroot and some beetroot seeds. It won't grow any further."),
_doc_items_create_entry = true, _doc_items_create_entry = true,
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = { drop = {
--[[ drops 1 beetroot guaranteed. --[[ drops 1 beetroot guaranteed.
drops 1-4 beetroot seeds: drops 1-4 beetroot seeds:
@ -119,14 +112,13 @@ minetest.register_node("mcl_farming:beetroot", {
{ items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 }, { items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 },
}, },
}, },
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_3.png") }, tiles = {"mcl_farming_beetroot_3.png"},
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_3.png", inventory_image = "mcl_farming_beetroot_3.png",
wield_image = "mcl_farming_beetroot_3.png", wield_image = "mcl_farming_beetroot_3.png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -9/16, -0.5, 0.5, 2/16, 0.5} {-0.5, -0.5, -0.5, 0.5, 3/16, 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,beetroot=4}, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,beetroot=4},

View File

@ -28,20 +28,18 @@ for i=1, 7 do
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity paramtype2 = "meshoptions",
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:carrot_item", drop = "mcl_farming:carrot_item",
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, tiles = {texture},
use_texture_alpha = "clip",
inventory_image = texture, inventory_image = texture,
wield_image = texture, wield_image = texture,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -9/16, -0.5, 0.5, sel_height - 1/16, 0.5} {-0.5, -0.5, -0.5, 0.5, sel_height, 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -55,13 +53,11 @@ minetest.register_node("mcl_farming:carrot", {
_doc_items_longdesc = S("Mature carrot plants are ready to be harvested for carrots. They won't grow any further."), _doc_items_longdesc = S("Mature carrot plants are ready to be harvested for carrots. They won't grow any further."),
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity paramtype2 = "meshoptions",
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(), tiles = {"farming_carrot_4.png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("farming_carrot_4.png") },
use_texture_alpha = "clip",
inventory_image = "farming_carrot_4.png", inventory_image = "farming_carrot_4.png",
wield_image = "farming_carrot_4.png", wield_image = "farming_carrot_4.png",
drop = { drop = {
@ -76,7 +72,7 @@ minetest.register_node("mcl_farming:carrot", {
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -9/16, -0.5, 0.5, 3/16, 0.5} {-0.5, -0.5, -0.5, 0.5, 4/16, 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},

View File

@ -27,73 +27,3 @@ dofile(minetest.get_modpath("mcl_farming").."/potatoes.lua")
-- ========= BEETROOT ========= -- ========= BEETROOT =========
dofile(minetest.get_modpath("mcl_farming").."/beetroot.lua") dofile(minetest.get_modpath("mcl_farming").."/beetroot.lua")
-- This function generates a row of plantlike and nodebox nodes whose
-- name starts with a given string, starting at a given position. It
-- places a given node below so that the rendering can be examined.
local function generate_plant_row(prefix, pos, below_node)
local i = 1
for node_name, node in pairs(minetest.registered_nodes) do
if (
1 == node_name:find(prefix) and
(
"plantlike" == node.drawtype or
"nodebox" == node.drawtype
)
) then
local node_pos = {
x = pos.x + i,
y = pos.y,
z = pos.z,
}
minetest.set_node(
node_pos,
{
name = node_name,
param2 = node.place_param2 or 0
}
)
local below_pos = {
x = node_pos.x,
y = node_pos.y - 1,
z = node_pos.z
}
minetest.set_node(
below_pos,
below_node
)
i = i + 1
end
end
end
minetest.register_chatcommand("generate_farming_plant_rows",{
description = "Generates rows of mcl_farming plant nodes on farming soil and glass",
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
local node_prefixes = {
"mcl_farming:beetroot",
"mcl_farming:carrot",
"mcl_farming:melon",
"mcl_farming:potato",
"mcl_farming:pumpkin",
"mcl_farming:wheat",
}
for i,node_prefix in ipairs(node_prefixes) do
generate_plant_row(
node_prefix,
pos,
{ name = "mcl_farming:soil" }
)
pos.z = pos.z + 2
generate_plant_row(
node_prefix,
pos,
{ name = "mcl_core:glass" }
)
pos.z = pos.z + 2
end
end
})

View File

@ -91,18 +91,16 @@ for s=1,7 do
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_plus_nodebox(),
sunlight_propagates = true, sunlight_propagates = true,
drop = stem_drop, drop = stem_drop,
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, tiles = {texture},
use_texture_alpha = "clip",
wield_image = texture, wield_image = texture,
inventory_image = texture, inventory_image = texture,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15} {-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s}, groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s},

View File

@ -6,13 +6,13 @@ for i=1, 7 do
local texture, selbox local texture, selbox
if i < 3 then if i < 3 then
texture = "mcl_farming_potatoes_stage_0.png" texture = "mcl_farming_potatoes_stage_0.png"
selbox = { -0.5, -9/16, -0.5, 0.5, -6/16, 0.5 } selbox = { -0.5, -0.5, -0.5, 0.5, -5/16, 0.5 }
elseif i < 5 then elseif i < 5 then
texture = "mcl_farming_potatoes_stage_1.png" texture = "mcl_farming_potatoes_stage_1.png"
selbox = { -0.5, -9/16, -0.5, 0.5, -3/16, 0.5 } selbox = { -0.5, -0.5, -0.5, 0.5, -2/16, 0.5 }
else else
texture = "mcl_farming_potatoes_stage_2.png" texture = "mcl_farming_potatoes_stage_2.png"
selbox = { -0.5, -9/16, -0.5, 0.5, 1/16, 0.5 } selbox = { -0.5, -0.5, -0.5, 0.5, 2/16, 0.5 }
end end
local create, name, longdesc local create, name, longdesc
@ -33,15 +33,13 @@ for i=1, 7 do
_doc_items_entry_name = name, _doc_items_entry_name = name,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:potato_item", drop = "mcl_farming:potato_item",
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, tiles = { texture },
use_texture_alpha = "clip",
inventory_image = texture, inventory_image = texture,
wield_image = texture, wield_image = texture,
selection_box = { selection_box = {
@ -59,14 +57,12 @@ minetest.register_node("mcl_farming:potato", {
description = S("Mature Potato Plant"), description = S("Mature Potato Plant"),
_doc_items_longdesc = S("Mature potato plants are ready to be harvested for potatoes. They won't grow any further."), _doc_items_longdesc = S("Mature potato plants are ready to be harvested for potatoes. They won't grow any further."),
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true, sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(), tiles = {"mcl_farming_potatoes_stage_3.png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_potatoes_stage_3.png") },
use_texture_alpha = "clip",
wield_image = "mcl_farming_potatoes_stage_3.png", wield_image = "mcl_farming_potatoes_stage_3.png",
inventory_image = "mcl_farming_potatoes_stage_3.png", inventory_image = "mcl_farming_potatoes_stage_3.png",
drop = { drop = {
@ -81,7 +77,7 @@ minetest.register_node("mcl_farming:potato", {
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -0.5, -9/16, -0.5, 0.5, 0, 0.5 } { -0.5, -0.5, -0.5, 0.5, 1/16, 0.5 }
} }
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},

View File

@ -63,18 +63,16 @@ for s=1,7 do
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_plus_nodebox(),
sunlight_propagates = true, sunlight_propagates = true,
drop = stem_drop, drop = stem_drop,
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, tiles = {texture},
use_texture_alpha = "clip",
inventory_image = texture, inventory_image = texture,
wield_image = texture, wield_image = texture,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15} {-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,}, groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,},
@ -106,6 +104,7 @@ local pumpkin_base_def = {
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
_mcl_hardness = 1, _mcl_hardness = 1,
} }
minetest.register_node("mcl_farming:pumpkin", pumpkin_base_def)
local pumpkin_face_base_def = table.copy(pumpkin_base_def) local pumpkin_face_base_def = table.copy(pumpkin_base_def)
pumpkin_face_base_def.description = S("Pumpkin") pumpkin_face_base_def.description = S("Pumpkin")
@ -116,11 +115,6 @@ pumpkin_face_base_def.groups.armor_head=1
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0 pumpkin_face_base_def._mcl_armor_mob_range_factor = 0
pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman" pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
pumpkin_face_base_def.groups.non_combat_armor=1 pumpkin_face_base_def.groups.non_combat_armor=1
pumpkin_face_base_def.on_construct = function(pos)
-- Attempt to spawn iron golem or snow golem
mobs_mc.tools.check_iron_golem_summon(pos)
mobs_mc.tools.check_snow_golem_summon(pos)
end
if minetest.get_modpath("mcl_armor") then if minetest.get_modpath("mcl_armor") then
pumpkin_face_base_def.on_secondary_use = armor.on_armor_use pumpkin_face_base_def.on_secondary_use = armor.on_armor_use
end end
@ -129,11 +123,12 @@ end
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5) mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5)
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth -- Register actual pumpkin, connected stems and stem-to-pumpkin growth
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin_face", pumpkin_face_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127",
function(pos)
-- Steal function to properly disconnect a carved pumpkin -- Attempt to spawn iron golem or snow golem
pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct mobs_mc.tools.check_iron_golem_summon(pos)
minetest.register_node("mcl_farming:pumpkin_face", pumpkin_face_base_def) mobs_mc.tools.check_snow_golem_summon(pos)
end)
-- Jack o'Lantern -- Jack o'Lantern
minetest.register_node("mcl_farming:pumpkin_face_light", { minetest.register_node("mcl_farming:pumpkin_face_light", {
@ -170,6 +165,11 @@ minetest.register_craft({
recipe = {{"mcl_farming:pumpkin"}} recipe = {{"mcl_farming:pumpkin"}}
}) })
minetest.register_craft({
output = "mcl_farming:pumpkin_seeds 4",
recipe = {{"mcl_farming:pumpkin_face"}}
})
minetest.register_craftitem("mcl_farming:pumpkin_pie", { minetest.register_craftitem("mcl_farming:pumpkin_pie", {
description = S("Pumpkin Pie"), description = S("Pumpkin Pie"),
_doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."), _doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."),
@ -187,6 +187,11 @@ minetest.register_craft({
output = "mcl_farming:pumpkin_pie", output = "mcl_farming:pumpkin_pie",
recipe = {"mcl_farming:pumpkin", "mcl_core:sugar", "mcl_throwing:egg"}, recipe = {"mcl_farming:pumpkin", "mcl_core:sugar", "mcl_throwing:egg"},
}) })
minetest.register_craft({
type = "shapeless",
output = "mcl_farming:pumpkin_pie",
recipe = {"mcl_farming:pumpkin_face", "mcl_core:sugar", "mcl_throwing:egg"},
})
if minetest.get_modpath("doc") then if minetest.get_modpath("doc") then

View File

@ -178,7 +178,7 @@ end
- stem_def: Partial node definition of the fully-grown unconnected stem node. Many fields are already defined. You need to add `tiles` and `description` at minimum. Don't define on_construct without good reason - stem_def: Partial node definition of the fully-grown unconnected stem node. Many fields are already defined. You need to add `tiles` and `description` at minimum. Don't define on_construct without good reason
- stem_drop: Drop probability table for all stem - stem_drop: Drop probability table for all stem
- gourd_itemstring: Desired itemstring of the full gourd node - gourd_itemstring: Desired itemstring of the full gourd node
- gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_destruct to the definition for unconnecting any connected stems - gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_dig_node to the definition for unconnecting any connected stems
- grow_interval: Will attempt to grow a gourd periodically at this interval in seconds - grow_interval: Will attempt to grow a gourd periodically at this interval in seconds
- grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number - grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number
- connected_stem_texture: Texture of the connected stem - connected_stem_texture: Texture of the connected stem
@ -228,8 +228,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
end end
-- Register gourd -- Register gourd
if not gourd_def.after_destruct then if not gourd_def.after_dig_node then
gourd_def.after_destruct = function(blockpos, oldnode) gourd_def.after_dig_node = function(blockpos, oldnode, oldmetadata, user)
-- Disconnect any connected stems, turning them back to normal stems -- Disconnect any connected stems, turning them back to normal stems
for n=1, #neighbors do for n=1, #neighbors do
local offset = neighbors[n] local offset = neighbors[n]
@ -265,7 +265,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
stem_def.selection_box = { stem_def.selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.15, -9/16, -0.15, 0.15, 7/16, 0.15} {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
}, },
} }
end end
@ -273,20 +273,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
stem_def.paramtype = "light" stem_def.paramtype = "light"
end end
if not stem_def.drawtype then if not stem_def.drawtype then
stem_def.drawtype = "nodebox" stem_def.drawtype = "plantlike"
end
if not stem_def.node_box then
stem_def.node_box = mcl_farming:get_plantlike_plus_nodebox()
end
if stem_def.tiles then
for i=1,#stem_def.tiles do
stem_def.tiles[i] = mcl_farming:align_plantlike_nodebox_texture(
stem_def.tiles[i]
)
end
end
if not stem_def.use_texture_alpha then
stem_def.use_texture_alpha = "clip"
end end
if stem_def.walkable == nil then if stem_def.walkable == nil then
stem_def.walkable = false stem_def.walkable = false
@ -313,9 +300,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
minetest.register_node(stem_itemstring, stem_def) minetest.register_node(stem_itemstring, stem_def)
-- Register connected stems -- Register connected stems
local connected_stem_texture = mcl_farming:align_plantlike_nodebox_texture(
connected_stem_texture
)
local connected_stem_tiles = { local connected_stem_tiles = {
{ "blank.png", --top { "blank.png", --top
"blank.png", -- bottom "blank.png", -- bottom
@ -347,16 +332,16 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
} }
} }
local connected_stem_nodebox = { local connected_stem_nodebox = {
{-0.5, -9/16, 0, 0.5, 7/16, 0}, {-0.5, -0.5, 0, 0.5, 0.5, 0},
{-0.5, -9/16, 0, 0.5, 7/16, 0}, {-0.5, -0.5, 0, 0.5, 0.5, 0},
{0, -9/16, -0.5, 0, 7/16, 0.5}, {0, -0.5, -0.5, 0, 0.5, 0.5},
{0, -9/16, -0.5, 0, 7/16, 0.5}, {0, -0.5, -0.5, 0, 0.5, 0.5},
} }
local connected_stem_selectionbox = { local connected_stem_selectionbox = {
{-0.1, -9/16, -0.1, 0.5, 0.2 - 1/16, 0.1}, {-0.1, -0.5, -0.1, 0.5, 0.2, 0.1},
{-0.5, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.1}, {-0.5, -0.5, -0.1, 0.1, 0.2, 0.1},
{-0.1, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.5}, {-0.1, -0.5, -0.1, 0.1, 0.2, 0.5},
{-0.1, -9/16, -0.5, 0.1, 0.2 - 1/16, 0.1}, {-0.1, -0.5, -0.5, 0.1, 0.2, 0.1},
} }
for i=1, 4 do for i=1, 4 do
@ -403,11 +388,12 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
{ x=0, y=0, z=-1 }, { x=0, y=0, z=-1 },
{ x=0, y=0, z=1 }, { x=0, y=0, z=1 },
} }
local floorpos, floor
for n=#neighbors, 1, -1 do for n=#neighbors, 1, -1 do
local offset = neighbors[n] local offset = neighbors[n]
local blockpos = vector.add(stempos, offset) local blockpos = vector.add(stempos, offset)
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z } floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
local floor = minetest.get_node(floorpos) floor = minetest.get_node(floorpos)
local block = minetest.get_node(blockpos) local block = minetest.get_node(blockpos)
local soilgroup = minetest.get_item_group(floor.name, "soil") local soilgroup = minetest.get_item_group(floor.name, "soil")
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
@ -421,8 +407,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
local r = math.random(1, #neighbors) local r = math.random(1, #neighbors)
local offset = neighbors[r] local offset = neighbors[r]
local blockpos = vector.add(stempos, offset) local blockpos = vector.add(stempos, offset)
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
local floor = minetest.get_node(floorpos)
local p2 local p2
if offset.x == 1 then if offset.x == 1 then
minetest.set_node(stempos, {name=connected_stem_names[1]}) minetest.set_node(stempos, {name=connected_stem_names[1]})
@ -484,40 +468,3 @@ minetest.register_lbm({
mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed)
end, end,
}) })
-- This function returns a nodebox that imitates a plantlike plus (+)
-- drawtype, but is shifted 1/16 lower, into the empty space above
-- farming soil. The regular plantlike drawtype can not do this.
function mcl_farming:get_plantlike_plus_nodebox()
return {
type = "fixed",
fixed = {
{ 0, -9/16, -0.15, 0, 7/16, 0.15 },
{ -0.15, -9/16, 0, 0.15, 7/16, 0 }
}
}
end
-- This function returns a nodebox that imitates a plantlike grid (#)
-- drawtype, but is shifted 1/16 lower, into the empty space above
-- farming soil. The regular plantlike drawtype can not do this.
function mcl_farming:get_plantlike_grid_nodebox()
return {
type = "fixed",
fixed = {
{ 4/16, -9/16, -8/16, 4/16, 7/16, 8/16},
{-4/16, -9/16, -8/16, -4/16, 7/16, 8/16},
{-8/16, -9/16, -4/16, 8/16, 7/16, -4/16},
{-8/16, -9/16, 4/16, 8/16, 7/16, 4/16},
}
}
end
-- This function takes a texture and returns a modified texture where
-- the bottom row is at the top, assuming 16px × 16px textures. This
-- is used to align textures to a “plantlike” nodebox shifted 1/16
-- below its own node into the empty space above farming soil.
function mcl_farming:align_plantlike_nodebox_texture(texture)
local texture = texture:gsub("%^", "\\%^"):gsub(":", "\\:")
return "[combine:16x16:0,-15=" .. texture .. ":0,1=" .. texture
end

View File

@ -39,21 +39,19 @@ for i=1,7 do
_doc_items_entry_name = name, _doc_items_entry_name = name,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
paramtype = "light", paramtype = "light",
-- keep place_param2 for plantlike drawtype compatiblity paramtype2 = "meshoptions",
place_param2 = 3, place_param2 = 3,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:wheat_seeds", drop = "mcl_farming:wheat_seeds",
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_"..(i-1)..".png") }, tiles = {"mcl_farming_wheat_stage_"..(i-1)..".png"},
use_texture_alpha = "clip",
inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png", inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png", wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -9/16, -0.5, 0.5, sel_heights[i] - 1/16, 0.5} {-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5}
}, },
}, },
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1}, groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
@ -67,21 +65,13 @@ minetest.register_node("mcl_farming:wheat", {
_doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."), _doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."),
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
-- keep place_param2 for plantlike drawtype compatiblity paramtype2 = "meshoptions",
place_param2 = 3, place_param2 = 3,
walkable = false, walkable = false,
drawtype = "nodebox", drawtype = "plantlike",
node_box = mcl_farming:get_plantlike_grid_nodebox(), tiles = {"mcl_farming_wheat_stage_7.png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_7.png") },
use_texture_alpha = "clip",
inventory_image = "mcl_farming_wheat_stage_7.png", inventory_image = "mcl_farming_wheat_stage_7.png",
wield_image = "mcl_farming_wheat_stage_7.png", wield_image = "mcl_farming_wheat_stage_7.png",
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -9/16, -0.5, 0.5, 7/16, 0.5 }
}
},
drop = { drop = {
max_items = 4, max_items = 4,
items = { items = {

View File

@ -27,34 +27,6 @@ local spawn_smoke = function(pos)
}, "high") }, "high")
end end
local adjacents = {
{ x =-1, y = 0, z = 0 },
{ x = 1, y = 0, z = 0 },
{ x = 0, y = 1, z = 0 },
{ x = 0, y =-1, z = 0 },
{ x = 0, y = 0, z =-1 },
{ x = 0, y = 0, z = 1 },
}
math.randomseed(os.time())
local function shuffle_table(t)
for i = #t, 1, -1 do
local r = math.random(i)
t[i], t[r] = t[r], t[i]
end
end
shuffle_table(adjacents)
local function has_flammable(pos)
for k,v in pairs(adjacents) do
local p=vector.add(pos,v)
local n=minetest.get_node_or_nil(p)
if n and minetest.get_item_group(n.name, "flammable") ~= 0 then
return p
end
end
end
-- --
-- Items -- Items
-- --
@ -95,6 +67,10 @@ local spawn_fire = function(pos, age)
minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z}) minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
end end
local function fire_timer(pos)
return minetest.get_node_timer(pos):start(math.random(30, 60))
end
minetest.register_node("mcl_fire:fire", { minetest.register_node("mcl_fire:fire", {
description = S("Fire"), description = S("Fire"),
_doc_items_longdesc = fire_help, _doc_items_longdesc = fire_help,
@ -127,6 +103,14 @@ minetest.register_node("mcl_fire:fire", {
end, end,
drop = "", drop = "",
sounds = {}, sounds = {},
on_timer= function(pos)
if not minetest.find_node_near(pos, 1, {"group:flammable"}) then
minetest.remove_node(pos)
return
end
-- Restart timer
return true
end,
-- Turn into eternal fire on special blocks, light Nether portal (if possible), start burning timer -- Turn into eternal fire on special blocks, light Nether portal (if possible), start burning timer
on_construct = function(pos) on_construct = function(pos)
local bpos = {x=pos.x, y=pos.y-1, z=pos.z} local bpos = {x=pos.x, y=pos.y-1, z=pos.z}
@ -134,13 +118,14 @@ minetest.register_node("mcl_fire:fire", {
local dim = mcl_worlds.pos_to_dimension(bpos) local dim = mcl_worlds.pos_to_dimension(bpos)
if under == "mcl_nether:magma" or under == "mcl_nether:netherrack" or (under == "mcl_core:bedrock" and dim == "end") then if under == "mcl_nether:magma" or under == "mcl_nether:netherrack" or (under == "mcl_core:bedrock" and dim == "end") then
minetest.set_node(pos, {name="mcl_fire:eternal_fire"}) minetest.swap_node(pos, {name = "mcl_fire:eternal_fire"})
end end
if minetest.get_modpath("mcl_portals") then if minetest.get_modpath("mcl_portals") then
mcl_portals.light_nether_portal(pos) mcl_portals.light_nether_portal(pos)
end end
spawn_smoke(pos) spawn_smoke(pos)
fire_timer(pos)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
mcl_particles.delete_node_particlespawners(pos) mcl_particles.delete_node_particlespawners(pos)
@ -354,9 +339,12 @@ minetest.register_abm({
-- [...]a fire that is not adjacent to any flammable block does not spread, even to another flammable block within the normal range. -- [...]a fire that is not adjacent to any flammable block does not spread, even to another flammable block within the normal range.
-- https://minecraft.fandom.com/wiki/Fire#Spread -- https://minecraft.fandom.com/wiki/Fire#Spread
local function has_flammable(pos)
return minetest.find_node_near(pos, 1, {"group:flammable"})
end
local function check_aircube(p1,p2) local function check_aircube(p1,p2)
local nds=minetest.find_nodes_in_area(p1,p2,{"air"}) local nds=minetest.find_nodes_in_area(p1,p2,{"air"})
shuffle_table(nds)
for k,v in pairs(nds) do for k,v in pairs(nds) do
if has_flammable(v) then return v end if has_flammable(v) then return v end
end end
@ -365,7 +353,7 @@ end
-- [...] a fire block can turn any air block that is adjacent to a flammable block into a fire block. This can happen at a distance of up to one block downward, one block sideways (including diagonals), and four blocks upward of the original fire block (not the block the fire is on/next to). -- [...] a fire block can turn any air block that is adjacent to a flammable block into a fire block. This can happen at a distance of up to one block downward, one block sideways (including diagonals), and four blocks upward of the original fire block (not the block the fire is on/next to).
local function get_ignitable(pos) local function get_ignitable(pos)
return check_aircube(vector.add(pos,vector.new(-1,-1,-1)),vector.add(pos,vector.new(1,4,1))) return check_aircube(vector.add(pos,vector.new(-1,-1,-1)),vector.add(pos,vector.new(1,4,1)))
end end
-- Fire spreads from a still lava block similarly: any air block one above and up to one block sideways (including diagonals) or two above and two blocks sideways (including diagonals) that is adjacent to a flammable block may be turned into a fire block. -- Fire spreads from a still lava block similarly: any air block one above and up to one block sideways (including diagonals) or two above and two blocks sideways (including diagonals) that is adjacent to a flammable block may be turned into a fire block.
local function get_ignitable_by_lava(pos) local function get_ignitable_by_lava(pos)
@ -397,8 +385,7 @@ else -- Fire enabled
action = function(pos) action = function(pos)
local p = get_ignitable(pos) local p = get_ignitable(pos)
if p then if p then
spawn_fire(p) minetest.set_node(p, {name = "mcl_fire:fire"})
shuffle_table(adjacents)
end end
end end
}) })
@ -414,26 +401,7 @@ else -- Fire enabled
action = function(pos) action = function(pos)
local p=get_ignitable_by_lava(pos) local p=get_ignitable_by_lava(pos)
if p then if p then
spawn_fire(p) minetest.set_node(p, {name = "mcl_fire:fire"})
end
end,
})
minetest.register_abm({
label = "Remove fires",
nodenames = {"mcl_fire:fire"},
interval = 7,
chance = 3,
catch_up = false,
action = function(pos)
local p=has_flammable(pos)
if p then
local n=minetest.get_node_or_nil(p)
if n and minetest.get_item_group(n.name, "flammable") < 1 then
minetest.remove_node(pos)
end
else
minetest.remove_node(pos)
end end
end, end,
}) })
@ -447,19 +415,17 @@ else -- Fire enabled
chance = 18, chance = 18,
catch_up = false, catch_up = false,
action = function(pos) action = function(pos)
local p = has_flammable(pos) local p = minetest.find_node_near(pos, 1, {"group:flammable"})
if not p then if not p then
return return
end end
local flammable_node = minetest.get_node(p)
local nn = minetest.get_node(p).name local def = minetest.registered_nodes[flammable_node.name]
local def = minetest.registered_nodes[nn] if def.on_burn then
local fgroup = minetest.get_item_group(nn, "flammable") def.on_burn(p)
else
if def and def._on_burn then minetest.swap_node(p, {name = "mcl_fire:fire"})
def._on_burn(p) fire_timer(p)
elseif fgroup ~= -1 then
spawn_fire(p)
minetest.check_for_falling(p) minetest.check_for_falling(p)
end end
end end

View File

@ -451,7 +451,7 @@ minetest.register_node("mcl_furnaces:furnace", {
on_timer = furnace_node_timer, on_timer = furnace_node_timer,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta2 = meta local meta2 = meta:to_table()
meta:from_table(oldmetadata) meta:from_table(oldmetadata)
local inv = meta:get_inventory() local inv = meta:get_inventory()
for _, listname in ipairs({"src", "dst", "fuel"}) do for _, listname in ipairs({"src", "dst", "fuel"}) do
@ -461,7 +461,7 @@ minetest.register_node("mcl_furnaces:furnace", {
minetest.add_item(p, stack) minetest.add_item(p, stack)
end end
end end
meta:from_table(meta2:to_table()) meta:from_table(meta2)
end, end,
on_construct = function(pos) on_construct = function(pos)

View File

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

View File

@ -29,6 +29,9 @@ if minetest.features.use_texture_alpha_string_modes then
PORTAL_ALPHA = nil PORTAL_ALPHA = nil
end end
local PORTICLE_DISTANCE = 15 --how far to send particle spawners for the portalnodes
local porticlespawners = {}
-- Table of objects (including players) which recently teleported by a -- Table of objects (including players) which recently teleported by a
-- Nether portal. Those objects have a brief cooloff period before they -- Nether portal. Those objects have a brief cooloff period before they
-- can teleport again. This prevents annoying back-and-forth teleportation. -- can teleport again. This prevents annoying back-and-forth teleportation.
@ -59,6 +62,65 @@ local function nether_to_overworld(x)
return LIMIT - math.abs(((x * OVERWORLD_TO_NETHER_SCALE + LIMIT) % (LIMIT*4)) - (LIMIT*2)) return LIMIT - math.abs(((x * OVERWORLD_TO_NETHER_SCALE + LIMIT) % (LIMIT*4)) - (LIMIT*2))
end end
local function remove_particlespawner_at_position(playername,pos)
if not porticlespawners[minetest.pos_to_string(pos)] or porticlespawners[minetest.pos_to_string(pos)][playername] == nil then return end
minetest.delete_particlespawner(porticlespawners[minetest.pos_to_string(pos)][playername],playername)
porticlespawners[minetest.pos_to_string(pos)][playername]=nil
end
local function add_particlespawner_at_position(player,pos,node)
if not porticlespawners[minetest.pos_to_string(pos)] then porticlespawners[minetest.pos_to_string(pos)] = {} end
if porticlespawners[minetest.pos_to_string(pos)][player:get_player_name()] ~= nil then return end
porticlespawners[minetest.pos_to_string(pos)][player:get_player_name()]=minetest.add_particlespawner({
amount = node_particles_allowed_level + 1,
minpos = vector.add(pos, vector.new(-3,-3,-3)),
maxpos = vector.add(pos, vector.new(3,3,3)),
minvel = vector.new(-0.5,-0.5,-0.5),
maxvel = vector.new(0.5,0.5,0.5),
minacc = vector.new(-0.5,-0.5,-0.5),
maxacc = vector.new(0.5,0.5,0.5),
minexptime = 0.1,
maxexptime = 2.4,
minsize = 0.3,
maxsize = 1.8,
time=0,
collisiondetection = false,
texture = "mcl_particles_nether_portal.png",
playername = player:get_player_name(),
})
end
local function add_porticlespawners(pos,node)
--Add particlespawners for all players in range
for _,obj in pairs(minetest.get_connected_players()) do
if vector.distance(obj:get_pos(),pos) <= PORTICLE_DISTANCE then
add_particlespawner_at_position(obj,pos,node)
end
end
end
local function remove_porticlespawners(pos,force)
--Remove particlespawners for all players out of range
-- force removes all particlespawners for the given position regardless of range
if porticlespawners[minetest.pos_to_string(pos)] then
for k,v in pairs(porticlespawners[minetest.pos_to_string(pos)]) do
local p=minetest.get_player_by_name(k)
local dst=PORTICLE_DISTANCE+1 --if player is logged off remove the particlespawner
if p and p:is_player() then
dst=vector.distance(p:get_pos(),pos)
end
if dst > PORTICLE_DISTANCE or force then
remove_particlespawner_at_position(k,pos)
end
end
end
end
local function check_porticlespawners(pos,node)
add_porticlespawners(pos,node)
remove_porticlespawners(pos)
end
-- Destroy portal if pos (portal frame or portal node) got destroyed -- Destroy portal if pos (portal frame or portal node) got destroyed
local function destroy_nether_portal(pos) local function destroy_nether_portal(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -77,6 +139,7 @@ local function destroy_nether_portal(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node and (node.name == "mcl_portals:portal" and (orientation == nil or (node.param2 == orientation))) then if node and (node.name == "mcl_portals:portal" and (orientation == nil or (node.param2 == orientation))) then
minetest.log("action", "[mcl_portal] Destroying Nether portal at " .. minetest.pos_to_string(pos)) minetest.log("action", "[mcl_portal] Destroying Nether portal at " .. minetest.pos_to_string(pos))
remove_porticlespawners(pos,true)
return minetest.remove_node(pos) return minetest.remove_node(pos)
end end
end end
@ -769,56 +832,16 @@ local function teleport(obj, portal_pos)
end end
end end
minetest.register_abm({ minetest.register_abm({
label = "Nether portal teleportation and particles", label = "Nether portal teleportation and particles",
nodenames = {"mcl_portals:portal"}, nodenames = {"mcl_portals:portal"},
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node) action = function(pos, node)
local o = node.param2 -- orientation
local d = math.random(0, 1) -- direction check_porticlespawners(pos)
local time = math.random() * 1.9 + 0.5
local velocity, acceleration
if o == 1 then
velocity = {x = math.random() * 0.7 + 0.3, y = math.random() - 0.5, z = math.random() - 0.5}
acceleration = {x = math.random() * 1.1 + 0.3, y = math.random() - 0.5, z = math.random() - 0.5}
else
velocity = {x = math.random() - 0.5, y = math.random() - 0.5, z = math.random() * 0.7 + 0.3}
acceleration = {x = math.random() - 0.5, y = math.random() - 0.5, z = math.random() * 1.1 + 0.3}
end
local distance = vector.add(vector.multiply(velocity, time), vector.multiply(acceleration, time * time / 2))
if d == 1 then
if o == 1 then
distance.x = -distance.x
velocity.x = -velocity.x
acceleration.x = -acceleration.x
else
distance.z = -distance.z
velocity.z = -velocity.z
acceleration.z = -acceleration.z
end
end
distance = vector.subtract(pos, distance)
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 15)) do
if obj:is_player() then
minetest.add_particlespawner({
amount = node_particles_allowed_level + 1,
minpos = distance,
maxpos = distance,
minvel = velocity,
maxvel = velocity,
minacc = acceleration,
maxacc = acceleration,
minexptime = time,
maxexptime = time,
minsize = 0.3,
maxsize = 1.8,
collisiondetection = false,
texture = "mcl_particles_nether_portal.png",
playername = obj:get_player_name(),
})
end
end
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do --maikerumine added for objects to travel for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do --maikerumine added for objects to travel
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
if (obj:is_player() or lua_entity) and prevent_portal_chatter(obj) then if (obj:is_player() or lua_entity) and prevent_portal_chatter(obj) then

View File

@ -1,5 +1,4 @@
local S = minetest.get_translator("mcl_tnt") local S = minetest.get_translator("mcl_tnt")
local tnt_drop_rate = tonumber(minetest.settings:get("mcl_tnt_drop_rate") or 1.0)
local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true) local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true)
local mod_death_messages = minetest.get_modpath("mcl_death_messages") local mod_death_messages = minetest.get_modpath("mcl_death_messages")
@ -181,7 +180,7 @@ function TNT:on_step(dtime)
self.blinkstatus = not self.blinkstatus self.blinkstatus = not self.blinkstatus
end end
if self.timer > tnt.BOOMTIMER then if self.timer > tnt.BOOMTIMER then
mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = tnt_drop_rate }, self.object) mcl_explosions.explode(self.object:get_pos(), 4, {}, self.object)
self.object:remove() self.object:remove()
end end
end end

View File

@ -232,10 +232,10 @@ if minetest.get_modpath("mcl_farming") then
local wear = mcl_autogroup.get_wear(toolname, "shearsy") local wear = mcl_autogroup.get_wear(toolname, "shearsy")
itemstack:add_wear(wear) itemstack:add_wear(wear)
end end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.above}, true) minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
local dir = vector.subtract(pointed_thing.under, pointed_thing.above) local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
local param2 = minetest.dir_to_facedir(dir) local param2 = minetest.dir_to_facedir(dir)
minetest.set_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2}) minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4") minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
end end
return itemstack return itemstack

View File

@ -1 +0,0 @@
name = screwdriver

View File

@ -3532,7 +3532,7 @@ local function register_decorations()
-- Pumpkin -- Pumpkin
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
decoration = "mcl_farming:pumpkin", decoration = "mcl_farming:pumpkin_face",
param2 = 0, param2 = 0,
param2_max = 3, param2_max = 3,
place_on = {"group:grass_block_no_snow"}, place_on = {"group:grass_block_no_snow"},

View File

@ -868,7 +868,7 @@ local function register_mgv6_decorations()
-- Pumpkin -- Pumpkin
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
decoration = "mcl_farming:pumpkin", decoration = "mcl_farming:pumpkin_face",
param2 = 0, param2 = 0,
param2_max = 3, param2_max = 3,
place_on = {"group:grass_block_no_snow"}, place_on = {"group:grass_block_no_snow"},

View File

@ -532,24 +532,9 @@ local function dir_to_rotation(dir)
return "0" return "0"
end end
mcl_structures.generate_test_structure_comparator = function(pos, rotation, pr)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_comparator.mts"
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
end
mcl_structures.generate_test_structure_fireproof = function(pos, rotation, pr)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_fireproof.mts"
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
end
mcl_structures.generate_test_structure_tnt = function(pos, rotation, pr)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_tnt.mts"
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
end
-- Debug command -- Debug command
minetest.register_chatcommand("spawnstruct", { minetest.register_chatcommand("spawnstruct", {
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_comparator | test_structure_fireproof | test_structure_tnt", 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."), description = S("Generate a pre-defined structure near your position."),
privs = {debug = true}, privs = {debug = true},
func = function(name, param) func = function(name, param)
@ -583,12 +568,6 @@ minetest.register_chatcommand("spawnstruct", {
mcl_structures.generate_end_exit_portal(pos, rot, pr) mcl_structures.generate_end_exit_portal(pos, rot, pr)
elseif param == "end_portal_shrine" then elseif param == "end_portal_shrine" then
mcl_structures.generate_end_portal_shrine(pos, rot, pr) mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "test_structure_comparator" then
mcl_structures.generate_test_structure_comparator(pos, rot, pr)
elseif param == "test_structure_fireproof" then
mcl_structures.generate_test_structure_fireproof(pos, rot, pr)
elseif param == "test_structure_tnt" then
mcl_structures.generate_test_structure_tnt(pos, rot, pr)
elseif param == "" then elseif param == "" then
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.") message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true errord = true

View File

@ -1 +0,0 @@
name = mcl_engine_workarounds

View File

@ -1 +0,0 @@
name = mcl_selftests

View File

@ -1 +0,0 @@
name = mcl_player

View File

@ -24,9 +24,6 @@ mcl_doWeatherCycle (Change weather) bool true
# Note that blocks never have drops when in Creative Mode. # Note that blocks never have drops when in Creative Mode.
mcl_doTileDrops (Blocks have drops) bool true mcl_doTileDrops (Blocks have drops) bool true
# Chance of a node destroyed by a TNT explosion to be dropped as an item
mcl_tnt_drop_rate (TNT drop rate) float 1.0 0.0 1.0
# If enabled, TNT explosions destroy blocks. # If enabled, TNT explosions destroy blocks.
mcl_tnt_griefing (TNT destroys blocks) bool true mcl_tnt_griefing (TNT destroys blocks) bool true
@ -105,9 +102,6 @@ animated_chests (Animated chests) bool true
# Whether to preview the player in inventory in 3D (requires Minetest 5.4) # Whether to preview the player in inventory in 3D (requires Minetest 5.4)
3d_player_preview (3D Player preview) bool true 3d_player_preview (3D Player preview) bool true
# How long a temporary message will be shown in the HUD
mcl_tmp_message_hud_hide_timeout (Temporary message display duration) int 10 0 60
[Experimental] [Experimental]
# Whether ice is translucent. If disabled, ice is fully opaque. # Whether ice is translucent. If disabled, ice is fully opaque.
# #