Compare commits

...

7 Commits

6 changed files with 23 additions and 17 deletions

View File

@ -1029,6 +1029,14 @@ local node_ok = function(pos, fallback)
return minetest.registered_nodes[fallback]
end
local function get_light(pos, tod)
if math.abs(pos.x) < 31000 and math.abs(pos.y) < 31000 and math.abs(pos.z) < 31000 then
local lightfunc = minetest.get_natural_light or minetest.get_node_light
return lightfunc(pos, tod)
else
return 0
end
end
-- environmental damage (water, lava, fire, light etc.)
local do_env_damage = function(self)
@ -1074,7 +1082,6 @@ local do_env_damage = function(self)
-- Use get_node_light for Minetest version 5.3 where get_natural_light
-- does not exist yet.
local get_light = minetest.get_natural_light or minetest.get_node_light
local sunlight = get_light(pos, self.time_of_day)
-- bright light harms mob

View File

@ -65,7 +65,7 @@ function mcl_bossbars.add_bar(player, def, dynamic, priority)
end
function mcl_bossbars.remove_bar(id)
mcl_bossbars.static[id].bar.id = nil
mcl_bossbars.static[id].id = nil
mcl_bossbars.static[id] = nil
end

View File

@ -501,7 +501,7 @@ function mcl_enchanting.show_enchanting_formspec(player)
local hover_ending = (can_enchant and "_hovered" or "_off")
formspec = formspec
.. "container[3.2," .. y .. "]"
.. (slot and "tooltip[button_" .. i .. ";" .. C(mcl_colors.GRAY) .. F(slot.description) .. " " .. C(mcl_colors.WHITE) .. " . . . ?\n\n" .. (enough_levels and C(enough_lapis and mcl_colors.GRAY or mcl_colors.RED) .. F(S("@1 Lapis Lazuli", i)) .. "\n" .. C(mcl_colors.GRAY) .. F(S("@1 Enchantment Levels", i)) or C(mcl_colors.RED) .. F(S("Level requirement: @1", slot.level_requirement))) .. "]" or "")
.. (slot and "tooltip[button_" .. i .. ";" .. C(mcl_colors.GRAY) .. ((slot.description and F(slot.description)) or "") .. " " .. C(mcl_colors.WHITE) .. " . . . ?\n\n" .. (enough_levels and C(enough_lapis and mcl_colors.GRAY or mcl_colors.RED) .. F(S("@1 Lapis Lazuli", i)) .. "\n" .. C(mcl_colors.GRAY) .. F(S("@1 Enchantment Levels", i)) or C(mcl_colors.RED) .. F(S("Level requirement: @1", slot.level_requirement))) .. "]" or "")
.. "style[button_" .. i .. ";bgimg=mcl_enchanting_button" .. ending .. ".png;bgimg_hovered=mcl_enchanting_button" .. hover_ending .. ".png;bgimg_pressed=mcl_enchanting_button" .. hover_ending .. ".png]"
.. "button[0,0;7.5,1.3;button_" .. i .. ";]"
.. (slot and "image[0,0;1.3,1.3;mcl_enchanting_number_" .. i .. ending .. ".png]" or "")

View File

@ -0,0 +1,2 @@
name = mcl_fireworks
description = Adds fun fireworks to the game which players can use.

View File

@ -27,9 +27,8 @@ local DELAY = 3 -- seconds before teleporting in Nether portal in Survival mo
local DISTANCE_MAX = 128
local PORTAL = "mcl_portals:portal"
local OBSIDIAN = "mcl_core:obsidian"
local O_Y_MIN, O_Y_MAX = max(mcl_vars.mg_overworld_min, -31), min(mcl_vars.mg_overworld_max_official, 2048)
local N_Y_MIN, N_Y_MAX = mcl_vars.mg_bedrock_nether_bottom_min, mcl_vars.mg_bedrock_nether_top_max - H_MIN
local O_DY, N_DY = O_Y_MAX - O_Y_MIN + 1, N_Y_MAX - N_Y_MIN + 1
local O_Y_MIN, O_Y_MAX = max(mcl_vars.mg_overworld_min, -31), min(mcl_vars.mg_overworld_max, 2048)
local N_Y_MIN, N_Y_MAX = mcl_vars.mg_bedrock_nether_bottom_min, mcl_vars.mg_bedrock_nether_top_min - H_MIN
-- Alpha and particles
local node_particles_allowed = minetest.settings:get("mcl_node_particles") or "none"
@ -78,6 +77,8 @@ local pos_to_string = minetest.pos_to_string
local is_area_protected = minetest.is_area_protected
local get_us_time = minetest.get_us_time
local dimension_to_teleport = { nether = "overworld", overworld = "nether" }
local limits = {
nether = {
pmin = {x=LIM_MIN, y = N_Y_MIN, z = LIM_MIN},
@ -181,10 +182,10 @@ local function get_target(p)
x, o1 = ping_pong(x, TRAVEL_X, LIM_MIN, LIM_MAX)
z, o2 = ping_pong(z, TRAVEL_Z, LIM_MIN, LIM_MAX)
y = floor(y * TRAVEL_Y + (o1+o2) / 16 * LIM_MAX)
y = min(max(y + mcl_vars.mg_overworld_min, mcl_vars.mg_overworld_min), mcl_vars.mg_overworld_max)
y = min(max(y + O_Y_MIN, O_Y_MIN), O_Y_MAX)
elseif d=="overworld" then
x, y, z = floor(x / TRAVEL_X + 0.5), floor(y / TRAVEL_Y + 0.5), floor(z / TRAVEL_Z + 0.5)
y = min(max(y + mcl_vars.mg_nether_min, mcl_vars.mg_nether_min), mcl_vars.mg_nether_max)
y = min(max(y + N_Y_MIN, N_Y_MIN), N_Y_MAX)
end
return {x=x, y=y, z=z}, d
end
@ -457,8 +458,8 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
local nodes = find_nodes_in_area_under_air(pos1, pos2, {"group:building_block"})
if nodes then
local nc = #nodes
log("action", "[mcl_portals] Area for destination Nether portal emerged! Found " .. tostring(nc) .. " nodes under the air around "..pos_to_string(pos))
if nc > 0 then
log("action", "[mcl_portals] Area for destination Nether portal emerged! Found " .. tostring(nc) .. " nodes under the air around "..pos_to_string(pos))
for i=1,nc do
local node = nodes[i]
local node1 = {x=node.x, y=node.y+1, z=node.z }
@ -474,7 +475,7 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
return
end
if not distance or (distance0 < distance) or (distance0 < distance-1 and node.y > lava and pos0.y < lava) then
log("action", "[mcl_portals] found distance "..tostring(distance0).." at pos "..pos_to_string(node))
log("verbose", "[mcl_portals] found distance "..tostring(distance0).." at pos "..pos_to_string(node))
distance = distance0
pos0 = {x=node1.x, y=node1.y, z=node1.z}
end
@ -626,7 +627,7 @@ end
-- Pos can be any of the inner part.
-- The frame MUST be filled only with air or any fire, which will be replaced with Nether portal blocks.
-- If no Nether portal can be lit, nothing happens.
-- Returns number of portals created (0, 1 or 2)
-- Returns true if portal created
function mcl_portals.light_nether_portal(pos)
-- Only allow to make portals in Overworld and Nether
local dim = mcl_worlds.pos_to_dimension(pos)
@ -636,11 +637,6 @@ function mcl_portals.light_nether_portal(pos)
local orientation = random(0, 1)
for orientation_iteration = 1, 2 do
if check_and_light_shape(pos, orientation) then
minetest.after(0.2, function(pos) -- generate target map chunk
local pos1 = add(mul(mcl_vars.pos_to_chunk(pos), mcl_vars.chunk_size_in_nodes), mcl_vars.central_chunk_offset_in_nodes)
local pos2 = add(pos1, mcl_vars.chunk_size_in_nodes - 1)
minetest.emerge_area(pos1, pos2)
end, vector.new(pos))
return true
end
orientation = 1 - orientation
@ -672,6 +668,7 @@ local function teleport_no_delay(obj, pos)
if exit then
finalize_teleport(obj, exit)
else
dim = dimension_to_teleport[dim]
-- need to create arrival portal
create_portal(target, limits[dim].pmin, limits[dim].pmax, name, obj)
end

View File

@ -156,7 +156,7 @@ minetest.register_globalstep(function(dtime)
for _,player in pairs(get_connected_players()) do
c_x, c_y = unpack(player_collision(player))
local c_x, c_y = unpack(player_collision(player))
if player:get_velocity().x + player:get_velocity().y < .5 and c_x + c_y > 0 then
--minetest.chat_send_player(player:get_player_name(), "pushed at " .. c_x + c_y .. " parsecs.")