Made nausea effect applicable to mobs (with no effect on the mob)

This commit is contained in:
WillConker 2024-06-10 14:57:48 +01:00
parent e03db09bd3
commit 6d33368858
1 changed files with 25 additions and 17 deletions

View File

@ -858,30 +858,38 @@ mcl_potions.register_effect({
return S("not feeling very well...").."\n"..S("frequency: @1 / 1 s", factor)
end,
res_condition = function(object)
return (not object:is_player()) -- TODO what should it do for mobs?
-- Currently no-op for mobs, just displays particles
-- TODO what should it do for mobs?
return not object:is_player() and not object:get_luaentity().is_mob
end,
on_start = function(object, factor)
object:set_lighting({
saturation = -1.0,
})
if object:is_player() then
object:set_lighting({
saturation = -1.0,
})
end
end,
on_hit_timer = function(object, factor, duration)
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
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
end
end,
on_end = function(object)
object:set_lighting({
saturation = 1.0,
})
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high")
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low")
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
end,
particle_color = "#60AA30",
uses_factor = true,