From d73231ab4acc66633aeb9f61caf6696b940ec3f8 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Jan 2024 02:13:08 +0100 Subject: [PATCH] Added nausea --- mods/ITEMS/mcl_potions/functions.lua | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index a1a193fda..afbbc2128 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -629,6 +629,54 @@ mcl_fovapi.register_modifier({ time = 1, }) +mcl_potions.register_effect({ + name = "nausea", + description = S("Nausea"), + get_tt = function(factor) + return S("not feeling very well...") + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + object:set_lighting({ + saturation = -1.0, + }) + end, + on_hit_timer = function(object, factor, duration) + if EF.nausea[object].high then + mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_high") + mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_low") + EF.nausea[object].high = false + else + mcl_fovapi.apply_modifier(object, "mcl_potions:nausea_high") + mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low") + EF.nausea[object].high = true + 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") + end, + particle_color = "#60AA30", + uses_factor = false, + timer_uses_factor = false, + hit_timer_step = 1, +}) +mcl_fovapi.register_modifier({ + name = "mcl_potions:nausea_high", + fov_factor = 2.2, + time = 1, +}) +mcl_fovapi.register_modifier({ + name = "mcl_potions:nausea_low", + fov_factor = 0.2, + time = 1, +}) + mcl_potions.register_effect({ name = "food_poisoning", description = S("Food Poisoning"),