Merge branch 'master' into mineclone5
commit
f851f5c7ca
|
@ -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
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -60,12 +60,12 @@ 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
|
||||
|
||||
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
|
||||
|
||||
|
@ -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())
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue