1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-11-13 05:50:17 +01:00

add fallback node for when [game] doesn't have dirt alias defined

This commit is contained in:
tenplus1 2024-06-29 08:22:33 +01:00
parent e11f383589
commit 91be60be9b
5 changed files with 23 additions and 5 deletions

17
api.lua
View File

@ -11,16 +11,23 @@ local use_mc2 = minetest.get_modpath("mcl_core")
-- Visual Harm 1ndicator check
local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")
-- Node check helper
local function has(nodename)
if nodename and minetest.registered_nodes[nodename] then
return nodename
end
end
-- Global
mobs = {
mod = "redo",
version = "20240620",
version = "20240629",
translate = S,
invis = minetest.global_exists("invisibility") and invisibility or {},
node_snow = minetest.registered_aliases["mapgen_snow"]
or (use_mc2 and "mcl_core:snow") or "default:snow",
node_dirt = minetest.registered_aliases["mapgen_dirt"]
or (use_mc2 and "mcl_core:dirt") or "default:dirt"
node_snow = has(minetest.registered_aliases["mapgen_snow"])
or has("mcl_core:snow") or has("default:snow") or "air",
node_dirt = has(minetest.registered_aliases["mapgen_dirt"])
or has("mcl_core:dirt") or has("default:dirt") or "mobs:fallback_node"
}
mobs.fallback_node = mobs.node_dirt

View File

@ -7,6 +7,14 @@ minetest.register_privilege("peaceful_player", {
give_to_singleplayer = false
})
-- Fallback node
minetest.register_node("mobs:fallback_node", {
description = "Fallback Node",
tiles = {"mobs_fallback.png"},
is_ground_content = false,
groups = {handy = 1, crumbly = 3},
drop = ""
})
-- Mob API
dofile(path .. "/api.lua")

View File

@ -23,6 +23,8 @@ THE SOFTWARE.
Textures under CC0 license by TenPlus1
mobs_fallback.png is dirt texture from original Minetest (CC-BY SA 3.0)
ShadowNinja (CC BY-SA 3.0):
tnt_smoke.png

View File

@ -33,6 +33,7 @@ https://forum.minetest.net/viewtopic.php?f=11&t=9917
* Added support for Visual Harm 1ndicators mod to show health bars
* Added self.node_damage flag which is true by default to enable damage_per_second node damage
* Added check for on_death() function before using mob api's own on_die() one
* Added mobs:fallback_node for when current [game] hasn't defined mapgen_dirt node
### Version 1.60

BIN
textures/mobs_fallback.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB