From 84764389dcd7034a3ad3a57f4fd35b18b08e5d20 Mon Sep 17 00:00:00 2001 From: Code-Sploit Date: Tue, 13 Apr 2021 11:34:53 +0000 Subject: [PATCH 1/4] Fix #1538 --- mods/ENTITIES/mobs_mc/enderman.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 6c87b9305..9c47e98fc 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -323,7 +323,7 @@ mobs:register_mob("mobs_mc:enderman", { -- self:teleport(nil) -- self.state = "" --else - if self.attack ~= nil then + if self.attack ~= nil and not minetest.settings:get_bool("creative_mode") then self.state = 'attack' end --end From 3077498a63a38e08adf25f344a0cf37c3b872886 Mon Sep 17 00:00:00 2001 From: kay27 Date: Tue, 13 Apr 2021 16:49:10 +0400 Subject: [PATCH 2/4] Fix screwdriver/door duplication glitch, https://git.minetest.land/MineClone2/MineClone2/issues/1149 --- mods/ITEMS/mcl_doors/api_doors.lua | 127 +++++++++++++++++++---------- 1 file changed, 86 insertions(+), 41 deletions(-) diff --git a/mods/ITEMS/mcl_doors/api_doors.lua b/mods/ITEMS/mcl_doors/api_doors.lua index f3dd0f469..909bb47e4 100644 --- a/mods/ITEMS/mcl_doors/api_doors.lua +++ b/mods/ITEMS/mcl_doors/api_doors.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mcl_doors") +local minetest_get_meta = minetest.get_meta -- This helper function calls on_place_node callbacks. local function on_place_node(place_to, newnode, @@ -164,14 +165,14 @@ function mcl_doors:register_door(name, def) end if def.only_placer_can_open then - local meta = minetest.get_meta(pt) + local meta = minetest_get_meta(pt) meta:set_string("doors_owner", "") - meta = minetest.get_meta(pt2) + meta = minetest_get_meta(pt2) meta:set_string("doors_owner", "") end - local meta1 = minetest.get_meta(pt) - local meta2 = minetest.get_meta(pt2) + local meta1 = minetest_get_meta(pt) + local meta2 = minetest_get_meta(pt2) -- save mirror state for the correct door if left_node.name:sub(1, #name) == name then meta1:set_int("is_mirrored", 1) @@ -198,9 +199,9 @@ function mcl_doors:register_door(name, def) local tb = def.tiles_bottom local function on_open_close(pos, dir, check_name, replace, replace_dir) - local meta1 = minetest.get_meta(pos) + local meta1 = minetest_get_meta(pos) pos.y = pos.y+dir - local meta2 = minetest.get_meta(pos) + local meta2 = minetest_get_meta(pos) -- if name of other door is not the same as check_name -> return if not minetest.get_node(pos).name == check_name then @@ -254,7 +255,7 @@ function mcl_doors:register_door(name, def) if not def.only_placer_can_open then return true end - local meta = minetest.get_meta(pos) + local meta = minetest_get_meta(pos) local pn = player:get_player_name() return meta:get_string("doors_owner") == pn end @@ -292,10 +293,15 @@ function mcl_doors:register_door(name, def) sounds = def.sounds, after_destruct = function(bottom, oldnode) - minetest.add_item(bottom, name) - local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z } - if minetest.get_node(bottom).name ~= name.."_b_2" and minetest.get_node(top).name == name.."_t_1" then - minetest.remove_node(top) + local meta_bottom = minetest_get_meta(bottom) + if meta_bottom:get_int("rotation") == 1 then + meta_bottom:set_int("rotation", 0) + else + minetest.add_item(bottom, name) + local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z } + if minetest.get_node(bottom).name ~= name.."_b_2" and minetest.get_node(top).name == name.."_t_1" then + minetest.remove_node(top) + end end end, @@ -305,13 +311,19 @@ function mcl_doors:register_door(name, def) action_on = on_mesecons_signal_open, }}, - on_rotate = function(pos, node, user, mode, param2) + on_rotate = function(bottom, node, user, mode, param2) if mode == screwdriver.ROTATE_FACE then - minetest.remove_node(pos) - node.param2 = screwdriver.rotate.facedir(pos, node, mode) - minetest.set_node(pos, node) + local meta_bottom = minetest_get_meta(bottom) + meta_bottom:set_int("rotation", 1) + node.param2 = screwdriver.rotate.facedir(bottom, node, mode) + minetest.swap_node(bottom, node) + + local top = {x=bottom.x,y=bottom.y+1,z=bottom.z} + local meta_top = minetest_get_meta(top) + meta_top:set_int("rotation", 1) node.name = name .."_t_1" - minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, node) + minetest.swap_node(top, node) + return true end return false @@ -353,9 +365,14 @@ function mcl_doors:register_door(name, def) sounds = def.sounds, after_destruct = function(top, oldnode) - local bottom = { x = top.x, y = top.y - 1, z = top.z } - if minetest.get_node(top).name ~= name.."_t_2" and minetest.get_node(bottom).name == name.."_b_1" and oldnode.name == name.."_t_1" then - minetest.dig_node(bottom) + local meta_top = minetest_get_meta(top) + if meta_top:get_int("rotation") == 1 then + meta_top:set_int("rotation", 0) + else + local bottom = { x = top.x, y = top.y - 1, z = top.z } + if minetest.get_node(top).name ~= name.."_t_2" and minetest.get_node(bottom).name == name.."_b_1" and oldnode.name == name.."_t_1" then + minetest.dig_node(bottom) + end end end, @@ -366,13 +383,19 @@ function mcl_doors:register_door(name, def) rules = mesecon.rules.flat, }}, - on_rotate = function(pos, node, user, mode, param2) + on_rotate = function(top, node, user, mode, param2) if mode == screwdriver.ROTATE_FACE then - minetest.remove_node(pos) - node.param2 = screwdriver.rotate.facedir(pos, node, mode) - minetest.set_node(pos, node) + local meta_top = minetest_get_meta(top) + meta_top:set_int("rotation", 1) + node.param2 = screwdriver.rotate.facedir(top, node, mode) + minetest.swap_node(top, node) + + local bottom = {x=top.x,y=top.y-1,z=top.z} + local meta_bottom = minetest_get_meta(bottom) + meta_bottom:set_int("rotation", 1) node.name = name .."_b_1" - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z}, node) + minetest.swap_node(bottom, node) + return true end return false @@ -414,10 +437,15 @@ function mcl_doors:register_door(name, def) sounds = def.sounds, after_destruct = function(bottom, oldnode) - minetest.add_item(bottom, name) - local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z } - if minetest.get_node(bottom).name ~= name.."_b_1" and minetest.get_node(top).name == name.."_t_2" then - minetest.remove_node(top) + local meta_bottom = minetest_get_meta(bottom) + if meta_bottom:get_int("rotation") == 1 then + meta_bottom:set_int("rotation", 0) + else + local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z } + minetest.add_item(bottom, name) + if minetest.get_node(bottom).name ~= name.."_b_1" and minetest.get_node(top).name == name.."_t_2" then + minetest.remove_node(top) + end end end, @@ -427,13 +455,19 @@ function mcl_doors:register_door(name, def) action_off = on_mesecons_signal_close, }}, - on_rotate = function(pos, node, user, mode, param2) + on_rotate = function(bottom, node, user, mode, param2) if mode == screwdriver.ROTATE_FACE then - minetest.remove_node(pos) - node.param2 = screwdriver.rotate.facedir(pos, node, mode) - minetest.set_node(pos, node) + local meta_bottom = minetest_get_meta(bottom) + meta_bottom:set_int("rotation", 1) + node.param2 = screwdriver.rotate.facedir(bottom, node, mode) + minetest.swap_node(bottom, node) + + local top = {x=bottom.x,y=bottom.y+1,z=bottom.z} + local meta_top = minetest_get_meta(top) + meta_top:set_int("rotation", 1) node.name = name .."_t_2" - minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, node) + minetest.swap_node(top, node) + return true end return false @@ -475,9 +509,14 @@ function mcl_doors:register_door(name, def) sounds = def.sounds, after_destruct = function(top, oldnode) - local bottom = { x = top.x, y = top.y - 1, z = top.z } - if minetest.get_node(top).name ~= name.."_t_1" and minetest.get_node(bottom).name == name.."_b_2" and oldnode.name == name.."_t_2" then - minetest.dig_node(bottom) + local meta_top = minetest_get_meta(top) + if meta_top:get_int("rotation") == 1 then + meta_top:set_int("rotation", 0) + else + local bottom = { x = top.x, y = top.y - 1, z = top.z } + if minetest.get_node(top).name ~= name.."_t_1" and minetest.get_node(bottom).name == name.."_b_2" and oldnode.name == name.."_t_2" then + minetest.dig_node(bottom) + end end end, @@ -488,13 +527,19 @@ function mcl_doors:register_door(name, def) rules = mesecon.rules.flat, }}, - on_rotate = function(pos, node, user, mode, param2) + on_rotate = function(top, node, user, mode, param2) if mode == screwdriver.ROTATE_FACE then - minetest.remove_node(pos) - node.param2 = screwdriver.rotate.facedir(pos, node, mode) - minetest.set_node(pos, node) + local meta_top = minetest_get_meta(top) + meta_top:set_int("rotation", 1) + node.param2 = screwdriver.rotate.facedir(top, node, mode) + minetest.swap_node(top, node) + + local bottom = {x=top.x,y=top.y-1,z=top.z} + local meta_bottom = minetest_get_meta(bottom) + meta_bottom:set_int("rotation", 1) node.name = name .."_b_2" - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z}, node) + minetest.swap_node(bottom, node) + return true end return false From cd0d2d22966c003eed17841ec81464b7bfaa06e5 Mon Sep 17 00:00:00 2001 From: Code-Sploit Date: Tue, 13 Apr 2021 13:57:45 +0000 Subject: [PATCH 3/4] Fix #1548 --- mods/ITEMS/mcl_potions/functions.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 996637aa7..211cf50b0 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -701,6 +701,10 @@ function mcl_potions.healing_func(player, hp) local obj = player:get_luaentity() + if player:get_hp() == 0 then + return + end + if obj and obj.harmed_by_heal then hp = -hp end if hp > 0 then From f498d3ae02b02d32d17fae639a655477c620a806 Mon Sep 17 00:00:00 2001 From: epCode Date: Tue, 13 Apr 2021 11:45:31 -0700 Subject: [PATCH 4/4] make elytra activate mor MC-like --- mods/PLAYER/mcl_playerplus/init.lua | 38 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 5ba73cd60..b1b994613 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -175,14 +175,14 @@ minetest.register_globalstep(function(dtime) ]]-- - local controls = player:get_player_control() + local control = player:get_player_control() local name = player:get_player_name() local meta = player:get_meta() local parent = player:get_attach() local wielded = player:get_wielded_item() local player_velocity = player:get_velocity() or player:get_player_velocity() - -- controls head bone + -- control head bone local pitch = - degrees(player:get_look_vertical()) local yaw = degrees(player:get_look_horizontal()) @@ -199,11 +199,22 @@ minetest.register_globalstep(function(dtime) minetest.log("action", "somehow player got of loaded areas") end + controls.register_on_press(function(player, key) + if key~="jump" then return end + if player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" and player_velocity.y < -6 and elytra[player] ~= true then + elytra[player] = true + end + end) + + if elytra[player] == true and node_stand_return ~= "air" or elytra[player] == true and player:get_inventory():get_stack("armor", 3):get_name() ~= "mcl_armor:elytra" or player:get_attach() ~= nil then + elytra[player] = false + end +--[[ if player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" and player_velocity.y < -6 and elytra[player] ~= true and is_sprinting(name) then elytra[player] = true elseif elytra[player] == true and node_stand_return ~= "air" or elytra[player] == true and player:get_inventory():get_stack("armor", 3):get_name() ~= "mcl_armor:elytra" or player:get_attach() ~= nil then elytra[player] = false - end + end]] if elytra[player] == true then mcl_player.player_set_animation(player, "fly") @@ -213,9 +224,10 @@ minetest.register_globalstep(function(dtime) end if math.abs(player_velocity.x) + math.abs(player_velocity.z) < 20 then local dir = minetest.yaw_to_dir(player:get_look_horizontal()) - player:add_velocity({x=dir.x, y=0, z=dir.z}) + local pitch = 1 * player:get_look_vertical() * -.1 + player:add_velocity({x=dir.x, y=pitch, z=dir.z}) end - if controls.sneak then + if control.sneak then if player_velocity.y > -5 then player:add_velocity({x=0, y=-2, z=0}) end @@ -225,11 +237,11 @@ minetest.register_globalstep(function(dtime) end -- controls right and left arms pitch when shooting a bow - 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(wielded:get_name(), "mcl_bows:bow") and control.RMB and not control.LMB and not control.up and not control.down and not control.left and not control.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_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35)) -- when punching - elseif controls.LMB and not parent then + elseif control.LMB and not parent 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_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0)) -- when holding an item. @@ -246,15 +258,15 @@ minetest.register_globalstep(function(dtime) -- set head pitch and yaw when swimming player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),player_vel_yaw - yaw,0)) -- sets eye height, and nametag color accordingly - player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}) + player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 0, g = 225 }}) -- control body bone when swimming player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,-player_vel_yaw + yaw + 180,0)) elseif parent then local parent_yaw = degrees(parent:get_yaw()) - player:set_properties({collisionbox = {-0.312,0,-0.312,0.312,1.8,0.312}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}) + player:set_properties({collisionbox = {-0.312,0,-0.312,0.312,1.8,0.312}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 0, g = 225 }}) player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch, -limit_vel_yaw(yaw, parent_yaw) + parent_yaw, 0)) player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0)) - elseif controls.sneak then + elseif control.sneak then -- controls head pitch when sneaking player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0)) -- sets eye height, and nametag color accordingly @@ -265,12 +277,12 @@ minetest.register_globalstep(function(dtime) -- set head pitch and yaw when swimming player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),player_vel_yaw - yaw,0)) -- sets eye height, and nametag color accordingly - player:set_properties({collisionbox = {-0.312,0,-0.312,0.312,0.8,0.312}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}) + player:set_properties({collisionbox = {-0.312,0,-0.312,0.312,0.8,0.312}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 0, g = 225 }}) -- control body bone when swimming player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,-player_vel_yaw + yaw + 180,0)) else -- sets eye height, and nametag color accordingly - player:set_properties({collisionbox = {-0.312,0,-0.312,0.312,1.8,0.312}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}) + player:set_properties({collisionbox = {-0.312,0,-0.312,0.312,1.8,0.312}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 0, g = 225 }}) player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch, player_vel_yaw - yaw, 0)) player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0, -player_vel_yaw + yaw, 0)) @@ -283,7 +295,7 @@ minetest.register_globalstep(function(dtime) mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime end - if controls.jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then + if control.jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then pos = player:get_pos()