From ce49cd02ac5273a21a673329d28e4ceb32b5db34 Mon Sep 17 00:00:00 2001 From: epCode Date: Sat, 10 Apr 2021 15:41:50 -0700 Subject: [PATCH 1/5] make player collision box MUCH closer to MC --- mods/PLAYER/mcl_playerplus/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index cbd93ada8..de346256f 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -210,26 +210,26 @@ minetest.register_globalstep(function(dtime) if parent then local parent_yaw = degrees(parent:get_yaw()) - player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, 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 = 225, 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 -- 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 - player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }}) + player:set_properties({collisionbox = {-0.312,0,-0.312,0.312,1.8,0.312}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }}) -- sneaking body conrols player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0)) elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and is_sprinting(name) == true then -- 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.312,0,-0.312,0.312,0.8,0.312}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, 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.35,0,-0.35,0.35,1.8,0.35}, 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 = 225, 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)) From 2313012f607e11283dcb1a2600eccc7b7a89a02c Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 11 Apr 2021 10:41:11 +0200 Subject: [PATCH 2/5] Fix #1528 --- mods/HUD/mcl_bossbars/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/HUD/mcl_bossbars/init.lua b/mods/HUD/mcl_bossbars/init.lua index a95d533ce..b5bec1334 100644 --- a/mods/HUD/mcl_bossbars/init.lua +++ b/mods/HUD/mcl_bossbars/init.lua @@ -60,7 +60,7 @@ function mcl_bossbars.add_bar(player, def, dynamic, priority) bar.id = last_id + 1 last_id = bar.id mcl_bossbars.static[bar.id] = bar - return id + return bar.id end end From af044e6a96fba49bd573eff01be751067403f0e3 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 11 Apr 2021 11:15:09 +0200 Subject: [PATCH 3/5] Bossbars: Add support for non-mob bosses --- mods/HUD/mcl_bossbars/init.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mods/HUD/mcl_bossbars/init.lua b/mods/HUD/mcl_bossbars/init.lua index b5bec1334..209d9a2c1 100644 --- a/mods/HUD/mcl_bossbars/init.lua +++ b/mods/HUD/mcl_bossbars/init.lua @@ -76,16 +76,23 @@ function mcl_bossbars.update_bar(id, def, priority) old.priority = priority or old.priority end -function mcl_bossbars.update_boss(luaentity, name, color) - local object = luaentity.object +function mcl_bossbars.update_boss(object, name, color) + local props = object:get_luaentity() + if not props or not props._cmi_is_mob then + props = object:get_properties() + props.health = object:get_hp() + end + local bardef = { - text = luaentity.nametag, - percentage = math.floor(luaentity.health / luaentity.hp_max * 100), color = color, + text = props.nametag, + percentage = math.floor(props.health / props.hp_max * 100), } + if not bardef.text or bardef.text == "" then bardef.text = name end + local pos = object:get_pos() for _, player in pairs(minetest.get_connected_players()) do local d = vector.distance(pos, player:get_pos()) From 24f8f9166b0dbd6ce86e39dd7646fb2fb1f67877 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 11 Apr 2021 17:29:05 +0200 Subject: [PATCH 4/5] Fix #1528 --- mods/HUD/mcl_bossbars/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/HUD/mcl_bossbars/init.lua b/mods/HUD/mcl_bossbars/init.lua index 209d9a2c1..08eb527bf 100644 --- a/mods/HUD/mcl_bossbars/init.lua +++ b/mods/HUD/mcl_bossbars/init.lua @@ -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.static = false + mcl_bossbars.static[id].bar.id = nil mcl_bossbars.static[id] = nil end From c0a31f0e9c0f90e7fac688f4e345d21466306d0d Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 11 Apr 2021 17:30:32 +0200 Subject: [PATCH 5/5] Fix #1535 --- mods/ENTITIES/mobs_mc/ender_dragon.lua | 2 +- mods/ENTITIES/mobs_mc/wither.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index db29b63ae..a6f404275 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -60,7 +60,7 @@ mobs:register_mob("mobs_mc:enderdragon", { }, ignores_nametag = true, do_custom = function(self) - mcl_bossbars.update_boss(self, "Ender Dragon", "light_purple") + mcl_bossbars.update_boss(self.object, "Ender Dragon", "light_purple") for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 80)) do local luaentity = obj:get_luaentity() if luaentity and luaentity.name == "mcl_end:crystal" then diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 8e7f7eb95..2d53cc547 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -73,7 +73,7 @@ mobs:register_mob("mobs_mc:wither", { self.object:set_properties({textures={self.base_texture}}) self.armor = {undead = 80, fleshy = 80} end - mcl_bossbars.update_boss(self, "Wither", "dark_purple") + mcl_bossbars.update_boss(self.object, "Wither", "dark_purple") end, on_spawn = function(self) minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})