From 8477d13c79ed27506ee8a0e09dc327a1cbf5e566 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 1 Oct 2023 04:33:40 +0200 Subject: [PATCH 01/91] General effects API overhaul - added a `register_effect()` function - added the withering effect - registered all the old effects under the new API - unified effect names - updated the main effect checker to use the new API - changed some hardcoded values to support the unified effect naming - added new namespaced metadata effects strings - added support for legacy effect player metadata - potions are still using the old effects API - added glue between old API calls and the new API - renamed the effect icons to support the unified effect naming --- mods/ITEMS/mcl_potions/functions.lua | 629 ++++++++++++++++++++++++--- mods/ITEMS/mcl_potions/potions.lua | 2 +- 2 files changed, 562 insertions(+), 69 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 24aa2e402..6f0255f16 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1,4 +1,5 @@ local EF = {} +<<<<<<< HEAD EF.invisible = {} EF.poisoned = {} EF.regenerating = {} @@ -11,24 +12,358 @@ EF.night_vision = {} EF.fire_proof = {} EF.bad_omen = {} EF.withering = {} +======= + +local registered_effects = {} +>>>>>>> df28ce66d (General effects API overhaul) local EFFECT_TYPES = 0 -for _,_ in pairs(EF) do - EFFECT_TYPES = EFFECT_TYPES + 1 +minetest.register_on_mods_loaded(function() + for _,_ in pairs(EF) do + EFFECT_TYPES = EFFECT_TYPES + 1 + end +end) + + +-- ██████╗░███████╗░██████╗░██╗░██████╗████████╗███████╗██████╗ +-- ██╔══██╗██╔════╝██╔════╝░██║██╔════╝╚══██╔══╝██╔════╝██╔══██╗ +-- ██████╔╝█████╗░░██║░░██╗░██║╚█████╗░░░░██║░░░█████╗░░██████╔╝ +-- ██╔══██╗██╔══╝░░██║░░╚██╗██║░╚═══██╗░░░██║░░░██╔══╝░░██╔══██╗ +-- ██║░░██║███████╗╚██████╔╝██║██████╔╝░░░██║░░░███████╗██║░░██║ +-- ╚═╝░░╚═╝╚══════╝░╚═════╝░╚═╝╚═════╝░░░░╚═╝░░░╚══════╝╚═╝░░╚═╝ +-- +-- ███████╗███████╗███████╗███████╗░█████╗░████████╗░██████╗ +-- ██╔════╝██╔════╝██╔════╝██╔════╝██╔══██╗╚══██╔══╝██╔════╝ +-- █████╗░░█████╗░░█████╗░░█████╗░░██║░░╚═╝░░░██║░░░╚█████╗░ +-- ██╔══╝░░██╔══╝░░██╔══╝░░██╔══╝░░██║░░██╗░░░██║░░░░╚═══██╗ +-- ███████╗██║░░░░░██║░░░░░███████╗╚█████╔╝░░░██║░░░██████╔╝ +-- ╚══════╝╚═╝░░░░░╚═╝░░░░░╚══════╝░╚════╝░░░░╚═╝░░░╚═════╝░ + +local function generate_linear_lvl_to_fac(l1, l2) + local a = l2 - l1 + local b = 2*l1 - l2 + return function(level) + return (a*level + b) + end end +local function generate_rational_lvl_to_fac(l1, l2) + local a = (l1 - l2) / 1.5 + local b = 2*l2 - l1 + return function(level) + if level == 0 then return 0 end + return (a/level + b) + end +end + +local function generate_modifier_func(name, dmg_flag, mod_func) + return function(object, damage, reason) + if EF[name][object] and not reason.flags.bypasses_magic and reason.flags[dmg_flag] then + return mod_func and mod_func(damage) or 0 + end + end +end + +-- API - registers an effect +-- required parameters in def: +-- name - string - effect name in code +-- optional parameters in def: +-- icon - string - file name of the effect icon in HUD - defaults to one based on name +-- res_condition - function(object) - returning true if target is to be resistant to the effect +-- on_start - function(object, factor) - called when dealing the effect +-- on_load - function(object, factor) - called on_joinplayer and on_activate +-- on_step - function(dtime, object, factor, duration) - running every step for all objects with this effect +-- on_hit_timer - function(object, factor, duration) - if defined runs a hit_timer depending on timer_uses_factor value +-- on_end - function(object) - called when the effect wears off +-- particle_color - string - colorstring for particles - defaults to #3000EE +-- uses_factor - bool - whether factor affects the effect +-- lvl1_factor - integer - factor for lvl1 effect - defaults to 1 if uses_factor +-- lvl2_factor - integer - factor for lvl2 effect - defaults to 2 if uses_factor +-- timer_uses_factor - bool - whether hit_timer uses factor (uses_factor must be true) or a constant value (hit_timer_step must be defined) +-- hit_timer_step - float - interval between hit_timer hits +-- damage_modifier - string - damage flag of which damage is changed as defined by modifier_func +-- modifier_func - function(damage) - see damage_modifier, if not defined damage_modifier defaults to 100% resistance +-- modifier_priority - integer - priority passed when registering damage_modifier - defaults to -50 +function mcl_potions.register_effect(def) + local modname = minetest.get_current_modname() + if def.name == nil then + error("Unable to register effect: name is nil") + end + local name = def.name + local pdef = {} + if not def.icon then + pdef.icon = modname.."_effect_"..name..".png" + else + pdef.icon = def.icon + end + pdef.res_condition = def.res_condition + pdef.on_start = def.on_start + pdef.on_load = def.on_load + pdef.on_step = def.on_step + pdef.on_hit_timer = def.on_hit_timer + pdef.on_end = def.on_end + if not def.particle_color then + pdef.particle_color = "#3000EE" + else + pdef.particle_color = def.particle_color + end + if def.uses_factor then + pdef.uses_factor = true + local l1 = def.lvl1_factor or 1 + local l2 = def.lvl2_factor or 2*l1 + if l1 < l2 then + pdef.level_to_factor = generate_linear_lvl_to_fac(l1, l2) + elseif l1 > l2 then + pdef.level_to_factor = generate_rational_lvl_to_fac(l1, l2) + else + error("Can't extrapolate levels from lvl1 and lvl2 bearing the same factor") + end + else + pdef.uses_factor = false + end + if def.on_hit_timer then + if def.timer_uses_factor then + if not def.uses_factor then error("Uses factor but does not use factor?") end + pdef.timer_uses_factor = true + else + if not def.hit_timer_step then error("If hit_timer does not use factor, hit_timer_step must be defined") end + pdef.timer_uses_factor = false + pdef.hit_timer_step = def.hit_timer_step + end + end + if def.damage_modifier then + mcl_damage.register_modifier( + generate_modifier_func(name, def.damage_modifier, def.modifier_func), + def.modifier_priority or -50 + ) + end + registered_effects[name] = pdef + EF[name] = {} +end + +mcl_potions.register_effect({ + name = "invisibility", + on_start = function(object, factor) + mcl_potions.make_invisible(object, true) + end, + on_load = function(object, factor) + mcl_potions.make_invisible(object, true) + end, + on_end = function(object) + mcl_potions.make_invisible(object, false) + end, + particle_color = "#7F8392", + uses_factor = false, +}) + +mcl_potions.register_effect({ + name = "poison", + res_condition = function(object) + local entity = object:get_luaentity() + return (entity and (entity.harmed_by_heal or string.find(entity.name, "spider"))) + end, + on_hit_timer = function(object, factor, duration) + if mcl_util.get_hp(object) - 1 > 0 then + mcl_util.deal_damage(object, 1, {type = "magic"}) + end + end, + particle_color = "#4E9331", + uses_factor = true, + lvl1_factor = 1.25, + lvl2_factor = 0.6, + timer_uses_factor = true, +}) + +mcl_potions.register_effect({ + name = "regeneration", + res_condition = function(object) + local entity = object:get_luaentity() + return (entity and entity.harmed_by_heal) + end, + on_hit_timer = function(object, factor, duration) + local entity = object:get_luaentity() + if object:is_player() then + object:set_hp(math.min(object:get_properties().hp_max or 20, object:get_hp() + 1), { type = "set_hp", other = "regeneration" }) + elseif entity and entity.is_mob then + entity.health = math.min(entity.hp_max, entity.health + 1) + end + end, + particle_color = "#CD5CAB", + uses_factor = true, + lvl1_factor = 2.5, + lvl2_factor = 1.25, + timer_uses_factor = true, +}) + +mcl_potions.register_effect({ + name = "strength", + res_condition = function(object) + return (not object:is_player()) + end, + particle_color = "#932423", +}) + +mcl_potions.register_effect({ + name = "weakness", + res_condition = function(object) + return (not object:is_player()) + end, + particle_color = "#484D48", +}) + +mcl_potions.register_effect({ + name = "water_breathing", + on_step = function(dtime, object, factor, duration) + if not object:is_player() then return end + if object:get_breath() then + hb.hide_hudbar(object, "breath") + if object:get_breath() < 10 then object:set_breath(10) end + end + end, + particle_color = "#2E5299", + uses_factor = false, +}) + +mcl_potions.register_effect({ + name = "leaping", + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + playerphysics.add_physics_factor(object, "jump", "mcl_potions:leaping", 1+factor) + end, + on_end = function(object) + playerphysics.remove_physics_factor(object, "jump", "mcl_potions:leaping") + end, + particle_color = "#22FF4C", + uses_factor = true, + lvl1_factor = 0.5, + lvl2_factor = 1, +}) + +mcl_potions.register_effect({ + name = "swiftness", + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + playerphysics.add_physics_factor(object, "speed", "mcl_potions:swiftness", 1+factor) + end, + on_end = function(object) + playerphysics.remove_physics_factor(object, "speed", "mcl_potions:swiftness") + end, + particle_color = "#7CAFC6", + uses_factor = true, + lvl1_factor = 0.2, + lvl2_factor = 0.4, +}) + +mcl_potions.register_effect({ + name = "slowness", + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + playerphysics.add_physics_factor(object, "speed", "mcl_potions:slowness", 1-factor) + end, + on_end = function(object) + playerphysics.remove_physics_factor(object, "speed", "mcl_potions:slowness") + end, + particle_color = "#5A6C81", + uses_factor = true, + lvl1_factor = 0.15, + lvl2_factor = 0.3, +}) + +mcl_potions.register_effect({ + name = "night_vision", + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + object:get_meta():set_int("night_vision", 1) + mcl_weather.skycolor.update_sky_color({object}) + end, + on_step = function(dtime, object, factor, duration) + mcl_weather.skycolor.update_sky_color({object}) + end, + on_end = function(object) + local meta = object:get_meta() + meta:set_int("night_vision", 0) + mcl_weather.skycolor.update_sky_color({object}) + end, + particle_color = "#1F1FA1", + uses_factor = false, +}) + +mcl_potions.register_effect({ + name = "fire_resistance", + res_condition = function(object) + return (not object:is_player()) + end, + particle_color = "#E49A3A", + uses_factor = false, + damage_modifier = "is_fire", +}) + +mcl_potions.register_effect({ + name = "bad_omen", + particle_color = "#0b6138", +}) + +mcl_potions.register_effect({ + name = "withering", + res_condition = function(object) + local entity = object:get_luaentity() + return (entity and string.find(entity.name, "wither")) + end, + on_hit_timer = function(object, factor, duration) + if object:is_player() or object:get_luaentity() then + mcl_util.deal_damage(object, 1, {type = "magic"}) + end + end, + particle_color = "#000000", + uses_factor = true, + lvl1_factor = 2, + lvl2_factor = 0.5, + timer_uses_factor = true, +}) + + +-- ██╗░░░██╗██████╗░██████╗░░█████╗░████████╗███████╗ +-- ██║░░░██║██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝ +-- ██║░░░██║██████╔╝██║░░██║███████║░░░██║░░░█████╗░░ +-- ██║░░░██║██╔═══╝░██║░░██║██╔══██║░░░██║░░░██╔══╝░░ +-- ╚██████╔╝██║░░░░░██████╦╝██║░░██║░░░██║░░░███████╗ +-- ░╚═════╝░╚═╝░░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝ +-- +-- ██╗░░██╗██╗░░░██╗██████╗░ +-- ██║░░██║██║░░░██║██╔══██╗ +-- ███████║██║░░░██║██║░░██║ +-- ██╔══██║██║░░░██║██║░░██║ +-- ██║░░██║╚██████╔╝██████╦╝ +-- ╚═╝░░╚═╝░╚═════╝░╚═════╝░ + local icon_ids = {} local function potions_set_hudbar(player) +<<<<<<< HEAD if EF.withering[player] and EF.regenerating[player] then hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_regen_wither.png", nil, "hudbars_bar_health.png") elseif EF.withering[player] then hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_wither.png", nil, "hudbars_bar_health.png") elseif EF.poisoned[player] and EF.regenerating[player] then +======= + if EF.withering[player] and EF.regeneration[player] then + hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_regen_wither.png", nil, "hudbars_bar_health.png") + elseif EF.withering[player] then + hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_wither.png", nil, "hudbars_bar_health.png") + elseif EF.poison[player] and EF.regeneration[player] then +>>>>>>> df28ce66d (General effects API overhaul) hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png") - elseif EF.poisoned[player] then + elseif EF.poison[player] then hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png") - elseif EF.regenerating[player] then + elseif EF.regeneration[player] then hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_regenerate.png", nil, "hudbars_bar_health.png") else hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png") @@ -69,23 +404,17 @@ local function potions_set_icons(player) for i=1, EFFECT_TYPES do local icon = icon_ids[name][i] local effect_name = active_effects[i] - if effect_name == "swift" and EF.swift[player].is_slow then - effect_name = "slow" - end if effect_name == nil then player:hud_change(icon, "text", "blank.png") else player:hud_change(icon, "text", "mcl_potions_effect_"..effect_name..".png^[resize:128x128") end end - end local function potions_set_hud(player) - potions_set_hudbar(player) potions_set_icons(player) - end @@ -103,29 +432,33 @@ end -- ╚█████╔╝██║░░██║███████╗╚█████╔╝██║░╚██╗███████╗██║░░██║ -- ░╚════╝░╚═╝░░╚═╝╚══════╝░╚════╝░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝ -local is_player, entity, meta - minetest.register_globalstep(function(dtime) + for name, effect in pairs(registered_effects) do + for object, vals in pairs(EF[name]) do + EF[name][object].timer = vals.timer + dtime - -- Check for invisible players - for player, vals in pairs(EF.invisible) do - - EF.invisible[player].timer = EF.invisible[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#7F8392") end - - if EF.invisible[player].timer >= EF.invisible[player].dur then - mcl_potions.make_invisible(player, false) - EF.invisible[player] = nil - if player:is_player() then - meta = player:get_meta() - meta:set_string("_is_invisible", minetest.serialize(EF.invisible[player])) + if object:get_pos() then mcl_potions._add_spawner(object, effect.particle_color) end + if effect.on_step then effect.on_step(dtime, object, vals.factor, vals.dur) end + if effect.on_hit_timer then + EF[name][object].hit_timer = (vals.hit_timer or 0) + dtime + if EF[name][object].hit_timer >= vals.step then + effect.on_hit_timer(object, vals.factor, vals.dur) + if EF[name][object] then EF[name][object].hit_timer = 0 end + end end - potions_set_hud(player) + if EF[name][object].timer >= vals.dur then + if effect.on_end then effect.on_end(object) end + EF[name][object] = nil + if object:is_player() then + meta = object:get_meta() + meta:set_string("mcl_potions:"..name, minetest.serialize(EF[name][object])) + potions_set_hud(object) + end + end end - end +<<<<<<< HEAD -- Check for withering players for player, vals in pairs(EF.withering) do @@ -402,16 +735,10 @@ minetest.register_globalstep(function(dtime) end +======= +>>>>>>> df28ce66d (General effects API overhaul) end) --- Prevent damage to player with Fire Resistance enabled -mcl_damage.register_modifier(function(obj, damage, reason) - if EF.fire_proof[obj] and not reason.flags.bypasses_magic and reason.flags.is_fire then - return 0 - end -end, -50) - - -- ███████╗███████╗███████╗███████╗░█████╗░████████╗ -- ██╔════╝██╔════╝██╔════╝██╔════╝██╔══██╗╚══██╔══╝ @@ -428,6 +755,7 @@ end, -50) -- ╚══════╝░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝ function mcl_potions._clear_cached_player_data(player) +<<<<<<< HEAD EF.invisible[player] = nil EF.poisoned[player] = nil EF.regenerating[player] = nil @@ -440,24 +768,24 @@ function mcl_potions._clear_cached_player_data(player) EF.fire_proof[player] = nil EF.bad_omen[player] = nil EF.withering[player] = nil +======= + for name, effect in pairs(EF) do + effect[player] = nil + end +>>>>>>> df28ce66d (General effects API overhaul) meta = player:get_meta() meta:set_int("night_vision", 0) end function mcl_potions._reset_player_effects(player, set_hud) - if not player:is_player() then return end - mcl_potions.make_invisible(player, false) - - playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping") - - playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness") - - mcl_weather.skycolor.update_sky_color({player}) + for name, effect in pairs(registered_effects) do + if effect.on_end then effect.on_end(player) end + end mcl_potions._clear_cached_player_data(player) @@ -467,12 +795,12 @@ function mcl_potions._reset_player_effects(player, set_hud) end function mcl_potions._save_player_effects(player) - if not player:is_player() then return end meta = player:get_meta() +<<<<<<< HEAD meta:set_string("_is_invisible", minetest.serialize(EF.invisible[player])) meta:set_string("_is_poisoned", minetest.serialize(EF.poisoned[player])) meta:set_string("_is_regenerating", minetest.serialize(EF.regenerating[player])) @@ -486,23 +814,90 @@ function mcl_potions._save_player_effects(player) meta:set_string("_has_bad_omen", minetest.serialize(EF.bad_omen[player])) meta:set_string("_is_withering", minetest.serialize(EF.withering[player])) +======= + for name, effect in pairs(registered_effects) do + meta:set_string("mcl_potions:_EF_"..name, minetest.serialize(EF[name][player])) + end +>>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions._load_player_effects(player) - if not player:is_player() then return end meta = player:get_meta() - if minetest.deserialize(meta:get_string("_is_invisible")) then - EF.invisible[player] = minetest.deserialize(meta:get_string("_is_invisible")) - mcl_potions.make_invisible(player, true) + -- handle legacy meta strings + local legacy_invisible = minetest.deserialize(meta:get_string("_is_invisible")) + local legacy_poisoned = minetest.deserialize(meta:get_string("_is_poisoned")) + local legacy_regenerating = minetest.deserialize(meta:get_string("_is_regenerating")) + local legacy_strong = minetest.deserialize(meta:get_string("_is_strong")) + local legacy_weak = minetest.deserialize(meta:get_string("_is_weak")) + local legacy_water_breathing = minetest.deserialize(meta:get_string("_is_water_breathing")) + local legacy_leaping = minetest.deserialize(meta:get_string("_is_leaping")) + local legacy_swift = minetest.deserialize(meta:get_string("_is_swift")) + local legacy_night_vision = minetest.deserialize(meta:get_string("_is_cat")) + local legacy_fireproof = minetest.deserialize(meta:get_string("_is_fire_proof")) + local legacy_bad_omen = minetest.deserialize(meta:get_string("_has_bad_omen")) + local legacy_withering = minetest.deserialize(meta:get_string("_is_withering")) + if legacy_invisible then + EF.invisibility[player] = legacy_invisible + meta:set_string("_is_invisible", "") + end + if legacy_poisoned then + EF.poison[player] = legacy_poisoned + meta:set_string("_is_poisoned", "") + end + if legacy_regenerating then + EF.regeneration[player] = legacy_regenerating + meta:set_string("_is_regenerating", "") + end + if legacy_strong then + EF.strength[player] = legacy_strong + meta:set_string("_is_strong", "") + end + if legacy_weak then + EF.weakness[player] = legacy_weak + meta:set_string("_is_weak", "") + end + if legacy_water_breathing then + EF.water_breathing[player] = legacy_water_breating + meta:set_string("_is_water_breating", "") + end + if legacy_leaping then + EF.leaping[player] = legacy_leaping + meta:set_string("_is_leaping", "") + end + if legacy_swift then + EF.swiftness[player] = legacy_swift + meta:set_string("_is_swift", "") + end + if legacy_night_vision then + EF.night_vision[player] = legacy_night_vision + meta:set_string("_is_cat", "") + end + if legacy_fireproof then + EF.fire_resistance[player] = legacy_fireproof + meta:set_string("_is_fire_proof", "") + end + if legacy_bad_omen then + EF.bad_omen[player] = legacy_bad_omen + meta:set_string("_has_bad_omen", "") + end + if legacy_withering then + EF.withering[player] = legacy_withering + meta:set_string("_is_withering", "") end - if minetest.deserialize(meta:get_string("_is_poisoned")) then - EF.poisoned[player] = minetest.deserialize(meta:get_string("_is_poisoned")) + -- new API effects + on_load for loaded legacy effects + for name, effect in pairs(registered_effects) do + local loaded = minetest.deserialize(meta:get_string("mcl_potions:"..name)) + if loaded then EF[name][player] = loaded end + if EF[name][player] and effect.on_load then + effect.on_load(player, EF[name][player].factor) + end end +<<<<<<< HEAD if minetest.deserialize(meta:get_string("_is_regenerating")) then EF.regenerating[player] = minetest.deserialize(meta:get_string("_is_regenerating")) @@ -544,6 +939,8 @@ function mcl_potions._load_player_effects(player) EF.withering[player] = minetest.deserialize(meta:get_string("_is_withering")) end +======= +>>>>>>> df28ce66d (General effects API overhaul) end -- Returns true if player has given effect @@ -563,12 +960,12 @@ end function mcl_potions.player_clear_effect(player,effect) EF[effect][player] = nil - potions_set_icons(player) + potions_set_hud(player) end minetest.register_on_leaveplayer( function(player) mcl_potions._save_player_effects(player) - mcl_potions._clear_cached_player_data(player) -- clearout the buffer to prevent looking for a player not there + mcl_potions._clear_cached_player_data(player) -- clear the buffer to prevent looking for a player not there icon_ids[player:get_player_name()] = nil end) @@ -578,7 +975,7 @@ minetest.register_on_dieplayer( function(player) end) minetest.register_on_joinplayer( function(player) - mcl_potions._reset_player_effects(player, false) -- make sure there are no wierd holdover effects + mcl_potions._reset_player_effects(player, false) -- make sure there are no weird holdover effects mcl_potions._load_player_effects(player) potions_init_icons(player) -- .after required because player:hud_change doesn't work when called @@ -597,10 +994,8 @@ minetest.register_on_shutdown(function() for _,player in pairs(minetest.get_connected_players()) do mcl_potions._save_player_effects(player) end - end) - -- ░██████╗██╗░░░██╗██████╗░██████╗░░█████╗░██████╗░████████╗██╗███╗░░██╗░██████╗░ -- ██╔════╝██║░░░██║██╔══██╗██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██║████╗░██║██╔════╝░ -- ╚█████╗░██║░░░██║██████╔╝██████╔╝██║░░██║██████╔╝░░░██║░░░██║██╔██╗██║██║░░██╗░ @@ -727,10 +1122,62 @@ end -- ██║░░░░░╚██████╔╝██║░╚███║╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝ -- ╚═╝░░░░░░╚═════╝░╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░ +local function target_valid(object, name) + if object:get_hp() <= 0 then return false end + + local entity = object:get_luaentity() + if entity and entity.is_boss then return false end + + if not (registered_effects[name].res_condition + and registered_effects[name].res_condition(object)) then return true end +end + +function mcl_potions.give_effect(name, object, factor, duration) + if not target_valid(object, name) then return false end + + local edef = registered_effects[name] + if not edef then return false end + if not EF[name][object] then + local vals = {dur = duration, timer = 0,} + if edef.uses_factor then vals.factor = factor end + if edef.on_hit_timer then + if edef.timer_uses_factor then vals.step = factor + else vals.step = edef.hit_timer_step end + end + EF[name][object] = vals + if edef.on_start then edef.on_start(object, factor) end + else + local present = EF[name][object] + if not edef.uses_factor or (edef.uses_factor and factor >= present.factor) then + present.dur = math.max(duration, present.dur - present.timer) + present.timer = 0 + if edef.uses_factor then + present.factor = factor + if edef.timer_uses_factor then present.step = factor end + if edef.on_start then edef.on_start(object, factor) end + end + end + end + + if object:is_player() then potions_set_hud(object) end +end + +function mcl_potions.give_effect_by_level(name, object, level, duration) + if level == 0 then return false end + if not registered_effects[name].uses_factor then + return mcl_potions.give_effect(name, object, 0, duration) + end + local factor = registered_effects[name].level_to_factor(level) + return mcl_potions.give_effect(name, object, factor, duration) +end function mcl_potions.healing_func(player, hp) +<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end +======= + if player:get_hp() <= 0 then return false end +>>>>>>> df28ce66d (General effects API overhaul) local obj = player:get_luaentity() @@ -755,9 +1202,9 @@ function mcl_potions.healing_func(player, hp) mcl_util.deal_damage(player, -hp, {type = "magic"}) end - end +<<<<<<< HEAD function mcl_potions.swiftness_func(player, factor, duration) if not player or player:get_hp() <= 0 then return false end @@ -852,8 +1299,25 @@ function mcl_potions.weakness_func(player, factor, duration) end +======= +>>>>>>> df28ce66d (General effects API overhaul) function mcl_potions.strength_func(player, factor, duration) + return mcl_potions.give_effect("strength", player, factor, duration) +end +function mcl_potions.leaping_func(player, factor, duration) + return mcl_potions.give_effect("leaping", player, factor, duration) +end +function mcl_potions.weakness_func(player, factor, duration) + return mcl_potions.give_effect("weakness", player, factor, duration) +end +function mcl_potions.swiftness_func(player, factor, duration) + return mcl_potions.give_effect("swiftness", player, factor, duration) +end +function mcl_potions.slowness_func(player, factor, duration) + return mcl_potions.give_effect("slowness", player, factor, duration) +end +<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end local entity = player:get_luaentity() @@ -877,6 +1341,10 @@ function mcl_potions.strength_func(player, factor, duration) potions_set_icons(player) end +======= +function mcl_potions.withering_func(player, factor, duration) + return mcl_potions.give_effect("withering", player, factor, duration) +>>>>>>> df28ce66d (General effects API overhaul) end @@ -909,6 +1377,7 @@ end function mcl_potions.poison_func(player, factor, duration) +<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end @@ -933,10 +1402,14 @@ function mcl_potions.poison_func(player, factor, duration) potions_set_hud(player) end +======= + return mcl_potions.give_effect("poison", player, factor, duration) +>>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.regeneration_func(player, factor, duration) +<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end @@ -961,10 +1434,14 @@ function mcl_potions.regeneration_func(player, factor, duration) potions_set_hud(player) end +======= + return mcl_potions.give_effect("regeneration", player, factor, duration) +>>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.invisiblility_func(player, null, duration) +<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end @@ -1015,10 +1492,18 @@ function mcl_potions.water_breathing_func(player, null, duration) potions_set_icons(player) end +======= + return mcl_potions.give_effect("invisibility", player, null, duration) +end + +function mcl_potions.water_breathing_func(player, null, duration) + return mcl_potions.give_effect("water_breathing", player, null, duration) +>>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.fire_resistance_func(player, null, duration) +<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end @@ -1041,10 +1526,14 @@ function mcl_potions.fire_resistance_func(player, null, duration) potions_set_icons(player) end +======= + return mcl_potions.give_effect("fire_resistance", player, null, duration) +>>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.night_vision_func(player, null, duration) +<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end @@ -1077,6 +1566,9 @@ function mcl_potions.night_vision_func(player, null, duration) potions_set_icons(player) end +======= + return mcl_potions.give_effect("night_vision", player, null, duration) +>>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions._extinguish_nearby_fire(pos, radius) @@ -1131,16 +1623,17 @@ function mcl_potions._extinguish_nearby_fire(pos, radius) end function mcl_potions.bad_omen_func(player, factor, duration) - if not EF.bad_omen[player] then - EF.bad_omen[player] = {dur = duration, timer = 0, factor = factor} - else - local victim = EF.bad_omen[player] - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - victim.factor = factor - end - - if player:is_player() then - potions_set_icons(player) - end + mcl_potions.give_effect("bad_omen", player, factor, duration) +-- if not EF.bad_omen[player] then +-- EF.bad_omen[player] = {dur = duration, timer = 0, factor = factor} +-- else +-- local victim = EF.bad_omen[player] +-- victim.dur = math.max(duration, victim.dur - victim.timer) +-- victim.timer = 0 +-- victim.factor = factor +-- end +-- +-- if player:is_player() then +-- potions_set_icons(player) +-- end end diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index fd9240b92..8a872f73e 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -535,7 +535,7 @@ local slowness_def = { color = "#5A6C81", effect = 0.85, is_dur = true, - on_use = mcl_potions.swiftness_func, + on_use = mcl_potions.slowness_func, is_II = true, is_plus = true, is_inv = true, From 5750284e8f26418672a08394d29891f9ccd4db15 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 10 Oct 2023 01:07:26 +0200 Subject: [PATCH 02/91] Improved /effect command and fixes -improved the /effect command, allowing to use effect levels -fixed a bug in level-to-factor conversions -renamed effect icons to follow the new convention --- mods/ITEMS/mcl_potions/commands.lua | 62 ++++++++++-------- mods/ITEMS/mcl_potions/functions.lua | 31 +++++++-- mods/ITEMS/mcl_potions/init.lua | 23 +++---- ...=> mcl_potions_effect_fire_resistance.png} | Bin ...ng => mcl_potions_effect_invisibility.png} | Bin ...oned.png => mcl_potions_effect_poison.png} | Bin ...ng => mcl_potions_effect_regeneration.png} | Bin ...ow.png => mcl_potions_effect_slowness.png} | Bin ...ng.png => mcl_potions_effect_strength.png} | Bin ...t.png => mcl_potions_effect_swiftness.png} | Bin ...ak.png => mcl_potions_effect_weakness.png} | Bin 11 files changed, 74 insertions(+), 42 deletions(-) rename textures/{mcl_potions_effect_fire_proof.png => mcl_potions_effect_fire_resistance.png} (100%) rename textures/{mcl_potions_effect_invisible.png => mcl_potions_effect_invisibility.png} (100%) rename textures/{mcl_potions_effect_poisoned.png => mcl_potions_effect_poison.png} (100%) rename textures/{mcl_potions_effect_regenerating.png => mcl_potions_effect_regeneration.png} (100%) rename textures/{mcl_potions_effect_slow.png => mcl_potions_effect_slowness.png} (100%) rename textures/{mcl_potions_effect_strong.png => mcl_potions_effect_strength.png} (100%) rename textures/{mcl_potions_effect_swift.png => mcl_potions_effect_swiftness.png} (100%) rename textures/{mcl_potions_effect_weak.png => mcl_potions_effect_weakness.png} (100%) diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index 10bf86311..16b3ec01e 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -8,23 +8,9 @@ local S = minetest.get_translator(minetest.get_current_modname()) -- ░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░╚═╝░░░  ░╚════╝░░╚════╝░╚═╝░░░░░╚═╝╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░╚═════╝░ -local get_chat_function = {} - -get_chat_function["poison"] = mcl_potions.poison_func -get_chat_function["regeneration"] = mcl_potions.regeneration_func -get_chat_function["invisibility"] = mcl_potions.invisiblility_func -get_chat_function["fire_resistance"] = mcl_potions.fire_resistance_func -get_chat_function["night_vision"] = mcl_potions.night_vision_func -get_chat_function["water_breathing"] = mcl_potions.water_breathing_func -get_chat_function["leaping"] = mcl_potions.leaping_func -get_chat_function["swiftness"] = mcl_potions.swiftness_func -get_chat_function["heal"] = mcl_potions.healing_func -get_chat_function["bad_omen"] = mcl_potions.bad_omen_func -get_chat_function["withering"] = mcl_potions.withering_func - minetest.register_chatcommand("effect",{ - params = S(" []"), - description = S("Add a status effect to yourself. Arguments: : name of status effect, e.g. poison. : duration in seconds. : effect strength multiplier (1 = 100%)"), + params = S(" [] []"), + description = S("Add a status effect to yourself. Arguments: : name of status effect, e.g. poison. : duration in seconds. : effect power determinant, bigger level results in more powerful effect for effects that depend on the level, defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect."), privs = {server = true}, func = function(name, params) @@ -37,22 +23,46 @@ minetest.register_chatcommand("effect",{ if not P[1] then return false, S("Missing effect parameter!") - elseif not tonumber(P[2]) then + elseif P[1] == "list" then + local regs = mcl_potions.get_registered_effects() + local effects = "heal" + for name, _ in pairs(regs) do + effects = effects .. ", " .. name + end + return true, effects + elseif not tonumber(P[2])then return false, S("Missing or invalid duration parameter!") - elseif P[3] and not tonumber(P[3]) then - return false, S("Invalid factor parameter!") - end - -- Default factor = 1 - if not P[3] then - P[3] = 1.0 + elseif P[3] and not tonumber(P[3]) and P[3] ~= "F" then + return false, S("Invalid level parameter!") + elseif P[3] and P[3] == "F" and not P[4] then + return false, S("Missing or invalid factor parameter when level is F!") end - if get_chat_function[P[1]] then - get_chat_function[P[1]](minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2])) - return true + -- Default level = 1 + if not P[3] then + P[3] = 1 + end + + if mcl_potions.is_effect_registered(P[1]) then + if P[3] == "F" then + local given = mcl_potions.give_effect(P[1], minetest.get_player_by_name(name), tonumber(P[4]), tonumber(P[2])) + if given then + return true, S("@1 effect given to player @2 for @3 seconds with factor of @4.", P[1], name, P[2], P[4]) + else + return false, S("Giving effect @1 to player @2 failed.", P[1], name) + end + else + local given = mcl_potions.give_effect_by_level(P[1], minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2])) + if given then + return true, S("@1 effect on level @2 given to player @3 for @4 seconds.", P[1], P[3], name, P[2]) + else + return false, S("Giving effect @1 to player @2 failed.", P[1], name) + end + end else return false, S("@1 is not an available status effect.", P[1]) end end, }) + diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 6f0255f16..31c811e0b 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -48,7 +48,7 @@ local function generate_linear_lvl_to_fac(l1, l2) end local function generate_rational_lvl_to_fac(l1, l2) - local a = (l1 - l2) / 1.5 + local a = (l1 - l2) * 2 local b = 2*l2 - l1 return function(level) if level == 0 then return 0 end @@ -89,6 +89,15 @@ function mcl_potions.register_effect(def) if def.name == nil then error("Unable to register effect: name is nil") end + if def.name == "list" then + error("Unable to register effect: list is a reserved word") + end + if def.name == "heal" then + error("Unable to register effect: heal is a reserved word") + end + if registered_effects[name] then + error("Effect named "..name.." already registered!") + end local name = def.name local pdef = {} if not def.icon then @@ -141,6 +150,18 @@ function mcl_potions.register_effect(def) EF[name] = {} end +function mcl_potions.get_registered_effects() + return table.copy(registered_effects) +end + +function mcl_potions.is_effect_registered(name) + if registered_effects[name] then + return true + else + return false + end +end + mcl_potions.register_effect({ name = "invisibility", on_start = function(object, factor) @@ -891,7 +912,7 @@ function mcl_potions._load_player_effects(player) -- new API effects + on_load for loaded legacy effects for name, effect in pairs(registered_effects) do - local loaded = minetest.deserialize(meta:get_string("mcl_potions:"..name)) + local loaded = minetest.deserialize(meta:get_string("mcl_potions:_EF_"..name)) if loaded then EF[name][player] = loaded end if EF[name][player] and effect.on_load then effect.on_load(player, EF[name][player].factor) @@ -1133,10 +1154,8 @@ local function target_valid(object, name) end function mcl_potions.give_effect(name, object, factor, duration) - if not target_valid(object, name) then return false end - local edef = registered_effects[name] - if not edef then return false end + if not edef or not target_valid(object, name) then return false end if not EF[name][object] then local vals = {dur = duration, timer = 0,} if edef.uses_factor then vals.factor = factor end @@ -1160,6 +1179,8 @@ function mcl_potions.give_effect(name, object, factor, duration) end if object:is_player() then potions_set_hud(object) end + + return true end function mcl_potions.give_effect_by_level(name, object, level, duration) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 8e4c53cad..8c308f1fb 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -462,17 +462,18 @@ function mcl_potions.get_alchemy(ingr, pot) return false end -mcl_mobs.effect_functions["poison"] = mcl_potions.poison_func -mcl_mobs.effect_functions["regeneration"] = mcl_potions.regeneration_func -mcl_mobs.effect_functions["invisibility"] = mcl_potions.invisiblility_func -mcl_mobs.effect_functions["fire_resistance"] = mcl_potions.fire_resistance_func -mcl_mobs.effect_functions["night_vision"] = mcl_potions.night_vision_func -mcl_mobs.effect_functions["water_breathing"] = mcl_potions.water_breathing_func -mcl_mobs.effect_functions["leaping"] = mcl_potions.leaping_func -mcl_mobs.effect_functions["swiftness"] = mcl_potions.swiftness_func -mcl_mobs.effect_functions["heal"] = mcl_potions.healing_func -mcl_mobs.effect_functions["bad_omen"] = mcl_potions.bad_omen_func -mcl_mobs.effect_functions["withering"] = mcl_potions.withering_func +-- TODO replace all calls to the old API with new API calls in other mods +-- mcl_mobs.effect_functions["poison"] = mcl_potions.poison_func +-- mcl_mobs.effect_functions["regeneration"] = mcl_potions.regeneration_func +-- mcl_mobs.effect_functions["invisibility"] = mcl_potions.invisiblility_func +-- mcl_mobs.effect_functions["fire_resistance"] = mcl_potions.fire_resistance_func +-- mcl_mobs.effect_functions["night_vision"] = mcl_potions.night_vision_func +-- mcl_mobs.effect_functions["water_breathing"] = mcl_potions.water_breathing_func +-- mcl_mobs.effect_functions["leaping"] = mcl_potions.leaping_func +-- mcl_mobs.effect_functions["swiftness"] = mcl_potions.swiftness_func +-- mcl_mobs.effect_functions["heal"] = mcl_potions.healing_func +-- mcl_mobs.effect_functions["bad_omen"] = mcl_potions.bad_omen_func +-- mcl_mobs.effect_functions["withering"] = mcl_potions.withering_func -- give withering to players in a wither rose local etime = 0 diff --git a/textures/mcl_potions_effect_fire_proof.png b/textures/mcl_potions_effect_fire_resistance.png similarity index 100% rename from textures/mcl_potions_effect_fire_proof.png rename to textures/mcl_potions_effect_fire_resistance.png diff --git a/textures/mcl_potions_effect_invisible.png b/textures/mcl_potions_effect_invisibility.png similarity index 100% rename from textures/mcl_potions_effect_invisible.png rename to textures/mcl_potions_effect_invisibility.png diff --git a/textures/mcl_potions_effect_poisoned.png b/textures/mcl_potions_effect_poison.png similarity index 100% rename from textures/mcl_potions_effect_poisoned.png rename to textures/mcl_potions_effect_poison.png diff --git a/textures/mcl_potions_effect_regenerating.png b/textures/mcl_potions_effect_regeneration.png similarity index 100% rename from textures/mcl_potions_effect_regenerating.png rename to textures/mcl_potions_effect_regeneration.png diff --git a/textures/mcl_potions_effect_slow.png b/textures/mcl_potions_effect_slowness.png similarity index 100% rename from textures/mcl_potions_effect_slow.png rename to textures/mcl_potions_effect_slowness.png diff --git a/textures/mcl_potions_effect_strong.png b/textures/mcl_potions_effect_strength.png similarity index 100% rename from textures/mcl_potions_effect_strong.png rename to textures/mcl_potions_effect_strength.png diff --git a/textures/mcl_potions_effect_swift.png b/textures/mcl_potions_effect_swiftness.png similarity index 100% rename from textures/mcl_potions_effect_swift.png rename to textures/mcl_potions_effect_swiftness.png diff --git a/textures/mcl_potions_effect_weak.png b/textures/mcl_potions_effect_weakness.png similarity index 100% rename from textures/mcl_potions_effect_weak.png rename to textures/mcl_potions_effect_weakness.png From d1ca0f23f03b9b5c77392fded486d5e544952c0a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 12 Oct 2023 23:11:45 +0200 Subject: [PATCH 03/91] Resolved merge conflict --- mods/ITEMS/mcl_potions/functions.lua | 704 +-------------------------- 1 file changed, 1 insertion(+), 703 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 31c811e0b..d27d7a844 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1,21 +1,5 @@ local EF = {} -<<<<<<< HEAD -EF.invisible = {} -EF.poisoned = {} -EF.regenerating = {} -EF.strong = {} -EF.weak = {} -EF.water_breathing = {} -EF.leaping = {} -EF.swift = {} -- for swiftness AND slowness -EF.night_vision = {} -EF.fire_proof = {} -EF.bad_omen = {} -EF.withering = {} -======= - local registered_effects = {} ->>>>>>> df28ce66d (General effects API overhaul) local EFFECT_TYPES = 0 minetest.register_on_mods_loaded(function() @@ -368,19 +352,11 @@ mcl_potions.register_effect({ local icon_ids = {} local function potions_set_hudbar(player) -<<<<<<< HEAD - if EF.withering[player] and EF.regenerating[player] then - hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_regen_wither.png", nil, "hudbars_bar_health.png") - elseif EF.withering[player] then - hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_wither.png", nil, "hudbars_bar_health.png") - elseif EF.poisoned[player] and EF.regenerating[player] then -======= if EF.withering[player] and EF.regeneration[player] then hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_regen_wither.png", nil, "hudbars_bar_health.png") elseif EF.withering[player] then hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_wither.png", nil, "hudbars_bar_health.png") elseif EF.poison[player] and EF.regeneration[player] then ->>>>>>> df28ce66d (General effects API overhaul) hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png") elseif EF.poison[player] then hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png") @@ -479,285 +455,6 @@ minetest.register_globalstep(function(dtime) end end end -<<<<<<< HEAD - - -- Check for withering players - for player, vals in pairs(EF.withering) do - - is_player = player:is_player() - entity = player:get_luaentity() - - EF.withering[player].timer = EF.withering[player].timer + dtime - EF.withering[player].hit_timer = (EF.withering[player].hit_timer or 0) + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#000000") end - - if EF.withering[player].hit_timer >= EF.withering[player].step then - if is_player or entity then mcl_util.deal_damage(player, 1, {type = "magic"}) end - if EF.withering[player] then EF.withering[player].hit_timer = 0 end - end - - if EF.withering[player] and EF.withering[player].timer >= EF.withering[player].dur then - EF.withering[player] = nil - if is_player then - meta = player:get_meta() - meta:set_string("_is_withering", minetest.serialize(EF.withering[player])) - potions_set_hud(player) - end - end - - end - - -- Check for poisoned players - for player, vals in pairs(EF.poisoned) do - - is_player = player:is_player() - entity = player:get_luaentity() - - EF.poisoned[player].timer = EF.poisoned[player].timer + dtime - EF.poisoned[player].hit_timer = (EF.poisoned[player].hit_timer or 0) + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#4E9331") end - - if EF.poisoned[player].hit_timer >= EF.poisoned[player].step then - if mcl_util.get_hp(player) - 1 > 0 then - mcl_util.deal_damage(player, 1, {type = "magic"}) - end - EF.poisoned[player].hit_timer = 0 - end - - if EF.poisoned[player] and EF.poisoned[player].timer >= EF.poisoned[player].dur then - EF.poisoned[player] = nil - if is_player then - meta = player:get_meta() - meta:set_string("_is_poisoned", minetest.serialize(EF.poisoned[player])) - potions_set_hud(player) - end - end - - end - - -- Check for regenerating players - for player, vals in pairs(EF.regenerating) do - - is_player = player:is_player() - entity = player:get_luaentity() - - EF.regenerating[player].timer = EF.regenerating[player].timer + dtime - EF.regenerating[player].heal_timer = (EF.regenerating[player].heal_timer or 0) + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#CD5CAB") end - - if EF.regenerating[player].heal_timer >= EF.regenerating[player].step then - - if is_player then - player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1), { type = "set_hp", other = "regeneration" }) - EF.regenerating[player].heal_timer = 0 - elseif entity and entity.is_mob then - entity.health = math.min(entity.hp_max, entity.health + 1) - EF.regenerating[player].heal_timer = 0 - else -- stop regenerating if not a player or mob - EF.regenerating[player] = nil - end - - end - - if EF.regenerating[player] and EF.regenerating[player].timer >= EF.regenerating[player].dur then - EF.regenerating[player] = nil - if is_player then - meta = player:get_meta() - meta:set_string("_is_regenerating", minetest.serialize(EF.regenerating[player])) - potions_set_hud(player) - end - end - - end - - -- Check for water breathing players - for player, vals in pairs(EF.water_breathing) do - - if player:is_player() then - - EF.water_breathing[player].timer = EF.water_breathing[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#2E5299") end - - if player:get_breath() then - hb.hide_hudbar(player, "breath") - if player:get_breath() < 10 then player:set_breath(10) end - end - - if EF.water_breathing[player].timer >= EF.water_breathing[player].dur then - meta = player:get_meta() - meta:set_string("_is_water_breathing", minetest.serialize(EF.water_breathing[player])) - EF.water_breathing[player] = nil - end - potions_set_hud(player) - - else - EF.water_breathing[player] = nil - end - - end - - -- Check for leaping players - for player, vals in pairs(EF.leaping) do - - if player:is_player() then - - EF.leaping[player].timer = EF.leaping[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#22FF4C") end - - if EF.leaping[player].timer >= EF.leaping[player].dur then - playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping") - EF.leaping[player] = nil - meta = player:get_meta() - meta:set_string("_is_leaping", minetest.serialize(EF.leaping[player])) - end - potions_set_hud(player) - - else - EF.leaping[player] = nil - end - - end - - -- Check for swift players - for player, vals in pairs(EF.swift) do - - if player:is_player() then - - EF.swift[player].timer = EF.swift[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#7CAFC6") end - - if EF.swift[player].timer >= EF.swift[player].dur then - playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness") - EF.swift[player] = nil - meta = player:get_meta() - meta:set_string("_is_swift", minetest.serialize(EF.swift[player])) - end - potions_set_hud(player) - - else - EF.swift[player] = nil - end - - end - - -- Check for Night Vision equipped players - for player, vals in pairs(EF.night_vision) do - - if player:is_player() then - - EF.night_vision[player].timer = EF.night_vision[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#1F1FA1") end - - if EF.night_vision[player].timer >= EF.night_vision[player].dur then - EF.night_vision[player] = nil - meta = player:get_meta() - meta:set_string("_is_cat", minetest.serialize(EF.night_vision[player])) - meta:set_int("night_vision", 0) - end - mcl_weather.skycolor.update_sky_color({player}) - potions_set_hud(player) - - else - EF.night_vision[player] = nil - end - - end - - -- Check for Fire Proof players - for player, vals in pairs(EF.fire_proof) do - - if player:is_player() then - - player = player or player:get_luaentity() - - EF.fire_proof[player].timer = EF.fire_proof[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#E49A3A") end - - if EF.fire_proof[player].timer >= EF.fire_proof[player].dur then - EF.fire_proof[player] = nil - meta = player:get_meta() - meta:set_string("_is_fire_proof", minetest.serialize(EF.fire_proof[player])) - end - potions_set_hud(player) - - else - EF.fire_proof[player] = nil - end - - end - - -- Check for Weak players - for player, vals in pairs(EF.weak) do - - if player:is_player() then - - EF.weak[player].timer = EF.weak[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#484D48") end - - if EF.weak[player].timer >= EF.weak[player].dur then - EF.weak[player] = nil - meta = player:get_meta() - meta:set_string("_is_weak", minetest.serialize(EF.weak[player])) - end - - else - EF.weak[player] = nil - end - - end - - -- Check for Strong players - for player, vals in pairs(EF.strong) do - - if player:is_player() then - - EF.strong[player].timer = EF.strong[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#932423") end - - if EF.strong[player].timer >= EF.strong[player].dur then - EF.strong[player] = nil - meta = player:get_meta() - meta:set_string("_is_strong", minetest.serialize(EF.strong[player])) - end - - else - EF.strong[player] = nil - end - - end - - -- Check for Bad Omen - for player, vals in pairs(EF.bad_omen) do - - is_player = player:is_player() - - EF.bad_omen[player].timer = EF.bad_omen[player].timer + dtime - - if player:get_pos() then mcl_potions._add_spawner(player, "#0b6138") end - - if EF.bad_omen[player] and EF.bad_omen[player].timer >= EF.bad_omen[player].dur then - EF.bad_omen[player] = nil - if is_player then - meta = player:get_meta() - meta:set_string("_has_bad_omen", minetest.serialize(EF.bad_omen[player])) - potions_set_hud(player) - end - end - - end - -======= ->>>>>>> df28ce66d (General effects API overhaul) end) @@ -776,24 +473,9 @@ end) -- ╚══════╝░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝ function mcl_potions._clear_cached_player_data(player) -<<<<<<< HEAD - EF.invisible[player] = nil - EF.poisoned[player] = nil - EF.regenerating[player] = nil - EF.strong[player] = nil - EF.weak[player] = nil - EF.water_breathing[player] = nil - EF.leaping[player] = nil - EF.swift[player] = nil - EF.night_vision[player] = nil - EF.fire_proof[player] = nil - EF.bad_omen[player] = nil - EF.withering[player] = nil -======= for name, effect in pairs(EF) do effect[player] = nil end ->>>>>>> df28ce66d (General effects API overhaul) meta = player:get_meta() meta:set_int("night_vision", 0) @@ -821,25 +503,9 @@ function mcl_potions._save_player_effects(player) end meta = player:get_meta() -<<<<<<< HEAD - meta:set_string("_is_invisible", minetest.serialize(EF.invisible[player])) - meta:set_string("_is_poisoned", minetest.serialize(EF.poisoned[player])) - meta:set_string("_is_regenerating", minetest.serialize(EF.regenerating[player])) - meta:set_string("_is_strong", minetest.serialize(EF.strong[player])) - meta:set_string("_is_weak", minetest.serialize(EF.weak[player])) - meta:set_string("_is_water_breathing", minetest.serialize(EF.water_breathing[player])) - meta:set_string("_is_leaping", minetest.serialize(EF.leaping[player])) - meta:set_string("_is_swift", minetest.serialize(EF.swift[player])) - meta:set_string("_is_cat", minetest.serialize(EF.night_vision[player])) - meta:set_string("_is_fire_proof", minetest.serialize(EF.fire_proof[player])) - meta:set_string("_has_bad_omen", minetest.serialize(EF.bad_omen[player])) - meta:set_string("_is_withering", minetest.serialize(EF.withering[player])) - -======= for name, effect in pairs(registered_effects) do meta:set_string("mcl_potions:_EF_"..name, minetest.serialize(EF[name][player])) end ->>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions._load_player_effects(player) @@ -918,50 +584,6 @@ function mcl_potions._load_player_effects(player) effect.on_load(player, EF[name][player].factor) end end -<<<<<<< HEAD - - if minetest.deserialize(meta:get_string("_is_regenerating")) then - EF.regenerating[player] = minetest.deserialize(meta:get_string("_is_regenerating")) - end - - if minetest.deserialize(meta:get_string("_is_strong")) then - EF.strong[player] = minetest.deserialize(meta:get_string("_is_strong")) - end - - if minetest.deserialize(meta:get_string("_is_weak")) then - EF.weak[player] = minetest.deserialize(meta:get_string("_is_weak")) - end - - if minetest.deserialize(meta:get_string("_is_water_breathing")) then - EF.water_breathing[player] = minetest.deserialize(meta:get_string("_is_water_breathing")) - end - - if minetest.deserialize(meta:get_string("_is_leaping")) then - EF.leaping[player] = minetest.deserialize(meta:get_string("_is_leaping")) - end - - if minetest.deserialize(meta:get_string("_is_swift")) then - EF.swift[player] = minetest.deserialize(meta:get_string("_is_swift")) - end - - if minetest.deserialize(meta:get_string("_is_cat")) then - EF.night_vision[player] = minetest.deserialize(meta:get_string("_is_cat")) - end - - if minetest.deserialize(meta:get_string("_is_fire_proof")) then - EF.fire_proof[player] = minetest.deserialize(meta:get_string("_is_fire_proof")) - end - - if minetest.deserialize(meta:get_string("_has_bad_omen")) then - EF.bad_omen[player] = minetest.deserialize(meta:get_string("_has_bad_omen")) - end - - if minetest.deserialize(meta:get_string("_is_withering")) then - EF.withering[player] = minetest.deserialize(meta:get_string("_is_withering")) - end - -======= ->>>>>>> df28ce66d (General effects API overhaul) end -- Returns true if player has given effect @@ -1144,7 +766,7 @@ end -- ╚═╝░░░░░░╚═════╝░╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░ local function target_valid(object, name) - if object:get_hp() <= 0 then return false end + if not object or object:get_hp() <= 0 then return false end local entity = object:get_luaentity() if entity and entity.is_boss then return false end @@ -1193,13 +815,7 @@ function mcl_potions.give_effect_by_level(name, object, level, duration) end function mcl_potions.healing_func(player, hp) - -<<<<<<< HEAD if not player or player:get_hp() <= 0 then return false end -======= - if player:get_hp() <= 0 then return false end ->>>>>>> df28ce66d (General effects API overhaul) - local obj = player:get_luaentity() if obj and obj.harmed_by_heal then hp = -hp end @@ -1225,103 +841,6 @@ function mcl_potions.healing_func(player, hp) end end -<<<<<<< HEAD -function mcl_potions.swiftness_func(player, factor, duration) - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - if not player:get_meta() then - return false - end - - if not EF.swift[player] then - - EF.swift[player] = {dur = duration, timer = 0, is_slow = factor < 1} - playerphysics.add_physics_factor(player, "speed", "mcl_potions:swiftness", factor) - - else - - local victim = EF.swift[player] - - playerphysics.add_physics_factor(player, "speed", "mcl_potions:swiftness", factor) - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - victim.is_slow = factor < 1 - - end - - if player:is_player() then - potions_set_icons(player) - end - -end - -function mcl_potions.leaping_func(player, factor, duration) - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - if not player:get_meta() then - return false - end - - if not EF.leaping[player] then - - EF.leaping[player] = {dur = duration, timer = 0} - playerphysics.add_physics_factor(player, "jump", "mcl_potions:leaping", factor) - - else - - local victim = EF.leaping[player] - - playerphysics.add_physics_factor(player, "jump", "mcl_potions:leaping", factor) - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_icons(player) - end - -end - - -function mcl_potions.weakness_func(player, factor, duration) - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - if not EF.weak[player] then - - EF.weak[player] = {dur = duration, timer = 0, factor = factor} - - else - - local victim = EF.weak[player] - - victim.factor = factor - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_icons(player) - end - -end - - -======= ->>>>>>> df28ce66d (General effects API overhaul) function mcl_potions.strength_func(player, factor, duration) return mcl_potions.give_effect("strength", player, factor, duration) end @@ -1338,258 +857,37 @@ function mcl_potions.slowness_func(player, factor, duration) return mcl_potions.give_effect("slowness", player, factor, duration) end -<<<<<<< HEAD - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - if not EF.strong[player] then - - EF.strong[player] = {dur = duration, timer = 0, factor = factor} - - else - - local victim = EF.strong[player] - - victim.factor = factor - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_icons(player) - end - -======= function mcl_potions.withering_func(player, factor, duration) return mcl_potions.give_effect("withering", player, factor, duration) ->>>>>>> df28ce66d (General effects API overhaul) -end - - -function mcl_potions.withering_func(player, factor, duration) - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and (entity.is_boss or string.find(entity.name, "wither")) then return false end - - if not EF.withering[player] then - - EF.withering[player] = {step = factor, dur = duration, timer = 0} - - else - - local victim = EF.withering[player] - - victim.step = math.min(victim.step, factor) - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_hud(player) - end - end function mcl_potions.poison_func(player, factor, duration) -<<<<<<< HEAD - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and (entity.is_boss or entity.harmed_by_heal or string.find(entity.name, "spider")) then return false end - - if not EF.poisoned[player] then - - EF.poisoned[player] = {step = factor, dur = duration, timer = 0} - - else - - local victim = EF.poisoned[player] - - victim.step = math.min(victim.step, factor) - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_hud(player) - end - -======= return mcl_potions.give_effect("poison", player, factor, duration) ->>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.regeneration_func(player, factor, duration) -<<<<<<< HEAD - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and (entity.is_boss or entity.harmed_by_heal) then return false end - - if not EF.regenerating[player] then - - EF.regenerating[player] = {step = factor, dur = duration, timer = 0} - - else - - local victim = EF.regenerating[player] - - victim.step = math.min(victim.step, factor) - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_hud(player) - end - -======= return mcl_potions.give_effect("regeneration", player, factor, duration) ->>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.invisiblility_func(player, null, duration) -<<<<<<< HEAD - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - if not EF.invisible[player] then - - EF.invisible[player] = {dur = duration, timer = 0} - mcl_potions.make_invisible(player, true) - - else - - local victim = EF.invisible[player] - - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_icons(player) - end - -end - -function mcl_potions.water_breathing_func(player, null, duration) - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - if not EF.water_breathing[player] then - - EF.water_breathing[player] = {dur = duration, timer = 0} - - else - - local victim = EF.water_breathing[player] - - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_icons(player) - end - -======= return mcl_potions.give_effect("invisibility", player, null, duration) end function mcl_potions.water_breathing_func(player, null, duration) return mcl_potions.give_effect("water_breathing", player, null, duration) ->>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.fire_resistance_func(player, null, duration) -<<<<<<< HEAD - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - if not EF.fire_proof[player] then - - EF.fire_proof[player] = {dur = duration, timer = 0} - - else - - local victim = EF.fire_proof[player] - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - if player:is_player() then - potions_set_icons(player) - end - -======= return mcl_potions.give_effect("fire_resistance", player, null, duration) ->>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions.night_vision_func(player, null, duration) -<<<<<<< HEAD - - if not player or player:get_hp() <= 0 then return false end - - local entity = player:get_luaentity() - if entity and entity.is_boss then return false end - - meta = player:get_meta() - if not EF.night_vision[player] then - - EF.night_vision[player] = {dur = duration, timer = 0} - - else - - local victim = EF.night_vision[player] - - victim.dur = math.max(duration, victim.dur - victim.timer) - victim.timer = 0 - - end - - is_player = player:is_player() - if is_player then - meta:set_int("night_vision", 1) - else - return -- Do not attempt to set night_vision on mobs - end - mcl_weather.skycolor.update_sky_color({player}) - - if player:is_player() then - potions_set_icons(player) - end - -======= return mcl_potions.give_effect("night_vision", player, null, duration) ->>>>>>> df28ce66d (General effects API overhaul) end function mcl_potions._extinguish_nearby_fire(pos, radius) From 5827a7638d295a83485ad8c396f4ab2763a38bb2 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 12 Oct 2023 23:51:14 +0200 Subject: [PATCH 04/91] Reimplemented /effect heal and fixed bugs -heal subcommand to the /effect reimplemented -healing_func() from old API standardized, included in new API -(the last point is due to it being substantially different from others) -fixed a few bugs, potential crashes -fixed incorrect withering effect progression -standardized variable naming --- mods/ITEMS/mcl_potions/commands.lua | 20 +++++- mods/ITEMS/mcl_potions/functions.lua | 92 ++++++++++++---------------- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index 16b3ec01e..a04f8f079 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -9,8 +9,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) minetest.register_chatcommand("effect",{ - params = S(" [] []"), - description = S("Add a status effect to yourself. Arguments: : name of status effect, e.g. poison. : duration in seconds. : effect power determinant, bigger level results in more powerful effect for effects that depend on the level, defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect."), + params = S("|heal|list [] []"), + description = S("Add a status effect to yourself. Arguments: : name of status effect, e.g. poison. Passing list as effect name lists available effects. Passing heal as effect name heals (or harms) by amount designed by the next parameter. : duration in seconds. (: amount of healing when the effect is heal, passing a negative value subtracts health.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level, defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect."), privs = {server = true}, func = function(name, params) @@ -30,7 +30,21 @@ minetest.register_chatcommand("effect",{ effects = effects .. ", " .. name end return true, effects - elseif not tonumber(P[2])then + elseif P[1] == "heal" then + local hp = tonumber(P[2]) + if not hp or hp == 0 then + return false, S("Missing or invalid heal amount parameter!") + else + mcl_potions.healing_func(minetest.get_player_by_name(name), hp) + if hp > 0 then + if hp < 1 then hp = 1 end + return true, S("Player @1 healed by @2 HP.", name, hp) + else + if hp > -1 then hp = -1 end + return true, S("Player @1 harmed by @2 HP.", name, hp) + end + end + elseif not tonumber(P[2]) then return false, S("Missing or invalid duration parameter!") elseif P[3] and not tonumber(P[3]) and P[3] ~= "F" then return false, S("Invalid level parameter!") diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index d27d7a844..a5d05e8f9 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -330,7 +330,7 @@ mcl_potions.register_effect({ particle_color = "#000000", uses_factor = true, lvl1_factor = 2, - lvl2_factor = 0.5, + lvl2_factor = 1, timer_uses_factor = true, }) @@ -444,7 +444,7 @@ minetest.register_globalstep(function(dtime) end end - if EF[name][object].timer >= vals.dur then + if not EF[name][object] or EF[name][object].timer >= vals.dur then if effect.on_end then effect.on_end(object) end EF[name][object] = nil if object:is_player() then @@ -684,13 +684,13 @@ function mcl_potions.make_invisible(obj_ref, hide) mcl_player.player_set_visibility(obj_ref, true) obj_ref:set_nametag_attributes({ color = { r = 255, g = 255, b = 255, a = 255 } }) end - else + else -- TODO make below section (and preferably other effects on mobs) rely on metadata if hide then local luaentity = obj_ref:get_luaentity() - EF.invisible[obj_ref].old_size = luaentity.visual_size + EF.invisibility[obj_ref].old_size = luaentity.visual_size obj_ref:set_properties({ visual_size = { x = 0, y = 0 } }) else - obj_ref:set_properties({ visual_size = EF.invisible[obj_ref].old_size }) + obj_ref:set_properties({ visual_size = EF.invisibility[obj_ref].old_size }) end end end @@ -814,11 +814,11 @@ function mcl_potions.give_effect_by_level(name, object, level, duration) return mcl_potions.give_effect(name, object, factor, duration) end -function mcl_potions.healing_func(player, hp) - if not player or player:get_hp() <= 0 then return false end - local obj = player:get_luaentity() +function mcl_potions.healing_func(object, hp) + if not object or object:get_hp() <= 0 then return false end + local ent = object:get_luaentity() - if obj and obj.harmed_by_heal then hp = -hp end + if ent and ent.harmed_by_heal then hp = -hp end if hp > 0 then -- at least 1 HP @@ -826,10 +826,10 @@ function mcl_potions.healing_func(player, hp) hp = 1 end - if obj and obj.is_mob then - obj.health = math.max(obj.health + hp, obj.hp_max) - elseif player:is_player() then - player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" }) + if ent and ent.is_mob then + ent.health = math.min(ent.health + hp, ent.hp_max) + elseif object:is_player() then + object:set_hp(math.min(object:get_hp() + hp, object:get_properties().hp_max), { type = "set_hp", other = "healing" }) end elseif hp < 0 then @@ -837,57 +837,57 @@ function mcl_potions.healing_func(player, hp) hp = -1 end - mcl_util.deal_damage(player, -hp, {type = "magic"}) + mcl_util.deal_damage(object, -hp, {type = "magic"}) end end -function mcl_potions.strength_func(player, factor, duration) - return mcl_potions.give_effect("strength", player, factor, duration) +function mcl_potions.strength_func(object, factor, duration) + return mcl_potions.give_effect("strength", object, factor, duration) end -function mcl_potions.leaping_func(player, factor, duration) - return mcl_potions.give_effect("leaping", player, factor, duration) +function mcl_potions.leaping_func(object, factor, duration) + return mcl_potions.give_effect("leaping", object, factor, duration) end -function mcl_potions.weakness_func(player, factor, duration) - return mcl_potions.give_effect("weakness", player, factor, duration) +function mcl_potions.weakness_func(object, factor, duration) + return mcl_potions.give_effect("weakness", object, factor, duration) end -function mcl_potions.swiftness_func(player, factor, duration) - return mcl_potions.give_effect("swiftness", player, factor, duration) +function mcl_potions.swiftness_func(object, factor, duration) + return mcl_potions.give_effect("swiftness", object, factor, duration) end -function mcl_potions.slowness_func(player, factor, duration) - return mcl_potions.give_effect("slowness", player, factor, duration) +function mcl_potions.slowness_func(object, factor, duration) + return mcl_potions.give_effect("slowness", object, factor, duration) end -function mcl_potions.withering_func(player, factor, duration) - return mcl_potions.give_effect("withering", player, factor, duration) +function mcl_potions.withering_func(object, factor, duration) + return mcl_potions.give_effect("withering", object, factor, duration) end -function mcl_potions.poison_func(player, factor, duration) - return mcl_potions.give_effect("poison", player, factor, duration) +function mcl_potions.poison_func(object, factor, duration) + return mcl_potions.give_effect("poison", object, factor, duration) end -function mcl_potions.regeneration_func(player, factor, duration) - return mcl_potions.give_effect("regeneration", player, factor, duration) +function mcl_potions.regeneration_func(object, factor, duration) + return mcl_potions.give_effect("regeneration", object, factor, duration) end -function mcl_potions.invisiblility_func(player, null, duration) - return mcl_potions.give_effect("invisibility", player, null, duration) +function mcl_potions.invisiblility_func(object, null, duration) + return mcl_potions.give_effect("invisibility", object, null, duration) end -function mcl_potions.water_breathing_func(player, null, duration) - return mcl_potions.give_effect("water_breathing", player, null, duration) +function mcl_potions.water_breathing_func(object, null, duration) + return mcl_potions.give_effect("water_breathing", object, null, duration) end -function mcl_potions.fire_resistance_func(player, null, duration) - return mcl_potions.give_effect("fire_resistance", player, null, duration) +function mcl_potions.fire_resistance_func(object, null, duration) + return mcl_potions.give_effect("fire_resistance", object, null, duration) end -function mcl_potions.night_vision_func(player, null, duration) - return mcl_potions.give_effect("night_vision", player, null, duration) +function mcl_potions.night_vision_func(object, null, duration) + return mcl_potions.give_effect("night_vision", object, null, duration) end function mcl_potions._extinguish_nearby_fire(pos, radius) @@ -941,18 +941,6 @@ function mcl_potions._extinguish_nearby_fire(pos, radius) return exting end -function mcl_potions.bad_omen_func(player, factor, duration) - mcl_potions.give_effect("bad_omen", player, factor, duration) --- if not EF.bad_omen[player] then --- EF.bad_omen[player] = {dur = duration, timer = 0, factor = factor} --- else --- local victim = EF.bad_omen[player] --- victim.dur = math.max(duration, victim.dur - victim.timer) --- victim.timer = 0 --- victim.factor = factor --- end --- --- if player:is_player() then --- potions_set_icons(player) --- end +function mcl_potions.bad_omen_func(object, factor, duration) + mcl_potions.give_effect("bad_omen", object, factor, duration) end From d85e582e8c307ed3dbb0e0f3a34af9154b82503d Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 27 Oct 2023 03:19:25 +0200 Subject: [PATCH 05/91] Arabic-to-Roman converter redo -rewrote the Arabic-to-Roman number converter -moved it to mcl_util --- mods/CORE/mcl_util/init.lua | 2 ++ mods/CORE/mcl_util/roman_numerals.lua | 30 +++++++++++++++++ mods/ITEMS/mcl_enchanting/engine.lua | 2 +- mods/ITEMS/mcl_enchanting/init.lua | 1 - mods/ITEMS/mcl_enchanting/mod.conf | 2 +- mods/ITEMS/mcl_enchanting/roman_numerals.lua | 34 -------------------- 6 files changed, 34 insertions(+), 37 deletions(-) create mode 100644 mods/CORE/mcl_util/roman_numerals.lua delete mode 100644 mods/ITEMS/mcl_enchanting/roman_numerals.lua diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index c2ae5391e..4204e218d 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1,5 +1,7 @@ mcl_util = {} +dofile(minetest.get_modpath(minetest.get_current_modname()).."/roman_numerals.lua") + -- Updates all values in t using values from to*. function table.update(t, ...) for _, to in ipairs {...} do diff --git a/mods/CORE/mcl_util/roman_numerals.lua b/mods/CORE/mcl_util/roman_numerals.lua new file mode 100644 index 000000000..a808e43f1 --- /dev/null +++ b/mods/CORE/mcl_util/roman_numerals.lua @@ -0,0 +1,30 @@ +local converter = { + {1000, "M"}, + {900, "CM"}, + {500, "D"}, + {400, "CD"}, + {100, "C"}, + {90, "XC"}, + {50, "L"}, + {40, "XL"}, + {10, "X"}, + {9, "IX"}, + {5, "V"}, + {4, "IV"}, + {1, "I"} +} + +mcl_util.to_roman = function(number) + local r = "" + local a = number + local i = 1 + while a > 0 do + if a >= converter[i][1] then + a = a - converter[i][1] + r = r.. converter[i][2] + else + i = i + 1 + end + end + return r +end diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index 67ef72056..dd01d5950 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -56,7 +56,7 @@ end function mcl_enchanting.get_enchantment_description(enchantment, level) local enchantment_def = mcl_enchanting.enchantments[enchantment] return enchantment_def.name .. - (enchantment_def.max_level == 1 and "" or " " .. mcl_enchanting.roman_numerals.toRoman(level)) + (enchantment_def.max_level == 1 and "" or " " .. mcl_util.to_roman(level)) end function mcl_enchanting.get_colorized_enchantment_description(enchantment, level) diff --git a/mods/ITEMS/mcl_enchanting/init.lua b/mods/ITEMS/mcl_enchanting/init.lua index 9f9fbd271..02ed1ee85 100644 --- a/mods/ITEMS/mcl_enchanting/init.lua +++ b/mods/ITEMS/mcl_enchanting/init.lua @@ -11,7 +11,6 @@ mcl_enchanting = { book_animation_steps = {0, 640, 680, 700, 740}, book_animation_loop = {["open"] = true, ["close"] = true}, book_animation_speed = 40, - roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49 enchantments = {}, overlay = "^[colorize:purple:50", --overlay = "^[invert:rgb^[multiply:#4df44d:50^[invert:rgb", diff --git a/mods/ITEMS/mcl_enchanting/mod.conf b/mods/ITEMS/mcl_enchanting/mod.conf index 610492857..d163fcd55 100644 --- a/mods/ITEMS/mcl_enchanting/mod.conf +++ b/mods/ITEMS/mcl_enchanting/mod.conf @@ -1,5 +1,5 @@ name = mcl_enchanting description = Enchanting for MineClone2 -depends = tt, walkover, mcl_sounds, mcl_colors, mcl_experience +depends = tt, walkover, mcl_sounds, mcl_colors, mcl_experience, mcl_util optional_depends = screwdriver author = Fleckenstein diff --git a/mods/ITEMS/mcl_enchanting/roman_numerals.lua b/mods/ITEMS/mcl_enchanting/roman_numerals.lua deleted file mode 100644 index f40c65406..000000000 --- a/mods/ITEMS/mcl_enchanting/roman_numerals.lua +++ /dev/null @@ -1,34 +0,0 @@ --------------------------------------------------------------------- ---! @file ---! @brief Convert from normal numbers to Roman Numerals ---------------------------------------------------------------------- -local conversionTable = { - { number = 1000, symbol = "M" }, - { number = 900, symbol = "CM" }, - { number = 500, symbol = "D" }, - { number = 400, symbol = "CD" }, - { number = 100, symbol = "C" }, - { number = 90, symbol = "XC" }, - { number = 50, symbol = "L" }, - { number = 40, symbol = "XL" }, - { number = 10, symbol = "X" }, - { number = 9, symbol = "IX" }, - { number = 5, symbol = "V" }, - { number = 4, symbol = "IV" }, - { number = 1, symbol = "I" } -} - -return{ - toRoman = function(number) - local romanNumeral = "" - - for _,table in pairs (conversionTable) do - while(number >= table.number) do - romanNumeral = romanNumeral .. table.symbol - number = number - table.number - end - end - - return romanNumeral - end -} From f1e9c3b5632bbcde1900deb05165fa22adc1a2b7 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 27 Oct 2023 05:02:43 +0200 Subject: [PATCH 06/91] Translatable effect names and cleanup -added translatable effect names to the API -made /effect utilize those descriptions -cleaned up variables/constants to go with further API changes --- mods/ITEMS/mcl_potions/commands.lua | 14 ++++---- mods/ITEMS/mcl_potions/functions.lua | 51 +++++++++++++++++----------- mods/ITEMS/mcl_potions/init.lua | 11 +++--- 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index a04f8f079..53245f4fc 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -24,9 +24,8 @@ minetest.register_chatcommand("effect",{ if not P[1] then return false, S("Missing effect parameter!") elseif P[1] == "list" then - local regs = mcl_potions.get_registered_effects() local effects = "heal" - for name, _ in pairs(regs) do + for name, _ in pairs(mcl_potions.registered_effects) do effects = effects .. ", " .. name end return true, effects @@ -57,20 +56,21 @@ minetest.register_chatcommand("effect",{ P[3] = 1 end - if mcl_potions.is_effect_registered(P[1]) then + local def = mcl_potions.registered_effects[P[1]] + if def then if P[3] == "F" then local given = mcl_potions.give_effect(P[1], minetest.get_player_by_name(name), tonumber(P[4]), tonumber(P[2])) if given then - return true, S("@1 effect given to player @2 for @3 seconds with factor of @4.", P[1], name, P[2], P[4]) + return true, S("@1 effect given to player @2 for @3 seconds with factor of @4.", def.description, name, P[2], P[4]) else - return false, S("Giving effect @1 to player @2 failed.", P[1], name) + return false, S("Giving effect @1 to player @2 failed.", def.description, name) end else local given = mcl_potions.give_effect_by_level(P[1], minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2])) if given then - return true, S("@1 effect on level @2 given to player @3 for @4 seconds.", P[1], P[3], name, P[2]) + return true, S("@1 effect on level @2 given to player @3 for @4 seconds.", def.description, P[3], name, P[2]) else - return false, S("Giving effect @1 to player @2 failed.", P[1], name) + return false, S("Giving effect @1 to player @2 failed.", def.description, name) end end else diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index a5d05e8f9..8aa01c569 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1,5 +1,8 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + local EF = {} -local registered_effects = {} +mcl_potions.registered_effects = {} +local registered_effects = mcl_potions.registered_effects -- shorthand ref local EFFECT_TYPES = 0 minetest.register_on_mods_loaded(function() @@ -8,7 +11,6 @@ minetest.register_on_mods_loaded(function() end end) - -- ██████╗░███████╗░██████╗░██╗░██████╗████████╗███████╗██████╗ -- ██╔══██╗██╔════╝██╔════╝░██║██╔════╝╚══██╔══╝██╔════╝██╔══██╗ -- ██████╔╝█████╗░░██║░░██╗░██║╚█████╗░░░░██║░░░█████╗░░██████╔╝ @@ -51,7 +53,9 @@ end -- API - registers an effect -- required parameters in def: -- name - string - effect name in code +-- description - translated string - actual effect name in game -- optional parameters in def: +-- get_tt - function(factor) - returns tooltip description text for use with potions -- icon - string - file name of the effect icon in HUD - defaults to one based on name -- res_condition - function(object) - returning true if target is to be resistant to the effect -- on_start - function(object, factor) - called when dealing the effect @@ -70,25 +74,33 @@ end -- modifier_priority - integer - priority passed when registering damage_modifier - defaults to -50 function mcl_potions.register_effect(def) local modname = minetest.get_current_modname() - if def.name == nil then + local name = def.name + if name == nil then error("Unable to register effect: name is nil") end - if def.name == "list" then + if type(name) ~= "string" then + error("Unable to register effect: name is not a string") + end + if name == "list" then error("Unable to register effect: list is a reserved word") end - if def.name == "heal" then + if name == "heal" then error("Unable to register effect: heal is a reserved word") end if registered_effects[name] then error("Effect named "..name.." already registered!") end - local name = def.name + if not def.description or type(def.description) ~= "string" then + error("Unable to register effect: description is not a string") + end local pdef = {} + pdef.description = def.description if not def.icon then pdef.icon = modname.."_effect_"..name..".png" else pdef.icon = def.icon end + pdef.get_tt = def.get_tt pdef.res_condition = def.res_condition pdef.on_start = def.on_start pdef.on_load = def.on_load @@ -134,20 +146,9 @@ function mcl_potions.register_effect(def) EF[name] = {} end -function mcl_potions.get_registered_effects() - return table.copy(registered_effects) -end - -function mcl_potions.is_effect_registered(name) - if registered_effects[name] then - return true - else - return false - end -end - mcl_potions.register_effect({ name = "invisibility", + description = S("Invisiblity"), on_start = function(object, factor) mcl_potions.make_invisible(object, true) end, @@ -163,6 +164,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "poison", + description = S("Poison"), res_condition = function(object) local entity = object:get_luaentity() return (entity and (entity.harmed_by_heal or string.find(entity.name, "spider"))) @@ -181,6 +183,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "regeneration", + description = S("Regeneration"), res_condition = function(object) local entity = object:get_luaentity() return (entity and entity.harmed_by_heal) @@ -202,6 +205,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "strength", + description = S("Strength"), res_condition = function(object) return (not object:is_player()) end, @@ -210,6 +214,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "weakness", + description = S("Weakness"), res_condition = function(object) return (not object:is_player()) end, @@ -218,6 +223,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "water_breathing", + description = S("Water Breathing"), on_step = function(dtime, object, factor, duration) if not object:is_player() then return end if object:get_breath() then @@ -231,6 +237,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "leaping", + description = S("Leaping"), res_condition = function(object) return (not object:is_player()) end, @@ -248,6 +255,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "swiftness", + description = S("Swiftness"), res_condition = function(object) return (not object:is_player()) end, @@ -265,6 +273,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "slowness", + description = S("Slowness"), res_condition = function(object) return (not object:is_player()) end, @@ -282,6 +291,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "night_vision", + description = S("Night Vision"), res_condition = function(object) return (not object:is_player()) end, @@ -303,6 +313,7 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "fire_resistance", + description = S("Fire Resistance"), res_condition = function(object) return (not object:is_player()) end, @@ -313,11 +324,13 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "bad_omen", + description = S("Bad Omen"), particle_color = "#0b6138", }) mcl_potions.register_effect({ name = "withering", + description = S("Withering"), res_condition = function(object) local entity = object:get_luaentity() return (entity and string.find(entity.name, "wither")) @@ -696,7 +709,7 @@ function mcl_potions.make_invisible(obj_ref, hide) end -function mcl_potions._use_potion(item, obj, color) +function mcl_potions._use_potion(obj, color) local d = 0.1 local pos = obj:get_pos() minetest.sound_play("mcl_potions_drinking", {pos = pos, max_hear_distance = 6, gain = 1}) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 8c308f1fb..6df03db9d 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -8,14 +8,17 @@ mcl_potions = {} -- duration effects of glowstone are a time factor of 1/2 -- splash potion duration effects are reduced by a factor of 3/4 -mcl_potions.II_FACTOR = 2 +mcl_potions.POTENT_FACTOR = 2 mcl_potions.PLUS_FACTOR = 8/3 +mcl_potions.INV_FACTOR = 0.50 mcl_potions.DURATION = 180 -mcl_potions.DURATION_PLUS = mcl_potions.DURATION * mcl_potions.PLUS_FACTOR -mcl_potions.DURATION_2 = mcl_potions.DURATION / mcl_potions.II_FACTOR +mcl_potions.DURATION_INV = mcl_potions.DURATION * mcl_potions.INV_FACTOR + +mcl_potions.II_FACTOR = mcl_potions.POTENT_FACTOR -- TODO remove at some point +mcl_potions.DURATION_PLUS = mcl_potions.DURATION * mcl_potions.PLUS_FACTOR -- TODO remove at some point +mcl_potions.DURATION_2 = mcl_potions.DURATION / mcl_potions.II_FACTOR -- TODO remove at some point -mcl_potions.INV_FACTOR = 0.50 mcl_potions.SPLASH_FACTOR = 0.75 mcl_potions.LINGERING_FACTOR = 0.25 From 9383b903ef45fbc1ae5cf687c825319a16eaf340 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 27 Oct 2023 05:06:45 +0200 Subject: [PATCH 07/91] Added new potions registering API -added comprehensive potions registering API -new API registers only drinkable potions for now -new API is compatible with very complex tooltips -new API can have multiple effects per potion -no hardcoding for specific potions in the new API --- mods/ITEMS/mcl_potions/potions.lua | 173 ++++++++++++++++++++++++++++- 1 file changed, 172 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 8a872f73e..072316136 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -1,5 +1,4 @@ local S = minetest.get_translator(minetest.get_current_modname()) ---local brewhelp = S("Try different combinations to create potions.") local function potion_image(colorstring, opacity) if not opacity then @@ -90,6 +89,178 @@ function return_on_use(def, effect, dur) end end +local function generate_on_use(effects, color, on_use, custom_effect) + return function(itemstack, user, pointed_thing) + if pointed_thing.type == "node" then + if user and not user:get_player_control().sneak then + local node = minetest.get_node(pointed_thing.under) + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + elseif pointed_thing.type == "object" then + return itemstack + end + + local potency = itemstack:get_meta():get_int("mcl_potions:potion_potent") + local plus = itemstack:get_meta():get_int("mcl_potions:potion_plus") + local ef_level + local dur + for name, details in pairs(effects) do + if details.uses_level then + ef_level = details.level + details.level_scaling * (potency) + else + ef_level = details.level + end + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + if potency>0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + end + else + dur = details.dur + end + mcl_potions.give_effect_by_level(name, user, ef_level, dur) + end + + if on_use then on_use(user, potency+1) end + if custom_effect then custom_effect(user, potency+1) end + + itemstack = minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) + if itemstack then mcl_potions._use_potion(user, color) end + + return itemstack + end +end + +-- API - registers a potion +-- required parameters in def: +-- name - string - potion name in code +-- optional parameters in def: +-- desc_prefix - translated string - part of visible potion name, comes before the word "Potion" +-- desc_suffix - translated string - part of visible potion name, comes after the word "Potion" +-- _tt - translated string - custom tooltip text +-- _dynamic_tt - function(level) - returns custom tooltip text dependent on potion level +-- _longdesc - translated string - text for in-game documentation +-- stack_max - int - max stack size - defaults to 1 +-- image - string - name of a custom texture of the potion icon +-- color - string - colorstring for potion icon when image is not defined - defaults to #0000FF +-- groups - table - item groups definition - +-- - must contain _mcl_potion=1 for tooltip to include dynamic_tt and effects +-- - defaults to {brewitem=1, food=3, can_eat_when_full=1, _mcl_potion=1} +-- _effect_list - table - all the effects dealt by the potion in the format of tables +-- -- the name of each sub-table should be a name of a registered effect, and fields can be the following: +-- -- -- uses_level - bool - whether the level of the potion affects the level of the effect - +-- -- -- - defaults to the uses_factor field of the effect definition +-- -- -- level - int - used as the effect level if uses_level is false and for lvl1 potions - defaults to 1 +-- -- -- level_scaling - int - used as the number of effect levels added per potion level - defaults to 1 - +-- -- -- - this has no effect if uses_level is false +-- -- -- dur - float - duration of the effect in seconds - defaults to mcl_potions.DURATION +-- -- -- dur_variable - bool - whether variants of the potion should have the length of this effect changed - +-- -- -- - defaults to true +-- -- -- - if at least one effect has this set to true, the potion has a "plus" variant +-- uses_level - bool - whether the potion should come at different levels - +-- - defaults to true if uses_level is true for at least one effect, else false +-- drinkable - bool - defaults to true +-- has_splash - bool - defaults to true +-- has_lingering - bool - defaults to true +-- has_arrow - bool - defaults to false +-- has_potent - bool - whether there is a potent (e.g. II) variant - defaults to the value of uses_level +-- default_potent_level - int - effect level used for the potent variant - defaults to 2 +-- custom_on_use - function(user, level) - called when the potion is drunk +-- custom_effect - function(object, level) - called when the potion effects are applied +-- custom_splash_effect - function(pos, level) - called when the splash potion explodes +-- custom_linger_effect - function(pos, radius, level) - called on the lingering potion step +function mcl_potions.register_potion(def) + local modname = minetest.get_current_modname() + local name = def.name + if name == nil then + error("Unable to register potion: name is nil") + end + if type(name) ~= "string" then + error("Unable to register potion: name is not a string") + end + local pdef = {} + pdef.description = S("@1 Potion @2", def.desc_prefix, def.desc_suffix) + pdef._tt_help = def._tt + pdef._dynamic_tt = def._dynamic_tt + local potion_longdesc = def._longdesc + if def._effect_list then + potion_longdesc = potion_intro .. "\n" .. def._longdesc + end + pdef._doc_items_longdesc = potion_longdesc + if def.drinkable ~= false then pdef._doc_items_usagehelp = how_to_drink end + pdef.stack_max = def.stack_max or 1 + local color = def.color or "#0000FF" + pdef.inventory_image = def.image or potion_image(color) + pdef.wield_image = pdef.inventory_image + pdef.groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, _mcl_potion=1} + + pdef._effect_list = {} + local effect + local uses_level = false + local has_plus = false + for name, details in pairs(def._effect_list) do + effect = mcl_potions.registered_effects[name] + if effect then + local ulvl + if details.uses_level ~= nil then ulvl = details.uses_level + else ulvl = effect.uses_factor end + if ulvl then uses_level = true end + local durvar = true + if details.dur_variable ~= nil then durvar = details.dur_variable end + if durvar then has_plus = true end + pdef._effect_list[name] = { + uses_level = ulvl, + level = details.level or 1, + level_scaling = details.level_scaling or 1, + dur = details.dur or mcl_potions.DURATION, + dur_variable = durvar, + } + else + error("Unable to register potion: effect not registered") + end + end + if def.uses_level ~= nil then uses_level = def.uses_level end + pdef.uses_level = uses_level + if def.has_potent ~= nil then pdef.has_potent = def.has_potent + else pdef.has_potent = uses_level end + pdef.has_plus = has_plus + local on_use + if def.drinkable ~= false then + on_use = generate_on_use(pdef._effect_list, color, def.custom_on_use, def.custom_effect) + end + pdef.on_place = on_use + pdef.on_secondary_use = on_use + + minetest.register_craftitem(modname..":"..name, pdef) + +end + +mcl_potions.register_potion({ + name = "trolling", + desc_prefix = S("Mighty"), + desc_suffix = S("of Trolling"), + _tt = "trololo", + _dynamic_tt = function(level) + return "trolololoooololo" + end, + _longdesc = "Trolololololo", + stack_max = 2, + color = "#00AA00", + _effect_list = { + night_vision = {}, + strength = {}, + swiftness = { + uses_level = false, + level = 2, + }, + poison = { + dur = 10, + }, + }, +}) + local function register_potion(def) From ef2ce7e0d7510861f87b17c926aacb09f40178fa Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 27 Oct 2023 05:08:23 +0200 Subject: [PATCH 08/91] Added new potion tooltip handling -potion tooltips are now utilizing the power of the new API -potion names change based on metadata -nothing triggers loading the new tooltips beyond the names for now --- mods/HELP/mcl_tt/mod.conf | 2 +- mods/HELP/mcl_tt/snippets_mcl.lua | 46 +++++++++++++++++++++++++++++++ mods/HELP/tt/init.lua | 16 +++++++++++ mods/HELP/tt/mod.conf | 2 +- 4 files changed, 64 insertions(+), 2 deletions(-) diff --git a/mods/HELP/mcl_tt/mod.conf b/mods/HELP/mcl_tt/mod.conf index e442e1320..b9ca12379 100644 --- a/mods/HELP/mcl_tt/mod.conf +++ b/mods/HELP/mcl_tt/mod.conf @@ -1,4 +1,4 @@ name = mcl_tt author = Wuzzy description = Add MCL2 tooltips -depends = tt, mcl_enchanting, mcl_colors +depends = tt, mcl_enchanting, mcl_colors, mcl_util diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 14fcc1719..410f5e744 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -121,3 +121,49 @@ tt.register_snippet(function(itemstring, _, itemstack) return S("Durability: @1", S("@1 uses", remaining_use .."/".. use)) end end) + + +-- Potions info +tt.register_snippet(function(itemstring, _, itemstack) + if not itemstack then return end + local def = itemstack:get_definition() + if def.groups._mcl_potion ~= 1 then return end + + local s = "" + local meta = itemstack:get_meta() + local potency = meta:get_int("mcl_potions:potion_potent") + local plus = meta:get_int("mcl_potions:potion_plus") + if def._dynamic_tt then s = s.. def._dynamic_tt(potency+1).. "\n" end + local effects = def._effect_list + local effect + local dur + local timestamp + local ef_level + local roman_lvl + local factor + local ef_tt + for name, details in pairs(effects) do + effect = mcl_potions.registered_effects[name] + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + if potency > 0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + end + else + dur = details.dur + end + timestamp = math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60)) + if details.uses_level then + ef_level = details.level + details.level_scaling * (potency) + else + ef_level = details.level + end + if ef_level > 1 then roman_lvl = " ".. mcl_util.to_roman(ef_level) + else roman_lvl = "" end + s = s.. effect.description.. roman_lvl.. " (".. timestamp.. ")\n" + if effect.uses_factor then factor = effect.level_to_factor(ef_level) end + if effect.get_tt then ef_tt = effect.get_tt(factor) else ef_tt = "" end + if ef_tt ~= "" then s = s.. ef_tt.. "\n" end + end + return s:trim() +end) diff --git a/mods/HELP/tt/init.lua b/mods/HELP/tt/init.lua index b3f2b8d55..8cc893d47 100644 --- a/mods/HELP/tt/init.lua +++ b/mods/HELP/tt/init.lua @@ -74,6 +74,22 @@ function tt.reload_itemstack_description(itemstack) local orig_desc = def._tt_original_description or def.description if meta:get_string("name") ~= "" then orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name")) + elseif def.groups._mcl_potion == 1 then + local potency = meta:get_int("mcl_potions:potion_potent") + local plus = meta:get_int("mcl_potions:potion_plus") + if potency > 0 then + local sym_potency = mcl_util.to_roman(potency+1) + orig_desc = orig_desc.. " ".. sym_potency + end + if plus > 0 then + local sym_plus = " " + local i = plus + while i>0 do + i = i - 1 + sym_plus = sym_plus.. "+" + end + orig_desc = orig_desc.. sym_plus + end end local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack) if desc == def.description and meta:get_string("description") == "" then return end diff --git a/mods/HELP/tt/mod.conf b/mods/HELP/tt/mod.conf index 2a260772d..7c4902418 100644 --- a/mods/HELP/tt/mod.conf +++ b/mods/HELP/tt/mod.conf @@ -1,4 +1,4 @@ name = tt author = Wuzzy description = Support for custom tooltip extensions for items -depends = mcl_colors +depends = mcl_colors, mcl_util From 6d927ab1a1ecd97dd667b7064d0d72fef44c4d46 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 27 Oct 2023 05:09:37 +0200 Subject: [PATCH 09/91] Creative inventory using new potions API -creative inventory utilizes the new potions API -the new fancy tooltips are used there --- mods/HUD/mcl_inventory/creative.lua | 23 ++++++++++++++++++++++- mods/HUD/mcl_inventory/mod.conf | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 1288bc1d5..95fe7419b 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -105,7 +105,13 @@ minetest.register_on_mods_loaded(function() nonmisc = true end if def.groups.brewitem then - table.insert(inventory_lists["brew"], name) + local str = name + if def.groups._mcl_potion == 1 then + local stack = ItemStack(name) + tt.reload_itemstack_description(stack) + str = stack:to_string() + end + table.insert(inventory_lists["brew"], str) nonmisc = true end if def.groups.craftitem then @@ -117,6 +123,21 @@ minetest.register_on_mods_loaded(function() table.insert(inventory_lists["misc"], name) end + if def.groups._mcl_potion == 1 then + if def.has_potent then + local stack = ItemStack(name) + stack:get_meta():set_int("mcl_potions:potion_potent", 1) + tt.reload_itemstack_description(stack) + table.insert(inventory_lists["brew"], stack:to_string()) + end + if def.has_plus then + local stack = ItemStack(name) + stack:get_meta():set_int("mcl_potions:potion_plus", 1) + tt.reload_itemstack_description(stack) + table.insert(inventory_lists["brew"], stack:to_string()) + end + end + table.insert(inventory_lists["all"], name) end end diff --git a/mods/HUD/mcl_inventory/mod.conf b/mods/HUD/mcl_inventory/mod.conf index 66f175c3b..fc10fe32a 100644 --- a/mods/HUD/mcl_inventory/mod.conf +++ b/mods/HUD/mcl_inventory/mod.conf @@ -2,4 +2,4 @@ name = mcl_inventory author = BlockMen description = Adds the player inventory and creative inventory. depends = mcl_init, mcl_formspec, mcl_enchanting, mcl_gamemode -optional_depends = mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting, mcl_craftguide, mcl_player +optional_depends = mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting, mcl_craftguide, mcl_player, tt From a8fcae0f5115eccc38107e3e676aa3087d5c4e85 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 28 Oct 2023 03:22:28 +0200 Subject: [PATCH 10/91] Fixed variable definitions ("undeclared global") --- mods/ITEMS/mcl_potions/functions.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 8aa01c569..275ec3405 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -490,7 +490,7 @@ function mcl_potions._clear_cached_player_data(player) effect[player] = nil end - meta = player:get_meta() + local meta = player:get_meta() meta:set_int("night_vision", 0) end @@ -514,7 +514,7 @@ function mcl_potions._save_player_effects(player) if not player:is_player() then return end - meta = player:get_meta() + local meta = player:get_meta() for name, effect in pairs(registered_effects) do meta:set_string("mcl_potions:_EF_"..name, minetest.serialize(EF[name][player])) @@ -525,7 +525,7 @@ function mcl_potions._load_player_effects(player) if not player:is_player() then return end - meta = player:get_meta() + local meta = player:get_meta() -- handle legacy meta strings local legacy_invisible = minetest.deserialize(meta:get_string("_is_invisible")) From dc35f43bfa00361f29ac9a0ffdb4feb57cf4e3a5 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 3 Nov 2023 22:28:00 +0100 Subject: [PATCH 11/91] Potions registering API fully works with creative --- mods/HUD/mcl_inventory/creative.lua | 6 ++++-- mods/ITEMS/mcl_potions/potions.lua | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 95fe7419b..4898423b0 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -126,13 +126,15 @@ minetest.register_on_mods_loaded(function() if def.groups._mcl_potion == 1 then if def.has_potent then local stack = ItemStack(name) - stack:get_meta():set_int("mcl_potions:potion_potent", 1) + local potency = def._default_potent_level - 1 + stack:get_meta():set_int("mcl_potions:potion_potent", potency) tt.reload_itemstack_description(stack) table.insert(inventory_lists["brew"], stack:to_string()) end if def.has_plus then local stack = ItemStack(name) - stack:get_meta():set_int("mcl_potions:potion_plus", 1) + local extend = def._default_extend_level + stack:get_meta():set_int("mcl_potions:potion_plus", extend) tt.reload_itemstack_description(stack) table.insert(inventory_lists["brew"], stack:to_string()) end diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 072316136..6e022f497 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -8,7 +8,7 @@ local function potion_image(colorstring, opacity) end local how_to_drink = S("Use the “Place” key to drink it.") -local potion_intro = S("Drinking a potion gives you a particular effect.") +local potion_intro = S("Drinking a potion gives you a particular effect or set of effects.") local function time_string(dur) if not dur then @@ -166,7 +166,8 @@ end -- has_lingering - bool - defaults to true -- has_arrow - bool - defaults to false -- has_potent - bool - whether there is a potent (e.g. II) variant - defaults to the value of uses_level --- default_potent_level - int - effect level used for the potent variant - defaults to 2 +-- default_potent_level - int - potion level used for the default potent variant - defaults to 2 +-- default_extend_level - int - extention level (amount of +) used for the default extended variant - defaults to 1 -- custom_on_use - function(user, level) - called when the potion is drunk -- custom_effect - function(object, level) - called when the potion effects are applied -- custom_splash_effect - function(pos, level) - called when the splash potion explodes @@ -225,6 +226,8 @@ function mcl_potions.register_potion(def) pdef.uses_level = uses_level if def.has_potent ~= nil then pdef.has_potent = def.has_potent else pdef.has_potent = uses_level end + pdef._default_potent_level = def.default_potent_level or 2 + pdef._default_extend_level = def.default_extend_level or 1 pdef.has_plus = has_plus local on_use if def.drinkable ~= false then @@ -259,6 +262,8 @@ mcl_potions.register_potion({ dur = 10, }, }, + default_potent_level = 5, + default_extend_level = 3, }) From 83530b42986da841e02642d1824a68601d4694d1 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 7 Jan 2024 22:54:10 +0100 Subject: [PATCH 12/91] Improved potion descriptions * added support for effect descriptions * added descriptions for some effects * fixed a crash --- mods/HELP/mcl_tt/snippets_mcl.lua | 56 ++++++++++++++-------------- mods/ITEMS/mcl_potions/functions.lua | 19 ++++++++++ 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 410f5e744..c1396790e 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -135,35 +135,37 @@ tt.register_snippet(function(itemstring, _, itemstack) local plus = meta:get_int("mcl_potions:potion_plus") if def._dynamic_tt then s = s.. def._dynamic_tt(potency+1).. "\n" end local effects = def._effect_list - local effect - local dur - local timestamp - local ef_level - local roman_lvl - local factor - local ef_tt - for name, details in pairs(effects) do - effect = mcl_potions.registered_effects[name] - if details.dur_variable then - dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) - if potency > 0 and details.uses_level then - dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + if effects then + local effect + local dur + local timestamp + local ef_level + local roman_lvl + local factor + local ef_tt + for name, details in pairs(effects) do + effect = mcl_potions.registered_effects[name] + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + if potency > 0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + end + else + dur = details.dur end - else - dur = details.dur + timestamp = math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60)) + if details.uses_level then + ef_level = details.level + details.level_scaling * (potency) + else + ef_level = details.level + end + if ef_level > 1 then roman_lvl = " ".. mcl_util.to_roman(ef_level) + else roman_lvl = "" end + s = s.. effect.description.. roman_lvl.. " (".. timestamp.. ")\n" + if effect.uses_factor then factor = effect.level_to_factor(ef_level) end + if effect.get_tt then ef_tt = minetest.colorize("grey", effect.get_tt(factor)) else ef_tt = "" end + if ef_tt ~= "" then s = s.. ef_tt.. "\n" end end - timestamp = math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60)) - if details.uses_level then - ef_level = details.level + details.level_scaling * (potency) - else - ef_level = details.level - end - if ef_level > 1 then roman_lvl = " ".. mcl_util.to_roman(ef_level) - else roman_lvl = "" end - s = s.. effect.description.. roman_lvl.. " (".. timestamp.. ")\n" - if effect.uses_factor then factor = effect.level_to_factor(ef_level) end - if effect.get_tt then ef_tt = effect.get_tt(factor) else ef_tt = "" end - if ef_tt ~= "" then s = s.. ef_tt.. "\n" end end return s:trim() end) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 275ec3405..12b0c08ec 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -165,6 +165,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "poison", description = S("Poison"), + get_tt = function(factor) + return S("-1 HP / @1 s", factor) + end, res_condition = function(object) local entity = object:get_luaentity() return (entity and (entity.harmed_by_heal or string.find(entity.name, "spider"))) @@ -184,6 +187,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "regeneration", description = S("Regeneration"), + get_tt = function(factor) + return S("+1 HP / @1 s", factor) + end, res_condition = function(object) local entity = object:get_luaentity() return (entity and entity.harmed_by_heal) @@ -238,6 +244,10 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "leaping", description = S("Leaping"), + get_tt = function(factor) + if factor > 0 then return S("+@1% jumping power", math.floor(factor*100)) end + return S("-@1% jumping power", math.floor(-factor*100)) + end, res_condition = function(object) return (not object:is_player()) end, @@ -256,6 +266,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "swiftness", description = S("Swiftness"), + get_tt = function(factor) + return S("+@1% running speed", math.floor(factor*100)) + end, res_condition = function(object) return (not object:is_player()) end, @@ -274,6 +287,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "slowness", description = S("Slowness"), + get_tt = function(factor) + return S("-@1% running speed", math.floor(factor*100)) + end, res_condition = function(object) return (not object:is_player()) end, @@ -331,6 +347,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "withering", description = S("Withering"), + get_tt = function(factor) + return S("-1 HP / @1 s, can kill", factor) + end, res_condition = function(object) local entity = object:get_luaentity() return (entity and string.find(entity.name, "wither")) From 7d3e2d3dbce3d4f9eb0c6a49ffef1cb54dcc6c94 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 7 Jan 2024 22:56:58 +0100 Subject: [PATCH 13/91] Implemented missing potion registering functionality * improved support for custom (non-status) effects * added support for splash potions * added support for lingering potions * added support for tipped arrows * removed the old registration --- mods/ITEMS/mcl_potions/lingering.lua | 92 ++++++++++++++----- mods/ITEMS/mcl_potions/potions.lua | 112 ++++++++++++++++++------ mods/ITEMS/mcl_potions/splash.lua | 70 +++++++++++---- mods/ITEMS/mcl_potions/tipped_arrow.lua | 65 ++++++++++++-- 4 files changed, 268 insertions(+), 71 deletions(-) diff --git a/mods/ITEMS/mcl_potions/lingering.lua b/mods/ITEMS/mcl_potions/lingering.lua index 46d94cad3..68da35146 100644 --- a/mods/ITEMS/mcl_potions/lingering.lua +++ b/mods/ITEMS/mcl_potions/lingering.lua @@ -11,8 +11,8 @@ end local lingering_effect_at = {} -local function add_lingering_effect(pos, color, def, is_water, instant) - lingering_effect_at[pos] = {color = color, timer = 30, def = def, is_water = is_water} +local function add_lingering_effect(pos, color, def, is_water, potency, plus) + lingering_effect_at[pos] = {color = color, timer = 30, def = def, is_water = is_water, potency = potency, plus = plus} end local function linger_particles(pos, d, texture, color) @@ -55,23 +55,52 @@ minetest.register_globalstep(function(dtime) end linger_particles(pos, d, texture, vals.color) - -- Extinguish fire if water bottle - if vals.is_water then - if mcl_potions._extinguish_nearby_fire(pos, d) then - vals.timer = vals.timer - 3.25 - end +-- -- Extinguish fire if water bottle +-- if vals.is_water then +-- if mcl_potions._extinguish_nearby_fire(pos, d) then +-- vals.timer = vals.timer - 3.25 +-- end +-- end + + if vals.def.while_lingering and vals.def.while_lingering(pos, d, vals.potency+1) then + vals.timer = vals.timer - 3.25 end -- Affect players and mobs for _, obj in pairs(minetest.get_objects_inside_radius(pos, d)) do local entity = obj:get_luaentity() - if obj:is_player() or entity.is_mob then + if obj:is_player() or entity and entity.is_mob then + local applied = false + if vals.def._effect_list then + local ef_level + local dur + for name, details in pairs(vals.def._effect_list) do + if details.uses_level then + ef_level = details.level + details.level_scaling * (vals.potency) + else + ef_level = details.level + end + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, vals.plus) + if vals.potency>0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, vals.potency) + end + else + dur = details.dur + end + dur = dur * mcl_potions.SPLASH_FACTOR + if mcl_potions.give_effect_by_level(name, obj, ef_level, dur) then + applied = true + end + end + end - vals.def.potion_fun(obj) - -- TODO: Apply timer penalty only if the potion effect was acutally applied - vals.timer = vals.timer - 3.25 + if vals.def.custom_effect and vals.def.custom_effect(obj, vals.potency+1) then + applied = true + end + if applied then vals.timer = vals.timer - 3.25 end end end @@ -87,31 +116,42 @@ end) function mcl_potions.register_lingering(name, descr, color, def) - local id = "mcl_potions:"..name.."_lingering" - local longdesc = def.longdesc + local longdesc = def._longdesc if not def.no_effect then - longdesc = S("A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect, possibly repeatedly.") + longdesc = S("A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect or set of effects, possibly repeatedly.") if def.longdesc then - longdesc = longdesc .. "\n" .. def.longdesc + longdesc = longdesc .. "\n" .. def._longdesc end end minetest.register_craftitem(id, { description = descr, - _tt_help = def.tt, + _tt_help = def._tt, + _dynamic_tt = def._dynamic_tt, _doc_items_longdesc = longdesc, _doc_items_usagehelp = S("Use the “Punch” key to throw it."), + stack_max = def.stack_max, + _effect_list = def._effect_list, + uses_level = def.uses_level, + has_potent = def.has_potent, + has_plus = def.has_plus, + _default_potent_level = def._default_potent_level, + _default_extend_level = def._default_extend_level, inventory_image = lingering_image(color), - groups = {brewitem=1, not_in_creative_inventory=0, bottle=1}, + groups = {brewitem=1, bottle=1, _mcl_potion=1}, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir(); local pos = placer:getpos(); minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true) local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying") - obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity}) - obj:setacceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3}) - obj:get_luaentity()._thrower = placer:get_player_name() + obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity}) + obj:set_acceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3}) + local ent = obj:get_luaentity() + ent._thrower = placer:get_player_name() + ent._potency = item:get_meta():get_int("mcl_potions:potion_potent") + ent._plus = item:get_meta():get_int("mcl_potions:potion_plus") + ent._effect_list = def._effect_list if not minetest.is_creative_enabled(placer:get_player_name()) then item:take_item() end @@ -126,6 +166,10 @@ function mcl_potions.register_lingering(name, descr, color, def) local velocity = 22 obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity}) obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3}) + local ent = obj:get_luaentity() + ent._potency = item:get_meta():get_int("mcl_potions:potion_potent") + ent._plus = item:get_meta():get_int("mcl_potions:potion_plus") + ent._effect_list = def._effect_list end }) @@ -148,7 +192,9 @@ function mcl_potions.register_lingering(name, descr, color, def) end if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1}) - add_lingering_effect(pos, color, def, name == "water") + local potency = self._potency or 0 + local plus = self._plus or 0 + add_lingering_effect(pos, color, def, name == "water", potency, plus) local texture if name == "water" then texture = "mcl_particles_droplet_bottle.png" @@ -160,9 +206,7 @@ function mcl_potions.register_lingering(name, descr, color, def) end end linger_particles(pos, d, texture, color) - if name == "water" then - mcl_potions._extinguish_nearby_fire(pos, d) - end + if def.on_splash then def.on_splash(pos, potency+1) end self.object:remove() end end, diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 6e022f497..1b66a955d 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -145,7 +145,7 @@ end -- stack_max - int - max stack size - defaults to 1 -- image - string - name of a custom texture of the potion icon -- color - string - colorstring for potion icon when image is not defined - defaults to #0000FF --- groups - table - item groups definition - +-- groups - table - item groups definition for the regular potion, not splash or lingering - -- - must contain _mcl_potion=1 for tooltip to include dynamic_tt and effects -- - defaults to {brewitem=1, food=3, can_eat_when_full=1, _mcl_potion=1} -- _effect_list - table - all the effects dealt by the potion in the format of tables @@ -168,10 +168,10 @@ end -- has_potent - bool - whether there is a potent (e.g. II) variant - defaults to the value of uses_level -- default_potent_level - int - potion level used for the default potent variant - defaults to 2 -- default_extend_level - int - extention level (amount of +) used for the default extended variant - defaults to 1 --- custom_on_use - function(user, level) - called when the potion is drunk --- custom_effect - function(object, level) - called when the potion effects are applied --- custom_splash_effect - function(pos, level) - called when the splash potion explodes --- custom_linger_effect - function(pos, radius, level) - called on the lingering potion step +-- custom_on_use - function(user, level) - called when the potion is drunk, returns true on success +-- custom_effect - function(object, level) - called when the potion effects are applied, returns true on success +-- custom_splash_effect - function(pos, level) - called when the splash potion explodes, returns true on success +-- custom_linger_effect - function(pos, radius, level) - called on the lingering potion step, returns true on success function mcl_potions.register_potion(def) local modname = minetest.get_current_modname() local name = def.name @@ -201,25 +201,28 @@ function mcl_potions.register_potion(def) local effect local uses_level = false local has_plus = false - for name, details in pairs(def._effect_list) do - effect = mcl_potions.registered_effects[name] - if effect then - local ulvl - if details.uses_level ~= nil then ulvl = details.uses_level - else ulvl = effect.uses_factor end - if ulvl then uses_level = true end - local durvar = true - if details.dur_variable ~= nil then durvar = details.dur_variable end - if durvar then has_plus = true end - pdef._effect_list[name] = { - uses_level = ulvl, - level = details.level or 1, - level_scaling = details.level_scaling or 1, - dur = details.dur or mcl_potions.DURATION, - dur_variable = durvar, - } - else - error("Unable to register potion: effect not registered") + if def._effect_list then + for name, details in pairs(def._effect_list) do + no_effects = false + effect = mcl_potions.registered_effects[name] + if effect then + local ulvl + if details.uses_level ~= nil then ulvl = details.uses_level + else ulvl = effect.uses_factor end + if ulvl then uses_level = true end + local durvar = true + if details.dur_variable ~= nil then durvar = details.dur_variable end + if durvar then has_plus = true end + pdef._effect_list[name] = { + uses_level = ulvl, + level = details.level or 1, + level_scaling = details.level_scaling or 1, + dur = details.dur or mcl_potions.DURATION, + dur_variable = durvar, + } + else + error("Unable to register potion: effect not registered") + end end end if def.uses_level ~= nil then uses_level = def.uses_level end @@ -238,6 +241,59 @@ function mcl_potions.register_potion(def) minetest.register_craftitem(modname..":"..name, pdef) + if def.has_splash or def.has_splash == nil then + local splash_desc = S("Splash @1 Potion @2", def.desc_prefix, def.desc_suffix) + local sdef = {} + sdef._tt = def._tt + sdef._dynamic_tt = def._dynamic_tt + sdef._longdesc = def._longdesc + sdef.stack_max = pdef.stack_max + sdef._effect_list = pdef._effect_list + sdef.uses_level = uses_level + sdef.has_potent = pdef.has_potent + sdef.has_plus = has_plus + sdef._default_potent_level = pdef._default_potent_level + sdef._default_extend_level = pdef._default_extend_level + sdef.custom_effect = def.custom_effect + sdef.on_splash = def.custom_splash_effect + if not def._effect_list then sdef.instant = true end + mcl_potions.register_splash(name, splash_desc, color, sdef) + end + + if def.has_lingering or def.has_lingering == nil then + local ling_desc = S("Lingering @1 Potion @2", def.desc_prefix, def.desc_suffix) + local ldef = {} + ldef._tt = def._tt + ldef._longdesc = def._longdesc + ldef.stack_max = pdef.stack_max + ldef._effect_list = pdef._effect_list + ldef.uses_level = uses_level + ldef.has_potent = pdef.has_potent + ldef.has_plus = has_plus + ldef._default_potent_level = pdef._default_potent_level + ldef._default_extend_level = pdef._default_extend_level + ldef.custom_effect = def.custom_effect + ldef.on_splash = def.custom_splash_effect + ldef.while_lingering = def.custom_linger_effect + if not def._effect_list then ldef.instant = true end + mcl_potions.register_lingering(name, ling_desc, color, ldef) + end + + if def.has_arrow then + local arr_desc = S("@1 Arrow @2", def.desc_prefix, def.desc_suffix) + local adef = {} + adef._tt = def._tt + adef._longdesc = def._longdesc + adef._effect_list = pdef._effect_list + adef.uses_level = uses_level + adef.has_potent = pdef.has_potent + adef.has_plus = has_plus + adef._default_potent_level = pdef._default_potent_level + adef._default_extend_level = pdef._default_extend_level + adef.custom_effect = def.custom_effect + if not def._effect_list then adef.instant = true end + mcl_potions.register_arrow(name, arr_desc, color, adef) + end end mcl_potions.register_potion({ @@ -264,6 +320,8 @@ mcl_potions.register_potion({ }, default_potent_level = 5, default_extend_level = 3, + custom_splash_effect = mcl_potions._extinguish_nearby_fire, + has_arrow = true, }) @@ -811,9 +869,9 @@ local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def, slowness_def, leaping_def, withering_def, poison_def, regeneration_def, invisibility_def, water_breathing_def, fire_resistance_def} -for _, def in ipairs(defs) do - register_potion(def) -end +-- for _, def in ipairs(defs) do +-- register_potion(def) +-- end diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index 0b8aedeab..33515c161 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -13,20 +13,28 @@ end function mcl_potions.register_splash(name, descr, color, def) local id = "mcl_potions:"..name.."_splash" - local longdesc = def.longdesc + local longdesc = def._longdesc if not def.no_effect then - longdesc = S("A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect.") - if def.longdesc then - longdesc = longdesc .. "\n" .. def.longdesc + longdesc = S("A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect or a set of status effects.") + if def._longdesc then + longdesc = longdesc .. "\n" .. def._longdesc end end minetest.register_craftitem(id, { description = descr, - _tt_help = def.tt, + _tt_help = def._tt, + _dynamic_tt = def._dynamic_tt, _doc_items_longdesc = longdesc, _doc_items_usagehelp = S("Use the “Punch” key to throw it."), + stack_max = def.stack_max, + _effect_list = def._effect_list, + uses_level = def.uses_level, + has_potent = def.has_potent, + has_plus = def.has_plus, + _default_potent_level = def._default_potent_level, + _default_extend_level = def._default_extend_level, inventory_image = splash_image(color), - groups = {brewitem=1, not_in_creative_inventory=0, bottle=1}, + groups = {brewitem=1, bottle=1, _mcl_potion=1}, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir(); @@ -35,7 +43,11 @@ function mcl_potions.register_splash(name, descr, color, def) local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying") obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity}) obj:set_acceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3}) - obj:get_luaentity()._thrower = placer:get_player_name() + local ent = obj:get_luaentity() + ent._thrower = placer:get_player_name() + ent._potency = item:get_meta():get_int("mcl_potions:potion_potent") + ent._plus = item:get_meta():get_int("mcl_potions:potion_plus") + ent._effect_list = def._effect_list if not minetest.is_creative_enabled(placer:get_player_name()) then item:take_item() end @@ -50,6 +62,10 @@ function mcl_potions.register_splash(name, descr, color, def) local velocity = 22 obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity}) obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3}) + local ent = obj:get_luaentity() + ent._potency = item:get_meta():get_int("mcl_potions:potion_potent") + ent._plus = item:get_meta():get_int("mcl_potions:potion_plus") + ent._effect_list = def._effect_list end }) @@ -103,10 +119,10 @@ function mcl_potions.register_splash(name, descr, color, def) texture = texture.."^[colorize:"..color..":127" }) - if name == "water" then - mcl_potions._extinguish_nearby_fire(pos) - end - self.object:remove() + local potency = self._potency or 0 + local plus = self._plus or 0 + + if def.on_splash then def.on_splash(pos, potency+1) end for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do local entity = obj:get_luaentity() @@ -114,13 +130,37 @@ function mcl_potions.register_splash(name, descr, color, def) local pos2 = obj:get_pos() local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2)) - if rad > 0 then - def.potion_fun(obj, redux_map[rad]) - else - def.potion_fun(obj, 1) + + if def._effect_list then + local ef_level + local dur + for name, details in pairs(def._effect_list) do + if details.uses_level then + ef_level = details.level + details.level_scaling * (potency) + else + ef_level = details.level + end + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + if potency>0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + end + else + dur = details.dur + end + dur = dur * mcl_potions.SPLASH_FACTOR + if rad > 0 then + mcl_potions.give_effect_by_level(name, obj, ef_level, redux_map[rad]*dur) + else + mcl_potions.give_effect_by_level(name, obj, ef_level, dur) + end + end end + + if def.custom_effect then def.custom_effect(obj, potency+1) end -- TODO use redux_map end end + self.object:remove() end end, diff --git a/mods/ITEMS/mcl_potions/tipped_arrow.lua b/mods/ITEMS/mcl_potions/tipped_arrow.lua index c0def3983..9ba127172 100644 --- a/mods/ITEMS/mcl_potions/tipped_arrow.lua +++ b/mods/ITEMS/mcl_potions/tipped_arrow.lua @@ -37,16 +37,23 @@ local arrow_tt = minetest.registered_items["mcl_bows:arrow"]._tt_help or "" function mcl_potions.register_arrow(name, desc, color, def) - local longdesc = def.longdesc or "" + local longdesc = def._longdesc or "" + local tt = def._tt or "" minetest.register_craftitem("mcl_potions:"..name.."_arrow", { description = desc, - _tt_help = arrow_tt .. "\n" .. def.tt, + _tt_help = arrow_tt .. "\n" .. tt, _doc_items_longdesc = arrow_longdesc .. "\n" .. S("This particular arrow is tipped and will give an effect when it hits a player or mob.") .. "\n" .. longdesc, _doc_items_usagehelp = how_to_shoot, + _effect_list = def._effect_list, + uses_level = def.uses_level, + has_potent = def.has_potent, + has_plus = def.has_plus, + _default_potent_level = def._default_potent_level, + _default_extend_level = def._default_extend_level, inventory_image = "mcl_bows_arrow_inv.png^(mcl_potions_arrow_inv.png^[colorize:"..color..":100)", - groups = { ammo=1, ammo_bow=1, brewitem=1}, + groups = { ammo=1, ammo_bow=1, brewitem=1, _mcl_potion=1}, _on_dispense = function(itemstack, dispenserpos, droppos, dropnode, dropdir) -- Shoot arrow local shootpos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51)) @@ -264,6 +271,9 @@ function mcl_potions.register_arrow(name, desc, color, def) end end + local potency = self._potency or 0 + local plus = self._plus or 0 + -- Punch target object but avoid hurting enderman. if lua then if lua.name ~= "mobs_mc:rover" then @@ -271,14 +281,59 @@ function mcl_potions.register_arrow(name, desc, color, def) full_punch_interval=1.0, damage_groups={fleshy=self._damage}, }, nil) - def.potion_fun(obj) + if def._effect_list then + local ef_level + local dur + for name, details in pairs(def._effect_list) do + if details.uses_level then + ef_level = details.level + details.level_scaling * (potency) + else + ef_level = details.level + end + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + if potency>0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + end + else + dur = details.dur + end + mcl_potions.give_effect_by_level(name, obj, ef_level, dur) + end + end + if def.custom_effect then def.custom_effect(obj, potency+1) end end else obj:punch(self.object, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=self._damage}, }, nil) - def.potion_fun(obj) + if def._effect_list then + local ef_level + local dur + for name, details in pairs(def._effect_list) do + if details.uses_level then + ef_level = details.level + details.level_scaling * (potency) + else + ef_level = details.level + end + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + if potency>0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + end + else + dur = details.dur + end + dur = dur * mcl_potions.SPLASH_FACTOR + if rad > 0 then + mcl_potions.give_effect_by_level(name, obj, ef_level, redux_map[rad]*dur) + else + mcl_potions.give_effect_by_level(name, obj, ef_level, dur) + end + end + end + if def.custom_effect then def.custom_effect(obj, potency+1) end end if is_player then From 93572d71f2acb26211a603861f7df1e483678b0f Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 7 Jan 2024 23:19:05 +0100 Subject: [PATCH 14/91] Added support for varied descriptions --- mods/ITEMS/mcl_potions/potions.lua | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 1b66a955d..940bbec4c 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -182,7 +182,15 @@ function mcl_potions.register_potion(def) error("Unable to register potion: name is not a string") end local pdef = {} - pdef.description = S("@1 Potion @2", def.desc_prefix, def.desc_suffix) + if def.desc_prefix and def.desc_suffix then + pdef.description = S("@1 Potion @2", def.desc_prefix, def.desc_suffix) + elseif def.desc_prefix then + pdef.description = S("@1 Potion", def.desc_prefix) + elseif def.desc_suffix then + pdef.description = S("Potion @1", def.desc_suffix) + else + pdef.description = S("Strange Potion") + end pdef._tt_help = def._tt pdef._dynamic_tt = def._dynamic_tt local potion_longdesc = def._longdesc @@ -242,7 +250,7 @@ function mcl_potions.register_potion(def) minetest.register_craftitem(modname..":"..name, pdef) if def.has_splash or def.has_splash == nil then - local splash_desc = S("Splash @1 Potion @2", def.desc_prefix, def.desc_suffix) + local splash_desc = S("Splash @1", pdef.description) local sdef = {} sdef._tt = def._tt sdef._dynamic_tt = def._dynamic_tt @@ -261,7 +269,7 @@ function mcl_potions.register_potion(def) end if def.has_lingering or def.has_lingering == nil then - local ling_desc = S("Lingering @1 Potion @2", def.desc_prefix, def.desc_suffix) + local ling_desc = S("Lingering @1", pdef.description) local ldef = {} ldef._tt = def._tt ldef._longdesc = def._longdesc @@ -280,7 +288,16 @@ function mcl_potions.register_potion(def) end if def.has_arrow then - local arr_desc = S("@1 Arrow @2", def.desc_prefix, def.desc_suffix) + local arr_desc + if def.desc_prefix and def.desc_suffix then + arr_desc = S("@1 Arrow @2", def.desc_prefix, def.desc_suffix) + elseif def.desc_prefix then + arr_desc = S("@1 Arrow", def.desc_prefix) + elseif def.desc_suffix then + arr_desc = S("Arrow @1", def.desc_suffix) + else + arr_desc = S("Strange Tipped Arrow") + end local adef = {} adef._tt = def._tt adef._longdesc = def._longdesc From 0b1cc6ad5745c91f58050363dd2661db7d802baf Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 8 Jan 2024 00:25:30 +0100 Subject: [PATCH 15/91] Fixed splash and lingering potions * descriptions * scaling --- mods/HELP/mcl_tt/snippets_mcl.lua | 10 ++++++++-- mods/ITEMS/mcl_potions/lingering.lua | 9 +++++---- mods/ITEMS/mcl_potions/splash.lua | 13 ++++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index c1396790e..7b25f0750 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -133,7 +133,13 @@ tt.register_snippet(function(itemstring, _, itemstack) local meta = itemstack:get_meta() local potency = meta:get_int("mcl_potions:potion_potent") local plus = meta:get_int("mcl_potions:potion_plus") - if def._dynamic_tt then s = s.. def._dynamic_tt(potency+1).. "\n" end + local sl_factor = 1 + if def.groups.splash_potion == 1 then + sl_factor = mcl_potions.SPLASH_FACTOR + elseif def.groups.ling_potion == 1 then + sl_factor = mcl_potions.LINGERING_FACTOR + end + if def._dynamic_tt then s = s.. def._dynamic_tt((potency+1)*sl_factor).. "\n" end local effects = def._effect_list if effects then local effect @@ -146,7 +152,7 @@ tt.register_snippet(function(itemstring, _, itemstack) for name, details in pairs(effects) do effect = mcl_potions.registered_effects[name] if details.dur_variable then - dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) * sl_factor if potency > 0 and details.uses_level then dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) end diff --git a/mods/ITEMS/mcl_potions/lingering.lua b/mods/ITEMS/mcl_potions/lingering.lua index 68da35146..646ff16ff 100644 --- a/mods/ITEMS/mcl_potions/lingering.lua +++ b/mods/ITEMS/mcl_potions/lingering.lua @@ -86,18 +86,19 @@ minetest.register_globalstep(function(dtime) if vals.potency>0 and details.uses_level then dur = dur / math.pow(mcl_potions.POTENT_FACTOR, vals.potency) end + dur = dur * mcl_potions.LINGERING_FACTOR else dur = details.dur end - dur = dur * mcl_potions.SPLASH_FACTOR if mcl_potions.give_effect_by_level(name, obj, ef_level, dur) then applied = true end end end - if vals.def.custom_effect and vals.def.custom_effect(obj, vals.potency+1) then - applied = true + if vals.def.custom_effect + and vals.def.custom_effect(obj, (vals.potency+1) * mcl_potions.LINGERING_FACTOR) then + applied = true end if applied then vals.timer = vals.timer - 3.25 end @@ -138,7 +139,7 @@ function mcl_potions.register_lingering(name, descr, color, def) _default_potent_level = def._default_potent_level, _default_extend_level = def._default_extend_level, inventory_image = lingering_image(color), - groups = {brewitem=1, bottle=1, _mcl_potion=1}, + groups = {brewitem=1, bottle=1, ling_potion=1, _mcl_potion=1}, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir(); diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index 33515c161..e14bf2c1a 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -34,7 +34,7 @@ function mcl_potions.register_splash(name, descr, color, def) _default_potent_level = def._default_potent_level, _default_extend_level = def._default_extend_level, inventory_image = splash_image(color), - groups = {brewitem=1, bottle=1, _mcl_potion=1}, + groups = {brewitem=1, bottle=1, splash_potion=1, _mcl_potion=1}, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir(); @@ -145,10 +145,10 @@ function mcl_potions.register_splash(name, descr, color, def) if potency>0 and details.uses_level then dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) end + dur = dur * mcl_potions.SPLASH_FACTOR else dur = details.dur end - dur = dur * mcl_potions.SPLASH_FACTOR if rad > 0 then mcl_potions.give_effect_by_level(name, obj, ef_level, redux_map[rad]*dur) else @@ -157,7 +157,14 @@ function mcl_potions.register_splash(name, descr, color, def) end end - if def.custom_effect then def.custom_effect(obj, potency+1) end -- TODO use redux_map + if def.custom_effect then + local power = (potency+1) * mcl_potions.SPLASH_FACTOR + if rad > 0 then + def.custom_effect(obj, redux_map[rad] * power) + else + def.custom_effect(obj, power) + end + end end end self.object:remove() From 5a7a533bf6eff1535933b3467a8ace850ba92b2c Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 8 Jan 2024 00:25:47 +0100 Subject: [PATCH 16/91] Added missing effect descriptions --- mods/ITEMS/mcl_potions/functions.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 12b0c08ec..efc4896fa 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -149,6 +149,9 @@ end mcl_potions.register_effect({ name = "invisibility", description = S("Invisiblity"), + get_tt = function(factor) + return S("body is invisible") + end, on_start = function(object, factor) mcl_potions.make_invisible(object, true) end, @@ -230,6 +233,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "water_breathing", description = S("Water Breathing"), + get_tt = function(factor) + return S("limitless breathing under water") + end, on_step = function(dtime, object, factor, duration) if not object:is_player() then return end if object:get_breath() then @@ -308,6 +314,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "night_vision", description = S("Night Vision"), + get_tt = function(factor) + return S("improved vision during the night") + end, res_condition = function(object) return (not object:is_player()) end, @@ -330,6 +339,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "fire_resistance", description = S("Fire Resistance"), + get_tt = function(factor) + return S("resistance to fire damage") + end, res_condition = function(object) return (not object:is_player()) end, From a429a462cda50991e7562e6956ae7cfe217ada0c Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 8 Jan 2024 00:26:36 +0100 Subject: [PATCH 17/91] Fixed tipped arrow descriptions --- mods/ITEMS/mcl_potions/tipped_arrow.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_potions/tipped_arrow.lua b/mods/ITEMS/mcl_potions/tipped_arrow.lua index 9ba127172..808eff61e 100644 --- a/mods/ITEMS/mcl_potions/tipped_arrow.lua +++ b/mods/ITEMS/mcl_potions/tipped_arrow.lua @@ -42,6 +42,7 @@ function mcl_potions.register_arrow(name, desc, color, def) minetest.register_craftitem("mcl_potions:"..name.."_arrow", { description = desc, _tt_help = arrow_tt .. "\n" .. tt, + _dynamic_tt = def._dynamic_tt, _doc_items_longdesc = arrow_longdesc .. "\n" .. S("This particular arrow is tipped and will give an effect when it hits a player or mob.") .. "\n" .. longdesc, From 3663a62374b67d19a3807ba4b385d53b56023331 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 8 Jan 2024 00:26:56 +0100 Subject: [PATCH 18/91] Added a constant to the API --- mods/ITEMS/mcl_potions/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 6df03db9d..550ddc27d 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -14,6 +14,7 @@ mcl_potions.INV_FACTOR = 0.50 mcl_potions.DURATION = 180 mcl_potions.DURATION_INV = mcl_potions.DURATION * mcl_potions.INV_FACTOR +mcl_potions.DURATION_POISON = 45 mcl_potions.II_FACTOR = mcl_potions.POTENT_FACTOR -- TODO remove at some point mcl_potions.DURATION_PLUS = mcl_potions.DURATION * mcl_potions.PLUS_FACTOR -- TODO remove at some point From eac63f93d5f9c594f4f69767aee60705a6ddfca6 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 8 Jan 2024 00:27:24 +0100 Subject: [PATCH 19/91] Re-registered potions under new API --- mods/ITEMS/mcl_potions/potions.lua | 221 ++++++++++++++--------------- 1 file changed, 108 insertions(+), 113 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 940bbec4c..6ba67938d 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -272,6 +272,7 @@ function mcl_potions.register_potion(def) local ling_desc = S("Lingering @1", pdef.description) local ldef = {} ldef._tt = def._tt + ldef._dynamic_tt = def._dynamic_tt ldef._longdesc = def._longdesc ldef.stack_max = pdef.stack_max ldef._effect_list = pdef._effect_list @@ -300,6 +301,7 @@ function mcl_potions.register_potion(def) end local adef = {} adef._tt = def._tt + adef._dynamic_tt = def._dynamic_tt adef._longdesc = def._longdesc adef._effect_list = pdef._effect_list adef.uses_level = uses_level @@ -671,45 +673,29 @@ end -- ╚═════╝░╚══════╝╚═╝░░░░░╚═╝╚═╝░░╚══╝╚═╝░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░ -local awkward_def = { +mcl_potions.register_potion({ name = "awkward", - description_potion = S("Awkward Potion"), - description_splash = S("Awkward Splash Potion"), - description_lingering = S("Awkward Lingering Potion"), - no_arrow = true, - no_effect = true, + desc_prefix = S("Awkward"), _tt = S("No effect"), _longdesc = S("Has an awkward taste and is used for brewing potions."), color = "#0000FF", - groups = {brewitem=1, food=3, can_eat_when_full=1, bottle=1}, - on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), -} +}) -local mundane_def = { +mcl_potions.register_potion({ name = "mundane", - description_potion = S("Mundane Potion"), - description_splash = S("Mundane Splash Potion"), - description_lingering = S("Mundane Lingering Potion"), - no_arrow = true, - no_effect = true, + desc_prefix = S("Mundane"), _tt = S("No effect"), - _longdesc = S("Has a terrible taste and is not useful for brewing potions."), + _longdesc = S("Has a terrible taste and is not really useful for brewing potions."), color = "#0000FF", - on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), -} +}) -local thick_def = { +mcl_potions.register_potion({ name = "thick", - description_potion = S("Thick Potion"), - description_splash = S("Thick Splash Potion"), - description_lingering = S("Thick Lingering Potion"), - no_arrow = true, - no_effect = true, + desc_prefix = S("Thick"), _tt = S("No effect"), - _longdesc = S("Has a bitter taste and is not useful for brewing potions."), + _longdesc = S("Has a bitter taste and is not really useful for brewing potions."), color = "#0000FF", - on_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), -} +}) local dragon_breath_def = { name = "dragon_breath", @@ -738,146 +724,155 @@ local healing_def = { is_II = true, } +mcl_potions.register_potion({ + name = "healing", + desc_suffix = S("of Healing"), + _dynamic_tt = function(level) + return S("+@1 HP", 4 * level) + end, + _longdesc = S("Instantly heals."), + color = "#F82423", + uses_level = true, + has_arrow = true, + custom_effect = function(object, level) + return mcl_potions.healing_func(object, 4 * level) + end, +}) -local harming_def = { +mcl_potions.register_potion({ name = "harming", - description = S("Harming"), - _tt = S("-6 HP"), - _tt_II = S("-12 HP"), + desc_suffix = S("of Harming"), + _dynamic_tt = function(level) + return S("-@1 HP", 6 * level) + end, _longdesc = S("Instantly deals damage."), color = "#430A09", - effect = -6, - instant = true, - on_use = mcl_potions.healing_func, - is_II = true, - is_inv = true, -} + uses_level = true, + has_arrow = true, + custom_effect = function(object, level) + return mcl_potions.healing_func(object, -6 * level) + end, +}) -local night_vision_def = { +mcl_potions.register_potion({ name = "night_vision", - description = S("Night Vision"), + desc_suffix = S("of Night Vision"), _tt = nil, _longdesc = S("Increases the perceived brightness of light under a dark sky."), color = "#1F1FA1", - effect = nil, - is_dur = true, - on_use = mcl_potions.night_vision_func, - is_plus = true, -} + _effect_list = { + night_vision = {}, + }, + has_arrow = true, +}) -local swiftness_def = { +mcl_potions.register_potion({ name = "swiftness", - description = S("Swiftness"), + desc_suffix = S("of Swiftness"), _tt = nil, _longdesc = S("Increases walking speed."), color = "#7CAFC6", - effect = 1.2, - is_dur = true, - on_use = mcl_potions.swiftness_func, - is_II = true, - is_plus = true, -} + _effect_list = { + swiftness = {}, + }, + has_arrow = true, +}) -local slowness_def = { +mcl_potions.register_potion({ name = "slowness", - description = S("Slowness"), + desc_suffix = S("of Slowness"), _tt = nil, _longdesc = S("Decreases walking speed."), color = "#5A6C81", - effect = 0.85, - is_dur = true, - on_use = mcl_potions.slowness_func, - is_II = true, - is_plus = true, - is_inv = true, -} + _effect_list = { + slowness = {dur=mcl_potions.DURATION_INV}, + }, + has_arrow = true, +}) -local leaping_def = { +mcl_potions.register_potion({ name = "leaping", - description = S("Leaping"), + desc_suffix = S("of Leaping"), _tt = nil, _longdesc = S("Increases jump strength."), color = "#22FF4C", - effect = 1.15, - is_dur = true, - on_use = mcl_potions.leaping_func, - is_II = true, - is_plus = true, -} + _effect_list = { + leaping = {}, + }, + has_arrow = true, +}) -local withering_def = { +mcl_potions.register_potion({ name = "withering", - description = S("Withering"), + desc_suffix = S("of Withering"), _tt = nil, _longdesc = S("Applies the withering effect which deals damage at a regular interval and can kill."), color = "#000000", - effect = 4, - is_dur = true, - on_use = mcl_potions.withering_func, - is_II = true, - is_plus = true, - is_inv = true, -} + _effect_list = { + withering = {dur=mcl_potions.DURATION_POISON}, + }, + has_arrow = true, +}) -local poison_def = { +mcl_potions.register_potion({ name = "poison", - description = S("Poison"), + desc_suffix = S("of Poison"), _tt = nil, _longdesc = S("Applies the poison effect which deals damage at a regular interval."), color = "#4E9331", - effect = 2.5, - is_dur = true, - on_use = mcl_potions.poison_func, - is_II = true, - is_plus = true, - is_inv = true, -} + _effect_list = { + poison = {dur=mcl_potions.DURATION_POISON}, + }, + has_arrow = true, +}) -local regeneration_def = { +mcl_potions.register_potion({ name = "regeneration", - description = S("Regeneration"), + desc_suffix = S("of Regeneration"), _tt = nil, _longdesc = S("Regenerates health over time."), color = "#CD5CAB", - effect = 2.5, - is_dur = true, - on_use = mcl_potions.regeneration_func, - is_II = true, - is_plus = true, -} + _effect_list = { + regeneration = {dur=mcl_potions.DURATION_POISON}, + }, + has_arrow = true, +}) -local invisibility_def = { +mcl_potions.register_potion({ name = "invisibility", - description = S("Invisibility"), + desc_suffix = S("of Invisibility"), _tt = nil, _longdesc = S("Grants invisibility."), color = "#7F8392", - is_dur = true, - on_use = mcl_potions.invisiblility_func, - is_plus = true, -} + _effect_list = { + invisibility = {}, + }, + has_arrow = true, +}) -local water_breathing_def = { +mcl_potions.register_potion({ name = "water_breathing", - description = S("Water Breathing"), + desc_suffix = S("of Water Breathing"), _tt = nil, _longdesc = S("Grants limitless breath underwater."), color = "#2E5299", - is_dur = true, - on_use = mcl_potions.water_breathing_func, - is_plus = true, -} + _effect_list = { + water_breathing = {}, + }, + has_arrow = true, +}) -local fire_resistance_def = { +mcl_potions.register_potion({ name = "fire_resistance", - description = S("Fire Resistance"), + desc_suffix = S("of Fire Resistance"), _tt = nil, _longdesc = S("Grants immunity to damage from heat sources like fire."), color = "#E49A3A", - is_dur = true, - on_use = mcl_potions.fire_resistance_func, - is_plus = true, -} + _effect_list = { + fire_resistance = {}, + }, + has_arrow = true, +}) From b84d36b3ff57ec80cb9e15062d7408d826df7410 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 8 Jan 2024 00:41:08 +0100 Subject: [PATCH 20/91] Registered dragon breath and pruned code * removed old registration code * added to the API the `nocreative` field * registered the bottled dragon's breath as an item --- mods/ITEMS/mcl_potions/lingering.lua | 4 +- mods/ITEMS/mcl_potions/potions.lua | 366 +----------------------- mods/ITEMS/mcl_potions/splash.lua | 4 +- mods/ITEMS/mcl_potions/tipped_arrow.lua | 4 +- 4 files changed, 23 insertions(+), 355 deletions(-) diff --git a/mods/ITEMS/mcl_potions/lingering.lua b/mods/ITEMS/mcl_potions/lingering.lua index 646ff16ff..ea0d0f36c 100644 --- a/mods/ITEMS/mcl_potions/lingering.lua +++ b/mods/ITEMS/mcl_potions/lingering.lua @@ -125,6 +125,8 @@ function mcl_potions.register_lingering(name, descr, color, def) longdesc = longdesc .. "\n" .. def._longdesc end end + local groups = {brewitem=1, bottle=1, ling_potion=1, _mcl_potion=1} + if def.nocreative then groups.not_in_creative_inventory = 1 end minetest.register_craftitem(id, { description = descr, _tt_help = def._tt, @@ -139,7 +141,7 @@ function mcl_potions.register_lingering(name, descr, color, def) _default_potent_level = def._default_potent_level, _default_extend_level = def._default_extend_level, inventory_image = lingering_image(color), - groups = {brewitem=1, bottle=1, ling_potion=1, _mcl_potion=1}, + groups = groups, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir(); diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 6ba67938d..5f941b2fb 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -148,6 +148,7 @@ end -- groups - table - item groups definition for the regular potion, not splash or lingering - -- - must contain _mcl_potion=1 for tooltip to include dynamic_tt and effects -- - defaults to {brewitem=1, food=3, can_eat_when_full=1, _mcl_potion=1} +-- nocreative - bool - adds a not_in_creative_inventory=1 group - defaults to false -- _effect_list - table - all the effects dealt by the potion in the format of tables -- -- the name of each sub-table should be a name of a registered effect, and fields can be the following: -- -- -- uses_level - bool - whether the level of the potion affects the level of the effect - @@ -204,6 +205,7 @@ function mcl_potions.register_potion(def) pdef.inventory_image = def.image or potion_image(color) pdef.wield_image = pdef.inventory_image pdef.groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, _mcl_potion=1} + if def.nocreative then pdef.groups.not_in_creative_inventory = 1 end pdef._effect_list = {} local effect @@ -255,6 +257,7 @@ function mcl_potions.register_potion(def) sdef._tt = def._tt sdef._dynamic_tt = def._dynamic_tt sdef._longdesc = def._longdesc + sdef.nocreative = def.nocreative sdef.stack_max = pdef.stack_max sdef._effect_list = pdef._effect_list sdef.uses_level = uses_level @@ -274,6 +277,7 @@ function mcl_potions.register_potion(def) ldef._tt = def._tt ldef._dynamic_tt = def._dynamic_tt ldef._longdesc = def._longdesc + ldef.nocreative = def.nocreative ldef.stack_max = pdef.stack_max ldef._effect_list = pdef._effect_list ldef.uses_level = uses_level @@ -303,6 +307,7 @@ function mcl_potions.register_potion(def) adef._tt = def._tt adef._dynamic_tt = def._dynamic_tt adef._longdesc = def._longdesc + adef.nocreative = def.nocreative adef._effect_list = pdef._effect_list adef.uses_level = uses_level adef.has_potent = pdef.has_potent @@ -326,6 +331,7 @@ mcl_potions.register_potion({ _longdesc = "Trolololololo", stack_max = 2, color = "#00AA00", + nocreative = true, _effect_list = { night_vision = {}, strength = {}, @@ -344,319 +350,6 @@ mcl_potions.register_potion({ }) -local function register_potion(def) - - local dur = mcl_potions.DURATION - - if def.is_inv then - dur = dur * mcl_potions.INV_FACTOR - end - if def.name == "poison" or def.name == "regeneration" or def.name == "withering" then - dur = 45 - end - - local on_use = nil - - if def.on_use then - on_use = return_on_use(def, def.effect, dur) - end - - local function get_tt(tt, effect, dur) - local _tt - if effect and def.is_dur then - _tt = perc_string(effect).." | "..time_string(dur) - if def.name == "poison" or def.name == "regeneration" or def.name == "withering" then - _tt = S("1 HP/@1s | @2", effect, time_string(dur)) - end - elseif def.name == "healing" or def.name == "harming" then - _tt = S("@1 HP", effect) - else - _tt = tt or time_string(dur) or S("No effect") - end - return _tt - end - - local function get_splash_fun(effect, sp_dur) - if def.is_dur then - return function(player, redx) def.on_use(player, effect, sp_dur*redx) end - elseif def.effect then - return function(player, redx) def.on_use(player, effect*redx, sp_dur) end - end - -- covers case of no effect (water, awkward, mundane) - return function() end - end - - local function get_lingering_fun(effect, ling_dur) - if def.is_dur then - return function(player) def.on_use(player, effect, ling_dur) end - elseif def.effect then - return function(player) def.on_use(player, effect*0.5, ling_dur) end - end - -- covers case of no effect (water, awkward, mundane) - return function() end - end - - local function get_arrow_fun(effect, dur) - if def.is_dur then - return function(player) def.on_use(player, effect, dur) end - elseif def.effect then - return function(player) def.on_use(player, effect, dur) end - end - -- covers case of no effect (water, awkward, mundane) - return function() end - end - - local desc - if not def.no_potion then - if def.description_potion then - desc = def.description_potion - else - desc = S("@1 Potion", def.description) - end - else - desc = def.description - end - local potion_longdesc = def._longdesc - if not def.no_effect then - potion_longdesc = potion_intro .. "\n" .. def._longdesc - end - local potion_usagehelp - local basic_potion_tt - if def.name ~= "dragon_breath" then - potion_usagehelp = how_to_drink - basic_potion_tt = get_tt(def._tt, def.effect, dur) - end - - minetest.register_craftitem("mcl_potions:"..def.name, { - description = desc, - _tt_help = basic_potion_tt, - _doc_items_longdesc = potion_longdesc, - _doc_items_usagehelp = potion_usagehelp, - stack_max = def.stack_max or 1, - inventory_image = def.image or potion_image(def.color), - wield_image = def.image or potion_image(def.color), - groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, bottle=1}, - on_place = on_use, - on_secondary_use = on_use, - }) - - -- Register Splash and Lingering - local splash_dur = dur * mcl_potions.SPLASH_FACTOR - local ling_dur = dur * mcl_potions.LINGERING_FACTOR - - local splash_def = { - tt = get_tt(def._tt, def.effect, splash_dur), - longdesc = def._longdesc, - potion_fun = get_splash_fun(def.effect, splash_dur), - no_effect = def.no_effect, - instant = def.instant, - } - - local ling_def - if def.name == "healing" or def.name == "harming" then - ling_def = { - tt = get_tt(def._tt, def.effect*mcl_potions.LINGERING_FACTOR, ling_dur), - longdesc = def._longdesc, - potion_fun = get_lingering_fun(def.effect*mcl_potions.LINGERING_FACTOR, ling_dur), - no_effect = def.no_effect, - instant = def.instant, - } - else - ling_def = { - tt = get_tt(def._tt, def.effect, ling_dur), - longdesc = def._longdesc, - potion_fun = get_lingering_fun(def.effect, ling_dur), - no_effect = def.no_effect, - instant = def.instant, - } - end - - local arrow_def = { - tt = get_tt(def._tt, def.effect, dur/8.), - longdesc = def._longdesc, - potion_fun = get_arrow_fun(def.effect, dur/8.), - no_effect = def.no_effect, - instant = def.instant, - } - - if def.color and not def.no_throwable then - local desc - if def.description_splash then - desc = def.description_splash - else - desc = S("Splash @1 Potion", def.description) - end - mcl_potions.register_splash(def.name, desc, def.color, splash_def) - if def.description_lingering then - desc = def.description_lingering - else - desc = S("Lingering @1 Potion", def.description) - end - mcl_potions.register_lingering(def.name, desc, def.color, ling_def) - if not def.no_arrow then - mcl_potions.register_arrow(def.name, S("Arrow of @1", def.description), def.color, arrow_def) - end - end - - if def.is_II then - - local desc_mod = S(" II") - - local effect_II - if def.name == "healing" or def.name == "harming" then - effect_II = def.effect*mcl_potions.II_FACTOR - elseif def.name == "poison" or def.name == "regeneration" then - effect_II = 1.2 - elseif def.name == "withering" then - effect_II = 2 - else - effect_II = def.effect^mcl_potions.II_FACTOR - end - - local dur_2 = dur / mcl_potions.II_FACTOR - if def.name == "poison" then dur_2 = dur_2 - 1 end - - if def.name == "slowness" then - dur_2 = 20 - effect_II = 0.40 - desc_mod = S(" IV") - end - - on_use = return_on_use(def, effect_II, dur_2) - - minetest.register_craftitem("mcl_potions:"..def.name.."_2", { - description = S("@1 Potion@2", def.description, desc_mod), - _tt_help = get_tt(def._tt_2, effect_II, dur_2), - _doc_items_longdesc = potion_longdesc, - _doc_items_usagehelp = potion_usagehelp, - stack_max = def.stack_max or 1, - inventory_image = def.image or potion_image(def.color), - wield_image = def.image or potion_image(def.color), - groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, bottle=1}, - on_place = on_use, - on_secondary_use = on_use, - }) - - -- Register Splash and Lingering - local splash_dur_2 = dur_2 * mcl_potions.SPLASH_FACTOR - local ling_dur_2 = dur_2 * mcl_potions.LINGERING_FACTOR - - local splash_def_2 - if def.name == "healing" then - splash_def_2 = { - tt = get_tt(def._tt_2, 7, splash_dur_2), - longdesc = def._longdesc, - potion_fun = get_splash_fun(7, splash_dur_2), - no_effect = def.no_effect, - instant = def.instant, - } - else - splash_def_2 = { - tt = get_tt(def._tt_2, effect_II, splash_dur_2), - longdesc = def._longdesc, - potion_fun = get_splash_fun(effect_II, splash_dur_2), - no_effect = def.no_effect, - instant = def.instant, - } - end - - - local ling_def_2 - if def.name == "healing" or def.name == "harming" then - ling_def_2 = { - tt = get_tt(def._tt_2, effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2), - longdesc = def._longdesc, - potion_fun = get_lingering_fun(effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2), - no_effect = def.no_effect, - instant = def.instant, - } - else - ling_def_2 = { - tt = get_tt(def._tt_2, effect_II, ling_dur_2), - longdesc = def._longdesc, - potion_fun = get_lingering_fun(effect_II, ling_dur_2), - no_effect = def.no_effect, - instant = def.instant, - } - end - - local arrow_def_2 = { - tt = get_tt(def._tt_2, effect_II, dur_2/8.), - longdesc = def._longdesc, - potion_fun = get_arrow_fun(effect_II, dur_2/8.), - no_effect = def.no_effect, - instant = def.instant, - } - - if def.color and not def.no_throwable then - mcl_potions.register_splash(def.name.."_2", S("Splash @1@2 Potion", def.description, desc_mod), def.color, splash_def_2) - mcl_potions.register_lingering(def.name.."_2", S("Lingering @1@2 Potion", def.description, desc_mod), def.color, ling_def_2) - if not def.no_arrow then - mcl_potions.register_arrow(def.name.."_2", S("Arrow of @1@2", def.description, desc_mod), def.color, arrow_def_2) - end - end - - end - - if def.is_plus then - - local dur_pl = dur * mcl_potions.PLUS_FACTOR - if def.name == "poison" or def.name == "regeneration" or def.name == "withering" then - dur_pl = 90 - end - - on_use = return_on_use(def, def.effect, dur_pl) - - minetest.register_craftitem("mcl_potions:"..def.name.."_plus", { - description = S("@1 + Potion", def.description), - _tt_help = get_tt(def._tt_plus, def.effect, dur_pl), - _doc_items_longdesc = potion_longdesc, - _doc_items_usagehelp = potion_usagehelp, - stack_max = 1, - inventory_image = def.image or potion_image(def.color), - wield_image = def.image or potion_image(def.color), - groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, bottle=1}, - on_place = on_use, - on_secondary_use = on_use, - }) - - -- Register Splash - local splash_dur_pl = dur_pl * mcl_potions.SPLASH_FACTOR - local ling_dur_pl = dur_pl * mcl_potions.LINGERING_FACTOR - - local splash_def_pl = { - tt = get_tt(def._tt_plus, def.effect, splash_dur_pl), - longdesc = def._longdesc, - potion_fun = get_splash_fun(def.effect, splash_dur_pl), - no_effect = def.no_effect, - instant = def.instant, - } - local ling_def_pl = { - tt = get_tt(def._tt_plus, def.effect, ling_dur_pl), - longdesc = def._longdesc, - potion_fun = get_lingering_fun(def.effect, ling_dur_pl), - no_effect = def.no_effect, - instant = def.instant, - } - local arrow_def_pl = { - tt = get_tt(def._tt_pl, def.effect, dur_pl/8.), - longdesc = def._longdesc, - potion_fun = get_arrow_fun(def.effect, dur_pl/8.), - no_effect = def.no_effect, - instant = def.instant, - } - if def.color and not def.no_throwable then - mcl_potions.register_splash(def.name.."_plus", S("Splash @1 + Potion", def.description), def.color, splash_def_pl) - mcl_potions.register_lingering(def.name.."_plus", S("Lingering @1 + Potion", def.description), def.color, ling_def_pl) - if not def.no_arrow then - mcl_potions.register_arrow(def.name.."_plus", S("Arrow of @1 +", def.description), def.color, arrow_def_pl) - end - end - - end - -end - -- ██████╗░░█████╗░████████╗██╗░█████╗░███╗░░██╗ -- ██╔══██╗██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║ @@ -673,6 +366,14 @@ end -- ╚═════╝░╚══════╝╚═╝░░░░░╚═╝╚═╝░░╚══╝╚═╝░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░ +minetest.register_craftitem("mcl_potions:dragon_breath", { + description = S("Dragon's Breath"), + _longdesc = S("This item is used in brewing and can be combined with splash potions to create lingering potions."), + image = "mcl_potions_dragon_breath.png", + groups = { brewitem = 1, bottle = 1 }, + stack_max = 64, +}) + mcl_potions.register_potion({ name = "awkward", desc_prefix = S("Awkward"), @@ -697,33 +398,6 @@ mcl_potions.register_potion({ color = "#0000FF", }) -local dragon_breath_def = { - name = "dragon_breath", - description = S("Dragon's Breath"), - no_arrow = true, - no_potion = true, - no_throwable = true, - no_effect = true, - _longdesc = S("This item is used in brewing and can be combined with splash potions to create lingering potions."), - image = "mcl_potions_dragon_breath.png", - groups = { brewitem = 1, bottle = 1 }, - on_use = nil, - stack_max = 64, -} - -local healing_def = { - name = "healing", - description = S("Healing"), - _tt = S("+4 HP"), - _tt_2 = S("+8 HP"), - _longdesc = S("Instantly heals."), - color = "#F82423", - effect = 4, - instant = true, - on_use = mcl_potions.healing_func, - is_II = true, -} - mcl_potions.register_potion({ name = "healing", desc_suffix = S("of Healing"), @@ -876,18 +550,6 @@ mcl_potions.register_potion({ -local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def, - healing_def, harming_def, night_vision_def, swiftness_def, - slowness_def, leaping_def, withering_def, poison_def, regeneration_def, - invisibility_def, water_breathing_def, fire_resistance_def} - --- for _, def in ipairs(defs) do --- register_potion(def) --- end - - - - -- minetest.register_craftitem("mcl_potions:weakness", { -- description = S("Weakness"), -- _tt_help = TODO, diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index e14bf2c1a..2fb9f362c 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -20,6 +20,8 @@ function mcl_potions.register_splash(name, descr, color, def) longdesc = longdesc .. "\n" .. def._longdesc end end + local groups = {brewitem=1, bottle=1, splash_potion=1, _mcl_potion=1} + if def.nocreative then groups.not_in_creative_inventory = 1 end minetest.register_craftitem(id, { description = descr, _tt_help = def._tt, @@ -34,7 +36,7 @@ function mcl_potions.register_splash(name, descr, color, def) _default_potent_level = def._default_potent_level, _default_extend_level = def._default_extend_level, inventory_image = splash_image(color), - groups = {brewitem=1, bottle=1, splash_potion=1, _mcl_potion=1}, + groups = groups, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir(); diff --git a/mods/ITEMS/mcl_potions/tipped_arrow.lua b/mods/ITEMS/mcl_potions/tipped_arrow.lua index 808eff61e..a6a1b71bc 100644 --- a/mods/ITEMS/mcl_potions/tipped_arrow.lua +++ b/mods/ITEMS/mcl_potions/tipped_arrow.lua @@ -39,6 +39,8 @@ function mcl_potions.register_arrow(name, desc, color, def) local longdesc = def._longdesc or "" local tt = def._tt or "" + local groups = {ammo=1, ammo_bow=1, brewitem=1, _mcl_potion=1} + if def.nocreative then groups.not_in_creative_inventory = 1 end minetest.register_craftitem("mcl_potions:"..name.."_arrow", { description = desc, _tt_help = arrow_tt .. "\n" .. tt, @@ -54,7 +56,7 @@ function mcl_potions.register_arrow(name, desc, color, def) _default_potent_level = def._default_potent_level, _default_extend_level = def._default_extend_level, inventory_image = "mcl_bows_arrow_inv.png^(mcl_potions_arrow_inv.png^[colorize:"..color..":100)", - groups = { ammo=1, ammo_bow=1, brewitem=1, _mcl_potion=1}, + groups = groups, _on_dispense = function(itemstack, dispenserpos, droppos, dropnode, dropdir) -- Shoot arrow local shootpos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51)) From 209299b79147c1dd8538f1fadff4aee048d3474a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 10 Jan 2024 21:57:15 +0100 Subject: [PATCH 21/91] Improved /effect command return messages Also improved the name of a variable --- mods/ITEMS/mcl_potions/commands.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index 53245f4fc..7b420f801 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -10,7 +10,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) minetest.register_chatcommand("effect",{ params = S("|heal|list [] []"), - description = S("Add a status effect to yourself. Arguments: : name of status effect, e.g. poison. Passing list as effect name lists available effects. Passing heal as effect name heals (or harms) by amount designed by the next parameter. : duration in seconds. (: amount of healing when the effect is heal, passing a negative value subtracts health.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level, defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect."), + description = S("Add a status effect to yourself. Arguments: : name of status effect. Passing \"list\" as effect name lists available effects. Passing \"heal\" as effect name heals (or harms) by amount designed by the next parameter. : duration in seconds. (: amount of healing when the effect is \"heal\", passing a negative value subtracts health.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor."), privs = {server = true}, func = function(name, params) @@ -25,8 +25,8 @@ minetest.register_chatcommand("effect",{ return false, S("Missing effect parameter!") elseif P[1] == "list" then local effects = "heal" - for name, _ in pairs(mcl_potions.registered_effects) do - effects = effects .. ", " .. name + for effect, _ in pairs(mcl_potions.registered_effects) do + effects = effects .. ", " .. effect end return true, effects elseif P[1] == "heal" then @@ -61,14 +61,22 @@ minetest.register_chatcommand("effect",{ if P[3] == "F" then local given = mcl_potions.give_effect(P[1], minetest.get_player_by_name(name), tonumber(P[4]), tonumber(P[2])) if given then - return true, S("@1 effect given to player @2 for @3 seconds with factor of @4.", def.description, name, P[2], P[4]) + if def.uses_factor then + return true, S("@1 effect given to player @2 for @3 seconds with factor of @4.", def.description, name, P[2], P[4]) + else + return true, S("@1 effect given to player @2 for @3 seconds.", def.description, name, P[2]) + end else return false, S("Giving effect @1 to player @2 failed.", def.description, name) end else local given = mcl_potions.give_effect_by_level(P[1], minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2])) if given then - return true, S("@1 effect on level @2 given to player @3 for @4 seconds.", def.description, P[3], name, P[2]) + if def.uses_factor then + return true, S("@1 effect on level @2 given to player @3 for @4 seconds.", def.description, P[3], name, P[2]) + else + return true, S("@1 effect given to player @2 for @3 seconds.", def.description, name, P[2]) + end else return false, S("Giving effect @1 to player @2 failed.", def.description, name) end From a6c9bc8a0118661a256162dfc864942b92305947 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 11 Jan 2024 00:23:41 +0100 Subject: [PATCH 22/91] Improved effects HUD and fixes * Fixed some effects not being replaced correctly with higher levels * Implemented an old FIXME (MTE 5.3.0 fixed underlying bug) * Added a way to obtain an approximate level of effect from factor * Added effect level to HUD under the icon * Added effect timer to HUD under the icon --- mods/ITEMS/mcl_potions/functions.lua | 115 +++++++++++++++++++++------ 1 file changed, 89 insertions(+), 26 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index efc4896fa..51236c17d 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -33,6 +33,14 @@ local function generate_linear_lvl_to_fac(l1, l2) end end +local function generate_linear_fac_to_lvl(l1, l2) + local a = 1/(l2 - l1) + local b = -(2*l1 - l2) * a + return function(factor) + return math.round(a*factor + b) + end +end + local function generate_rational_lvl_to_fac(l1, l2) local a = (l1 - l2) * 2 local b = 2*l2 - l1 @@ -42,6 +50,15 @@ local function generate_rational_lvl_to_fac(l1, l2) end end +local function generate_rational_fac_to_lvl(l1, l2) + local a = (l1 - l2) * 2 + local b = 2*l2 - l1 + return function(factor) + if factor == 0 then return math.huge end + return math.round(a/(factor - b)) + end +end + local function generate_modifier_func(name, dmg_flag, mod_func) return function(object, damage, reason) if EF[name][object] and not reason.flags.bypasses_magic and reason.flags[dmg_flag] then @@ -118,8 +135,12 @@ function mcl_potions.register_effect(def) local l2 = def.lvl2_factor or 2*l1 if l1 < l2 then pdef.level_to_factor = generate_linear_lvl_to_fac(l1, l2) + pdef.factor_to_level = generate_linear_fac_to_lvl(l1, l2) + pdef.inv_factor = false elseif l1 > l2 then pdef.level_to_factor = generate_rational_lvl_to_fac(l1, l2) + pdef.factor_to_level = generate_rational_fac_to_lvl(l1, l2) + pdef.inv_factor = true else error("Can't extrapolate levels from lvl1 and lvl2 bearing the same factor") end @@ -417,7 +438,8 @@ local function potions_init_icons(player) icon_ids[name] = {} for e=1, EFFECT_TYPES do local x = -52 * e - 2 - local id = player:hud_add({ + local id = {} + id.img = player:hud_add({ hud_elem_type = "image", text = "blank.png", position = { x = 1, y = 0 }, @@ -426,6 +448,28 @@ local function potions_init_icons(player) alignment = { x = 1, y = 1 }, z_index = 100, }) + id.label = player:hud_add({ + hud_elem_type = "text", + text = "", + position = { x = 1, y = 0 }, + offset = { x = x+22, y = 50 }, + scale = { x = 50, y = 15 }, + alignment = { x = 0, y = 1 }, + z_index = 100, + style = 1, + number = 0xFFFFFF, + }) + id.timestamp = player:hud_add({ + hud_elem_type = "text", + text = "", + position = { x = 1, y = 0 }, + offset = { x = x+22, y = 65 }, + scale = { x = 50, y = 15 }, + alignment = { x = 0, y = 1 }, + z_index = 100, + style = 1, + number = 0xFFFFFF, + }) table.insert(icon_ids[name], id) end end @@ -438,19 +482,38 @@ local function potions_set_icons(player) local active_effects = {} for effect_name, effect in pairs(EF) do if effect[player] then - table.insert(active_effects, effect_name) + active_effects[effect_name] = effect[player] end end - for i=1, EFFECT_TYPES do - local icon = icon_ids[name][i] - local effect_name = active_effects[i] - if effect_name == nil then - player:hud_change(icon, "text", "blank.png") - else - player:hud_change(icon, "text", "mcl_potions_effect_"..effect_name..".png^[resize:128x128") + local i = 1 + for effect_name, def in pairs(registered_effects) do + local icon = icon_ids[name][i].img + local label = icon_ids[name][i].label + local timestamp = icon_ids[name][i].timestamp + local vals = active_effects[effect_name] + if vals then + player:hud_change(icon, "text", def.icon .. "^[resize:128x128") + if def.uses_factor then + local level = def.factor_to_level(vals.factor) + if level == math.huge then level = "∞" + else level = mcl_util.to_roman(level) end + player:hud_change(label, "text", level) + else + player:hud_change(label, "text", "") + end + local dur = math.round(vals.dur-vals.timer) + player:hud_change(timestamp, "text", math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))) + EF[effect_name][player].hud_index = i + i = i + 1 end end + while i < EFFECT_TYPES do + player:hud_change(icon_ids[name][i].img, "text", "blank.png") + player:hud_change(icon_ids[name][i].label, "text", "") + player:hud_change(icon_ids[name][i].timestamp, "text", "") + i = i + 1 + end end local function potions_set_hud(player) @@ -496,6 +559,10 @@ minetest.register_globalstep(function(dtime) meta:set_string("mcl_potions:"..name, minetest.serialize(EF[name][object])) potions_set_hud(object) end + elseif object:is_player() then + local dur = math.round(vals.dur-vals.timer) + object:hud_change(icon_ids[object:get_player_name()][vals.hud_index].timestamp, + "text", math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))) end end end @@ -665,15 +732,7 @@ minetest.register_on_joinplayer( function(player) mcl_potions._reset_player_effects(player, false) -- make sure there are no weird holdover effects mcl_potions._load_player_effects(player) potions_init_icons(player) - -- .after required because player:hud_change doesn't work when called - -- in same tick as player:hud_add - -- (see ) - -- FIXME: Remove minetest.after - minetest.after(3, function(player) - if player and player:is_player() then - potions_set_hud(player) - end - end, player) + potions_set_hud(player) end) minetest.register_on_shutdown(function() @@ -833,14 +892,18 @@ function mcl_potions.give_effect(name, object, factor, duration) if edef.on_start then edef.on_start(object, factor) end else local present = EF[name][object] - if not edef.uses_factor or (edef.uses_factor and factor >= present.factor) then - present.dur = math.max(duration, present.dur - present.timer) - present.timer = 0 - if edef.uses_factor then - present.factor = factor - if edef.timer_uses_factor then present.step = factor end - if edef.on_start then edef.on_start(object, factor) end - end + if not edef.uses_factor or (edef.uses_factor and + (not edef.inv_factor and factor >= present.factor + or edef.inv_factor and factor <= present.factor)) then + present.dur = math.max(duration, present.dur - present.timer) + present.timer = 0 + if edef.uses_factor then + present.factor = factor + if edef.timer_uses_factor then present.step = factor end + if edef.on_start then edef.on_start(object, factor) end + end + else + return false end end From 40580843d531fdc3f5d9e39f6dc509d8bc7fee8b Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 13 Jan 2024 05:20:33 +0100 Subject: [PATCH 23/91] New effect icons --- textures/mcl_potions_effect_absorbtion.png | Bin 0 -> 130 bytes textures/mcl_potions_effect_bad_luck.png | Bin 0 -> 101 bytes textures/mcl_potions_effect_bad_omen.png | Bin 156 -> 126 bytes textures/mcl_potions_effect_blindness.png | Bin 0 -> 125 bytes textures/mcl_potions_effect_conduit_power.png | Bin 0 -> 124 bytes textures/mcl_potions_effect_darkness.png | Bin 0 -> 114 bytes textures/mcl_potions_effect_dolphin_grace.png | Bin 0 -> 152 bytes textures/mcl_potions_effect_fatigue.png | Bin 0 -> 147 bytes textures/mcl_potions_effect_fire_resistance.png | Bin 121 -> 149 bytes textures/mcl_potions_effect_food_poisoning.png | Bin 126 -> 128 bytes textures/mcl_potions_effect_glowing.png | Bin 0 -> 147 bytes textures/mcl_potions_effect_haste.png | Bin 0 -> 130 bytes textures/mcl_potions_effect_health_boost.png | Bin 0 -> 115 bytes textures/mcl_potions_effect_hero_of_village.png | Bin 0 -> 136 bytes textures/mcl_potions_effect_invisibility.png | Bin 124 -> 146 bytes textures/mcl_potions_effect_leaping.png | Bin 122 -> 118 bytes textures/mcl_potions_effect_levitation.png | Bin 0 -> 135 bytes textures/mcl_potions_effect_luck.png | Bin 0 -> 135 bytes textures/mcl_potions_effect_nausea.png | Bin 0 -> 138 bytes textures/mcl_potions_effect_night_vision.png | Bin 112 -> 148 bytes textures/mcl_potions_effect_poison.png | Bin 123 -> 147 bytes textures/mcl_potions_effect_regeneration.png | Bin 138 -> 138 bytes textures/mcl_potions_effect_resistance.png | Bin 0 -> 111 bytes textures/mcl_potions_effect_saturation.png | Bin 0 -> 134 bytes textures/mcl_potions_effect_slow_falling.png | Bin 0 -> 124 bytes textures/mcl_potions_effect_slowness.png | Bin 118 -> 152 bytes textures/mcl_potions_effect_strength.png | Bin 114 -> 142 bytes textures/mcl_potions_effect_swiftness.png | Bin 122 -> 129 bytes textures/mcl_potions_effect_water_breathing.png | Bin 142 -> 137 bytes textures/mcl_potions_effect_weakness.png | Bin 129 -> 134 bytes 30 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 textures/mcl_potions_effect_absorbtion.png create mode 100644 textures/mcl_potions_effect_bad_luck.png create mode 100644 textures/mcl_potions_effect_blindness.png create mode 100644 textures/mcl_potions_effect_conduit_power.png create mode 100644 textures/mcl_potions_effect_darkness.png create mode 100644 textures/mcl_potions_effect_dolphin_grace.png create mode 100644 textures/mcl_potions_effect_fatigue.png create mode 100644 textures/mcl_potions_effect_glowing.png create mode 100644 textures/mcl_potions_effect_haste.png create mode 100644 textures/mcl_potions_effect_health_boost.png create mode 100644 textures/mcl_potions_effect_hero_of_village.png create mode 100644 textures/mcl_potions_effect_levitation.png create mode 100644 textures/mcl_potions_effect_luck.png create mode 100644 textures/mcl_potions_effect_nausea.png create mode 100644 textures/mcl_potions_effect_resistance.png create mode 100644 textures/mcl_potions_effect_saturation.png create mode 100644 textures/mcl_potions_effect_slow_falling.png diff --git a/textures/mcl_potions_effect_absorbtion.png b/textures/mcl_potions_effect_absorbtion.png new file mode 100644 index 0000000000000000000000000000000000000000..114f64e2df9c8484a245f7eae294d3acb5b4fa5a GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|o}Mm_AsQ2tH*DOd#%aj#@!Cor z7o|le2hJW_$9S2ypiqQ2t!R!*({fMlut~~&f0j6g dJW}RlWZ1&Q!tgC=gB;LM22WQ%mvv4FO#n&4DJTE{ literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_bad_luck.png b/textures/mcl_potions_effect_bad_luck.png new file mode 100644 index 0000000000000000000000000000000000000000..f950d489ff1edab78ac1d2da2b3881933f70b91c GIT binary patch literal 101 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|I-V|$AsQ2tH*DOd#%ahpUXO@geCxjavJdf literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_bad_omen.png b/textures/mcl_potions_effect_bad_omen.png index 4293aed2236a2baf56c5cbebb9c4925daef0ce6d..e652e6c5ce379bda0de1b4eddb406c8f997b91d4 100644 GIT binary patch literal 126 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|uAVNAAsQ2tH*DOd#%aj#an>(8 zrHc-k4rPXnycw?ywl2(YnD+bp0S1>Dk2rWw9CHX!e%+|Oz=8RspVINmPgq_*@RU+f ZWGJ2;ct!R2(tMzS44$rjF6*2UngG65DVhKP literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh<3?#J|q#XfLoB=)|u0Yzx+PXO>Y^CwqNk9%` zNswPKgTu2MX+Vynr;B3PZ!~!GZ?fp(EwD6Ez96z7+aatylgTe~DWM4f3eF}= literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_darkness.png b/textures/mcl_potions_effect_darkness.png new file mode 100644 index 0000000000000000000000000000000000000000..fc72daeb0819ee06535b7ffd21e010c013e5d0f0 GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|mYyz-AsQ2tH*DOd#%b7KaIt}j zmu0Ksl!K8KUk;>RG)=hLtkdesJWI}`@Qu`iDg)M+l53RxnLRlebU)fnHMXFVdQ&MBb@0Cp208UO$Q literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_dolphin_grace.png b/textures/mcl_potions_effect_dolphin_grace.png new file mode 100644 index 0000000000000000000000000000000000000000..ac640819de3098e6e39a9900d6bba4e04d0aa9f5 GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|@t!V@AsQ2tH*DOd#%ai~G3Ta~ zlAsf_V{Snz2XDof1F3;?SjttG1*Mp3)E#&ls8e@fG5hZ2g)a|EdhMv`^k-g{e&Ns* zBi;;^P4X8!*nAFuXweKj*rhM`K_y6pS4EM*q3D}$@@GkJpj8Z>u6{1-oD!M<=e;pF literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_fatigue.png b/textures/mcl_potions_effect_fatigue.png new file mode 100644 index 0000000000000000000000000000000000000000..13b724c2ad6c7cace908d5c93070b7b7ba9392ad GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|QJyZ2AsQ2tH*DOd#%aj#@&A75 z4wn~F6MUPxA6#ijGu@=%C;h>?Z3Ekmk0*HMNL{$&cEEGSD$W}XE2WmR?O@S6pU}zv wXWwxl{vC%zT$$yr{xF#^XIjTq2O%bg;-XtUyG3I+0&QXNboFyt=akR{0A+VH*Z=?k literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_fire_resistance.png b/textures/mcl_potions_effect_fire_resistance.png index effbefaa4d26ed3b01cc4d4264126402c2c79d74..3be85391d471bfa8d9a7bd07da3c2684fdd7b490 100644 GIT binary patch delta 131 zcmV-}0DS*>l>v|#eFy>o005AYXf^-<09;8#K~yM_W3aKdCJ8YB@wrA#A`wCZF=k`Y zfTk0|MUzFh0aG(!4RC|uZ0s74O~O=7zy>ru$RxU_afK$u8t~{r3k;N)#^q@&F^x4? lu*x-H)J&QsttHS% N22WQ%mvv4FO#lx6A&CG0 delta 108 zcmZo*teYT_#>mXTz@TcIs|2Lj0(?STZLF;qY%eXHp3wvpG4^zE4B?PXPD@BwcmI6O zgM({cpMG=USWZ>b%`YmOua%~?KTar_cJm?Q=EF>B?CJtmH#itHfAhBN+hsiksGY&n L)z4*}Q$iB}7G5cG diff --git a/textures/mcl_potions_effect_glowing.png b/textures/mcl_potions_effect_glowing.png new file mode 100644 index 0000000000000000000000000000000000000000..83cd8b969246092a9ac4fe289bdeed673f5a630c GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|QJyZ2AsQ2tH*DOd#%aj#ar^&N z7o`?9lU#wr7hD2N6kZ=Z?@%t}sMp1|=AUD5!%@$QF9FLMQ`9Fu&V1r=pogpGW5Y7W vZutu`U75_&W*nPu^5G{Ve^ZtMCnH17ltXqb^$)#)wlH|Q`njxgN@xNA$(Ay4 literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_haste.png b/textures/mcl_potions_effect_haste.png new file mode 100644 index 0000000000000000000000000000000000000000..54dd34740ea9c49d85d9f8d5dbf7c612fff3d289 GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|o}Mm_AsQ2tH*DOd#%aj#@xMHe zi&Bl0!P#Rg8CM6rF?$f$wXShN(40DjYixh!sV!(^k@on&Y-p$UCX-2uL#qF%r^r&( d8YvGahNRu8g0UKPxY;G)-x}l(8YmGQ!h|A-mjGp+Hj@ NJYD@<);T3K0RY??A7ual literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_hero_of_village.png b/textures/mcl_potions_effect_hero_of_village.png new file mode 100644 index 0000000000000000000000000000000000000000..c0462a40fe6b9a9b58010f7001478c90a22b4557 GIT binary patch literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|{+=$5AsQ2tH*DOd#%b8_LCRc7 zP>eUC=g88=2JZ_d4=%O^cuizWQS{-BnA37!+QOOhvQWz7jnFMGaq7j_DVdFM6PD6%|PgY8IxZE&RnC%|HyiEE- zX2XVyA&WH~G8`r!FyU}zo;5LICrGwev*RwCiA%2Z2L&A|gTpL0wMuwT^tmM;xG9pM eAmnH|p@l&#-sDfnqZCD;B@CXfelF{r5}E*1zb&i) delta 106 zcmbQlSTjK)g^`(ofkD+aR|!b51^9%x+E`mxw3NTe;1C0f7<#%mhH%Ixrz9k-S)aZp zk!iATk7#O-sZ)=o!;vF1Zk~$RKY!!4i5ov@BrnwSU}R=y5G&>W`g+FYDL~B(p00i_ I>zopr0G-1l#Q*>R diff --git a/textures/mcl_potions_effect_leaping.png b/textures/mcl_potions_effect_leaping.png index 8fbf25ae84585c966112f2dc0e9d693ca6bc461c..3b9d5500eb1242c1dd9c63c1dfedeb967379c643 100644 GIT binary patch delta 99 zcmb;_n;;R#!NkD8Fkxbb8IZE|ba4#Pn3%j_<2E%;Lx#df|1({bbfhkvIlP>4I#){J z8^1$YHZ9#38tzLTxz%u0Zjn=_%1_3~u5)z?oQw?5vl4dn-E~|)z4*}Q$iB} D5a1>` delta 103 zcmXS`njn$H$jrdNplX||1fObSu1`h*f2D^6N6Wkl~#erHGJYD@<);T3K F0RZ&|AmRW3 diff --git a/textures/mcl_potions_effect_levitation.png b/textures/mcl_potions_effect_levitation.png new file mode 100644 index 0000000000000000000000000000000000000000..ca8b6db1d039cf29608985d121e8edb0ab23c349 GIT binary patch literal 135 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|ex5FlAsXkCH*DOd#%aj#amodC z7o|5+584EmGM;5*F~_0%6;Zn(R+!lpNrxy=7DXS|M7fn2wuNDJMX7F_Nb6Mw<&;$T=r776} literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_effect_nausea.png b/textures/mcl_potions_effect_nausea.png new file mode 100644 index 0000000000000000000000000000000000000000..1b291ee4915e3eb0efcddf86bcd662e13b5a0462 GIT binary patch literal 138 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|fu1goAsQ2tH*DOd#%aj#ant`) z7bOwi6IK^}9K)Q~vBhXza4E<-kjmnx{;){VjyL1ghKvJ`dEOlCIxeYlgn8NA2q(_{ m?@wNJ@VlhI=4d*hg~60_@&@O&IlqC1GkCiCxvXF i(Bz8_IggY%85sh-zgj*Piwy@_!{F)a=d#Wzp$P!BW-7D* delta 94 zcmbQjSTI2%f{~elfkD+aR|!b51^9%x+E`m>)Q4V5yYvMl;pyTS!XcZSl8~@wefy$W u&OJvj_GI$(*qwLaIKfcV*i^vE!^2=N%ImwOswEGofx*+&&t;ucLK6TJ038GX diff --git a/textures/mcl_potions_effect_poison.png b/textures/mcl_potions_effect_poison.png index 9d8cd5815c83731773b64e3b01114276f5499f7a..014b4314c565b15891767c2867580e83b1634094 100644 GIT binary patch delta 129 zcmV-{0Dk{_lL3$zdk6vm005AYXf^-<09r{zK~yM_W3aKdCJ8YB@r(`SL?UzzxHQAX zDboOPBBnYt5?uqPh1fN~m14CJi<7X*VRa;m4Vb3l)PU&*G^b(@R;=MmtOiV9;nRTC jR|GWRib}E)A4v!R!+A`HhwP$d00000NkvXXu0mjf5$!Sj delta 105 zcmbQtSUo`^nUR@+fkD+aR|!b51^9%x+E`o1PD?s|TtXEnV&LiG7{Vc&oRE;P;{Wl0 z|9uO^I{FMlm@XQ%b(ys_74xW;@>nKJ2{<0W5b~LSg&4!UK!HPI+tt*8dKo-j{an^L HB{Ts5QY|2% diff --git a/textures/mcl_potions_effect_regeneration.png b/textures/mcl_potions_effect_regeneration.png index dfb82bba9553ca3881de5f388c2bc652d3d8ca86..1c5b7d502a96e30ab0a01fec8a80cd2648afd038 100644 GIT binary patch delta 121 zcmV-<0EYjH0g3^T7;*>#0001xk!Usm002=*L_t(2kz=s2wk8QN0Pz)_RYW4nG{7xI zQ-Lgq(17MpG}UlHoEoqqs@gz;2CN~2MFU&{mj>+dfXhkvA`Vjn;h4tsJ>jH*$3JAH bC6W*TV-+YsZ?aRX00000NkvXXu0mjfDh@2^ delta 121 zcmeBT>|&fCQN+Z|z`&3+SNs!@;tcQ!aka6wKCG(xwyn%{V*CZ5ppB=CV+e;V>%on@ z2NZZ147xQRab4kjdTP!giKnM-Ih@-vC$oJ2>or`5k zNLcu0%51oQg$?&L_hXbmlm9|@2LRRENhGr)2(iCcmn p(YTom)q#$FMaABQ52T%KB~tV%gQu&X%Q~loCIEF7 B9-aUI diff --git a/textures/mcl_potions_effect_strength.png b/textures/mcl_potions_effect_strength.png index 515b5777a111fbe1af949d047efc18c7df10bc17..54da79ed091452f00b64242487538e7d46ddb692 100644 GIT binary patch delta 124 zcmV-?0E7Q>jscJub_fCh005AYXf^-<098puK~yMHW3aKdCJ8YB@tIUvA`w0fSjDNQ z0q$Zno%l4Mk@z$qn~iK0J`K2Bg+&9Jc|>Wzv; xvwtB&&!mGId;1kTI~5swxNbObDReY4GIV|9pS$3IKn_p~gQu&X%Q~loCIB<99#jAT diff --git a/textures/mcl_potions_effect_swiftness.png b/textures/mcl_potions_effect_swiftness.png index cf9e4b95c9d8011d745461c0f9f962e154200d41..cf5d6b4d98edb8ab2ad8bfb0f5ac038804313d75 100644 GIT binary patch delta 111 zcmbbP0l+XkKBNit# delta 104 zcmZoz;r7!3fmK;OXk;vd$@? F2>`$p9~b}t diff --git a/textures/mcl_potions_effect_water_breathing.png b/textures/mcl_potions_effect_water_breathing.png index 3ced75eba39a07d8176c66e1fb9f92502290cc75..80a1054f7293ee645b1f05cd502cbd3d2eb3a677 100644 GIT binary patch delta 120 zcmV-;0EhpM0f_;S7;y*!0001xk!Usm002-)L_t(2kz=s2wk8QN0I_DrIU*4j4FtJl zX@HAD7oH3aH+FdIUe}5SgQX30000|>lDQO3l~z`&3+SNs!@;tcQ!akX%-vaz^J0C7A#K delta 112 zcmZo;Y-F4uk;%x+z`&qto2vw**aCb)Ty3naw{P8gbWN=*P{hpB#W93KHkqO6SG^C9 z{|pJC8TTvgTe~DWM4f^7 Date: Sat, 13 Jan 2024 05:49:02 +0100 Subject: [PATCH 24/91] Improved damage mods in effects, resistance effect --- mods/ITEMS/mcl_potions/functions.lua | 32 ++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 51236c17d..010b6268c 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -60,11 +60,16 @@ local function generate_rational_fac_to_lvl(l1, l2) end local function generate_modifier_func(name, dmg_flag, mod_func) - return function(object, damage, reason) + if dmg_flag ~= "" then return function(object, damage, reason) if EF[name][object] and not reason.flags.bypasses_magic and reason.flags[dmg_flag] then - return mod_func and mod_func(damage) or 0 + return mod_func and mod_func(damage, EF[name][object]) or 0 end end + else return function(object, damage, reason) + if EF[name][object] and not reason.flags.bypasses_magic then + return mod_func and mod_func(damage, EF[name][object]) or 0 + end + end end end -- API - registers an effect @@ -86,8 +91,8 @@ end -- lvl2_factor - integer - factor for lvl2 effect - defaults to 2 if uses_factor -- timer_uses_factor - bool - whether hit_timer uses factor (uses_factor must be true) or a constant value (hit_timer_step must be defined) -- hit_timer_step - float - interval between hit_timer hits --- damage_modifier - string - damage flag of which damage is changed as defined by modifier_func --- modifier_func - function(damage) - see damage_modifier, if not defined damage_modifier defaults to 100% resistance +-- damage_modifier - string - damage flag of which damage is changed as defined by modifier_func, pass empty string for all damage +-- modifier_func - function(damage, effect_vals) - see damage_modifier, if not defined damage_modifier defaults to 100% resistance -- modifier_priority - integer - priority passed when registering damage_modifier - defaults to -50 function mcl_potions.register_effect(def) local modname = minetest.get_current_modname() @@ -371,6 +376,25 @@ mcl_potions.register_effect({ damage_modifier = "is_fire", }) +mcl_potions.register_effect({ + name = "resistance", + description = S("Resistance"), + get_tt = function(factor) + return S("resist @1% of incoming damage", math.floor(factor*100)) + end, + res_condition = function(object) + return (not object:is_player()) + end, + particle_color = "#2552A5", + uses_factor = true, + lvl1_factor = 0.2, + lvl2_factor = 0.4, + damage_modifier = "", + modifier_func = function(damage, effect_vals) + return damage - (effect_vals.factor)*damage + end, +}) + mcl_potions.register_effect({ name = "bad_omen", description = S("Bad Omen"), From fce73ab2bff82e391d2323ddd7120c81807ee765 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 14 Jan 2024 08:46:36 +0100 Subject: [PATCH 25/91] Added some missing effects and improved API * added a way to have a damage modifier relying on type instead of flag * added Slow Falling * added Levitation * added Health Boost * added Absorption --- mods/HUD/hudbars/init.lua | 4 +- mods/ITEMS/mcl_potions/functions.lua | 117 +++++++++++++++++- mods/PLAYER/mcl_hunger/init.lua | 6 +- ....png => mcl_potions_effect_absorption.png} | Bin textures/mcl_potions_icon_absorb.png | Bin 0 -> 128 bytes 5 files changed, 117 insertions(+), 10 deletions(-) rename textures/{mcl_potions_effect_absorbtion.png => mcl_potions_effect_absorption.png} (100%) create mode 100644 textures/mcl_potions_icon_absorb.png diff --git a/mods/HUD/hudbars/init.lua b/mods/HUD/hudbars/init.lua index 505ff403b..7f86a959d 100644 --- a/mods/HUD/hudbars/init.lua +++ b/mods/HUD/hudbars/init.lua @@ -521,7 +521,9 @@ end local function update_health(player) local hp_max = player:get_properties().hp_max - hb.change_hudbar(player, "health", player:get_hp(), hp_max) + local hp = player:get_hp() + if hp > hp_max then hp = hp_max end + hb.change_hudbar(player, "health", hp, hp_max) end -- update built-in HUD bars diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 010b6268c..0486e782d 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -59,14 +59,19 @@ local function generate_rational_fac_to_lvl(l1, l2) end end -local function generate_modifier_func(name, dmg_flag, mod_func) - if dmg_flag ~= "" then return function(object, damage, reason) - if EF[name][object] and not reason.flags.bypasses_magic and reason.flags[dmg_flag] then +local function generate_modifier_func(name, dmg_flag, mod_func, is_type) + if dmg_flag == "" then return function(object, damage, reason) + if EF[name][object] and not reason.flags.bypasses_magic then + return mod_func and mod_func(damage, EF[name][object]) or 0 + end + end + elseif is_type then return function(object, damage, reason) + if EF[name][object] and not reason.flags.bypasses_magic and reason.type == dmg_flag then return mod_func and mod_func(damage, EF[name][object]) or 0 end end else return function(object, damage, reason) - if EF[name][object] and not reason.flags.bypasses_magic then + if EF[name][object] and not reason.flags.bypasses_magic and reason.flags[dmg_flag] then return mod_func and mod_func(damage, EF[name][object]) or 0 end end end @@ -92,6 +97,7 @@ end -- timer_uses_factor - bool - whether hit_timer uses factor (uses_factor must be true) or a constant value (hit_timer_step must be defined) -- hit_timer_step - float - interval between hit_timer hits -- damage_modifier - string - damage flag of which damage is changed as defined by modifier_func, pass empty string for all damage +-- dmg_mod_is_type - bool - damage_modifier string is used as type instead of flag of damage, defaults to false -- modifier_func - function(damage, effect_vals) - see damage_modifier, if not defined damage_modifier defaults to 100% resistance -- modifier_priority - integer - priority passed when registering damage_modifier - defaults to -50 function mcl_potions.register_effect(def) @@ -164,7 +170,7 @@ function mcl_potions.register_effect(def) end if def.damage_modifier then mcl_damage.register_modifier( - generate_modifier_func(name, def.damage_modifier, def.modifier_func), + generate_modifier_func(name, def.damage_modifier, def.modifier_func, def.dmg_mod_is_type), def.modifier_priority or -50 ) end @@ -295,6 +301,28 @@ mcl_potions.register_effect({ lvl2_factor = 1, }) +mcl_potions.register_effect({ + name = "slow_falling", + description = S("Slow Falling"), + get_tt = function(factor) + return S("decreases gravity effects") + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + playerphysics.add_physics_factor(object, "gravity", "mcl_potions:slow_falling", 0.5) + end, + on_step = function(dtime, object, factor, duration) + local vel = object:get_velocity().y + if vel < -3 then object:add_velocity(vector.new(0,-3-vel,0)) end + end, + on_end = function(object) + playerphysics.remove_physics_factor(object, "gravity", "mcl_potions:slow_falling") + end, + particle_color = "#ACCCFF", +}) + mcl_potions.register_effect({ name = "swiftness", description = S("Swiftness"), @@ -337,6 +365,22 @@ mcl_potions.register_effect({ lvl2_factor = 0.3, }) +mcl_potions.register_effect({ + name = "levitation", + description = S("Levitation"), + get_tt = function(factor) + return S("moves you upwards at @1 nodes/s", factor) + end, + on_step = function(dtime, object, factor, duration) + local vel = object:get_velocity().y + if vel damage then + effect_vals.absorb = absorb - damage + else + carryover = damage - absorb + effect_vals.absorb = 0 + end + return carryover + end, +}) + mcl_potions.register_effect({ name = "fire_resistance", description = S("Fire Resistance"), @@ -438,6 +540,8 @@ mcl_potions.register_effect({ -- ██║░░██║╚██████╔╝██████╦╝ -- ╚═╝░░╚═╝░╚═════╝░╚═════╝░ +hb.register_hudbar("absorption", 0xFFFFFF, S("Absorption"), {bar = "[fill:2x16:#B59500", icon = "mcl_potions_icon_absorb.png"}, 0, 0, 0, false) + local icon_ids = {} local function potions_set_hudbar(player) @@ -496,6 +600,7 @@ local function potions_init_icons(player) }) table.insert(icon_ids[name], id) end + hb.init_hudbar(player, "absorption") end local function potions_set_icons(player) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 45606cd61..03cd2a0a3 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -247,13 +247,13 @@ minetest.register_globalstep(function(dtime) food_tick_timer = 0 -- let hunger work always - if player_health > 0 and player_health <= 20 then + if player_health > 0 then --mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_HUNGER) -- later for hunger status effect mcl_hunger.update_exhaustion_hud(player) end if food_level >= 18 then -- slow regeneration - if player_health > 0 and player_health < 20 then + if player_health > 0 and player_health < player:get_properties().hp_max then player:set_hp(player_health+1) mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) mcl_hunger.update_exhaustion_hud(player) @@ -270,7 +270,7 @@ minetest.register_globalstep(function(dtime) end elseif food_tick_timer > max_tick_timer and food_level == 20 and food_saturation_level > 0 then -- fast regeneration - if player_health > 0 and player_health < 20 then + if player_health > 0 and player_health < player:get_properties().hp_max then food_tick_timer = 0 player:set_hp(player_health+1) mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) diff --git a/textures/mcl_potions_effect_absorbtion.png b/textures/mcl_potions_effect_absorption.png similarity index 100% rename from textures/mcl_potions_effect_absorbtion.png rename to textures/mcl_potions_effect_absorption.png diff --git a/textures/mcl_potions_icon_absorb.png b/textures/mcl_potions_icon_absorb.png new file mode 100644 index 0000000000000000000000000000000000000000..f1f671f6bee660af7b3a33ea5cc35014de449fc2 GIT binary patch literal 128 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>1|%O$WD@{V?w&4=Arj%q2?}C=_8gPG?@ Date: Sun, 14 Jan 2024 10:19:19 +0100 Subject: [PATCH 26/91] Added food poisoning and saturation effects --- mods/ITEMS/mcl_potions/functions.lua | 52 +++++++++++++++++++++++ mods/PLAYER/mcl_hunger/hunger.lua | 13 ++---- mods/PLAYER/mcl_hunger/register_foods.lua | 8 ++-- 3 files changed, 59 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 0486e782d..7ee2fd967 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -525,6 +525,50 @@ mcl_potions.register_effect({ timer_uses_factor = true, }) +mcl_potions.register_effect({ + name = "food_poisoning", + description = S("Food Poisoning"), + get_tt = function(factor) + return S("exhausts by @1 per second", factor) + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + hb.change_hudbar(object, "hunger", nil, nil, "mcl_hunger_icon_foodpoison.png", nil, "mcl_hunger_bar_foodpoison.png") + if mcl_hunger.debug then + hb.change_hudbar(object, "exhaustion", nil, nil, nil, nil, "mcl_hunger_bar_foodpoison.png") + end + end, + on_step = function(dtime, object, factor, duration) + mcl_hunger.exhaust(object:get_player_name(), dtime*factor) + end, + on_end = function(object) + mcl_hunger.reset_bars_poison_hunger(object) + end, + particle_color = "#83A061", + uses_factor = true, + lvl1_factor = 100, + lvl2_factor = 200, +}) + +mcl_potions.register_effect({ + name = "saturation", + description = S("Saturation"), + get_tt = function(factor) + return S("saturates by @1 per second", factor) + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_step = function(dtime, object, factor, duration) + mcl_hunger.set_hunger(object, math.min(mcl_hunger.get_hunger(object)+dtime*factor, 20)) + mcl_hunger.saturate(object:get_player_name(), dtime*factor) + end, + particle_color = "#CEAE29", + uses_factor = true, +}) + -- ██╗░░░██╗██████╗░██████╗░░█████╗░████████╗███████╗ -- ██║░░░██║██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝ @@ -841,6 +885,14 @@ function mcl_potions.player_get_effect(player, effect_name) return EF[effect_name][player] end +function mcl_potions.player_get_effect_level(player, effect_name) + if not EF[effect_name] then return end + local effect = EF[effect_name][player] + if not effect then return 0 end + if not registered_effects[effect_name].uses_factor then return 1 end + return registered_effects[effect_name].factor_to_level(effect.factor) +end + function mcl_potions.player_clear_effect(player,effect) EF[effect][player] = nil potions_set_hud(player) diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index de6369359..afca9553b 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -99,7 +99,7 @@ function mcl_hunger.reset_bars_poison_hunger(player) end end --- Poison player +-- Poison player TODO remove this function local function poisonp(tick, time, time_left, damage, exhaustion, name) if not mcl_hunger.active then return @@ -186,15 +186,8 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso do_poison = true end if do_poison then - -- Set food poison bars - if exhaust and exhaust > 0 then - hb.change_hudbar(user, "hunger", nil, nil, "mcl_hunger_icon_foodpoison.png", nil, "mcl_hunger_bar_foodpoison.png") - if mcl_hunger.debug then - hb.change_hudbar(user, "exhaustion", nil, nil, nil, nil, "mcl_hunger_bar_foodpoison.png") - end - mcl_hunger.poison_hunger[name] = mcl_hunger.poison_hunger[name] + 1 - end - poisonp(1, poisontime, 0, poison, exhaust, user:get_player_name()) + local level = mcl_potions.player_get_effect_level(user, "food_poisoning") + mcl_potions.give_effect_by_level("food_poisoning", user, level+exhaust, poisontime) end end diff --git a/mods/PLAYER/mcl_hunger/register_foods.lua b/mods/PLAYER/mcl_hunger/register_foods.lua index a68dde1c1..ee33e9332 100644 --- a/mods/PLAYER/mcl_hunger/register_foods.lua +++ b/mods/PLAYER/mcl_hunger/register_foods.lua @@ -1,7 +1,7 @@ -- Apply food poisoning effect as long there are no real status effect. --- TODO: Remove this when food poisoning a status effect in mcl_potions. +-- TODO: Sanitize this now that Food Poisoning is now an effect in mcl_potions -- Normal poison damage is set to 0 because it's handled elsewhere. -mcl_hunger.register_food("mcl_mobitems:rotten_flesh", 4, "", 30, 0, 100, 80) -mcl_hunger.register_food("mcl_mobitems:chicken", 2, "", 30, 0, 100, 30) -mcl_hunger.register_food("mcl_fishing:pufferfish_raw", 1, "", 15, 0, 300) +mcl_hunger.register_food("mcl_mobitems:rotten_flesh", 4, "", 30, 0, 1, 80) +mcl_hunger.register_food("mcl_mobitems:chicken", 2, "", 30, 0, 1, 30) +mcl_hunger.register_food("mcl_fishing:pufferfish_raw", 1, "", 15, 0, 3) From a8054e8112cc6f34aaf859f5f11f548117201289 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 14 Jan 2024 10:53:33 +0100 Subject: [PATCH 27/91] Add hero of the village effect --- mods/ITEMS/mcl_potions/functions.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 7ee2fd967..f435d55ea 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -500,7 +500,13 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "bad_omen", description = S("Bad Omen"), - particle_color = "#0b6138", + particle_color = "#472331", +}) + +mcl_potions.register_effect({ + name = "hero_of_village", + description = S("Hero of the Village"), + particle_color = "#006D2A", }) mcl_potions.register_effect({ From 3f5cea30464a06e4c3897342fb6b2208e04c7bdb Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 15 Jan 2024 23:48:58 +0100 Subject: [PATCH 28/91] Added HP hudbar look modifier API (for now in mcl_potions) --- mods/ITEMS/mcl_potions/functions.lua | 80 +++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index f435d55ea..2bc9cd8ff 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -592,25 +592,77 @@ mcl_potions.register_effect({ hb.register_hudbar("absorption", 0xFFFFFF, S("Absorption"), {bar = "[fill:2x16:#B59500", icon = "mcl_potions_icon_absorb.png"}, 0, 0, 0, false) -local icon_ids = {} +local hp_hudbar_modifiers = {} + +-- API - registers a HP hudbar modifier +-- required parameters in def: +-- predicate - function(player) - returns true if player fulfills the requirements (eg. has the effects) for the hudbar look +-- icon - string - name of the icon to which the modifier should change the HP hudbar heart +-- priority - signed int - lower gets checked first, and first fulfilled predicate applies its modifier +function mcl_potions.register_hp_hudbar_modifier(def) + if type(def.predicate) ~= "function" then error("Predicate must be a function") end + if not def.icon then error("No icon provided") end + if not def.priority then error("No priority provided") end + table.insert(hp_hudbar_modifiers, { + predicate = def.predicate, + icon = def.icon, + priority = def.priority, + }) + table.sort(hp_hudbar_modifiers, function(a, b) return a.priority <= b.priority end) +end + +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.withering[player] and EF.regeneration[player] then return true end + end, + icon = "mcl_potions_icon_regen_wither.png", + priority = -30, +}) + +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.withering[player] then return true end + end, + icon = "mcl_potions_icon_wither.png", + priority = -20, +}) + +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.poison[player] and EF.regeneration[player] then return true end + end, + icon = "hbhunger_icon_regen_poison.png", + priority = -10, +}) + +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.poison[player] then return true end + end, + icon = "hbhunger_icon_health_poison.png", + priority = 0, +}) + +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.regeneration[player] then return true end + end, + icon = "hudbars_icon_regenerate.png", + priority = 10, +}) local function potions_set_hudbar(player) - if EF.withering[player] and EF.regeneration[player] then - hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_regen_wither.png", nil, "hudbars_bar_health.png") - elseif EF.withering[player] then - hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_wither.png", nil, "hudbars_bar_health.png") - elseif EF.poison[player] and EF.regeneration[player] then - hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png") - elseif EF.poison[player] then - hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png") - elseif EF.regeneration[player] then - hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_regenerate.png", nil, "hudbars_bar_health.png") - else - hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png") + for _, mod in pairs(hp_hudbar_modifiers) do + if mod.predicate(player) then + hb.change_hudbar(player, "health", nil, nil, mod.icon, nil, "hudbars_bar_health.png") + return + end end - + hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png") end +local icon_ids = {} + local function potions_init_icons(player) local name = player:get_player_name() icon_ids[name] = {} From 5610fa1c4b4e03962e05f3512c42e0d358cd8266 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 16 Jan 2024 02:03:39 +0100 Subject: [PATCH 29/91] Added frost effect --- mods/ITEMS/mcl_potions/functions.lua | 61 +++++++++++++++++++++- textures/mcl_potions_effect_frost.png | Bin 0 -> 139 bytes textures/mcl_potions_frost_hud.png | Bin 0 -> 80572 bytes textures/mcl_potions_icon_frost.png | Bin 0 -> 138 bytes textures/mcl_potions_icon_regen_frost.png | Bin 0 -> 151 bytes 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 textures/mcl_potions_effect_frost.png create mode 100644 textures/mcl_potions_frost_hud.png create mode 100644 textures/mcl_potions_icon_frost.png create mode 100644 textures/mcl_potions_icon_regen_frost.png diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 2bc9cd8ff..000720a31 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -531,6 +531,49 @@ mcl_potions.register_effect({ timer_uses_factor = true, }) +mcl_potions.register_effect({ + name = "frost", + description = S("Frost"), + get_tt = function(factor) + return S("-1 HP / 1 s, can kill, -@1% running speed", math.floor(factor*100)) + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + mcl_burning.extinguish(object) + playerphysics.add_physics_factor(object, "speed", "mcl_potions:frost", 1-factor) + EF.frost[object].vignette = object:hud_add({ + hud_elem_type = "image", + position = {x = 0.5, y = 0.5}, + scale = {x = -101, y = -101}, + text = "mcl_potions_frost_hud.png", + z_index = -400 + }) + end, + on_hit_timer = function(object, factor, duration) + if object:is_player() or object:get_luaentity() then + mcl_util.deal_damage(object, 1, {type = "magic"}) + end + end, + on_end = function(object) + playerphysics.remove_physics_factor(object, "speed", "mcl_potions:frost") + if not EF.frost[object] then return end + object:hud_remove(EF.frost[object].vignette) + end, + particle_color = "#5B7DAA", + uses_factor = true, + lvl1_factor = 0.1, + lvl2_factor = 0.2, + timer_uses_factor = false, + hit_timer_step = 1, + damage_modifier = "is_fire", + modifier_func = function(damage, effect_vals) + effect_vals.timer = effect_vals.dur + return 0 + end, +}) + mcl_potions.register_effect({ name = "food_poisoning", description = S("Food Poisoning"), @@ -643,12 +686,28 @@ mcl_potions.register_hp_hudbar_modifier({ priority = 0, }) +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.frost[player] and EF.regeneration[player] then return true end + end, + icon = "mcl_potions_icon_regen_frost.png", + priority = 10, +}) + +mcl_potions.register_hp_hudbar_modifier({ + predicate = function(player) + if EF.frost[player] then return true end + end, + icon = "mcl_potions_icon_frost.png", + priority = 20, +}) + mcl_potions.register_hp_hudbar_modifier({ predicate = function(player) if EF.regeneration[player] then return true end end, icon = "hudbars_icon_regenerate.png", - priority = 10, + priority = 30, }) local function potions_set_hudbar(player) diff --git a/textures/mcl_potions_effect_frost.png b/textures/mcl_potions_effect_frost.png new file mode 100644 index 0000000000000000000000000000000000000000..6a008d25cf4ecc63114d2324974d04674468dbb0 GIT binary patch literal 139 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|L7py-AsQ2tH*DOd#%ai~@%y{; zE=nc55vGeZ9WojWE__+QnY58HnAuO-;BG@`7vs&Kl%)}KyYBMOxV7O&ql~o2XJ*TV nE@?Is1TH^WqMBqnp@kv&ciFL)nl&eZrZafD`njxgN@xNA0t_#+ literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_frost_hud.png b/textures/mcl_potions_frost_hud.png new file mode 100644 index 0000000000000000000000000000000000000000..282c713f13f3fc04de22d246b15e168bee66851b GIT binary patch literal 80572 zcmV)CK*GO?P)Ei>00BCKNklta+4FQXw=UfrJGzZp_e#Xk%~#wsADJad(>t+>JXh z0@Gn8GpgyP4ahWmeAl-pe=M`8R&UIeYgX-|uGKdQ{+k5x;o% zMZA0OH=KRW-fOS5w*T&*nf=!Q)BviXFvD2YdJ0g8xfdQf!Lbl401Chn5Cbw83I#R+ z*iZlD>7SzrzUzC3|9w*QZk*_!^bY7{_%T(uFTGg(fUXRm_+;;&2Ei&goO-v6+%dQbRI8 zfH=MEIaDtd+To!?= zEO71xb9O)D?EA$4r;1)w>sL!1-n!j>ViovMR=Uw@rD$hyG3vY9dprKi!=BtJ0uM>F zXED{SCpfPP0U<(ELO26f6u+ z>m@UY5~>iG;e*fR|7&oPGKVTSEIc_EVzvIc?YV&0b6>*%!oc-Kiva?I)9wb;fCNKu zfEnT0Z4&Lf8x;{C@F8QpJ(S~BL{XMJb%IDj%vh>fsfJ7qmdt!ocy$mjh+fzV5zk(i zDMD21HxXNHvO0!5wBi>=zKu~e;8Vl+B2 z40n8hV>E#1c2QZbbobstdT)v`d-7`bm0l0~(NI1O1>k)Z;#GZ0&^C%7Vi(lX-AB zC9qgOD}!}G3?PBj;fA~257Mk!do~GLh*WGX2~i8*-8{Z7_>)@h>tvh3VMaiOY>W_+ zXP38RcdEAMZh!#P3`q?UKo!-pbpRErRz|bXCV=c>*a_4NW9Co?;nEXb@Dnw@wy~T& zl(Q!!>yzHCZ&m=f?gk8IFa?|%ass(@4?+y62#|o0P*Wf&r0l!bW;$TV4IfENQ-iI*G2b`dxm4|v^Rr5O#~_18kS>z6J7BEiN8B()+b@~Ae9 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o^H3 lHE14L#lV(u&n=vRfk$rA=hGgxdw_;Bc)I$ztaD0e0stTKDOLag literal 0 HcmV?d00001 diff --git a/textures/mcl_potions_icon_regen_frost.png b/textures/mcl_potions_icon_regen_frost.png new file mode 100644 index 0000000000000000000000000000000000000000..0a604ec557ab40e59818473717c7164d1d986b7c GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>1|%O$WD@{Vah@)YArj%q2?}C=?En9>m-xQ- zKmW7i%r^sg!V`A>v6E>QIdtRKUF-k<(_j4J4}Y@vx3PqBw!w_5IUAH(JRKf8T1`+* zTy{XT@h)p9M{v(V2DS;JO`->C+V~9i@Ub$4WGtP>Jh!_9XcL2{tDnm{r-UW|Z`3tg literal 0 HcmV?d00001 From 31adc45da9f2b3eaab476fe715a0a6c3d15000b3 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 17 Jan 2024 01:38:24 +0100 Subject: [PATCH 30/91] Added blindness effect (also improved TT descriptions of some effects) --- mods/ITEMS/mcl_potions/functions.lua | 37 +++++++++++++++++++++++-- textures/mcl_potions_blindness_hud.png | Bin 0 -> 9583 bytes 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 textures/mcl_potions_blindness_hud.png diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 000720a31..802fdac6e 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -369,7 +369,7 @@ mcl_potions.register_effect({ name = "levitation", description = S("Levitation"), get_tt = function(factor) - return S("moves you upwards at @1 nodes/s", factor) + return S("moves body upwards at @1 nodes/s", factor) end, on_step = function(dtime, object, factor, duration) local vel = object:get_velocity().y @@ -410,7 +410,7 @@ mcl_potions.register_effect({ name = "health_boost", description = S("Health Boost"), get_tt = function(factor) - return S("increases HP by @1", factor) + return S("HP increased by @1", factor) end, res_condition = function(object) return (not object:is_player()) @@ -574,6 +574,39 @@ mcl_potions.register_effect({ end, }) +mcl_potions.register_effect({ + name = "blindness", + description = "Blindness", + get_tt = function(factor) + return S("impaired sight") + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + EF.blindness[object].vignette = object:hud_add({ + hud_elem_type = "image", + position = {x = 0.5, y = 0.5}, + scale = {x = -101, y = -101}, + text = "mcl_potions_blindness_hud.png", + z_index = -401 + }) + mcl_fovapi.apply_modifier(object, "mcl_potions:blindness") + end, + on_end = function(object) + mcl_fovapi.remove_modifier(object, "mcl_potions:blindness") + if not EF.blindness[object] then return end + object:hud_remove(EF.blindness[object].vignette) + end, + particle_color = "#686868", + uses_factor = false, +}) +mcl_fovapi.register_modifier({ + name = "mcl_potions:blindness", + fov_factor = 0.6, + time = 1, +}) + mcl_potions.register_effect({ name = "food_poisoning", description = S("Food Poisoning"), diff --git a/textures/mcl_potions_blindness_hud.png b/textures/mcl_potions_blindness_hud.png new file mode 100644 index 0000000000000000000000000000000000000000..ac5be885bd278d4735867db39694bbc3480d2975 GIT binary patch literal 9583 zcmWk!c|4Te-@a$eFpOnn9kN#x$&w|~j3rb^kNqiImMM8GNn@X}FUe9V*#`ZTEt6El zVC)`b@YA;2fa2LOP;HA}O<006{! z1&AN{T>s~W6wh#NY?mF>ozAtznfa?6xr~jGHAsh7qee82Hb@%9=1&;F2<0J`|)*ci&2ELIbiktz_6IhhnoOvf8CI^z8uNkTc+&1 zde=iB$l{Lnu{-Yqaj1#<);a<7@jey?crjlcF}!Z$poExDfjA;1leH_?geshfe^9?1 zrF^j3W<(%{bC-ydurZ&MJMsy~KXzUg1a?O+?jR2QZf1t60S(Qwl-XwsD#iRZC(n9E4)egpwMchGYe0tW(?w+PKl8~!kYGqAG|36l5y zqA9%`<)#^L?luwk;P%5zaYhY^#ShlLSM3ENUtk|kr1WeiG-CV}cGgyk#xakKk4L<2 z~y<<2tcbgt!s5;VP;9X7hMq==Bz5<|?R{5soyymsE?r zJ4tE9NC9W&F_};>9Egc1m=Q63oIpAcO0nU0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w;%o?bHOm&XLDM$()l(3Q+*QVNaWmWMJ zJpPHokxq>%p$_eZBp{L7;x5|nu4js%wu(>=SFlT&72>o4*vTuLJv zO%EZa#Q?>&z`+B(6CG79xV|Q*L9XE6a$HaQ9Oa>qH(3h3&g7f{eBJv+JR#;Xn5I8{ z{*OCAHugA`G-F9ZncbW1W^UZQ`B(s~^nMMLvKwbAS^tLKG!l6Wsil4AGZDKulgES5CW&L9Z5n$bbT~!Q#0l7w2v`94lzD`o@S> zO15^g{iZ|9a zwjE**+*7@3%EfXsPQIq`{;muh=xaouqF-v4HM6AJ0C}O1p9@?Ib}`OUnF8={5Z#VU#Ob(4%O9zR^+v~Cn1g-!V zm{6AU_&dk=Z)$j*9hIlWe1MG+Frlpf0Q&!<{`dsS8k4^5Y#m zZS83y%$B>H3hLqT7ZQZCq*7Ku4Ey2|E5}oQklQmEsV@^f{vdOKr8?*i1l`c33UZ}F zx^}<_z~I%UIw*9G+1oEfuj8umhp_%q{VD-OG3UdZHqSbn3{yKKO-?g=63|#Z01i5* zkiaKk?_A4|1Cjf|v3xwkW**q>o2O-*_ZWkCTL-r_!HwJpTtBzsGuS*vdAirXaxG^4 Q|9z@!S8dE{Og!TL4{6*2g8%>k literal 0 HcmV?d00001 From 92a77a7dbbc640422c9cfb9ac2f8ce8c86e4f403 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 20 Jan 2024 00:01:06 +0100 Subject: [PATCH 31/91] Fixed graphical features of some effects * loading fixed (by adding on_load) * absorption bar never reaching end fixed --- mods/ITEMS/mcl_potions/functions.lua | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 802fdac6e..a1a193fda 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -437,9 +437,12 @@ mcl_potions.register_effect({ return (not object:is_player()) end, on_start = function(object, factor) - hb.change_hudbar(object, "absorption", factor, math.floor(factor/20+1)*20) + hb.change_hudbar(object, "absorption", factor, (math.floor(factor/20-0.05)+1)*20) EF.absorption[object].absorb = factor end, + on_load = function(object, factor) + minetest.after(0, function() hb.change_hudbar(object, "absorption", nil, (math.floor(factor/20-0.05)+1)*20) end) + end, on_step = function(dtime, object, factor, duration) hb.change_hudbar(object, "absorption", EF.absorption[object].absorb) end, @@ -551,6 +554,15 @@ mcl_potions.register_effect({ z_index = -400 }) end, + on_load = function(object, factor) + EF.frost[object].vignette = object:hud_add({ + hud_elem_type = "image", + position = {x = 0.5, y = 0.5}, + scale = {x = -101, y = -101}, + text = "mcl_potions_frost_hud.png", + z_index = -400 + }) + end, on_hit_timer = function(object, factor, duration) if object:is_player() or object:get_luaentity() then mcl_util.deal_damage(object, 1, {type = "magic"}) @@ -593,6 +605,16 @@ mcl_potions.register_effect({ }) mcl_fovapi.apply_modifier(object, "mcl_potions:blindness") end, + on_load = function(object, factor) + EF.blindness[object].vignette = object:hud_add({ + hud_elem_type = "image", + position = {x = 0.5, y = 0.5}, + scale = {x = -101, y = -101}, + text = "mcl_potions_blindness_hud.png", + z_index = -401 + }) + mcl_fovapi.apply_modifier(object, "mcl_potions:blindness") + end, on_end = function(object) mcl_fovapi.remove_modifier(object, "mcl_potions:blindness") if not EF.blindness[object] then return end @@ -622,6 +644,12 @@ mcl_potions.register_effect({ hb.change_hudbar(object, "exhaustion", nil, nil, nil, nil, "mcl_hunger_bar_foodpoison.png") end end, + on_load = function(object, factor) -- TODO refactor and add hunger bar modifier API + hb.change_hudbar(object, "hunger", nil, nil, "mcl_hunger_icon_foodpoison.png", nil, "mcl_hunger_bar_foodpoison.png") + if mcl_hunger.debug then + hb.change_hudbar(object, "exhaustion", nil, nil, nil, nil, "mcl_hunger_bar_foodpoison.png") + end + end, on_step = function(dtime, object, factor, duration) mcl_hunger.exhaust(object:get_player_name(), dtime*factor) end, From aa4ff1827d01a2466998ceba9da3249135e6b88a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Jan 2024 02:13:08 +0100 Subject: [PATCH 32/91] 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"), From 65b923c43ce98efe6b3aa82f13943cad66b508c4 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Jan 2024 04:45:19 +0100 Subject: [PATCH 33/91] Added darkness --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 27 +++++++------ mods/ITEMS/mcl_potions/functions.lua | 46 +++++++++++++++++++++++ 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 6d9efd47a..edadbbeb8 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -120,20 +120,25 @@ mcl_weather.skycolor = { override_day_night_ratio = function(player, ratio) local meta = player:get_meta() local has_night_vision = meta:get_int("night_vision") == 1 + local has_darkness = meta:get_int("darkness") == 1 local is_visited_shepherd = meta:get_int("mcl_shepherd:special") == 1 local arg - -- Apply night vision only for dark sky - local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none" - local pos = player:get_pos() - local dim = mcl_worlds.pos_to_dimension(pos) - if (has_night_vision or is_visited_shepherd) and is_dark and dim ~= "nether" and dim ~= "end" then - if ratio == nil then - arg = NIGHT_VISION_RATIO - else - arg = math.max(ratio, NIGHT_VISION_RATIO) - end + if has_darkness and not is_visited_shepherd then + arg = 0 else - arg = ratio + -- Apply night vision only for dark sky + local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none" + local pos = player:get_pos() + local dim = mcl_worlds.pos_to_dimension(pos) + if (has_night_vision or is_visited_shepherd) and is_dark and dim ~= "nether" and dim ~= "end" then + if ratio == nil then + arg = NIGHT_VISION_RATIO + else + arg = math.max(ratio, NIGHT_VISION_RATIO) + end + else + arg = ratio + end end player:override_day_night_ratio(arg) end, diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index afbbc2128..6a1d14a5f 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -406,6 +406,52 @@ mcl_potions.register_effect({ uses_factor = false, }) +mcl_potions.register_effect({ + name = "darkness", + description = S("Darkness"), + get_tt = function(factor) + return S("surrounded by darkness") + end, + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) + object:get_meta():set_int("darkness", 1) + mcl_weather.skycolor.update_sky_color({object}) + object:set_sky({fog = { + fog_distance = 10, + }}) + EF.darkness[object].flash = 0.6 + end, + on_step = function(dtime, object, factor, duration) + if object:get_meta():get_int("night_vision") ~= 1 then + local flash = EF.darkness[object].flash + if flash < 0.1 then EF.darkness[object].flashdir = true + elseif flash > 0.6 then EF.darkness[object].flashdir = false end + flash = EF.darkness[object].flashdir and (flash + dtime) or (flash - dtime) + object:set_sky({fog = { + fog_start = flash, + }}) + EF.darkness[object].flash = flash + else + object:set_sky({fog = { + fog_start = 0.99, + }}) + end + mcl_weather.skycolor.update_sky_color({object}) + end, + on_end = function(object) + object:get_meta():set_int("darkness", 0) + mcl_weather.skycolor.update_sky_color({object}) + object:set_sky({fog = { + fog_distance = -1, + fog_start = -1, + }}) + end, + particle_color = "#000000", + uses_factor = false, +}) + mcl_potions.register_effect({ name = "health_boost", description = S("Health Boost"), From 394b090c8398df017b58e837c30a86a4f485db76 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Jan 2024 21:49:26 +0100 Subject: [PATCH 34/91] Improved the darkness effect --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 3 ++- mods/ITEMS/mcl_potions/functions.lua | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index edadbbeb8..87952845b 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -124,7 +124,8 @@ mcl_weather.skycolor = { local is_visited_shepherd = meta:get_int("mcl_shepherd:special") == 1 local arg if has_darkness and not is_visited_shepherd then - arg = 0 + if has_night_vision then arg = 0.1 + else arg = 0 end else -- Apply night vision only for dark sky local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none" diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 6a1d14a5f..55fa79c45 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -259,7 +259,7 @@ mcl_potions.register_effect({ res_condition = function(object) return (not object:is_player()) end, - particle_color = "#484D48", + particle_color = "#485D48", }) mcl_potions.register_effect({ @@ -419,14 +419,14 @@ mcl_potions.register_effect({ object:get_meta():set_int("darkness", 1) mcl_weather.skycolor.update_sky_color({object}) object:set_sky({fog = { - fog_distance = 10, + fog_distance = factor, }}) EF.darkness[object].flash = 0.6 end, on_step = function(dtime, object, factor, duration) if object:get_meta():get_int("night_vision") ~= 1 then local flash = EF.darkness[object].flash - if flash < 0.1 then EF.darkness[object].flashdir = true + if flash < 0.2 then EF.darkness[object].flashdir = true elseif flash > 0.6 then EF.darkness[object].flashdir = false end flash = EF.darkness[object].flashdir and (flash + dtime) or (flash - dtime) object:set_sky({fog = { @@ -435,7 +435,7 @@ mcl_potions.register_effect({ EF.darkness[object].flash = flash else object:set_sky({fog = { - fog_start = 0.99, + fog_start = 0.9, }}) end mcl_weather.skycolor.update_sky_color({object}) @@ -449,7 +449,9 @@ mcl_potions.register_effect({ }}) end, particle_color = "#000000", - uses_factor = false, + uses_factor = true, + lvl1_factor = 30, + lvl2_factor = 20, }) mcl_potions.register_effect({ @@ -573,7 +575,7 @@ mcl_potions.register_effect({ mcl_util.deal_damage(object, 1, {type = "magic"}) end end, - particle_color = "#000000", + particle_color = "#292929", uses_factor = true, lvl1_factor = 2, lvl2_factor = 1, From b6484a6d153d6865e31f1054451efa3329f60b73 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Jan 2024 22:02:05 +0100 Subject: [PATCH 35/91] Added time_override to FOV API time_override can be used when applying or removing modifiers --- mods/PLAYER/mcl_fovapi/init.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mods/PLAYER/mcl_fovapi/init.lua b/mods/PLAYER/mcl_fovapi/init.lua index 92815d833..43dcfe403 100644 --- a/mods/PLAYER/mcl_fovapi/init.lua +++ b/mods/PLAYER/mcl_fovapi/init.lua @@ -75,7 +75,7 @@ minetest.register_on_respawnplayer(function(player) mcl_fovapi.remove_all_modifiers(player) end) -function mcl_fovapi.apply_modifier(player, modifier_name) +function mcl_fovapi.apply_modifier(player, modifier_name, time_override) if not player or not modifier_name then return end @@ -106,13 +106,14 @@ function mcl_fovapi.apply_modifier(player, modifier_name) minetest.log("FOV::Modifier applied to player:" .. player_name .. " modifier: " .. modifier_name) end + local time = time_override or modifier.time -- modifier apply code. if modifier.exclusive == true then -- if exclusive, reset the player's fov, and apply the new fov. if modifier.is_multiplier then player:set_fov(0, false, 0) end - player:set_fov(modifier.fov_factor, modifier.is_multiplier, modifier.time) + player:set_fov(modifier.fov_factor, modifier.is_multiplier, time) else -- not exclusive? let's apply it in the mix. local fov_factor, is_mult = player:get_fov() @@ -126,15 +127,15 @@ function mcl_fovapi.apply_modifier(player, modifier_name) fov_factor = (fov_factor + modifier.fov_factor) / 2 end if modifier.is_multiplier and is_mult then - player:set_fov(fov_factor, true, modifier.time) + player:set_fov(fov_factor, true, time) else - player:set_fov(fov_factor, false, modifier.time) + player:set_fov(fov_factor, false, time) end end end -function mcl_fovapi.remove_modifier(player, modifier_name) +function mcl_fovapi.remove_modifier(player, modifier_name, time_override) if not player or not modifier_name then return end @@ -159,9 +160,10 @@ function mcl_fovapi.remove_modifier(player, modifier_name) applied[k] = mcl_fovapi.registered_modifiers[k] end + local time = time_override or modifier.reset_time local elem = next if elem(applied) == nil then - player:set_fov(0, false, modifier.reset_time) + player:set_fov(0, false, time) return end local exc = false @@ -191,7 +193,7 @@ function mcl_fovapi.remove_modifier(player, modifier_name) fov_factor = fov_factor * x.fov_factor end end - player:set_fov(fov_factor, not non_multiplier_added, modifier.reset_time) + player:set_fov(fov_factor, not non_multiplier_added, time) end if mcl_fovapi.registered_modifiers[modifier_name].on_end then From e0396424467c2e393bc3060b7fa6ca289e1941d0 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Jan 2024 22:06:39 +0100 Subject: [PATCH 36/91] Improved nausea --- mods/ITEMS/mcl_potions/functions.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 55fa79c45..27d07cff5 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -693,12 +693,12 @@ mcl_potions.register_effect({ 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") + 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") - mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low") + 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, @@ -710,9 +710,10 @@ mcl_potions.register_effect({ mcl_fovapi.remove_modifier(object, "mcl_potions:nausea_low") end, particle_color = "#60AA30", - uses_factor = false, - timer_uses_factor = false, - hit_timer_step = 1, + uses_factor = true, + lvl1_factor = 2, + lvl2_factor = 1, + timer_uses_factor = true, }) mcl_fovapi.register_modifier({ name = "mcl_potions:nausea_high", From 03c73b7820c12a6e55325b33568766e191a5acd5 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Jan 2024 22:12:13 +0100 Subject: [PATCH 37/91] Improved descriptions --- mods/ITEMS/mcl_potions/functions.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 27d07cff5..b2d44432b 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -410,7 +410,7 @@ mcl_potions.register_effect({ name = "darkness", description = S("Darkness"), get_tt = function(factor) - return S("surrounded by darkness") + return S("surrounded by darkness\nnot seeing anything beyond @1 nodes", factor) end, res_condition = function(object) return (not object:is_player()) @@ -681,7 +681,7 @@ mcl_potions.register_effect({ name = "nausea", description = S("Nausea"), get_tt = function(factor) - return S("not feeling very well...") + return S("not feeling very well...\nfrequency: @1 / 1 s", factor) end, res_condition = function(object) return (not object:is_player()) From 0e339472585064bacd7851ad7be1a031af6640b7 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 23 Jan 2024 01:18:07 +0100 Subject: [PATCH 38/91] Renamed some functions and variables * changed names referring to player where it does support mobs * also added an is_player() check in one function --- mods/ENVIRONMENT/mcl_raids/init.lua | 8 ++++---- mods/ITEMS/mcl_campfires/api.lua | 2 +- mods/ITEMS/mcl_nether/init.lua | 2 +- mods/ITEMS/mcl_potions/functions.lua | 23 ++++++++++++----------- mods/PLAYER/mcl_hunger/hunger.lua | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_raids/init.lua b/mods/ENVIRONMENT/mcl_raids/init.lua index 8e7c644ae..208ee93e0 100644 --- a/mods/ENVIRONMENT/mcl_raids/init.lua +++ b/mods/ENVIRONMENT/mcl_raids/init.lua @@ -104,7 +104,7 @@ function mcl_raids.promote_to_raidcaptain(c) -- object mcl_raids.drop_obanner(pos) if cmi_cause and cmi_cause.type == "punch" and cmi_cause.puncher:is_player() then awards.unlock(cmi_cause.puncher:get_player_name(), "mcl:voluntary_exile") - local lv = mcl_potions.player_get_effect(cmi_cause.puncher, "bad_omen") + local lv = mcl_potions.get_effect(cmi_cause.puncher, "bad_omen") if not lv then lv = 0 else lv = lv.factor end lv = math.max(5,lv + 1) @@ -296,7 +296,7 @@ mcl_events.register_event("raid",{ --minetest.log("Cond start raid") local r = {} for _,p in pairs(minetest.get_connected_players()) do - if mcl_potions.player_has_effect(p,"bad_omen") then + if mcl_potions.has_effect(p,"bad_omen") then local raid_pos = mcl_raids.find_village(p:get_pos()) if raid_pos then --minetest.log("We have a raid position. Start raid") @@ -310,7 +310,7 @@ mcl_events.register_event("raid",{ self.mobs = {} self.health_max = 1 self.health = 0 - local lv = mcl_potions.player_get_effect(minetest.get_player_by_name(self.player), "bad_omen") + local lv = mcl_potions.get_effect(minetest.get_player_by_name(self.player), "bad_omen") if lv and lv.factor and lv.factor > 1 then self.max_stage = 6 end end, cond_progress = function(self) @@ -331,7 +331,7 @@ mcl_events.register_event("raid",{ end, on_complete = function(self) awards.unlock(self.player,"mcl:hero_of_the_village") - mcl_potions.player_clear_effect(minetest.get_player_by_name(self.player),"bad_omen") + mcl_potions.clear_effect(minetest.get_player_by_name(self.player),"bad_omen") make_firework(self.pos,os.time()) end, }) diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index 7fa495edb..ba6a55960 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -380,7 +380,7 @@ minetest.register_globalstep(function(dtime) etime = 0 for _,pl in pairs(minetest.get_connected_players()) do local armor_feet = pl:get_inventory():get_stack("armor", 5) - if pl and pl:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.player_has_effect(pl, "fire_proof")) then + if pl and pl:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.has_effect(pl, "fire_proof")) then return end burn_in_campfire(pl) diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index 252768df5..3a57ae427 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -135,7 +135,7 @@ minetest.register_node("mcl_nether:magma", { -- From walkover mod on_walk_over = function(loc, nodeiamon, player) local armor_feet = player:get_inventory():get_stack("armor", 5) - if player and player:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.player_has_effect(player, "fire_proof")) then + if player and player:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.has_effect(player, "fire_proof")) then return end -- Hurt players standing on top of this block diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index b2d44432b..796e82ebe 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1145,32 +1145,33 @@ function mcl_potions._load_player_effects(player) end end --- Returns true if player has given effect -function mcl_potions.player_has_effect(player, effect_name) +-- Returns true if object has given effect +function mcl_potions.has_effect(object, effect_name) if not EF[effect_name] then return false end - return EF[effect_name][player] ~= nil + return EF[effect_name][object] ~= nil end -function mcl_potions.player_get_effect(player, effect_name) - if not EF[effect_name] or not EF[effect_name][player] then +function mcl_potions.get_effect(object, effect_name) + if not EF[effect_name] or not EF[effect_name][object] then return false end - return EF[effect_name][player] + return EF[effect_name][object] end -function mcl_potions.player_get_effect_level(player, effect_name) +function mcl_potions.get_effect_level(object, effect_name) if not EF[effect_name] then return end - local effect = EF[effect_name][player] + local effect = EF[effect_name][object] if not effect then return 0 end if not registered_effects[effect_name].uses_factor then return 1 end return registered_effects[effect_name].factor_to_level(effect.factor) end -function mcl_potions.player_clear_effect(player,effect) - EF[effect][player] = nil - potions_set_hud(player) +function mcl_potions.clear_effect(object, effect) + EF[effect][object] = nil + if not object:is_player() then return end + potions_set_hud(object) end minetest.register_on_leaveplayer( function(player) diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index afca9553b..c0ba9fb91 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -186,7 +186,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso do_poison = true end if do_poison then - local level = mcl_potions.player_get_effect_level(user, "food_poisoning") + local level = mcl_potions.get_effect_level(user, "food_poisoning") mcl_potions.give_effect_by_level("food_poisoning", user, level+exhaust, poisontime) end end From 456d205161eb99bba331d0b57da997571386ffb5 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 24 Jan 2024 00:28:24 +0100 Subject: [PATCH 39/91] Added strength and weakness effects * also highest effect level displayed in HUD set to 3000 * also improved indicating effects with strange factors in HUD --- mods/ENTITIES/mcl_mobs/combat.lua | 7 ++++++ mods/ITEMS/mcl_potions/functions.lua | 34 +++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 4bbfcd119..f6ee2f429 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -605,6 +605,13 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) * tmp * ((armor[group] or 0) / 100.0) end + -- strength and weakness effects + local strength = mcl_potions.get_effect(hitter, "strength") + local weakness = mcl_potions.get_effect(hitter, "weakness") + local str_fac = strength and strength.factor or 1 + local weak_fac = weakness and weakness.factor or 1 + damage = damage * str_fac * weak_fac + if weapon then local fire_aspect_level = mcl_enchanting.get_enchantment(weapon, "fire_aspect") if fire_aspect_level > 0 then diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 796e82ebe..72252c910 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -54,7 +54,7 @@ local function generate_rational_fac_to_lvl(l1, l2) local a = (l1 - l2) * 2 local b = 2*l2 - l1 return function(factor) - if factor == 0 then return math.huge end + if (factor - b) == 0 then return math.huge end return math.round(a/(factor - b)) end end @@ -247,21 +247,41 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "strength", description = S("Strength"), - res_condition = function(object) - return (not object:is_player()) + get_tt = function(factor) + return S("+@1% melee damage", factor-1) end, particle_color = "#932423", + uses_factor = true, + lvl1_factor = 1.3, + lvl2_factor = 1.6, }) mcl_potions.register_effect({ name = "weakness", description = S("Weakness"), - res_condition = function(object) - return (not object:is_player()) + get_tt = function(factor) + return S("-@1% melee damage", 1-factor) end, particle_color = "#485D48", + uses_factor = true, + lvl1_factor = 0.8, + lvl2_factor = 0.6, }) +-- implementation of strength and weakness effects +-- mobs have this implemented in mcl_mobs/combat.lua in mob_class:on_punch() +mcl_damage.register_modifier(function(object, damage, reason) + if reason.direct and reason.direct == reason.source then + local hitter = reason.direct + local strength = EF.strength[hitter] + local weakness = EF.weakness[hitter] + if not strength and not weakness then return end + local str_fac = strength and strength.factor or 1 + local weak_fac = weakness and weakness.factor or 1 + return damage * str_fac * weak_fac + end +end, 0) + mcl_potions.register_effect({ name = "water_breathing", description = S("Water Breathing"), @@ -944,7 +964,9 @@ local function potions_set_icons(player) player:hud_change(icon, "text", def.icon .. "^[resize:128x128") if def.uses_factor then local level = def.factor_to_level(vals.factor) - if level == math.huge then level = "∞" + if level > 3000 or level == math.huge then level = "∞" + elseif level < 0 then level = "???" + elseif level == 0 then level = "0" else level = mcl_util.to_roman(level) end player:hud_change(label, "text", level) else From bf82241e82fe912fac215aec6bacbf5541944b1d Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 24 Jan 2024 02:37:24 +0100 Subject: [PATCH 40/91] Added dolphin's grace --- mods/ITEMS/mcl_potions/functions.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 72252c910..cdcb04f1b 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -299,6 +299,27 @@ mcl_potions.register_effect({ uses_factor = false, }) +mcl_potions.register_effect({ + name = "dolphin_grace", + description = S("Dolphin's Grace"), + get_tt = function(factor) + return S("swimming gracefully") + end, + on_hit_timer = function(object, factor, duration) + local node = minetest.get_node_or_nil(object:get_pos()) + if node and minetest.registered_nodes[node.name] + and minetest.get_item_group(node.name, "liquid") ~= 0 then + playerphysics.add_physics_factor(object, "speed", "mcl_potions:dolphin", 2) + else + playerphysics.remove_physics_factor(object, "speed", "mcl_potions:dolphin", 2) + end + end, + particle_color = "#6AABFD", + uses_factor = false, + timer_uses_factor = false, + hit_timer_step = 1, +}) + mcl_potions.register_effect({ name = "leaping", description = S("Leaping"), From 1ac81e440c8fa4ef18c5a5f3493d046262fff595 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 24 Jan 2024 05:16:13 +0100 Subject: [PATCH 41/91] Added haste and fatigue --- mods/ITEMS/mcl_potions/functions.lua | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index cdcb04f1b..c17478e7c 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -817,6 +817,63 @@ mcl_potions.register_effect({ uses_factor = true, }) +mcl_potions.register_effect({ + name = "haste", + description = S("Haste"), + res_condition = function(object) + return (not object:is_player()) + end, + particle_color = "#FFFF00", + uses_factor = true, + lvl1_factor = 0.2, + lvl2_factor = 0.4, +}) + +mcl_potions.register_effect({ + name = "fatigue", + description = S("Fatigue"), + res_condition = function(object) + return (not object:is_player()) + end, + particle_color = "#64643D", + uses_factor = true, + lvl1_factor = 0.3, + lvl2_factor = 0.09, +}) + +-- implementation of haste and fatigue effects for digging +minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) + local item = puncher:get_wielded_item() + local meta = item:get_meta() + local haste = EF.haste[puncher] + local fatigue = EF.fatigue[puncher] + local item_haste = meta:get_float("mcl_potions:haste") + local item_fatig = 1 - meta:get_float("mcl_potions:fatigue") + local h_fac + if haste then h_fac = haste.factor + else h_fac = 0 end + local f_fac + if fatigue then f_fac = fatigue.factor + else f_fac = 1 end + if f_fac < 0 then f_fac = 0 end + if item_haste ~= h_fac or item_fatig ~= f_fac then + meta:set_float("mcl_potions:haste", h_fac) + meta:set_float("mcl_potions:fatigue", 1 - f_fac) + meta:set_tool_capabilities() + local toolcaps = item:get_tool_capabilities() +-- if not toolcaps or not toolcaps.groupcaps then return end + for name, group in pairs(toolcaps.groupcaps) do + local t = group.times + for i=1, #t do + t[i] = t[i] / (1+h_fac) / f_fac + end + end + -- TODO attack speed change? + meta:set_tool_capabilities(toolcaps) + puncher:set_wielded_item(item) + end +end) + -- ██╗░░░██╗██████╗░██████╗░░█████╗░████████╗███████╗ -- ██║░░░██║██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝ From 0c4094596e39a72a93c66814df72474aa93a7673 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 3 Feb 2024 05:37:55 +0100 Subject: [PATCH 42/91] Improved haste and fatigue effects * fixed a few crashes related to unusual effect levels * added haste and fatigue combat functionality * added some cleanup to avoid hangover unstackable items * capped the slowdown from fatigue at 5 minutes digging time * (despite the above, if a tool has a longer time set in definition, that still works) * removed an unused "global" variable --- mods/ENTITIES/mcl_mobs/combat.lua | 2 + mods/ITEMS/mcl_potions/functions.lua | 62 +++++++++++++++++++++++----- mods/ITEMS/mcl_potions/potions.lua | 1 - 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index f6ee2f429..99878be2e 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -534,6 +534,8 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) if self.protected and minetest.is_protected(mob_pos, hitter:get_player_name()) then return end + + mcl_potions.update_haste_and_fatigue(hitter) end local time_now = minetest.get_us_time() diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index c17478e7c..df0608d87 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -841,38 +841,61 @@ mcl_potions.register_effect({ lvl2_factor = 0.09, }) --- implementation of haste and fatigue effects for digging -minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) - local item = puncher:get_wielded_item() +-- implementation of haste and fatigue effects +local LONGEST_MINING_TIME = 300 +function mcl_potions.update_haste_and_fatigue(player) + local item = player:get_wielded_item() local meta = item:get_meta() - local haste = EF.haste[puncher] - local fatigue = EF.fatigue[puncher] + local haste = EF.haste[player] + local fatigue = EF.fatigue[player] local item_haste = meta:get_float("mcl_potions:haste") local item_fatig = 1 - meta:get_float("mcl_potions:fatigue") local h_fac if haste then h_fac = haste.factor else h_fac = 0 end + if h_fac < 0 then h_fac = 0 end local f_fac if fatigue then f_fac = fatigue.factor else f_fac = 1 end if f_fac < 0 then f_fac = 0 end if item_haste ~= h_fac or item_fatig ~= f_fac then - meta:set_float("mcl_potions:haste", h_fac) - meta:set_float("mcl_potions:fatigue", 1 - f_fac) + if h_fac ~= 0 then meta:set_float("mcl_potions:haste", h_fac) + else meta:set_string("mcl_potions:haste", "") end + if f_fac ~= 1 then meta:set_float("mcl_potions:fatigue", 1 - f_fac) + else meta:set_string("mcl_potions:fatigue", "") end meta:set_tool_capabilities() + mcl_enchanting.update_groupcaps(item) + if h_fac == 0 and f_fac == 1 then + player:set_wielded_item(item) + return + end local toolcaps = item:get_tool_capabilities() --- if not toolcaps or not toolcaps.groupcaps then return end + toolcaps.full_punch_interval = toolcaps.full_punch_interval / (1+h_fac) / f_fac for name, group in pairs(toolcaps.groupcaps) do local t = group.times for i=1, #t do - t[i] = t[i] / (1+h_fac) / f_fac + if f_fac == 0 then + t[i] = t[i] > LONGEST_MINING_TIME and t[i] or LONGEST_MINING_TIME + else + local old_time = t[i] + t[i] = t[i] / (1+h_fac) / f_fac + if old_time < LONGEST_MINING_TIME and t[i] > LONGEST_MINING_TIME then + t[i] = LONGEST_MINING_TIME + end + end end end - -- TODO attack speed change? meta:set_tool_capabilities(toolcaps) - puncher:set_wielded_item(item) + player:set_wielded_item(item) end +end +minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) + mcl_potions.update_haste_and_fatigue(puncher) end) +minetest.register_on_punchplayer(function(player, hitter) + mcl_potions.update_haste_and_fatigue(hitter) +end) +-- update when hitting mob implemented in mcl_mobs/combat.lua -- ██╗░░░██╗██████╗░██████╗░░█████╗░████████╗███████╗ @@ -1131,6 +1154,22 @@ end) -- ███████╗╚█████╔╝██║░░██║██████╔╝██╔╝░░░██████╔╝██║░░██║░░╚██╔╝░░███████╗ -- ╚══════╝░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝ +function mcl_potions._reset_haste_fatigue_item_meta(player) + local inv = player:get_inventory() + if not inv then return end + local lists = inv:get_lists() + for _, list in pairs(lists) do + for _, item in pairs(list) do + local meta = item:get_meta() + meta:set_string("mcl_potions:haste", "") + meta:set_string("mcl_potions:fatigue", "") + meta:set_tool_capabilities() + mcl_enchanting.update_groupcaps(item) + end + end + inv:set_lists(lists) +end + function mcl_potions._clear_cached_player_data(player) for name, effect in pairs(EF) do effect[player] = nil @@ -1288,6 +1327,7 @@ end) minetest.register_on_joinplayer( function(player) mcl_potions._reset_player_effects(player, false) -- make sure there are no weird holdover effects mcl_potions._load_player_effects(player) + mcl_potions._reset_haste_fatigue_item_meta(player) potions_init_icons(player) potions_set_hud(player) end) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 5f941b2fb..0422bfb90 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -213,7 +213,6 @@ function mcl_potions.register_potion(def) local has_plus = false if def._effect_list then for name, details in pairs(def._effect_list) do - no_effects = false effect = mcl_potions.registered_effects[name] if effect then local ulvl From 6d7fe9104711e99fba914d6cb97dcb21bd303c57 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 19 Mar 2024 01:25:38 +0100 Subject: [PATCH 43/91] Capped fatigue effect on punching This fixes a crash, too Also updates toolcaps on gamemode change --- mods/ITEMS/mcl_potions/functions.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index df0608d87..7fbf3a6d5 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -843,7 +843,9 @@ mcl_potions.register_effect({ -- implementation of haste and fatigue effects local LONGEST_MINING_TIME = 300 +local LONGEST_PUNCH_INTERVAL = 10 function mcl_potions.update_haste_and_fatigue(player) + if mcl_gamemode.get_gamemode(player) == "creative" then return end local item = player:get_wielded_item() local meta = item:get_meta() local haste = EF.haste[player] @@ -870,7 +872,12 @@ function mcl_potions.update_haste_and_fatigue(player) return end local toolcaps = item:get_tool_capabilities() - toolcaps.full_punch_interval = toolcaps.full_punch_interval / (1+h_fac) / f_fac + if f_fac == 0 then + local fpi = toolcaps.full_punch_interval + toolcaps.full_punch_interval = fpi > LONGEST_PUNCH_INTERVAL and fpi or LONGEST_PUNCH_INTERVAL + else + toolcaps.full_punch_interval = toolcaps.full_punch_interval / (1+h_fac) / f_fac + end for name, group in pairs(toolcaps.groupcaps) do local t = group.times for i=1, #t do @@ -1169,6 +1176,7 @@ function mcl_potions._reset_haste_fatigue_item_meta(player) end inv:set_lists(lists) end +mcl_gamemode.register_on_gamemode_change(mcl_potions._reset_haste_fatigue_item_meta) function mcl_potions._clear_cached_player_data(player) for name, effect in pairs(EF) do From ddbc7cd8266292939809460247628c17e4b77d58 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 20 Mar 2024 01:47:00 +0100 Subject: [PATCH 44/91] Haste and fatigue expanded and improved * abstracted and refactored some parts of haste and fatigue * added and exposed new mcl_potions API functions * fixed haste and fatigue not altering the hand * mcl_meshhand now calls into mcl_potions when resetting the hand --- mods/ITEMS/mcl_potions/functions.lua | 136 ++++++++++++++++++++------- mods/PLAYER/mcl_meshhand/init.lua | 7 +- 2 files changed, 108 insertions(+), 35 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 7fbf3a6d5..3fbf6663c 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -4,6 +4,9 @@ local EF = {} mcl_potions.registered_effects = {} local registered_effects = mcl_potions.registered_effects -- shorthand ref +-- effects affecting item speed utilize numerous hacks, so they have to be counted separately +local item_speed_effects = {} + local EFFECT_TYPES = 0 minetest.register_on_mods_loaded(function() for _,_ in pairs(EF) do @@ -90,6 +93,7 @@ end -- on_step - function(dtime, object, factor, duration) - running every step for all objects with this effect -- on_hit_timer - function(object, factor, duration) - if defined runs a hit_timer depending on timer_uses_factor value -- on_end - function(object) - called when the effect wears off +-- after_end - function(object) - called when the effect wears off, after purging the data of the effect -- particle_color - string - colorstring for particles - defaults to #3000EE -- uses_factor - bool - whether factor affects the effect -- lvl1_factor - integer - factor for lvl1 effect - defaults to 1 if uses_factor @@ -100,6 +104,14 @@ end -- dmg_mod_is_type - bool - damage_modifier string is used as type instead of flag of damage, defaults to false -- modifier_func - function(damage, effect_vals) - see damage_modifier, if not defined damage_modifier defaults to 100% resistance -- modifier_priority - integer - priority passed when registering damage_modifier - defaults to -50 +-- affects_item_speed - table +-- -- if provided, effect gets added to the item_speed_effects table, this should be true if the effect affects item speeds, +-- -- otherwise it won't work properly with other such effects (like haste and fatigue) +-- -- -- factor_is_positive - bool - whether values of factor between 0 and 1 should be considered +factor% or speed multiplier +-- -- -- - obviously +factor% is positive and speed multiplier is negative interpretation +-- -- -- - values of factor higher than 1 will have a positive effect regardless +-- -- -- - values of factor lower than 0 will have a negative effect regardless +-- -- -- - open an issue on our tracker if you have a usage that isn't supported by this API function mcl_potions.register_effect(def) local modname = minetest.get_current_modname() local name = def.name @@ -176,6 +188,7 @@ function mcl_potions.register_effect(def) end registered_effects[name] = pdef EF[name] = {} + item_speed_effects[name] = def.affects_item_speed end mcl_potions.register_effect({ @@ -817,16 +830,68 @@ mcl_potions.register_effect({ uses_factor = true, }) +-- constants relevant for effects altering mining and attack speed +local LONGEST_MINING_TIME = 300 +local LONGEST_PUNCH_INTERVAL = 10 +mcl_potions.LONGEST_MINING_TIME = LONGEST_MINING_TIME +mcl_potions.LONGEST_PUNCH_INTERVAL = LONGEST_PUNCH_INTERVAL + +function mcl_potions.apply_haste_fatigue(toolcaps, h_fac, f_fac) + if f_fac == 0 then + local fpi = toolcaps.full_punch_interval + toolcaps.full_punch_interval = fpi > LONGEST_PUNCH_INTERVAL and fpi or LONGEST_PUNCH_INTERVAL + else + toolcaps.full_punch_interval = toolcaps.full_punch_interval / (1+h_fac) / f_fac + end + for name, group in pairs(toolcaps.groupcaps) do + local t = group.times + for i=1, #t do + if f_fac == 0 then + t[i] = t[i] > LONGEST_MINING_TIME and t[i] or LONGEST_MINING_TIME + else + local old_time = t[i] + t[i] = t[i] / (1+h_fac) / f_fac + if old_time < LONGEST_MINING_TIME and t[i] > LONGEST_MINING_TIME then + t[i] = LONGEST_MINING_TIME + end + end + end + end + return toolcaps +end + +function mcl_potions.hf_update_internal(hand, object) + local meta = hand:get_meta() + local h_fac = mcl_potions.get_total_haste(object) + local f_fac = mcl_potions.get_total_fatigue(object) + local toolcaps = hand:get_tool_capabilities() + meta:set_tool_capabilities(mcl_potions.apply_haste_fatigue(toolcaps, h_fac, f_fac)) + return hand +end + +local function haste_fatigue_hand_update(object) + local inventory = object:get_inventory() + if not inventory or inventory:get_size("hand") < 1 then return end + local hand = inventory:get_stack("hand", 1) + inventory:set_stack("hand", 1, mcl_potions.hf_update_internal(hand, object)) +end + mcl_potions.register_effect({ name = "haste", description = S("Haste"), res_condition = function(object) return (not object:is_player()) end, + on_start = haste_fatigue_hand_update, + after_end = function(object) + haste_fatigue_hand_update(object) + mcl_potions._reset_haste_fatigue_item_meta(object) + end, particle_color = "#FFFF00", uses_factor = true, lvl1_factor = 0.2, lvl2_factor = 0.4, + affects_item_speed = {factor_is_positive = true}, }) mcl_potions.register_effect({ @@ -835,31 +900,27 @@ mcl_potions.register_effect({ res_condition = function(object) return (not object:is_player()) end, + on_start = haste_fatigue_hand_update, + after_end = function(object) + haste_fatigue_hand_update(object) + mcl_potions._reset_haste_fatigue_item_meta(object) + end, particle_color = "#64643D", uses_factor = true, lvl1_factor = 0.3, lvl2_factor = 0.09, + affects_item_speed = {}, }) -- implementation of haste and fatigue effects -local LONGEST_MINING_TIME = 300 -local LONGEST_PUNCH_INTERVAL = 10 function mcl_potions.update_haste_and_fatigue(player) if mcl_gamemode.get_gamemode(player) == "creative" then return end local item = player:get_wielded_item() local meta = item:get_meta() - local haste = EF.haste[player] - local fatigue = EF.fatigue[player] local item_haste = meta:get_float("mcl_potions:haste") local item_fatig = 1 - meta:get_float("mcl_potions:fatigue") - local h_fac - if haste then h_fac = haste.factor - else h_fac = 0 end - if h_fac < 0 then h_fac = 0 end - local f_fac - if fatigue then f_fac = fatigue.factor - else f_fac = 1 end - if f_fac < 0 then f_fac = 0 end + local h_fac = mcl_potions.get_total_haste(player) + local f_fac = mcl_potions.get_total_fatigue(player) if item_haste ~= h_fac or item_fatig ~= f_fac then if h_fac ~= 0 then meta:set_float("mcl_potions:haste", h_fac) else meta:set_string("mcl_potions:haste", "") end @@ -872,39 +933,22 @@ function mcl_potions.update_haste_and_fatigue(player) return end local toolcaps = item:get_tool_capabilities() - if f_fac == 0 then - local fpi = toolcaps.full_punch_interval - toolcaps.full_punch_interval = fpi > LONGEST_PUNCH_INTERVAL and fpi or LONGEST_PUNCH_INTERVAL - else - toolcaps.full_punch_interval = toolcaps.full_punch_interval / (1+h_fac) / f_fac - end - for name, group in pairs(toolcaps.groupcaps) do - local t = group.times - for i=1, #t do - if f_fac == 0 then - t[i] = t[i] > LONGEST_MINING_TIME and t[i] or LONGEST_MINING_TIME - else - local old_time = t[i] - t[i] = t[i] / (1+h_fac) / f_fac - if old_time < LONGEST_MINING_TIME and t[i] > LONGEST_MINING_TIME then - t[i] = LONGEST_MINING_TIME - end - end - end - end - meta:set_tool_capabilities(toolcaps) + meta:set_tool_capabilities(mcl_potions.apply_haste_fatigue(toolcaps, h_fac, f_fac)) player:set_wielded_item(item) end + haste_fatigue_hand_update(player, h_fac, f_fac) end minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) mcl_potions.update_haste_and_fatigue(puncher) end) minetest.register_on_punchplayer(function(player, hitter) + if not hitter:is_player() then return end -- TODO implement haste and fatigue support for mobs? mcl_potions.update_haste_and_fatigue(hitter) end) -- update when hitting mob implemented in mcl_mobs/combat.lua + -- ██╗░░░██╗██████╗░██████╗░░█████╗░████████╗███████╗ -- ██║░░░██║██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝ -- ██║░░░██║██████╔╝██║░░██║███████║░░░██║░░░█████╗░░ @@ -1132,6 +1176,7 @@ minetest.register_globalstep(function(dtime) if not EF[name][object] or EF[name][object].timer >= vals.dur then if effect.on_end then effect.on_end(object) end EF[name][object] = nil + if effect.after_end then effect.after_end(object) end if object:is_player() then meta = object:get_meta() meta:set_string("mcl_potions:"..name, minetest.serialize(EF[name][object])) @@ -1315,6 +1360,31 @@ function mcl_potions.get_effect_level(object, effect_name) return registered_effects[effect_name].factor_to_level(effect.factor) end +function mcl_potions.get_total_haste(object) + local accum_factor = 1 + for name, def in pairs(item_speed_effects) do + if EF[name][object] then + local factor = EF[name][object].factor + if def.factor_is_positive then factor = factor + 1 end + if factor > 1 then accum_factor = accum_factor * factor end + end + end + return accum_factor - 1 +end + +function mcl_potions.get_total_fatigue(object) + local accum_factor = 1 + for name, def in pairs(item_speed_effects) do + if EF[name][object] then + local factor = EF[name][object].factor + if def.factor_is_positive then factor = factor + 1 end + if factor <= 0 then return 0 end + if factor < 1 then accum_factor = accum_factor * factor end + end + end + return accum_factor +end + function mcl_potions.clear_effect(object, effect) EF[effect][object] = nil if not object:is_player() then return end diff --git a/mods/PLAYER/mcl_meshhand/init.lua b/mods/PLAYER/mcl_meshhand/init.lua index c42ff8081..44eb3e2b9 100644 --- a/mods/PLAYER/mcl_meshhand/init.lua +++ b/mods/PLAYER/mcl_meshhand/init.lua @@ -76,13 +76,16 @@ else end function mcl_meshhand.update_player(player) + local hand if mcl_skins_enabled then local node_id = mcl_skins.get_node_id_by_player(player) - player:get_inventory():set_stack("hand", 1, "mcl_meshhand:" .. node_id) + hand = ItemStack("mcl_meshhand:" .. node_id) else local creative = minetest.is_creative_enabled(player:get_player_name()) - player:get_inventory():set_stack("hand", 1, "mcl_meshhand:hand" .. (creative and "_crea" or "_surv")) + hand = ItemStack("mcl_meshhand:hand" .. (creative and "_crea" or "_surv")) end + if not mcl_potions then player:get_inventory():set_stack("hand", 1, hand) end + player:get_inventory():set_stack("hand", 1, mcl_potions.hf_update_internal(hand, player)) end minetest.register_on_joinplayer(function(player) From 5263740a808e6f1c86ea2f756b7302cf2d111527 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 20 Mar 2024 02:11:00 +0100 Subject: [PATCH 45/91] Added conduit power --- mods/ITEMS/mcl_potions/functions.lua | 38 ++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 3fbf6663c..677e81f51 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -912,6 +912,40 @@ mcl_potions.register_effect({ affects_item_speed = {}, }) +mcl_potions.register_effect({ + name = "conduit_power", + description = S("Conduit Power"), + res_condition = function(object) + return (not object:is_player()) + end, + on_start = haste_fatigue_hand_update, + on_step = function(dtime, object, factor, duration) + if not object:is_player() then return end + local node = minetest.get_node_or_nil(object:get_pos()) + if node and minetest.registered_nodes[node.name] + and minetest.get_item_group(node.name, "liquid") ~= 0 + and minetest.get_item_group(node.name, "water") ~= 0 then + EF.conduit_power[object].blocked = nil + if object:get_breath() then + hb.hide_hudbar(object, "breath") + if object:get_breath() < 10 then object:set_breath(10) end + end + -- TODO implement improved underwater vision with this effect + else + EF.conduit_power[object].blocked = true + end + end, + after_end = function(object) + haste_fatigue_hand_update(object) + mcl_potions._reset_haste_fatigue_item_meta(object) + end, + particle_color = "#1FB1BA", + uses_factor = true, + lvl1_factor = 0.2, + lvl2_factor = 0.4, + affects_item_speed = {factor_is_positive = true}, +}) + -- implementation of haste and fatigue effects function mcl_potions.update_haste_and_fatigue(player) if mcl_gamemode.get_gamemode(player) == "creative" then return end @@ -1363,7 +1397,7 @@ end function mcl_potions.get_total_haste(object) local accum_factor = 1 for name, def in pairs(item_speed_effects) do - if EF[name][object] then + if EF[name][object] and not EF[name][object].blocked then local factor = EF[name][object].factor if def.factor_is_positive then factor = factor + 1 end if factor > 1 then accum_factor = accum_factor * factor end @@ -1375,7 +1409,7 @@ end function mcl_potions.get_total_fatigue(object) local accum_factor = 1 for name, def in pairs(item_speed_effects) do - if EF[name][object] then + if EF[name][object] and not EF[name][object].blocked then local factor = EF[name][object].factor if def.factor_is_positive then factor = factor + 1 end if factor <= 0 then return 0 end From bbe2964d483b4dbe1d40e8f022cf18db24676939 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 20 Mar 2024 22:45:47 +0100 Subject: [PATCH 46/91] Added some effect descriptions --- mods/ITEMS/mcl_potions/functions.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 677e81f51..f1ddfad41 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -861,6 +861,7 @@ function mcl_potions.apply_haste_fatigue(toolcaps, h_fac, f_fac) end function mcl_potions.hf_update_internal(hand, object) + -- TODO add a check for creative mode? local meta = hand:get_meta() local h_fac = mcl_potions.get_total_haste(object) local f_fac = mcl_potions.get_total_fatigue(object) @@ -879,6 +880,9 @@ end mcl_potions.register_effect({ name = "haste", description = S("Haste"), + get_tt = function(factor) + return S("+@1% mining and attack speed", math.floor(factor*100)) + end, res_condition = function(object) return (not object:is_player()) end, @@ -897,6 +901,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "fatigue", description = S("Fatigue"), + get_tt = function(factor) + return S("-@1% mining and attack speed", math.floor((1-factor)*100)) + end, res_condition = function(object) return (not object:is_player()) end, @@ -915,6 +922,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "conduit_power", description = S("Conduit Power"), + get_tt = function(factor) + return S("+@1% mining and attack speed in water\nlimitless breathing under water", math.floor(factor*100)) + end, res_condition = function(object) return (not object:is_player()) end, From c503a5fb8c6e72919979678785fbcc82464543c8 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 21 Mar 2024 01:10:20 +0100 Subject: [PATCH 47/91] Added luck and bad luck effects They're no-op for now --- mods/ITEMS/mcl_potions/functions.lua | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index f1ddfad41..db50c7058 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -602,6 +602,38 @@ mcl_potions.register_effect({ end, }) +mcl_potions.register_effect({ + name = "luck", + description = S("Luck"), + particle_color = "#7BFF42", + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) +-- mcl_luck.add_luck_modifier(object, "mcl_potions:luck", factor) + end, + on_end = function(object) +-- mcl_luck.remove_luck_modifier(object, "mcl_potions:luck") + end, + uses_factor = true, +}) + +mcl_potions.register_effect({ + name = "bad_luck", + description = S("Bad Luck"), + particle_color = "#887343", + res_condition = function(object) + return (not object:is_player()) + end, + on_start = function(object, factor) +-- mcl_luck.add_luck_modifier(object, "mcl_potions:bad_luck", -factor) + end, + on_end = function(object) +-- mcl_luck.remove_luck_modifier(object, "mcl_potions:bad_luck") + end, + uses_factor = true, +}) + mcl_potions.register_effect({ name = "bad_omen", description = S("Bad Omen"), From b28467d34839d13f6c511e256df193364db8afc7 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 21 Mar 2024 01:27:11 +0100 Subject: [PATCH 48/91] Added mcl_luck API Luck and Bad Luck effects use the mcl_luck API now The API is unused for now --- mods/ITEMS/mcl_potions/functions.lua | 14 ++++++++---- mods/PLAYER/mcl_luck/init.lua | 33 ++++++++++++++++++++++++++++ mods/PLAYER/mcl_luck/mod.conf | 3 +++ 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 mods/PLAYER/mcl_luck/init.lua create mode 100644 mods/PLAYER/mcl_luck/mod.conf diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index db50c7058..50cde6bae 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -610,10 +610,13 @@ mcl_potions.register_effect({ return (not object:is_player()) end, on_start = function(object, factor) --- mcl_luck.add_luck_modifier(object, "mcl_potions:luck", factor) + mcl_luck.apply_luck_modifier(object:get_player_name(), "mcl_potions:luck", factor) + end, + on_load = function(object, factor) + mcl_luck.apply_luck_modifier(object:get_player_name(), "mcl_potions:luck", factor) end, on_end = function(object) --- mcl_luck.remove_luck_modifier(object, "mcl_potions:luck") + mcl_luck.remove_luck_modifier(object:get_player_name(), "mcl_potions:luck") end, uses_factor = true, }) @@ -626,10 +629,13 @@ mcl_potions.register_effect({ return (not object:is_player()) end, on_start = function(object, factor) --- mcl_luck.add_luck_modifier(object, "mcl_potions:bad_luck", -factor) + mcl_luck.apply_luck_modifier(object:get_player_name(), "mcl_potions:bad_luck", -factor) + end, + on_load = function(object, factor) + mcl_luck.apply_luck_modifier(object:get_player_name(), "mcl_potions:bad_luck", -factor) end, on_end = function(object) --- mcl_luck.remove_luck_modifier(object, "mcl_potions:bad_luck") + mcl_luck.remove_luck_modifier(object:get_player_name(), "mcl_potions:bad_luck") end, uses_factor = true, }) diff --git a/mods/PLAYER/mcl_luck/init.lua b/mods/PLAYER/mcl_luck/init.lua new file mode 100644 index 000000000..275cea52f --- /dev/null +++ b/mods/PLAYER/mcl_luck/init.lua @@ -0,0 +1,33 @@ +mcl_luck = {} + +-- table indexed by player name +-- each entry for each player contains list of modifiers applied to the player +-- modifiers are listed by their name (defined when applying them) +-- all modifiers are dynamic (they are removed when the player leaves game and on server shutdown) +local applied_luck = {} + +function mcl_luck.apply_luck_modifier(player_name, modifier_name, amount) + applied_luck[player_name][modifier_name] = amount +end + +function mcl_luck.remove_luck_modifier(player_name, modifier_name) + applied_luck[player_name][modifier_name] = nil +end + +function mcl_luck.get_luck(player_name) + local luck = 0 + for _, amount in pairs(applied_luck[player_name]) do + luck = luck + amount + end + return luck +end + +minetest.register_on_joinplayer(function(player) + local player_name = player:get_player_name() + applied_luck[player_name] = {} +end) + +minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + applied_luck[player_name] = nil +end) diff --git a/mods/PLAYER/mcl_luck/mod.conf b/mods/PLAYER/mcl_luck/mod.conf new file mode 100644 index 000000000..395c888bb --- /dev/null +++ b/mods/PLAYER/mcl_luck/mod.conf @@ -0,0 +1,3 @@ +name = mcl_luck +author = Herowl +description = An API for handling luck, it can be polled by random events. From 42778a3a6dc388aa88566077defb02abf893b347 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 21 Mar 2024 03:10:05 +0100 Subject: [PATCH 49/91] Made some random rolls affected by mcl_luck * xp bottle * bow and crossbow crits * megacrits added for mcl_bows, achievable only by (mcl_)luck --- mods/HUD/mcl_experience/bottle.lua | 11 ++++++++--- mods/HUD/mcl_experience/mod.conf | 2 +- mods/ITEMS/mcl_bows/bow.lua | 8 ++++---- mods/ITEMS/mcl_bows/crossbow.lua | 8 ++++---- mods/ITEMS/mcl_bows/mod.conf | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/mods/HUD/mcl_experience/bottle.lua b/mods/HUD/mcl_experience/bottle.lua index 62a3fb9ca..50f96656f 100644 --- a/mods/HUD/mcl_experience/bottle.lua +++ b/mods/HUD/mcl_experience/bottle.lua @@ -14,7 +14,7 @@ minetest.register_entity("mcl_experience:bottle",{ local n = node.name if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and minetest.get_item_group(n, "liquid") == 0 then minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1}) - mcl_experience.throw_xp(pos, math.random(3, 11)) + mcl_experience.throw_xp(pos, math.random(3, 11) + (self._luck or 0)) minetest.add_particlespawner({ amount = 50, time = 0.1, @@ -40,13 +40,18 @@ minetest.register_entity("mcl_experience:bottle",{ end, }) -local function throw_xp_bottle(pos, dir, velocity) +local function throw_xp_bottle(pos, dir, velocity, user) minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true) local obj = minetest.add_entity(pos, "mcl_experience:bottle") obj:set_velocity(vector.multiply(dir, velocity)) local acceleration = vector.multiply(dir, -3) acceleration.y = -9.81 obj:set_acceleration(acceleration) + if user then + local ent = obj:get_luaentity() + local luck = mcl_luck.get_luck(user:get_player_name()) + ent._luck = luck + end end minetest.register_craftitem("mcl_experience:bottle", { @@ -55,7 +60,7 @@ minetest.register_craftitem("mcl_experience:bottle", { wield_image = "mcl_experience_bottle.png", stack_max = 64, on_use = function(itemstack, placer, pointed_thing) - throw_xp_bottle(vector.add(placer:get_pos(), vector.new(0, 1.5, 0)), placer:get_look_dir(), 10) + throw_xp_bottle(vector.add(placer:get_pos(), vector.new(0, 1.5, 0)), placer:get_look_dir(), 10, placer) if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end diff --git a/mods/HUD/mcl_experience/mod.conf b/mods/HUD/mcl_experience/mod.conf index a8e992c06..1e0c09c31 100644 --- a/mods/HUD/mcl_experience/mod.conf +++ b/mods/HUD/mcl_experience/mod.conf @@ -1,4 +1,4 @@ name = mcl_experience author = oilboi description = eXPerience mod -depends = mcl_gamemode +depends = mcl_gamemode, mcl_luck diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 3d22c6df6..9f381f501 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -270,10 +270,10 @@ controls.register_on_release(function(player, key, time) local is_critical = false if charge >= BOW_CHARGE_TIME_FULL then speed = BOW_MAX_SPEED - local r = math.random(1,5) - if r == 1 then - -- 20% chance for critical hit - damage = 10 + local r = math.random(1,5) + mcl_luck.get_luck(player:get_player_name()) + if r > 4 then + -- 20% chance for critical hit (by default) + damage = 10 + math.floor((r-5)/5) -- mega crit (over crit) with high luck is_critical = true else damage = 9 diff --git a/mods/ITEMS/mcl_bows/crossbow.lua b/mods/ITEMS/mcl_bows/crossbow.lua index 54c6d7da2..c1cb7f8be 100644 --- a/mods/ITEMS/mcl_bows/crossbow.lua +++ b/mods/ITEMS/mcl_bows/crossbow.lua @@ -322,10 +322,10 @@ controls.register_on_press(function(player, key, time) -- Fully charged local is_critical = false speed = BOW_MAX_SPEED - local r = math.random(1,5) - if r == 1 then - -- 20% chance for critical hit - damage = 10 + local r = math.random(1,5) + mcl_luck.get_luck(player:get_player_name()) + if r > 4 then + -- 20% chance for critical hit (by default) + damage = 10 + math.floor((r-5)/5) -- mega crit (over crit) with high luck is_critical = true else damage = 9 diff --git a/mods/ITEMS/mcl_bows/mod.conf b/mods/ITEMS/mcl_bows/mod.conf index 0fdd666a3..61fb52ddb 100644 --- a/mods/ITEMS/mcl_bows/mod.conf +++ b/mods/ITEMS/mcl_bows/mod.conf @@ -1,6 +1,6 @@ name = mcl_bows author = Arcelmi description = This mod adds bows and arrows for MineClone 2. -depends = controls, mcl_particles, mcl_enchanting, mcl_init, mcl_util, mcl_shields, mcl_fovapi +depends = controls, mcl_particles, mcl_enchanting, mcl_init, mcl_util, mcl_shields, mcl_fovapi, mcl_luck optional_depends = awards, mcl_achievements, mcl_core, mcl_mobitems, playerphysics, doc, doc_identifier, mesecons_button From 7cd0cfede867027019780066d5921811bdd36b9b Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 24 Mar 2024 05:46:01 +0100 Subject: [PATCH 50/91] Further (mcl_)luck functionality * XP from mob breeding impacted by luck * eye of ender explosion chance impacted by luck * fishing loot impacted by luck * melee critical damage impacted by luck * also fixed 2 scripts marked as "executable" --- mods/ENTITIES/mcl_mobs/breeding.lua | 3 ++- mods/ENTITIES/mcl_mobs/mod.conf | 2 +- mods/ENTITIES/mcl_mobs/spawning.lua | 0 mods/HUD/mcl_achievements/init.lua | 0 mods/ITEMS/mcl_end/eye_of_ender.lua | 9 ++++++--- mods/ITEMS/mcl_end/mod.conf | 2 +- mods/ITEMS/mcl_fishing/init.lua | 4 ++-- mods/ITEMS/mcl_fishing/mod.conf | 2 +- mods/PLAYER/mcl_criticals/init.lua | 27 ++++++++++++++++++++++++++- mods/PLAYER/mcl_criticals/mod.conf | 2 +- 10 files changed, 40 insertions(+), 11 deletions(-) mode change 100755 => 100644 mods/ENTITIES/mcl_mobs/spawning.lua mode change 100755 => 100644 mods/HUD/mcl_achievements/init.lua diff --git a/mods/ENTITIES/mcl_mobs/breeding.lua b/mods/ENTITIES/mcl_mobs/breeding.lua index 7b5d91119..90e625db8 100644 --- a/mods/ENTITIES/mcl_mobs/breeding.lua +++ b/mods/ENTITIES/mcl_mobs/breeding.lua @@ -78,6 +78,7 @@ function mob_class:feed_tame(clicker, feed_count, breed, tame, notake) self.food = 0 self.horny = true self.persistent = true + self._luck = mcl_luck.get_luck(clicker:get_player_name()) end end @@ -273,7 +274,7 @@ function mob_class:check_breeding() return end - mcl_experience.throw_xp(pos, math.random(1, 7)) + mcl_experience.throw_xp(pos, math.random(1, 7) + (parent1._luck or 0) + (parent2._luck or 0)) -- custom breed function if parent1.on_breed then diff --git a/mods/ENTITIES/mcl_mobs/mod.conf b/mods/ENTITIES/mcl_mobs/mod.conf index 9c10e9a2b..927c1c905 100644 --- a/mods/ENTITIES/mcl_mobs/mod.conf +++ b/mods/ENTITIES/mcl_mobs/mod.conf @@ -1,5 +1,5 @@ name = mcl_mobs author = PilzAdam description = Adds a mob API for mods to add animals or monsters, etc. -depends = mcl_particles +depends = mcl_particles, mcl_luck optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience, mcl_sculk diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua old mode 100755 new mode 100644 diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua old mode 100755 new mode 100644 diff --git a/mods/ITEMS/mcl_end/eye_of_ender.lua b/mods/ITEMS/mcl_end/eye_of_ender.lua index b5adc7cb6..065d7657e 100644 --- a/mods/ITEMS/mcl_end/eye_of_ender.lua +++ b/mods/ITEMS/mcl_end/eye_of_ender.lua @@ -28,8 +28,8 @@ minetest.register_entity("mcl_end:ender_eye", { self._age = self._age + dtime if self._age >= 3 then -- End of life - local r = math.random(1,5) - if r == 1 then + local r = math.random(1,15) + self._luck + if r <= 3 then -- 20% chance to get destroyed completely. -- 100% if in Creative Mode self.object:remove() @@ -85,11 +85,12 @@ minetest.register_craftitem("mcl_end:ender_eye", { if user == nil then return end + local player_name = user:get_player_name() local origin = user:get_pos() origin.y = origin.y + 1.5 local strongholds = mcl_structures.registered_structures["end_shrine"].static_pos local dim = mcl_worlds.pos_to_dimension(origin) - local is_creative = minetest.is_creative_enabled(user:get_player_name()) + local is_creative = minetest.is_creative_enabled(player_name) -- Just drop the eye of ender if there are no strongholds if #strongholds <= 0 or dim ~= "overworld" then @@ -124,6 +125,8 @@ minetest.register_craftitem("mcl_end:ender_eye", { -- Throw it! local obj = minetest.add_entity(origin, "mcl_end:ender_eye") local dir + local ent = obj:get_luaentity() + ent._luck = mcl_luck.get_luck(player_name) if lowest_dist <= 25 then local velocity = 4 diff --git a/mods/ITEMS/mcl_end/mod.conf b/mods/ITEMS/mcl_end/mod.conf index 3547074cf..3666ace19 100644 --- a/mods/ITEMS/mcl_end/mod.conf +++ b/mods/ITEMS/mcl_end/mod.conf @@ -1,2 +1,2 @@ name = mcl_end -depends = screwdriver, mcl_sounds, mcl_util, doc_items, mcl_worlds, mcl_structures, mcl_stonecutter +depends = screwdriver, mcl_sounds, mcl_util, doc_items, mcl_worlds, mcl_structures, mcl_stonecutter, mcl_luck diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index ca9c3b2e3..e3bf181f5 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -62,8 +62,8 @@ local fish = function(itemstack, player, pointed_thing) local junk_values = {10, 8.1, 6.1, 4.2} local luck_of_the_sea = math.min(mcl_enchanting.get_enchantment(itemstack, "luck_of_the_sea"), 3) local index = luck_of_the_sea + 1 - local fish_value = fish_values[index] - local junk_value = junk_values[index] + fish_value + local fish_value = fish_values[index] - mcl_luck.get_luck(ent.player) + local junk_value = junk_values[index] + fish_value - mcl_luck.get_luck(ent.player) if r <= fish_value then -- Fish items = mcl_loot.get_loot({ diff --git a/mods/ITEMS/mcl_fishing/mod.conf b/mods/ITEMS/mcl_fishing/mod.conf index 71bde6146..1af715aaf 100644 --- a/mods/ITEMS/mcl_fishing/mod.conf +++ b/mods/ITEMS/mcl_fishing/mod.conf @@ -1,3 +1,3 @@ name = mcl_fishing description = Adds fish and fishing poles to go fishing. -depends = mcl_core, mcl_sounds, mcl_loot, mcl_mobs, mcl_enchanting, mcl_throwing, mcl_colors, mcl_buckets +depends = mcl_core, mcl_sounds, mcl_loot, mcl_mobs, mcl_enchanting, mcl_throwing, mcl_colors, mcl_buckets, mcl_luck diff --git a/mods/PLAYER/mcl_criticals/init.lua b/mods/PLAYER/mcl_criticals/init.lua index 3e292d165..d30647004 100644 --- a/mods/PLAYER/mcl_criticals/init.lua +++ b/mods/PLAYER/mcl_criticals/init.lua @@ -23,7 +23,32 @@ mcl_damage.register_modifier(function(obj, damage, reason) texture = "mcl_particles_crit.png^[colorize:#bc7a57:127", }) minetest.sound_play("mcl_criticals_hit", {object = obj}) - return damage * math.random(1.5, 2.5) + local crit_mod + local CRIT_MIN = 1.5 + local CRIT_DIFF = 1 + if hitter:is_player() then + local luck = mcl_luck.get_luck(hitter:get_player_name()) + if luck ~= 0 then + local a, d + if luck > 0 then + d = -0.5 + a = d - math.abs(luck) + elseif luck < 0 then + a = -0.5 + d = a - math.abs(luck) + else + minetest.log("warning", "[mcl_criticals] luck is not a number") -- this technically can't happen, but want to catch such cases + end + if a then + local x = math.random() + crit_mod = CRIT_DIFF * (a * x) / (d - luck * x) + CRIT_MIN + end + end + end + if not crit_mod then + crit_mod = math.random(CRIT_MIN, CRIT_MIN + CRIT_DIFF) + end + return damage * crit_mod end end end, -100) diff --git a/mods/PLAYER/mcl_criticals/mod.conf b/mods/PLAYER/mcl_criticals/mod.conf index 5b0b91330..0ae588aa6 100644 --- a/mods/PLAYER/mcl_criticals/mod.conf +++ b/mods/PLAYER/mcl_criticals/mod.conf @@ -1,2 +1,2 @@ name = mcl_criticals -depends = mcl_damage +depends = mcl_damage, mcl_luck From 6dab6158b96437086f9d58a5d41c02abdd96001c Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 31 Mar 2024 04:34:19 +0200 Subject: [PATCH 51/91] Reserve some more keywords in register_effect() --- mods/ITEMS/mcl_potions/functions.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 50cde6bae..e3ec67d90 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -121,11 +121,8 @@ function mcl_potions.register_effect(def) if type(name) ~= "string" then error("Unable to register effect: name is not a string") end - if name == "list" then - error("Unable to register effect: list is a reserved word") - end - if name == "heal" then - error("Unable to register effect: heal is a reserved word") + if name == "list" or name == "heal" or name == "remove" or name == "clear" then + error("Unable to register effect: " .. name .. " is a reserved word") end if registered_effects[name] then error("Effect named "..name.." already registered!") From 7ae31790bff5464117311c73d7a765c5d8396a11 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 1 Apr 2024 03:43:49 +0200 Subject: [PATCH 52/91] Fixed running on_end for effects that aren't ending --- mods/ITEMS/mcl_potions/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index e3ec67d90..ac0fdd3de 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1317,7 +1317,7 @@ function mcl_potions._reset_player_effects(player, set_hud) end for name, effect in pairs(registered_effects) do - if effect.on_end then effect.on_end(player) end + if EF[name][player] and effect.on_end then effect.on_end(player) end end mcl_potions._clear_cached_player_data(player) From 09be413e3f317752508ff5fdd488fe2bedfc42b7 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 1 Apr 2024 04:38:05 +0200 Subject: [PATCH 53/91] Added glowing effect Also added on_save_effect callback to run cleanup --- mods/ITEMS/mcl_potions/functions.lua | 69 +++++++++++++++++++++++++ textures/mcl_potions_glow_waypoint.png | Bin 0 -> 252 bytes 2 files changed, 69 insertions(+) create mode 100644 textures/mcl_potions_glow_waypoint.png diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index ac0fdd3de..e12e61fa5 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -94,6 +94,7 @@ end -- on_hit_timer - function(object, factor, duration) - if defined runs a hit_timer depending on timer_uses_factor value -- on_end - function(object) - called when the effect wears off -- after_end - function(object) - called when the effect wears off, after purging the data of the effect +-- on_save_effect - function(object - called when the effect is to be serialized for saving (supposed to do cleanup) -- particle_color - string - colorstring for particles - defaults to #3000EE -- uses_factor - bool - whether factor affects the effect -- lvl1_factor - integer - factor for lvl1 effect - defaults to 1 if uses_factor @@ -144,6 +145,7 @@ function mcl_potions.register_effect(def) pdef.on_step = def.on_step pdef.on_hit_timer = def.on_hit_timer pdef.on_end = def.on_end + pdef.on_save_effect = def.on_save_effect if not def.particle_color then pdef.particle_color = "#3000EE" else @@ -505,6 +507,72 @@ mcl_potions.register_effect({ lvl2_factor = 20, }) +local GLOW_DISTANCE = 30 +local CLOSE_GLOW_LIMIT = 3 +local MIN_GLOW_SCALE = 1 +local MAX_GLOW_SCALE = 4 +local SCALE_DIFF = MAX_GLOW_SCALE - MIN_GLOW_SCALE +local SCALE_FACTOR = (GLOW_DISTANCE - CLOSE_GLOW_LIMIT) / SCALE_DIFF +local abs = math.abs +mcl_potions.register_effect({ + name = "glowing", + description = S("Glowing"), + get_tt = function(factor) + return S("more visible at all times") + end, + on_start = function(object, factor) + EF.glowing[object].waypoints = {} + end, + on_step = function(dtime, object, factor, duration) + local pos = object:get_pos() + if not pos then return end + local x, y, z = pos.x, pos.y, pos.z + for _, player in pairs(minetest.get_connected_players()) do + local pp = player:get_pos() + if pp and player ~= object then + local hud_id = EF.glowing[object].waypoints[player] + if abs(pp.x-x) < GLOW_DISTANCE and abs(pp.y-y) < GLOW_DISTANCE + and abs(pp.z-z) < GLOW_DISTANCE then + local distance = vector.distance(pos, pp) + local scale + if distance <= CLOSE_GLOW_LIMIT then scale = MAX_GLOW_SCALE + elseif distance >= GLOW_DISTANCE then scale = MIN_GLOW_SCALE + else scale = (GLOW_DISTANCE - distance) / SCALE_FACTOR + MIN_GLOW_SCALE end + if hud_id then + player:hud_change(hud_id, "world_pos", pos) + player:hud_change(hud_id, "scale", {x = scale, y = scale}) + else + EF.glowing[object].waypoints[player] = player:hud_add({ + hud_elem_type = "image_waypoint", + position = {x = 0.5, y = 0.5}, + scale = {x = scale, y = scale}, + text = "mcl_potions_glow_waypoint.png", + alignment = {x = 0, y = -1}, + world_pos = pos, + }) + end + elseif hud_id then + player:hud_remove(hud_id) + EF.glowing[object].waypoints[player] = nil + end + end + end + end, + on_end = function(object) + for player, hud_id in pairs(EF.glowing[object].waypoints) do + if player:get_pos() then player:hud_remove(hud_id) end + end + end, + on_save_effect = function(object) + for player, hud_id in pairs(EF.glowing[object].waypoints) do + if player:get_pos() then player:hud_remove(hud_id) end + end + EF.glowing[object].waypoints = {} + end, + particle_color = "#FFFF00", + uses_factor = false, +}) + mcl_potions.register_effect({ name = "health_boost", description = S("Health Boost"), @@ -1334,6 +1402,7 @@ function mcl_potions._save_player_effects(player) local meta = player:get_meta() for name, effect in pairs(registered_effects) do + if effect.on_save_effect and EF[name][player] then effect.on_save_effect(player) end meta:set_string("mcl_potions:_EF_"..name, minetest.serialize(EF[name][player])) end end diff --git a/textures/mcl_potions_glow_waypoint.png b/textures/mcl_potions_glow_waypoint.png new file mode 100644 index 0000000000000000000000000000000000000000..1e5afedfbec5e8968c5d8199ea038f91a82b486b GIT binary patch literal 252 zcmV~FYthh!q5 Date: Mon, 1 Apr 2024 06:58:33 +0200 Subject: [PATCH 54/91] Brewing somewhat works with the new API --- mods/ITEMS/mcl_brewing/init.lua | 2 +- mods/ITEMS/mcl_potions/init.lua | 150 +++++++++++++++-------------- mods/ITEMS/mcl_potions/potions.lua | 7 ++ 3 files changed, 88 insertions(+), 71 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 306129320..cdac3429e 100644 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -82,7 +82,7 @@ local function brewable(inv) for i=1,stand_size do - bottle = inv:get_stack("stand", i):get_name() + bottle = inv:get_stack("stand", i) alchemy = mcl_potions.get_alchemy(ingredient, bottle) if alchemy then diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 550ddc27d..3f9955630 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -29,6 +29,7 @@ dofile(modpath .. "/splash.lua") dofile(modpath .. "/lingering.lua") dofile(modpath .. "/tipped_arrow.lua") dofile(modpath .. "/potions.lua") +local potions = mcl_potions.registered_potions minetest.register_craftitem("mcl_potions:fermented_spider_eye", { description = S("Fermented Spider Eye"), @@ -370,97 +371,110 @@ local output_table = { ["mcl_potions:awkward"] = awkward_table, } - -local enhancement_table = {} -local extension_table = {} -local potions = {} - -for i, potion in ipairs({"healing","harming","swiftness","slowness", - "leaping","poison","regeneration","invisibility","fire_resistance", - -- "weakness","strength", - "water_breathing","night_vision", "withering"}) do - - table.insert(potions, potion) - - if potion ~= "invisibility" and potion ~= "night_vision" and potion ~= "weakness" and potion ~= "water_breathing" and potion ~= "fire_resistance" then - enhancement_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_2" - enhancement_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_2_splash" - table.insert(potions, potion.."_2") - end - - if potion ~= "healing" and potion ~= "harming" then - extension_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_plus_splash" - extension_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_plus" - table.insert(potions, potion.."_plus") - end - -end - -for i, potion in ipairs({"awkward", "mundane", "thick", "water"}) do - table.insert(potions, potion) -end - - local inversion_table = { ["mcl_potions:healing"] = "mcl_potions:harming", - ["mcl_potions:healing_2"] = "mcl_potions:harming_2", ["mcl_potions:swiftness"] = "mcl_potions:slowness", - ["mcl_potions:swiftness_plus"] = "mcl_potions:slowness_plus", ["mcl_potions:leaping"] = "mcl_potions:slowness", - ["mcl_potions:leaping_plus"] = "mcl_potions:slowness_plus", ["mcl_potions:night_vision"] = "mcl_potions:invisibility", - ["mcl_potions:night_vision_plus"] = "mcl_potions:invisibility_plus", ["mcl_potions:poison"] = "mcl_potions:harming", - ["mcl_potions:poison_2"] = "mcl_potions:harming_2", - ["mcl_potions:healing_splash"] = "mcl_potions:harming_splash", - ["mcl_potions:healing_2_splash"] = "mcl_potions:harming_2_splash", - ["mcl_potions:swiftness_splash"] = "mcl_potions:slowness_splash", - ["mcl_potions:swiftness_plus_splash"] = "mcl_potions:slowness_plus_splash", - ["mcl_potions:leaping_splash"] = "mcl_potions:slowness_splash", - ["mcl_potions:leaping_plus_splash"] = "mcl_potions:slowness_plus_splash", - ["mcl_potions:night_vision_splash"] = "mcl_potions:invisibility_splash", - ["mcl_potions:night_vision_plus_splash"] = "mcl_potions:invisibility_plus_splash", - ["mcl_potions:poison_splash"] = "mcl_potions:harming_splash", - ["mcl_potions:poison_2_splash"] = "mcl_potions:harming_2_splash", +-- ["mcl_potions:healing_splash"] = "mcl_potions:harming_splash", +-- ["mcl_potions:swiftness_splash"] = "mcl_potions:slowness_splash", +-- ["mcl_potions:leaping_splash"] = "mcl_potions:slowness_splash", +-- ["mcl_potions:night_vision_splash"] = "mcl_potions:invisibility_splash", +-- ["mcl_potions:poison_splash"] = "mcl_potions:harming_splash", } - local splash_table = {} local lingering_table = {} -for i, potion in ipairs(potions) do - splash_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_splash" - lingering_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_lingering" +for potion, def in pairs(potions) do + if def.has_splash then + splash_table[potion] = potion.."_splash" + end + if def.has_lingering then + lingering_table[potion.."_splash"] = potion.."_lingering" + end end local mod_table = { - ["mesecons:wire_00000000_off"] = extension_table, ["mcl_potions:fermented_spider_eye"] = inversion_table, - ["mcl_nether:glowstone_dust"] = enhancement_table, ["mcl_mobitems:gunpowder"] = splash_table, ["mcl_potions:dragon_breath"] = lingering_table, } --- Compare two ingredients for compatable alchemy +local function extend_dur(potionstack) + local def = potions[potionstack:get_name()] + if not def then return false end -- somehow, it initially always fails + if not def.has_plus then return false end -- bail out if can't be extended + local potionstack = ItemStack(potionstack) + local meta = potionstack:get_meta() + local potent = meta:get_int("mcl_potions:potion_potent") + local plus = meta:get_int("mcl_potions:potion_plus") + if plus == 0 then + if potent ~= 0 then + meta:set_int("mcl_potions:potion_potent", 0) + end + meta:set_int("mcl_potions:potion_plus", def._default_extend_level) + tt.reload_itemstack_description(potionstack) + return potionstack + end + return false +end + +local function enhance_pow(potionstack) + local def = potions[potionstack:get_name()] + if not def then return false end -- somehow, it initially always fails + if not def.has_potent then return false end -- bail out if has no potent variant + local potionstack = ItemStack(potionstack) + local meta = potionstack:get_meta() + local potent = meta:get_int("mcl_potions:potion_potent") + local plus = meta:get_int("mcl_potions:potion_plus") + if potent == 0 then + if plus ~= 0 then + meta:set_int("mcl_potions:potion_plus", 0) + end + meta:set_int("mcl_potions:potion_potent", def._default_potent_level-1) + tt.reload_itemstack_description(potionstack) + return potionstack + end + return false +end + +local meta_mod_table = { + ["mesecons:wire_00000000_off"] = extend_dur, + ["mcl_nether:glowstone_dust"] = enhance_pow, +} + +-- Find an alchemical recipe for given ingredient and potion +-- returns outcome function mcl_potions.get_alchemy(ingr, pot) - if output_table[pot] then + local brew_selector = output_table[pot:get_name()] + if brew_selector and brew_selector[ingr] then + local meta = pot:get_meta():to_table() + local alchemy = ItemStack(brew_selector[ingr]) + local metaref = alchemy:get_meta() + metaref:from_table(meta) + tt.reload_itemstack_description(alchemy) + return alchemy + end - local brew_table = output_table[pot] - - if brew_table[ingr] then - return brew_table[ingr] + brew_selector = mod_table[ingr] + if brew_selector then + local brew = brew_selector[pot:get_name()] + if brew then + local meta = pot:get_meta():to_table() + local alchemy = ItemStack(brew) + local metaref = alchemy:get_meta() + metaref:from_table(meta) + tt.reload_itemstack_description(alchemy) + return alchemy end end - if mod_table[ingr] then - - local brew_table = mod_table[ingr] - - if brew_table[pot] then - return brew_table[pot] - end - + if meta_mod_table[ingr] then + local brew_func = meta_mod_table[ingr] + if brew_func then return brew_func(pot) end end return false @@ -493,10 +507,6 @@ minetest.register_globalstep(function(dtime) end) mcl_wip.register_wip_item("mcl_potions:night_vision") -mcl_wip.register_wip_item("mcl_potions:night_vision_plus") mcl_wip.register_wip_item("mcl_potions:night_vision_splash") -mcl_wip.register_wip_item("mcl_potions:night_vision_plus_splash") mcl_wip.register_wip_item("mcl_potions:night_vision_lingering") -mcl_wip.register_wip_item("mcl_potions:night_vision_plus_lingering") mcl_wip.register_wip_item("mcl_potions:night_vision_arrow") -mcl_wip.register_wip_item("mcl_potions:night_vision_plus_arrow") diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 0422bfb90..3c6b62070 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -1,5 +1,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) +mcl_potions.registered_potions = {} + local function potion_image(colorstring, opacity) if not opacity then opacity = 127 @@ -268,6 +270,7 @@ function mcl_potions.register_potion(def) sdef.on_splash = def.custom_splash_effect if not def._effect_list then sdef.instant = true end mcl_potions.register_splash(name, splash_desc, color, sdef) + pdef.has_splash = true end if def.has_lingering or def.has_lingering == nil then @@ -289,6 +292,7 @@ function mcl_potions.register_potion(def) ldef.while_lingering = def.custom_linger_effect if not def._effect_list then ldef.instant = true end mcl_potions.register_lingering(name, ling_desc, color, ldef) + pdef.has_lingering = true end if def.has_arrow then @@ -316,7 +320,10 @@ function mcl_potions.register_potion(def) adef.custom_effect = def.custom_effect if not def._effect_list then adef.instant = true end mcl_potions.register_arrow(name, arr_desc, color, adef) + pdef.has_arrow = true end + + mcl_potions.registered_potions[modname..":"..name] = pdef end mcl_potions.register_potion({ From c4bedb37e068f1c89326695fa3698f2d5197e4d9 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 2 Apr 2024 03:57:14 +0200 Subject: [PATCH 55/91] Brewing fully works with the new system --- mods/ITEMS/mcl_potions/init.lua | 4 ++-- mods/ITEMS/mcl_potions/potions.lua | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 3f9955630..4c46ec9bd 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -405,7 +405,7 @@ local mod_table = { local function extend_dur(potionstack) local def = potions[potionstack:get_name()] - if not def then return false end -- somehow, it initially always fails + if not def then return false end if not def.has_plus then return false end -- bail out if can't be extended local potionstack = ItemStack(potionstack) local meta = potionstack:get_meta() @@ -424,7 +424,7 @@ end local function enhance_pow(potionstack) local def = potions[potionstack:get_name()] - if not def then return false end -- somehow, it initially always fails + if not def then return false end if not def.has_potent then return false end -- bail out if has no potent variant local potionstack = ItemStack(potionstack) local meta = potionstack:get_meta() diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 3c6b62070..0f59a3b97 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -250,6 +250,7 @@ function mcl_potions.register_potion(def) pdef.on_place = on_use pdef.on_secondary_use = on_use + local internal_def = table.copy(pdef) minetest.register_craftitem(modname..":"..name, pdef) if def.has_splash or def.has_splash == nil then @@ -270,7 +271,7 @@ function mcl_potions.register_potion(def) sdef.on_splash = def.custom_splash_effect if not def._effect_list then sdef.instant = true end mcl_potions.register_splash(name, splash_desc, color, sdef) - pdef.has_splash = true + internal_def.has_splash = true end if def.has_lingering or def.has_lingering == nil then @@ -292,7 +293,7 @@ function mcl_potions.register_potion(def) ldef.while_lingering = def.custom_linger_effect if not def._effect_list then ldef.instant = true end mcl_potions.register_lingering(name, ling_desc, color, ldef) - pdef.has_lingering = true + internal_def.has_lingering = true end if def.has_arrow then @@ -320,10 +321,10 @@ function mcl_potions.register_potion(def) adef.custom_effect = def.custom_effect if not def._effect_list then adef.instant = true end mcl_potions.register_arrow(name, arr_desc, color, adef) - pdef.has_arrow = true + internal_def.has_arrow = true end - mcl_potions.registered_potions[modname..":"..name] = pdef + mcl_potions.registered_potions[modname..":"..name] = internal_def end mcl_potions.register_potion({ From a9c2a89f1634d7ff1163fdc0d5c0d7b5e3011344 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 2 Apr 2024 05:03:27 +0200 Subject: [PATCH 56/91] New brewing recipes registering API Also migrated all recipes to the new system --- mods/ITEMS/mcl_potions/init.lua | 142 +++++++++++++++++++++++++++----- 1 file changed, 120 insertions(+), 22 deletions(-) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 4c46ec9bd..b8b47dba7 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -337,9 +337,28 @@ minetest.register_craft({ }) + +local output_table = { } + +-- API +-- registers a potion that can be combined with multiple ingredients for different outcomes +-- out_table contains the recipes for those outcomes +function mcl_potions.register_ingredient_potion(input, out_table) + if output_table[input] then + error("Attempt to register the same ingredient twice!") + end + if type(input) ~= "string" then + error("Invalid argument! input must be a string") + end + if type(out_table) ~= "table" then + error("Invalid argument! out_table must be a table") + end + output_table[input] = out_table +end + local water_table = { ["mcl_nether:nether_wart_item"] = "mcl_potions:awkward", - -- ["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness", + ["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness", ["mcl_potions:speckled_melon"] = "mcl_potions:mundane", ["mcl_core:sugar"] = "mcl_potions:mundane", ["mcl_mobitems:magma_cream"] = "mcl_potions:mundane", @@ -351,25 +370,71 @@ local water_table = { ["mcl_nether:glowstone_dust"] = "mcl_potions:thick", ["mcl_mobitems:gunpowder"] = "mcl_potions:water_splash" } +-- API +-- register a potion recipe brewed from water +function mcl_potions.register_water_brew(ingr, potion) + if water_table[ingr] then + error("Attempt to register the same ingredient twice!") + end + if type(ingr) ~= "string" then + error("Invalid argument! ingr must be a string") + end + if type(potion) ~= "string" then + error("Invalid argument! potion must be a string") + end + water_table[ingr] = potion +end +mcl_potions.register_ingredient_potion("mcl_potions:river_water", water_table) +mcl_potions.register_ingredient_potion("mcl_potions:water", water_table) local awkward_table = { ["mcl_potions:speckled_melon"] = "mcl_potions:healing", ["mcl_farming:carrot_item_gold"] = "mcl_potions:night_vision", ["mcl_core:sugar"] = "mcl_potions:swiftness", ["mcl_mobitems:magma_cream"] = "mcl_potions:fire_resistance", - -- ["mcl_mobitems:blaze_powder"] = "mcl_potions:strength", + ["mcl_mobitems:blaze_powder"] = "mcl_potions:strength", ["mcl_fishing:pufferfish_raw"] = "mcl_potions:water_breathing", ["mcl_mobitems:ghast_tear"] = "mcl_potions:regeneration", ["mcl_mobitems:spider_eye"] = "mcl_potions:poison", ["mcl_flowers:wither_rose"] = "mcl_potions:withering", ["mcl_mobitems:rabbit_foot"] = "mcl_potions:leaping", } +-- API +-- register a potion recipe brewed from awkward potion +function mcl_potions.register_awkward_brew(ingr, potion) + if awkward_table[ingr] then + error("Attempt to register the same ingredient twice!") + end + if type(ingr) ~= "string" then + error("Invalid argument! ingr must be a string") + end + if type(potion) ~= "string" then + error("Invalid argument! potion must be a string") + end + awkward_table[ingr] = potion +end +mcl_potions.register_ingredient_potion("mcl_potions:awkward", awkward_table) -local output_table = { - ["mcl_potions:river_water"] = water_table, - ["mcl_potions:water"] = water_table, - ["mcl_potions:awkward"] = awkward_table, -} +-- TODO mundane and thick potion recipes + + +local mod_table = { } + +-- API +-- registers a brewing recipe altering the potion using a table +-- this is supposed to substitute one item with another +function mcl_potions.register_table_modifier(ingr, modifier) + if mod_table[ingr] then + error("Attempt to register the same ingredient twice!") + end + if type(ingr) ~= "string" then + error("Invalid argument! ingr must be a string") + end + if type(modifier) ~= "table" then + error("Invalid argument! modifier must be a table") + end + mod_table[ingr] = modifier +end local inversion_table = { ["mcl_potions:healing"] = "mcl_potions:harming", @@ -377,16 +442,37 @@ local inversion_table = { ["mcl_potions:leaping"] = "mcl_potions:slowness", ["mcl_potions:night_vision"] = "mcl_potions:invisibility", ["mcl_potions:poison"] = "mcl_potions:harming", --- ["mcl_potions:healing_splash"] = "mcl_potions:harming_splash", --- ["mcl_potions:swiftness_splash"] = "mcl_potions:slowness_splash", --- ["mcl_potions:leaping_splash"] = "mcl_potions:slowness_splash", --- ["mcl_potions:night_vision_splash"] = "mcl_potions:invisibility_splash", --- ["mcl_potions:poison_splash"] = "mcl_potions:harming_splash", } +-- API +function mcl_potions.register_inversion_recipe(input, output) + if inversion_table[input] then + error("Attempt to register the same input twice!") + end + if type(input) ~= "string" then + error("Invalid argument! input must be a string") + end + if type(output) ~= "string" then + error("Invalid argument! output must be a string") + end + inversion_table[input] = output +end +local function fill_inversion_table() -- autofills with splash and lingering inversion recipes + local filling_table = { } + for input, output in pairs(inversion_table) do + if potions[input].has_splash and potions[output].has_splash then + filling_table[input.."_splash"] = output .. "_splash" + if potions[input].has_lingering and potions[output].has_lingering then + filling_table[input.."_lingering"] = output .. "_lingering" + end + end + end + table.update(inversion_table, filling_table) + mcl_potions.register_table_modifier("mcl_potions:fermented_spider_eye", inversion_table) +end +minetest.register_on_mods_loaded(fill_inversion_table) local splash_table = {} local lingering_table = {} - for potion, def in pairs(potions) do if def.has_splash then splash_table[potion] = potion.."_splash" @@ -395,13 +481,27 @@ for potion, def in pairs(potions) do lingering_table[potion.."_splash"] = potion.."_lingering" end end +mcl_potions.register_table_modifier("mcl_mobitems:gunpowder", splash_table) +mcl_potions.register_table_modifier("mcl_potions:dragon_breath", lingering_table) -local mod_table = { - ["mcl_potions:fermented_spider_eye"] = inversion_table, - ["mcl_mobitems:gunpowder"] = splash_table, - ["mcl_potions:dragon_breath"] = lingering_table, -} +local meta_mod_table = { } + +-- API +-- registers a brewing recipe altering the potion using a function +-- this is supposed to be a recipe that changes metadata only +function mcl_potions.register_meta_modifier(ingr, mod_func) + if meta_mod_table[ingr] then + error("Attempt to register the same ingredient twice!") + end + if type(ingr) ~= "string" then + error("Invalid argument! ingr must be a string") + end + if type(mod_func) ~= "function" then + error("Invalid argument! mod_func must be a function") + end + meta_mod_table[ingr] = mod_func +end local function extend_dur(potionstack) local def = potions[potionstack:get_name()] @@ -421,6 +521,7 @@ local function extend_dur(potionstack) end return false end +mcl_potions.register_meta_modifier("mesecons:wire_00000000_off", extend_dur) local function enhance_pow(potionstack) local def = potions[potionstack:get_name()] @@ -440,11 +541,8 @@ local function enhance_pow(potionstack) end return false end +mcl_potions.register_meta_modifier("mcl_nether:glowstone_dust", enhance_pow) -local meta_mod_table = { - ["mesecons:wire_00000000_off"] = extend_dur, - ["mcl_nether:glowstone_dust"] = enhance_pow, -} -- Find an alchemical recipe for given ingredient and potion -- returns outcome From ced2741686d7e9681121e96cfad31ca3d9ba6011 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 8 Apr 2024 22:58:16 +0200 Subject: [PATCH 57/91] Added strength and weakness potions Also fixed potent slowness potion level Also fixed slowness and swiftness effect descriptions --- mods/ITEMS/mcl_potions/functions.lua | 4 +- mods/ITEMS/mcl_potions/potions.lua | 142 +++++---------------------- 2 files changed, 25 insertions(+), 121 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index e12e61fa5..5e9eec315 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -260,7 +260,7 @@ mcl_potions.register_effect({ name = "strength", description = S("Strength"), get_tt = function(factor) - return S("+@1% melee damage", factor-1) + return S("+@1% melee damage", 100*(factor-1)) end, particle_color = "#932423", uses_factor = true, @@ -272,7 +272,7 @@ mcl_potions.register_effect({ name = "weakness", description = S("Weakness"), get_tt = function(factor) - return S("-@1% melee damage", 1-factor) + return S("-@1% melee damage", 100*(1-factor)) end, particle_color = "#485D48", uses_factor = true, diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 0f59a3b97..3ebb3aad8 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -468,6 +468,7 @@ mcl_potions.register_potion({ _effect_list = { slowness = {dur=mcl_potions.DURATION_INV}, }, + default_potent_level = 4, has_arrow = true, }) @@ -555,124 +556,27 @@ mcl_potions.register_potion({ has_arrow = true, }) +mcl_potions.register_potion({ + name = "strength", + desc_suffix = S("of Strength"), + _tt = nil, + _longdesc = S("Increases attack power."), + color = "#932423", + _effect_list = { + strength = {}, + }, + has_arrow = true, +}) +mcl_potions.register_potion({ + name = "weakness", + desc_suffix = S("of Weakness"), + _tt = nil, + _longdesc = S("Decreases attack power."), + color = "#484D48", + _effect_list = { + weakness = {}, + }, + has_arrow = true, +}) --- minetest.register_craftitem("mcl_potions:weakness", { --- description = S("Weakness"), --- _tt_help = TODO, --- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#484D48"), --- inventory_image = potion_image("#484D48"), --- groups = { brewitem=1, food=3, can_eat_when_full=1 }, --- stack_max = 1, --- --- on_place = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#484D48") --- return itemstack --- end, --- --- on_secondary_use = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#484D48") --- return itemstack --- end --- }) --- --- minetest.register_craftitem("mcl_potions:weakness_plus", { --- description = S("Weakness +"), --- _tt_help = TODO, --- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#484D48"), --- inventory_image = potion_image("#484D48"), --- groups = { brewitem=1, food=3, can_eat_when_full=1 }, --- stack_max = 1, --- --- on_place = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#484D48") --- return itemstack --- end, --- --- on_secondary_use = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#484D48") --- return itemstack --- end --- }) --- --- minetest.register_craftitem("mcl_potions:strength", { --- description = S("Strength"), --- _tt_help = TODO, --- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#932423"), --- inventory_image = potion_image("#932423"), --- groups = { brewitem=1, food=3, can_eat_when_full=1 }, --- stack_max = 1, --- --- on_place = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#932423") --- return itemstack --- end, --- --- on_secondary_use = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#932423") --- return itemstack --- end --- }) --- --- minetest.register_craftitem("mcl_potions:strength_2", { --- description = S("Strength II"), --- _tt_help = TODO, --- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#932423"), --- inventory_image = potion_image("#932423"), --- groups = { brewitem=1, food=3, can_eat_when_full=1 }, --- stack_max = 1, --- --- on_place = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#932423") --- return itemstack --- end, --- --- on_secondary_use = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#932423") --- return itemstack --- end --- }) --- --- minetest.register_craftitem("mcl_potions:strength_plus", { --- description = S("Strength +"), --- _tt_help = TODO, --- _doc_items_longdesc = brewhelp, --- wield_image = potion_image("#932423"), --- inventory_image = potion_image("#932423"), --- groups = { brewitem=1, food=3, can_eat_when_full=1 }, --- stack_max = 1, --- --- on_place = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#932423") --- return itemstack --- end, --- --- on_secondary_use = function(itemstack, user, pointed_thing) --- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) --- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) --- mcl_potions._use_potion(itemstack, user, "#932423") --- return itemstack --- end --- }) From 8cfe96a955ebfcb7dab8cd9c65c399ef57b84901 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 9 Apr 2024 00:25:31 +0200 Subject: [PATCH 58/91] Added potions for new effects * also added some new brewing recipes --- mods/ITEMS/mcl_potions/functions.lua | 2 +- mods/ITEMS/mcl_potions/init.lua | 18 +++ mods/ITEMS/mcl_potions/potions.lua | 228 ++++++++++++++++++++++++++- 3 files changed, 246 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 5e9eec315..9a2b760d1 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -569,7 +569,7 @@ mcl_potions.register_effect({ end EF.glowing[object].waypoints = {} end, - particle_color = "#FFFF00", + particle_color = "#FFFF77", uses_factor = false, }) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index b8b47dba7..f8b77145f 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -398,6 +398,21 @@ local awkward_table = { ["mcl_mobitems:spider_eye"] = "mcl_potions:poison", ["mcl_flowers:wither_rose"] = "mcl_potions:withering", ["mcl_mobitems:rabbit_foot"] = "mcl_potions:leaping", + + ["mcl_flowers:fourleaf_clover"] = "mcl_potions:luck", + ["mcl_farming:potato_item_poison"] = "mcl_potions:nausea", + -- TODO slow falling + -- TODO levitation? + -- TODO darkness? + -- TODO absorption + -- TODO health boost? + -- TODO resistance + -- TODO turtle master? + -- TODO frost + -- TODO blindness? + -- TODO food poisoning? + -- TODO saturation? + -- TODO haste } -- API -- register a potion recipe brewed from awkward potion @@ -416,6 +431,7 @@ end mcl_potions.register_ingredient_potion("mcl_potions:awkward", awkward_table) -- TODO mundane and thick potion recipes +-- TODO glowing out of thick local mod_table = { } @@ -442,6 +458,8 @@ local inversion_table = { ["mcl_potions:leaping"] = "mcl_potions:slowness", ["mcl_potions:night_vision"] = "mcl_potions:invisibility", ["mcl_potions:poison"] = "mcl_potions:harming", + ["mcl_potions:luck"] = "mcl_potions:bad_luck", + ["mcl_potions:haste"] = "mcl_potions:fatigue", } -- API function mcl_potions.register_inversion_recipe(input, output) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 3ebb3aad8..bd5760455 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -489,7 +489,7 @@ mcl_potions.register_potion({ desc_suffix = S("of Withering"), _tt = nil, _longdesc = S("Applies the withering effect which deals damage at a regular interval and can kill."), - color = "#000000", + color = "#292929", _effect_list = { withering = {dur=mcl_potions.DURATION_POISON}, }, @@ -580,3 +580,229 @@ mcl_potions.register_potion({ has_arrow = true, }) +mcl_potions.register_potion({ + name = "slow_falling", + desc_suffix = S("of Slow Falling"), + _tt = nil, + _longdesc = S("Instead of falling, you descend gracefully."), + color = "#ACCCFF", + _effect_list = { + slow_falling = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "levitation", + desc_suffix = S("of Levitation"), + _tt = nil, + _longdesc = S("Floats body slowly upwards."), + color = "#420E7E", + _effect_list = { + levitation = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "darkness", + desc_suffix = S("of Darkness"), + _tt = nil, + _longdesc = S("Surrounds with darkness."), + color = "#000000", + _effect_list = { + darkness = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "glowing", + desc_suffix = S("of Glowing"), + _tt = nil, + _longdesc = S("Highlights for others to see."), + color = "#FFFF77", + _effect_list = { + glowing = {}, + }, + has_arrow = false, -- TODO add a spectral arrow instead (in mcl_bows?) +}) + +mcl_potions.register_potion({ + name = "health_boost", + desc_suffix = S("of Health Boost"), + _tt = nil, + _longdesc = S("Increases health."), + color = "#FF2222", + _effect_list = { + health_boost = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "absorption", + desc_suffix = S("of Absorption"), + _tt = nil, + _longdesc = S("Absorbs some incoming damage."), + color = "#B59500", + _effect_list = { + absorption = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "resistance", + desc_suffix = S("of Resistance"), + _tt = nil, + _longdesc = S("Descreases damage taken."), + color = "#2552A5", + _effect_list = { + resistance = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "resistance", + desc_suffix = S("of Resistance"), + _tt = nil, + _longdesc = S("Descreases damage taken."), + color = "#2552A5", + _effect_list = { + resistance = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "turtle_master", + desc_suffix = S("of Turtle Master"), + _tt = nil, + _longdesc = S("Descreases damage taken at the cost of speed."), + color = "#255235", + _effect_list = { + resistance = { + level = 3, + dur = 20, + }, + slowness = { + level = 4, + level_scaling = 2, + dur = 20, + }, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "luck", + desc_suffix = S("of Luck"), + _tt = nil, + _longdesc = S("Increases luck."), + color = "#7BFF42", + _effect_list = { + luck = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "bad_luck", + desc_suffix = S("of Bad Luck"), + _tt = nil, + _longdesc = S("Decreases luck."), + color = "#887343", + _effect_list = { + bad_luck = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "frost", + desc_suffix = S("of Frost"), + _tt = nil, + _longdesc = S("Freezes..."), + color = "#5B7DAA", + _effect_list = { + frost = {}, + }, + has_arrow = true, + -- TODO implement effect stacking? +}) + +mcl_potions.register_potion({ + name = "blindness", + desc_suffix = S("of Blindness"), + _tt = nil, + _longdesc = S("Impairs sight."), + color = "#586868", + _effect_list = { + blindness = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "nausea", + desc_suffix = S("of Nausea"), + _tt = nil, + _longdesc = S("Disintegrates senses."), + color = "#715C7F", + _effect_list = { + nausea = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "food_poisoning", + desc_suffix = S("of Food Poisoning"), + _tt = nil, + _longdesc = S("Moves bowels too fast."), + color = "#83A061", + _effect_list = { + food_poisoning = {}, + }, + has_arrow = true, + -- TODO implement effect stacking? +}) + +mcl_potions.register_potion({ + name = "saturation", + desc_suffix = S("of Saturation"), + _tt = nil, + _longdesc = S("Satisfies hunger."), + color = "#CEAE29", + _effect_list = { + saturation = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "haste", + desc_suffix = S("of Haste"), + _tt = nil, + _longdesc = S("Increases digging and attack speed."), + color = "#FFFF00", + _effect_list = { + haste = {}, + }, + has_arrow = true, +}) + +mcl_potions.register_potion({ + name = "fatigue", + desc_suffix = S("of Fatigue"), + _tt = nil, + _longdesc = S("Decreases digging and attack speed."), + color = "#64643D", + _effect_list = { + fatigue = {}, + }, + has_arrow = true, +}) + From b5367a77a748578dc31dd494a4149d92c4b4531a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 9 Apr 2024 01:11:31 +0200 Subject: [PATCH 59/91] Expanded brewing recipe API Added recipes using thick or mundane potion --- mods/ITEMS/mcl_potions/init.lua | 39 +++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index f8b77145f..189a014dc 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -430,8 +430,43 @@ function mcl_potions.register_awkward_brew(ingr, potion) end mcl_potions.register_ingredient_potion("mcl_potions:awkward", awkward_table) --- TODO mundane and thick potion recipes --- TODO glowing out of thick +local mundane_table = { + ["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness", +} +-- API +-- register a potion recipe brewed from mundane potion +function mcl_potions.register_mundane_brew(ingr, potion) + if mundane_table[ingr] then + error("Attempt to register the same ingredient twice!") + end + if type(ingr) ~= "string" then + error("Invalid argument! ingr must be a string") + end + if type(potion) ~= "string" then + error("Invalid argument! potion must be a string") + end + mundane_table[ingr] = potion +end +mcl_potions.register_ingredient_potion("mcl_potions:mundane", mundane_table) + +local thick_table = { + -- TODO glowing from some shining cave flowers +} +-- API +-- register a potion recipe brewed from thick potion +function mcl_potions.register_thick_brew(ingr, potion) + if thick_table[ingr] then + error("Attempt to register the same ingredient twice!") + end + if type(ingr) ~= "string" then + error("Invalid argument! ingr must be a string") + end + if type(potion) ~= "string" then + error("Invalid argument! potion must be a string") + end + thick_table[ingr] = potion +end +mcl_potions.register_ingredient_potion("mcl_potions:thick", thick_table) local mod_table = { } From 7c1f9805e276b792418ebfadfa4ee35f1d443fd8 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 9 Apr 2024 01:44:52 +0200 Subject: [PATCH 60/91] Tooltip and color fixes --- mods/ITEMS/mcl_potions/functions.lua | 7 ++++--- mods/ITEMS/mcl_potions/potions.lua | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 9a2b760d1..edf1dae5c 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -463,7 +463,7 @@ mcl_potions.register_effect({ name = "darkness", description = S("Darkness"), get_tt = function(factor) - return S("surrounded by darkness\nnot seeing anything beyond @1 nodes", factor) + return S("surrounded by darkness").."\n"..S("not seeing anything beyond @1 nodes", factor) end, res_condition = function(object) return (not object:is_player()) @@ -751,6 +751,7 @@ mcl_potions.register_effect({ on_start = function(object, factor) mcl_burning.extinguish(object) playerphysics.add_physics_factor(object, "speed", "mcl_potions:frost", 1-factor) + if EF.frost[object].vignette then return end EF.frost[object].vignette = object:hud_add({ hud_elem_type = "image", position = {x = 0.5, y = 0.5}, @@ -838,7 +839,7 @@ mcl_potions.register_effect({ name = "nausea", description = S("Nausea"), get_tt = function(factor) - return S("not feeling very well...\nfrequency: @1 / 1 s", factor) + return S("not feeling very well...").."\n"..S("frequency: @1 / 1 s", factor) end, res_condition = function(object) return (not object:is_player()) @@ -1026,7 +1027,7 @@ mcl_potions.register_effect({ name = "conduit_power", description = S("Conduit Power"), get_tt = function(factor) - return S("+@1% mining and attack speed in water\nlimitless breathing under water", math.floor(factor*100)) + return S("+@1% mining and attack speed in water").."\n"..S("limitless breathing under water", math.floor(factor*100)) end, res_condition = function(object) return (not object:is_player()) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index bd5760455..6199ea5df 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -633,7 +633,7 @@ mcl_potions.register_potion({ desc_suffix = S("of Health Boost"), _tt = nil, _longdesc = S("Increases health."), - color = "#FF2222", + color = "#BE1919", _effect_list = { health_boost = {}, }, From 7c2d74e983b2eea50b717d04eccaa8328ced2a22 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 14 Apr 2024 01:31:04 +0200 Subject: [PATCH 61/91] Typos fixed --- mods/ITEMS/mcl_potions/potions.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 6199ea5df..7e12d9a94 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -656,7 +656,7 @@ mcl_potions.register_potion({ name = "resistance", desc_suffix = S("of Resistance"), _tt = nil, - _longdesc = S("Descreases damage taken."), + _longdesc = S("Decreases damage taken."), color = "#2552A5", _effect_list = { resistance = {}, @@ -668,7 +668,7 @@ mcl_potions.register_potion({ name = "resistance", desc_suffix = S("of Resistance"), _tt = nil, - _longdesc = S("Descreases damage taken."), + _longdesc = S("Decreases damage taken."), color = "#2552A5", _effect_list = { resistance = {}, @@ -680,7 +680,7 @@ mcl_potions.register_potion({ name = "turtle_master", desc_suffix = S("of Turtle Master"), _tt = nil, - _longdesc = S("Descreases damage taken at the cost of speed."), + _longdesc = S("Decreases damage taken at the cost of speed."), color = "#255235", _effect_list = { resistance = { From dcbc9d2398aa1bb1d2363c34300c1a15b20e346a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 14 Apr 2024 04:04:04 +0200 Subject: [PATCH 62/91] Allowed giving effect without particles ...both with API and the /effect command --- mods/ITEMS/mcl_potions/commands.lua | 20 +++++++++++++++----- mods/ITEMS/mcl_potions/functions.lua | 13 +++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index 7b420f801..d1280c645 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -9,8 +9,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) minetest.register_chatcommand("effect",{ - params = S("|heal|list [] []"), - description = S("Add a status effect to yourself. Arguments: : name of status effect. Passing \"list\" as effect name lists available effects. Passing \"heal\" as effect name heals (or harms) by amount designed by the next parameter. : duration in seconds. (: amount of healing when the effect is \"heal\", passing a negative value subtracts health.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor."), + params = S("|heal|list [] [] [NOPART]"), + description = S("Add a status effect to yourself. Arguments: : name of status effect. Passing \"list\" as effect name lists available effects. Passing \"heal\" as effect name heals (or harms) by amount designed by the next parameter. : duration in seconds. (: amount of healing when the effect is \"heal\", passing a negative value subtracts health.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor. NOPART at the end means no particles will be shown for this effect."), privs = {server = true}, func = function(name, params) @@ -45,7 +45,7 @@ minetest.register_chatcommand("effect",{ end elseif not tonumber(P[2]) then return false, S("Missing or invalid duration parameter!") - elseif P[3] and not tonumber(P[3]) and P[3] ~= "F" then + elseif P[3] and not tonumber(P[3]) and P[3] ~= "F" and P[3] ~= "NOPART" then return false, S("Invalid level parameter!") elseif P[3] and P[3] == "F" and not P[4] then return false, S("Missing or invalid factor parameter when level is F!") @@ -54,12 +54,22 @@ minetest.register_chatcommand("effect",{ -- Default level = 1 if not P[3] then P[3] = 1 + elseif P[3] == "NOPART" then + P[3] = 1 + P[4] = "NOPART" + end + + local nopart = false + if P[3] == "F" then + nopart = P[5] == "NOPART" + else + nopart = P[4] == "NOPART" end local def = mcl_potions.registered_effects[P[1]] if def then if P[3] == "F" then - local given = mcl_potions.give_effect(P[1], minetest.get_player_by_name(name), tonumber(P[4]), tonumber(P[2])) + local given = mcl_potions.give_effect(P[1], minetest.get_player_by_name(name), tonumber(P[4]), tonumber(P[2]), nopart) if given then if def.uses_factor then return true, S("@1 effect given to player @2 for @3 seconds with factor of @4.", def.description, name, P[2], P[4]) @@ -70,7 +80,7 @@ minetest.register_chatcommand("effect",{ return false, S("Giving effect @1 to player @2 failed.", def.description, name) end else - local given = mcl_potions.give_effect_by_level(P[1], minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2])) + local given = mcl_potions.give_effect_by_level(P[1], minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2]), nopart) if given then if def.uses_factor then return true, S("@1 effect on level @2 given to player @3 for @4 seconds.", def.description, P[3], name, P[2]) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index edf1dae5c..7d97df5ee 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1311,7 +1311,7 @@ minetest.register_globalstep(function(dtime) for object, vals in pairs(EF[name]) do EF[name][object].timer = vals.timer + dtime - if object:get_pos() then mcl_potions._add_spawner(object, effect.particle_color) end + if object:get_pos() and not vals.no_particles then mcl_potions._add_spawner(object, effect.particle_color) end if effect.on_step then effect.on_step(dtime, object, vals.factor, vals.dur) end if effect.on_hit_timer then EF[name][object].hit_timer = (vals.hit_timer or 0) + dtime @@ -1702,11 +1702,11 @@ local function target_valid(object, name) and registered_effects[name].res_condition(object)) then return true end end -function mcl_potions.give_effect(name, object, factor, duration) +function mcl_potions.give_effect(name, object, factor, duration, no_particles) local edef = registered_effects[name] if not edef or not target_valid(object, name) then return false end if not EF[name][object] then - local vals = {dur = duration, timer = 0,} + local vals = {dur = duration, timer = 0, no_particles = no_particles} if edef.uses_factor then vals.factor = factor end if edef.on_hit_timer then if edef.timer_uses_factor then vals.step = factor @@ -1716,6 +1716,7 @@ function mcl_potions.give_effect(name, object, factor, duration) if edef.on_start then edef.on_start(object, factor) end else local present = EF[name][object] + present.no_particles = no_particles if not edef.uses_factor or (edef.uses_factor and (not edef.inv_factor and factor >= present.factor or edef.inv_factor and factor <= present.factor)) then @@ -1736,13 +1737,13 @@ function mcl_potions.give_effect(name, object, factor, duration) return true end -function mcl_potions.give_effect_by_level(name, object, level, duration) +function mcl_potions.give_effect_by_level(name, object, level, duration, no_particles) if level == 0 then return false end if not registered_effects[name].uses_factor then - return mcl_potions.give_effect(name, object, 0, duration) + return mcl_potions.give_effect(name, object, 0, duration, no_particles) end local factor = registered_effects[name].level_to_factor(level) - return mcl_potions.give_effect(name, object, factor, duration) + return mcl_potions.give_effect(name, object, factor, duration, no_particles) end function mcl_potions.healing_func(object, hp) From 75e5ca8d49f26666e8fbae8f34af9aa45ea4bc3a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 14 Apr 2024 04:27:09 +0200 Subject: [PATCH 63/91] Added the option to remove and clear effects... ...with the /effect command. Also made the API for clearing effects more robust. --- mods/ITEMS/mcl_potions/commands.lua | 17 +++++++++++++++-- mods/ITEMS/mcl_potions/functions.lua | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index d1280c645..c977b8c1c 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -9,8 +9,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) minetest.register_chatcommand("effect",{ - params = S("|heal|list [] [] [NOPART]"), - description = S("Add a status effect to yourself. Arguments: : name of status effect. Passing \"list\" as effect name lists available effects. Passing \"heal\" as effect name heals (or harms) by amount designed by the next parameter. : duration in seconds. (: amount of healing when the effect is \"heal\", passing a negative value subtracts health.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor. NOPART at the end means no particles will be shown for this effect."), + params = S("|heal|list|clear|remove [] [] [NOPART]"), + description = S("Add a status effect to yourself. Arguments: : name of status effect. Passing \"list\" as effect name lists available effects. Passing \"heal\" as effect name heals (or harms) by amount designed by the next parameter. Passing \"clear\" as effect name removes all effects. Passing \"remove\" as effect name removes the effect named by the next parameter. : duration in seconds. (: amount of healing when the effect is \"heal\", passing a negative value subtracts health. : name of a status effect to be removed when using \"remove\" as the previous parameter.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor. NOPART at the end means no particles will be shown for this effect."), privs = {server = true}, func = function(name, params) @@ -43,6 +43,19 @@ minetest.register_chatcommand("effect",{ return true, S("Player @1 harmed by @2 HP.", name, hp) end end + elseif P[1] == "clear" then + mcl_potions._reset_player_effects(minetest.get_player_by_name(name)) + return true, S("Effects cleared for player @1", name) + elseif P[1] == "remove" then + if not P[2] then + return false, S("Missing effect parameter!") + end + if mcl_potions.registered_effects[P[2]] then + mcl_potions.clear_effect(minetest.get_player_by_name(name), P[2]) + return true, S("Removed effect @1 from player @2", P[2], name) + else + return false, S("@1 is not an available status effect.", P[2]) + end elseif not tonumber(P[2]) then return false, S("Missing or invalid duration parameter!") elseif P[3] and not tonumber(P[3]) and P[3] ~= "F" and P[3] ~= "NOPART" then diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 7d97df5ee..f63ca6e03 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1385,12 +1385,18 @@ function mcl_potions._reset_player_effects(player, set_hud) return end + local removed_effects = {} for name, effect in pairs(registered_effects) do if EF[name][player] and effect.on_end then effect.on_end(player) end + if effect.after_end then table.insert(removed_effects, effect.after_end) end end mcl_potions._clear_cached_player_data(player) + for i=1, #removed_effects do + removed_effects[i](player) + end + if set_hud ~= false then potions_set_hud(player) end @@ -1535,7 +1541,16 @@ function mcl_potions.get_total_fatigue(object) end function mcl_potions.clear_effect(object, effect) - EF[effect][object] = nil + if not EF[effect] then + minetest.log("warning", "[mcl_potions] Tried to remove an effect that is not registered: " .. dump(effect)) + return false + end + local def = registered_effects[effect] + if EF[effect][object] then + if def.on_end then def.on_end(object) end + EF[effect][object] = nil + if def.after_end then def.after_end(object) end + end if not object:is_player() then return end potions_set_hud(object) end From 9b501bfa7e550d31c1749635516b4ef22ed576d3 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 14 Apr 2024 04:50:24 +0200 Subject: [PATCH 64/91] Allowed infinite effect duration --- mods/ITEMS/mcl_potions/commands.lua | 12 +++++++----- mods/ITEMS/mcl_potions/functions.lua | 27 +++++++++++++++++++++------ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index c977b8c1c..4b4aa0ba7 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -9,8 +9,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) minetest.register_chatcommand("effect",{ - params = S("|heal|list|clear|remove [] [] [NOPART]"), - description = S("Add a status effect to yourself. Arguments: : name of status effect. Passing \"list\" as effect name lists available effects. Passing \"heal\" as effect name heals (or harms) by amount designed by the next parameter. Passing \"clear\" as effect name removes all effects. Passing \"remove\" as effect name removes the effect named by the next parameter. : duration in seconds. (: amount of healing when the effect is \"heal\", passing a negative value subtracts health. : name of a status effect to be removed when using \"remove\" as the previous parameter.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor. NOPART at the end means no particles will be shown for this effect."), + params = S("|heal|list|clear|remove |INF [] [] [NOPART]"), + description = S("Add a status effect to yourself. Arguments: : name of status effect. Passing \"list\" as effect name lists available effects. Passing \"heal\" as effect name heals (or harms) by amount designed by the next parameter. Passing \"clear\" as effect name removes all effects. Passing \"remove\" as effect name removes the effect named by the next parameter. : duration in seconds. Passing \"INF\" as duration makes the effect infinite. (: amount of healing when the effect is \"heal\", passing a negative value subtracts health. : name of a status effect to be removed when using \"remove\" as the previous parameter.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor. NOPART at the end means no particles will be shown for this effect."), privs = {server = true}, func = function(name, params) @@ -56,7 +56,7 @@ minetest.register_chatcommand("effect",{ else return false, S("@1 is not an available status effect.", P[2]) end - elseif not tonumber(P[2]) then + elseif not tonumber(P[2]) and P[2] ~= "INF" then return false, S("Missing or invalid duration parameter!") elseif P[3] and not tonumber(P[3]) and P[3] ~= "F" and P[3] ~= "NOPART" then return false, S("Invalid level parameter!") @@ -72,6 +72,8 @@ minetest.register_chatcommand("effect",{ P[4] = "NOPART" end + local inf = P[2] == "INF" + local nopart = false if P[3] == "F" then nopart = P[5] == "NOPART" @@ -82,7 +84,7 @@ minetest.register_chatcommand("effect",{ local def = mcl_potions.registered_effects[P[1]] if def then if P[3] == "F" then - local given = mcl_potions.give_effect(P[1], minetest.get_player_by_name(name), tonumber(P[4]), tonumber(P[2]), nopart) + local given = mcl_potions.give_effect(P[1], minetest.get_player_by_name(name), tonumber(P[4]), inf and "INF" or tonumber(P[2]), nopart) if given then if def.uses_factor then return true, S("@1 effect given to player @2 for @3 seconds with factor of @4.", def.description, name, P[2], P[4]) @@ -93,7 +95,7 @@ minetest.register_chatcommand("effect",{ return false, S("Giving effect @1 to player @2 failed.", def.description, name) end else - local given = mcl_potions.give_effect_by_level(P[1], minetest.get_player_by_name(name), tonumber(P[3]), tonumber(P[2]), nopart) + local given = mcl_potions.give_effect_by_level(P[1], minetest.get_player_by_name(name), tonumber(P[3]), inf and "INF" or tonumber(P[2]), nopart) if given then if def.uses_factor then return true, S("@1 effect on level @2 given to player @3 for @4 seconds.", def.description, P[3], name, P[2]) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index f63ca6e03..d36b8db62 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1272,8 +1272,12 @@ local function potions_set_icons(player) else player:hud_change(label, "text", "") end - local dur = math.round(vals.dur-vals.timer) - player:hud_change(timestamp, "text", math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))) + if vals.dur == math.huge then + player:hud_change(timestamp, "text", "∞") + else + local dur = math.round(vals.dur-vals.timer) + player:hud_change(timestamp, "text", math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))) + end EF[effect_name][player].hud_index = i i = i + 1 end @@ -1309,7 +1313,7 @@ end minetest.register_globalstep(function(dtime) for name, effect in pairs(registered_effects) do for object, vals in pairs(EF[name]) do - EF[name][object].timer = vals.timer + dtime + if vals.dur ~= math.huge then EF[name][object].timer = vals.timer + dtime end if object:get_pos() and not vals.no_particles then mcl_potions._add_spawner(object, effect.particle_color) end if effect.on_step then effect.on_step(dtime, object, vals.factor, vals.dur) end @@ -1331,9 +1335,14 @@ minetest.register_globalstep(function(dtime) potions_set_hud(object) end elseif object:is_player() then - local dur = math.round(vals.dur-vals.timer) - object:hud_change(icon_ids[object:get_player_name()][vals.hud_index].timestamp, - "text", math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))) + if vals.dur == math.huge then + object:hud_change(icon_ids[object:get_player_name()][vals.hud_index].timestamp, + "text", "∞") + else + local dur = math.round(vals.dur-vals.timer) + object:hud_change(icon_ids[object:get_player_name()][vals.hud_index].timestamp, + "text", math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))) + end end end end @@ -1727,6 +1736,9 @@ function mcl_potions.give_effect(name, object, factor, duration, no_particles) if edef.timer_uses_factor then vals.step = factor else vals.step = edef.hit_timer_step end end + if duration == "INF" then + vals.dur = math.huge + end EF[name][object] = vals if edef.on_start then edef.on_start(object, factor) end else @@ -1742,6 +1754,9 @@ function mcl_potions.give_effect(name, object, factor, duration, no_particles) if edef.timer_uses_factor then present.step = factor end if edef.on_start then edef.on_start(object, factor) end end + if duration == "INF" then + present.dur = math.huge + end else return false end From 70d8dfe558fe002464bec564677738dbd53a969a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 14 Apr 2024 07:45:39 +0200 Subject: [PATCH 65/91] Improved API mob support * various API functions now work with mobs properly * the following effects don't work with mobs at all: water breathing, dolphin's grace, leaping, swiftness, slowness, slow falling, night vision, darkness, frost, health boost, absorption, fire resistance, resistance, luck, bad luck, blindness, nausea, hunger, saturation, haste, fatigue, conduit power * the following effects should work with mobs: invisibility, regeneration, poison, withering, strength, weakness, levitation, glowing * the following effects have no effect on mobs (but can be applied with the API): bad omen, hero of the village --- mods/ITEMS/mcl_campfires/api.lua | 2 +- mods/ITEMS/mcl_mobitems/init.lua | 2 +- mods/ITEMS/mcl_nether/init.lua | 2 +- mods/ITEMS/mcl_potions/commands.lua | 2 +- mods/ITEMS/mcl_potions/functions.lua | 93 +++++++++++++++++----------- 5 files changed, 62 insertions(+), 39 deletions(-) diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index ba6a55960..98318f3f1 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -380,7 +380,7 @@ minetest.register_globalstep(function(dtime) etime = 0 for _,pl in pairs(minetest.get_connected_players()) do local armor_feet = pl:get_inventory():get_stack("armor", 5) - if pl and pl:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.has_effect(pl, "fire_proof")) then + if pl and pl:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.has_effect(pl, "fire_resistance")) then return end burn_in_campfire(pl) diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 182bc8ced..01b9a5039 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -154,7 +154,7 @@ local function drink_milk_delayed(itemstack, player, pointed_thing) ) then mcl_hunger.stop_poison(player) end - mcl_potions._reset_player_effects(player) + mcl_potions._reset_effects(player) end -- Wrapper for handling mcl_hunger delayed eating diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index 3a57ae427..b69355d5d 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -135,7 +135,7 @@ minetest.register_node("mcl_nether:magma", { -- From walkover mod on_walk_over = function(loc, nodeiamon, player) local armor_feet = player:get_inventory():get_stack("armor", 5) - if player and player:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.has_effect(player, "fire_proof")) then + if player and player:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.has_effect(player, "fire_resistance")) then return end -- Hurt players standing on top of this block diff --git a/mods/ITEMS/mcl_potions/commands.lua b/mods/ITEMS/mcl_potions/commands.lua index 4b4aa0ba7..1c2cd7347 100644 --- a/mods/ITEMS/mcl_potions/commands.lua +++ b/mods/ITEMS/mcl_potions/commands.lua @@ -44,7 +44,7 @@ minetest.register_chatcommand("effect",{ end end elseif P[1] == "clear" then - mcl_potions._reset_player_effects(minetest.get_player_by_name(name)) + mcl_potions._reset_effects(minetest.get_player_by_name(name)) return true, S("Effects cleared for player @1", name) elseif P[1] == "remove" then if not P[2] then diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index d36b8db62..8d85b19b6 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -300,8 +300,10 @@ mcl_potions.register_effect({ get_tt = function(factor) return S("limitless breathing under water") end, + res_condition = function(object) + return (not object:is_player()) -- TODO add support for breath setting for mobs + end, on_step = function(dtime, object, factor, duration) - if not object:is_player() then return end if object:get_breath() then hb.hide_hudbar(object, "breath") if object:get_breath() < 10 then object:set_breath(10) end @@ -317,6 +319,9 @@ mcl_potions.register_effect({ get_tt = function(factor) return S("swimming gracefully") end, + res_condition = function(object) + return (not object:is_player()) -- TODO needs mob physics factor API + end, on_hit_timer = function(object, factor, duration) local node = minetest.get_node_or_nil(object:get_pos()) if node and minetest.registered_nodes[node.name] @@ -340,7 +345,7 @@ mcl_potions.register_effect({ return S("-@1% jumping power", math.floor(-factor*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob physics factor API end, on_start = function(object, factor) playerphysics.add_physics_factor(object, "jump", "mcl_potions:leaping", 1+factor) @@ -361,7 +366,7 @@ mcl_potions.register_effect({ return S("decreases gravity effects") end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob physics factor API end, on_start = function(object, factor) playerphysics.add_physics_factor(object, "gravity", "mcl_potions:slow_falling", 0.5) @@ -383,7 +388,7 @@ mcl_potions.register_effect({ return S("+@1% running speed", math.floor(factor*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob physics factor API end, on_start = function(object, factor) playerphysics.add_physics_factor(object, "speed", "mcl_potions:swiftness", 1+factor) @@ -404,7 +409,7 @@ mcl_potions.register_effect({ return S("-@1% running speed", math.floor(factor*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob physics factor API end, on_start = function(object, factor) playerphysics.add_physics_factor(object, "speed", "mcl_potions:slowness", 1-factor) @@ -441,7 +446,7 @@ mcl_potions.register_effect({ return S("improved vision during the night") end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_start = function(object, factor) object:get_meta():set_int("night_vision", 1) @@ -466,7 +471,7 @@ mcl_potions.register_effect({ return S("surrounded by darkness").."\n"..S("not seeing anything beyond @1 nodes", factor) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_start = function(object, factor) object:get_meta():set_int("darkness", 1) @@ -580,7 +585,7 @@ mcl_potions.register_effect({ return S("HP increased by @1", factor) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob HP modifier API? end, on_start = function(object, factor) object:set_properties({hp_max = minetest.PLAYER_MAX_HP_DEFAULT+factor}) @@ -601,7 +606,7 @@ mcl_potions.register_effect({ return S("absorbs up to @1 incoming damage", factor) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO dmg modifiers don't work for mobs end, on_start = function(object, factor) hb.change_hudbar(object, "absorption", factor, (math.floor(factor/20-0.05)+1)*20) @@ -641,7 +646,7 @@ mcl_potions.register_effect({ return S("resistance to fire damage") end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO dmg modifiers don't work for mobs end, particle_color = "#E49A3A", uses_factor = false, @@ -655,7 +660,7 @@ mcl_potions.register_effect({ return S("resist @1% of incoming damage", math.floor(factor*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO dmg modifiers don't work for mobs end, particle_color = "#2552A5", uses_factor = true, @@ -672,7 +677,7 @@ mcl_potions.register_effect({ description = S("Luck"), particle_color = "#7BFF42", res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_start = function(object, factor) mcl_luck.apply_luck_modifier(object:get_player_name(), "mcl_potions:luck", factor) @@ -691,7 +696,7 @@ mcl_potions.register_effect({ description = S("Bad Luck"), particle_color = "#887343", res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_start = function(object, factor) mcl_luck.apply_luck_modifier(object:get_player_name(), "mcl_potions:bad_luck", -factor) @@ -746,7 +751,7 @@ mcl_potions.register_effect({ return S("-1 HP / 1 s, can kill, -@1% running speed", math.floor(factor*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob physics factor API end, on_start = function(object, factor) mcl_burning.extinguish(object) @@ -799,7 +804,7 @@ mcl_potions.register_effect({ return S("impaired sight") end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_start = function(object, factor) EF.blindness[object].vignette = object:hud_add({ @@ -842,7 +847,7 @@ 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()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_start = function(object, factor) object:set_lighting({ @@ -891,7 +896,7 @@ mcl_potions.register_effect({ return S("exhausts by @1 per second", factor) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_start = function(object, factor) hb.change_hudbar(object, "hunger", nil, nil, "mcl_hunger_icon_foodpoison.png", nil, "mcl_hunger_bar_foodpoison.png") @@ -924,7 +929,7 @@ mcl_potions.register_effect({ return S("saturates by @1 per second", factor) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO what should it do for mobs? end, on_step = function(dtime, object, factor, duration) mcl_hunger.set_hunger(object, math.min(mcl_hunger.get_hunger(object)+dtime*factor, 20)) @@ -988,7 +993,7 @@ mcl_potions.register_effect({ return S("+@1% mining and attack speed", math.floor(factor*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob API support end, on_start = haste_fatigue_hand_update, after_end = function(object) @@ -1009,7 +1014,7 @@ mcl_potions.register_effect({ return S("-@1% mining and attack speed", math.floor((1-factor)*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob API support end, on_start = haste_fatigue_hand_update, after_end = function(object) @@ -1030,7 +1035,7 @@ mcl_potions.register_effect({ return S("+@1% mining and attack speed in water").."\n"..S("limitless breathing under water", math.floor(factor*100)) end, res_condition = function(object) - return (not object:is_player()) + return (not object:is_player()) -- TODO needs mob API support end, on_start = haste_fatigue_hand_update, on_step = function(dtime, object, factor, duration) @@ -1380,34 +1385,35 @@ function mcl_potions._reset_haste_fatigue_item_meta(player) end mcl_gamemode.register_on_gamemode_change(mcl_potions._reset_haste_fatigue_item_meta) -function mcl_potions._clear_cached_player_data(player) +function mcl_potions._clear_cached_effect_data(object) for name, effect in pairs(EF) do - effect[player] = nil + effect[object] = nil end - - local meta = player:get_meta() + if not object:is_player() then return end + local meta = object:get_meta() meta:set_int("night_vision", 0) end -function mcl_potions._reset_player_effects(player, set_hud) - if not player:is_player() then - return +function mcl_potions._reset_effects(object, set_hud) + local set_hud = set_hud + if not object:is_player() then + set_hud = false end local removed_effects = {} for name, effect in pairs(registered_effects) do - if EF[name][player] and effect.on_end then effect.on_end(player) end + if EF[name][object] and effect.on_end then effect.on_end(object) end if effect.after_end then table.insert(removed_effects, effect.after_end) end end - mcl_potions._clear_cached_player_data(player) + mcl_potions._clear_cached_effect_data(object) for i=1, #removed_effects do - removed_effects[i](player) + removed_effects[i](object) end if set_hud ~= false then - potions_set_hud(player) + potions_set_hud(object) end end @@ -1566,17 +1572,17 @@ end minetest.register_on_leaveplayer( function(player) mcl_potions._save_player_effects(player) - mcl_potions._clear_cached_player_data(player) -- clear the buffer to prevent looking for a player not there + mcl_potions._clear_cached_effect_data(player) -- clear the buffer to prevent looking for a player not there icon_ids[player:get_player_name()] = nil end) minetest.register_on_dieplayer( function(player) - mcl_potions._reset_player_effects(player) + mcl_potions._reset_effects(player) potions_set_hud(player) end) minetest.register_on_joinplayer( function(player) - mcl_potions._reset_player_effects(player, false) -- make sure there are no weird holdover effects + mcl_potions._reset_effects(player, false) -- make sure there are no weird holdover effects mcl_potions._load_player_effects(player) mcl_potions._reset_haste_fatigue_item_meta(player) potions_init_icons(player) @@ -1716,12 +1722,29 @@ end -- ██║░░░░░╚██████╔╝██║░╚███║╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝ -- ╚═╝░░░░░░╚═════╝░╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░ +local registered_res_predicates = {} +-- API +-- This is supposed to add custom resistance functions independent of effects +-- E.g. some entity could be resistant to all (or some) effects under specific conditions +-- predicate - function(object, effect_name) - return true if resists effect +function mcl_potions.register_generic_resistance_predicate(predicate) + if type(predicate) == "function" then + table.insert(registered_res_predicates, predicate) + else + error("Attempted to register non-function as a predicate") + end +end + local function target_valid(object, name) if not object or object:get_hp() <= 0 then return false end local entity = object:get_luaentity() if entity and entity.is_boss then return false end + for i=1, #registered_res_predicates do + if registered_res_predicates[i](object, name) then return false end + end + if not (registered_effects[name].res_condition and registered_effects[name].res_condition(object)) then return true end end From 8f4d5d2e27656bdccb87d1046f3bac70c9afc131 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 17 Apr 2024 21:51:12 +0200 Subject: [PATCH 66/91] Added the ominous potion --- mods/ITEMS/mcl_potions/functions.lua | 3 +++ mods/ITEMS/mcl_potions/potions.lua | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 8d85b19b6..fa524996b 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -713,6 +713,9 @@ mcl_potions.register_effect({ mcl_potions.register_effect({ name = "bad_omen", description = S("Bad Omen"), + get_tt = function(factor) + return S("danger is imminent") + end, particle_color = "#472331", }) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 7e12d9a94..b651cfbb2 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -806,3 +806,22 @@ mcl_potions.register_potion({ has_arrow = true, }) +mcl_potions.register_potion({ + name = "ominous", + desc_prefix = S("Ominous"), + _tt = nil, + _longdesc = S("Attracts danger."), + image = table.concat({ + "(mcl_potions_potion_overlay.png^[colorize:red:100)", + "^mcl_potions_splash_overlay.png^[colorize:black:100", + "^mcl_potions_potion_bottle.png", + }), + _effect_list = { + bad_omen = { + dur = 6000, + }, + }, + has_splash = false, + has_lingering = false, +}) + From 78ae5ddc26324173433ad901d457a59a5c1361c2 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 17 Apr 2024 22:52:25 +0200 Subject: [PATCH 67/91] Added some potion recipes Also: * changed the duration of saturation and food poisoning potions * minor code changes --- mods/ITEMS/mcl_potions/init.lua | 34 ++++++++++++++++-------------- mods/ITEMS/mcl_potions/potions.lua | 8 +++---- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 189a014dc..d70e14f36 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -401,18 +401,14 @@ local awkward_table = { ["mcl_flowers:fourleaf_clover"] = "mcl_potions:luck", ["mcl_farming:potato_item_poison"] = "mcl_potions:nausea", - -- TODO slow falling - -- TODO levitation? - -- TODO darkness? - -- TODO absorption - -- TODO health boost? - -- TODO resistance - -- TODO turtle master? - -- TODO frost - -- TODO blindness? - -- TODO food poisoning? - -- TODO saturation? - -- TODO haste + ["mcl_mobitems:phantom_membrane"] = "mcl_potions:slow_falling", -- TODO add phantom membranes + ["mcl_core:apple_gold"] = "mcl_potions:resistance", + + -- TODO darkness - sculk? + -- TODO absorption - water element? + -- TODO turtle master - earth element? + -- TODO frost - frost element? + -- TODO haste - air element? } -- API -- register a potion recipe brewed from awkward potion @@ -450,7 +446,10 @@ end mcl_potions.register_ingredient_potion("mcl_potions:mundane", mundane_table) local thick_table = { - -- TODO glowing from some shining cave flowers + ["mcl_crimson:shroomlight"] = "mcl_potions:glowing", + ["mcl_mobitems:nether_star"] = "mcl_potions:ominous", + ["mcl_mobitems:ink_sac"] = "mcl_potions:blindness", + ["mcl_farming:carrot_item_gold"] = "mcl_potions:saturation", } -- API -- register a potion recipe brewed from thick potion @@ -495,6 +494,9 @@ local inversion_table = { ["mcl_potions:poison"] = "mcl_potions:harming", ["mcl_potions:luck"] = "mcl_potions:bad_luck", ["mcl_potions:haste"] = "mcl_potions:fatigue", + ["mcl_potions:saturation"] = "mcl_potions:food_poisoning", + ["mcl_potions:slow_falling"] = "mcl_potions:levitation", + ["mcl_potions:absorption"] = "mcl_potions:health_boost", } -- API function mcl_potions.register_inversion_recipe(input, output) @@ -529,9 +531,9 @@ local lingering_table = {} for potion, def in pairs(potions) do if def.has_splash then splash_table[potion] = potion.."_splash" - end - if def.has_lingering then - lingering_table[potion.."_splash"] = potion.."_lingering" + if def.has_lingering then + lingering_table[potion.."_splash"] = potion.."_lingering" + end end end mcl_potions.register_table_modifier("mcl_mobitems:gunpowder", splash_table) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index b651cfbb2..0d6d1940c 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -764,7 +764,7 @@ mcl_potions.register_potion({ _longdesc = S("Moves bowels too fast."), color = "#83A061", _effect_list = { - food_poisoning = {}, + food_poisoning = {dur=mcl_potions.DURATION_POISON}, }, has_arrow = true, -- TODO implement effect stacking? @@ -777,7 +777,7 @@ mcl_potions.register_potion({ _longdesc = S("Satisfies hunger."), color = "#CEAE29", _effect_list = { - saturation = {}, + saturation = {dur=mcl_potions.DURATION_POISON}, }, has_arrow = true, }) @@ -817,9 +817,7 @@ mcl_potions.register_potion({ "^mcl_potions_potion_bottle.png", }), _effect_list = { - bad_omen = { - dur = 6000, - }, + bad_omen = {dur = 6000}, }, has_splash = false, has_lingering = false, From a4eaaad1a963c77a57134b5e25f1a85bafe3cbf7 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 21 Apr 2024 19:19:42 +0200 Subject: [PATCH 68/91] Remove unused function in mcl_hunger --- mods/PLAYER/mcl_hunger/hunger.lua | 36 ------------------------------- 1 file changed, 36 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index c0ba9fb91..2c29e1939 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -99,42 +99,6 @@ function mcl_hunger.reset_bars_poison_hunger(player) end end --- Poison player TODO remove this function -local function poisonp(tick, time, time_left, damage, exhaustion, name) - if not mcl_hunger.active then - return - end - local player = minetest.get_player_by_name(name) - -- First check if player is still there - if not player then - return - end - -- Abort if food poisonings have been stopped - if mcl_hunger.poison_hunger[name] == 0 then - return - end - time_left = time_left + tick - if time_left < time then - minetest.after(tick, poisonp, tick, time, time_left, damage, exhaustion, name) - else - if exhaustion > 0 then - mcl_hunger.poison_hunger [name] = mcl_hunger.poison_hunger[name] - 1 - end - if mcl_hunger.poison_hunger[name] <= 0 then - mcl_hunger.reset_bars_poison_hunger(player) - end - end - - -- Deal damage and exhaust player - -- TODO: Introduce fatal poison at higher difficulties - if player:get_hp()-damage > 0 then - mcl_util.deal_damage(player, damage, {type = "hunger"}) - end - - mcl_hunger.exhaust(name, exhaustion) - -end - local poisonrandomizer = PseudoRandom(os.time()) function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poison, exhaust, poisonchance, sound) From 914e3c6c2a79c643370640ccca0381f0046677e5 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Apr 2024 02:12:54 +0200 Subject: [PATCH 69/91] Effects persist on loads for mobs too --- mods/ENTITIES/mcl_mobs/api.lua | 13 +++++++--- mods/ENTITIES/mcl_mobs/init.lua | 1 + mods/ITEMS/mcl_potions/functions.lua | 37 +++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 8ebdddcac..37db6b46e 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -96,18 +96,20 @@ function mob_class:get_staticdata() local tmp = {} - for _,stat in pairs(self) do + for tag, stat in pairs(self) do local t = type(stat) if t ~= "function" and t ~= "nil" and t ~= "userdata" - and _ ~= "_cmi_components" then - tmp[_] = self[_] + and tag ~= "_cmi_components" then + tmp[tag] = self[tag] end end + tmp._mcl_potions = self._mcl_potions + return minetest.serialize(tmp) end @@ -306,7 +308,10 @@ function mob_class:mob_activate(staticdata, def, dtime) self._run_armor_init = true end - + if not self._mcl_potions then + self._mcl_potions = {} + end + mcl_potions._load_entity_effects(self) if def.after_activate then diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 2b18a6775..3a2e18872 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -325,6 +325,7 @@ function mcl_mobs.register_mob(name, def) attack_exception = def.attack_exception or function(p) return false end, _spawner = def._spawner, + _mcl_potions = {}, } if minetest.get_modpath("doc_identifier") ~= nil then diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index fa524996b..17323ad7c 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1339,8 +1339,13 @@ minetest.register_globalstep(function(dtime) if effect.after_end then effect.after_end(object) end if object:is_player() then meta = object:get_meta() - meta:set_string("mcl_potions:"..name, minetest.serialize(EF[name][object])) + meta:set_string("mcl_potions:_EF_"..name, "") potions_set_hud(object) + else + local ent = object:get_luaentity() + if ent then + ent._mcl_potions["_EF_"..name] = nil + end end elseif object:is_player() then if vals.dur == math.huge then @@ -1351,6 +1356,11 @@ minetest.register_globalstep(function(dtime) object:hud_change(icon_ids[object:get_player_name()][vals.hud_index].timestamp, "text", math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))) end + else + local ent = object:get_luaentity() + if ent then + ent._mcl_potions["_EF_"..name] = EF[name][object] + end end end end @@ -1503,9 +1513,28 @@ function mcl_potions._load_player_effects(player) -- new API effects + on_load for loaded legacy effects for name, effect in pairs(registered_effects) do local loaded = minetest.deserialize(meta:get_string("mcl_potions:_EF_"..name)) - if loaded then EF[name][player] = loaded end - if EF[name][player] and effect.on_load then - effect.on_load(player, EF[name][player].factor) + if loaded then + EF[name][player] = loaded + if effect.on_load then + effect.on_load(player, EF[name][player].factor) + end + end + end +end + +function mcl_potions._load_entity_effects(entity) + if not entity or not entity._mcl_potions or entity._mcl_potions == {} then + return + end + local object = entity.object + if not object or not object:get_pos() then return end + for name, effect in pairs(registered_effects) do + local loaded = entity._mcl_potions["_EF_"..name] + if loaded then + EF[name][object] = loaded + if effect.on_load then + effect.on_load(object, EF[name][object].factor) + end end end end From e806d5f3cea9dcb13bf3896d6e5b6b33d854114f Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Apr 2024 02:16:46 +0200 Subject: [PATCH 70/91] Fixed effects still being handled after mob death --- mods/ITEMS/mcl_potions/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 17323ad7c..875d13c7c 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1333,7 +1333,7 @@ minetest.register_globalstep(function(dtime) end end - if not EF[name][object] or EF[name][object].timer >= vals.dur then + if not object or not EF[name][object] or EF[name][object].timer >= vals.dur or not object:get_pos() then if effect.on_end then effect.on_end(object) end EF[name][object] = nil if effect.after_end then effect.after_end(object) end From 63b2da7aa0cd3a572a728ff3feecff764209dbf9 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Apr 2024 02:26:26 +0200 Subject: [PATCH 71/91] Added on_save_effect support for mobs --- mods/ENTITIES/mcl_mobs/api.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 37db6b46e..873d05bf2 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -109,6 +109,12 @@ function mob_class:get_staticdata() end tmp._mcl_potions = self._mcl_potions + if tmp._mcl_potions then + for name_raw, data in pairs(tmp._mcl_potions) do + local def = mcl_potions.registered_effects[name_raw:match("^_EF_(.+)$")] + if def and def.on_save_effect then def.on_save_effect(self.object) end + end + end return minetest.serialize(tmp) end From 9e9507efeb87f7cfc078447afa4dadbd326178d2 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Apr 2024 03:23:13 +0200 Subject: [PATCH 72/91] Plant placement and drop fixes --- mods/CORE/mcl_util/init.lua | 5 +++-- mods/ITEMS/mcl_flowers/init.lua | 3 ++- mods/ITEMS/mcl_potions/functions.lua | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 4204e218d..b6fd71673 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -438,10 +438,11 @@ function mcl_util.generate_on_place_plant_function(condition) if not def_under or not def_above then return itemstack end - if def_under.buildable_to then + if def_under.buildable_to and def_under.name ~= itemstack:get_name() then place_pos = pointed_thing.under - elseif def_above.buildable_to then + elseif def_above.buildable_to and def_above.name ~= itemstack:get_name() then place_pos = pointed_thing.above + pointed_thing.under = pointed_thing.above else return itemstack end diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 7c1fa1de4..85a65a165 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -194,8 +194,8 @@ def_clover.mesh = "mcl_clover_3leaf.obj" def_clover.tiles = { "mcl_flowers_clover.png" } def_clover.inventory_image = "mcl_flowers_clover_inv.png" def_clover.wield_image = "mcl_flowers_clover_inv.png" -def_clover.drop = nil def_clover.use_texture_alpha = "clip" +def_clover.drop = "mcl_flowers:clover" def_clover.selection_box = { type = "fixed", fixed = { -4/16, -0.5, -4/16, 4/16, 0, 4/16 }, @@ -212,6 +212,7 @@ def_4l_clover.tiles = { "mcl_flowers_fourleaf_clover.png" } def_4l_clover.inventory_image = "mcl_flowers_fourleaf_clover_inv.png" def_4l_clover.wield_image = "mcl_flowers_fourleaf_clover_inv.png" def_4l_clover.use_texture_alpha = "clip" +def_4l_clover.drop = "mcl_flowers:fourleaf_clover" minetest.register_node("mcl_flowers:fourleaf_clover", def_4l_clover) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 875d13c7c..41c077b81 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -1673,7 +1673,7 @@ function mcl_potions.make_invisible(obj_ref, hide) mcl_player.player_set_visibility(obj_ref, true) obj_ref:set_nametag_attributes({ color = { r = 255, g = 255, b = 255, a = 255 } }) end - else -- TODO make below section (and preferably other effects on mobs) rely on metadata + else if hide then local luaentity = obj_ref:get_luaentity() EF.invisibility[obj_ref].old_size = luaentity.visual_size From 53d640028e2422349307de0e19a1dcf64d5616e9 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 22 Apr 2024 04:51:01 +0200 Subject: [PATCH 73/91] Added effect stacking option to the potions API Also: * Frost and Food Poisoning potion now stack their effects * fixed a crash related to tipped arrows --- mods/HELP/mcl_tt/snippets_mcl.lua | 1 + mods/ITEMS/mcl_potions/lingering.lua | 5 ++++- mods/ITEMS/mcl_potions/potions.lua | 26 ++++++++++++++++++------- mods/ITEMS/mcl_potions/splash.lua | 7 +++++-- mods/ITEMS/mcl_potions/tipped_arrow.lua | 15 ++++++++------ 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 7b25f0750..639422295 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -171,6 +171,7 @@ tt.register_snippet(function(itemstring, _, itemstack) if effect.uses_factor then factor = effect.level_to_factor(ef_level) end if effect.get_tt then ef_tt = minetest.colorize("grey", effect.get_tt(factor)) else ef_tt = "" end if ef_tt ~= "" then s = s.. ef_tt.. "\n" end + if details.effect_stacks then s = s.. minetest.colorize("grey", S("...stacks")).. "\n" end end end return s:trim() diff --git a/mods/ITEMS/mcl_potions/lingering.lua b/mods/ITEMS/mcl_potions/lingering.lua index ea0d0f36c..0eeb40b50 100644 --- a/mods/ITEMS/mcl_potions/lingering.lua +++ b/mods/ITEMS/mcl_potions/lingering.lua @@ -90,6 +90,9 @@ minetest.register_globalstep(function(dtime) else dur = details.dur end + if details.effect_stacks then + ef_level = ef_level + mcl_potions.get_effect_level(obj, name) + end if mcl_potions.give_effect_by_level(name, obj, ef_level, dur) then applied = true end @@ -97,7 +100,7 @@ minetest.register_globalstep(function(dtime) end if vals.def.custom_effect - and vals.def.custom_effect(obj, (vals.potency+1) * mcl_potions.LINGERING_FACTOR) then + and vals.def.custom_effect(obj, (vals.potency+1) * mcl_potions.LINGERING_FACTOR, plus) then applied = true end diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 0d6d1940c..9ebf64ad2 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -64,7 +64,7 @@ function return_on_use(def, effect, dur) --def.on_use(user, effect, dur) -- Will do effect immediately but not reduce item count until eating delay ends which makes it exploitable by deliberately not finishing delay - -- Wrapper for handling mcl_hunger delayed eating + -- Wrapper for handling mcl_hunger delayed eating TODO migrate to the new function local name = user:get_player_name() mcl_hunger.eat_internal[name]._custom_itemstack = itemstack -- Used as comparison to make sure the custom wrapper executes only when the same item is eaten mcl_hunger.eat_internal[name]._custom_var = { @@ -122,11 +122,14 @@ local function generate_on_use(effects, color, on_use, custom_effect) else dur = details.dur end + if details.effect_stacks then + ef_level = ef_level + mcl_potions.get_effect_level(user, name) + end mcl_potions.give_effect_by_level(name, user, ef_level, dur) end if on_use then on_use(user, potency+1) end - if custom_effect then custom_effect(user, potency+1) end + if custom_effect then custom_effect(user, potency+1, plus) end itemstack = minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) if itemstack then mcl_potions._use_potion(user, color) end @@ -162,6 +165,7 @@ end -- -- -- dur_variable - bool - whether variants of the potion should have the length of this effect changed - -- -- -- - defaults to true -- -- -- - if at least one effect has this set to true, the potion has a "plus" variant +-- -- -- effect_stacks - bool - whether the effect stacks - defaults to false -- uses_level - bool - whether the potion should come at different levels - -- - defaults to true if uses_level is true for at least one effect, else false -- drinkable - bool - defaults to true @@ -172,7 +176,7 @@ end -- default_potent_level - int - potion level used for the default potent variant - defaults to 2 -- default_extend_level - int - extention level (amount of +) used for the default extended variant - defaults to 1 -- custom_on_use - function(user, level) - called when the potion is drunk, returns true on success --- custom_effect - function(object, level) - called when the potion effects are applied, returns true on success +-- custom_effect - function(object, level, plus) - called when the potion effects are applied, returns true on success -- custom_splash_effect - function(pos, level) - called when the splash potion explodes, returns true on success -- custom_linger_effect - function(pos, radius, level) - called on the lingering potion step, returns true on success function mcl_potions.register_potion(def) @@ -195,6 +199,9 @@ function mcl_potions.register_potion(def) pdef.description = S("Strange Potion") end pdef._tt_help = def._tt + if def._tt and def.effect_stacks then + pdef._tt_help = pdef._tt_help .. "\n" .. S("Stacks the effect") + end pdef._dynamic_tt = def._dynamic_tt local potion_longdesc = def._longdesc if def._effect_list then @@ -230,6 +237,7 @@ function mcl_potions.register_potion(def) level_scaling = details.level_scaling or 1, dur = details.dur or mcl_potions.DURATION, dur_variable = durvar, + effect_stacks = details.effect_stacks and true or false } else error("Unable to register potion: effect not registered") @@ -727,10 +735,12 @@ mcl_potions.register_potion({ _longdesc = S("Freezes..."), color = "#5B7DAA", _effect_list = { - frost = {}, + frost = { + dur = mcl_potions.DURATION_POISON, + effect_stacks = true, + }, }, has_arrow = true, - -- TODO implement effect stacking? }) mcl_potions.register_potion({ @@ -764,10 +774,12 @@ mcl_potions.register_potion({ _longdesc = S("Moves bowels too fast."), color = "#83A061", _effect_list = { - food_poisoning = {dur=mcl_potions.DURATION_POISON}, + food_poisoning = { + dur = mcl_potions.DURATION_POISON, + effect_stacks = true, + }, }, has_arrow = true, - -- TODO implement effect stacking? }) mcl_potions.register_potion({ diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index 2fb9f362c..3b9261458 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -151,6 +151,9 @@ function mcl_potions.register_splash(name, descr, color, def) else dur = details.dur end + if details.effect_stacks then + ef_level = ef_level + mcl_potions.get_effect_level(obj, name) + end if rad > 0 then mcl_potions.give_effect_by_level(name, obj, ef_level, redux_map[rad]*dur) else @@ -162,9 +165,9 @@ function mcl_potions.register_splash(name, descr, color, def) if def.custom_effect then local power = (potency+1) * mcl_potions.SPLASH_FACTOR if rad > 0 then - def.custom_effect(obj, redux_map[rad] * power) + def.custom_effect(obj, redux_map[rad] * power, plus) else - def.custom_effect(obj, power) + def.custom_effect(obj, power, plus) end end end diff --git a/mods/ITEMS/mcl_potions/tipped_arrow.lua b/mods/ITEMS/mcl_potions/tipped_arrow.lua index a6a1b71bc..1833e7169 100644 --- a/mods/ITEMS/mcl_potions/tipped_arrow.lua +++ b/mods/ITEMS/mcl_potions/tipped_arrow.lua @@ -301,10 +301,14 @@ function mcl_potions.register_arrow(name, desc, color, def) else dur = details.dur end + dur = dur * mcl_potions.SPLASH_FACTOR + if details.effect_stacks then + ef_level = ef_level + mcl_potions.get_effect_level(obj, name) + end mcl_potions.give_effect_by_level(name, obj, ef_level, dur) end end - if def.custom_effect then def.custom_effect(obj, potency+1) end + if def.custom_effect then def.custom_effect(obj, potency+1, plus) end end else obj:punch(self.object, 1.0, { @@ -329,14 +333,13 @@ function mcl_potions.register_arrow(name, desc, color, def) dur = details.dur end dur = dur * mcl_potions.SPLASH_FACTOR - if rad > 0 then - mcl_potions.give_effect_by_level(name, obj, ef_level, redux_map[rad]*dur) - else - mcl_potions.give_effect_by_level(name, obj, ef_level, dur) + if details.effect_stacks then + ef_level = ef_level + mcl_potions.get_effect_level(obj, name) end + mcl_potions.give_effect_by_level(name, obj, ef_level, dur) end end - if def.custom_effect then def.custom_effect(obj, potency+1) end + if def.custom_effect then def.custom_effect(obj, potency+1, plus) end end if is_player then From a039e056a5f8bc86f552bc3741ea4b9d099beb29 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 00:59:22 +0200 Subject: [PATCH 74/91] Support delayed drinking with new potions API --- mods/ITEMS/mcl_potions/potions.lua | 111 +++++++++++------------------ 1 file changed, 43 insertions(+), 68 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 9ebf64ad2..cc83954c7 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -46,51 +46,6 @@ end -- ╚═╝░░░░░░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░ -function return_on_use(def, effect, dur) - return function (itemstack, user, pointed_thing) - if pointed_thing.type == "node" then - if user and not user:get_player_control().sneak then - -- Use pointed node's on_rightclick function first, if present - local node = minetest.get_node(pointed_thing.under) - if user and not user:get_player_control().sneak then - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then - return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack - end - end - end - elseif pointed_thing.type == "object" then - return itemstack - end - - --def.on_use(user, effect, dur) -- Will do effect immediately but not reduce item count until eating delay ends which makes it exploitable by deliberately not finishing delay - - -- Wrapper for handling mcl_hunger delayed eating TODO migrate to the new function - local name = user:get_player_name() - mcl_hunger.eat_internal[name]._custom_itemstack = itemstack -- Used as comparison to make sure the custom wrapper executes only when the same item is eaten - mcl_hunger.eat_internal[name]._custom_var = { - user = user, - effect = effect, - dur = dur, - } - mcl_hunger.eat_internal[name]._custom_func = def.on_use - mcl_hunger.eat_internal[name]._custom_wrapper = function(name) - - mcl_hunger.eat_internal[name]._custom_func( - mcl_hunger.eat_internal[name]._custom_var.user, - mcl_hunger.eat_internal[name]._custom_var.effect, - mcl_hunger.eat_internal[name]._custom_var.dur - ) - end - - local old_name, old_count = itemstack:get_name(), itemstack:get_count() - itemstack = minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) - if old_name ~= itemstack:get_name() or old_count ~= itemstack:get_count() then - mcl_potions._use_potion(itemstack, user, def.color) - end - return itemstack - end -end - local function generate_on_use(effects, color, on_use, custom_effect) return function(itemstack, user, pointed_thing) if pointed_thing.type == "node" then @@ -104,32 +59,52 @@ local function generate_on_use(effects, color, on_use, custom_effect) return itemstack end - local potency = itemstack:get_meta():get_int("mcl_potions:potion_potent") - local plus = itemstack:get_meta():get_int("mcl_potions:potion_plus") - local ef_level - local dur - for name, details in pairs(effects) do - if details.uses_level then - ef_level = details.level + details.level_scaling * (potency) - else - ef_level = details.level - end - if details.dur_variable then - dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) - if potency>0 and details.uses_level then - dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + -- Wrapper for handling mcl_hunger delayed eating + local player_name = user:get_player_name() + mcl_hunger.eat_internal[player_name]._custom_itemstack = itemstack -- Used as comparison to make sure the custom wrapper executes only when the same item is eaten + mcl_hunger.eat_internal[player_name]._custom_var = { + user = user, + effects = effects, + on_use = on_use, + custom_effect = custom_effect, + } + mcl_hunger.eat_internal[player_name]._custom_func = function(itemstack, user, effects, on_use, custom_effect) + local potency = itemstack:get_meta():get_int("mcl_potions:potion_potent") + local plus = itemstack:get_meta():get_int("mcl_potions:potion_plus") + local ef_level + local dur + for name, details in pairs(effects) do + if details.uses_level then + ef_level = details.level + details.level_scaling * (potency) + else + ef_level = details.level end - else - dur = details.dur + if details.dur_variable then + dur = details.dur * math.pow(mcl_potions.PLUS_FACTOR, plus) + if potency>0 and details.uses_level then + dur = dur / math.pow(mcl_potions.POTENT_FACTOR, potency) + end + else + dur = details.dur + end + if details.effect_stacks then + ef_level = ef_level + mcl_potions.get_effect_level(user, name) + end + mcl_potions.give_effect_by_level(name, user, ef_level, dur) end - if details.effect_stacks then - ef_level = ef_level + mcl_potions.get_effect_level(user, name) - end - mcl_potions.give_effect_by_level(name, user, ef_level, dur) - end - if on_use then on_use(user, potency+1) end - if custom_effect then custom_effect(user, potency+1, plus) end + if on_use then on_use(user, potency+1) end + if custom_effect then custom_effect(user, potency+1, plus) end + end + mcl_hunger.eat_internal[player_name]._custom_wrapper = function(player_name) + mcl_hunger.eat_internal[player_name]._custom_func( + mcl_hunger.eat_internal[player_name]._custom_itemstack, + mcl_hunger.eat_internal[player_name]._custom_var.user, + mcl_hunger.eat_internal[player_name]._custom_var.effects, + mcl_hunger.eat_internal[player_name]._custom_var.on_use, + mcl_hunger.eat_internal[player_name]._custom_var.custom_effect + ) + end itemstack = minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) if itemstack then mcl_potions._use_potion(user, color) end From bdaff930e0cb53a14601c85019c55be2ebcce82b Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 03:26:01 +0200 Subject: [PATCH 75/91] Documentation update --- mods/ITEMS/mcl_potions/API.md | 318 +++++++++++++++++++++++++++ mods/ITEMS/mcl_potions/functions.lua | 4 +- 2 files changed, 320 insertions(+), 2 deletions(-) create mode 100644 mods/ITEMS/mcl_potions/API.md diff --git a/mods/ITEMS/mcl_potions/API.md b/mods/ITEMS/mcl_potions/API.md new file mode 100644 index 000000000..be0784e22 --- /dev/null +++ b/mods/ITEMS/mcl_potions/API.md @@ -0,0 +1,318 @@ +## Potions and Effects API + + +* [Potions and Effects API](#potions-and-effects-api) + * [Namespace](#namespace) + * [Effects](#effects) + * [Functions](#functions) + * [Deprecated Functions](#deprecated-functions) + * [Tables](#tables) + * [Internally registered effects](#internally-registered-effects) + * [Constants](#constants) + * [Effect Definition](#effect-definition) + * [HP Hudbar Modifiers](#hp-hudbar-modifiers) + * [Functions](#functions) + * [HP Hudbar Modifier Definition](#hp-hudbar-modifier-definition) + * [Potions](#potions) + * [Functions](#functions) + * [Tables](#tables) + * [Internally registered potions](#internally-registered-potions) + * [Constants](#constants) + * [Potion Definition](#potion-definition) + * [Brewing](#brewing) + * [Functions](#functions) + * [Miscellaneous Functions](#miscellaneous-functions) + + +### Namespace +All of the API is defined in the `mcl_potions` namespace. + +### Effects +This section describes parts of the API related to defining and managing effects on players and entities. The mod defines a bunch of effects internally using the same API as described below. + +#### Functions +`mcl_potions.register_effect(def)` – takes an effect definition (`def`) and registers an effect if the definition is valid, and adds the known parts of the definition as well as the outcomes of processing of some parts of the definition to the `mcl_potions.registered_effects` table. This should only be used at load time. + + +`mcl_potions.apply_haste_fatigue(toolcaps, h_fac, f_fac)` – takes a table of tool capabilities (`toolcaps`) and modifies it using the provided haste factor (`h_fac`) and fatigue factor (`f_fac`). The factors default to no-op values. + + +`mcl_potions.hf_update_internal(hand, object)` – returns the `hand` of the `object` updated according to their combined haste and fatigue. **This doesn't change anything by itself!** Manual update of the hand with the hand returned by this function has to be done. This should only be called in situations that are *directly* impacted by haste and/or fatigue, and therefore require an update of the hand. + + +`mcl_potions.update_haste_and_fatigue(player)` – updates haste and fatigue on a `player` (described by an ObjectRef). This should be called whenever an update of the haste-type and fatigue-type effects is desired. + + +`mcl_potions._reset_haste_fatigue_item_meta(player)` – resets the item meta changes caused by haste-type and fatigue-type effects throughout the inventory of the `player` described by an ObjectRef. + + +`mcl_potions._clear_cached_effect_data(object)` – clears cashed effect data for the `object`. This shouldn't be used for resetting effects. + + +`mcl_potions._reset_effects(object, set_hud)` – actually resets the effects for the `object`. It also updates HUD if `set_hud` is `true` or undefined (`nil`). + + +`mcl_potions._save_player_effects(player)` – saves all effects of the `player` described by an ObjectRef to metadata. + + +`mcl_potions._load_player_effects(player)` – loads all effects from the metadata of the `player` described by an ObjectRef. + + +`mcl_potions._load_entity_effects(entity)` – loads all effects from the `entity` (a LuaEntity). + + +`mcl_potions.has_effect(object, effect_name)` – returns `true` if `object` (described by an ObjectRef) has the effect of the ID `effect_name`, `false` otherwise. + + +`mcl_potions.get_effect(object, effect_name)` - returns a table containing values of the effect of the ID `effect_name` on the `object` if the object has the named effect, `false` otherwise. + + +`mcl_potions.get_effect_level(object, effect_name)` – returns the level of the effect of the ID `effect_name` on the `object`. If the effect has no levels, returns `1`. If the object doesn't have the effect, returns `0`. If the effect is not registered, returns `nil`. + + +`mcl_potions.get_total_haste(object)` – returns the total haste of the `object` (from all haste-type effects). + + +`mcl_potions.get_total_fatigue(object)` – returns the total fatigue of the `object` (from all fatigue-type effects). + + +`mcl_potions.clear_effect(object, effect)` – attempts to remove the effect of the ID `effect` from the `object`. If the effect is not registered, logs a warning and returns `false`. Otherwise, returns `nil`. + + +`mcl_potions.make_invisible(obj_ref, hide)` – makes the object going by the `obj_ref` invisible if `hide` is true, visible otherwise. + + +`mcl_potions.register_generic_resistance_predicate(predicate)` – registers an arbitrary effect resistance predicate. This can be used e.g. to make some entity resistant to all (or some) effects under specific conditions. + +* `predicate` – `function(object, effect_name)` - return `true` if `object` resists effect of the ID `effect_name` + + +`mcl_potions.give_effect(name, object, factor, duration, no_particles)` – attempts to give effect of the ID `name` to the `object` with the provided `factor` and `duration`. If `no_particles` is `true`, no particles will be emitted from the object when under the effect. If the effect is not registered, target is invalid (or resistant), or the same effect with more potency is already applied to the target, this function does nothing and returns `false`. On success, this returns `true`. + + +`mcl_potions.give_effect_by_level(name, object, level, duration, no_particles)` – attempts to give effect of the ID `name` to the `object` with the provided `level` and `duration`. If `no_particles` is `true`, no particles will be emitted from the object when under the effect. This converts `level` to factor and calls `mcl_potions.give_effect()` internally, returning the return value of that function. `level` equal to `0` is no-op. + + +`mcl_potions.healing_func(object, hp)` – attempts to heal the `object` by `hp`. Negative `hp` harms magically instead. + + +#### Deprecated functions +**Don't use the following functions, use the above API instead!** The following are only provided for backwards compatibility and will be removed later. They all call `mcl_potions.give_effect()` internally. + +* `mcl_potions.strength_func(object, factor, duration)` +* `mcl_potions.leaping_func(object, factor, duration)` +* `mcl_potions.weakness_func(object, factor, duration)` +* `mcl_potions.swiftness_func(object, factor, duration)` +* `mcl_potions.slowness_func(object, factor, duration)` +* `mcl_potions.withering_func(object, factor, duration)` +* `mcl_potions.poison_func(object, factor, duration)` +* `mcl_potions.regeneration_func(object, factor, duration)` +* `mcl_potions.invisiblility_func(object, null, duration)` +* `mcl_potions.water_breathing_func(object, null, duration)` +* `mcl_potions.fire_resistance_func(object, null, duration)` +* `mcl_potions.night_vision_func(object, null, duration)` +* `mcl_potions.bad_omen_func(object, factor, duration)` + + + +#### Tables +`mcl_potions.registered_effects` – contains all effects that have been registered. You can read from it various data about the effects. You can overwrite the data and alter the effects' definitions too, but this is discouraged, i.e. only do this if you really know what you are doing. You shouldn't add effects directly to this table, as this would skip important setup; instead use the `mcl_potions.register_effect()` function, which is described above. + +#### Internally registered effects +You can't register effects going by these names, because they are already used: +* `invisibility` +* `poison` +* `regeneration` +* `strength` +* `weakness` +* `weakness` +* `dolphin_grace` +* `leaping` +* `slow_falling` +* `swiftness` +* `slowness` +* `levitation` +* `night_vision` +* `darkness` +* `glowing` +* `health_boost` +* `absorption` +* `fire_resistance` +* `resistance` +* `luck` +* `bad_luck` +* `bad_omen` +* `hero_of_village` +* `withering` +* `frost` +* `blindness` +* `nausea` +* `food_poisoning` +* `saturation` +* `haste` +* `fatigue` +* `conduit_power` + +#### Constants +`mcl_potions.LONGEST_MINING_TIME` – longest mining time of one block that can be achieved by slowing down the mining by fatigue-type effects. + +`mcl_potions.LONGEST_PUNCH_INTERVAL` – longest punch interval that can be achieved by slowing down the punching by fatigue-type effects. + +#### Effect Definition +```lua +def = { +-- required parameters in def: + name = string -- effect name in code (unique ID) - can't be one of the reserved words ("list", "heal", "remove", "clear") + description = S(string) -- actual effect name in game +-- optional parameters in def: + get_tt = function(factor) -- returns tooltip description text for use with potions + icon = string -- file name of the effect icon in HUD - defaults to one based on name + res_condition = function(object) -- returning true if target is to be resistant to the effect + on_start = function(object, factor) -- called when dealing the effect + on_load = function(object, factor) -- called on_joinplayer and on_activate + on_step = function(dtime, object, factor, duration) -- running every step for all objects with this effect + on_hit_timer = function(object, factor, duration) -- if defined runs a hit_timer depending on timer_uses_factor value + on_end = function(object) -- called when the effect wears off + after_end = function(object) -- called when the effect wears off, after purging the data of the effect + on_save_effect = function(object -- called when the effect is to be serialized for saving (supposed to do cleanup) + particle_color = string -- colorstring for particles - defaults to #3000EE + uses_factor = bool -- whether factor affects the effect + lvl1_factor = number -- factor for lvl1 effect - defaults to 1 if uses_factor + lvl2_factor = number -- factor for lvl2 effect - defaults to 2 if uses_factor + timer_uses_factor = bool -- whether hit_timer uses factor (uses_factor must be true) or a constant value (hit_timer_step must be defined) + hit_timer_step = float -- interval between hit_timer hits + damage_modifier = string -- damage flag of which damage is changed as defined by modifier_func, pass empty string for all damage + dmg_mod_is_type = bool -- damage_modifier string is used as type instead of flag of damage, defaults to false + modifier_func = function(damage, effect_vals) -- see damage_modifier, if not defined damage_modifier defaults to 100% resistance + modifier_priority = integer -- priority passed when registering damage_modifier - defaults to -50 + affects_item_speed = table +-- -- if provided, effect gets added to the item_speed_effects table, this should be true if the effect affects item speeds, +-- -- otherwise it won't work properly with other such effects (like haste and fatigue) +-- -- -- factor_is_positive - bool - whether values of factor between 0 and 1 should be considered +factor% or speed multiplier +-- -- -- - obviously +factor% is positive and speed multiplier is negative interpretation +-- -- -- - values of factor higher than 1 will have a positive effect regardless +-- -- -- - values of factor lower than 0 will have a negative effect regardless +} +``` + +### HP Hudbar Modifiers +This part of the API allows complex modification of the HP hudbar. It is mainly required here, so it is defined here. It may be moved to a different mod in the future. + +#### Functions +`mcl_potions.register_hp_hudbar_modifier(def)` – this function takes a modifier definition (`def`, described below) and registers a HP hudbar modifier if the definition is valid. + +#### HP Hudbar Modifier Definition +```lua +def = { +-- required parameters in def: + predicate = function(player) -- returns true if player fulfills the requirements (eg. has the effects) for the hudbar look + icon = string -- name of the icon to which the modifier should change the HP hudbar heart + priority = signed_int -- lower gets checked first, and first fulfilled predicate applies its modifier +} +``` + +### Potions +Magic! + +#### Functions +`mcl_potions.register_potion(def)` – takes a potion definition (`def`) and registers a potion if the definition is valid, and adds the known parts of the definition as well as the outcomes of processing of some parts of the definition to the `mcl_potions.registered_effects` table. This, depending on some fields of the definition, may as well register the corresponding splash potion, lingering potion and tipped arrow. This should only be used at load time. + +`mcl_potions.register_splash(name, descr, color, def)` – registers a splash potion (item and entity when thrown). This is mostly part of the internal API and probably shouldn't be used from outside, therefore not providing exact description. This is used by `mcl_potions.register_potion()`. + +`mcl_potions.register_lingering(name, descr, color, def)` – registers a lingering potion (item and entity when thrown). This is mostly part of the internal API and probably shouldn't be used from outside, therefore not providing exact description. This is used by `mcl_potions.register_potion()`. + +`mcl_potions.register_arrow(name, desc, color, def)` – registers a tipped arrow (item and entity when shot). This is mostly part of the internal API and probably shouldn't be used from outside, therefore not providing exact description. This is used by `mcl_potions.register_potion()`. + +#### Tables +`mcl_potions.registered_potions` – contains all potions that have been registered. You can read from it various data about the potions. You can overwrite the data and alter the definitions too, but this is discouraged, i.e. only do this if you really know what you are doing. You shouldn't add potions directly to this table, because they have to be registered as items too; instead use the `mcl_potions.register_potion()` function, which is described above. Some brewing recipes are autofilled based on this table after the loading of all the mods is done. + +#### Constants +* `mcl_potions.POTENT_FACTOR = 2` +* `mcl_potions.PLUS_FACTOR = 8/3` +* `mcl_potions.INV_FACTOR = 0.50` +* `mcl_potions.DURATION = 180` +* `mcl_potions.DURATION_INV = mcl_potions.DURATION * mcl_potions.INV_FACTOR` +* `mcl_potions.DURATION_POISON = 45` +* `mcl_potions.II_FACTOR = mcl_potions.POTENT_FACTOR` – **DEPRECATED** +* `mcl_potions.DURATION_PLUS = mcl_potions.DURATION * mcl_potions.PLUS_FACTOR` – **DEPRECATED** +* `mcl_potions.DURATION_2 = mcl_potions.DURATION / mcl_potions.II_FACTOR` – **DEPRECATED** +* `mcl_potions.SPLASH_FACTOR = 0.75` +* `mcl_potions.LINGERING_FACTOR = 0.25` + +#### Potion Definition +```lua +def = { +-- required parameters in def: + name = string, -- potion name in code +-- optional parameters in def: + desc_prefix = S(string), -- part of visible potion name, comes before the word "Potion" + desc_suffix = S(string), -- part of visible potion name, comes after the word "Potion" + _tt = S(string), -- custom tooltip text + _dynamic_tt = function(level), -- returns custom tooltip text dependent on potion level + _longdesc = S(string), -- text for in=game documentation + stack_max = int, -- max stack size - defaults to 1 + image = string, -- name of a custom texture of the potion icon + color = string, -- colorstring for potion icon when image is not defined - defaults to #0000FF + groups = table, -- item groups definition for the regular potion, not splash or lingering - +-- - must contain _mcl_potion=1 for tooltip to include dynamic_tt and effects +-- - defaults to {brewitem=1, food=3, can_eat_when_full=1, _mcl_potion=1} + nocreative = bool, -- adds a not_in_creative_inventory=1 group - defaults to false + _effect_list = {, -- all the effects dealt by the potion in the format of tables +-- -- the name of each sub-table should be a name of a registered effect, and fields can be the following: + uses_level = bool, -- whether the level of the potion affects the level of the effect - +-- -- -- - defaults to the uses_factor field of the effect definition + level = int, -- used as the effect level if uses_level is false and for lvl1 potions - defaults to 1 + level_scaling = int, -- used as the number of effect levels added per potion level - defaults to 1 - +-- -- -- - this has no effect if uses_level is false + dur = float, -- duration of the effect in seconds - defaults to mcl_potions.DURATION + dur_variable = bool, -- whether variants of the potion should have the length of this effect changed - +-- -- -- - defaults to true +-- -- -- - if at least one effect has this set to true, the potion has a "plus" variant + effect_stacks = bool, -- whether the effect stacks - defaults to false + } + uses_level = bool, -- whether the potion should come at different levels - +-- - defaults to true if uses_level is true for at least one effect, else false + drinkable = bool, -- defaults to true + has_splash = bool, -- defaults to true + has_lingering = bool, -- defaults to true + has_arrow = bool, -- defaults to false + has_potent = bool, -- whether there is a potent (e.g. II) variant - defaults to the value of uses_level + default_potent_level = int, -- potion level used for the default potent variant - defaults to 2 + default_extend_level = int, -- extention level (amount of +) used for the default extended variant - defaults to 1 + custom_on_use = function(user, level), -- called when the potion is drunk, returns true on success + custom_effect = function(object, level, plus), -- called when the potion effects are applied, returns true on success + custom_splash_effect = function(pos, level), -- called when the splash potion explodes, returns true on success + custom_linger_effect = function(pos, radius, level), -- called on the lingering potion step, returns true on success +} +``` + +### Brewing +Functions supporting brewing potions, used by the `mcl_brewing` module, which calls `mcl_potions.get_alchemy()`. + +#### Functions +`mcl_potions.register_ingredient_potion(input, out_table)` – registers a potion (`input`, item string) that can be combined with multiple ingredients for different outcomes; `out_table` contains the recipes for those outcomes + +`mcl_potions.register_water_brew(ingr, potion)` – registers a `potion` (item string) brewed from water with a specific ingredient (`ingr`) + +`mcl_potions.register_awkward_brew(ingr, potion)` – registers a `potion` (item string) brewed from an awkward potion with a specific ingredient (`ingr`) + +`mcl_potions.register_mundane_brew(ingr, potion)` – registers a `potion` (item string) brewed from a mundane potion with a specific ingredient (`ingr`) + +`mcl_potions.register_thick_brew(ingr, potion)` – registers a `potion` (item string) brewed from a thick potion with a specific ingredient (`ingr`) + +`mcl_potions.register_table_modifier(ingr, modifier)` – registers a brewing recipe altering the potion using a table; this is supposed to substitute one item with another + +`mcl_potions.register_inversion_recipe(input, output)` – what it says + +`mcl_potions.register_meta_modifier(ingr, mod_func)` – registers a brewing recipe altering the potion using a function; this is supposed to be a recipe that changes metadata only + +`mcl_potions.get_alchemy(ingr, pot)` – finds an alchemical recipe for given ingredient and potion; returns outcome + +### Miscellaneous Functions +`mcl_potions._extinguish_nearby_fire(pos, radius)` – attempts to extinguish fires in an area, both on objects and nodes. + +`mcl_potions._add_spawner(obj, color)` – adds a particle spawner denoting an effect being in action. + +`mcl_potions._use_potion(obj, color)` – visual and sound effects of drinking a potion. + +`mcl_potions.is_obj_hit(self, pos)` – determines if an object is hit (by a thrown potion). diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 41c077b81..4ab98491a 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -97,8 +97,8 @@ end -- on_save_effect - function(object - called when the effect is to be serialized for saving (supposed to do cleanup) -- particle_color - string - colorstring for particles - defaults to #3000EE -- uses_factor - bool - whether factor affects the effect --- lvl1_factor - integer - factor for lvl1 effect - defaults to 1 if uses_factor --- lvl2_factor - integer - factor for lvl2 effect - defaults to 2 if uses_factor +-- lvl1_factor - number - factor for lvl1 effect - defaults to 1 if uses_factor +-- lvl2_factor - number - factor for lvl2 effect - defaults to 2 if uses_factor -- timer_uses_factor - bool - whether hit_timer uses factor (uses_factor must be true) or a constant value (hit_timer_step must be defined) -- hit_timer_step - float - interval between hit_timer hits -- damage_modifier - string - damage flag of which damage is changed as defined by modifier_func, pass empty string for all damage From dc7b1869b747f829bd984abc63a441707e8442da Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 04:28:21 +0200 Subject: [PATCH 76/91] Move most of the game to the new API --- mods/ENTITIES/mcl_mobs/physics.lua | 2 +- mods/ENVIRONMENT/mcl_raids/init.lua | 6 +++--- mods/ITEMS/mcl_core/craftitems.lua | 28 ++++++++++++++-------------- mods/ITEMS/mcl_farming/potatoes.lua | 2 +- mods/ITEMS/mcl_fishing/init.lua | 3 ++- mods/ITEMS/mcl_mobitems/init.lua | 2 +- mods/ITEMS/mcl_potions/functions.lua | 1 + mods/ITEMS/mcl_sus_stew/init.lua | 18 +++++++++--------- 8 files changed, 32 insertions(+), 30 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 705b22dbb..73aefb509 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -684,7 +684,7 @@ function mob_class:do_env_damage() self.object:set_velocity({x = 0, y = 0, z = 0}) -- wither rose effect elseif self.standing_in == "mcl_flowers:wither_rose" then - mcl_potions.withering_func(self.object, 1, 2) + mcl_potions.give_effect_by_level("withering", self.object, 2, 2) end local nodef = minetest.registered_nodes[self.standing_in] diff --git a/mods/ENVIRONMENT/mcl_raids/init.lua b/mods/ENVIRONMENT/mcl_raids/init.lua index 208ee93e0..1b762b0e9 100644 --- a/mods/ENVIRONMENT/mcl_raids/init.lua +++ b/mods/ENVIRONMENT/mcl_raids/init.lua @@ -104,11 +104,11 @@ function mcl_raids.promote_to_raidcaptain(c) -- object mcl_raids.drop_obanner(pos) if cmi_cause and cmi_cause.type == "punch" and cmi_cause.puncher:is_player() then awards.unlock(cmi_cause.puncher:get_player_name(), "mcl:voluntary_exile") - local lv = mcl_potions.get_effect(cmi_cause.puncher, "bad_omen") + local lv = mcl_potions.get_effect_level(cmi_cause.puncher, "bad_omen") if not lv then lv = 0 else lv = lv.factor end lv = math.max(5,lv + 1) - mcl_potions.bad_omen_func(cmi_cause.puncher,lv,6000) + mcl_potions.give_effect_by_level("bad_omen", cmi_cause.puncher, lv, 6000) end end if old_ondie then return old_ondie(self,pos,cmi_cause) end @@ -310,7 +310,7 @@ mcl_events.register_event("raid",{ self.mobs = {} self.health_max = 1 self.health = 0 - local lv = mcl_potions.get_effect(minetest.get_player_by_name(self.player), "bad_omen") + local lv = mcl_potions.get_effect_level(minetest.get_player_by_name(self.player), "bad_omen") if lv and lv.factor and lv.factor > 1 then self.max_stage = 6 end end, cond_progress = function(self) diff --git a/mods/ITEMS/mcl_core/craftitems.lua b/mods/ITEMS/mcl_core/craftitems.lua index e89fe124a..f95d42ad2 100644 --- a/mods/ITEMS/mcl_core/craftitems.lua +++ b/mods/ITEMS/mcl_core/craftitems.lua @@ -167,17 +167,17 @@ local function eat_gapple(itemstack, placer, pointed_thing) return itemstack end - local regen_duration, absorbtion_factor = 5, 1 + local regen_duration, absorption = 5, 1 if itemstack:get_name() == "mcl_core:apple_gold_enchanted" then - regen_duration, absorbtion_factor = 20, 4 - mcl_potions.fire_resistance_func(placer, 1, 300) - mcl_potions.leaping_func(placer, 1, 300) + regen_duration, absorption = 20, 4 + mcl_potions.give_effect("fire_resistance", placer, 1, 300) + mcl_potions.give_effect_by_level("leaping", placer, 1, 300) if enable_fapples then - mcl_potions.swiftness_func(placer, absorbtion_factor, 120) + mcl_potions.give_effect_by_level("swiftness", placer, absorption, 120) end end - -- TODO: Absorbtion - mcl_potions.regeneration_func(placer, 2, regen_duration) + mcl_potions.give_effect_by_level("absorption", placer, absorption, 120) + mcl_potions.give_effect_by_level("regeneration", placer, 2, regen_duration) return gapple_hunger_restore(itemstack, placer, pointed_thing) end @@ -206,17 +206,17 @@ local function eat_gapple_delayed(itemstack, placer, pointed_thing) return itemstack end - local regen_duration, absorbtion_factor = 5, 1 + local regen_duration, absorption = 5, 1 if itemstack:get_name() == "mcl_core:apple_gold_enchanted" then - regen_duration, absorbtion_factor = 20, 4 - mcl_potions.fire_resistance_func(placer, 1, 300) - mcl_potions.leaping_func(placer, 1, 300) + regen_duration, absorption = 20, 4 + mcl_potions.give_effect("fire_resistance", placer, 1, 300) + mcl_potions.give_effect_by_level("leaping", placer, 1, 300) if enable_fapples then - mcl_potions.swiftness_func(placer, absorbtion_factor, 120) + mcl_potions.give_effect_by_level("swiftness", placer, absorption, 120) end end - -- TODO: Absorbtion - mcl_potions.regeneration_func(placer, 2, regen_duration) + mcl_potions.give_effect_by_level("absorption", placer, absorption, 120) + mcl_potions.give_effect_by_level("regeneration", placer, 2, regen_duration) --return gapple_hunger_restore(itemstack, placer, pointed_thing) end diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index d3f4e4fc0..66c5169c4 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -142,7 +142,7 @@ minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, -- 60% chance of poisoning with poisonous potato if itemstack:get_name() == "mcl_farming:potato_item_poison" then if math.random(1,10) >= 6 then - mcl_potions.poison_func(user, 1, 5) + mcl_potions.give_effect_by_level("poison", user, 1, 5) end end diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index e3bf181f5..163c103a3 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -519,7 +519,8 @@ minetest.register_craftitem("mcl_fishing:pufferfish_raw", { minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing) if itemstack:get_name() == "mcl_fishing:pufferfish_raw" then - mcl_potions.poison_func(user, 1/3, 60) + mcl_potions.give_effect_by_level("poison", user, 3, 60) + mcl_potions.give_effect_by_level("nausea", user, 2, 20) end end ) diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 01b9a5039..f74d254ba 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -580,6 +580,6 @@ minetest.register_craft({ minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing) -- poisoning with spider eye if itemstack:get_name() == "mcl_mobitems:spider_eye" then - mcl_potions.poison_func(user, 1, 4) + mcl_potions.give_effect_by_level("poison", user, 1, 4) end end) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 4ab98491a..460a1cb8f 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -717,6 +717,7 @@ mcl_potions.register_effect({ return S("danger is imminent") end, particle_color = "#472331", + uses_factor = true, }) mcl_potions.register_effect({ diff --git a/mods/ITEMS/mcl_sus_stew/init.lua b/mods/ITEMS/mcl_sus_stew/init.lua index d34dbbf00..a4c3aae31 100644 --- a/mods/ITEMS/mcl_sus_stew/init.lua +++ b/mods/ITEMS/mcl_sus_stew/init.lua @@ -8,8 +8,8 @@ local eat = minetest.item_eat(6, "mcl_core:bowl") --6 hunger points, player rece local flower_effect = { [ "mcl_flowers:allium" ] = "fire_resistance", [ "mcl_flowers:lily_of_the_valley" ] = "poison", - [ "mcl_flowers:blue_orchid" ] = "hunger", - [ "mcl_flowers:dandelion" ] = "hunger", + [ "mcl_flowers:blue_orchid" ] = "food_poisoning", + [ "mcl_flowers:dandelion" ] = "food_poisoning", [ "mcl_flowers:cornflower" ] = "jump", [ "mcl_flowers:oxeye_daisy" ] = "regeneration", [ "mcl_flowers:poppy" ] = "night_vision" @@ -17,31 +17,31 @@ local flower_effect = { local effects = { [ "fire_resistance" ] = function(itemstack, placer, pointed_thing) - mcl_potions.fire_resistance_func(placer, 1, 4) + mcl_potions.give_effect("fire_resistance", placer, 1, 4) return eat(itemstack, placer, pointed_thing) end, [ "poison" ] = function(itemstack, placer, pointed_thing) - mcl_potions.poison_func(placer, 1, 12) + mcl_potions.give_effect_by_level("poison", placer, 1, 12) return eat(itemstack, placer, pointed_thing) end, - [ "hunger" ] = function(itemstack, placer, pointed_thing, player) - mcl_hunger.item_eat(6, "mcl_core:bowl", 3.5, 0, 100) + [ "food_poisoning" ] = function(itemstack, placer, pointed_thing, player) + mcl_potions.give_effect_by_level("food_poisoning", placer, 10, 12) return eat(itemstack, placer, pointed_thing) end, ["jump"] = function(itemstack, placer, pointed_thing) - mcl_potions.leaping_func(placer, 1, 6) + mcl_potions.give_effect_by_level("leaping", placer, 1, 6) return eat(itemstack, placer, pointed_thing) end, ["regeneration"] = function(itemstack, placer, pointed_thing) - mcl_potions.regeneration_func(placer, 1, 8) + mcl_potions.give_effect_by_level("regeneration", placer, 1, 8) return eat(itemstack, placer, pointed_thing) end, ["night_vision"] = function(itemstack, placer, pointed_thing) - mcl_potions.night_vision_func(placer, 1, 5) + mcl_potions.give_effect("night_vision", placer, 1, 5) return eat(itemstack, placer, pointed_thing) end, } From e36b7f413b938e9da6eef42206e89729f372e8e2 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 04:34:27 +0200 Subject: [PATCH 77/91] Strays now use frost arrows --- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index f41d57fd3..a84264a83 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -113,7 +113,8 @@ local skeleton = { self.object:set_yaw(minetest.dir_to_yaw(vector.direction(self.object:get_pos(), self.attack:get_pos()))) end local dmg = math.random(2, 4) - mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object, nil, dmg) + local arrow = self.arrow:match("^(.+)_entity$") + mcl_bows.shoot_arrow(arrow, pos, dir, self.object:get_yaw(), self.object, nil, dmg) end end, shoot_interval = 2, @@ -140,10 +141,10 @@ stray.textures = { "mcl_bows_bow_0.png", }, } +stray.arrow = "mcl_potions:frost_arrow_entity" -- TODO: different sound (w/ echo) --- TODO: stray's arrow inflicts slowness status table.insert(stray.drops, { - name = "mcl_potions:slowness_arrow", + name = "mcl_potions:frost_arrow", chance = 2, min = 1, max = 1, From 55ce6f0f4b881dc4e051e1092e14a18f3599f8de Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 05:03:54 +0200 Subject: [PATCH 78/91] Migrated beacons to the new API Also added more effects to them --- mods/ITEMS/mcl_beacons/init.lua | 62 +++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 9941e9e50..953d036d3 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -4,8 +4,12 @@ there are strings in meta, which are being used to see which effect will be give Valid strings: swiftness leaping - strenght + strength regeneration + haste + resistance + slow_falling + absorption ]]-- mcl_beacons = { @@ -122,10 +126,17 @@ local formspec_string= "image[1,4.5;1,1;custom_beacom_symbol_2.png]".. "image[1,6;1,1;custom_beacom_symbol_1.png]".. - "image_button[5.2,1.5;1,1;mcl_potions_effect_swift.png;swiftness;]".. + "image_button[5.2,1.5;1,1;mcl_potions_effect_swiftness.png;swiftness;]".. + "image_button[8.5,1.5;1,1;mcl_potions_effect_haste.png;haste;]".. + "image_button[5.2,3;1,1;mcl_potions_effect_leaping.png;leaping;]".. - "image_button[5.2,4.5;1,1;mcl_potions_effect_strong.png;strenght;]".. - "image_button[5.2,6;1,1;mcl_potions_effect_regenerating.png;regeneration;]".. + "image_button[8.5,3;1,1;mcl_potions_effect_resistance.png;resistance;]".. + + "image_button[5.2,4.5;1,1;mcl_potions_effect_strength.png;strength;]".. + "image_button[8.5,4.5;1,1;mcl_potions_effect_absorption.png;absorption;]".. + + "image_button[5.2,6;1,1;mcl_potions_effect_regeneration.png;regeneration;]".. + "image_button[8.5,6;1,1;mcl_potions_effect_slow_falling.png;slow_falling;]".. "item_image[1,7;1,1;mcl_core:diamond]".. "item_image[2.2,7;1,1;mcl_core:emerald]".. @@ -197,15 +208,7 @@ end local function effect_player(effect,pos,power_level, effect_level,player) local distance = vector.distance(player:get_pos(), pos) if distance > (power_level+1)*10 then return end - if effect == "swiftness" then - mcl_potions.swiftness_func(player,effect_level,16) - elseif effect == "leaping" then - mcl_potions.leaping_func(player, effect_level, 16) - elseif effect == "strenght" then - mcl_potions.strength_func(player, effect_level, 16) - elseif effect == "regeneration" then - mcl_potions.regeneration_func(player, effect_level, 16) - end + mcl_potions.give_effect_by_level(effect, player, effect_level, 16) end local function apply_effects_to_all_players(pos) @@ -254,7 +257,8 @@ minetest.register_node("mcl_beacons:beacon", { remove_beacon_beam(pos) end, on_receive_fields = function(pos, formname, fields, sender) - if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then + if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght + or fields.haste or fields.resistance or fields.absorption or fields.slow_falling then local sender_name = sender:get_player_name() local power_level = beacon_blockcheck(pos) if minetest.is_protected(pos, sender_name) then @@ -293,6 +297,14 @@ minetest.register_node("mcl_beacons:beacon", { end minetest.get_meta(pos):set_string("effect","swiftness") successful = true + elseif fields.haste then + if power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + else + minetest.get_meta(pos):set_int("effect_level",1) + end + minetest.get_meta(pos):set_string("effect","haste") + successful = true elseif fields.leaping and power_level >= 2 then if power_level == 4 then minetest.get_meta(pos):set_int("effect_level",2) @@ -301,18 +313,38 @@ minetest.register_node("mcl_beacons:beacon", { end minetest.get_meta(pos):set_string("effect","leaping") successful = true + elseif fields.resistance and power_level >= 2 then + if power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + else + minetest.get_meta(pos):set_int("effect_level",1) + end + minetest.get_meta(pos):set_string("effect","resistance") + successful = true elseif fields.strenght and power_level >= 3 then if power_level == 4 then minetest.get_meta(pos):set_int("effect_level",2) else minetest.get_meta(pos):set_int("effect_level",1) end - minetest.get_meta(pos):set_string("effect","strenght") + minetest.get_meta(pos):set_string("effect","strength") + successful = true + elseif fields.absorption and power_level >= 3 then + if power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + else + minetest.get_meta(pos):set_int("effect_level",1) + end + minetest.get_meta(pos):set_string("effect","absorption") successful = true elseif fields.regeneration and power_level == 4 then minetest.get_meta(pos):set_int("effect_level",2) minetest.get_meta(pos):set_string("effect","regeneration") successful = true + elseif fields.slow_falling and power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + minetest.get_meta(pos):set_string("effect","slow_falling") + successful = true end if successful then if power_level == 4 then From 747bf16a9461ddf938f530060ff5190347cb3046 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 05:12:42 +0200 Subject: [PATCH 79/91] Migrated mobs to the new effects API --- mods/ENTITIES/mcl_mobs/combat.lua | 7 ++----- mods/ENTITIES/mobs_mc/skeleton_wither.lua | 2 +- mods/ENTITIES/mobs_mc/spider.lua | 2 +- mods/ENTITIES/mobs_mc/wither.lua | 10 +++++----- mods/ITEMS/mcl_potions/init.lua | 13 ------------- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 99878be2e..d9df817e4 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -21,8 +21,6 @@ local function atan(x) end end -mcl_mobs.effect_functions = {} - -- check if daytime and also if mob is docile during daylight hours function mob_class:day_docile() @@ -1153,9 +1151,8 @@ function mob_class:do_states_attack (dtime) damage_groups = {fleshy = self.damage} }, nil) if self.dealt_effect then - mcl_mobs.effect_functions[self.dealt_effect.name]( - self.attack, self.dealt_effect.factor, self.dealt_effect.dur - ) + mcl_potions.give_effect_by_level(self.dealt_effect.name, self.attack, + self.dealt_effect.level, self.dealt_effect.dur) end end else diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index c39104f4b..b01fb4b96 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -98,7 +98,7 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", { fire_resistant = true, dealt_effect = { name = "withering", - factor = 1, + level = 1, dur = 10, }, }) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 16f802c09..d01c7afbe 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -138,7 +138,7 @@ cave_spider.sounds = table.copy(spider.sounds) cave_spider.sounds.base_pitch = 1.25 cave_spider.dealt_effect = { name = "poison", - factor = 2.5, + level = 2, dur = 7, } mcl_mobs.register_mob("mobs_mc:cave_spider", cave_spider) diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index f1e1e6e78..252873629 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -349,7 +349,7 @@ mcl_mobs.register_mob("mobs_mc:wither", { mcl_util.deal_damage(objs[n], 8, {type = "magic"}) hit_some = true end - mcl_mobs.effect_functions["withering"](objs[n], 0.5, 10) + mcl_potions.give_effect("withering", objs[n], 2, 10) end if hit_some then mcl_mobs.effect(pos, 32, "mcl_particles_soul_fire_flame.png", 5, 10, self.reach, 1, 0) @@ -469,7 +469,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", { -- direct hit hit_player = function(self, player) local pos = vector.new(self.object:get_pos()) - mcl_mobs.effect_functions["withering"](player, 0.5, 10) + mcl_potions.give_effect("withering", player, 2, 10) player:punch(self.object, 1.0, { full_punch_interval = 0.5, damage_groups = {fleshy = 8}, @@ -484,7 +484,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", { hit_mob = function(self, mob) local pos = vector.new(self.object:get_pos()) - mcl_mobs.effect_functions["withering"](mob, 0.5, 10) + mcl_potions.give_effect("withering", mob, 2, 10) mob:punch(self.object, 1.0, { full_punch_interval = 0.5, damage_groups = {fleshy = 8}, @@ -522,7 +522,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", { -- direct hit hit_player = function(self, player) local pos = vector.new(self.object:get_pos()) - mcl_mobs.effect_functions["withering"](player, 0.5, 10) + mcl_potions.give_effect("withering", player, 2, 10) player:punch(self.object, 1.0, { full_punch_interval = 0.5, damage_groups = {fleshy = 12}, @@ -541,7 +541,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", { hit_mob = function(self, mob) local pos = vector.new(self.object:get_pos()) - mcl_mobs.effect_functions["withering"](mob, 0.5, 10) + mcl_potions.give_effect("withering", mob, 2, 10) mob:punch(self.object, 1.0, { full_punch_interval = 0.5, damage_groups = {fleshy = 12}, diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index d70e14f36..cdc095203 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -633,19 +633,6 @@ function mcl_potions.get_alchemy(ingr, pot) return false end --- TODO replace all calls to the old API with new API calls in other mods --- mcl_mobs.effect_functions["poison"] = mcl_potions.poison_func --- mcl_mobs.effect_functions["regeneration"] = mcl_potions.regeneration_func --- mcl_mobs.effect_functions["invisibility"] = mcl_potions.invisiblility_func --- mcl_mobs.effect_functions["fire_resistance"] = mcl_potions.fire_resistance_func --- mcl_mobs.effect_functions["night_vision"] = mcl_potions.night_vision_func --- mcl_mobs.effect_functions["water_breathing"] = mcl_potions.water_breathing_func --- mcl_mobs.effect_functions["leaping"] = mcl_potions.leaping_func --- mcl_mobs.effect_functions["swiftness"] = mcl_potions.swiftness_func --- mcl_mobs.effect_functions["heal"] = mcl_potions.healing_func --- mcl_mobs.effect_functions["bad_omen"] = mcl_potions.bad_omen_func --- mcl_mobs.effect_functions["withering"] = mcl_potions.withering_func - -- give withering to players in a wither rose local etime = 0 minetest.register_globalstep(function(dtime) From cafa36d0b44ea635568db3ffd1600bb2e7f83b4b Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 05:19:41 +0200 Subject: [PATCH 80/91] Add more sus stew effects --- mods/ITEMS/mcl_sus_stew/init.lua | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_sus_stew/init.lua b/mods/ITEMS/mcl_sus_stew/init.lua index a4c3aae31..8a88027ae 100644 --- a/mods/ITEMS/mcl_sus_stew/init.lua +++ b/mods/ITEMS/mcl_sus_stew/init.lua @@ -7,12 +7,18 @@ local eat = minetest.item_eat(6, "mcl_core:bowl") --6 hunger points, player rece local flower_effect = { [ "mcl_flowers:allium" ] = "fire_resistance", + [ "mcl_flowers:azure_bluet" ] = "blindness", [ "mcl_flowers:lily_of_the_valley" ] = "poison", - [ "mcl_flowers:blue_orchid" ] = "food_poisoning", - [ "mcl_flowers:dandelion" ] = "food_poisoning", + [ "mcl_flowers:blue_orchid" ] = "saturation", + [ "mcl_flowers:dandelion" ] = "saturation", [ "mcl_flowers:cornflower" ] = "jump", [ "mcl_flowers:oxeye_daisy" ] = "regeneration", - [ "mcl_flowers:poppy" ] = "night_vision" + [ "mcl_flowers:poppy" ] = "night_vision", + [ "mcl_flowers:wither_rose" ] = "withering", + [ "mcl_flowers:tulip_orange" ] = "weakness", + [ "mcl_flowers:tulip_pink" ] = "weakness", + [ "mcl_flowers:tulip_red" ] = "weakness", + [ "mcl_flowers:tulip_white" ] = "weakness", } local effects = { @@ -20,13 +26,19 @@ local effects = { mcl_potions.give_effect("fire_resistance", placer, 1, 4) return eat(itemstack, placer, pointed_thing) end, + + [ "blindness" ] = function(itemstack, placer, pointed_thing) + mcl_potions.give_effect("blindness", placer, 1, 8) + return eat(itemstack, placer, pointed_thing) + end, + [ "poison" ] = function(itemstack, placer, pointed_thing) mcl_potions.give_effect_by_level("poison", placer, 1, 12) return eat(itemstack, placer, pointed_thing) end, - [ "food_poisoning" ] = function(itemstack, placer, pointed_thing, player) - mcl_potions.give_effect_by_level("food_poisoning", placer, 10, 12) + [ "saturation" ] = function(itemstack, placer, pointed_thing, player) + mcl_potions.give_effect_by_level("saturation", placer, 1, 0.5) return eat(itemstack, placer, pointed_thing) end, @@ -40,6 +52,16 @@ local effects = { return eat(itemstack, placer, pointed_thing) end, + ["withering"] = function(itemstack, placer, pointed_thing) + mcl_potions.give_effect_by_level("withering", placer, 1, 8) + return eat(itemstack, placer, pointed_thing) + end, + + ["weakness"] = function(itemstack, placer, pointed_thing) + mcl_potions.give_effect_by_level("weakness", placer, 1, 9) + return eat(itemstack, placer, pointed_thing) + end, + ["night_vision"] = function(itemstack, placer, pointed_thing) mcl_potions.give_effect("night_vision", placer, 1, 5) return eat(itemstack, placer, pointed_thing) From d306260c7e900f75d4dca782559678ea5254abcc Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 05:23:18 +0200 Subject: [PATCH 81/91] Guardian fixes --- mods/ENTITIES/mobs_mc/guardian.lua | 4 +--- mods/ENTITIES/mobs_mc/guardian_elder.lua | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/guardian.lua b/mods/ENTITIES/mobs_mc/guardian.lua index f2addbfa0..473575665 100644 --- a/mods/ENTITIES/mobs_mc/guardian.lua +++ b/mods/ENTITIES/mobs_mc/guardian.lua @@ -99,9 +99,7 @@ mcl_mobs.register_mob("mobs_mc:guardian", { view_range = 16, }) --- Spawning disabled due to size issues --- TODO: Re-enable spawning ---mcl_mobs:spawn_specific("mobs_mc:guardian", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level - 10) +mcl_mobs:spawn_specific("mobs_mc:guardian", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level - 10) mcl_mobs:non_spawn_specific("mobs_mc:guardian","overworld",0,minetest.LIGHT_MAX+1) -- spawn eggs mcl_mobs.register_egg("mobs_mc:guardian", S("Guardian"), "#5a8272", "#f17d31", 0) diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index 094c0513c..47ca568e1 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -105,11 +105,14 @@ mcl_mobs.register_mob("mobs_mc:guardian_elder", { fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, jump = false, view_range = 16, + dealt_effect = { + name = "fatigue", + level = 3, + dur = 30, + }, }) --- Spawning disabled due to size issues <- what do you mean? -j4i --- TODO: Re-enable spawning --- mcl_mobs:spawn_specific("mobs_mc:guardian_elder", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level-18) +mcl_mobs:spawn_specific("mobs_mc:guardian_elder", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level-18) -- spawn eggs mcl_mobs.register_egg("mobs_mc:guardian_elder", S("Elder Guardian"), "#ceccba", "#747693", 0) From dbea863553a99923b95b0261cc78f892ddfb2cf0 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 06:25:01 +0200 Subject: [PATCH 82/91] Legacy potions converter --- mods/ITEMS/mcl_potions/potions.lua | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index cc83954c7..bda47f1e3 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -1,6 +1,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) mcl_potions.registered_potions = {} +-- shorthand +local registered_potions = mcl_potions.registered_potions local function potion_image(colorstring, opacity) if not opacity then @@ -810,3 +812,50 @@ mcl_potions.register_potion({ has_lingering = false, }) + + + +-- COMPAT CODE +local function replace_legacy_potion(itemstack) + local name = itemstack:get_name() + local new_name = name:match("^(.+)_plus$") + local new_stack + if new_name then + new_stack = ItemStack(new_name) + new_stack:get_meta():set_int("mcl_potions:potion_plus", + registered_potions[new_name]._default_extend_level) + tt.reload_itemstack_description(new_stack) + end + new_name = name:match("^(.+)_2$") + if new_name then + new_stack = ItemStack(new_name) + new_stack:get_meta():set_int("mcl_potions:potion_potent", + registered_potions[new_name]._default_potent_level-1) + tt.reload_itemstack_description(new_stack) + end + return new_stack +end +local compat = "mcl_potions:compat_potion" +minetest.register_craftitem(compat, { + description = S("Unknown Potion"), + _tt_help = S("Right-click to identify"), + image = "mcl_potions_dragon_breath.png", + on_secondary_use = replace_legacy_potion, + on_place = replace_legacy_potion, +}) + +local old_potions_plus = { + "fire_resistance", "water_breathing", "invisibility", "regeneration", "poison", + "withering", "leaping", "slowness", "swiftness", "night_vision" +} +local old_potions_2 = { + "healing", "harming", "swiftness", "slowness", "leaping", + "withering", "poison", "regeneration" +} + +for _, name in pairs(old_potions_2) do + minetest.register_alias("mcl_potions:" .. name .. "_2", compat) +end +for _, name in pairs(old_potions_plus) do + minetest.register_alias("mcl_potions:" .. name .. "_plus", compat) +end From 7a4c1ceba52b151f8880bb10e34cc9a11bd1a13a Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 06:47:56 +0200 Subject: [PATCH 83/91] Legacy potion conversion extended --- mods/ITEMS/mcl_potions/potions.lua | 33 ++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index bda47f1e3..545b11876 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -818,19 +818,38 @@ mcl_potions.register_potion({ -- COMPAT CODE local function replace_legacy_potion(itemstack) local name = itemstack:get_name() - local new_name = name:match("^(.+)_plus$") + local suffix = "" + local bare_name = name:match("^(.+)_splash$") + if bare_name then + suffix = "_splash" + else + bare_name = name:match("^(.+)_lingering$") + if bare_name then + suffix = "_lingering" + else + bare_name = name:match("^(.+)_arrow$") + if bare_name then + suffix = "_arrow" + else + bare_name = name + end + end + end + local new_name = bare_name:match("^(.+)_plus$") local new_stack if new_name then - new_stack = ItemStack(new_name) + new_stack = ItemStack(new_name..suffix) new_stack:get_meta():set_int("mcl_potions:potion_plus", registered_potions[new_name]._default_extend_level) + new_stack:set_count(itemstack:get_count()) tt.reload_itemstack_description(new_stack) end - new_name = name:match("^(.+)_2$") + new_name = bare_name:match("^(.+)_2$") if new_name then - new_stack = ItemStack(new_name) + new_stack = ItemStack(new_name..suffix) new_stack:get_meta():set_int("mcl_potions:potion_potent", registered_potions[new_name]._default_potent_level-1) + new_stack:set_count(itemstack:get_count()) tt.reload_itemstack_description(new_stack) end return new_stack @@ -855,7 +874,13 @@ local old_potions_2 = { for _, name in pairs(old_potions_2) do minetest.register_alias("mcl_potions:" .. name .. "_2", compat) + minetest.register_alias("mcl_potions:" .. name .. "_2_splash", compat) + minetest.register_alias("mcl_potions:" .. name .. "_2_lingering", compat) + minetest.register_alias("mcl_potions:" .. name .. "_2_arrow", compat) end for _, name in pairs(old_potions_plus) do minetest.register_alias("mcl_potions:" .. name .. "_plus", compat) + minetest.register_alias("mcl_potions:" .. name .. "_plus_splash", compat) + minetest.register_alias("mcl_potions:" .. name .. "_plus_lingering", compat) + minetest.register_alias("mcl_potions:" .. name .. "_plus_arrow", compat) end From 664993ca7532decc222e47e86efdb2c4058036a2 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 07:37:10 +0200 Subject: [PATCH 84/91] Fixed mob drops not having proper description --- mods/ENTITIES/mcl_item_entity/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 19e91b460..2cb506450 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -127,6 +127,7 @@ local function try_object_pickup(player, inv, object, checkpos) -- Add what we can to the inventory local itemstack = ItemStack(le.itemstring) + tt.reload_itemstack_description(itemstack) local leftovers = inv:add_item("main", itemstack ) check_pickup_achievements(object, player) From 651fb74be1e5dd5c2f7c31fd5b65dd51352fe72c Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 14:29:00 +0200 Subject: [PATCH 85/91] Fix a crash --- mods/ENTITIES/mcl_mobs/spawning.lua | 3 +++ mods/ENTITIES/mobs_mc/guardian.lua | 2 +- mods/ENTITIES/mobs_mc/guardian_elder.lua | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index b0e6260aa..8a8a42281 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -565,6 +565,9 @@ function mcl_mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ return end + assert(min_height) + assert(max_height) + -- chance/spawn number override in minetest.conf for registered mob local numbers = minetest.settings:get(name) diff --git a/mods/ENTITIES/mobs_mc/guardian.lua b/mods/ENTITIES/mobs_mc/guardian.lua index 473575665..ab4051626 100644 --- a/mods/ENTITIES/mobs_mc/guardian.lua +++ b/mods/ENTITIES/mobs_mc/guardian.lua @@ -99,7 +99,7 @@ mcl_mobs.register_mob("mobs_mc:guardian", { view_range = 16, }) -mcl_mobs:spawn_specific("mobs_mc:guardian", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level - 10) +mcl_mobs:spawn_specific("mobs_mc:guardian", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level - 10, mobs_mc.water_level) mcl_mobs:non_spawn_specific("mobs_mc:guardian","overworld",0,minetest.LIGHT_MAX+1) -- spawn eggs mcl_mobs.register_egg("mobs_mc:guardian", S("Guardian"), "#5a8272", "#f17d31", 0) diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index 47ca568e1..be787216c 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -112,7 +112,7 @@ mcl_mobs.register_mob("mobs_mc:guardian_elder", { }, }) -mcl_mobs:spawn_specific("mobs_mc:guardian_elder", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level-18) +mcl_mobs:spawn_specific("mobs_mc:guardian_elder", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level-18, mobs_mc.water_level) -- spawn eggs mcl_mobs.register_egg("mobs_mc:guardian_elder", S("Elder Guardian"), "#ceccba", "#747693", 0) From 551bc99517c8702923698cffdddfb5ad7fe0fe6f Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 27 Apr 2024 21:21:16 +0200 Subject: [PATCH 86/91] Improved compat alias visual --- mods/ITEMS/mcl_potions/potions.lua | 14 +++++++++++--- textures/vl_unknown.png | Bin 0 -> 111 bytes 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 textures/vl_unknown.png diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 545b11876..938fdde6e 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -855,10 +855,18 @@ local function replace_legacy_potion(itemstack) return new_stack end local compat = "mcl_potions:compat_potion" +local compat_arrow = "mcl_potions:compat_arrow" minetest.register_craftitem(compat, { description = S("Unknown Potion"), _tt_help = S("Right-click to identify"), - image = "mcl_potions_dragon_breath.png", + image = "mcl_potions_potion_overlay.png^[colorize:#00F:127^mcl_potions_potion_bottle.png^vl_unknown.png", + on_secondary_use = replace_legacy_potion, + on_place = replace_legacy_potion, +}) +minetest.register_craftitem(compat_arrow, { + description = S("Unknown Tipped Arrow"), + _tt_help = S("Right-click to identify"), + image = "mcl_bows_arrow_inv.png^(mcl_potions_arrow_inv.png^[colorize:#FFF:100)^vl_unknown.png", on_secondary_use = replace_legacy_potion, on_place = replace_legacy_potion, }) @@ -876,11 +884,11 @@ for _, name in pairs(old_potions_2) do minetest.register_alias("mcl_potions:" .. name .. "_2", compat) minetest.register_alias("mcl_potions:" .. name .. "_2_splash", compat) minetest.register_alias("mcl_potions:" .. name .. "_2_lingering", compat) - minetest.register_alias("mcl_potions:" .. name .. "_2_arrow", compat) + minetest.register_alias("mcl_potions:" .. name .. "_2_arrow", compat_arrow) end for _, name in pairs(old_potions_plus) do minetest.register_alias("mcl_potions:" .. name .. "_plus", compat) minetest.register_alias("mcl_potions:" .. name .. "_plus_splash", compat) minetest.register_alias("mcl_potions:" .. name .. "_plus_lingering", compat) - minetest.register_alias("mcl_potions:" .. name .. "_plus_arrow", compat) + minetest.register_alias("mcl_potions:" .. name .. "_plus_arrow", compat_arrow) end diff --git a/textures/vl_unknown.png b/textures/vl_unknown.png new file mode 100644 index 0000000000000000000000000000000000000000..279a4cdb076afa6aa029f2e732fcddb712c8f892 GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`W}YsNAr_~T6Be-k;CH!Ua8s(& zsAGasQ=7nRpGA9(EqE0)-Bv7`xn@hld4^wX5}^kUs7oa=FzA$IPCvikBs0(i22WQ% Jmvv4FO#o^^A|L<& literal 0 HcmV?d00001 From 191dd1b95019057e5bd73ee6bd059ef8dca935c2 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 28 Apr 2024 01:00:45 +0200 Subject: [PATCH 87/91] Update template.txt --- mods/ITEMS/mcl_potions/locale/template.txt | 345 ++++++++++++++++----- mods/ITEMS/mcl_potions/potions.lua | 18 +- 2 files changed, 268 insertions(+), 95 deletions(-) diff --git a/mods/ITEMS/mcl_potions/locale/template.txt b/mods/ITEMS/mcl_potions/locale/template.txt index 1420dabee..50c622391 100644 --- a/mods/ITEMS/mcl_potions/locale/template.txt +++ b/mods/ITEMS/mcl_potions/locale/template.txt @@ -1,13 +1,274 @@ # textdomain: mcl_potions - []= +Invisibility= +body is invisible= -Add a status effect to yourself. Arguments: : name of status effect, e.g. poison. : duration in seconds. : effect strength multiplier (1 @= 100%)= +Poison= +-1 HP / @1 s= + +Regeneration= ++1 HP / @1 s= + +Strength= ++@1% melee damage= + +Weakness= +-@1% melee damage= + +Water Breathing= +limitless breathing under water= + +Dolphin's Grace= +swimming gracefully= + +Leaping= ++@1% jumping power= +-@1% jumping power= + +Slow Falling= +decreases gravity effects= + +Swiftness= ++@1% running speed= + +Slowness= +-@1% running speed= + +Levitation= +moves body upwards at @1 nodes/s= + +Night Vision= +improved vision during the night= + +Darkness= +surrounded by darkness= +not seeing anything beyond @1 nodes= + +Glowing= +more visible at all times= + +Health Boost= +HP increased by @1= + +Absorption= +absorbs up to @1 incoming damage= + +Fire Resistance= +resistance to fire damage= + +Resistance= +resist @1% of incoming damage= + +Luck= + +Bad Luck= + +Bad Omen= +danger is imminent= + +Hero of the Village= + +Withering= +-1 HP / @1 s, can kill= + +Frost= +-1 HP / 1 s, can kill, -@1% running speed= + +Blindness= +impaired sight= + +Nausea= +not feeling very well...= +frequency: @1 / 1 s= + +Food Poisoning= +exhausts by @1 per second= + +Saturation= +saturates by @1 per second= + +Haste= ++@1% mining and attack speed= + +Fatigue= +-@1% mining and attack speed= + +Conduit Power= ++@1% mining and attack speed in water= + + +|heal|list|clear|remove |INF [] [] [NOPART]= + +Add a status effect to yourself. Arguments: : name of status effect. Passing "list" as effect name lists available effects. Passing "heal" as effect name heals (or harms) by amount designed by the next parameter. Passing "clear" as effect name removes all effects. Passing "remove" as effect name removes the effect named by the next parameter. : duration in seconds. Passing "INF" as duration makes the effect infinite. (: amount of healing when the effect is "heal", passing a negative value subtracts health. : name of a status effect to be removed when using "remove" as the previous parameter.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor. NOPART at the end means no particles will be shown for this effect.= Missing effect parameter!= -Missing or invalid duration parameter!= -Invalid factor parameter!= +Missing or invalid heal amount parameter!= +Player @1 healed by @2 HP.= +Player @1 harmed by @2 HP.= +Effects cleared for player @1= +Removed effect @1 from player @2= @1 is not an available status effect.= +Missing or invalid duration parameter!= +Invalid level parameter!= +Missing or invalid factor parameter when level is F!= + +@1 effect given to player @2 for @3 seconds with factor of @4.= +@1 effect given to player @2 for @3 seconds.= +Giving effect @1 to player @2 failed.= +@1 effect on level @2 given to player @3 for @4 seconds.= +@1 effect given to player @2 for @3 seconds.= +Giving effect @1 to player @2 failed.= +@1 is not an available status effect.= + + +A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect or a set of status effects.= +Use the “Punch” key to throw it.= + + +A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect or set of effects, possibly repeatedly.= + + +This particular arrow is tipped and will give an effect when it hits a player or mob.= + + +Use the “Place” key to drink it.= +Drinking a potion gives you a particular effect or set of effects.= + +@1 Potion @2= +@1 Potion= +Potion @1= +Strange Potion= + +Stacks the effect= + +Splash @1= +Lingering @1= +@1 Arrow @2= +@1 Arrow= +Arrow @1= +Strange Tipped Arrow= + +Mighty= +of Trolling= + +Dragon's Breath= +This item is used in brewing and can be combined with splash potions to create lingering potions.= + +Awkward= +No effect= +Has an awkward taste and is used for brewing potions.= + +Mundane= +Has a terrible taste and is not really useful for brewing potions.= + +Thick= +Has a bitter taste and may be useful for brewing potions.= + +of Healing= ++@1 HP= +Instantly heals.= + +of Harming= +-@1 HP= +Instantly deals damage.= + +of Night Vision= +Increases the perceived brightness of light under a dark sky.= + +of Swiftness= +Increases walking speed.= + +of Slowness= +Decreases walking speed.= + +of Leaping= +Increases jump strength.= + +of Withering= +Applies the withering effect which deals damage at a regular interval and can kill.= + +of Poison= +Applies the poison effect which deals damage at a regular interval.= + +of Regeneration= +Regenerates health over time.= + +of Invisibility= +Grants invisibility.= + +of Water Breathing= +Grants limitless breath underwater.= + +of Fire Resistance= +Grants immunity to damage from heat sources like fire.= + +of Strength= +Increases attack power.= + +of Weakness= +Decreases attack power.= + +of Slow Falling= +Instead of falling, you descend gracefully.= + +of Levitation= +Floats body slowly upwards.= + +of Darkness= +Surrounds with darkness.= + +of Glowing= +Highlights for others to see.= + +of Health Boost= +Increases health.= + +of Absorption= +Absorbs some incoming damage.= + +of Resistance= +Decreases damage taken.= + +of Stone Cloak= +Decreases damage taken at the cost of speed.= + +of Luck= +Increases luck.= + +of Bad Luck= +Decreases luck.= + +of Frost= +Freezes...= + +of Blindness= +Impairs sight.= + +of Nausea= +Disintegrates senses.= + +of Food Poisoning= +Moves bowels too fast.= + +of Saturation= +Satisfies hunger.= + +of Haste= +Increases digging and attack speed.= + +of Fatigue= +Decreases digging and attack speed.= + +Ominous= +Attracts danger.= + +Unknown Potion= +Right-click to identify= +Unknown Tipped Arrow= + + Fermented Spider Eye= +Try different combinations to create potions.= + Glass Bottle= Liquid container= @@ -37,79 +298,3 @@ A throwable water bottle that will shatter on impact, where it creates a cloud o Glistering Melon= This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else.= - -A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect, possibly repeatedly.= - -Use the “Punch” key to throw it.= -Use the “Place” key to drink it.= -Drinking a potion gives you a particular effect.= -1 HP/@1s | @2= -@1 HP= -@1 Potion= -Splash @1 Potion= -Lingering @1 Potion= -Arrow of @1= - II= - IV= -@1 Potion@2= -Splash @1@2 Potion= -Lingering @1@2 Potion= -Arrow of @1@2= -@1 + Potion= -Splash @1 + Potion= -Lingering @1 + Potion= -Arrow of @1 += -Awkward Potion= -Awkward Splash Potion= -Awkward Lingering Potion= -Has an awkward taste and is used for brewing potions.= -Mundane Potion= -Mundane Splash Potion= -Mundane Lingering Potion= -Has a terrible taste and is not useful for brewing potions.= -Thick Potion= -Thick Splash Potion= -Thick Lingering Potion= -Has a bitter taste and is not useful for brewing potions.= -Dragon's Breath= - -This item is used in brewing and can be combined with splash potions to create lingering potions.= - -Healing= -+4 HP= -+8 HP= -Instantly heals.= -Harming= --6 HP= --12 HP= -Instantly deals damage.= -Night Vision= -Increases the perceived brightness of light under a dark sky.= -Swiftness= -Increases walking speed.= -Slowness= -Decreases walking speed.= -Leaping= -Increases jump strength.= -Poison= -Applies the poison effect which deals damage at a regular interval.= -Regeneration= -Regenerates health over time.= -Invisibility= -Grants invisibility.= -Water Breathing= -Grants limitless breath underwater.= -Fire Resistance= -Grants immunity to damage from heat sources like fire.= -Weakness= -Weakness += -Strength= -Strength II= -Strength += -Try different combinations to create potions.= -No effect= - -A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect.= - -This particular arrow is tipped and will give an effect when it hits a player or mob.= - diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 938fdde6e..471c4ad3d 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -386,7 +386,7 @@ mcl_potions.register_potion({ name = "thick", desc_prefix = S("Thick"), _tt = S("No effect"), - _longdesc = S("Has a bitter taste and is not really useful for brewing potions."), + _longdesc = S("Has a bitter taste and may be useful for brewing potions."), color = "#0000FF", }) @@ -650,20 +650,8 @@ mcl_potions.register_potion({ }) mcl_potions.register_potion({ - name = "resistance", - desc_suffix = S("of Resistance"), - _tt = nil, - _longdesc = S("Decreases damage taken."), - color = "#2552A5", - _effect_list = { - resistance = {}, - }, - has_arrow = true, -}) - -mcl_potions.register_potion({ - name = "turtle_master", - desc_suffix = S("of Turtle Master"), + name = "stone_cloak", + desc_suffix = S("of Stone Cloak"), _tt = nil, _longdesc = S("Decreases damage taken at the cost of speed."), color = "#255235", From 496360a1c414f603e39fcb52352166f432dae6f3 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sun, 28 Apr 2024 03:04:47 +0200 Subject: [PATCH 88/91] Updated Polish translation --- mods/HELP/mcl_tt/locale/mcl_tt.pl.tr | 2 +- mods/HELP/mcl_tt/locale/template.txt | 1 + .../mcl_potions/locale/mcl_potions.pl.tr | 355 +++++++++++++----- mods/ITEMS/mcl_potions/locale/template.txt | 5 - mods/ITEMS/mcl_potions/potions.lua | 3 - 5 files changed, 269 insertions(+), 97 deletions(-) diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr b/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr index 7eb8f4c77..912c98ac7 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr @@ -45,4 +45,4 @@ Durability: @1=Wytrzymałość: @1 Block breaking strength: @1=Siła niszczenia bloku: @1 @1 uses=@1 użyć Unlimited uses=Nielimitowane użycia - +...stacks=...kumuluje się diff --git a/mods/HELP/mcl_tt/locale/template.txt b/mods/HELP/mcl_tt/locale/template.txt index 3e3b4d300..15076ec24 100644 --- a/mods/HELP/mcl_tt/locale/template.txt +++ b/mods/HELP/mcl_tt/locale/template.txt @@ -45,3 +45,4 @@ Block breaking strength: @1= @1 uses= Unlimited uses= Durability: @1= +...stacks= diff --git a/mods/ITEMS/mcl_potions/locale/mcl_potions.pl.tr b/mods/ITEMS/mcl_potions/locale/mcl_potions.pl.tr index abf61d4d3..db835bd9e 100644 --- a/mods/ITEMS/mcl_potions/locale/mcl_potions.pl.tr +++ b/mods/ITEMS/mcl_potions/locale/mcl_potions.pl.tr @@ -1,115 +1,294 @@ # textdomain: mcl_potions - []= [] +Invisibility=Niewidzialność +body is invisible=ciało jest niewidzialne + +Poison=Trucizna +-1 HP / @1 s=-1 PŻ / @1 s + +Regeneration=Regeneracja ++1 HP / @1 s=+1 PŻ / @1 s + +Strength=Siła ++@1% melee damage=+@1% obrażeń w walce wręcz + +Weakness=Osłabienie +-@1% melee damage=-@1% obrażeń w walce wręcz + +Water Breathing=Oddychanie pod Wodą +limitless breathing under water=nieograniczone oddychanie pod wodą + +Dolphin's Grace=Gracja Delfina +swimming gracefully=pływanie z gracją + +Leaping=Zwiększony Skok ++@1% jumping power=+@1% siły skoku +-@1% jumping power=-@1% siły skoku + +Slow Falling=Powolne Opadanie +decreases gravity effects=zmniejsza skutki grawitacji + +Swiftness=Szybkość ++@1% running speed=+@1% prędkości w biegu + +Slowness=Spowolnienie +-@1% running speed=-@1% prędkości w biegu + +Levitation=Lewitacja +moves body upwards at @1 nodes/s=porusza ciało w górę z prędkością @1 bloków/s + +Night Vision=Noktowizja +improved vision during the night=poprawione widzenie w nocy + +Darkness=Ciemność +surrounded by darkness=otoczony ciemnością +not seeing anything beyond @1 nodes=nie widzi nic poza @1 blokami + +Glowing=Blask +more visible at all times=bardziej widoczny przez cały czas + +Health Boost=Zwiększone Zdrowie +HP increased by @1=PŻ zwiększone o @1 + +Absorption=Absorpcja +absorbs up to @1 incoming damage=pochłania do @1 otrzymywanych obrażeń + +Fire Resistance=Odporność na Ogień +resistance to fire damage=odporność na szkody od ognia + +Resistance=Odporność +resist @1% of incoming damage=zmniejsza otrzymywane obrażenia o @1% + +Luck=Szczęście + +Bad Luck=Pech + +Bad Omen=Zły Omen +danger is imminent=zagrożenie jest blisko + +Hero of the Village=Bohater Wioski + +Withering=Obumieranie +-1 HP / @1 s, can kill=-1 PŻ / @1 s, może zabić + +Frost=Mróz +-1 HP / 1 s, can kill, -@1% running speed=-1 PŻ / 1 s, może zabić, -@1% prędkości w biegu + +Blindness=Ślepota +impaired sight=upośledzony wzrok + +Nausea=Nudności +not feeling very well...=nie czuje się zbyt dobrze +frequency: @1 / 1 s=częstotliwość: @1 / 1 s + +Food Poisoning=Zatrucie Pokarmowe +exhausts by @1 per second=wyczerpuje o @1 na sekundę + +Saturation=Nasycenie +saturates by @1 per second=nasyca o @1 na sekundę + +Haste=Pośpiech ++@1% mining and attack speed=+@1% prędkości kopania i ataku + +Fatigue=Zmęczenie +-@1% mining and attack speed=-@1% prędkości kopania i ataku + +Conduit Power=Moc Przewodni ++@1% mining and attack speed in water=+@1% prędkości kopania i ataku w wodzie + + +|heal|list|clear|remove |INF [] [] [NOPART]=|heal|list|clear|remove |INF [] [] [NOPART] + +Add a status effect to yourself. Arguments: : name of status effect. Passing "list" as effect name lists available effects. Passing "heal" as effect name heals (or harms) by amount designed by the next parameter. Passing "clear" as effect name removes all effects. Passing "remove" as effect name removes the effect named by the next parameter. : duration in seconds. Passing "INF" as duration makes the effect infinite. (: amount of healing when the effect is "heal", passing a negative value subtracts health. : name of a status effect to be removed when using "remove" as the previous parameter.) : effect power determinant, bigger level results in more powerful effect for effects that depend on the level (no changes for other effects), defaults to 1, pass F to use low-level factor instead. : effect strength modifier, can mean different things depending on the effect, no changes for effects that do not depend on level/factor. NOPART at the end means no particles will be shown for this effect.=Nadaj efekt statusu dla samego siebie. Argumenty: : nazwa efektu statusu (po angielsku). Przekazanie "list" jako nazwa efektu wypisuje dostępne nazwy efektów. Przekazanie "heal" jako nazwa efektu leczy (albo krzywdzi) o ilość określoną następnym parametrem. Przekazanie "clear" jako nazwy efektu usuwa wszystkie efekty. Przekazanie "remove" jako nazwy efektu usuwa efekt określony następnym parametrem. : czas trwania w sekundach. Przekazanie "INF" jako czas trwania czyni efekt nieskończonym. (: ilość leczenia kiedy ID-efektu to "heal", przekazanie liczby ujemnej zabiera zdrowie. : nazwa efektu statusu do usunięcia używając "remove" jako poprzedniego parametru.) : wyznacznik siły efektu, wyższy poziom skutkuje potężniejszym efektem prze efektach zależnych od poziomu (brak zmiany przy pozostałych), domyślnie 1, przekaż F żeby użyć niskopoziomowego współczynnika zamiast poziomu. : modyfikator siły efektu, może oznaczać różne rzeczy dla różnych efektów, nie wpływa na efekty, które nie zależą od poziomu/współczynnika. NOPART na końcu oznacza, że cząsteczki nie będą wyświetlane wokół ciebie dla tego efektu. + +Missing effect parameter!=Brakujący ID efektu! +Missing or invalid heal amount parameter!=Brakująca lub niewłaściwa ilość leczenia! +Player @1 healed by @2 HP.=Gracz @1 wyleczony o @2 PŻ. +Player @1 harmed by @2 HP.=Gracz @1 skrzywdzony o @2 PŻ. +Effects cleared for player @1=Efekty wyczyszczone dla gracza @1 +Removed effect @1 from player @2=Usunięto efekt @1 z gracza @2 +@1 is not an available status effect.=@1 nie jest dostępnym efektem. +Missing or invalid duration parameter!=Brakujący lub niewłaściwy czas trwania! +Invalid level parameter!=Niewłaściwy parametr poziomu! +Missing or invalid factor parameter when level is F!=Brakujący lub niewłaściwy współczynnik kiedy poziom to F! + +@1 effect given to player @2 for @3 seconds with factor of @4.=Efekt @1 nadany dla gracza @2 na @3 sekund ze współczynnikiem @4. +@1 effect given to player @2 for @3 seconds.=Efekt @1 nadany dla gracza @2 na #3 sekund. +Giving effect @1 to player @2 failed.=Nadawanie efektu @1 dla gracza @2 nie powiodło się. +@1 effect on level @2 given to player @3 for @4 seconds.=Efekt @1 na poziomie @2 nadany dla gracza @3 na @4 sekund. + + +A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect or a set of status effects.=Mikstura, którą można rzucić, a rozbije się przy uderzeniu, wystawiając wszystkich pobliskich graczy i moby na skutki jej działania. +Use the “Punch” key to throw it.=Użyj przycisku "Uderz" by rzucić. + + +A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect or set of effects, possibly repeatedly.=Mikstura, którą można rzucić, a roztrzaska się przy uderzeniu, tworząc magiczne opary pozostające przez chwilę na ziemi. Jakikolwiek gracz lub mob wewnątrz oparów będzie wystawiony na skutki mikstury, być może wielokrotnie. + + +This particular arrow is tipped and will give an effect when it hits a player or mob.=Czubek tej strzały jest zanurzony w miksturze, co wystawi jej cel na skutki jej działania. + + +Use the “Place” key to drink it.=Użyj przycisku "Postaw" by wypić. +Drinking a potion gives you a particular effect or set of effects.=Wypicie mikstury wywoła u ciebie określone skutki. + +@1 Potion @2=@1 Mikstura @2 +@1 Potion=@1 Mikstura +Potion @1=Mikstura @1 +Strange Potion=Dziwna Mikstura + +Splash @1=Miotana @1 +Lingering @1=Trwała @1 +@1 Arrow @2=@1 Strzała @2 +@1 Arrow=@1 Strzała +Arrow @1=Strzała @1 +Strange Tipped Arrow=Strzała z Dziwnym Grotem + +Mighty=Potężna +of Trolling=Trollowania + +Dragon's Breath=Oddech Smoka +This item is used in brewing and can be combined with splash potions to create lingering potions.=Ten przedmiot jest używany przy warzeniu i może zostać dodany do miotanych mikstur, aby uczynić je trwałymi. + +Awkward=Klarowna +No effect=Brak efektu +Has an awkward taste and is used for brewing potions.=Ma dziwny smak i jest używana do warzenia mikstur. + +Mundane=Mdła +Has a terrible taste and is not really useful for brewing potions.=Ma ohydny smak i nie jest zbyt użyteczna przy warzeniu mikstur. + +Thick=Gęsta +Has a bitter taste and may be useful for brewing potions.=Ma cierpki smak i może być użyteczna przy warzeniu mikstur. + +of Healing=Leczenia ++@1 HP=+@1 PŻ +Instantly heals.=Natychmiast leczy. + +of Harming=Krzywdy +-@1 HP=-@1 PŻ +Instantly deals damage.=Natychmiast zadaje obrażenia. + +of Night Vision=Noktowizji +Increases the perceived brightness of light under a dark sky.=Zwiększa postrzeganą jasność przy ciemnym niebie. + +of Swiftness=Szybkości +Increases walking speed.=Zwiększa prędkość ruchu. + +of Slowness=Spowolnienia +Decreases walking speed.=Zmniejsza prędkość ruchu. + +of Leaping=Zwiększonego Skoku +Increases jump strength.=Zwiększa siłę skoku. + +of Withering=Obumierania +Applies the withering effect which deals damage at a regular interval and can kill.=Zadaje efekt obumierania, zadający obrażenia w regularnych odstępach czasu i mogący zabić. + +of Poison=Trucizny +Applies the poison effect which deals damage at a regular interval.=Zadaje efekt trucizny, zadający obrażenia w regularnych odstępach czasu. + +of Regeneration=Regeneracji +Regenerates health over time.=Regeneruje życie z upływem czasu. + +of Invisibility=Niewidzialności +Grants invisibility.=Daje niewidzialność. + +of Water Breathing=Oddychania pod Wodą +Grants limitless breath underwater.=Daje nieograniczony oddech pod wodą. + +of Fire Resistance=Odporności na Ogień +Grants immunity to damage from heat sources like fire.=Daje odporność na obrażenia od źródeł ciepła takich jak ogień. + +of Strength=Siły +Increases attack power.=Zwiększa siłę ataku. + +of Weakness=Osłabienia +Decreases attack power.=Zmniejsza siłę ataku. + +of Slow Falling=Powolnego Opadania +Instead of falling, you descend gracefully.=Zamiast spadać, zstępujesz delikatnie. + +of Levitation=Lewitacji +Floats body slowly upwards.=Ciało powoli dryfuje w górę. + +of Darkness=Ciemności +Surrounds with darkness.=Otacza ciemnością. + +of Glowing=Blasku +Highlights for others to see.=Podświetla dla innych do dostrzeżenia. + +of Health Boost=Zwiększonego Zdrowia +Increases health.=Zwiększa zdrowie. + +of Absorption=Absorpcji +Absorbs some incoming damage.=Pochłania trochę otrzymywanych obrażeń. + +of Resistance=Odporności +Decreases damage taken.=Zmniejsza otrzymywane obrażenia. + +of Stone Cloak=Kamiennego Płaszcza +Decreases damage taken at the cost of speed.=Zmniejsza otrzymywane obrażenia kosztem prędkości. + +of Luck=Szczęścia +Increases luck.=Zwiększa szczęście. + +of Bad Luck=Pecha +Decreases luck.=Zmniejsza szczęście. + +of Frost=Mrozu +Freezes...=Zamraża... + +of Blindness=Ślepoty +Impairs sight.=Upośledza wzrok. + +of Nausea=Nudności +Disintegrates senses.=Dezintegruje zmysły. + +of Food Poisoning=Zatrucia Pokarmowego +Moves bowels too fast.=Porusza jelitami zbyt szybko. + +of Saturation=Nasycenia +Satisfies hunger.=Zaspokaja głód. + +of Haste=Pośpiechu +Increases digging and attack speed.=Zwiększa prędkość kopania i ataku. + +of Fatigue=Zmęczenia +Decreases digging and attack speed.=Zmniejsza prędkość kopania i ataku. + +Ominous=Złowieszcza +Attracts danger.=Przyciąga zagrożenie. + +Unknown Potion=Nieznana Mikstura +Right-click to identify=Kliknij prawym przyciskiem myszy, aby zidentyfikować +Unknown Tipped Arrow=Strzała z Nieznanym Grotem -Add a status effect to yourself. Arguments: : name of status effect, e.g. poison. : duration in seconds. : effect strength multiplier (1 @= 100%)=Dodaj status na siebie. Argumenty: : nazwa efektu statusu, np. trucizna. : czas trwania w sekundach. : czynnik siły efektu (1 @= 100%) -Missing effect parameter!=Brak parametru efektu! -Missing or invalid duration parameter!=Brak lub nieprawidłowy parametr czasu trwania! -Invalid factor parameter!=Nieprawidłowy parametr czynnika! -@1 is not an available status effect.=@1 nie jest dostępnym efektem statusu. Fermented Spider Eye=Fermentowane oko pająka +Try different combinations to create potions.=Wypróbuj różne kombinacje, by stworzyć mikstury. + Glass Bottle=Szklana butelka -Liquid container=Pojemnik na płyn +Liquid container=Zbiornik na ciecz A glass bottle is used as a container for liquids and can be used to collect water directly.=Szklana butelka jest używana jako pojemnik na płyny i może być wykorzystana bezpośrednio do pozyskiwania wody. - To collect water, use it on a cauldron with water (which removes a level of water) or any water source (which removes no water).=Aby pozyskać wodę użyj jej na kotle z wodą (co usunie jeden poziom wody) lub jakimkolwiek źródle wody (co nie usunie wody). Water Bottle=Butelka wody -Water bottles can be used to fill cauldrons. Drinking water has no effect.=Butelka wody może być wykorzystana do napełniania kotłów. Picie wody nie ma żadnych efektów. +Water bottles can be used to fill cauldrons. Drinking water has no effect.=Butelka wody może być wykorzystana do napełniania kotłów. Picie wody nie ma żadnych skutków. Use the “Place” key to drink. Place this item on a cauldron to pour the water into the cauldron.=Użyj przycisku do stawiania aby pić. Postaw ten przedmiot na kotle aby wylać wodę do kotła. River Water Bottle=Butelka wody rzecznej -River water bottles can be used to fill cauldrons. Drinking it has no effect.=Butelka wody rzecznej może być wykorzystana do napełniania kotłów. Picie jej nie ma żadnego efektu. +River water bottles can be used to fill cauldrons. Drinking it has no effect.=Butelka wody rzecznej może być wykorzystana do napełniania kotłów. Picie jej nie ma żadnego skutku. Use the “Place” key to drink. Place this item on a cauldron to pour the river water into the cauldron.=Użyj przycisku do stawiania aby pić. Postaw ten przedmiot na kotle aby wylać wodę rzeczną do kotła. Splash Water Bottle=Miotana butelka wody Extinguishes fire and hurts some mobs=Gasi ogień i rani niektóre moby -A throwable water bottle that will shatter on impact, where it extinguishes nearby fire and hurts mobs that are vulnerable to water.=Butelka wody którą można rzucać i roztrzaska się przy uderzeniu, gdzie ugasi ogień i rani moby podatne na wodę. +A throwable water bottle that will shatter on impact, where it extinguishes nearby fire and hurts mobs that are vulnerable to water.=Butelka wody, którą można rzucić, a roztrzaska się przy uderzeniu, gdzie ugasi ogień i zrani moby podatne na wodę. Lingering Water Bottle=Trwała miotana butelka wody -A throwable water bottle that will shatter on impact, where it creates a cloud of water vapor that lingers on the ground for a while. This cloud extinguishes fire and hurts mobs that are vulnerable to water.=Butelka wody którą można rzucać i roztrzaska się przy uderzeniu tworząc opary wody pozostające przez chwilę na ziemi. Opary te gaszą ogień i ranią moby podatne na wodę. +A throwable water bottle that will shatter on impact, where it creates a cloud of water vapor that lingers on the ground for a while. This cloud extinguishes fire and hurts mobs that are vulnerable to water.=Butelka wody którą można rzucić, a roztrzaska się przy uderzeniu, tworząc opary wody pozostające przez chwilę na ziemi. Opary te gaszą ogień i ranią moby podatne na wodę. Glistering Melon=Błyszczący arbuz This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else.=Ten błyszczący arbuz jest pełen tycich odłamków złota i wygląda ładnie w ramkach na przedmioty. Nie jest jadalny ani użyteczny do innych rzeczy. - -A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect, possibly repeatedly.=Mikstura którą można rzucać i roztrzaska się przy uderzeniu tworząc magiczne opary pozostające przez chwilę na ziemi. Jakikolwiek gracz lub mob wewnątrz oparów będzie wystawiony na efekt mikstury. - -Use the “Punch” key to throw it.=Użyj przycisku "Uderz" by rzucić. -Use the “Place” key to drink it.=Użyj przycisku "Postaw" by wypić. -Drinking a potion gives you a particular effect.=Wypicie mikstury sprawi, że będziesz wystawiona na jej efekty. -1 HP/@1s | @2=1 HP/@1s | @2 -@1 HP=@1 HP -@1 Potion=Mikstura @1 -Splash @1 Potion=Miotana mikstura @1 -Lingering @1 Potion=Trwała miotana mikstura @1 -Arrow of @1=Strzała @1 - II= II - IV= IV -@1 Potion@2=Mikstura @1@2 -Splash @1@2 Potion=Miotana mikstura @1@2 -Lingering @1@2 Potion=Trwała miotana mikstura @1@2 -Arrow of @1@2=Strzała @1@2 -@1 + Potion=Mikstura @1 + -Splash @1 + Potion=Miotana mikstura @1 + -Lingering @1 + Potion=Trwała miotana mikstura @1 + -Arrow of @1 +=Strzała @1 + -Awkward Potion=Klarowna mikstura -Awkward Splash Potion=Klarowna miotana mikstura -Awkward Lingering Potion=Klarowna trwała miotana mikstura -Has an awkward taste and is used for brewing potions.=Ma dziwny smak i jest użyteczna przy warzenia mikstur. -Mundane Potion=Mdła mikstura -Mundane Splash Potion=Mdła miotana mikstura -Mundane Lingering Potion=Mdła trwała miotana mikstura -Has a terrible taste and is not useful for brewing potions.=Ma ohydny smak i nie jest użyteczna przy warzenia mikstur. -Thick Potion=Gęsta mikstura -Thick Splash Potion=Gęsta miotana mikstura -Thick Lingering Potion=Gęsta trwała miotana mikstura -Has a bitter taste and is not useful for brewing potions.=Ma cierpki smak i nie jest użyteczna przy warzenia mikstur. -Dragon's Breath=Oddech smoka - -This item is used in brewing and can be combined with splash potions to create lingering potions.=Ten przedmiot jest używany przy warzeniu i może zostać dodany do miotanych mikstur aby uczynić je trwałymi. - -Healing=leczenia -+4 HP=+4 HP -+8 HP=+8 HP -Instantly heals.=Natychmiastowo leczy. -Harming=obrażeń --6 HP=-6 HP --12 HP=-12 HP -Instantly deals damage.=Natychmiastowo zadaje obrażenia. -Night Vision=widzenia w ciemności -Increases the perceived brightness of light under a dark sky.=Zwiększa postrzeganą jasność przy ciemnym niebie. -Swiftness=prędkości -Increases walking speed.=Zwiększa prędkość poruszania. -Slowness=spowolnienia -Decreases walking speed.=Zmniejsza prędkość poruszania. -Leaping=skakania -Increases jump strength.=Zwiększa siłę skoku. -Poison=trucizny -Applies the poison effect which deals damage at a regular interval.=Aplikuje efekt trucizny zadający obrażenia w regularnych odstępach czasu. -Regeneration=regeneracji -Regenerates health over time.=Regeneruje życie przez pewien czas. -Invisibility=niewidzialności -Grants invisibility.=Sprawia, że cel jest niewidzialny. -Water Breathing=oddychania pod wodą -Grants limitless breath underwater.=Sprawia, że cel może oddychać pod wodą. -Fire Resistance=odporności na ogień -Grants immunity to damage from heat sources like fire.=Sprawia, że cel jest odporny na obrażenia od źródeł ciepła takich jak ogień. -Weakness=słabości -Weakness +=słabości + -Strength=siły -Strength II=siły II -Strength +=siły + -Try different combinations to create potions.=Spróbuj innej kombinacji aby stworzyć miksturę. -No effect=Brak efektu - -A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect.=Mikstura, którą można rzucić i rozbije się przy uderzeniu wystawiając wszystkich pobliskich graczy i moby na efekt jej działania. - -This particular arrow is tipped and will give an effect when it hits a player or mob.=Czubek tej strzały jest zanurzony w miksturze co wystawi jej cel na efekt jej działania. - diff --git a/mods/ITEMS/mcl_potions/locale/template.txt b/mods/ITEMS/mcl_potions/locale/template.txt index 50c622391..39cd18f31 100644 --- a/mods/ITEMS/mcl_potions/locale/template.txt +++ b/mods/ITEMS/mcl_potions/locale/template.txt @@ -115,9 +115,6 @@ Missing or invalid factor parameter when level is F!= @1 effect given to player @2 for @3 seconds.= Giving effect @1 to player @2 failed.= @1 effect on level @2 given to player @3 for @4 seconds.= -@1 effect given to player @2 for @3 seconds.= -Giving effect @1 to player @2 failed.= -@1 is not an available status effect.= A throwable potion that will shatter on impact, where it gives all nearby players and mobs a status effect or a set of status effects.= @@ -138,8 +135,6 @@ Drinking a potion gives you a particular effect or set of effects.= Potion @1= Strange Potion= -Stacks the effect= - Splash @1= Lingering @1= @1 Arrow @2= diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 471c4ad3d..c8de4353e 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -176,9 +176,6 @@ function mcl_potions.register_potion(def) pdef.description = S("Strange Potion") end pdef._tt_help = def._tt - if def._tt and def.effect_stacks then - pdef._tt_help = pdef._tt_help .. "\n" .. S("Stacks the effect") - end pdef._dynamic_tt = def._dynamic_tt local potion_longdesc = def._longdesc if def._effect_list then From 018814c362c5ae560d9ad1c2abbeaa18c9ff2ad6 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 2 May 2024 04:09:39 +0200 Subject: [PATCH 89/91] Added a few mobitems * one droppable from strays * the rest will get their mobs in a later update * added alternative ways to get the items * added recipes for potions that use these items --- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 9 ++++- mods/ENTITIES/mobs_mc/villager.lua | 2 ++ mods/ITEMS/mcl_fishing/init.lua | 2 ++ mods/ITEMS/mcl_mobitems/init.lua | 40 ++++++++++++++++++++++ mods/ITEMS/mcl_potions/init.lua | 10 +++--- textures/vl_mobitems_aery_charge.png | Bin 0 -> 229 bytes textures/vl_mobitems_crystalline_drop.png | Bin 0 -> 156 bytes textures/vl_mobitems_earthen_ash.png | Bin 0 -> 206 bytes textures/vl_mobitems_ice_crystal.png | Bin 0 -> 341 bytes textures/vl_mobitems_spectre_membrane.png | Bin 0 -> 167 bytes 10 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 textures/vl_mobitems_aery_charge.png create mode 100644 textures/vl_mobitems_crystalline_drop.png create mode 100644 textures/vl_mobitems_earthen_ash.png create mode 100644 textures/vl_mobitems_ice_crystal.png create mode 100644 textures/vl_mobitems_spectre_membrane.png diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index a84264a83..8ea4d9ced 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -153,13 +153,20 @@ table.insert(stray.drops, { local chance = 0.5 for i = 1, lvl do if chance > 1 then - return 1 + return 1 -- TODO verify this logic, I think this is not how chance works end chance = chance + (1 - chance) / 2 end return chance end, }) +table.insert(stray.drops, { + name = "mcl_mobitems:shiny_ice_crystal", + chance = 3, + min = 1, + max = 2, + looting = "rare", +}) mcl_mobs.register_mob("mobs_mc:stray", stray) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 2897650c8..b1e291037 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -608,6 +608,8 @@ local professions = { { { { "mcl_nether:nether_wart_item", 22, 22 }, E1 }, { { "mcl_core:emerald", 3, 3 }, { "mcl_experience:bottle", 1, 1 } }, + { { "mcl_core:emerald", 15, 15 }, { "mcl_mobitems:aery_charge", 1, 1 } }, -- TODO reconsider + { { "mcl_core:emerald", 15, 15 }, { "mcl_mobitems:earthen_ash", 1, 1 } }, -- TODO reconsider }, }, }, diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 163c103a3..f381ffefc 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -114,6 +114,8 @@ local fish = function(itemstack, player, pointed_thing) { itemstring = "mcl_mobitems:saddle", }, { itemstring = "mcl_flowers:waterlily", }, { itemstring = "mcl_mobitems:nautilus_shell", }, + { itemstring = "mcl_mobitems:spectre_membrane", }, + { itemstring = "mcl_mobitems:crystalline_drop", }, }, stacks_min = 1, stacks_max = 1, diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index f74d254ba..4d92c2d43 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -231,6 +231,46 @@ minetest.register_craftitem("mcl_mobitems:string",{ groups = { craftitem = 1 }, }) +minetest.register_craftitem("mcl_mobitems:spectre_membrane",{ + description = S("Spectre Membrane"), + _doc_items_longdesc = S("This is a crafting component dropped from dead spectres."), + inventory_image = "vl_mobitems_spectre_membrane.png", + groups = { craftitem = 1, brewitem = 1 }, + stack_max = 64, +}) + +minetest.register_craftitem("mcl_mobitems:shiny_ice_crystal",{ + description = S("Shiny Ice Crystal"), + _doc_items_longdesc = S("This item is mainly used for crafting."), + inventory_image = "vl_mobitems_ice_crystal.png", + groups = { craftitem = 1, brewitem = 1 }, + stack_max = 64, +}) + +minetest.register_craftitem("mcl_mobitems:aery_charge",{ + description = S("Aery Charge"), + _doc_items_longdesc = S("This item is mainly used for crafting."), -- TODO shoot? + inventory_image = "vl_mobitems_aery_charge.png", + groups = { craftitem = 1, brewitem = 1 }, + stack_max = 64, +}) + +minetest.register_craftitem("mcl_mobitems:crystalline_drop",{ + description = S("Crystalline Drop"), + _doc_items_longdesc = S("This item is mainly used for crafting."), -- TODO other uses? + inventory_image = "vl_mobitems_crystalline_drop.png", + groups = { craftitem = 1, brewitem = 1 }, + stack_max = 64, +}) + +minetest.register_craftitem("mcl_mobitems:earthen_ash",{ + description = S("Earthen Ash"), + _doc_items_longdesc = S("This item is mainly used for crafting."), -- TODO other uses? + inventory_image = "vl_mobitems_earthen_ash.png", + groups = { craftitem = 1, brewitem = 1 }, + stack_max = 64, +}) + minetest.register_craftitem("mcl_mobitems:blaze_rod", { description = S("Blaze Rod"), _doc_items_longdesc = S("This is a crafting component dropped from dead blazes."), diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index cdc095203..653e3df8c 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -401,14 +401,14 @@ local awkward_table = { ["mcl_flowers:fourleaf_clover"] = "mcl_potions:luck", ["mcl_farming:potato_item_poison"] = "mcl_potions:nausea", - ["mcl_mobitems:phantom_membrane"] = "mcl_potions:slow_falling", -- TODO add phantom membranes + ["mcl_mobitems:spectre_membrane"] = "mcl_potions:slow_falling", ["mcl_core:apple_gold"] = "mcl_potions:resistance", + ["mcl_mobitems:aery_charge"] = "mcl_potions:haste", + ["mcl_mobitems:crystalline_drop"] = "mcl_potions:absorption", + ["mcl_mobitems:earthen_ash"] = "mcl_potions:stone_cloak", + ["mcl_mobitems:shiny_ice_crystal"] = "mcl_potions:frost", -- TODO darkness - sculk? - -- TODO absorption - water element? - -- TODO turtle master - earth element? - -- TODO frost - frost element? - -- TODO haste - air element? } -- API -- register a potion recipe brewed from awkward potion diff --git a/textures/vl_mobitems_aery_charge.png b/textures/vl_mobitems_aery_charge.png new file mode 100644 index 0000000000000000000000000000000000000000..51608d922875d710554c24892a96ada2de4959c2 GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ydl>XLoEE)PT0tG$U%Vh{r`IB zoaWxHjD>SOx=g~OSh%IVrL~{3x|uys^FPvhoOP4&`yEsM*)Gqn)B1UD_sT=F_wX8P zUgV#q*MHl3TkQX7cdK?Ja=5=0s__t*vS?GRpoU{{j1TvoXogF2TyIVuj`~oLcbsXO z7vtJF4eJ_Q9inUvL?Sveerhu++}~q%A;(;P)2naEjmMg{&5eji|HQ_*mMcMYn~>6h dWnBM_^tUHFxfLaN-UYgw!PC{xWt~$(696E+Sv~*& literal 0 HcmV?d00001 diff --git a/textures/vl_mobitems_crystalline_drop.png b/textures/vl_mobitems_crystalline_drop.png new file mode 100644 index 0000000000000000000000000000000000000000..42ecb6d6d297dfda88e7234c15bbcc282258e054 GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`$(}BbAr`&K2@6y^qJF>ne?XGq zQp~Q;SL-+NEq`-uv`JTuBO-|+TF*alFFk-n`HiI#^U(q0r`9iL{*@I)s zN<4}w3}*yxNj7K;bn-E$IB#%OJjuzmtn(3%D+dEZSt|eHE2V~qfYvd1y85}Sb4q9e E0KJzp1ONa4 literal 0 HcmV?d00001 diff --git a/textures/vl_mobitems_earthen_ash.png b/textures/vl_mobitems_earthen_ash.png new file mode 100644 index 0000000000000000000000000000000000000000..63fd28bbfbb5d80c0ac36133abd1763001d5c5d6 GIT binary patch literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Q$1ZALo7}wCrI2|psoJN{^qRd zCMkd8&Ff#)Z{lIhytl3H>VM7J*#Fs+nGVjdIeXOdfA(f!1rx)z1E%F>jiv`PCOnJq zpZ$Ml;=BJJ*(6S!H}F+3^D(|5`h(}-O35XH9gedm@G>TfoK@i2%$dV6Nv-6pf?b>U zgt?vFY?%(%dLD5}G-w`bOY}P~J;8t>xTmM{l7#{TgXEISk8dfIT?RUk!PC{xWt~$( F6971sPhkK6 literal 0 HcmV?d00001 diff --git a/textures/vl_mobitems_ice_crystal.png b/textures/vl_mobitems_ice_crystal.png new file mode 100644 index 0000000000000000000000000000000000000000..a3138545f3359dbab5554b27c5c095443dcdf4a3 GIT binary patch literal 341 zcmV-b0jmCqP)=Dz{JWDrh|uF~G_BnV)U06^*MbLcT< nGKZ2_&1ClP#O~$K<}B+IdN;my9`(ue00000NkvXXu0mjfKN*)s literal 0 HcmV?d00001 diff --git a/textures/vl_mobitems_spectre_membrane.png b/textures/vl_mobitems_spectre_membrane.png new file mode 100644 index 0000000000000000000000000000000000000000..0819e7532441d6c8ac6233404de127800ae6c20b GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`d7dtgAr_~T6Bd{kteyK^zU5>P zPZGPoy~i9z1=pv~>zYMptCjw1&pejRuqkOm+6=~zuk#j2xJ+8BaMpmC<5u7Kut{_J z&xS3U(| Date: Thu, 2 May 2024 04:14:55 +0200 Subject: [PATCH 90/91] Updated Polish translation --- mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.pl.tr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.pl.tr b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.pl.tr index a58bfb474..484bc2d61 100644 --- a/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.pl.tr +++ b/mods/ITEMS/mcl_mobitems/locale/mcl_mobitems.pl.tr @@ -58,6 +58,12 @@ This item is dropped by dead squids. Squid ink can be used to as an ingredient String=Nić Strings are used in crafting.=Nić jest użyteczna w wytwarzaniu. +Spectre Membrane=Błona Widma +This is a crafting component dropped from dead spectres.=Jest to materiał do wytwarzania wypadający z martwych widm. +Shiny Ice Crystal=Lśniący Kryształ Lodu +Aery Charge=Powietrzny Ładunek +Crystalline Drop=Krystaliczna Kropla +Earthen Ash=Ziemny Popiół Blaze Rod=Płomienna różdżka This is a crafting component dropped from dead blazes.=Jest to materiał do wytwarzania wypadający z martwych płomyków. Blaze Powder=Płomienny proszek From 07fac026ddfdf4fb685594d30ec7052b799258eb Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 2 May 2024 04:17:16 +0200 Subject: [PATCH 91/91] Added a darkness potion recipe --- mods/ITEMS/mcl_potions/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 653e3df8c..446f6ef16 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -497,6 +497,7 @@ local inversion_table = { ["mcl_potions:saturation"] = "mcl_potions:food_poisoning", ["mcl_potions:slow_falling"] = "mcl_potions:levitation", ["mcl_potions:absorption"] = "mcl_potions:health_boost", + ["mcl_potions:glowing"] = "mcl_potions:darkness", -- TODO remove after adding a direct recipe? } -- API function mcl_potions.register_inversion_recipe(input, output)