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

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/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. 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 code: GPLv3.
License for images / textures: CC-BY-SA except where noted. License for images / textures: CC-BY-SA except where noted.

View file

@ -86,6 +86,11 @@ local bamboo_def = {
on_rotate = on_rotate, on_rotate = on_rotate,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing then
return itemstack
end
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return itemstack return itemstack
end end
@ -276,6 +281,13 @@ local bamboo_block_def = {
_mcl_hardness = 2, _mcl_hardness = 2,
_mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. _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) 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 local pos = pointed_thing.under

View file

@ -9,9 +9,10 @@ Authors:
Gerold55 - Code Start + Models? Gerold55 - Code Start + Models?
PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes. PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes.
cora - Added burning damage. cora - Added burning damage.
DinoNuggies4665 - Cooking logic implemented DinoNuggies4665 - Cooking logic implemented.
thunder1035 - Redesigned model and texture tweaks thunder1035 - Redesigned model and texture tweaks.
AncientMariner - Changed smoke to particle spawner and tweaked particle configuration. AncientMariner - Changed smoke to particle spawner and tweaked particle configuration.
Michieal - Fixed misc. errors.
License of media 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 elseif minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then
mcl_campfires.take_item(pos, node, player, itemstack) mcl_campfires.take_item(pos, node, player, itemstack)
else else
if not pointed_thing then
return itemstack
end
minetest.item_place_node(itemstack, player, pointed_thing) minetest.item_place_node(itemstack, player, pointed_thing)
end end
end, end,