2020-11-12 15:46:57 +01:00
|
|
|
local EF = {}
|
|
|
|
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 = {}
|
2022-10-22 21:56:00 +02:00
|
|
|
EF.bad_omen = {}
|
2020-11-12 15:46:57 +01:00
|
|
|
|
|
|
|
local EFFECT_TYPES = 0
|
|
|
|
for _,_ in pairs(EF) do
|
|
|
|
EFFECT_TYPES = EFFECT_TYPES + 1
|
|
|
|
end
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local icon_ids = {}
|
2020-06-20 19:30:35 +02:00
|
|
|
|
2020-07-28 01:41:07 +02:00
|
|
|
local function potions_set_hudbar(player)
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.poisoned[player] and EF.regenerating[player] then
|
2020-07-28 01:41:07 +02:00
|
|
|
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png")
|
2020-11-12 15:46:57 +01:00
|
|
|
elseif EF.poisoned[player] then
|
2020-07-28 01:41:07 +02:00
|
|
|
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png")
|
2020-11-12 15:46:57 +01:00
|
|
|
elseif EF.regenerating[player] then
|
2020-07-28 01:41:07 +02:00
|
|
|
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")
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local function potions_init_icons(player)
|
|
|
|
local name = player:get_player_name()
|
|
|
|
icon_ids[name] = {}
|
|
|
|
for e=1, EFFECT_TYPES do
|
2021-08-01 14:10:00 +02:00
|
|
|
local x = -52 * e - 2
|
2020-11-12 15:46:57 +01:00
|
|
|
local id = player:hud_add({
|
|
|
|
hud_elem_type = "image",
|
|
|
|
text = "blank.png",
|
|
|
|
position = { x = 1, y = 0 },
|
2021-08-01 14:10:00 +02:00
|
|
|
offset = { x = x, y = 3 },
|
2022-10-11 22:53:48 +02:00
|
|
|
scale = { x = 0.375, y = 0.375 },
|
2020-11-12 15:46:57 +01:00
|
|
|
alignment = { x = 1, y = 1 },
|
|
|
|
z_index = 100,
|
|
|
|
})
|
|
|
|
table.insert(icon_ids[name], id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function potions_set_icons(player)
|
|
|
|
local name = player:get_player_name()
|
|
|
|
if not icon_ids[name] then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local active_effects = {}
|
|
|
|
for effect_name, effect in pairs(EF) do
|
|
|
|
if effect[player] then
|
|
|
|
table.insert(active_effects, effect_name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
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")
|
2020-11-12 16:13:01 +01:00
|
|
|
else
|
2022-10-11 22:53:48 +02:00
|
|
|
player:hud_change(icon, "text", "mcl_potions_effect_"..effect_name..".png^[resize:128x128")
|
2020-11-12 15:46:57 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
local function potions_set_hud(player)
|
|
|
|
|
|
|
|
potions_set_hudbar(player)
|
|
|
|
potions_set_icons(player)
|
|
|
|
|
|
|
|
end
|
2020-07-28 01:41:07 +02:00
|
|
|
|
|
|
|
|
2020-08-03 18:47:42 +02:00
|
|
|
-- ███╗░░░███╗░█████╗░██╗███╗░░██╗ ███████╗███████╗███████╗███████╗░█████╗░████████╗
|
|
|
|
-- ████╗░████║██╔══██╗██║████╗░██║ ██╔════╝██╔════╝██╔════╝██╔════╝██╔══██╗╚══██╔══╝
|
|
|
|
-- ██╔████╔██║███████║██║██╔██╗██║ █████╗░░█████╗░░█████╗░░█████╗░░██║░░╚═╝░░░██║░░░
|
|
|
|
-- ██║╚██╔╝██║██╔══██║██║██║╚████║ ██╔══╝░░██╔══╝░░██╔══╝░░██╔══╝░░██║░░██╗░░░██║░░░
|
|
|
|
-- ██║░╚═╝░██║██║░░██║██║██║░╚███║ ███████╗██║░░░░░██║░░░░░███████╗╚█████╔╝░░░██║░░░
|
|
|
|
-- ╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝╚═╝░░╚══╝ ╚══════╝╚═╝░░░░░╚═╝░░░░░╚══════╝░╚════╝░░░░╚═╝░░░
|
|
|
|
--
|
|
|
|
-- ░█████╗░██╗░░██╗███████╗░█████╗░██╗░░██╗███████╗██████╗░
|
|
|
|
-- ██╔══██╗██║░░██║██╔════╝██╔══██╗██║░██╔╝██╔════╝██╔══██╗
|
|
|
|
-- ██║░░╚═╝███████║█████╗░░██║░░╚═╝█████═╝░█████╗░░██████╔╝
|
|
|
|
-- ██║░░██╗██╔══██║██╔══╝░░██║░░██╗██╔═██╗░██╔══╝░░██╔══██╗
|
|
|
|
-- ╚█████╔╝██║░░██║███████╗╚█████╔╝██║░╚██╗███████╗██║░░██║
|
|
|
|
-- ░╚════╝░╚═╝░░╚═╝╚══════╝░╚════╝░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
local is_player, entity, meta
|
2020-07-25 01:39:23 +02:00
|
|
|
|
2020-06-20 19:30:35 +02:00
|
|
|
minetest.register_globalstep(function(dtime)
|
|
|
|
|
|
|
|
-- Check for invisible players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.invisible) do
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.invisible[player].timer = EF.invisible[player].timer + dtime
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#7F8392") end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.invisible[player].timer >= EF.invisible[player].dur then
|
2020-07-26 02:59:26 +02:00
|
|
|
mcl_potions.make_invisible(player, false)
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.invisible[player] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
if player:is_player() then
|
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_invisible", minetest.serialize(EF.invisible[player]))
|
2020-08-03 02:44:18 +02:00
|
|
|
end
|
2022-05-09 12:18:59 +02:00
|
|
|
potions_set_hud(player)
|
|
|
|
|
2020-06-20 19:30:35 +02:00
|
|
|
end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-06-20 19:30:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Check for poisoned players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.poisoned) do
|
2020-06-20 19:30:35 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
is_player = player:is_player()
|
|
|
|
entity = player:get_luaentity()
|
2020-06-20 19:30:35 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.poisoned[player].timer = EF.poisoned[player].timer + dtime
|
|
|
|
EF.poisoned[player].hit_timer = (EF.poisoned[player].hit_timer or 0) + dtime
|
2020-06-20 19:30:35 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#4E9331") end
|
2020-06-26 01:21:16 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.poisoned[player].hit_timer >= EF.poisoned[player].step then
|
2021-04-18 20:21:11 +02:00
|
|
|
if mcl_util.get_hp(player) - 1 > 0 then
|
|
|
|
mcl_util.deal_damage(player, 1, {type = "magic"})
|
2020-06-20 19:30:35 +02:00
|
|
|
end
|
2021-04-18 20:21:11 +02:00
|
|
|
EF.poisoned[player].hit_timer = 0
|
2020-07-26 02:59:26 +02:00
|
|
|
end
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.poisoned[player] and EF.poisoned[player].timer >= EF.poisoned[player].dur then
|
|
|
|
EF.poisoned[player] = nil
|
2020-07-28 01:41:07 +02:00
|
|
|
if is_player then
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_poisoned", minetest.serialize(EF.poisoned[player]))
|
|
|
|
potions_set_hud(player)
|
2020-07-27 23:32:48 +02:00
|
|
|
end
|
2020-06-20 19:30:35 +02:00
|
|
|
end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Check for regnerating players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.regenerating) do
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
is_player = player:is_player()
|
|
|
|
entity = player:get_luaentity()
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.regenerating[player].timer = EF.regenerating[player].timer + dtime
|
|
|
|
EF.regenerating[player].heal_timer = (EF.regenerating[player].heal_timer or 0) + dtime
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#CD5CAB") end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.regenerating[player].heal_timer >= EF.regenerating[player].step then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
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" })
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.regenerating[player].heal_timer = 0
|
2022-05-25 14:02:10 +02:00
|
|
|
elseif entity and entity.is_mob then
|
2020-07-26 02:59:26 +02:00
|
|
|
entity.health = math.min(entity.hp_max, entity.health + 1)
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.regenerating[player].heal_timer = 0
|
2020-07-26 02:59:26 +02:00
|
|
|
else -- stop regenerating if not a player or mob
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.regenerating[player] = nil
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
end
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.regenerating[player] and EF.regenerating[player].timer >= EF.regenerating[player].dur then
|
|
|
|
EF.regenerating[player] = nil
|
2020-07-28 01:17:04 +02:00
|
|
|
if is_player then
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_regenerating", minetest.serialize(EF.regenerating[player]))
|
|
|
|
potions_set_hud(player)
|
2020-07-28 01:17:04 +02:00
|
|
|
end
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Check for water breathing players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.water_breathing) do
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
if player:is_player() then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.water_breathing[player].timer = EF.water_breathing[player].timer + dtime
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#2E5299") end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
if player:get_breath() then
|
2022-05-09 12:18:59 +02:00
|
|
|
hb.hide_hudbar(player, "breath")
|
2020-06-20 21:50:58 +02:00
|
|
|
if player:get_breath() < 10 then player:set_breath(10) end
|
|
|
|
end
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.water_breathing[player].timer >= EF.water_breathing[player].dur then
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_water_breathing", minetest.serialize(EF.water_breathing[player]))
|
|
|
|
EF.water_breathing[player] = nil
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
2022-05-09 12:18:59 +02:00
|
|
|
potions_set_hud(player)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
else
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.water_breathing[player] = nil
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Check for leaping players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.leaping) do
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
if player:is_player() then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.leaping[player].timer = EF.leaping[player].timer + dtime
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#22FF4C") end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.leaping[player].timer >= EF.leaping[player].dur then
|
2020-06-24 03:36:55 +02:00
|
|
|
playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping")
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.leaping[player] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_leaping", minetest.serialize(EF.leaping[player]))
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
2022-05-09 12:18:59 +02:00
|
|
|
potions_set_hud(player)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
else
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.leaping[player] = nil
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Check for swift players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.swift) do
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
if player:is_player() then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.swift[player].timer = EF.swift[player].timer + dtime
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#7CAFC6") end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.swift[player].timer >= EF.swift[player].dur then
|
2020-06-24 03:36:55 +02:00
|
|
|
playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness")
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.swift[player] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_swift", minetest.serialize(EF.swift[player]))
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
2022-05-09 12:18:59 +02:00
|
|
|
potions_set_hud(player)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
else
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.swift[player] = nil
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
|
|
|
|
2020-06-20 19:30:35 +02:00
|
|
|
end
|
|
|
|
|
2020-06-21 03:30:26 +02:00
|
|
|
-- Check for Night Vision equipped players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.night_vision) do
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
if player:is_player() then
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.night_vision[player].timer = EF.night_vision[player].timer + dtime
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#1F1FA1") end
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.night_vision[player].timer >= EF.night_vision[player].dur then
|
|
|
|
EF.night_vision[player] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_cat", minetest.serialize(EF.night_vision[player]))
|
2020-08-19 10:39:44 +02:00
|
|
|
meta:set_int("night_vision", 0)
|
2020-06-21 03:30:26 +02:00
|
|
|
end
|
2020-08-19 10:39:44 +02:00
|
|
|
mcl_weather.skycolor.update_sky_color({player})
|
2022-05-09 12:18:59 +02:00
|
|
|
potions_set_hud(player)
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
else
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.night_vision[player] = nil
|
2020-06-21 03:30:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2020-06-28 22:45:49 +02:00
|
|
|
-- Check for Fire Proof players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.fire_proof) do
|
2020-06-28 22:45:49 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
if player:is_player() then
|
2020-06-28 22:45:49 +02:00
|
|
|
|
|
|
|
player = player or player:get_luaentity()
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.fire_proof[player].timer = EF.fire_proof[player].timer + dtime
|
2020-06-28 22:45:49 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#E49A3A") end
|
2020-06-28 22:45:49 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.fire_proof[player].timer >= EF.fire_proof[player].dur then
|
|
|
|
EF.fire_proof[player] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_fire_proof", minetest.serialize(EF.fire_proof[player]))
|
2020-06-28 22:45:49 +02:00
|
|
|
end
|
2022-05-09 12:18:59 +02:00
|
|
|
potions_set_hud(player)
|
2020-06-28 22:45:49 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
else
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.fire_proof[player] = nil
|
2020-06-28 22:45:49 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2020-06-29 00:47:04 +02:00
|
|
|
-- Check for Weak players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.weak) do
|
2020-06-29 00:47:04 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
if player:is_player() then
|
2020-06-29 00:47:04 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.weak[player].timer = EF.weak[player].timer + dtime
|
2020-06-29 00:47:04 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#484D48") end
|
2020-06-29 00:47:04 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.weak[player].timer >= EF.weak[player].dur then
|
|
|
|
EF.weak[player] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_weak", minetest.serialize(EF.weak[player]))
|
2020-06-29 00:47:04 +02:00
|
|
|
end
|
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
else
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.weak[player] = nil
|
2020-06-29 00:47:04 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2020-06-29 02:31:08 +02:00
|
|
|
-- Check for Strong players
|
2020-11-12 15:46:57 +01:00
|
|
|
for player, vals in pairs(EF.strong) do
|
2020-06-29 02:31:08 +02:00
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
if player:is_player() then
|
2020-06-29 02:31:08 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.strong[player].timer = EF.strong[player].timer + dtime
|
2020-06-29 02:31:08 +02:00
|
|
|
|
2021-05-14 12:07:58 +02:00
|
|
|
if player:get_pos() then mcl_potions._add_spawner(player, "#932423") end
|
2020-06-29 02:31:08 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if EF.strong[player].timer >= EF.strong[player].dur then
|
|
|
|
EF.strong[player] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
meta:set_string("_is_strong", minetest.serialize(EF.strong[player]))
|
2020-06-29 02:31:08 +02:00
|
|
|
end
|
|
|
|
|
2020-07-26 02:59:26 +02:00
|
|
|
else
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.strong[player] = nil
|
2020-06-29 02:31:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2022-10-22 21:56:00 +02:00
|
|
|
-- 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()
|
2022-10-23 00:04:58 +02:00
|
|
|
meta:set_string("_has_bad_omen", minetest.serialize(EF.bad_omen[player]))
|
2022-10-22 21:56:00 +02:00
|
|
|
potions_set_hud(player)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2020-06-24 03:36:55 +02:00
|
|
|
end)
|
2020-06-20 19:30:35 +02:00
|
|
|
|
2020-07-01 02:05:08 +02:00
|
|
|
-- Prevent damage to player with Fire Resistance enabled
|
2021-04-25 20:51:13 +02:00
|
|
|
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
|
2020-06-28 22:45:49 +02:00
|
|
|
end
|
2021-04-25 20:51:13 +02:00
|
|
|
end, -50)
|
2020-06-28 22:45:49 +02:00
|
|
|
|
2020-07-01 00:40:04 +02:00
|
|
|
|
2020-08-03 18:47:42 +02:00
|
|
|
|
|
|
|
-- ███████╗███████╗███████╗███████╗░█████╗░████████╗
|
|
|
|
-- ██╔════╝██╔════╝██╔════╝██╔════╝██╔══██╗╚══██╔══╝
|
|
|
|
-- █████╗░░█████╗░░█████╗░░█████╗░░██║░░╚═╝░░░██║░░░
|
|
|
|
-- ██╔══╝░░██╔══╝░░██╔══╝░░██╔══╝░░██║░░██╗░░░██║░░░
|
|
|
|
-- ███████╗██║░░░░░██║░░░░░███████╗╚█████╔╝░░░██║░░░
|
|
|
|
-- ╚══════╝╚═╝░░░░░╚═╝░░░░░╚══════╝░╚════╝░░░░╚═╝░░░
|
|
|
|
--
|
|
|
|
-- ██╗░░░░░░█████╗░░█████╗░██████╗░░░░░██╗░██████╗░█████╗░██╗░░░██╗███████╗
|
|
|
|
-- ██║░░░░░██╔══██╗██╔══██╗██╔══██╗░░░██╔╝██╔════╝██╔══██╗██║░░░██║██╔════╝
|
|
|
|
-- ██║░░░░░██║░░██║███████║██║░░██║░░██╔╝░╚█████╗░███████║╚██╗░██╔╝█████╗░░
|
|
|
|
-- ██║░░░░░██║░░██║██╔══██║██║░░██║░██╔╝░░░╚═══██╗██╔══██║░╚████╔╝░██╔══╝░░
|
|
|
|
-- ███████╗╚█████╔╝██║░░██║██████╔╝██╔╝░░░██████╔╝██║░░██║░░╚██╔╝░░███████╗
|
|
|
|
-- ╚══════╝░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝
|
|
|
|
|
2022-09-08 23:45:53 +02:00
|
|
|
function mcl_potions._clear_cached_player_data(player)
|
|
|
|
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
|
2022-10-22 21:56:00 +02:00
|
|
|
EF.bad_omen[player] = nil
|
2022-10-25 00:30:14 +02:00
|
|
|
|
2022-09-08 23:45:53 +02:00
|
|
|
meta = player:get_meta()
|
|
|
|
meta:set_int("night_vision", 0)
|
|
|
|
end
|
2020-08-03 18:47:42 +02:00
|
|
|
|
2020-11-12 16:13:01 +01:00
|
|
|
function mcl_potions._reset_player_effects(player, set_hud)
|
2020-06-13 01:54:45 +02:00
|
|
|
|
2020-08-08 10:00:16 +02:00
|
|
|
if not player:is_player() then
|
|
|
|
return
|
|
|
|
end
|
2020-06-20 02:22:32 +02:00
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
mcl_potions.make_invisible(player, false)
|
2020-11-12 15:46:57 +01:00
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping")
|
2022-10-25 00:30:14 +02:00
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness")
|
2022-10-25 00:30:14 +02:00
|
|
|
|
2020-08-19 10:39:44 +02:00
|
|
|
mcl_weather.skycolor.update_sky_color({player})
|
2020-06-13 01:54:45 +02:00
|
|
|
|
2022-09-15 19:02:28 +02:00
|
|
|
mcl_potions._clear_cached_player_data(player)
|
|
|
|
|
2020-11-12 16:13:01 +01:00
|
|
|
if set_hud ~= false then
|
|
|
|
potions_set_hud(player)
|
|
|
|
end
|
2020-08-03 02:44:18 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function mcl_potions._save_player_effects(player)
|
|
|
|
|
2020-08-08 10:00:16 +02:00
|
|
|
if not player:is_player() then
|
|
|
|
return
|
|
|
|
end
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
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]))
|
2022-10-22 21:56:00 +02:00
|
|
|
meta:set_string("_has_bad_omen", minetest.serialize(EF.bad_omen[player]))
|
2020-08-03 02:44:18 +02:00
|
|
|
|
|
|
|
end
|
2020-07-28 01:17:04 +02:00
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
function mcl_potions._load_player_effects(player)
|
|
|
|
|
2020-08-08 10:00:16 +02:00
|
|
|
if not player:is_player() then
|
|
|
|
return
|
|
|
|
end
|
2020-08-03 02:44:18 +02:00
|
|
|
meta = player:get_meta()
|
|
|
|
|
|
|
|
if minetest.deserialize(meta:get_string("_is_invisible")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.invisible[player] = minetest.deserialize(meta:get_string("_is_invisible"))
|
2020-08-03 02:44:18 +02:00
|
|
|
mcl_potions.make_invisible(player, true)
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.deserialize(meta:get_string("_is_poisoned")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.poisoned[player] = minetest.deserialize(meta:get_string("_is_poisoned"))
|
2020-08-03 02:44:18 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.deserialize(meta:get_string("_is_regenerating")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.regenerating[player] = minetest.deserialize(meta:get_string("_is_regenerating"))
|
2020-06-20 02:22:32 +02:00
|
|
|
end
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_is_strong")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.strong[player] = minetest.deserialize(meta:get_string("_is_strong"))
|
2020-06-20 16:16:00 +02:00
|
|
|
end
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_is_weak")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.weak[player] = minetest.deserialize(meta:get_string("_is_weak"))
|
2020-06-20 16:16:00 +02:00
|
|
|
end
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_is_water_breathing")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.water_breathing[player] = minetest.deserialize(meta:get_string("_is_water_breathing"))
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_is_leaping")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.leaping[player] = minetest.deserialize(meta:get_string("_is_leaping"))
|
2020-06-20 21:50:58 +02:00
|
|
|
end
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_is_swift")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.swift[player] = minetest.deserialize(meta:get_string("_is_swift"))
|
2020-06-20 19:30:35 +02:00
|
|
|
end
|
2020-06-20 16:16:00 +02:00
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_is_cat")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.night_vision[player] = minetest.deserialize(meta:get_string("_is_cat"))
|
2020-06-21 03:30:26 +02:00
|
|
|
end
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_is_fire_proof")) then
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.fire_proof[player] = minetest.deserialize(meta:get_string("_is_fire_proof"))
|
2020-06-28 22:45:49 +02:00
|
|
|
end
|
2020-08-03 02:44:18 +02:00
|
|
|
|
2022-10-23 00:04:58 +02:00
|
|
|
if minetest.deserialize(meta:get_string("_has_bad_omen")) then
|
2022-10-22 21:56:00 +02:00
|
|
|
EF.bad_omen[player] = minetest.deserialize(meta:get_string("_has_bad_omen"))
|
|
|
|
end
|
|
|
|
|
2020-06-24 03:36:55 +02:00
|
|
|
end
|
|
|
|
|
2020-11-12 16:43:12 +01:00
|
|
|
-- Returns true if player has given effect
|
|
|
|
function mcl_potions.player_has_effect(player, effect_name)
|
|
|
|
if not EF[effect_name] then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
return EF[effect_name][player] ~= nil
|
|
|
|
end
|
|
|
|
|
2022-10-25 00:30:14 +02:00
|
|
|
function mcl_potions.player_get_effect(player, effect_name)
|
|
|
|
if not EF[effect_name] or not EF[effect_name][player] then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
return EF[effect_name][player]
|
|
|
|
end
|
|
|
|
|
2022-11-08 03:57:11 +01:00
|
|
|
function mcl_potions.player_clear_effect(player,effect)
|
|
|
|
EF[effect][player] = nil
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-08-03 02:44:18 +02:00
|
|
|
minetest.register_on_leaveplayer( function(player)
|
|
|
|
mcl_potions._save_player_effects(player)
|
2022-09-08 23:45:53 +02:00
|
|
|
mcl_potions._clear_cached_player_data(player) -- clearout the buffer to prevent looking for a player not there
|
2020-11-12 15:46:57 +01:00
|
|
|
icon_ids[player:get_player_name()] = nil
|
2020-08-03 02:44:18 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_dieplayer( function(player)
|
|
|
|
mcl_potions._reset_player_effects(player)
|
2020-11-12 16:13:01 +01:00
|
|
|
potions_set_hud(player)
|
2020-08-03 02:44:18 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_joinplayer( function(player)
|
2020-11-12 16:13:01 +01:00
|
|
|
mcl_potions._reset_player_effects(player, false) -- make sure there are no wierd holdover effects
|
2020-08-03 02:44:18 +02:00
|
|
|
mcl_potions._load_player_effects(player)
|
2020-11-12 16:13:01 +01:00
|
|
|
potions_init_icons(player)
|
|
|
|
-- .after required because player:hud_change doesn't work when called
|
|
|
|
-- in same tick as player:hud_add
|
|
|
|
-- (see <https://github.com/minetest/minetest/pull/9611>)
|
2020-11-12 16:28:52 +01:00
|
|
|
-- FIXME: Remove minetest.after
|
|
|
|
minetest.after(3, function(player)
|
2020-11-12 16:13:01 +01:00
|
|
|
if player and player:is_player() then
|
|
|
|
potions_set_hud(player)
|
|
|
|
end
|
|
|
|
end, player)
|
2020-08-03 02:44:18 +02:00
|
|
|
end)
|
2020-06-13 01:54:45 +02:00
|
|
|
|
2020-08-06 02:18:18 +02:00
|
|
|
minetest.register_on_shutdown(function()
|
|
|
|
-- save player effects on server shutdown
|
2021-03-16 17:39:06 +01:00
|
|
|
for _,player in pairs(minetest.get_connected_players()) do
|
2020-08-06 02:18:18 +02:00
|
|
|
mcl_potions._save_player_effects(player)
|
|
|
|
end
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
2020-08-03 18:47:42 +02:00
|
|
|
|
|
|
|
-- ░██████╗██╗░░░██╗██████╗░██████╗░░█████╗░██████╗░████████╗██╗███╗░░██╗░██████╗░
|
|
|
|
-- ██╔════╝██║░░░██║██╔══██╗██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██║████╗░██║██╔════╝░
|
|
|
|
-- ╚█████╗░██║░░░██║██████╔╝██████╔╝██║░░██║██████╔╝░░░██║░░░██║██╔██╗██║██║░░██╗░
|
|
|
|
-- ░╚═══██╗██║░░░██║██╔═══╝░██╔═══╝░██║░░██║██╔══██╗░░░██║░░░██║██║╚████║██║░░╚██╗
|
|
|
|
-- ██████╔╝╚██████╔╝██║░░░░░██║░░░░░╚█████╔╝██║░░██║░░░██║░░░██║██║░╚███║╚██████╔╝
|
|
|
|
-- ╚═════╝░░╚═════╝░╚═╝░░░░░╚═╝░░░░░░╚════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═╝╚═╝░░╚══╝░╚═════╝░
|
|
|
|
--
|
|
|
|
-- ███████╗██╗░░░██╗███╗░░██╗░█████╗░████████╗██╗░█████╗░███╗░░██╗░██████╗
|
|
|
|
-- ██╔════╝██║░░░██║████╗░██║██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║██╔════╝
|
|
|
|
-- █████╗░░██║░░░██║██╔██╗██║██║░░╚═╝░░░██║░░░██║██║░░██║██╔██╗██║╚█████╗░
|
|
|
|
-- ██╔══╝░░██║░░░██║██║╚████║██║░░██╗░░░██║░░░██║██║░░██║██║╚████║░╚═══██╗
|
|
|
|
-- ██║░░░░░╚██████╔╝██║░╚███║╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝
|
|
|
|
-- ╚═╝░░░░░░╚═════╝░╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░
|
|
|
|
|
2020-06-27 01:08:41 +02:00
|
|
|
function mcl_potions.is_obj_hit(self, pos)
|
|
|
|
|
2020-07-17 02:20:13 +02:00
|
|
|
local entity
|
2020-06-27 01:08:41 +02:00
|
|
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.1)) do
|
|
|
|
|
2020-07-17 02:20:13 +02:00
|
|
|
entity = object:get_luaentity()
|
2020-06-27 01:08:41 +02:00
|
|
|
|
|
|
|
if entity and entity.name ~= self.object:get_luaentity().name then
|
|
|
|
|
2022-05-25 14:02:10 +02:00
|
|
|
if entity.is_mob then
|
2020-08-08 10:00:16 +02:00
|
|
|
return true
|
|
|
|
end
|
2020-06-27 01:08:41 +02:00
|
|
|
|
2020-07-12 18:16:26 +02:00
|
|
|
elseif object:is_player() and self._thrower ~= object:get_player_name() then
|
2020-07-02 23:52:09 +02:00
|
|
|
return true
|
2020-06-27 01:08:41 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2022-09-15 19:02:28 +02:00
|
|
|
function mcl_potions.make_invisible(obj_ref, hide)
|
|
|
|
if obj_ref:is_player() then
|
|
|
|
if hide then
|
|
|
|
mcl_player.player_set_visibility(obj_ref, false)
|
|
|
|
obj_ref:set_nametag_attributes({ color = { a = 0 } })
|
|
|
|
else
|
|
|
|
mcl_player.player_set_visibility(obj_ref, true)
|
|
|
|
obj_ref:set_nametag_attributes({ color = { r = 255, g = 255, b = 255, a = 255 } })
|
2021-03-12 04:14:23 +01:00
|
|
|
end
|
2022-09-15 19:02:28 +02:00
|
|
|
else
|
|
|
|
if hide then
|
|
|
|
local luaentity = obj_ref:get_luaentity()
|
|
|
|
EF.invisible[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 })
|
2021-03-12 04:14:23 +01:00
|
|
|
end
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-20 16:16:00 +02:00
|
|
|
|
2020-06-20 15:00:53 +02:00
|
|
|
function mcl_potions._use_potion(item, obj, color)
|
2020-06-19 03:04:31 +02:00
|
|
|
local d = 0.1
|
2020-06-20 15:00:53 +02:00
|
|
|
local pos = obj:get_pos()
|
2020-06-21 14:39:08 +02:00
|
|
|
minetest.sound_play("mcl_potions_drinking", {pos = pos, max_hear_distance = 6, gain = 1})
|
2020-06-19 03:04:31 +02:00
|
|
|
minetest.add_particlespawner({
|
2020-08-08 10:00:16 +02:00
|
|
|
amount = 25,
|
|
|
|
time = 1,
|
|
|
|
minpos = {x=pos.x-d, y=pos.y+1, z=pos.z-d},
|
|
|
|
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
|
|
|
minvel = {x=-0.1, y=0, z=-0.1},
|
|
|
|
maxvel = {x=0.1, y=0.1, z=0.1},
|
|
|
|
minacc = {x=-0.1, y=0, z=-0.1},
|
|
|
|
maxacc = {x=0.1, y=.1, z=0.1},
|
|
|
|
minexptime = 1,
|
|
|
|
maxexptime = 5,
|
|
|
|
minsize = 0.5,
|
|
|
|
maxsize = 1,
|
|
|
|
collisiondetection = true,
|
|
|
|
vertical = false,
|
2020-08-19 17:07:53 +02:00
|
|
|
texture = "mcl_particles_effect.png^[colorize:"..color..":127",
|
2020-08-08 10:00:16 +02:00
|
|
|
})
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
|
|
|
|
2020-06-20 15:00:53 +02:00
|
|
|
|
|
|
|
function mcl_potions._add_spawner(obj, color)
|
|
|
|
local d = 0.2
|
|
|
|
local pos = obj:get_pos()
|
|
|
|
minetest.add_particlespawner({
|
2020-08-08 10:00:16 +02:00
|
|
|
amount = 1,
|
|
|
|
time = 1,
|
|
|
|
minpos = {x=pos.x-d, y=pos.y+1, z=pos.z-d},
|
|
|
|
maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
|
|
|
|
minvel = {x=-0.1, y=0, z=-0.1},
|
|
|
|
maxvel = {x=0.1, y=0.1, z=0.1},
|
|
|
|
minacc = {x=-0.1, y=0, z=-0.1},
|
|
|
|
maxacc = {x=0.1, y=.1, z=0.1},
|
|
|
|
minexptime = 0.5,
|
|
|
|
maxexptime = 1,
|
|
|
|
minsize = 0.5,
|
|
|
|
maxsize = 1,
|
|
|
|
collisiondetection = false,
|
|
|
|
vertical = false,
|
2020-08-19 17:07:53 +02:00
|
|
|
texture = "mcl_particles_effect.png^[colorize:"..color..":127",
|
2020-08-08 10:00:16 +02:00
|
|
|
})
|
2020-06-20 15:00:53 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2020-07-07 02:36:05 +02:00
|
|
|
|
2020-08-03 18:47:42 +02:00
|
|
|
-- ██████╗░░█████╗░░██████╗███████╗ ██████╗░░█████╗░████████╗██╗░█████╗░███╗░░██╗
|
|
|
|
-- ██╔══██╗██╔══██╗██╔════╝██╔════╝ ██╔══██╗██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║
|
|
|
|
-- ██████╦╝███████║╚█████╗░█████╗░░ ██████╔╝██║░░██║░░░██║░░░██║██║░░██║██╔██╗██║
|
|
|
|
-- ██╔══██╗██╔══██║░╚═══██╗██╔══╝░░ ██╔═══╝░██║░░██║░░░██║░░░██║██║░░██║██║╚████║
|
|
|
|
-- ██████╦╝██║░░██║██████╔╝███████╗ ██║░░░░░╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║
|
|
|
|
-- ╚═════╝░╚═╝░░╚═╝╚═════╝░╚══════╝ ╚═╝░░░░░░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝
|
|
|
|
--
|
|
|
|
-- ███████╗███████╗███████╗███████╗░█████╗░████████╗
|
|
|
|
-- ██╔════╝██╔════╝██╔════╝██╔════╝██╔══██╗╚══██╔══╝
|
|
|
|
-- █████╗░░█████╗░░█████╗░░█████╗░░██║░░╚═╝░░░██║░░░
|
|
|
|
-- ██╔══╝░░██╔══╝░░██╔══╝░░██╔══╝░░██║░░██╗░░░██║░░░
|
|
|
|
-- ███████╗██║░░░░░██║░░░░░███████╗╚█████╔╝░░░██║░░░
|
|
|
|
-- ╚══════╝╚═╝░░░░░╚═╝░░░░░╚══════╝░╚════╝░░░░╚═╝░░░
|
|
|
|
--
|
|
|
|
-- ███████╗██╗░░░██╗███╗░░██╗░█████╗░████████╗██╗░█████╗░███╗░░██╗░██████╗
|
|
|
|
-- ██╔════╝██║░░░██║████╗░██║██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║██╔════╝
|
|
|
|
-- █████╗░░██║░░░██║██╔██╗██║██║░░╚═╝░░░██║░░░██║██║░░██║██╔██╗██║╚█████╗░
|
|
|
|
-- ██╔══╝░░██║░░░██║██║╚████║██║░░██╗░░░██║░░░██║██║░░██║██║╚████║░╚═══██╗
|
|
|
|
-- ██║░░░░░╚██████╔╝██║░╚███║╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝
|
|
|
|
-- ╚═╝░░░░░░╚═════╝░╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░
|
|
|
|
|
|
|
|
|
2020-06-18 22:56:19 +02:00
|
|
|
function mcl_potions.healing_func(player, hp)
|
2020-06-18 23:17:56 +02:00
|
|
|
|
2020-07-04 02:31:53 +02:00
|
|
|
local obj = player:get_luaentity()
|
2020-06-26 01:21:16 +02:00
|
|
|
|
2021-04-13 15:57:45 +02:00
|
|
|
if player:get_hp() == 0 then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2020-07-12 22:56:41 +02:00
|
|
|
if obj and obj.harmed_by_heal then hp = -hp end
|
2020-06-20 02:22:32 +02:00
|
|
|
|
2020-06-18 23:17:56 +02:00
|
|
|
if hp > 0 then
|
2020-08-05 20:59:16 +02:00
|
|
|
-- at least 1 HP
|
|
|
|
if hp < 1 then
|
|
|
|
hp = 1
|
|
|
|
end
|
2020-06-26 01:21:16 +02:00
|
|
|
|
2022-05-25 14:02:10 +02:00
|
|
|
if obj and obj.is_mob then
|
2020-06-26 01:21:16 +02:00
|
|
|
obj.health = math.max(obj.health + hp, obj.hp_max)
|
2020-07-21 01:50:17 +02:00
|
|
|
elseif player:is_player() then
|
2020-07-07 00:57:00 +02:00
|
|
|
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
2020-06-26 01:21:16 +02:00
|
|
|
end
|
|
|
|
|
2020-08-05 20:59:16 +02:00
|
|
|
elseif hp < 0 then
|
|
|
|
if hp > -1 then
|
|
|
|
hp = -1
|
|
|
|
end
|
2020-06-26 01:21:16 +02:00
|
|
|
|
2021-04-30 16:38:53 +02:00
|
|
|
mcl_util.deal_damage(player, -hp, {type = "magic"})
|
2020-06-26 01:21:16 +02:00
|
|
|
end
|
|
|
|
|
2020-06-18 22:56:19 +02:00
|
|
|
end
|
2020-06-13 01:54:45 +02:00
|
|
|
|
|
|
|
function mcl_potions.swiftness_func(player, factor, duration)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-08-08 10:00:16 +02:00
|
|
|
if not player:get_meta() then
|
|
|
|
return false
|
|
|
|
end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.swift[player] then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.swift[player] = {dur = duration, timer = 0, is_slow = factor < 1}
|
2020-06-24 03:36:55 +02:00
|
|
|
playerphysics.add_physics_factor(player, "speed", "mcl_potions:swiftness", factor)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.swift[player]
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-06-24 03:36:55 +02:00
|
|
|
playerphysics.add_physics_factor(player, "speed", "mcl_potions:swiftness", factor)
|
2020-06-20 21:50:58 +02:00
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
2020-11-12 15:46:57 +01:00
|
|
|
victim.is_slow = factor < 1
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-06-20 15:00:53 +02:00
|
|
|
end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function mcl_potions.leaping_func(player, factor, duration)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-08-08 10:00:16 +02:00
|
|
|
if not player:get_meta() then
|
|
|
|
return false
|
|
|
|
end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.leaping[player] then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.leaping[player] = {dur = duration, timer = 0}
|
2020-06-24 03:36:55 +02:00
|
|
|
playerphysics.add_physics_factor(player, "jump", "mcl_potions:leaping", factor)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.leaping[player]
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-06-24 03:36:55 +02:00
|
|
|
playerphysics.add_physics_factor(player, "jump", "mcl_potions:leaping", factor)
|
2020-06-20 21:50:58 +02:00
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
2020-06-20 15:00:53 +02:00
|
|
|
end
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
|
|
|
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
function mcl_potions.weakness_func(player, factor, duration)
|
2020-07-01 00:40:04 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.weak[player] then
|
2020-07-01 00:40:04 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.weak[player] = {dur = duration, timer = 0, factor = factor}
|
2020-07-01 00:40:04 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.weak[player]
|
2020-07-01 00:40:04 +02:00
|
|
|
|
|
|
|
victim.factor = factor
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
2020-06-20 15:00:53 +02:00
|
|
|
end
|
2020-06-29 02:31:08 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-29 02:31:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function mcl_potions.strength_func(player, factor, duration)
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.strong[player] then
|
2020-06-29 02:31:08 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.strong[player] = {dur = duration, timer = 0, factor = factor}
|
2020-06-29 02:31:08 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.strong[player]
|
2020-06-29 02:31:08 +02:00
|
|
|
|
|
|
|
victim.factor = factor
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
|
|
|
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
function mcl_potions.poison_func(player, factor, duration)
|
2020-06-20 02:22:32 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.poisoned[player] then
|
2020-06-20 19:30:35 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.poisoned[player] = {step = factor, dur = duration, timer = 0}
|
2020-06-20 19:30:35 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.poisoned[player]
|
2020-06-20 19:30:35 +02:00
|
|
|
|
|
|
|
victim.step = math.min(victim.step, factor)
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
2020-06-19 02:08:00 +02:00
|
|
|
end
|
2020-08-03 02:50:29 +02:00
|
|
|
|
|
|
|
if player:is_player() then
|
2020-11-12 15:46:57 +01:00
|
|
|
potions_set_hud(player)
|
2020-08-03 02:50:29 +02:00
|
|
|
end
|
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
|
|
|
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-06-19 02:08:00 +02:00
|
|
|
function mcl_potions.regeneration_func(player, factor, duration)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.regenerating[player] then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.regenerating[player] = {step = factor, dur = duration, timer = 0}
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.regenerating[player]
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
victim.step = math.min(victim.step, factor)
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
2020-06-20 15:00:53 +02:00
|
|
|
end
|
2020-08-03 02:50:29 +02:00
|
|
|
|
|
|
|
if player:is_player() then
|
2020-11-12 15:46:57 +01:00
|
|
|
potions_set_hud(player)
|
2020-08-03 02:50:29 +02:00
|
|
|
end
|
2020-08-03 18:47:42 +02:00
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
|
|
|
|
2020-06-19 02:08:00 +02:00
|
|
|
|
2020-07-12 02:26:45 +02:00
|
|
|
function mcl_potions.invisiblility_func(player, null, duration)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.invisible[player] then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.invisible[player] = {dur = duration, timer = 0}
|
2020-06-20 21:50:58 +02:00
|
|
|
mcl_potions.make_invisible(player, true)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.invisible[player]
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-13 01:54:45 +02:00
|
|
|
end
|
2020-06-18 23:59:36 +02:00
|
|
|
|
2020-07-12 02:26:45 +02:00
|
|
|
function mcl_potions.water_breathing_func(player, null, duration)
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.water_breathing[player] then
|
2020-06-20 21:50:58 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.water_breathing[player] = {dur = duration, timer = 0}
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.water_breathing[player]
|
2020-06-20 21:50:58 +02:00
|
|
|
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
2020-06-20 15:00:53 +02:00
|
|
|
|
2020-06-18 23:59:36 +02:00
|
|
|
end
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-18 23:59:36 +02:00
|
|
|
end
|
2020-06-21 03:00:57 +02:00
|
|
|
|
|
|
|
|
2020-07-12 02:26:45 +02:00
|
|
|
function mcl_potions.fire_resistance_func(player, null, duration)
|
2020-06-21 03:00:57 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.fire_proof[player] then
|
2020-06-21 03:00:57 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.fire_proof[player] = {dur = duration, timer = 0}
|
2020-06-28 22:45:49 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.fire_proof[player]
|
2020-06-28 22:45:49 +02:00
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
|
|
|
end
|
2020-06-21 03:00:57 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-21 03:00:57 +02:00
|
|
|
end
|
2020-06-21 03:17:45 +02:00
|
|
|
|
|
|
|
|
2020-07-12 02:26:45 +02:00
|
|
|
function mcl_potions.night_vision_func(player, null, duration)
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-08-19 10:39:44 +02:00
|
|
|
meta = player:get_meta()
|
2020-11-12 15:46:57 +01:00
|
|
|
if not EF.night_vision[player] then
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
EF.night_vision[player] = {dur = duration, timer = 0}
|
2020-06-21 03:30:26 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
local victim = EF.night_vision[player]
|
2020-06-21 03:30:26 +02:00
|
|
|
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
|
|
|
|
|
|
|
end
|
2020-08-26 07:46:07 +02:00
|
|
|
|
|
|
|
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
|
2020-08-19 10:39:44 +02:00
|
|
|
mcl_weather.skycolor.update_sky_color({player})
|
2020-06-21 03:30:26 +02:00
|
|
|
|
2020-11-12 15:46:57 +01:00
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
|
2020-06-21 03:17:45 +02:00
|
|
|
end
|
2020-08-03 18:47:42 +02:00
|
|
|
|
2020-08-05 19:44:19 +02:00
|
|
|
function mcl_potions._extinguish_nearby_fire(pos, radius)
|
2020-08-05 18:33:53 +02:00
|
|
|
local epos = {x=pos.x, y=pos.y+0.5, z=pos.z}
|
|
|
|
local dnode = minetest.get_node({x=pos.x,y=pos.y-0.5,z=pos.z})
|
|
|
|
if minetest.get_item_group(dnode.name, "fire") ~= 0 then
|
|
|
|
epos.y = pos.y - 0.5
|
|
|
|
end
|
|
|
|
local exting = false
|
2020-08-05 19:44:19 +02:00
|
|
|
-- No radius: Splash, extinguish epos and 4 nodes around
|
|
|
|
if not radius then
|
|
|
|
local dirs = {
|
|
|
|
{x=0,y=0,z=0},
|
|
|
|
{x=0,y=0,z=-1},
|
|
|
|
{x=0,y=0,z=1},
|
|
|
|
{x=-1,y=0,z=0},
|
|
|
|
{x=1,y=0,z=0},
|
|
|
|
}
|
|
|
|
for d=1, #dirs do
|
|
|
|
local tpos = vector.add(epos, dirs[d])
|
|
|
|
local node = minetest.get_node(tpos)
|
|
|
|
if minetest.get_item_group(node.name, "fire") ~= 0 then
|
|
|
|
minetest.sound_play("fire_extinguish_flame", {pos = tpos, gain = 0.25, max_hear_distance = 16}, true)
|
|
|
|
minetest.remove_node(tpos)
|
|
|
|
exting = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- Has radius: lingering, extinguish all nodes in area
|
|
|
|
else
|
|
|
|
local nodes = minetest.find_nodes_in_area(
|
|
|
|
{x=epos.x-radius,y=epos.y,z=epos.z-radius},
|
|
|
|
{x=epos.x+radius,y=epos.y,z=epos.z+radius},
|
|
|
|
{"group:fire"})
|
|
|
|
for n=1, #nodes do
|
|
|
|
minetest.sound_play("fire_extinguish_flame", {pos = nodes[n], gain = 0.25, max_hear_distance = 16}, true)
|
|
|
|
minetest.remove_node(nodes[n])
|
2020-08-05 18:33:53 +02:00
|
|
|
exting = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return exting
|
|
|
|
end
|
2022-10-22 21:56:00 +02:00
|
|
|
|
2022-10-25 00:30:14 +02:00
|
|
|
function mcl_potions.bad_omen_func(player, factor, duration)
|
2022-10-22 21:56:00 +02:00
|
|
|
if not EF.bad_omen[player] then
|
2022-10-25 00:30:14 +02:00
|
|
|
EF.bad_omen[player] = {dur = duration, timer = 0, factor = factor}
|
2022-10-22 21:56:00 +02:00
|
|
|
else
|
|
|
|
local victim = EF.bad_omen[player]
|
|
|
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
|
|
|
victim.timer = 0
|
2022-10-25 00:30:14 +02:00
|
|
|
victim.factor = factor
|
2022-10-22 21:56:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if player:is_player() then
|
|
|
|
potions_set_icons(player)
|
|
|
|
end
|
|
|
|
end
|