add mineclone support, tweak & tidy code
This commit is contained in:
parent
54caa91c49
commit
61372d0987
118
init.lua
118
init.lua
@ -1,75 +1,62 @@
|
||||
|
||||
-- mod check and sound settings
|
||||
|
||||
local def = minetest.get_modpath("default")
|
||||
local mcl = minetest.get_modpath("mcl_core")
|
||||
local snd = mcl and mcl_sounds.node_sound_glass_defaults() or default.node_sound_glass_defaults()
|
||||
|
||||
-- PB&J Pup node
|
||||
|
||||
minetest.register_node("pbj_pup:pbj_pup", {
|
||||
description = "PB&J Pup",
|
||||
tiles = {
|
||||
"pbj_pup_sides.png",
|
||||
"pbj_pup_jelly.png",
|
||||
"pbj_pup_sides.png",
|
||||
"pbj_pup_sides.png",
|
||||
"pbj_pup_back.png",
|
||||
"pbj_pup_front.png"
|
||||
"pbj_pup_sides.png", "pbj_pup_jelly.png", "pbj_pup_sides.png",
|
||||
"pbj_pup_sides.png", "pbj_pup_back.png", "pbj_pup_front.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = default.LIGHT_MAX,
|
||||
light_source = 15,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
groups = {cracky = 2, handy = 1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
sounds = snd,
|
||||
_mcl_hardness = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "pbj_pup:pbj_pup",
|
||||
burntime = 10
|
||||
})
|
||||
-- Nyan Cat node
|
||||
|
||||
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"
|
||||
"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,
|
||||
light_source = 15,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
groups = {cracky = 2, handy = 1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
sounds = snd,
|
||||
_mcl_hardness = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "nyancat:nyancat",
|
||||
burntime = 10
|
||||
})
|
||||
-- MooGNU node
|
||||
|
||||
minetest.register_node(":moognu:moognu", {
|
||||
description = "MooGNU",
|
||||
tiles = {
|
||||
"moognu_side.png",
|
||||
"moognu_side.png",
|
||||
"moognu_side.png",
|
||||
"moognu_side.png",
|
||||
"moognu_back.png",
|
||||
"moognu_front.png"
|
||||
"moognu_side.png", "moognu_side.png", "moognu_side.png",
|
||||
"moognu_side.png", "moognu_back.png", "moognu_front.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = default.LIGHT_MAX,
|
||||
light_source = 15,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
groups = {cracky = 2, handy = 1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
sounds = snd,
|
||||
_mcl_hardness = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "moognu:moognu",
|
||||
burntime = 10
|
||||
})
|
||||
-- Rainbow node
|
||||
|
||||
minetest.register_node(":nyancat:nyancat_rainbow", {
|
||||
description = "Rainbow",
|
||||
@ -79,11 +66,32 @@ minetest.register_node(":nyancat:nyancat_rainbow", {
|
||||
"nyancat_rainbow.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = default.LIGHT_MAX,
|
||||
light_source = 15,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
groups = {cracky = 2, handy = 1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
sounds = snd,
|
||||
_mcl_hardness = 1,
|
||||
})
|
||||
|
||||
-- Fuels
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "pbj_pup:pbj_pup",
|
||||
burntime = 10
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "nyancat:nyancat",
|
||||
burntime = 10
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "moognu:moognu",
|
||||
burntime = 10
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
@ -92,14 +100,13 @@ minetest.register_craft({
|
||||
burntime = 10
|
||||
})
|
||||
|
||||
-- helper function to place Nyan/Pup/Moo with rainbow tail
|
||||
|
||||
local types = {"pbj_pup:pbj_pup", "nyancat:nyancat", "moognu:moognu"}
|
||||
|
||||
-- Place Nyan, Pup or MooGnu with Rainbow
|
||||
local function place(pos, facedir, length)
|
||||
|
||||
if facedir > 3 then
|
||||
facedir = 0
|
||||
end
|
||||
if facedir > 3 then facedir = 0 end
|
||||
|
||||
local tailvec = minetest.facedir_to_dir(facedir)
|
||||
local p = {x = pos.x, y = pos.y, z = pos.z}
|
||||
@ -117,6 +124,7 @@ local function place(pos, facedir, length)
|
||||
end
|
||||
|
||||
-- Do we generate PB&J Pup and Nyan Cat's in world?
|
||||
|
||||
if minetest.settings:get_bool("pbj_pup_generate") ~= false then
|
||||
|
||||
local function generate(minp, maxp, seed)
|
||||
@ -125,9 +133,7 @@ if minetest.settings:get_bool("pbj_pup_generate") ~= false then
|
||||
local height_max = -32
|
||||
local chance = 1000
|
||||
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
if maxp.y < height_min or minp.y > height_max then return end
|
||||
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
@ -146,11 +152,15 @@ if minetest.settings:get_bool("pbj_pup_generate") ~= false then
|
||||
|
||||
minetest.register_on_generated(generate)
|
||||
|
||||
default.generate_nyancats = generate --Legacy
|
||||
if def then default.generate_nyancats = generate end --Legacy
|
||||
end
|
||||
|
||||
-- Legacy
|
||||
|
||||
minetest.register_alias("default:nyancat", "nyancat:nyancat")
|
||||
minetest.register_alias("default:nyancat_rainbow", "nyancat:nyancat_rainbow")
|
||||
minetest.register_alias("pbj_pup:pbj_pup_candies", "nyancat:nyancat_rainbow")
|
||||
default.make_nyancat = place
|
||||
|
||||
if def then default.make_nyancat = place end
|
||||
|
||||
print("[MOD] PB&J Pup loaded")
|
||||
|
Loading…
x
Reference in New Issue
Block a user