Move all common mods back to minetest_game

This commit is contained in:
PilzAdam 2013-05-18 16:05:16 +02:00
parent 7f765f5f6c
commit fcf0816fa8
273 changed files with 12186 additions and 6 deletions

16
mods/flowers/README.txt Normal file
View file

@ -0,0 +1,16 @@
Minetest 0.4 mod: flowers
=========================
License of source code:
-----------------------
Copyright (C) 2012-2013 Ironzorg, VanessaE
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
License of media (textures and sounds)
--------------------------------------
WTFPL

1
mods/flowers/depends.txt Normal file
View file

@ -0,0 +1 @@
default

167
mods/flowers/init.lua Normal file
View file

@ -0,0 +1,167 @@
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
-- Map Generation
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
-- Aliases for original flowers mod
minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white")
minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow")
minetest.register_alias("flowers:flower_geranium", "flowers:geranium")
minetest.register_alias("flowers:flower_rose", "flowers:rose")
minetest.register_alias("flowers:flower_tulip", "flowers:tulip")
minetest.register_alias("flowers:flower_viola", "flowers:viola")
minetest.register_node("flowers:dandelion_white", {
description = "White Dandelion",
drawtype = "plantlike",
tiles = { "flowers_dandelion_white.png" },
inventory_image = "flowers_dandelion_white.png",
wield_image = "flowers_dandelion_white.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_white=1},
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("flowers:dandelion_yellow", {
description = "Yellow Dandelion",
drawtype = "plantlike",
tiles = { "flowers_dandelion_yellow.png" },
inventory_image = "flowers_dandelion_yellow.png",
wield_image = "flowers_dandelion_yellow.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_yellow=1},
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("flowers:geranium", {
description = "Blue Geranium",
drawtype = "plantlike",
tiles = { "flowers_geranium.png" },
inventory_image = "flowers_geranium.png",
wield_image = "flowers_geranium.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_blue=1},
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("flowers:rose", {
description = "Rose",
drawtype = "plantlike",
tiles = { "flowers_rose.png" },
inventory_image = "flowers_rose.png",
wield_image = "flowers_rose.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_red=1},
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("flowers:tulip", {
description = "Tulip",
drawtype = "plantlike",
tiles = { "flowers_tulip.png" },
inventory_image = "flowers_tulip.png",
wield_image = "flowers_tulip.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_orange=1},
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("flowers:viola", {
description = "Viola",
drawtype = "plantlike",
tiles = { "flowers_viola.png" },
inventory_image = "flowers_viola.png",
wield_image = "flowers_viola.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_violet=1},
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_abm({
nodenames = {"group:flora"},
neighbors = {"default:dirt_with_grass", "default:desert_sand"},
interval = 50,
chance = 25,
action = function(pos, node)
pos.y = pos.y - 1
local under = minetest.env:get_node(pos)
pos.y = pos.y + 1
if under.name == "default:desert_sand" then
minetest.env:set_node(pos, {name="default:dry_shrub"})
elseif under.name ~= "default:dirt_with_grass" then
return
end
local light = minetest.env:get_node_light(pos)
if not light or light < 13 then
return
end
local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4}
local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4}
if #minetest.env:find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
return
end
local flowers = minetest.env:find_nodes_in_area(pos0, pos1, "group:flora")
if #flowers > 3 then
return
end
local seedling = minetest.env:find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
if #seedling > 0 then
seedling = seedling[math.random(#seedling)]
seedling.y = seedling.y + 1
light = minetest.env:get_node_light(seedling)
if not light or light < 13 then
return
end
if minetest.env:get_node(seedling).name == "air" then
minetest.env:set_node(seedling, {name=node.name})
end
end
end,
})

62
mods/flowers/mapgen.lua Normal file
View file

@ -0,0 +1,62 @@
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y >= 2 and minp.y <= 0 then
-- Generate flowers
local perlin1 = minetest.env:get_perlin(436, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine flowers amount from perlin noise
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
-- Find random positions for flowers based on this random
local pr = PseudoRandom(seed+456)
for i=0,grass_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
if ground_y then
local p = {x=x,y=ground_y+1,z=z}
local nn = minetest.env:get_node(p).name
-- Check if the node can be replaced
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
nn = minetest.env:get_node({x=x,y=ground_y,z=z}).name
if nn == "default:dirt_with_grass" then
local flower_choice = pr:next(1, 6)
local flower
if flower_choice == 1 then
flower = "flowers:tulip"
elseif flower_choice == 2 then
flower = "flowers:rose"
elseif flower_choice == 3 then
flower = "flowers:dandelion_yellow"
elseif flower_choice == 4 then
flower = "flowers:dandelion_white"
elseif flower_choice == 5 then
flower = "flowers:flower_geranium"
elseif flower_choice == 6 then
flower = "flowers:viola"
end
minetest.env:set_node(p, {name=flower})
end
end
end
end
end
end
end
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B