mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-23 03:13:46 +01:00
Automatically parse solid groups
parent
c6223e5b3d
commit
3d7502f666
2
API.md
2
API.md
@ -49,6 +49,8 @@ This section explains all the used groups in this subgame.
|
|||||||
### Declarative groups
|
### Declarative groups
|
||||||
These groups are used mostly for informational purposes
|
These groups are used mostly for informational purposes
|
||||||
|
|
||||||
|
* `solid=1`: Solid block (automatically assigned)
|
||||||
|
* `not_solid=1`: Block is sold (only assign this group for nodes which are automatically detected as “solid” in error
|
||||||
* `water=1`: Water
|
* `water=1`: Water
|
||||||
* `lava=1`: Lava
|
* `lava=1`: Lava
|
||||||
* `liquid`: Block is a liquid
|
* `liquid`: Block is a liquid
|
||||||
|
18
mods/mcl_autogroup/init.lua
Normal file
18
mods/mcl_autogroup/init.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
-- Automatically assign the “solid” group for solid nodes
|
||||||
|
local overwrite = function()
|
||||||
|
for nname, ndef in pairs(minetest.registered_nodes) do
|
||||||
|
if (ndef.walkable == nil or ndef.walkable == true)
|
||||||
|
and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
|
||||||
|
and (ndef.node_box == nil or ndef.node_box.type == "regular")
|
||||||
|
and (ndef.groups.falling_node == 0 or ndef.groups.falling_node == nil)
|
||||||
|
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
|
||||||
|
local groups = table.copy(ndef.groups)
|
||||||
|
groups.solid = 1
|
||||||
|
minetest.override_item(nname, {
|
||||||
|
groups = groups
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
overwrite()
|
1
mods/mcl_autogroup/mod.conf
Normal file
1
mods/mcl_autogroup/mod.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
name = mcl_autogroup
|
Loading…
Reference in New Issue
Block a user