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

View File

@ -109,6 +109,7 @@ local piglin = {
else else
self._zombie_transform_timer = nil self._zombie_transform_timer = nil
end end
if self._zombie_transform_timer and self._zombie_transform_timer >= 15 then 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") local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:zombified_piglin")
zog:set_rotation(self.object:get_rotation()) zog:set_rotation(self.object:get_rotation())
@ -116,6 +117,7 @@ local piglin = {
self.object:remove() self.object:remove()
return return
end end
if self.trading == true then if self.trading == true then
self.state = "trading" self.state = "trading"
self.object:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(20,-20,18)) 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 else
self._zombie_transform_timer = nil self._zombie_transform_timer = nil
end end
if self._zombie_transform_timer and self._zombie_transform_timer >= 15 then 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") local zog = minetest.add_entity(self.object:get_pos(), "mobs_mc:zombified_piglin")
zog:set_rotation(self.object:get_rotation()) 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 return not object:is_player() and not object:get_luaentity().is_mob
end, end,
on_start = function(object, factor) on_start = function(object, factor)
if object:is_player() then if not object:is_player() then return end
object:set_lighting({ object:set_lighting({
saturation = -1.0, saturation = -1.0,
}) })
end
end, end,
on_hit_timer = function(object, factor, duration) on_hit_timer = function(object, factor, duration)
if object:is_player() then if not object:is_player() then return end
if EF.nausea[object].high then if EF.nausea[object].high then
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high", factor) mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high", factor)
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_low", factor) mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_low", factor)
EF.nausea[object].high = false EF.nausea[object].high = false
else else
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_high", factor) mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_high", factor)
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low", factor) mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low", factor)
EF.nausea[object].high = true EF.nausea[object].high = true
end
end end
end, end,
on_end = function(object) on_end = function(object)
if object:is_player() then if not object:is_player() then return end
object:set_lighting({ object:set_lighting({
saturation = 1.0, saturation = 1.0,
}) })
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high") mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high")
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low") mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low")
end
end, end,
particle_color = "#60AA30", particle_color = "#60AA30",
uses_factor = true, uses_factor = true,