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) 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)
object:set_lighting({ if object:is_player() then
saturation = -1.0, object:set_lighting({
}) saturation = -1.0,
})
end
end, end,
on_hit_timer = function(object, factor, duration) on_hit_timer = function(object, factor, duration)
if EF.nausea[object].high then if object:is_player() then
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high", factor) if EF.nausea[object].high then
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_low", factor) mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high", factor)
EF.nausea[object].high = false mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_low", factor)
else EF.nausea[object].high = false
mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_high", factor) else
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low", factor) mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_high", factor)
EF.nausea[object].high = true mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low", factor)
EF.nausea[object].high = true
end
end end
end, end,
on_end = function(object) on_end = function(object)
object:set_lighting({ if object:is_player() then
saturation = 1.0, object:set_lighting({
}) saturation = 1.0,
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_high")
mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low")
end
end, end,
particle_color = "#60AA30", particle_color = "#60AA30",
uses_factor = true, uses_factor = true,