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. 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
@ -201,7 +206,7 @@ local bamboo_def = {
local node_above_name = minetest.get_node(pointed_thing.above).name local node_above_name = minetest.get_node(pointed_thing.above).name
mcl_bamboo.mcl_log("\n\n\nnode_above name: " .. node_above_name) mcl_bamboo.mcl_log("\n\n\nnode_above name: " .. node_above_name)
if node_above_name ~= "mcl_core:water_source" and node_above_name ~= "mcl_core:lava_source" if node_above_name ~= "mcl_core:water_source" and node_above_name ~= "mcl_core:lava_source"
and node_above_name ~= "mcl_nether:nether_lava_source" then and node_above_name ~= "mcl_nether:nether_lava_source" then
local _, position = minetest.item_place(place_item, placer, pointed_thing, fdir) local _, position = minetest.item_place(place_item, placer, pointed_thing, fdir)
if position then if position then
if not minetest.is_creative_enabled(placer:get_player_name()) then if not minetest.is_creative_enabled(placer:get_player_name()) then
@ -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,