Fix indestructable blocks provided by mods #4285

Open
teknomunk wants to merge 9 commits from teknomunk/MineClone2:fix-indestructable-blocks into master
Member

Fixes #4225

Adds default group of handy=1 to all blocks that don't have any registered diggable group registered unless the block is marked with a group of indestructible ~= 0 and translate MineTest Game groups to VoxeLibre groups where possible.

Testing

  1. Add mods that don't use VoxeLibre groups.
    a. https://content.luanti.org/packages/GreenXenith/mesecons_wireless/
  2. Place some of these blocks
  3. Verify they can be broken
  4. Use creative mode to place bedrock
  5. Verify it can't be broke in survival
Fixes #4225 Adds default group of handy=1 to all blocks that don't have any registered diggable group registered unless the block is marked with a group of indestructible ~= 0 and translate MineTest Game groups to VoxeLibre groups where possible. ### Testing 1. Add mods that don't use VoxeLibre groups. a. https://content.luanti.org/packages/GreenXenith/mesecons_wireless/ 2. Place some of these blocks 3. Verify they can be broken 4. Use creative mode to place bedrock 5. Verify it can't be broke in survival
teknomunk added the
nodes
#P6: low
labels 2024-05-07 16:44:07 +02:00
teknomunk added this to the 0.88.0 – Back on Track milestone 2024-05-08 18:01:03 +02:00
teknomunk force-pushed fix-indestructable-blocks from 63fe4eca33 to d68787ea04 2024-06-02 04:45:21 +02:00 Compare
the-real-herowl approved these changes 2024-08-18 11:28:56 +02:00
Dismissed
the-real-herowl left a comment
Owner

LGTM. Needs more actual mod tests.

LGTM. Needs more actual mod tests.
rudzik8 requested changes 2024-08-18 11:34:18 +02:00
rudzik8 left a comment
Member

Works, but a known MTG diggroup was missed.

Works, but a known MTG diggroup was missed.
@ -315,0 +316,4 @@
["choppy"] = "axey",
["oddly_breakable_by_hand"] = "handy",
["cracky"] = "pickaxey",
["crumbly"] = "shovely",
Member
http://api.minetest.net/groups/#known-damage-and-digging-time-defining-groups **Suggestion:** ``` ["snappy"] = "shearsy", ```
Author
Member

Done.

Done.
teknomunk marked this conversation as resolved
the-real-herowl dismissed the-real-herowl’s review 2024-08-18 11:40:37 +02:00
Reason:

Issue found

the-real-herowl requested review from the-real-herowl 2024-08-18 11:41:00 +02:00
teknomunk force-pushed fix-indestructable-blocks from d68787ea04 to 15701d44b2 2024-08-18 13:32:22 +02:00 Compare
teknomunk force-pushed fix-indestructable-blocks from 15701d44b2 to 025a96cfbe 2024-08-19 02:39:37 +02:00 Compare
teknomunk requested review from rudzik8 2024-08-19 03:03:01 +02:00
rudzik8 requested changes 2024-08-19 04:35:29 +02:00
@ -315,0 +320,4 @@
["snappy"] = "shearsy",
}
function mcl_autogroup.mod_compatibility(groups, ndef)
Member

I think this function should be called group_compatibility, because that's exactly what it implements.

Also, it should be documented in CORE/mcl_autogroup/API.md.

I think this function should be called `group_compatibility`, because that's exactly what it implements. Also, it should be documented in `CORE/mcl_autogroup/API.md`.
Author
Member

Done.

Done.
teknomunk marked this conversation as resolved
@ -359,6 +396,7 @@ local function overwrite()
})
end
end
minetest.log("verbose","Total registered blocks: "..tostring(count))
Member

Total registered nodes.

Also, doing tostring here shouldn't be necessary, Lua does that automatically on concatenation.

Total registered **nodes**. Also, doing `tostring` here shouldn't be necessary, Lua does that automatically on concatenation.
Author
Member

Using tostring() is habit, and makes sure that regardless of what is in the variable it won't crash. I'll still change it here.

Using `tostring()` is habit, and makes sure that regardless of what is in the variable it won't crash. I'll still change it here.
teknomunk marked this conversation as resolved
@ -729,3 +729,3 @@
tiles = {"mcl_core_bedrock.png"},
stack_max = 64,
groups = {creative_breakable=1, building_block=1, material_stone=1},
groups = {creative_breakable=1, building_block=1, material_stone=1, indestructable=1},
Member

I suppose this group is to be applied to all nodes that already have creative_breakable=1. Why just bedrock and not barriers and others?

In any case, I don't think this change is welcome in terms of mod compatibility.

I think it's obvious that unbreakable group wins here. We might just follow the standard.

I suppose this group is to be applied to all nodes that already have `creative_breakable=1`. Why just bedrock and not barriers and others? In any case, I don't think this change is welcome in terms of mod compatibility. * Wuzzy's bedrock2 uses `unbreakable=1`: https://codeberg.org/Wuzzy/minetest_bedrock2/src/commit/db8459d07cda62d4cdd5214fb4b5fa76cfeb349f/init.lua#L38 * StarNinja's nextgen_bedrock uses `indestructible=1`: https://github.com/starninjas/nextgen_bedrock/blob/13fd95be3bd83408840c4fb6668df79cddfb1345/init.lua#L42 (notice the **i** instead of **a**) * TenPlus1's invisiblocks uses `unbreakable=1`: https://codeberg.org/tenplus1/invisiblocks/src/commit/5f5d2aa3b20637f0ce69b281c1374647ff54c2b6/init.lua#L23 * argyle77's borders uses `unbreakable=1`: https://github.com/argyle77/borders/blob/b9cf7fb5fba49b31e19205bd19ffef4109055233/settings.lua#L97 * Calinou's maptools uses `unbreakable=1`: https://github.com/minetest-mods/maptools/blob/b9e69b70c496905baeb61ad365e4917b478e8b4f/init.lua#L30 * Truemmerer's invisible-blocks uses `unbreakable=1`: https://github.com/Truemmerer/invisible-blocks/blob/ca57fe7762dccc7c893c803fe115e047c393d6bf/init.lua#L42 I think it's obvious that `unbreakable` group wins here. We might just follow the standard.

