Fixed a crashing issue when digging nodes
This commit is contained in:
parent
e90370f1dc
commit
dedaf17f5e
5
API.lua
5
API.lua
@ -990,11 +990,12 @@ function liblevelup_handle_node_drops(pos, original_drops, digger)
|
||||
if is_counted(original_drops.node_dug, original_drops) then
|
||||
update_stats = true
|
||||
local player_name = digger:get_player_name()
|
||||
for _, item in next, drops do
|
||||
for _, item in next, original_drops do
|
||||
local stack = ItemStack(item)
|
||||
local count = stack:get_count()
|
||||
stack:set_count(1)
|
||||
increment(player_name..";"..stack:to_string(), count)
|
||||
local material_name = stack:to_string()
|
||||
increment(player_name..";"..material_name, count)
|
||||
-- We need to check the player's level now, before updating it, so we
|
||||
-- can compare it to the new value.
|
||||
local previous_level = get_scaled_player_level(player_name)
|
||||
|
28
init.lua
28
init.lua
@ -19,23 +19,23 @@ dofile(minetest.get_modpath("liblevelup").."/API.lua")
|
||||
|
||||
-- This constant tells other mods that depend on this one that the
|
||||
-- minerals, saplings, seeds, and spores from Minetest Game versions
|
||||
-- 0.4.0 through 5.0.1, Minimal 0.4.0 through 5.0.1, Build 0.4.6, and
|
||||
-- Survival 0.4.6 are properly detected. Each time a new version of the
|
||||
-- engine is released with corresponding versions of is official
|
||||
-- subgames, this number will be incremented by one. Normally, it's
|
||||
-- best to compare using the greater-than-or-equal-to operator. All
|
||||
-- past versions of the official subgames will remain supported, so it
|
||||
-- doesn't make sense to require an exact match when determining
|
||||
-- whether this mod has support for detecting the countables in a given
|
||||
-- Minetest Game version.
|
||||
-- 0.4.0 through 5.4.1, Minimal 0.4.0 through 5.2.0, Development Test
|
||||
-- 5.3.0 through 5.4.2, Build 0.4.6, and Survival 0.4.6 are properly
|
||||
-- detected. Each time a new version of the engine is released with
|
||||
-- corresponding versions of is official subgames, this number will be
|
||||
-- incremented by one. Normally, it's best to compare using the
|
||||
-- greater-than-or-equal-to operator. All past versions of the official
|
||||
-- subgames will remain supported, so it doesn't make sense to require
|
||||
-- an exact match when determining whether this mod has support for
|
||||
-- detecting the countables in a given Minetest Game version.
|
||||
--
|
||||
-- Version 0.4.0 was the first to support mods, and corresponds to 0 as
|
||||
-- this mod's detection level for that version. There have been 26
|
||||
-- this mod's detection level for that version. There have been 27
|
||||
-- versions released since then, all of which are properly detected
|
||||
-- with the below algorithm, so we're now at detection level 26. (This
|
||||
-- is Minetest Game version 5.4.1.)
|
||||
liblevelup.meta.minetest_game_detection = 26
|
||||
|
||||
-- with the below algorithm, so we're now at detection level 27. (This
|
||||
-- is Development Test version 5.4.2; this engine version has no
|
||||
-- corresponding Minetest Game version.)
|
||||
liblevelup.meta.minetest_game_detection = 27
|
||||
|
||||
local debug_table = false
|
||||
-- Uncomment this line for testing.
|
||||
|
Loading…
x
Reference in New Issue
Block a user