Tweaked code layout as per review comments

This commit is contained in:
WillConker 2024-06-20 17:52:16 +01:00
parent f705571dff
commit 8a6b88c2f0
3 changed files with 24 additions and 22 deletions

View File

@ -84,6 +84,7 @@ local hoglin = {
else
self._zombie_transform_timer = nil
end
if self._zombie_transform_timer and self._zombie_transform_timer >= 15 then
local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:zoglin")
zog:set_rotation(self.object:get_rotation())
@ -130,6 +131,7 @@ baby_hoglin.do_custom = function(self, dtime)
else
self._zombie_transform_timer = nil
end
if self._zombie_transform_timer and self._zombie_transform_timer >= 15 then
local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:baby_zoglin")
zog:set_rotation(self.object:get_rotation())

View File

@ -109,6 +109,7 @@ local piglin = {
else
self._zombie_transform_timer = nil
end
if self._zombie_transform_timer and self._zombie_transform_timer >= 15 then
local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:zombified_piglin")
zog:set_rotation(self.object:get_rotation())
@ -116,6 +117,7 @@ local piglin = {
self.object:remove()
return
end
if self.trading == true then
self.state = "trading"
self.object:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(20,-20,18))
@ -376,6 +378,7 @@ piglin_brute.do_custom = function(self, dtime)
else
self._zombie_transform_timer = nil
end
if self._zombie_transform_timer and self._zombie_transform_timer >= 15 then
local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:zombified_piglin")
zog:set_rotation(self.object:get_rotation())

View File

@ -863,33 +863,30 @@ mcl_potions.register_effect({
return not object:is_player() and not object:get_luaentity().is_mob
end,
on_start = function(object, factor)
if object:is_player() then
object:set_lighting({
saturation = -1.0,
})
end
if not object:is_player() then return end
object:set_lighting({
saturation = -1.0,
})
end,
on_hit_timer = function(object, factor, duration)
if object:is_player() then
if EF.nausea[object].high then
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high", factor)
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_low", factor)
EF.nausea[object].high = false
else
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_high", factor)
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low", factor)
EF.nausea[object].high = true
end
if not object:is_player() then return end
if EF.nausea[object].high then
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high", factor)
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_low", factor)
EF.nausea[object].high = false
else
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_high", factor)
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low", factor)
EF.nausea[object].high = true
end
end,
on_end = function(object)
if object:is_player() then
object:set_lighting({
saturation = 1.0,
})
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high")
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low")
end
if not object:is_player() then return end
object:set_lighting({
saturation = 1.0,
})
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high")
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low")
end,
particle_color = "#60AA30",
uses_factor = true,