Nyancat mod integration
The nyancat mod is not published at Minetest's content database and not in minetest_game, so a successful installation of the nyanland mod is difficult. To avoid this dependency difficulty, the nyancat mod can be embedded into the nyanland mod. The nyancat mod is already added as a subtree but not yet integrated. Changes by this commit: * Execute the embedded nyancat mod code if there is no other nyancat mod installed and modify the mod such that the embedding works * Disable legacy nyanland and nyancat code by default and add settings to enable them if needed * Reduce the nyancat:nyancat fall damage * Some changes to satisfy luacheck
10
.luacheckrc
@ -1,13 +1,5 @@
|
||||
read_globals = {"minetest", "vector", "math", "table", "ItemStack", "dump",
|
||||
"VoxelArea", "VoxelManip", "PseudoRandom",
|
||||
"default", "treecapitator",
|
||||
nyancat = {
|
||||
fields = {
|
||||
place = {
|
||||
read_only = false,
|
||||
}
|
||||
},
|
||||
other_fields = true
|
||||
}
|
||||
}
|
||||
globals = {"nyanland_height"}
|
||||
globals = {"nyancat", "nyanland_height"}
|
||||
|
@ -2,6 +2,8 @@ Code:
|
||||
|
||||
The mod this is based on was licensed under GPLv3 and can be found in the 0.3
|
||||
branch and at https://forum.minetest.net/viewtopic.php?t=658.
|
||||
License of the embedded nyancat mod (see nyancat/license.txt):
|
||||
SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
License of my changes:
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
@ -10,6 +12,7 @@ SPDX-License-Identifier: MIT
|
||||
Textures:
|
||||
|
||||
SPDX-License-Identifier: CC-BY-SA-3.0
|
||||
See nyancat/license.txt for the authors of the nyancat_* textures.
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
default
|
||||
nyancat
|
||||
nyancat?
|
||||
treecapitator?
|
||||
|
14
init.lua
@ -1,3 +1,6 @@
|
||||
local modpath = minetest.get_modpath"nyanland"
|
||||
dofile(modpath .. "/nyancat/init.lua")
|
||||
|
||||
local settings = {
|
||||
height = tonumber(minetest.settings:get"nyanland.height") or 30688,
|
||||
nyancat_prop = (tonumber(minetest.settings:get"nyanland.nyancat_prop")
|
||||
@ -589,17 +592,14 @@ end
|
||||
|
||||
|
||||
nyanland_height = settings.height
|
||||
dofile(minetest.get_modpath"nyanland".."/portal.lua")
|
||||
dofile(modpath .. "/portal.lua")
|
||||
|
||||
|
||||
-- legacy
|
||||
if not minetest.settings:get_bool"nyanland.enable_nyanland_legacy" then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.register_entity("nyanland:tail_entity", {
|
||||
--[[physical = false,
|
||||
visual = "sprite",
|
||||
timer=0,
|
||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
||||
visual = "cube",--]]
|
||||
on_activate = function(self)
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
Minetest Game mod: nyancat
|
||||
Modified Minetest Game mod: nyancat
|
||||
==========================
|
||||
See license.txt for license information.
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
default
|
@ -1,17 +1,23 @@
|
||||
minetest.register_node("nyancat:nyancat", {
|
||||
if minetest.global_exists("nyancat") then
|
||||
return
|
||||
end
|
||||
assert(not minetest.registered_nodes["nyancat:nyancat"],
|
||||
"Detected an incompatible nyancat mod")
|
||||
|
||||
minetest.register_node(":nyancat:nyancat", {
|
||||
description = "Nyan Cat",
|
||||
tiles = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png",
|
||||
"nyancat_side.png", "nyancat_back.png", "nyancat_front.png"},
|
||||
paramtype = "light",
|
||||
light_source = default.LIGHT_MAX,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
groups = {cracky = 2, fall_damage_add_percent = -88},
|
||||
is_ground_content = false,
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nyancat:nyancat_rainbow", {
|
||||
minetest.register_node(":nyancat:nyancat_rainbow", {
|
||||
description = "Nyan Cat Rainbow",
|
||||
tiles = {
|
||||
"nyancat_rainbow.png^[transformR90",
|
||||
@ -47,7 +53,7 @@ function nyancat.place(pos, facedir, length)
|
||||
local tailvec = minetest.facedir_to_dir(facedir)
|
||||
local p = {x = pos.x, y = pos.y, z = pos.z}
|
||||
minetest.set_node(p, {name = "nyancat:nyancat", param2 = facedir})
|
||||
for i = 1, length do
|
||||
for _ = 1, length do
|
||||
p.x = p.x + tailvec.x
|
||||
p.z = p.z + tailvec.z
|
||||
minetest.set_node(p, {name = "nyancat:nyancat_rainbow", param2 = facedir})
|
||||
@ -65,7 +71,7 @@ function nyancat.generate(minp, maxp, seed)
|
||||
local volume = (maxp.x - minp.x + 1) * (y_max - y_min + 1) * (maxp.z - minp.z + 1)
|
||||
local pr = PseudoRandom(seed + 9324342)
|
||||
local max_num_nyancats = math.floor(volume / (16 * 16 * 16))
|
||||
for i = 1, max_num_nyancats do
|
||||
for _ = 1, max_num_nyancats do
|
||||
if pr:next(0, 1000) == 0 then
|
||||
local x0 = pr:next(minp.x, maxp.x)
|
||||
local y0 = pr:next(minp.y, maxp.y)
|
||||
@ -80,10 +86,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
nyancat.generate(minp, maxp, seed)
|
||||
end)
|
||||
|
||||
-- Legacy
|
||||
if not minetest.settings:get_bool"nyanland.enable_nyancat_legacy" then
|
||||
return
|
||||
end
|
||||
minetest.register_alias("default:nyancat", "nyancat:nyancat")
|
||||
minetest.register_alias("default:nyancat_rainbow", "nyancat:nyancat_rainbow")
|
||||
minetest.register_alias("nyancat", "nyancat:nyancat")
|
||||
minetest.register_alias("nyancat_rainbow", "nyancat:nyancat_rainbow")
|
||||
-- luacheck: globals default
|
||||
default.make_nyancat = nyancat.place
|
||||
default.generate_nyancats = nyancat.generate
|
||||
|
@ -8,6 +8,15 @@ nyanland.height (Height) int 30688 -32000 32000
|
||||
# The radius of the nyanland tree heads
|
||||
nyanland.tree_size (Tree head size) int 2 0 80
|
||||
|
||||
# The change of generating a nyancat in a mapchunk
|
||||
# The change of generating a nyancat in a mapchunk in the nyanland
|
||||
# Value in percent (default 100%)
|
||||
nyanland.nyancat_prop (Nyancat probability) float 100 0 100
|
||||
|
||||
# Execute the legacy code of the embedded nyancat mod. This setting should
|
||||
# only be enabled if compatibility problems occur with, for example, ancient
|
||||
# worlds which have the default:nyancat node.
|
||||
nyanland.enable_nyancat_legacy (Enable nyancat legacy) bool false
|
||||
|
||||
# Execute legacy code for worlds which have used ancient versions of the
|
||||
# nyanland mod. This setting should usually be disabled.
|
||||
nyanland.enable_nyanland_legacy (Enable nyanland legacy) bool false
|
||||
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 148 B |