Rename indestructible wool nodes (+ documentation and cleanups) (#367)

This commit is contained in:
ANAND 2019-03-17 20:13:31 +05:30 committed by rubenwardy
parent ab423cea90
commit a3b41c154c
3 changed files with 779 additions and 759 deletions

View file

@ -2,6 +2,10 @@
This mod handles creating and loading maps. This mod handles creating and loading maps.
## Attributions
- Indestructible nodes adapted from various mods in `minetest_game`.
## Creating a new map ## Creating a new map
### 1. Dependencies ### 1. Dependencies
@ -61,14 +65,17 @@ Each map's metadata is stored in an accompanying .conf file containing the follo
* `hint`: [Optional] Helpful hint or tip for unique maps, to help players understand the map. * `hint`: [Optional] Helpful hint or tip for unique maps, to help players understand the map.
* `rotation`: Rotation of the schem. [`x`|`z`] * `rotation`: Rotation of the schem. [`x`|`z`]
* `schematic`: Name of the map's schematic. * `schematic`: Name of the map's schematic.
* `initial_stuff`: [Optional] Comma-separated list of itemstacks to be given to the player on join and on respawn. * `initial_stuff`: [Optional] Comma-separated list of itemstacks to be given to the player
* `treasures`: [Optional] List of treasures to be registered for the map, in a serialized format. Refer to the `treasures` sub-section for more details. on join and on respawn.
* `treasures`: [Optional] List of treasures to be registered for the map, in a serialized
format. Refer to the `treasures` sub-section for more details.
* `r`: Radius of the map. * `r`: Radius of the map.
* `h`: Height of the map. * `h`: Height of the map.
* `team.i`: Name of team `i`. * `team.i`: Name of team `i`.
* `team.i.color`: Color of team `i`. * `team.i.color`: Color of team `i`.
* `team.i.pos`: Position of team `i`'s flag, relative to center of schem. * `team.i.pos`: Position of team `i`'s flag, relative to center of schem.
* `chests.i.from`, `chests.i.to`: [Optional] Positions of diagonal corners of custom chest zone `i`, relative to the center of the schem. * `chests.i.from`, `chests.i.to`: [Optional] Positions of diagonal corners of custom chest
zone `i`, relative to the center of the schem.
* `chests.i.n`: [Optional] Number of chests to place in custom chest zone `i`. * `chests.i.n`: [Optional] Number of chests to place in custom chest zone `i`.
#### `treasures` #### `treasures`
@ -82,3 +89,15 @@ treasures = default:pick_steel,0.5,5,1,10;shooter:shotgun,0.04,2,1;shooter:grena
``` ```
(See [here](../../other/treasurer/README.md) to understand the magic numbers) (See [here](../../other/treasurer/README.md) to understand the magic numbers)
## Indestructible nodes
- `ctf_map` provides indestructible nodes for most nodes from default, and all nodes from
stairs.
- All indestructible nodes have the same item name with the mod prefix being `ctf_map:`
instead of their original prefixes (e.g. `default:stone` -> `ctf_map:stone` and
`stairs:stair_stone` -> `ctf_map:stair_stone`) with the exception of wool, whose
indestructible nodes have slightly different names from the original node names -
`ctf_map:wool_<color>`. This is because the original nomenclature becomes meaningless
if the modname prefix is changed.

View file

@ -1,16 +1,5 @@
minetest.register_node("ctf_map:reinforced_cobble", {
description = "Reinforced Cobblestone",
tiles = {"ctf_map_reinforced_cobble.png"},
is_ground_content = false,
groups = {cracky = 1, stone = 2},
sounds = default.node_sound_stone_defaults(),
})
--
-- Special nodes -- Special nodes
-- do
minetest.register_node("ctf_map:ignore", { minetest.register_node("ctf_map:ignore", {
description = "Artificial Ignore", -- this may need to be given a more appropriate name description = "Artificial Ignore", -- this may need to be given a more appropriate name
drawtype = "airlike", drawtype = "airlike",
@ -64,10 +53,31 @@ minetest.register_node("ctf_map:ind_stone_red", {
is_ground_content = false is_ground_content = false
}) })
-- minetest.register_node("ctf_map:killnode", {
-- Indestructible nodes for building description = "Kill Node",
-- drawtype = "glasslike",
tiles = {"ctf_map_killnode.png"},
paramtype = "light",
sunlight_propogates = true,
walkable = false,
pointable = false,
damage_per_second = 20,
is_ground_content = false,
groups = {immortal = 1},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("ctf_map:reinforced_cobble", {
description = "Reinforced Cobblestone",
tiles = {"ctf_map_reinforced_cobble.png"},
is_ground_content = false,
groups = {cracky = 1, stone = 2},
sounds = default.node_sound_stone_defaults(),
})
end
-- Indestructible nodes from default
do
-- Stone -- Stone
minetest.register_node("ctf_map:stone", { minetest.register_node("ctf_map:stone", {
@ -111,6 +121,7 @@ minetest.register_node("ctf_map:mossycobble", {
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.register_node("ctf_map:desert_stone", { minetest.register_node("ctf_map:desert_stone", {
description = "Indestructible Desert Stone", description = "Indestructible Desert Stone",
tiles = {"default_desert_stone.png"}, tiles = {"default_desert_stone.png"},
@ -735,33 +746,21 @@ minetest.register_node("ctf_map:meselamp", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
light_source = default.LIGHT_MAX, light_source = default.LIGHT_MAX,
}) })
end
minetest.register_node("ctf_map:killnode", { -- Register indestructible variants of nodes from stairs and wool
description = "Kill Node", do
drawtype = "glasslike",
tiles = {"ctf_map_killnode.png"},
paramtype = "light",
sunlight_propogates = true,
walkable = false,
pointable = false,
damage_per_second = 20,
is_ground_content = false,
groups = {immortal = 1},
sounds = default.node_sound_glass_defaults(),
})
-- Re-register all nodes from stairs and wool
for name, nodedef in pairs(minetest.registered_nodes) do for name, nodedef in pairs(minetest.registered_nodes) do
if name:find("stairs") then if name:find("stairs") then
nodedef = table.copy(nodedef) nodedef = table.copy(nodedef)
nodedef.groups = {immortal = 1} nodedef.groups = {immortal = 1}
minetest.register_node("ctf_map:" .. name:split(":")[2], nodedef) minetest.register_node("ctf_map:" .. name:split(":")[2], nodedef)
elseif name:find("wool") then elseif name:find("wool") then
local color = name:split(":")[2]
nodedef = table.copy(nodedef) nodedef = table.copy(nodedef)
nodedef.groups = {immortal = 1} nodedef.groups = {immortal = 1}
minetest.register_node("ctf_map:" .. name:split(":")[2], nodedef) minetest.register_node("ctf_map:wool_" .. color, nodedef)
minetest.register_alias("ctf_map:" .. color, "ctf_map:wool_" .. color)
end
end end
end end
minetest.register_alias("ctf_map:ind_cobble", "ctf_map:cobble")
minetest.register_alias("ctf_map:ind_stone", "ctf_map:stone")

View file

@ -2,6 +2,8 @@ assert(minetest.get_mapgen_setting("mg_name") == "singlenode", "singlenode mapge
minetest.register_alias("mapgen_singlenode", "ctf_map:ignore") minetest.register_alias("mapgen_singlenode", "ctf_map:ignore")
minetest.register_alias("ctf_map:flag", "air") minetest.register_alias("ctf_map:flag", "air")
minetest.register_alias("ctf_map:ind_cobble", "ctf_map:cobble")
minetest.register_alias("ctf_map:ind_stone", "ctf_map:stone")
minetest.register_alias("flowers:mushroom_red", "air") minetest.register_alias("flowers:mushroom_red", "air")
minetest.register_alias("flowers:mushroom_brown", "air") minetest.register_alias("flowers:mushroom_brown", "air")