1
0
Fork 0

Compare commits

...

19 Commits

Author SHA1 Message Date
Tuxilio 7abffa8500 Merge branch 'master' into tridents 2023-10-01 10:03:41 +00:00
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 a620d24ec8 Fix a number of crashes involving unknown nodes, also fix fishbuckets on_place (#3914)
Fixes: #3913 #3915

~~You can reproduce the crash by placing a fish bucket on top snow above an unknown node.

I also noticed that the code always uses pointed_thing.above so I fixed that and also added a function to mcl_utils to figure out where a node should be placed (either above or below). Looks like the rest of the code could also use improvement but at least it does not crash now.~~

Cora fixed a bunch of related crashes in Mineclona so I am replacing my commit and cherry picking all her commits here.
https://codeberg.org/mineclonia/mineclonia/pulls/549

Here is the list of fixes from that PR:
- Crash when placing snow layer on unknown nodes
- Crash when snow layers on unknown nodes are flooded
- Crash when placing fishbucket on snow on top of unknown nodes
- Crash when placing chorus flower and stem on unknown
- Crash when placing mob spawners on unknown
- The fishbucket on place to actually replace buildable_to

Co-authored-by: cora <coradelamouche@gmx.ch>
Reviewed-on: MineClone2/MineClone2#3914
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
Co-authored-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 <mrrar@noreply.git.minetest.land>
Co-committed-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 <mrrar@noreply.git.minetest.land>
2023-09-29 18:47:07 +00:00
ancientmarinerdev 178b24886f Merge pull request 'mcl_oxidation: typo in README.' (#3910) from mdk/MineClone2:typo into master
Reviewed-on: MineClone2/MineClone2#3910
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
2023-09-29 18:41:27 +00:00
ancientmarinerdev 8333281b4f Merge pull request 'Halved the creeper explosion timer reset radius' (#3808) from reduce-explosiontimer_reset_radius into master
Reviewed-on: MineClone2/MineClone2#3808
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
2023-09-29 18:36:28 +00:00
Nicu 6d3e55ce12 Reduced the creeper explosion timer reset radius from 6 to 3
This gives the player just enough time to get out of the creeper's range, to reset their explosion timer and avoid unnecessary destruction.
2023-09-29 18:35:21 +00:00
ancientmarinerdev 2c2f5595f3 Merge pull request 'Add Setting to keep respawn location set if bed is destroyed.' (#3933) from Eliy21/MineClone2:no_bed_respawn_setting into master
Reviewed-on: MineClone2/MineClone2#3933
Reviewed-by: chmodsayshello <chmodsayshello@hotmail.com>
2023-09-29 18:29:31 +00:00
ancientmarinerdev c51442704c Merge pull request 'mcl_skins: link to official mcl_custom_skins' (#3954) from skins into master
Reviewed-on: MineClone2/MineClone2#3954
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
2023-09-28 19:43:24 +00:00
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 2bd6678b08 mcl_skins: link to official mcl_custom_skins 2023-09-28 13:09:45 -05:00
Codiac e0c44244f9 Merge pull request 'Point mcl_custom_skins link to a working URL' (#3949) from Montandalar/MineClone2:fix_url_mcl_custom_skins into master
Reviewed-on: MineClone2/MineClone2#3949
Reviewed-by: Codiac <codiac@noreply.git.minetest.land>
2023-09-28 10:40:03 +00:00
Codiac 5b7352a23a 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>
2023-09-28 10:39:23 +00:00
Michieal e8c658658d Update Credits. 2023-09-26 18:59:51 +00:00
Michieal e9d994b74d Fix Campifires API to not crash the server.
Fixed the error in Campfires' On_RightClick() to not error out when called with a non-existent pointed_thing.
2023-09-26 18:57:17 +00:00
Michieal eafe6627d8 Extra checks placed in. 2023-09-26 18:35:12 +00:00
Blockhead 882c3ef339 Point mcl_custom_skins link to a working URL 2023-09-25 19:55:36 +10:00
Michieal b2ebcf5d4f Readme Change
Putting my name back into the credits in the mod.
2023-09-20 06:07:13 +00:00
Michieal f57220f784 Fix Server crash (Issue ##3939)
Fixes the error of pointed_thing being nil (null) by first checking to see if it exists, and if not, exit the on_place call back.
2023-09-20 05:57:49 +00:00
Eliy21 2d9bffaa43 Update settingtypes.txt
Add the no bed respawn in settings
2023-09-11 19:42:04 +00:00
Eliy21 eb658a4996 Update mods/PLAYER/mcl_spawn/init.lua
Add if then condition for no bed/anchor respawn settings
2023-09-11 19:38:33 +00:00
Julien Palard 878480d010
mcl_oxidation: typo in README. 2023-09-02 15:18:30 +02:00
14 changed files with 59 additions and 25 deletions

View File

@ -11,4 +11,4 @@ For example, Copper Blocks have the definition arguement of `_mcl_waxed_variant
For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node. For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node.
Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table. Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table.
Wxaed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`. Waxed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`.

View File

@ -50,7 +50,7 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
explosion_strength = 3, explosion_strength = 3,
explosion_radius = 3.5, explosion_radius = 3.5,
explosion_damage_radius = 3.5, explosion_damage_radius = 3.5,
explosiontimer_reset_radius = 6, explosiontimer_reset_radius = 3,
reach = 3, reach = 3,
explosion_timer = 1.5, explosion_timer = 1.5,
allow_fuse_reset = true, allow_fuse_reset = true,
@ -172,7 +172,7 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
explosion_strength = 6, explosion_strength = 6,
explosion_radius = 8, explosion_radius = 8,
explosion_damage_radius = 8, explosion_damage_radius = 8,
explosiontimer_reset_radius = 6, explosiontimer_reset_radius = 3,
reach = 3, reach = 3,
explosion_timer = 1.5, explosion_timer = 1.5,
allow_fuse_reset = true, allow_fuse_reset = true,

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

@ -18,13 +18,21 @@ local function on_place_fish(itemstack, placer, pointed_thing)
return new_stack return new_stack
end end
local pos = pointed_thing.above or pointed_thing.under if pointed_thing.type ~= "node" then return end
if not pos then return end
local n = minetest.get_node_or_nil(pos) local pos = pointed_thing.above
if n.name and minetest.registered_nodes[n.name].buildable_to or n.name == "mcl_portals:portal" then local n = minetest.get_node(pointed_thing.above)
local fish = itemstack:get_name():gsub(fishbucket_prefix,"") local def = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
if ( def and def.buildable_to ) or n.name == "mcl_portals:portal" then
pos = pointed_thing.under
n = minetest.get_node(pointed_thing.under)
end
local fish = itemstack:get_definition()._mcl_buckets_fish
if fish_names[fish] then if fish_names[fish] then
local o = minetest.add_entity(pos, "mobs_mc:" .. fish) local o = minetest.add_entity(pos, "mobs_mc:" .. fish)
if o and o:get_pos() then
local props = itemstack:get_meta():get_string("properties") local props = itemstack:get_meta():get_string("properties")
if props ~= "" then if props ~= "" then
o:set_properties(minetest.deserialize(props)) o:set_properties(minetest.deserialize(props))
@ -60,6 +68,7 @@ for techname, fishname in pairs(fish_names) do
stack_max = 1, stack_max = 1,
groups = {bucket = 1, fish_bucket = 1}, groups = {bucket = 1, fish_bucket = 1},
liquids_pointable = false, liquids_pointable = false,
_mcl_buckets_fish = techname,
on_place = on_place_fish, on_place = on_place_fish,
on_secondary_use = on_place_fish, on_secondary_use = on_place_fish,
_on_dispense = function(stack, pos, droppos, dropnode, dropdir) _on_dispense = function(stack, pos, droppos, dropnode, dropdir)

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,

View File

@ -1581,7 +1581,7 @@ end
-- MUST NOT be called if there is a snow cover node above pos. -- MUST NOT be called if there is a snow cover node above pos.
function mcl_core.clear_snow_dirt(pos, node) function mcl_core.clear_snow_dirt(pos, node)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if def._mcl_snowless then if def and def._mcl_snowless then
minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2}) minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2})
end end
end end
@ -1602,7 +1602,7 @@ function mcl_core.on_snowable_construct(pos)
-- Make snowed if needed -- Make snowed if needed
if minetest.get_item_group(anode.name, "snow_cover") == 1 then if minetest.get_item_group(anode.name, "snow_cover") == 1 then
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if def._mcl_snowed then if def and def._mcl_snowed then
minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2}) minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2})
end end
end end
@ -1623,7 +1623,7 @@ function mcl_core.on_snow_construct(pos)
local npos = {x=pos.x, y=pos.y-1, z=pos.z} local npos = {x=pos.x, y=pos.y-1, z=pos.z}
local node = minetest.get_node(npos) local node = minetest.get_node(npos)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if def._mcl_snowed then if def and def._mcl_snowed then
minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2}) minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2})
end end
end end

View File

@ -1038,7 +1038,7 @@ for i=1,8 do
-- Get position where snow would be placed -- Get position where snow would be placed
local target local target
if minetest.registered_nodes[unode.name].buildable_to then if def and def.buildable_to then
target = under target = under
else else
target = above target = above

View File

@ -155,7 +155,8 @@ minetest.register_node("mcl_end:chorus_flower", {
1) On top of end stone or chorus plant 1) On top of end stone or chorus plant
2) On top of air and horizontally adjacent to exactly 1 chorus plant ]] 2) On top of air and horizontally adjacent to exactly 1 chorus plant ]]
local pos local pos
if minetest.registered_nodes[node_under.name].buildable_to then local def = minetest.registered_nodes[node_under.name]
if def and def.buildable_to then
pos = pointed_thing.under pos = pointed_thing.under
else else
pos = pointed_thing.above pos = pointed_thing.above
@ -283,7 +284,8 @@ minetest.register_node("mcl_end:chorus_plant", {
condition is met: condition is met:
- placed on end stone or any chorus node ]] - placed on end stone or any chorus node ]]
local pos_place, node_check local pos_place, node_check
if minetest.registered_nodes[node_under.name].buildable_to then local def = minetest.registered_nodes[node_under.name]
if def and def.buildable_to then
pos_place = pointed_thing.under pos_place = pointed_thing.under
node_check = node_above node_check = node_above
else else

View File

@ -301,7 +301,8 @@ minetest.register_node("mcl_mobspawners:spawner", {
local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing) local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing)
if success then if success then
local placepos local placepos
if minetest.registered_nodes[node_under.name].buildable_to then local def = minetest.registered_nodes[node_under.name]
if def and def.buildable_to then
placepos = pointed_thing.under placepos = pointed_thing.under
else else
placepos = pointed_thing.above placepos = pointed_thing.above

View File

@ -3,7 +3,7 @@
This mod allows advanced skin customization. This mod allows advanced skin customization.
Use the /skin command to open the skin configuration screen. Use the /skin command to open the skin configuration screen.
To include custom skins in MineClone2, please download [mcl_custom_skins](https://git.minetest.land/mineclone2/mcl_custom_skins) To include custom skins in MineClone2, please download the [mcl_custom_skins](https://codeberg.org/MineClone2/mcl_custom_skins) mod.
## License ## License
Code under MIT license Code under MIT license

View File

@ -76,6 +76,7 @@ local node_search_list =
local success = storage:get_int("mcl_spawn_success")==1 local success = storage:get_int("mcl_spawn_success")==1
local searched = (storage:get_int("mcl_spawn_searched")==1) or mg_name == "v6" or mg_name == "singlenode" or minetest.settings:get("static_spawnpoint") local searched = (storage:get_int("mcl_spawn_searched")==1) or mg_name == "v6" or mg_name == "singlenode" or minetest.settings:get("static_spawnpoint")
local return_spawn = minetest.settings:get_bool("mcl_return_spawn", true)
local wsp = minetest.string_to_pos(storage:get_string("mcl_spawn_world_spawn_point")) or {} -- world spawn position local wsp = minetest.string_to_pos(storage:get_string("mcl_spawn_world_spawn_point")) or {} -- world spawn position
local check = storage:get_int("mcl_spawn_check") or 0 local check = storage:get_int("mcl_spawn_check") or 0
local cp = minetest.string_to_pos(storage:get_string("mcl_spawn_cp")) or {x=start_pos.x, y=start_pos.y, z=start_pos.z} local cp = minetest.string_to_pos(storage:get_string("mcl_spawn_cp")) or {x=start_pos.x, y=start_pos.y, z=start_pos.z}
@ -498,7 +499,7 @@ function mcl_spawn.get_player_spawn_pos(player)
if(string.match(checknode.name, "mcl_beds:respawn_anchor_charged_")) then if(string.match(checknode.name, "mcl_beds:respawn_anchor_charged_")) then
local charge_level = tonumber(string.sub(checknode.name, -1)) local charge_level = tonumber(string.sub(checknode.name, -1))
if not charge_level then if not charge_level and return_spawn then
minetest.log("warning","could not get level of players respawn anchor, sending him back to spawn!") minetest.log("warning","could not get level of players respawn anchor, sending him back to spawn!")
player:get_meta():set_string("mcl_beds:spawn", "") player:get_meta():set_string("mcl_beds:spawn", "")
minetest.chat_send_player(player:get_player_name(), S("Couldn't get level of your respawn anchor!")) minetest.chat_send_player(player:get_player_name(), S("Couldn't get level of your respawn anchor!"))
@ -510,10 +511,12 @@ function mcl_spawn.get_player_spawn_pos(player)
minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor"}) minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor"})
return checkpos, false return checkpos, false
end end
else elseif return_spawn then
player:get_meta():set_string("mcl_beds:spawn", "") player:get_meta():set_string("mcl_beds:spawn", "")
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!")) minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!"))
return mcl_spawn.get_world_spawn_pos(), false return mcl_spawn.get_world_spawn_pos(), false
else
return checkpos, false
end end
end end
end end

View File

@ -51,6 +51,9 @@ mcl_disabled_events (Disabled events) string
# This setting is only read at startup. # This setting is only read at startup.
enable_bed_respawn (Respawn at bed) bool true enable_bed_respawn (Respawn at bed) bool true
#If enabled, players respawn at world spawn if bed is destroyed or respawn anchor has no charge.
mcl_return_spawn (Return to spawn if no bed) bool true
# How many players have to sleep to skip the night, in percent. # How many players have to sleep to skip the night, in percent.
# Setting to 0 will mean 1 player is always enough to skip the night. Setting above 100 will prevent skipping the night. # Setting to 0 will mean 1 player is always enough to skip the night. Setting above 100 will prevent skipping the night.
# 100 by default. # 100 by default.