place_node crashes the game because of nil player, so add nil checks
* Fix for runtime error in callback `item_OnPlace()` due nill player/placer * This is for forward preparation on minetest 5.X with backguard compatibility * related to #39 * related to https://codeberg.org/minenux/minetest-game-adventuretest/issues/39 * related to https://github.com/Bremaweb/adventuretest/issues/39 * update NOTES.md with related fixed about MT 5.X migration
This commit is contained in:
parent
fceb855f2a
commit
f1ff77133a
1
NOTES.md
1
NOTES.md
@ -3,6 +3,7 @@
|
|||||||
### migration to mt 5.0/5.2
|
### migration to mt 5.0/5.2
|
||||||
|
|
||||||
There are the issues Tignasse Verte mentionned: Adding `placer` in `register_functions.lua`
|
There are the issues Tignasse Verte mentionned: Adding `placer` in `register_functions.lua`
|
||||||
|
(related commit for minenux are commit a996d5ac709446322d6c6261c21e5f0752a6aeeb )
|
||||||
and replacing the two occourances of `nodeupdate` with `minetest.check_for_falling`.
|
and replacing the two occourances of `nodeupdate` with `minetest.check_for_falling`.
|
||||||
|
|
||||||
Other changes are necessary because I changed (and had to change) quite a lot
|
Other changes are necessary because I changed (and had to change) quite a lot
|
||||||
|
@ -98,7 +98,7 @@ minetest.register_on_dignode(adventuretest_dignode)
|
|||||||
|
|
||||||
local function adventuretest_placenode(pos, node, placer)
|
local function adventuretest_placenode(pos, node, placer)
|
||||||
hunger.handle_node_actions(pos,node,placer)
|
hunger.handle_node_actions(pos,node,placer)
|
||||||
if placer:is_player() then
|
if placer and placer:is_player() then
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
pd.increment(name,STAT_PLACED,1)
|
pd.increment(name,STAT_PLACED,1)
|
||||||
|
|
||||||
|
@ -144,6 +144,7 @@ if minetest.setting_getbool("creative_mode") then
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||||
|
minetest.log("warning","[creative] maybe missing check for player here?")
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@ local hb = {}
|
|||||||
local scale = tonumber(core.setting_get("hud_scaling")) or 1
|
local scale = tonumber(core.setting_get("hud_scaling")) or 1
|
||||||
|
|
||||||
local function update_wheel(player)
|
local function update_wheel(player)
|
||||||
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not player or not name then
|
if not player or not name or not player:is_player() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -169,6 +170,9 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local function update_wrapper(a, b, player)
|
local function update_wrapper(a, b, player)
|
||||||
|
if not player or not player:is_player() then
|
||||||
|
return
|
||||||
|
end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not name then
|
if not name then
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user