Compare commits

..

33 Commits

Author SHA1 Message Date
kay27 273aeaffd2 Fix constant name for survival mode in portals branch 2021-03-22 03:07:06 +04:00
kay27 e5ccf63d7e Fine tune Nether portals in portals branch 2021-03-22 02:47:57 +04:00
kay27 77e249af79 Merge remote-tracking branch 'origin/master' into portals 2021-03-21 23:36:11 +04:00
kay27 ae28007f36 Fix teleportation bugs (in portals branch) 2021-03-21 23:35:54 +04:00
kay27 6bc8219c63 Implement travel up, add debug info to compare 2 searches (to portals branch) 2021-03-21 15:00:12 +04:00
kay27 8e43f042b4 Merge remote-tracking branch 'origin/master' into portals 2021-03-21 13:06:06 +04:00
kay27 04a88fd244 Add yet another ugly hack to remove water from Nether v7 with Caverns option 2021-03-20 17:51:38 +04:00
kay27 f031120fe5 Merge remote-tracking branch 'origin/master' into portals 2021-03-20 16:54:59 +04:00
kay27 f7b290267d Merge remote-tracking branch 'origin/master' into portals 2021-03-20 12:18:51 +04:00
iliekprogrammar a18a87e247 Remove debug information... again :/ 2021-03-20 12:18:50 +04:00
iliekprogrammar dc462e2433 Fix indentation from iliekprogrammar's previous PRs 2021-03-20 12:18:50 +04:00
iliekprogrammar fd9ed93ea4 Move holding code into mcl_playerplus 2021-03-20 12:18:49 +04:00
iliekprogrammar 69c855be1f Remove debug information 2021-03-20 12:18:49 +04:00
iliekprogrammar 92941534f8 Slightly lift your right arm when holding an item. 2021-03-20 12:18:49 +04:00
kay27 53dcee99cb Make Nether portals work with Nether roof area (portals branch) 2021-03-19 22:39:41 +04:00
kay27 3a585488b4 Merge remote-tracking branch 'origin/master' into portals 2021-03-19 22:29:35 +04:00
kay27 45f2a26f1c Merge remote-tracking branch 'origin/master' into portals 2021-03-19 20:49:49 +04:00
kay27 ef395af838 Make portals branch fully playable (reduce y scale to 2), fix critical bugs 2021-03-19 12:34:07 +04:00
kay27 60fc57d878 Fix orientational bug in portals branch 2021-03-19 10:07:19 +04:00
kay27 653a633adf Add debug info, test alternative search algorithm in portals branch 2021-03-19 01:52:55 +04:00
kay27 f191be41db Add teleporters queue to avoid multiple searches (portals branch) 2021-03-18 23:04:03 +04:00
kay27 aa3e4c2846 Update mcl_portals/mod.conf (merge) 2021-03-18 22:30:30 +04:00
kay27 b3cdb44410 Add alternative suitable place search for Nether portals in portals branch 2021-03-18 17:55:29 +04:00
kay27 809b88f57d Localize several API functions for Nether portals 2021-03-18 10:39:18 +04:00
kay27 4c9643fde9 Merge remote-tracking branch 'origin/master' into portals 2021-03-18 03:36:51 +04:00
kay27 e4840e4170 Fix old bugs, add new bugs to Nether portals feature branch 2021-03-18 02:57:31 +04:00
kay27 c4f4ede29a Fix errors with Nether portal destination calcs 2021-03-17 18:13:40 +04:00
kay27 7bd1bc23b1 Fix chunk offset for building arrival Nether portal, log generating chunk coordinates 2021-03-17 17:49:14 +04:00
kay27 574c38c768 Merge remote-tracking branch 'origin/master' into portals 2021-03-17 16:40:19 +04:00
ZeDique la Ruleta 47312f86ed Chests now open 90 degrees, regardless
- Removed 'block' check with chests, they will always open 90 degrees regardless of what's behind them
2021-03-17 16:39:52 +04:00
epCode 12192d1a8d Fix #1277 2021-03-17 16:39:52 +04:00
kay27 3a8900f905 Restore mcl_farming_pumpkin_face_preview.png 2021-03-17 04:13:14 +04:00
kay27 0d725252dc Implement optimized Nether portals 2021-03-17 04:09:08 +04:00
5 changed files with 111 additions and 27 deletions

View File

@ -2856,18 +2856,6 @@ local falling = function(self, pos)
self.object:set_acceleration({x = 0, y = 0, z = 0})
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
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,
shoot_offset = def.shoot_offset or 0,
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_what = def.replace_what,
replace_with = def.replace_with,

View File

