Merge pull request 'Fix Server crash (Issue #3939)' (#3947) from Michieal/MineClone2_For_PRs:Bamboo_Fix_PointedThing into master

Reviewed-on: MineClone2/MineClone2#3947
Reviewed-by: Codiac <codiac@noreply.git.minetest.land>
This commit is contained in:
Codiac 2023-09-28 10:39:23 +00:00
commit 5b7352a23a
4 changed files with 21 additions and 5 deletions

View File

@ -3,7 +3,7 @@ mcl_bamboo
This mod adds working, familiar bamboo nodes to your Mineclone 2 world.
Code: MineClone2 dev team. Original (basic) bamboo code by: Small Joker.
Code: Michieal. Original (basic, used as inspiration) bamboo code by: Small Joker. Updates to the code: Mineclone Dev Team, Michieal.
License for code: GPLv3.
License for images / textures: CC-BY-SA except where noted.

View File

@ -86,6 +86,11 @@ local bamboo_def = {
on_rotate = on_rotate,
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing then
return itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
@ -276,6 +281,13 @@ local bamboo_block_def = {
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block.
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing then
return itemstack
end
if pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node.
return itemstack
end
local pos = pointed_thing.under

View File

@ -9,9 +9,10 @@ Authors:
Gerold55 - Code Start + Models?
PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes.
cora - Added burning damage.
DinoNuggies4665 - Cooking logic implemented
thunder1035 - Redesigned model and texture tweaks
DinoNuggies4665 - Cooking logic implemented.
thunder1035 - Redesigned model and texture tweaks.
AncientMariner - Changed smoke to particle spawner and tweaked particle configuration.
Michieal - Fixed misc. errors.
License of media
----------------

View File

@ -332,6 +332,9 @@ function mcl_campfires.register_campfire(name, def)
elseif minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then
mcl_campfires.take_item(pos, node, player, itemstack)
else
if not pointed_thing then
return itemstack
end
minetest.item_place_node(itemstack, player, pointed_thing)
end
end,