Make game agnostic and add mod.conf (#2)

This commit is contained in:
ROllerozxa 2022-09-04 19:02:09 +02:00 committed by GitHub
parent c1fbe4cf21
commit 642d7f679d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 9 deletions

@ -1 +0,0 @@
default

@ -1,13 +1,21 @@
local node_sound
if minetest.global_exists("default") then
node_sound = default.node_sound_defaults()
elseif minetest.global_exists("sounds") then
node_sound = sounds.node()
end
minetest.register_node("nyancat:nyancat", { minetest.register_node("nyancat:nyancat", {
description = "Nyan Cat", description = "Nyan Cat",
tiles = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png", tiles = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png",
"nyancat_side.png", "nyancat_back.png", "nyancat_front.png"}, "nyancat_side.png", "nyancat_back.png", "nyancat_front.png"},
paramtype = "light", paramtype = "light",
light_source = default.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky = 2}, groups = {cracky = 2},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_defaults(), sounds = node_sound,
}) })
minetest.register_node("nyancat:nyancat_rainbow", { minetest.register_node("nyancat:nyancat_rainbow", {
@ -18,11 +26,11 @@ minetest.register_node("nyancat:nyancat_rainbow", {
"nyancat_rainbow.png" "nyancat_rainbow.png"
}, },
paramtype = "light", paramtype = "light",
light_source = default.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky = 2}, groups = {cracky = 2},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_defaults(), sounds = node_sound,
}) })
@ -83,7 +91,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
end) end)
-- Legacy compat -- Legacy compat
minetest.register_alias("default:nyancat", "nyancat:nyancat") if minetest.global_exists("default") then
minetest.register_alias("default:nyancat_rainbow", "nyancat:nyancat_rainbow") minetest.register_alias("default:nyancat", "nyancat:nyancat")
default.make_nyancat = nyancat.place minetest.register_alias("default:nyancat_rainbow", "nyancat:nyancat_rainbow")
default.generate_nyancats = nyancat.generate default.make_nyancat = nyancat.place
default.generate_nyancats = nyancat.generate
end

4
mod.conf Normal file

@ -0,0 +1,4 @@
name = nyancat
title = Nyan Cat
description = nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan
optional_depends = default, sounds