forked from VoxeLibre/VoxeLibre
Compare commits
33 Commits
Author | SHA1 | Date |
---|---|---|
kay27 | 273aeaffd2 | |
kay27 | e5ccf63d7e | |
kay27 | 77e249af79 | |
kay27 | ae28007f36 | |
kay27 | 6bc8219c63 | |
kay27 | 8e43f042b4 | |
kay27 | 04a88fd244 | |
kay27 | f031120fe5 | |
kay27 | f7b290267d | |
iliekprogrammar | a18a87e247 | |
iliekprogrammar | dc462e2433 | |
iliekprogrammar | fd9ed93ea4 | |
iliekprogrammar | 69c855be1f | |
iliekprogrammar | 92941534f8 | |
kay27 | 53dcee99cb | |
kay27 | 3a585488b4 | |
kay27 | 45f2a26f1c | |
kay27 | ef395af838 | |
kay27 | 60fc57d878 | |
kay27 | 653a633adf | |
kay27 | f191be41db | |
kay27 | aa3e4c2846 | |
kay27 | b3cdb44410 | |
kay27 | 809b88f57d | |
kay27 | 4c9643fde9 | |
kay27 | e4840e4170 | |
kay27 | c4f4ede29a | |
kay27 | 7bd1bc23b1 | |
kay27 | 574c38c768 | |
ZeDique la Ruleta | 47312f86ed | |
epCode | 12192d1a8d | |
kay27 | 3a8900f905 | |
kay27 | 0d725252dc |
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
Loading…
Reference in New Issue