added farming mod (own mod not from minetest_game)

This commit is contained in:
cale 2016-01-10 12:14:08 +01:00
parent d4ed4bdb29
commit 95a6075a54
13 changed files with 116 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 283 B

16
mods/farming/LICENSE.txt Normal file
View File

@ -0,0 +1,16 @@
License for Code
----------------
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-2.1.html
License for Media
-----------------
CC-BY-SA 3.0 UNPORTED. Created by cd2 (cdqwertz)

50
mods/farming/init.lua Normal file
View File

@ -0,0 +1,50 @@
farming = {}
function farming.register_plant(name, steps, def)
for i = 1, steps, 1 do
minetest.register_node(":farming:"..name.."_"..tostring(i), {
description = def.description .. " " .. tostring(i),
tiles = {def.texture.."_"..tostring(i)..".png"},
drawtype = "plantlike",
paramtype = "light",
drop = def.drop .. " " .. tostring(i),
groups = {crumbly=3},
walkable = false,
})
minetest.register_abm({
nodenames = {"farming:"..name.."_"..tostring(i)},
neighbors = {"default:dirt", "default:grass"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if i < steps then
minetest.set_node(pos, {name = "farming:"..name.."_"..tostring(i+1)})
end
end,
})
end
minetest.register_craftitem(def.drop, {
description = def.drop_description,
inventory_image = def.drop_texture,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.set_node(pointed_thing.above, {name="farming:"..name.."_1"})
itemstack:take_item()
end
return itemstack
end,
})
end
farming.register_plant("wheat", 5, {
description = "Wheat",
texture = "farming_wheat",
drop = "farming:wheat_seeds",
drop_description = "Wheat Seeds",
drop_texture = "farming_wheat_seeds.png",
})
minetest.register_craftitem("farming:flour", {
description = "Flour",
inventory_image = "farming_flour.png",
})

50
mods/farming/init.lua~ Normal file
View File

@ -0,0 +1,50 @@
farming = {}
function farming.register_plant(name, steps, def)
for i = 1, steps, 1 do
minetest.register_node(":farming:"..name.."_"..tostring(i), {
description = def.description .. " " .. tostring(i),
tiles = {def.texture.."_"..tostring(i)..".png"},
drawtype = "plantlike",
paramtype = "light",
drop = def.drop .. " " .. tostring(i),
groups = {crumbly=3},
walkable = false,
})
minetest.register_abm({
nodenames = {"farming:"..name.."_"..tostring(i)},
neighbors = {"default:dirt", "default:grass"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if i < steps then
minetest.set_node(pos, {name = "farming:"..name.."_"..tostring(i+1)})
end
end,
})
end
minetest.register_craftitem(def.drop, {
description = def.drop_description,
inventory_image = def.drop_texture,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.set_node(pointed_thing.above, {name="farming:"..name.."_1"})
itemstack:take_item()
end
return itemstack
end,
})
end
farming.register_plant("wheat", 5, {
description = "Wheat",
texture = "farming_wheat",
drop = "farming:wheat_seeds",
drop_description = "Wheat Seeds",
drop_texture = "farming_wheat_seeds.png",
})
minetest.register_craftitem("farming:flour", {
description = "Flour",
inventory_image = "farming_flour.png",
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B