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,14 +858,19 @@ mcl_potions.register_effect({
return S("not feeling very well...").."\n"..S("frequency: @1 / 1 s", factor) return S("not feeling very well...").."\n"..S("frequency: @1 / 1 s", factor)
end, end,
res_condition = function(object) 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, end,
on_start = function(object, factor) on_start = function(object, factor)
if object:is_player() then
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 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)
@ -875,13 +880,16 @@ mcl_potions.register_effect({
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
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,