1
0
Fork 0

Fix invisibility potion crash

mobs-redo
Johannes Fritz 2022-09-08 16:45:53 -05:00
parent e5f966067c
commit 3695ee2425
1 changed files with 21 additions and 18 deletions

View File

@ -375,38 +375,41 @@ end, -50)
-- ███████╗╚█████╔╝██║░░██║██████╔╝██╔╝░░░██████╔╝██║░░██║░░╚██╔╝░░███████╗ -- ███████╗╚█████╔╝██║░░██║██████╔╝██╔╝░░░██████╔╝██║░░██║░░╚██╔╝░░███████╗
-- ╚══════╝░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝ -- ╚══════╝░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝
function mcl_potions._clear_cached_player_data(player)
function mcl_potions._reset_player_effects(player, set_hud)
if not player:is_player() then
return
end
meta = player:get_meta()
mcl_potions.make_invisible(player, false)
EF.invisible[player] = nil EF.invisible[player] = nil
EF.poisoned[player] = nil EF.poisoned[player] = nil
EF.regenerating[player] = nil EF.regenerating[player] = nil
EF.strong[player] = nil EF.strong[player] = nil
EF.weak[player] = nil EF.weak[player] = nil
EF.water_breathing[player] = nil EF.water_breathing[player] = nil
EF.leaping[player] = nil EF.leaping[player] = nil
playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping")
EF.swift[player] = nil EF.swift[player] = nil
playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness")
EF.night_vision[player] = nil EF.night_vision[player] = nil
meta:set_int("night_vision", 0)
mcl_weather.skycolor.update_sky_color({player})
EF.fire_proof[player] = nil EF.fire_proof[player] = nil
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})
if set_hud ~= false then if set_hud ~= false then
potions_set_hud(player) potions_set_hud(player)
end end
mcl_potions._clear_cached_player_data(player)
end end
function mcl_potions._save_player_effects(player) function mcl_potions._save_player_effects(player)
@ -489,7 +492,7 @@ end
minetest.register_on_leaveplayer( function(player) minetest.register_on_leaveplayer( function(player)
mcl_potions._save_player_effects(player) mcl_potions._save_player_effects(player)
mcl_potions._reset_player_effects(player) -- clearout the buffer to prevent looking for a player not there mcl_potions._clear_cached_player_data(player) -- clearout the buffer to prevent looking for a player not there
icon_ids[player:get_player_name()] = nil icon_ids[player:get_player_name()] = nil
end) end)