@ -38,7 +38,6 @@ mcl_weather.reg_weathers["none"] = {
local storage = minetest.get_mod_storage()
-- Save weather into mod storage, so it can be loaded after restarting the server
local save_weather = function()
if not mcl_weather.end_time then return end
storage:set_string("mcl_weather_state", mcl_weather.state)
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)

View File

@ -161,12 +161,6 @@ local function on_metadata_inventory_take(pos, listname, index, stack, player)
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 minrelpos, maxrelpos
local dir = minetest.facedir_to_dir(param2)
@ -483,12 +477,10 @@ minetest.register_node("mcl_furnaces:furnace", {
give_xp(pos)
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:
furnace_reset_delta_time(pos)
minetest.get_node_timer(pos):start(1.0)
on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
end,
on_metadata_inventory_put = function(pos)
-- 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
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,
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_move = allow_metadata_inventory_move,
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_receive_fields = receive_fields,
_mcl_blast_resistance = 3.5,

View File

@ -324,8 +324,10 @@ function build_nether_portal(pos, width, height, orientation, name)
local pp_1 = {x = x, y = pos.y - 2, z = z}
local nn = get_node(pp).name
local nn_1 = get_node(pp_1).name
log("warning", "[mcl_portals] pos=" .. pos_to_string(pp) .. " nn=" .. nn .. " name=" .. name .. " width=" .. tostring(width) .. " height=" .. tostring(height).." orientation=" ..tostring(orientation).." gc="..tostring(registered_nodes[nn].is_ground_content) .." for obsidian platform:")
if ((nn=="air" and nn_1 == "air") or not registered_nodes[nn].is_ground_content) and not is_protected(pp, name) then
set_node(pp, {name = OBSIDIAN})
minetest.log("warning", "set!")
end
end
end
@ -430,12 +432,96 @@ local function get_lava_level(pos, pos1, pos2)
return max(min(mcl_vars.mg_lava_nether_max, pos2.y-1), pos1.y+1)
end
local function ecb_scan_area(blockpos, action, calls_remaining, param)
if calls_remaining and calls_remaining > 0 then return end
local pos, pos1, pos2, name, obj = param.pos, param.pos1, param.pos2, param.name or "", param.obj
local lava = get_lava_level(pos, pos1, pos2)
local ttt1 = minetest.get_us_time() -- !!debug
-- loop in a spiral around pos
local cs, x, z, dx, dz, p0x, p0z, p1x, p1y, p1z, p2x, p2y, p2z = mcl_vars.chunk_size_in_nodes, 0, 0, 0, -1, pos.x, pos.z, pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z
local i_max = (cs*2-1) * (cs*2-1)
log("action", "[mcl_portals] Area for destination Nether portal emerged! We about to iterate " .. tostring(i_max) .. " positions of spiral around "..pos_to_string(pos))
local backup_pos, bnc = nil, 0 -- 'better than nothing'
local p1 = {x=0, y=p1y, z=0}
local p2 = {x=0, y=p2y, z=0}
for i = 1, i_max do
local px, pz = p0x + x, p0z + z
if ((i%100) == 1) then
log("action", "[mcl_portals] i=" ..tostring(i) .." px=" .. tostring(px) .." pz=" .. tostring(pz) .. " x:"..tostring(p1x) .."-"..tostring(p2x) .. " z:"..tostring(p1z) .."-"..tostring(p2z))
end
if px >= p1x and pz >= p1z and px <= p2x and pz <= p2z then
p1.x, p2.x, p1.z, p2.z = px, px, pz, pz
local nodes = find_nodes_in_area_under_air(p1, p2, {"group:building_block"})
log("action", "[mcl_portals] check " .. pos_to_string(p1) .. "-" .. pos_to_string(p2) .. ": " .. tostring(nodes and #nodes))
if nodes and #nodes > 0 then
for j = 1, #nodes do
local node = nodes[j]
if not is_protected(node, name) then
node.y = node.y + 2
local node2 = {x = node.x, y = node.y + 2, z = node.z}
if not is_protected(node2, name) then
local nodes_j = find_nodes_in_area(node, node2, {"air"})
local nc = #nodes_j
if nc >= 3 then
node2.x = node2.x + 2
node2.z = node2.z + 2
nodes_j = find_nodes_in_area(node, node2, {"air"})
if #nodes_j == 36 then
local msg1 = "DEBUG message: space found using algorithm 1, elapsed time: " .. tostring(minetest.get_us_time()-ttt1) .." us" -- !!debug
log("warning", "[mcl_portals] " .. msg1) -- !!debug
minetest.chat_send_all(msg1) -- !!debug
log("action", "[mcl_portals] found space at pos "..pos_to_string(node).." - creating a portal")
create_portal_2({x=node.x, y=node.y+1, z=node.z}, name, obj)
return
end
elseif nc > bnc or ((nc > max(bnc-2,0)) and backup_pos.y<lava and node.y > lava) then
bnc = nc
backup_pos = {x = node2.x, y = node2.y, z = node2.z}
log("action", "[mcl_portals] set backup pos "..pos_to_string(backup_pos).." with "..tostring(nc).." air node(s)")
end
end
end
end
end
end
if x == z or (x < 0 and x == -z) or (x > 0 and x == 1-z) then
dx, dz = -dz, dx
end
x, z = x+dx, z+dz
px, pz = p0x + x, p0z + z
end
if backup_pos then -- several nodes of air might be better than lava lake, right?
local msg1 = "DEBUG message: space partially found using algorithm 1, elapsed time: " .. tostring(minetest.get_us_time()-ttt1) .." us" -- !!debug
log("warning", "[mcl_portals] " .. msg1) -- !!debug
minetest.chat_send_all(msg1) -- !!debug
log("action", "[mcl_portals] using backup pos "..pos_to_string(backup_pos).." to create a portal")
create_portal_2(backup_pos, name, obj)
return
end
local msg1 = "DEBUG message: space not found using algorithm 1, elapsed time: " .. tostring(minetest.get_us_time()-ttt1) .." us" -- !!debug
log("warning", "[mcl_portals] " .. msg1) -- !!debug
minetest.chat_send_all(msg1) -- !!debug
log("action", "[mcl_portals] found no space, reverting to target pos "..pos_to_string(pos).." - creating a portal")
if pos.y < lava then
pos.y = lava + 1
else
pos.y = pos.y + 1
end
create_portal_2(pos, name, obj)
end
local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
if calls_remaining and calls_remaining > 0 then return end
local pos, pos1, pos2, name, obj = param.pos, param.pos1, param.pos2, param.name or "", param.obj
local pos0, distance
local lava = get_lava_level(pos, pos1, pos2)
local ttt2 = minetest.get_us_time() -- !!debug
local nodes = find_nodes_in_area_under_air(pos1, pos2, {"group:building_block"})
if nodes then
local nc = #nodes
@ -452,6 +538,9 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
if nc2 == 27 and not is_area_protected(node, node2, name) then
local distance0 = dist(pos, node)
if distance0 < 2 then
local msg1 = "DEBUG message: space found using algorithm 2, elapsed time: " .. tostring(minetest.get_us_time()-ttt2) .." us" -- !!debug
log("warning", "[mcl_portals] " .. msg1) -- !!debug
minetest.chat_send_all(msg1) -- !!debug
log("action", "[mcl_portals] found space at pos "..pos_to_string(node).." - creating a portal")
create_portal_2(node1, name, obj)
return
@ -467,10 +556,16 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
end
end
if distance then -- several nodes of air might be better than lava lake, right?
local msg1 = "DEBUG message: space partially found using algorithm 2, elapsed time: " .. tostring(minetest.get_us_time()-ttt2) .." us" -- !!debug
log("warning", "[mcl_portals] " .. msg1) -- !!debug
minetest.chat_send_all(msg1) -- !!debug
log("action", "[mcl_portals] using backup pos "..pos_to_string(pos0).." to create a portal")
create_portal_2(pos0, name, obj)
return
end
local msg1 = "DEBUG message: space not found using algorithm 2, elapsed time: " .. tostring(minetest.get_us_time()-ttt2) .." us" -- !!debug
log("warning", "[mcl_portals] " .. msg1) -- !!debug
minetest.chat_send_all(msg1) -- !!debug
log("action", "[mcl_portals] found no space, reverting to target pos "..pos_to_string(pos).." - creating a portal")
if pos.y < lava then
pos.y = lava + 1
@ -503,7 +598,11 @@ local function create_portal(pos, limit1, limit2, name, obj)
pos2 = {x = min(max(limit2.x, pos.x), pos2.x), y = min(max(limit2.y, pos.y), pos2.y), z = min(max(limit2.z, pos.z), pos2.z)}
end
minetest.emerge_area(pos1, pos2, ecb_scan_area_2, {pos = vector.new(pos), pos1 = pos1, pos2 = pos2, name=name, obj=obj})
if random(1,2) == 2 then
minetest.emerge_area(pos1, pos2, ecb_scan_area_2, {pos = vector.new(pos), pos1 = pos1, pos2 = pos2, name=name, obj=obj})
else
minetest.emerge_area(pos1, pos2, ecb_scan_area, {pos = vector.new(pos), pos1 = pos1, pos2 = pos2, name=name, obj=obj})
end
end
local function available_for_nether_portal(p)

View File

@ -252,7 +252,13 @@ minetest.register_globalstep(function(dtime)
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
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 depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider")