Compare commits

..

21 Commits

Author SHA1 Message Date
AFCMS c35c8a1713 Merge branch 'master' into api-cauldrons 2021-03-19 15:12:54 +01:00
AFCMS 64b49ba719 try to fix give function 2021-03-19 14:58:25 +01:00
AFCMS d00490c86f fix stupid crash 2021-03-19 14:27:57 +01:00
AFCMS 8c91d23eb8 fix give function 2021-03-19 14:26:43 +01:00
AFCMS 294cb3eb7d cleanup 2021-03-19 14:17:59 +01:00
AFCMS cf4d57e584 fix crash 2021-03-19 14:13:34 +01:00
AFCMS 890b95bb49 Merge branch 'master' into api-cauldrons 2021-03-19 13:39:17 +01:00
AFCMS 8611d27f1d init function 2021-03-19 10:23:22 +01:00
AFCMS 59892abf6d fix 2021-03-19 10:19:08 +01:00
AFCMS e69365f44d init give function 2021-03-19 10:18:15 +01:00
AFCMS aa0c7bd2cf Merge branch 'master' into api-cauldrons 2021-03-19 10:16:27 +01:00
AFCMS 2b73c16c69 fix doc 2 2021-03-18 20:58:06 +01:00
AFCMS 36f479b2ec cleanup 2021-03-18 20:52:24 +01:00
AFCMS 717a18ef16 fix doc 2021-03-18 20:50:37 +01:00
AFCMS 9b0c87dabc fixes 2021-03-18 19:43:25 +01:00
AFCMS 3c83898095 quick fix 2021-03-18 19:30:53 +01:00
AFCMS 6ebae965f6 fixes 2021-03-18 19:27:43 +01:00
AFCMS 5e5b3ebf75 WIP API for mcl_cauldrons 2021-03-18 19:18:35 +01:00
AFCMS e68736a040 WIP 2021-03-18 18:02:08 +01:00
AFCMS 72149a2c56 part 2 2021-03-18 09:43:31 +01:00
AFCMS 182e825303 init mcl_cauldrons API (WIP) 2021-03-17 21:47:27 +01:00
34 changed files with 915 additions and 848 deletions

View File

@ -6,7 +6,7 @@ block has a hardness and the actual Minecraft digging time is determined by
this: this:
1) The block's hardness 1) The block's hardness
2) The tool being used (the tool speed and its efficiency level) 2) The tool being used (the tool_multiplier and its efficiency level)
3) Whether the tool is considered as "eligible" for the block 3) Whether the tool is considered as "eligible" for the block
(e.g. only diamond pick eligible for obsidian) (e.g. only diamond pick eligible for obsidian)
@ -43,13 +43,13 @@ this field is a table which defines which groups the tool can dig and how
efficiently. efficiently.
_mcl_diggroups = { _mcl_diggroups = {
handy = { speed = 1, level = 1, uses = 0 }, handy = { tool_multiplier = 1, level = 1, uses = 0 },
pickaxey = { speed = 1, level = 0, uses = 0 }, pickaxey = { tool_multiplier = 1, level = 0, uses = 0 },
} }
The "uses" field indicate how many uses (0 for infinite) a tool has when used on The "uses" field indicate how many uses (0 for infinite) a tool has when used on
the specified digging group. The "speed" field is a multiplier to the dig speed the specified digging group. The "tool_multiplier" field is a multiplier to the
on that digging group. dig speed on that digging group.
The "level" field indicates which levels of the group the tool can harvest. A The "level" field indicates which levels of the group the tool can harvest. A
level of 0 means that the tool cannot harvest blocks of that node. A level of 1 level of 0 means that the tool cannot harvest blocks of that node. A level of 1
@ -69,8 +69,6 @@ This also means that it is very important that no mod adds _mcl_autogroup as a
dependency. dependency.
--]] --]]
assert(minetest.get_modpath("mcl_autogroup"), "This mod requires the mod mcl_autogroup to function")
-- Returns a table containing the unique "_mcl_hardness" for nodes belonging to -- Returns a table containing the unique "_mcl_hardness" for nodes belonging to
-- each diggroup. -- each diggroup.
local function get_hardness_values_for_groups() local function get_hardness_values_for_groups()
@ -137,18 +135,19 @@ end
-- Parameters: -- Parameters:
-- group - the group which it is digging -- group - the group which it is digging
-- can_harvest - if the tool can harvest the block -- can_harvest - if the tool can harvest the block
-- speed - dig speed multiplier for tool (default 1) -- tool_multiplier - dig speed multiplier for tool (default 1)
-- efficiency - efficiency level for the tool if applicable -- efficiency - efficiency level for the tool if applicable
local function get_digtimes(group, can_harvest, speed, efficiency) local function get_digtimes(group, can_harvest, tool_multiplier, efficiency)
local speed = speed or 1 tool_multiplier = tool_multiplier or 1
local speed_multiplier = tool_multiplier
if efficiency then if efficiency then
speed = speed + efficiency * efficiency + 1 speed_multiplier = speed_multiplier + efficiency * efficiency + 1
end end
local digtimes = {} local digtimes = {}
for index, hardness in pairs(hardness_values[group]) do for index, hardness in pairs(hardness_values[group]) do
local digtime = (hardness or 0) / speed local digtime = (hardness or 0) / speed_multiplier
if can_harvest then if can_harvest then
digtime = digtime * 1.5 digtime = digtime * 1.5
else else
@ -179,7 +178,7 @@ end
-- tool. -- tool.
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency) local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
for g, capsdef in pairs(groupcaps_def) do for g, capsdef in pairs(groupcaps_def) do
local mult = capsdef.speed or 1 local mult = capsdef.tool_multiplier or 1
local uses = capsdef.uses local uses = capsdef.uses
local def = mcl_autogroup.registered_diggroups[g] local def = mcl_autogroup.registered_diggroups[g]
local max_level = def.levels and #def.levels or 1 local max_level = def.levels and #def.levels or 1
@ -210,7 +209,7 @@ function mcl_autogroup.can_harvest(nodename, toolname)
-- Check if it can be dug by tool -- Check if it can be dug by tool
local tdef = minetest.registered_tools[toolname] local tdef = minetest.registered_tools[toolname]
if tdef and tdef._mcl_diggroups then if tdef then
for g, gdef in pairs(tdef._mcl_diggroups) do for g, gdef in pairs(tdef._mcl_diggroups) do
if ndef.groups[g] then if ndef.groups[g] then
if ndef.groups[g] <= gdef.level then if ndef.groups[g] <= gdef.level then

View File

@ -12,8 +12,6 @@ as possible. Minetest loads mods in reverse alphabetical order.
mcl_autogroup = {} mcl_autogroup = {}
mcl_autogroup.registered_diggroups = {} mcl_autogroup.registered_diggroups = {}
assert(minetest.get_modpath("_mcl_autogroup"), "This mod requires the mod _mcl_autogroup to function")
-- Register a group as a digging group. -- Register a group as a digging group.
-- --
-- Parameters: -- Parameters:

View File

@ -33,26 +33,25 @@ mcl_vars.MAP_BLOCKSIZE = math.max(1, core.MAP_BLOCKSIZE or 16)
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000) mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, core.MAX_MAP_GENERATION_LIMIT or 31000) mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, core.MAX_MAP_GENERATION_LIMIT or 31000)
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2) local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE local chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
mcl_vars.chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
local central_chunk_max_pos = central_chunk_min_pos + mcl_vars.chunk_size_in_nodes - 1 local central_chunk_max_pos = central_chunk_min_pos + chunk_size_in_nodes - 1
local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes
local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE) local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE
local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1 local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1
local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / mcl_vars.chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk
local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / mcl_vars.chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits. local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits.
mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * mcl_vars.chunk_size_in_nodes mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * chunk_size_in_nodes
mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * mcl_vars.chunk_size_in_nodes mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * chunk_size_in_nodes
local function coordinate_to_block(x) local function coordinate_to_block(x)
return math.floor(x / mcl_vars.MAP_BLOCKSIZE) return math.floor(x / mcl_vars.MAP_BLOCKSIZE)
end end
local function coordinate_to_chunk(x) local function coordinate_to_chunk(x)
return math.floor((coordinate_to_block(x) - central_chunk_offset) / mcl_vars.chunksize) return math.floor((coordinate_to_block(x) + central_chunk_offset) / mcl_vars.chunksize)
end end
function mcl_vars.pos_to_block(pos) function mcl_vars.pos_to_block(pos)
@ -71,7 +70,7 @@ function mcl_vars.pos_to_chunk(pos)
} }
end end
local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / mcl_vars.chunk_size_in_nodes) local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / chunk_size_in_nodes)
local k_positive_z = k_positive * 2 local k_positive_z = k_positive * 2
local k_positive_y = k_positive_z * k_positive_z local k_positive_y = k_positive_z * k_positive_z

View File

@ -6,7 +6,7 @@ mcl_worlds = {}
function mcl_worlds.is_in_void(pos) function mcl_worlds.is_in_void(pos)
local void = local void =
not ((pos.y < mcl_vars.mg_overworld_max and pos.y > mcl_vars.mg_overworld_min) or not ((pos.y < mcl_vars.mg_overworld_max and pos.y > mcl_vars.mg_overworld_min) or
(pos.y < mcl_vars.mg_nether_max+128 and pos.y > mcl_vars.mg_nether_min) or (pos.y < mcl_vars.mg_nether_max and pos.y > mcl_vars.mg_nether_min) or
(pos.y < mcl_vars.mg_end_max and pos.y > mcl_vars.mg_end_min)) (pos.y < mcl_vars.mg_end_max and pos.y > mcl_vars.mg_end_min))
local void_deadly = false local void_deadly = false
@ -15,11 +15,11 @@ function mcl_worlds.is_in_void(pos)
-- Overworld → Void → End → Void → Nether → Void -- Overworld → Void → End → Void → Nether → Void
if pos.y < mcl_vars.mg_overworld_min and pos.y > mcl_vars.mg_end_max then if pos.y < mcl_vars.mg_overworld_min and pos.y > mcl_vars.mg_end_max then
void_deadly = pos.y < mcl_vars.mg_overworld_min - deadly_tolerance void_deadly = pos.y < mcl_vars.mg_overworld_min - deadly_tolerance
elseif pos.y < mcl_vars.mg_end_min and pos.y > mcl_vars.mg_nether_max+128 then elseif pos.y < mcl_vars.mg_end_min and pos.y > mcl_vars.mg_nether_max then
-- The void between End and Nether. Like usual, but here, the void -- The void between End and Nether. Like usual, but here, the void
-- *above* the Nether also has a small tolerance area, so player -- *above* the Nether also has a small tolerance area, so player
-- can fly above the Nether without getting hurt instantly. -- can fly above the Nether without getting hurt instantly.
void_deadly = (pos.y < mcl_vars.mg_end_min - deadly_tolerance) and (pos.y > mcl_vars.mg_nether_max+128 + deadly_tolerance) void_deadly = (pos.y < mcl_vars.mg_end_min - deadly_tolerance) and (pos.y > mcl_vars.mg_nether_max + deadly_tolerance)
elseif pos.y < mcl_vars.mg_nether_min then elseif pos.y < mcl_vars.mg_nether_min then
void_deadly = pos.y < mcl_vars.mg_nether_min - deadly_tolerance void_deadly = pos.y < mcl_vars.mg_nether_min - deadly_tolerance
end end
@ -35,7 +35,7 @@ end
function mcl_worlds.y_to_layer(y) function mcl_worlds.y_to_layer(y)
if y >= mcl_vars.mg_overworld_min then if y >= mcl_vars.mg_overworld_min then
return y - mcl_vars.mg_overworld_min, "overworld" return y - mcl_vars.mg_overworld_min, "overworld"
elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max+128 then elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max then
return y - mcl_vars.mg_nether_min, "nether" return y - mcl_vars.mg_nether_min, "nether"
elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then
return y - mcl_vars.mg_end_min, "end" return y - mcl_vars.mg_end_min, "end"
@ -73,7 +73,7 @@ end
-- Takes a position and returns true if this position can have Nether dust -- Takes a position and returns true if this position can have Nether dust
function mcl_worlds.has_dust(pos) function mcl_worlds.has_dust(pos)
-- Weather in the Overworld and the high part of the void below -- Weather in the Overworld and the high part of the void below
return pos.y <= mcl_vars.mg_nether_max + 138 and pos.y >= mcl_vars.mg_nether_min - 10 return pos.y <= mcl_vars.mg_nether_max + 64 and pos.y >= mcl_vars.mg_nether_min - 64
end end
-- Takes a position (pos) and returns true if compasses are working here -- Takes a position (pos) and returns true if compasses are working here

View File

@ -165,6 +165,10 @@ minetest.register_globalstep(function(dtime)
end end
end) end)
local minigroups = { "shearsy", "swordy", "shearsy_wool", "swordy_cobweb" }
local basegroups = { "pickaxey", "axey", "shovely" }
local materials = { "wood", "gold", "stone", "iron", "diamond" }
-- Stupid workaround to get drops from a drop table: -- Stupid workaround to get drops from a drop table:
-- Create a temporary table in minetest.registered_nodes that contains the proper drops, -- Create a temporary table in minetest.registered_nodes that contains the proper drops,
-- because unfortunately minetest.get_node_drops needs the drop table to be inside a registered node definition -- because unfortunately minetest.get_node_drops needs the drop table to be inside a registered node definition

View File

@ -2826,7 +2826,7 @@ local falling = function(self, pos)
end end
if mcl_portals ~= nil then if mcl_portals ~= nil then
if mcl_portals.nether_portal_cooloff(self.object) then if mcl_portals.nether_portal_cooloff[self.object] then
return false -- mob has teleported through Nether portal - it's 99% not falling return false -- mob has teleported through Nether portal - it's 99% not falling
end end
end end
@ -2856,18 +2856,6 @@ local falling = function(self, pos)
self.object:set_acceleration({x = 0, y = 0, z = 0}) self.object:set_acceleration({x = 0, y = 0, z = 0})
end end
if minetest.registered_nodes[node_ok(pos).name].groups.lava then
if self.floats_on_lava == 1 then
self.object:set_acceleration({
x = 0,
y = -self.fall_speed / (max(1, v.y) ^ 2),
z = 0
})
end
end
-- in water then float up -- in water then float up
if minetest.registered_nodes[node_ok(pos).name].groups.water then if minetest.registered_nodes[node_ok(pos).name].groups.water then
@ -3785,7 +3773,6 @@ minetest.register_entity(name, {
knock_back = def.knock_back ~= false, knock_back = def.knock_back ~= false,
shoot_offset = def.shoot_offset or 0, shoot_offset = def.shoot_offset or 0,
floats = def.floats or 1, -- floats in water by default floats = def.floats or 1, -- floats in water by default
floats_on_lava = def.floats_on_lava or 0,
replace_rate = def.replace_rate, replace_rate = def.replace_rate,
replace_what = def.replace_what, replace_what = def.replace_what,
replace_with = def.replace_with, replace_with = def.replace_with,

View File

@ -38,7 +38,6 @@ mcl_weather.reg_weathers["none"] = {
local storage = minetest.get_mod_storage() local storage = minetest.get_mod_storage()
-- Save weather into mod storage, so it can be loaded after restarting the server -- Save weather into mod storage, so it can be loaded after restarting the server
local save_weather = function() local save_weather = function()
if not mcl_weather.end_time then return end
storage:set_string("mcl_weather_state", mcl_weather.state) storage:set_string("mcl_weather_state", mcl_weather.state)
storage:set_int("mcl_weather_end_time", mcl_weather.end_time) storage:set_int("mcl_weather_end_time", mcl_weather.end_time)
minetest.log("verbose", "[mcl_weather] Weather data saved: state="..mcl_weather.state.." end_time="..mcl_weather.end_time) minetest.log("verbose", "[mcl_weather] Weather data saved: state="..mcl_weather.state.." end_time="..mcl_weather.end_time)

View File

@ -16,17 +16,23 @@ local dir_to_pitch = function(dir)
end end
local random_arrow_positions = function(positions, placement) local random_arrow_positions = function(positions, placement)
local min = 0
local max = 0
if positions == 'x' then if positions == 'x' then
return math.random(-4, 4) min = -4
max = 4
elseif positions == 'y' then elseif positions == 'y' then
return math.random(0, 10) min = 0
max = 10
end end
if placement == 'front' and positions == 'z' then if placement == 'front' and positions == 'z' then
return 3 min = 3
max = 3
elseif placement == 'back' and positions == 'z' then elseif placement == 'back' and positions == 'z' then
return -3 min = -3
max = -3
end end
return 0 return math.random(max, min)
end end
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements") local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
@ -298,8 +304,8 @@ ARROW_ENTITY.on_step = function(self, dtime)
else else
self._attach_parent = 'Body' self._attach_parent = 'Body'
end end
self._z_rotation = math.random(-30, 30) self._z_rotation = math.random(30, -30)
self._y_rotation = math.random( -30, 30) self._y_rotation = math.random(30, -30)
self.object:set_attach(obj, self._attach_parent, {x=self._x_position,y=self._y_position,z=random_arrow_positions('z', placement)}, {x=0,y=self._rotation_station + self._y_rotation,z=self._z_rotation}) self.object:set_attach(obj, self._attach_parent, {x=self._x_position,y=self._y_position,z=random_arrow_positions('z', placement)}, {x=0,y=self._rotation_station + self._y_rotation,z=self._z_rotation})
minetest.after(150, function() minetest.after(150, function()
self.object:remove() self.object:remove()

View File

@ -209,46 +209,21 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
new_bucket = ItemStack({name = liquiddef.itemname}) new_bucket = ItemStack({name = liquiddef.itemname})
end end
minetest.add_node(pointed_thing.under, {name="air"}) minetest.set_node(pointed_thing.under, {name="air"})
sound_take(nn, pointed_thing.under) sound_take(nn, pointed_thing.under)
if mod_doc and doc.entry_exists("nodes", nn) then if mod_doc and doc.entry_exists("nodes", nn) then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn) doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn)
end end
elseif nn == "mcl_cauldrons:cauldron_3" then elseif minetest.get_item_group(nn, "cauldron") then
-- Take water out of full cauldron new_bucket = mcl_cauldrons.take_cauldron(pointed_thing.under, new_bucket, user)
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
if not minetest.is_creative_enabled(user:get_player_name()) then
new_bucket = ItemStack("mcl_buckets:bucket_water")
end
sound_take("mcl_core:water_source", pointed_thing.under)
elseif nn == "mcl_cauldrons:cauldron_3r" then
-- Take river water out of full cauldron
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
if not minetest.is_creative_enabled(user:get_player_name()) then
new_bucket = ItemStack("mcl_buckets:bucket_river_water")
end
sound_take("mclx_core:river_water_source", pointed_thing.under)
end end
-- Add liquid bucket and put it into inventory, if possible. -- Add liquid bucket and put it into inventory, if possible.
-- Drop new bucket otherwise. -- Drop new bucket otherwise.
if new_bucket then if minetest.is_creative_enabled(user:get_player_name()) then --TODO
if itemstack:get_count() == 1 then itemstack:take_item()
return new_bucket
else
local inv = user:get_inventory()
if inv:room_for_item("main", new_bucket) then
inv:add_item("main", new_bucket)
else
minetest.add_item(user:get_pos(), new_bucket)
end
if not minetest.is_creative_enabled(user:get_player_name()) then
itemstack:take_item()
end
return itemstack
end
end end
end, end,
_on_dispense = function(stack, pos, droppos, dropnode, dropdir) _on_dispense = function(stack, pos, droppos, dropnode, dropdir)

View File

@ -1,6 +1,6 @@
name = mcl_buckets name = mcl_buckets
author = Kahrl author = Kahrl
description = description =
depends = mcl_worlds depends = mcl_worlds, mcl_cauldrons
optional_depends = mcl_core, mclx_core, doc optional_depends = mcl_core, mclx_core, doc

View File

@ -61,7 +61,7 @@ if mod_mcl_core then
if minetest.get_item_group(nn, "cauldron") ~= 0 then if minetest.get_item_group(nn, "cauldron") ~= 0 then
-- Put water into cauldron -- Put water into cauldron
if nn ~= "mcl_cauldrons:cauldron_3" then if nn ~= "mcl_cauldrons:cauldron_3" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"}) mcl_cauldrons.set_cauldron_level(pos, "water", 3)
end end
sound_place("mcl_core:water_source", pos) sound_place("mcl_core:water_source", pos)
return false return false
@ -104,7 +104,7 @@ if mod_mclx_core then
if minetest.get_item_group(nn, "cauldron") ~= 0 then if minetest.get_item_group(nn, "cauldron") ~= 0 then
-- Put water into cauldron -- Put water into cauldron
if nn ~= "mcl_cauldrons:cauldron_3r" then if nn ~= "mcl_cauldrons:cauldron_3r" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3r"}) mcl_cauldrons.set_cauldron(pos, "river_water", 3)
end end
sound_place("mcl_core:water_source", pos) sound_place("mcl_core:water_source", pos)
return false return false

View File

@ -0,0 +1,24 @@
# mcl_cauldrons
This mod add an API to add cauldrons to mcl.
## mcl_cauldrons.is_cauldron(name)
return true if name is cauldron, false overwise.
## mcl_cauldrons.take_cauldron(pos, itemstack, user, sounds)
empty cauldron at `pos`
return `bucket` field of the cauldron def if user is player, itemstack overwise.
* pos: position of the cauldron
* itemstack: will be return if `bucket` field isn't defined in cauldron def or user is nil or not player.
* user: player who takes cauldron
* sounds: sounds table. If not nil, dug sound will be played.
## mcl_cauldrons.register_cauldron_type(def)
def can have these fields:
* name: name of the liquid e.g: "water"
* bucket: string of the bucket item. can be nil. e.g: "mcl_buckets:bucket_water"
* desc: description of the item. %s will be replaced by the level. e.g: "Water Cauldron %s/3 full"
* texture: texture of the flowing liquid e.g: "mcl_core_water_flowing.png"
## mcl_cauldrons.registered_cauldrons
Table containing chauldrons def indexed by name.

View File

@ -1,8 +1,31 @@
local S = minetest.get_translator("mcl_cauldron") local S = minetest.get_translator("mcl_cauldron")
mcl_cauldrons = {}
-- Cauldron mod, adds cauldrons. -- Cauldron mod, adds cauldrons.
-- TODO: Extinguish fire of burning entities local function give_item(user, itemstack)
local inv = user:get_inventory()
if inv then
--[[if false then --minetest.is_creative_enabled(user:get_player_name()) then
if inv:contains_item("main", itemstack) then
return false
else
if inv:room_for_item("main", itemstack) then
inv:add_item("main", itemstack)
else
minetest.add_item(user:get_pos(), itemstack)
end
end
else]]
if inv:room_for_item("main", itemstack) then
inv:add_item("main", itemstack)
else
minetest.add_item(user:get_pos(), itemstack)
end
--end
end
return itemstack
end
-- Convenience function because the cauldron nodeboxes are very similar -- Convenience function because the cauldron nodeboxes are very similar
local create_cauldron_nodebox = function(water_level) local create_cauldron_nodebox = function(water_level)
@ -41,7 +64,8 @@ for w=0,3 do
cauldron_nodeboxes[w] = create_cauldron_nodebox(w) cauldron_nodeboxes[w] = create_cauldron_nodebox(w)
end end
mcl_cauldrons.registered_cauldrons = {}
--local cauldrons_list = {}
-- Empty cauldron -- Empty cauldron
minetest.register_node("mcl_cauldrons:cauldron", { minetest.register_node("mcl_cauldrons:cauldron", {
description = S("Cauldron"), description = S("Cauldron"),
@ -67,53 +91,144 @@ minetest.register_node("mcl_cauldrons:cauldron", {
_mcl_blast_resistance = 2, _mcl_blast_resistance = 2,
}) })
-- Template function for cauldrons with water function mcl_cauldrons.set_cauldron_level(pos, type, level)
local register_filled_cauldron = function(water_level, description, river_water) return minetest.set_node(pos, {name = mcl_cauldrons.get_cauldron_string(type, level)})
local id = "mcl_cauldrons:cauldron_"..water_level end
local water_tex
if river_water then
id = id .. "r"
water_tex = "default_river_water_source_animated.png^[verticalframe:16:0"
else
water_tex = "default_water_source_animated.png^[verticalframe:16:0"
end
minetest.register_node(id, {
description = description,
_doc_items_create_entry = false,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level), cauldron_filled=water_level, comparator_signal=water_level},
node_box = cauldron_nodeboxes[water_level],
collision_box = cauldron_nodeboxes[0],
selection_box = { type = "regular" },
tiles = {
"("..water_tex..")^mcl_cauldrons_cauldron_top.png",
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
"mcl_cauldrons_cauldron_side.png"
},
sounds = mcl_sounds.node_sound_metal_defaults(),
drop = "mcl_cauldrons:cauldron",
_mcl_hardness = 2,
_mcl_blast_resistance = 2,
})
-- Add entry aliases for the Help function mcl_cauldrons.get_cauldron_level(pos)
if minetest.get_modpath("doc") then local nn = minetest.get_node(pos)
doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", id) return minetest.get_item_group(nn.name, "cauldron")
end
function mcl_cauldrons.add_cauldron_level(pos, type, number)
local number = mcl_cauldrons.get_cauldron_level(pos) + number
if number > 4 then number = 4 end
if number < 1 then number = 1 end
mcl_cauldrons.set_cauldron_level(pos, type, number)
return number
end
function mcl_cauldrons.is_cauldron(name)
return minetest.get_item_group(name, "cauldron") ~= 0
end
function mcl_cauldrons.take_cauldron(pos, itemstack, user, sounds)
local nn = minetest.get_node(pos)
if mcl_cauldrons.registered_cauldrons[nn.name] and mcl_cauldrons.registered_cauldrons[nn.name].bucket then
if user and not minetest.is_creative_enabled(user:get_player_name()) then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron"})
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
return give_item(user, ItemStack(mcl_cauldrons.registered_cauldrons[nn.name].bucket))
else
minetest.set_node(pos, {name="mcl_cauldrons:cauldron"})
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
return itemstack
end
else
minetest.set_node(pos, {name="mcl_cauldrons:cauldron"})
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
return itemstack
end end
end end
-- Filled cauldrons (3 levels) function mcl_cauldrons.take_small_cauldron(pos, itemstack, user, sounds)
register_filled_cauldron(1, S("Cauldron (1/3 Water)")) local nn = minetest.get_node(pos)
register_filled_cauldron(2, S("Cauldron (2/3 Water)")) if mcl_cauldrons.registered_cauldrons[nn.name] and mcl_cauldrons.registered_cauldrons[nn.name].bottle then
register_filled_cauldron(3, S("Cauldron (3/3 Water)")) if user and not minetest.is_creative_enabled(user:get_player_name()) then
local number = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1)
if number ~= 0 then
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
local item_name = mcl_cauldrons.registered_cauldrons[nn.name].bottle
local inv = placer:get_inventory()
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
if minetest.is_creative_enabled(placer:get_player_name()) then
-- Don't replace empty bottle in creative for convenience reasons
if not inv:contains_item("main", item_name) then
inv:add_item("main", item_name)
end
elseif itemstack:get_count() == 1 then
return item_name
else
if inv:room_for_item("main", item_name) then
inv:add_item("main", item_name)
else
minetest.add_item(placer:get_pos(), item_name)
end
itemstack:take_item()
end
end
else
local number = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1)
if number ~= 0 then
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
end
return itemstack
end
else
local number = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1)
if number ~= 0 then
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
end
return itemstack
end
end
function mcl_cauldrons.get_cauldron_string(type, level)
if mcl_cauldrons.registered_cauldrons["mcl_cauldrons:cauldron_"..type.."_"..level] then
return "mcl_cauldrons:cauldron_"..type.."_"..level
elseif level == 0 then
return "mcl_cauldrons:cauldron"
else
minetest.log("warning", "[mcl_cauldrons] trying to get string from invalid cauldron params")
return "air"
end
end
function mcl_cauldrons.register_cauldron_type(def)
for water_level = 1,3 do
local id = "mcl_cauldrons:cauldron_"..def.name.."_"..water_level
mcl_cauldrons.registered_cauldrons[id] = def
minetest.register_node(id, {
description = string.format(def.desc, water_level),
_doc_items_create_entry = false,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level), cauldron_filled=water_level, comparator_signal=water_level},
node_box = cauldron_nodeboxes[water_level],
collision_box = cauldron_nodeboxes[0],
selection_box = { type = "regular" },
tiles = {
"("..def.texture.."^[verticalframe:16:0"..")^mcl_cauldrons_cauldron_top.png",
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
"mcl_cauldrons_cauldron_side.png"
},
sounds = mcl_sounds.node_sound_metal_defaults(),
drop = "mcl_cauldrons:cauldron",
_mcl_hardness = 2,
_mcl_blast_resistance = 2,
})
-- Add entry aliases for the Help
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", id)
end
end
end
mcl_cauldrons.register_cauldron_type({
name = "water",
bucket = "mcl_buckets:bucket_water",
bottle = "mcl_potions:water",
desc = S("Cauldron (%s/3 Water)"),
texture = "default_water_source_animated.png"
})
if minetest.get_modpath("mclx_core") then if minetest.get_modpath("mclx_core") then
register_filled_cauldron(1, S("Cauldron (1/3 River Water)"), true) --register_filled_cauldron(1, S("Cauldron (1/3 River Water)"), true)
register_filled_cauldron(2, S("Cauldron (2/3 River Water)"), true) --register_filled_cauldron(2, S("Cauldron (2/3 River Water)"), true)
register_filled_cauldron(3, S("Cauldron (3/3 River Water)"), true) --register_filled_cauldron(3, S("Cauldron (3/3 River Water)"), true)
end end
minetest.register_craft({ minetest.register_craft({
@ -141,3 +256,10 @@ minetest.register_abm({
end end
end end
}) })
for i = 1, 3 do --Backward compatibility
minetest.register_alias("mcl_cauldrons:cauldron_"..i, "mcl_cauldrons:cauldron_water_"..i)
end
for i = 1, 3 do
minetest.register_alias("mcl_cauldrons:cauldron_"..i.."r", "mcl_cauldrons:cauldron_river_water_"..i)
end

View File

@ -1,3 +1,4 @@
name = mcl_cauldrons name = mcl_cauldrons
description = Add cauldrons to mcl
depends = mcl_core, mcl_sounds depends = mcl_core, mcl_sounds
optional_depends = mclx_core, doc optional_depends = mclx_core, doc

View File

@ -19,7 +19,7 @@ function mcl_cocoas.place(itemstack, placer, pt, plantname)
-- Am I right-clicking on something that has a custom on_rightclick set? -- Am I right-clicking on something that has a custom on_rightclick set?
if placer and not placer:get_player_control().sneak then if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[under.name] and minetest.registered_nodes[under.name].on_rightclick then if minetest.registered_nodes[under.name] and minetest.registered_nodes[under.name].on_rightclick then
return minetest.registered_nodes[under.name].on_rightclick(pt.under, under, placer, itemstack) or itemstack return minetest.registered_nodes[under.name].on_rightclick(pointed_thing.under, under, placer, itemstack) or itemstack
end end
end end

View File

@ -14,7 +14,7 @@ mcl_autogroup.register_diggroup("shearsy_wool")
mcl_autogroup.register_diggroup("shearsy_cobweb") mcl_autogroup.register_diggroup("shearsy_cobweb")
mcl_autogroup.register_diggroup("swordy") mcl_autogroup.register_diggroup("swordy")
mcl_autogroup.register_diggroup("swordy_cobweb") mcl_autogroup.register_diggroup("swordy_cobweb")
mcl_autogroup.register_diggroup("hoey") mcl_autogroup.register_diggroup("creative_breakable")
-- Load files -- Load files
local modpath = minetest.get_modpath("mcl_core") local modpath = minetest.get_modpath("mcl_core")

View File

@ -108,19 +108,7 @@ local register_leaves = function(subname, description, longdesc, tiles, sapling,
tiles = tiles, tiles = tiles,
paramtype = "light", paramtype = "light",
stack_max = 64, stack_max = 64,
groups = { groups = {handy=1,shearsy=1,swordy=1, leafdecay=leafdecay_distance, flammable=2, leaves=1, deco_block=1, dig_by_piston=1, fire_encouragement=30, fire_flammability=60},
handy=1,
hoey=1,
shearsy=1,
swordy=1,
leafdecay=leafdecay_distance,
flammable=2,
leaves=1,
deco_block=1,
dig_by_piston=1,
fire_encouragement=30,
fire_flammability=60
},
drop = get_drops(0), drop = get_drops(0),
_mcl_shears_drop = true, _mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),

View File

@ -45,10 +45,6 @@ end
-- To make it more efficient it will first check a hash value to determine if -- To make it more efficient it will first check a hash value to determine if
-- the tool needs to be updated. -- the tool needs to be updated.
function mcl_enchanting.update_groupcaps(itemstack) function mcl_enchanting.update_groupcaps(itemstack)
if not itemstack:get_tool_capabilities() then
return
end
local name = itemstack:get_name() local name = itemstack:get_name()
local level = mcl_enchanting.get_enchantment(itemstack, "efficiency") local level = mcl_enchanting.get_enchantment(itemstack, "efficiency")
local groupcaps = get_efficiency_groupcaps(name, level) local groupcaps = get_efficiency_groupcaps(name, level)

View File

@ -78,9 +78,6 @@ minetest.register_tool("mcl_farming:hoe_wood", {
}, },
_repair_material = "group:wood", _repair_material = "group:wood",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = {
hoey = { speed = 2, level = 1, uses = 60 }
},
}) })
minetest.register_craft({ minetest.register_craft({
@ -121,9 +118,6 @@ minetest.register_tool("mcl_farming:hoe_stone", {
}, },
_repair_material = "mcl_core:cobble", _repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = {
hoey = { speed = 4, level = 3, uses = 132 }
},
}) })
minetest.register_craft({ minetest.register_craft({
@ -160,9 +154,6 @@ minetest.register_tool("mcl_farming:hoe_iron", {
}, },
_repair_material = "mcl_core:iron_ingot", _repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = {
hoey = { speed = 6, level = 4, uses = 251 }
},
}) })
minetest.register_craft({ minetest.register_craft({
@ -205,9 +196,6 @@ minetest.register_tool("mcl_farming:hoe_gold", {
}, },
_repair_material = "mcl_core:gold_ingot", _repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = {
hoey = { speed = 12, level = 2, uses = 33 }
},
}) })
minetest.register_craft({ minetest.register_craft({
@ -252,9 +240,6 @@ minetest.register_tool("mcl_farming:hoe_diamond", {
}, },
_repair_material = "mcl_core:diamond", _repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = {
hoey = { speed = 8, level = 5, uses = 1562 }
},
}) })
minetest.register_craft({ minetest.register_craft({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -146,7 +146,7 @@ minetest.register_node("mcl_farming:hay_block", {
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,
groups = {handy=1, hoey=1, flammable=2, fire_encouragement=60, fire_flammability=20, building_block=1, fall_damage_add_percent=-80}, groups = {handy=1, flammable=2, fire_encouragement=60, fire_flammability=20, building_block=1, fall_damage_add_percent=-80},
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
on_rotate = on_rotate, on_rotate = on_rotate,
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,

View File

@ -50,69 +50,69 @@ local alldirs=
-- 3 exptime variants because the animation is not tied to particle expiration time. -- 3 exptime variants because the animation is not tied to particle expiration time.
-- 3 colorized variants to imitate minecraft's -- 3 colorized variants to imitate minecraft's
local smoke_pdef_base = { local smoke_pdef_base = {
amount = 0.001, amount = 0.001,
time = 0, time = 0,
-- minpos = vector.add(pos, { x = -0.45, y = -0.45, z = -0.45 }), -- minpos = vector.add(pos, { x = -0.45, y = -0.45, z = -0.45 }),
-- maxpos = vector.add(pos, { x = 0.45, y = 0.45, z = 0.45 }), -- maxpos = vector.add(pos, { x = 0.45, y = 0.45, z = 0.45 }),
minvel = { x = -0.1, y = 0.3, z = -0.1 }, minvel = { x = -0.1, y = 0.3, z = -0.1 },
maxvel = { x = 0.1, y = 1.6, z = 0.1 }, maxvel = { x = 0.1, y = 1.6, z = 0.1 },
-- minexptime = 3 exptime variants, -- minexptime = 3 exptime variants,
-- maxexptime = 3 exptime variants -- maxexptime = 3 exptime variants
minsize = 4.0, minsize = 4.0,
maxsize = 4.5, maxsize = 4.5,
-- texture = "mcl_particles_smoke_anim.png^[colorize:#000000:(3 colourize variants)", -- texture = "mcl_particles_smoke_anim.png^[colorize:#000000:(3 colourize variants)",
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
aspect_w = 8, aspect_w = 8,
aspect_h = 8, aspect_h = 8,
-- length = 3 exptime variants -- length = 3 exptime variants
}, },
collisiondetection = true, collisiondetection = true,
} }
local smoke_pdef_cached = {} local smoke_pdef_cached = {}
local spawn_smoke = function(pos) local spawn_smoke = function(pos)
local min = math.min local min = math.min
local new_minpos = vector.add(pos, { x = -0.45, y = -0.45, z = -0.45 }) local new_minpos = vector.add(pos, { x = -0.45, y = -0.45, z = -0.45 })
local new_maxpos = vector.add(pos, { x = 0.45, y = 0.45, z = 0.45 }) local new_maxpos = vector.add(pos, { x = 0.45, y = 0.45, z = 0.45 })
-- populate the cache -- populate the cache
if not next(smoke_pdef_cached) then if not next(smoke_pdef_cached) then
-- the last frame plays for 1/8 * N seconds, so we can take advantage of it -- the last frame plays for 1/8 * N seconds, so we can take advantage of it
-- to have varying exptime for each variant. -- to have varying exptime for each variant.
local exptimes = { 0.75, 1.5, 4.0 } local exptimes = { 0.75, 1.5, 4.0 }
local colorizes = { "199", "209", "243" } -- round(78%, 82%, 90% of 256) - 1 local colorizes = { "199", "209", "243" } -- round(78%, 82%, 90% of 256) - 1
local id = 1 local id = 1
for _,exptime in ipairs(exptimes) do for _,exptime in ipairs(exptimes) do
for _,colorize in ipairs(colorizes) do for _,colorize in ipairs(colorizes) do
smoke_pdef_base.minpos = new_minpos smoke_pdef_base.minpos = new_minpos
smoke_pdef_base.maxpos = new_maxpos smoke_pdef_base.maxpos = new_maxpos
smoke_pdef_base.maxexptime = exptime smoke_pdef_base.maxexptime = exptime
smoke_pdef_base.animation.length = exptime + 0.1 smoke_pdef_base.animation.length = exptime + 0.1
-- minexptime must be set such that the last frame is actully rendered, -- minexptime must be set such that the last frame is actully rendered,
-- even if its very short. Larger exptime -> larger range -- even if its very short. Larger exptime -> larger range
smoke_pdef_base.minexptime = min(exptime, (7.0/8.0 * (exptime + 0.1) + 0.1)) smoke_pdef_base.minexptime = min(exptime, (7.0/8.0 * (exptime + 0.1) + 0.1))
smoke_pdef_base.texture = "mcl_particles_smoke_anim.png^[colorize:#000000:" ..colorize smoke_pdef_base.texture = "mcl_particles_smoke_anim.png^[colorize:#000000:" ..colorize
smoke_pdef_cached[id] = table.copy(smoke_pdef_base) smoke_pdef_cached[id] = table.copy(smoke_pdef_base)
mcl_particles.add_node_particlespawner(pos, smoke_pdef_cached[id], "high") mcl_particles.add_node_particlespawner(pos, smoke_pdef_cached[id], "high")
id = id + 1 id = id + 1
end end
end end
-- cache already populated -- cache already populated
else else
for i, smoke_pdef in ipairs(smoke_pdef_cached) do for i, smoke_pdef in ipairs(smoke_pdef_cached) do
smoke_pdef.minpos = new_minpos smoke_pdef.minpos = new_minpos
smoke_pdef.maxpos = new_maxpos smoke_pdef.maxpos = new_maxpos
mcl_particles.add_node_particlespawner(pos, smoke_pdef, "high") mcl_particles.add_node_particlespawner(pos, smoke_pdef, "high")
end end
end end
--[[ Old smoke pdef --[[ Old smoke pdef
local spawn_smoke = function(pos) local spawn_smoke = function(pos)
mcl_particles.add_node_particlespawner(pos, { mcl_particles.add_node_particlespawner(pos, {
amount = 0.1, amount = 0.1,
time = 0, time = 0,
@ -132,7 +132,7 @@ local spawn_smoke = function(pos)
length = 2.1, length = 2.1,
}, },
}, "high") }, "high")
-- ]] -- ]]
end end

View File

@ -161,12 +161,6 @@ local function on_metadata_inventory_take(pos, listname, index, stack, player)
end end
end end
local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
if from_list == "dst" then
give_xp(pos, player)
end
end
local function spawn_flames(pos, param2) local function spawn_flames(pos, param2)
local minrelpos, maxrelpos local minrelpos, maxrelpos
local dir = minetest.facedir_to_dir(param2) local dir = minetest.facedir_to_dir(param2)
@ -483,12 +477,10 @@ minetest.register_node("mcl_furnaces:furnace", {
give_xp(pos) give_xp(pos)
end, end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) on_metadata_inventory_move = function(pos)
-- Reset accumulated game time when player works with furnace: -- Reset accumulated game time when player works with furnace:
furnace_reset_delta_time(pos) furnace_reset_delta_time(pos)
minetest.get_node_timer(pos):start(1.0) minetest.get_node_timer(pos):start(1.0)
on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
end, end,
on_metadata_inventory_put = function(pos) on_metadata_inventory_put = function(pos)
-- Reset accumulated game time when player works with furnace: -- Reset accumulated game time when player works with furnace:
@ -502,7 +494,9 @@ minetest.register_node("mcl_furnaces:furnace", {
-- start timer function, it will helpful if player clears dst slot -- start timer function, it will helpful if player clears dst slot
minetest.get_node_timer(pos):start(1.0) minetest.get_node_timer(pos):start(1.0)
on_metadata_inventory_take(pos, listname, index, stack, player) if listname == "dst" then
give_xp(pos, player)
end
end, end,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
@ -558,7 +552,6 @@ minetest.register_node("mcl_furnaces:furnace_active", {
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
on_metadata_inventory_move = on_metadata_inventory_move,
on_metadata_inventory_take = on_metadata_inventory_take, on_metadata_inventory_take = on_metadata_inventory_take,
on_receive_fields = receive_fields, on_receive_fields = receive_fields,
_mcl_blast_resistance = 3.5, _mcl_blast_resistance = 3.5,

View File

@ -176,7 +176,7 @@ minetest.register_node("mcl_nether:nether_wart_block", {
stack_max = 64, stack_max = 64,
tiles = {"mcl_nether_nether_wart_block.png"}, tiles = {"mcl_nether_nether_wart_block.png"},
is_ground_content = false, is_ground_content = false,
groups = {handy=1, hoey=1, building_block=1}, groups = {handy=1, building_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults( sounds = mcl_sounds.node_sound_leaves_defaults(
{ {
footstep={name="default_dirt_footstep", gain=0.7}, footstep={name="default_dirt_footstep", gain=0.7},

View File

@ -275,7 +275,7 @@ minetest.register_node("mcl_ocean:dried_kelp_block", {
description = S("Dried Kelp Block"), description = S("Dried Kelp Block"),
_doc_items_longdesc = S("A decorative block that serves as a great furnace fuel."), _doc_items_longdesc = S("A decorative block that serves as a great furnace fuel."),
tiles = { "mcl_ocean_dried_kelp_top.png", "mcl_ocean_dried_kelp_bottom.png", "mcl_ocean_dried_kelp_side.png" }, tiles = { "mcl_ocean_dried_kelp_top.png", "mcl_ocean_dried_kelp_bottom.png", "mcl_ocean_dried_kelp_side.png" },
groups = { handy = 1, hoey = 1, building_block = 1, flammable = 2, fire_encouragement = 30, fire_flammability = 60 }, groups = { handy = 1, building_block = 1, flammable = 2, fire_encouragement = 30, fire_flammability = 60 },
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,

View File

@ -1,4 +1,4 @@
name = mcl_portals name = mcl_portals
description = Adds buildable portals to the Nether and End dimensions. description = Adds buildable portals to the Nether and End dimensions.
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn depends = mcl_init, mcl_worlds, mcl_core, mcl_nether, mcl_end, mcl_particles, mcl_spawn
optional_depends = awards, doc optional_depends = awards, doc

File diff suppressed because it is too large Load Diff

View File

@ -75,61 +75,13 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
from_liquid_source = true from_liquid_source = true
river_water = node.name == "mclx_core:river_water_source" river_water = node.name == "mclx_core:river_water_source"
-- Or reduce water level of cauldron by 1 -- Or reduce water level of cauldron by 1
elseif string.sub(node.name, 1, 14) == "mcl_cauldrons:" then elseif mcl_cauldrons.is_cauldron(node.name) then
local pname = placer:get_player_name() local pname = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, pname) then if minetest.is_protected(pointed_thing.under, pname) then
minetest.record_protection_violation(pointed_thing.under, pname) minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack return itemstack
end end
if node.name == "mcl_cauldrons:cauldron_3" then mcl_cauldrons.take_small_cauldron(pointed_thing.under, itemstack, placer, {dug = "mcl_potions_bottle_fill"})
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"})
elseif node.name == "mcl_cauldrons:cauldron_2" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"})
elseif node.name == "mcl_cauldrons:cauldron_1" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
elseif node.name == "mcl_cauldrons:cauldron_3r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"})
elseif node.name == "mcl_cauldrons:cauldron_2r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1r"})
elseif node.name == "mcl_cauldrons:cauldron_1r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
end
end
if get_water then
local water_bottle
if river_water then
water_bottle = ItemStack("mcl_potions:river_water")
else
water_bottle = ItemStack("mcl_potions:water")
end
-- Replace with water bottle, if possible, otherwise
-- place the water potion at a place where's space
local inv = placer:get_inventory()
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
if minetest.is_creative_enabled(placer:get_player_name()) then
-- Don't replace empty bottle in creative for convenience reasons
if not inv:contains_item("main", water_bottle) then
inv:add_item("main", water_bottle)
end
elseif itemstack:get_count() == 1 then
return water_bottle
else
if inv:room_for_item("main", water_bottle) then
inv:add_item("main", water_bottle)
else
minetest.add_item(placer:get_pos(), water_bottle)
end
itemstack:take_item()
end
end end
end end
return itemstack return itemstack
@ -154,31 +106,6 @@ local potion_image = function(colorstring, opacity)
return "mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_potion_bottle.png" return "mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_potion_bottle.png"
end end
-- Cauldron fill up rules:
-- Adding any water increases the water level by 1, preserving the current water type
local cauldron_levels = {
-- start = { add water, add river water }
{ "", "_1", "_1r" },
{ "_1", "_2", "_2" },
{ "_2", "_3", "_3" },
{ "_1r", "_2r", "_2r" },
{ "_2r", "_3r", "_3r" },
}
local fill_cauldron = function(cauldron, water_type)
local base = "mcl_cauldrons:cauldron"
for i=1, #cauldron_levels do
if cauldron == base .. cauldron_levels[i][1] then
if water_type == "mclx_core:river_water_source" then
return base .. cauldron_levels[i][3]
else
return base .. cauldron_levels[i][2]
end
end
end
end
-- Itemstring of potions is “mcl_potions:<NBT Potion Tag>” -- Itemstring of potions is “mcl_potions:<NBT Potion Tag>”
minetest.register_craftitem("mcl_potions:water", { minetest.register_craftitem("mcl_potions:water", {

View File

@ -48,7 +48,7 @@ minetest.register_node("mcl_sponges:sponge", {
buildable_to = false, buildable_to = false,
stack_max = 64, stack_max = 64,
sounds = mcl_sounds.node_sound_dirt_defaults(), sounds = mcl_sounds.node_sound_dirt_defaults(),
groups = {handy=1, hoey=1, building_block=1}, groups = {handy=1, building_block=1},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pn = placer:get_player_name() local pn = placer:get_player_name()
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
@ -107,7 +107,7 @@ minetest.register_node("mcl_sponges:sponge_wet", {
buildable_to = false, buildable_to = false,
stack_max = 64, stack_max = 64,
sounds = mcl_sounds.node_sound_dirt_defaults(), sounds = mcl_sounds.node_sound_dirt_defaults(),
groups = {handy=1, hoey=1, building_block=1}, groups = {handy=1, building_block=1},
_mcl_blast_resistance = 0.6, _mcl_blast_resistance = 0.6,
_mcl_hardness = 0.6, _mcl_hardness = 0.6,
}) })

View File

@ -48,16 +48,15 @@ minetest.register_tool(":", {
}, },
groups = hand_groups, groups = hand_groups,
_mcl_diggroups = { _mcl_diggroups = {
handy = { speed = 1, level = 1, uses = 0 }, handy = { tool_multiplier = 1, level = 1, uses = 0 },
axey = { speed = 1, level = 1, uses = 0 }, axey = { tool_multiplier = 1, level = 1, uses = 0 },
shovely = { speed = 1, level = 1, uses = 0 }, shovely = { tool_multiplier = 1, level = 1, uses = 0 },
hoey = { speed = 1, level = 1, uses = 0 }, pickaxey = { tool_multiplier = 1, level = 0, uses = 0 },
pickaxey = { speed = 1, level = 0, uses = 0 }, swordy = { tool_multiplier = 1, level = 0, uses = 0 },
swordy = { speed = 1, level = 0, uses = 0 }, swordy_cobweb = { tool_multiplier = 1, level = 0, uses = 0 },
swordy_cobweb = { speed = 1, level = 0, uses = 0 }, shearsy = { tool_multiplier = 1, level = 0, uses = 0 },
shearsy = { speed = 1, level = 0, uses = 0 }, shearsy_wool = { tool_multiplier = 1, level = 0, uses = 0 },
shearsy_wool = { speed = 1, level = 0, uses = 0 }, shearsy_cobweb = { tool_multiplier = 1, level = 0, uses = 0 },
shearsy_cobweb = { speed = 1, level = 0, uses = 0 },
} }
}) })
@ -91,7 +90,7 @@ minetest.register_tool("mcl_tools:pick_wood", {
_repair_material = "group:wood", _repair_material = "group:wood",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
pickaxey = { speed = 2, level = 1, uses = 60 } pickaxey = { tool_multiplier = 2, level = 1, uses = 60 }
}, },
}) })
minetest.register_tool("mcl_tools:pick_stone", { minetest.register_tool("mcl_tools:pick_stone", {
@ -111,7 +110,7 @@ minetest.register_tool("mcl_tools:pick_stone", {
_repair_material = "mcl_core:cobble", _repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
pickaxey = { speed = 4, level = 3, uses = 132 } pickaxey = { tool_multiplier = 4, level = 3, uses = 132 }
}, },
}) })
minetest.register_tool("mcl_tools:pick_iron", { minetest.register_tool("mcl_tools:pick_iron", {
@ -131,7 +130,7 @@ minetest.register_tool("mcl_tools:pick_iron", {
_repair_material = "mcl_core:iron_ingot", _repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
pickaxey = { speed = 6, level = 4, uses = 251 } pickaxey = { tool_multiplier = 6, level = 4, uses = 251 }
}, },
}) })
minetest.register_tool("mcl_tools:pick_gold", { minetest.register_tool("mcl_tools:pick_gold", {
@ -151,7 +150,7 @@ minetest.register_tool("mcl_tools:pick_gold", {
_repair_material = "mcl_core:gold_ingot", _repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
pickaxey = { speed = 12, level = 2, uses = 33 } pickaxey = { tool_multiplier = 12, level = 2, uses = 33 }
}, },
}) })
minetest.register_tool("mcl_tools:pick_diamond", { minetest.register_tool("mcl_tools:pick_diamond", {
@ -171,7 +170,7 @@ minetest.register_tool("mcl_tools:pick_diamond", {
_repair_material = "mcl_core:diamond", _repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
pickaxey = { speed = 8, level = 5, uses = 1562 } pickaxey = { tool_multiplier = 8, level = 5, uses = 1562 }
}, },
}) })
@ -263,7 +262,7 @@ minetest.register_tool("mcl_tools:shovel_wood", {
_repair_material = "group:wood", _repair_material = "group:wood",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
shovely = { speed = 2, level = 1, uses = 60 } shovely = { tool_multiplier = 2, level = 1, uses = 60 }
}, },
}) })
minetest.register_tool("mcl_tools:shovel_stone", { minetest.register_tool("mcl_tools:shovel_stone", {
@ -284,7 +283,7 @@ minetest.register_tool("mcl_tools:shovel_stone", {
_repair_material = "mcl_core:cobble", _repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
shovely = { speed = 4, level = 3, uses = 132 } shovely = { tool_multiplier = 4, level = 3, uses = 132 }
}, },
}) })
minetest.register_tool("mcl_tools:shovel_iron", { minetest.register_tool("mcl_tools:shovel_iron", {
@ -305,7 +304,7 @@ minetest.register_tool("mcl_tools:shovel_iron", {
_repair_material = "mcl_core:iron_ingot", _repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
shovely = { speed = 6, level = 4, uses = 251 } shovely = { tool_multiplier = 6, level = 4, uses = 251 }
}, },
}) })
minetest.register_tool("mcl_tools:shovel_gold", { minetest.register_tool("mcl_tools:shovel_gold", {
@ -326,7 +325,7 @@ minetest.register_tool("mcl_tools:shovel_gold", {
_repair_material = "mcl_core:gold_ingot", _repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
shovely = { speed = 12, level = 2, uses = 33 } shovely = { tool_multiplier = 12, level = 2, uses = 33 }
}, },
}) })
minetest.register_tool("mcl_tools:shovel_diamond", { minetest.register_tool("mcl_tools:shovel_diamond", {
@ -347,7 +346,7 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
_repair_material = "mcl_core:diamond", _repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
shovely = { speed = 8, level = 5, uses = 1562 } shovely = { tool_multiplier = 8, level = 5, uses = 1562 }
}, },
}) })
@ -369,7 +368,7 @@ minetest.register_tool("mcl_tools:axe_wood", {
_repair_material = "group:wood", _repair_material = "group:wood",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
axey = { speed = 2, level = 1, uses = 60 } axey = { tool_multiplier = 2, level = 1, uses = 60 }
}, },
}) })
minetest.register_tool("mcl_tools:axe_stone", { minetest.register_tool("mcl_tools:axe_stone", {
@ -388,7 +387,7 @@ minetest.register_tool("mcl_tools:axe_stone", {
_repair_material = "mcl_core:cobble", _repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
axey = { speed = 4, level = 3, uses = 132 } axey = { tool_multiplier = 4, level = 3, uses = 132 }
}, },
}) })
minetest.register_tool("mcl_tools:axe_iron", { minetest.register_tool("mcl_tools:axe_iron", {
@ -408,7 +407,7 @@ minetest.register_tool("mcl_tools:axe_iron", {
_repair_material = "mcl_core:iron_ingot", _repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
axey = { speed = 6, level = 4, uses = 251 } axey = { tool_multiplier = 6, level = 4, uses = 251 }
}, },
}) })
minetest.register_tool("mcl_tools:axe_gold", { minetest.register_tool("mcl_tools:axe_gold", {
@ -427,7 +426,7 @@ minetest.register_tool("mcl_tools:axe_gold", {
_repair_material = "mcl_core:gold_ingot", _repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
axey = { speed = 12, level = 2, uses = 33 } axey = { tool_multiplier = 12, level = 2, uses = 33 }
}, },
}) })
minetest.register_tool("mcl_tools:axe_diamond", { minetest.register_tool("mcl_tools:axe_diamond", {
@ -446,7 +445,7 @@ minetest.register_tool("mcl_tools:axe_diamond", {
_repair_material = "mcl_core:diamond", _repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
axey = { speed = 8, level = 5, uses = 1562 } axey = { tool_multiplier = 8, level = 5, uses = 1562 }
}, },
}) })
@ -468,8 +467,8 @@ minetest.register_tool("mcl_tools:sword_wood", {
_repair_material = "group:wood", _repair_material = "group:wood",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
swordy = { speed = 2, level = 1, uses = 60 }, swordy = { tool_multiplier = 2, level = 1, uses = 60 },
swordy_cobweb = { speed = 2, level = 1, uses = 60 } swordy_cobweb = { tool_multiplier = 2, level = 1, uses = 60 }
}, },
}) })
minetest.register_tool("mcl_tools:sword_stone", { minetest.register_tool("mcl_tools:sword_stone", {
@ -488,8 +487,8 @@ minetest.register_tool("mcl_tools:sword_stone", {
_repair_material = "mcl_core:cobble", _repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
swordy = { speed = 4, level = 3, uses = 132 }, swordy = { tool_multiplier = 4, level = 3, uses = 132 },
swordy_cobweb = { speed = 4, level = 3, uses = 132 } swordy_cobweb = { tool_multiplier = 4, level = 3, uses = 132 }
}, },
}) })
minetest.register_tool("mcl_tools:sword_iron", { minetest.register_tool("mcl_tools:sword_iron", {
@ -508,8 +507,8 @@ minetest.register_tool("mcl_tools:sword_iron", {
_repair_material = "mcl_core:iron_ingot", _repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
swordy = { speed = 6, level = 4, uses = 251 }, swordy = { tool_multiplier = 6, level = 4, uses = 251 },
swordy_cobweb = { speed = 6, level = 4, uses = 251 } swordy_cobweb = { tool_multiplier = 6, level = 4, uses = 251 }
}, },
}) })
minetest.register_tool("mcl_tools:sword_gold", { minetest.register_tool("mcl_tools:sword_gold", {
@ -528,8 +527,8 @@ minetest.register_tool("mcl_tools:sword_gold", {
_repair_material = "mcl_core:gold_ingot", _repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
swordy = { speed = 12, level = 2, uses = 33 }, swordy = { tool_multiplier = 12, level = 2, uses = 33 },
swordy_cobweb = { speed = 12, level = 2, uses = 33 } swordy_cobweb = { tool_multiplier = 12, level = 2, uses = 33 }
}, },
}) })
minetest.register_tool("mcl_tools:sword_diamond", { minetest.register_tool("mcl_tools:sword_diamond", {
@ -548,8 +547,8 @@ minetest.register_tool("mcl_tools:sword_diamond", {
_repair_material = "mcl_core:diamond", _repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
swordy = { speed = 8, level = 5, uses = 1562 }, swordy = { tool_multiplier = 8, level = 5, uses = 1562 },
swordy_cobweb = { speed = 8, level = 5, uses = 1562 } swordy_cobweb = { tool_multiplier = 8, level = 5, uses = 1562 }
}, },
}) })
@ -570,9 +569,9 @@ minetest.register_tool("mcl_tools:shears", {
sound = { breaks = "default_tool_breaks" }, sound = { breaks = "default_tool_breaks" },
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
shearsy = { speed = 1.5, level = 1, uses = 238 }, shearsy = { tool_multiplier = 1.5, level = 1, uses = 238 },
shearsy_wool = { speed = 5, level = 1, uses = 238 }, shearsy_wool = { tool_multiplier = 5, level = 1, uses = 238 },
shearsy_cobweb = { speed = 15, level = 1, uses = 238 } shearsy_cobweb = { tool_multiplier = 15, level = 1, uses = 238 }
}, },
}) })

