mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 14:23:16 -04:00
add moonflower, glowing dye, glowing mese...
This commit is contained in:
parent
8260e3b886
commit
1c69bdde58
9 changed files with 118 additions and 0 deletions
|
@ -304,6 +304,21 @@ minetest.register_craft({
|
|||
recipe = {"default:steel_ingot", "default:copper_ingot"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dye:glowing_dye",
|
||||
recipe = {"default:mese_crystal_fragment", "moonflower:moonflower_closed"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:glowing_mese',
|
||||
recipe = {
|
||||
{'', 'dye:glowing_dye', ''},
|
||||
{'dye:glowing_dye', 'default:mese', 'dye:glowing_dye'},
|
||||
{'', 'dye:glowing_dye', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:coalblock',
|
||||
recipe = {
|
||||
|
|
|
@ -29,6 +29,14 @@ minetest.register_node("default:stone_with_coal", {
|
|||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:glowing_mese", {
|
||||
description = "Glowing Mese",
|
||||
tiles = {"default_glowing_mese.png"},
|
||||
groups = {cracky=1,level=2},
|
||||
light_source = 14,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:stone_with_iron", {
|
||||
description = "Iron Ore",
|
||||
tiles = {"default_stone.png^default_mineral_iron.png"},
|
||||
|
|
BIN
mods/default/textures/default_glowing_mese.png
Normal file
BIN
mods/default/textures/default_glowing_mese.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 473 B |
|
@ -61,6 +61,12 @@ dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orang
|
|||
-- Local stuff
|
||||
local dyelocal = {}
|
||||
|
||||
-- Glowing Moonflower Dye:
|
||||
minetest.register_craftitem("dye:glowing_dye", {
|
||||
description = "Glowing Moonflower Dye",
|
||||
inventory_image = "dye_moonflower_glow.png",
|
||||
})
|
||||
|
||||
-- This collection of colors is partly a historic thing, partly something else.
|
||||
dyelocal.dyes = {
|
||||
{"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}},
|
||||
|
|
BIN
mods/dye/textures/dye_moonflower_glow.png
Normal file
BIN
mods/dye/textures/dye_moonflower_glow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 430 B |
1
mods/moonflower/depends.txt
Normal file
1
mods/moonflower/depends.txt
Normal file
|
@ -0,0 +1 @@
|
|||
default
|
88
mods/moonflower/init.lua
Normal file
88
mods/moonflower/init.lua
Normal file
|
@ -0,0 +1,88 @@
|
|||
-- Moon Flower mod by MirceaKitsune
|
||||
|
||||
local SPAWN_ATTEMPTS = 5 -- How many times to attempt spawning per chunk
|
||||
local SPAWN_PROBABILITY = 0.1 -- Probability of each spawn attempt
|
||||
local OPEN_TIME_START = 0.2 -- Day time at which moon flowers open up
|
||||
local OPEN_TIME_END = 0.8 -- Day time at which moon flowers close up
|
||||
local OPEN_CHECK = 10 -- Interval at which to check if lighting changed
|
||||
|
||||
minetest.register_node("moonflower:moonflower_closed", {
|
||||
description = "Moon flower",
|
||||
drawtype = "plantlike",
|
||||
tiles = { "moonflower_closed.png" },
|
||||
inventory_image = "moonflower_closed.png",
|
||||
wield_image = "moonflower_closed.png",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = { snappy = 3, flammable=2, flower=1 },
|
||||
drop = 'moonflower:moonflower_closed',
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("moonflower:moonflower_open", {
|
||||
description = "Moon flower",
|
||||
drawtype = "plantlike",
|
||||
tiles = { "moonflower_open.png" },
|
||||
inventory_image = "moonflower_open.png",
|
||||
wield_image = "moonflower_open.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
light_source = LIGHT_MAX / 2,
|
||||
groups = { not_in_creative_inventory = 1, snappy = 3, flammable=2, flower=1 },
|
||||
drop = 'moonflower:moonflower_closed',
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||
},
|
||||
})
|
||||
|
||||
set_moonflower = function (pos)
|
||||
-- choose the appropriate form of the moon flower
|
||||
if (minetest.env:get_node_light(pos, 0.5) == 15)
|
||||
and ((minetest.env:get_timeofday() < OPEN_TIME_START) or (minetest.env:get_timeofday() > OPEN_TIME_END)) then
|
||||
minetest.env:add_node(pos, { name = "moonflower:moonflower_open" })
|
||||
else
|
||||
minetest.env:add_node(pos, { name = "moonflower:moonflower_closed" })
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "moonflower:moonflower_closed", "moonflower:moonflower_open" },
|
||||
interval = OPEN_CHECK,
|
||||
chance = 1,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
set_moonflower(pos)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
for attempts = 0, SPAWN_ATTEMPTS do
|
||||
-- choose a random location on the X and Z axes
|
||||
local coords_x = math.random(minp.x, maxp.x)
|
||||
local coords_z = math.random(minp.z, maxp.z)
|
||||
|
||||
-- now scan upward until we find a suitable spot on the Y axis, if none is found this attempt is failed
|
||||
for coords_y = minp.y, maxp.y do
|
||||
local pos_here = { x = coords_x, y = coords_y, z = coords_z }
|
||||
local node_here = minetest.env:get_node(pos_here)
|
||||
local pos_top = { x = coords_x, y = coords_y + 1, z = coords_z }
|
||||
local node_top = minetest.env:get_node(pos_top)
|
||||
|
||||
if (node_here.name == "default:dirt_with_grass") and (node_top.name == "air") then
|
||||
if (math.random() <= SPAWN_PROBABILITY) then
|
||||
set_moonflower(pos_top)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
BIN
mods/moonflower/textures/moonflower_closed.png
Normal file
BIN
mods/moonflower/textures/moonflower_closed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 269 B |
BIN
mods/moonflower/textures/moonflower_open.png
Normal file
BIN
mods/moonflower/textures/moonflower_open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 289 B |
Loading…
Add table
Reference in a new issue