Somehow, barriers work properly with this too. I was surprised.

Somehow, barriers work properly with this too. I was surprised.
Author
Member

I've made it so that unbeakable=1 and indestructable=1 behave the same way.

I've made it so that `unbeakable=1` and `indestructable=1` behave the same way.
Member

The right English word for this is indestructible, with i.

The right English word for this is **indestructible**, with **i**.
teknomunk marked this conversation as resolved
teknomunk force-pushed fix-indestructable-blocks from 1d076a57e1 to 207a9da66f 2024-08-19 14:21:55 +02:00 Compare
teknomunk requested review from rudzik8 2024-08-20 14:20:58 +02:00
teknomunk force-pushed fix-indestructable-blocks from 5cbd3768f0 to 7420c38dcc 2024-09-13 14:36:17 +02:00 Compare
the-real-herowl requested changes 2024-09-15 19:46:07 +02:00
@ -315,0 +325,4 @@
for name,_ in pairs(groups) do
local new_group = GROUP_MAP[name]
if new_group then
groups[new_group] = 1

Shouldn't it take the previous group value from the other group?

Shouldn't it take the previous group value from the other group?
teknomunk marked this conversation as resolved
@ -315,0 +326,4 @@
local new_group = GROUP_MAP[name]
if new_group then
groups[new_group] = 1
node_def.groups[new_group] = 1

Here you're updating both groups and node_def. For consistency, only one should be used. Perhaps only one parameter should be taken by the function?

Here you're updating both `groups` and `node_def`. For consistency, only one should be used. Perhaps only one parameter should be taken by the function?
Author
Member

Had to add ndef.groups = newgroups after adding the compatibility groups to make this work correctly.

Had to add `ndef.groups = newgroups` after adding the compatibility groups to make this work correctly.
teknomunk marked this conversation as resolved
@ -315,0 +334,4 @@
end
if not grouped then
groups.handy = 1

Here you're updating only groups

Here you're updating only `groups`
teknomunk marked this conversation as resolved
@ -7,2 +4,2 @@
* toolname: (optional) string, valid toolname
* player: (optinal) ObjectRef, valid player
## `mcl_autogroup.can_harvest(nodename, toolname, player)`
Return true if `nodename` can be dig with `toolname` by `player`.

dig -> dug while we're at it?

dig -> dug while we're at it?
teknomunk marked this conversation as resolved
the-real-herowl added the
Testing / Retest
label 2024-09-15 19:46:31 +02:00

Also solve the merge conflicts

Also solve the merge conflicts
teknomunk force-pushed fix-indestructable-blocks from 7420c38dcc to 3ce4eca9c0 2024-09-16 13:00:36 +02:00 Compare
Author
Member

Also solve the merge conflicts

Done. Working on fixing the remainder of the issues.

> Also solve the merge conflicts Done. Working on fixing the remainder of the issues.
teknomunk force-pushed fix-indestructable-blocks from e2c917c9e7 to cc8c62211a 2024-09-16 13:27:36 +02:00 Compare
teknomunk requested review from the-real-herowl 2024-09-16 13:30:57 +02:00
teknomunk force-pushed fix-indestructable-blocks from c0d2d73814 to 1494d4a1bb 2024-09-17 12:06:06 +02:00 Compare
teknomunk force-pushed fix-indestructable-blocks from 1494d4a1bb to 89f8fdc8cb 2024-11-10 12:18:12 +01:00 Compare
teknomunk force-pushed fix-indestructable-blocks from 89f8fdc8cb to 59e7611eda 2024-11-11 02:18:24 +01:00 Compare
teknomunk force-pushed fix-indestructable-blocks from 59e7611eda to 9146c0257f 2024-11-12 01:00:31 +01:00 Compare
First-time contributor

Sooo, wanna test this to help out, but do you guys have any easy examples of "Mods that don't use VoxeLibre groups"? 👼

Sooo, wanna test this to help out, but do you guys have any easy examples of "Mods that don't use VoxeLibre groups"? 👼
Author
Member

The mod that led me to making this in the first place is https://content.luanti.org/packages/GreenXenith/mesecons_wireless/

The mod that led me to making this in the first place is https://content.luanti.org/packages/GreenXenith/mesecons_wireless/
First-time contributor

The mod that led me to making this in the first place is https://content.luanti.org/packages/GreenXenith/mesecons_wireless/

I can't use this mod, it says I'm missing "default" as a dependency.

> The mod that led me to making this in the first place is https://content.luanti.org/packages/GreenXenith/mesecons_wireless/ I can't use this mod, it says I'm missing "default" as a dependency.
Author
Member

Ah, that's right. I had to edit the mod to get it to work. I'll find more mods to test this with.

Ah, that's right. I had to edit the mod to get it to work. I'll find more mods to test this with.
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
Sign in to join this conversation.
No reviewers
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#4285
No description provided.