View File

@ -29,7 +29,7 @@ local function add_chunk(pos)
end end
prev = d prev = d
end end
chunks[#chunks+1] = {n, n} chunks[#chunks] = {n, n}
end end
function mcl_mapgen_core.is_generated(pos) function mcl_mapgen_core.is_generated(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int local n = mcl_vars.get_chunk_number(pos) -- unsigned int
@ -1790,8 +1790,6 @@ local generate_nether_decorations = function(minp, maxp, seed)
return return
end end
minetest.log("action", "[mcl_mapgen_core] Nether decorations " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp))
-- TODO: Generate everything based on Perlin noise instead of PseudoRandom -- TODO: Generate everything based on Perlin noise instead of PseudoRandom
local bpos local bpos
@ -1849,7 +1847,6 @@ local generate_nether_decorations = function(minp, maxp, seed)
end end
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.register_on_generated(function(minp, maxp, blockseed)
minetest.log("action", "[mcl_mapgen_core] Generating chunk " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp))
add_chunk(minp) add_chunk(minp)
local p1, p2 = {x=minp.x, y=minp.y, z=minp.z}, {x=maxp.x, y=maxp.y, z=maxp.z} local p1, p2 = {x=minp.x, y=minp.y, z=minp.z}, {x=maxp.x, y=maxp.y, z=maxp.z}
if lvm > 0 then if lvm > 0 then
@ -2135,32 +2132,24 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- * Replace water with Nether lava. -- * Replace water with Nether lava.
-- * Replace stone, sand dirt in v6 so the Nether works in v6. -- * Replace stone, sand dirt in v6 so the Nether works in v6.
elseif minp.y <= mcl_vars.mg_nether_max and maxp.y >= mcl_vars.mg_nether_min then elseif minp.y <= mcl_vars.mg_nether_max and maxp.y >= mcl_vars.mg_nether_min then
local nodes
if mg_name == "v6" then if mg_name == "v6" then
local nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"}) nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
for n=1, #nodes do
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
if data[p_pos] == c_water then
data[p_pos] = c_nether_lava
lvm_used = true
elseif data[p_pos] == c_stone then
data[p_pos] = c_netherrack
lvm_used = true
elseif data[p_pos] == c_sand or data[p_pos] == c_dirt then
data[p_pos] = c_soul_sand
lvm_used = true
end
end
else else
minetest.emerge_area(minp, maxp, function(blockpos, action, calls_remaining, param) nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source"})
if calls_remaining > 0 then return end end
-- local nodes = minetest.find_nodes_in_area(param.minp, param.maxp, {"mcl_core:water_source"}) for n=1, #nodes do
local nodes = minetest.find_nodes_in_area(param.minp, param.maxp, {"group:water"}) local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
local sn=(mcl_observers and mcl_observers.swap_node) or minetest.swap_node if data[p_pos] == c_water then
local l = {name="mcl_nether:nether_lava_source"} data[p_pos] = c_nether_lava
for _, n in pairs(nodes) do lvm_used = true
sn(n, l) elseif data[p_pos] == c_stone then
end data[p_pos] = c_netherrack
end, {minp=vector.new(minp), maxp=vector.new(maxp)}) lvm_used = true
elseif data[p_pos] == c_sand or data[p_pos] == c_dirt then
data[p_pos] = c_soul_sand
lvm_used = true
end
end end
-- End block fixes: -- End block fixes:

View File

@ -534,7 +534,7 @@ 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 | nether_portal | dungeon", params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | dungeon",
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)
@ -570,8 +570,6 @@ minetest.register_chatcommand("spawnstruct", {
mcl_structures.generate_end_portal_shrine(pos, rot, pr) mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then
mcl_dungeons.spawn_dungeon(pos, rot, pr) mcl_dungeons.spawn_dungeon(pos, rot, pr)
elseif param == "nether_portal" and mcl_portals and mcl_portals.spawn_nether_portal then
mcl_portals.spawn_nether_portal(pos, rot, pr, name)
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

@ -96,8 +96,6 @@ minetest.register_globalstep(function(dtime)
local player_velocity = player:get_velocity() or player:get_player_velocity() local player_velocity = player:get_velocity() or player:get_player_velocity()
local wielded = player:get_wielded_item()
-- controls head bone -- controls head bone
local pitch = - degrees(player:get_look_vertical()) local pitch = - degrees(player:get_look_vertical())
local yaw = degrees(player:get_look_horizontal()) local yaw = degrees(player:get_look_horizontal())
@ -109,19 +107,13 @@ minetest.register_globalstep(function(dtime)
player_vel_yaw = limit_vel_yaw(player_vel_yaw, yaw) player_vel_yaw = limit_vel_yaw(player_vel_yaw, yaw)
player_vel_yaws[name] = player_vel_yaw player_vel_yaws[name] = player_vel_yaw
-- controls right and left arms pitch when shooting a bow -- controls right and left arms pitch when shooting a bow or punching
if string.find(wielded:get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35)) player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35)) player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
-- when punching
elseif controls.LMB and player:get_attach() == nil then elseif controls.LMB and player:get_attach() == nil then
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0)) player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0))
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0)) player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
-- when holding an item.
elseif wielded:get_name() ~= "" then
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(20,0,0))
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
-- resets arms pitch
else else
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0)) player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0)) player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
@ -252,7 +244,13 @@ minetest.register_globalstep(function(dtime)
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4) playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
end end
end end
elseif get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then else
-- Reset speed decrease
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
end
-- Swimming? Check if boots are enchanted with depth strider
if get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then
local boots = player:get_inventory():get_stack("armor", 5) local boots = player:get_inventory():get_stack("armor", 5)
local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider") local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider")

View File

@ -106,18 +106,14 @@ minetest.register_entity("wieldview:wieldnode", {
if player then if player then
local wielded = player:get_wielded_item() local wielded = player:get_wielded_item()
local itemstring = wielded:get_name() local itemstring = wielded:get_name()
if self.itemstring ~= itemstring then if self.itemstring ~= itemstring then
local def = minetest.registered_items[itemstring] local def = minetest.registered_items[itemstring]
self.object:set_properties({glow = def and def.light_source or 0}) self.object:set_properties({glow = def and def.light_source or 0})
-- wield item as cubic
if armor.textures[self.wielder].wielditem == "blank.png" then if armor.textures[self.wielder].wielditem == "blank.png" then
self.object:set_properties({textures = {itemstring}}) self.object:set_properties({textures = {itemstring}})
else -- wield item as flat else
self.object:set_properties({textures = {""}}) self.object:set_properties({textures = {""}})
end end
self.itemstring = itemstring self.itemstring = itemstring
end end
else else