Update farming mod
may need to be reverted
This commit is contained in:
parent
dbb8cebf90
commit
a31ba77de2
@ -1,34 +1,23 @@
|
||||
Minetest Game mod: farming
|
||||
==========================
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2014 webdesigner97
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by PilzAdam (MIT)
|
||||
webdesigner97 (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
License of media (textures):
|
||||
----------------------------
|
||||
Created by PilzAdam (License: WTFPL):
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
Created by PilzAdam (CC BY 3.0):
|
||||
farming_bread.png
|
||||
farming_soil.png
|
||||
farming_soil_wet.png
|
||||
farming_soil_wet_side.png
|
||||
farming_string.png
|
||||
|
||||
Created by BlockMen (License: CC BY 3.0):
|
||||
Created by BlockMen (CC BY 3.0):
|
||||
farming_tool_diamondhoe.png
|
||||
farming_tool_mesehoe.png
|
||||
farming_tool_bronzehoe.png
|
||||
@ -36,10 +25,10 @@ Created by BlockMen (License: CC BY 3.0):
|
||||
farming_tool_stonehoe.png
|
||||
farming_tool_woodhoe.png
|
||||
|
||||
Created by MasterGollum (License: WTFPL):
|
||||
Created by MasterGollum (CC BY 3.0):
|
||||
farming_straw.png
|
||||
|
||||
Created by Gambit (License: WTFPL):
|
||||
Created by Gambit (CC BY 3.0):
|
||||
farming_wheat.png
|
||||
farming_wheat_*.png
|
||||
farming_cotton_*.png
|
||||
|
@ -1,5 +1,8 @@
|
||||
|
||||
-- Wear out hoes, place soil
|
||||
-- TODO Ignore group:flower
|
||||
farming.registered_plants = {}
|
||||
|
||||
farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
@ -9,11 +12,11 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
||||
if pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||
local above = minetest.get_node(p)
|
||||
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
@ -21,23 +24,23 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- check if the node above the pointed thing is air
|
||||
if above.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- check if pointing at soil
|
||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- check if (wet) soil defined
|
||||
local regN = minetest.registered_nodes
|
||||
if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if minetest.is_protected(pt.under, user:get_player_name()) then
|
||||
minetest.record_protection_violation(pt.under, user:get_player_name())
|
||||
return
|
||||
@ -47,16 +50,22 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- turn the node into soil, wear out item and play sound
|
||||
-- turn the node into soil and play sound
|
||||
minetest.set_node(pt.under, {name = regN[under.name].soil.dry})
|
||||
minetest.sound_play("default_dig_crumbly", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(user:get_player_name())) then
|
||||
-- wear tool
|
||||
local wdef = itemstack:get_definition()
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
-- tool break sound
|
||||
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
||||
minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5})
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
@ -90,7 +99,9 @@ farming.register_hoe = function(name, def)
|
||||
inventory_image = def.inventory_image,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses)
|
||||
end
|
||||
end,
|
||||
groups = def.groups,
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
-- Register its recipe
|
||||
if def.material == nil then
|
||||
@ -119,20 +130,29 @@ farming.register_hoe = function(name, def)
|
||||
end
|
||||
end
|
||||
|
||||
-- how often node timers for plants will tick, +/- some random value
|
||||
local function tick(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(166, 286))
|
||||
end
|
||||
-- how often a growth failure tick is retried (e.g. too dark)
|
||||
local function tick_again(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(40, 80))
|
||||
end
|
||||
|
||||
-- Seed placement
|
||||
farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
if not pt then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
if pt.type ~= "node" then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
local above = minetest.get_node(pt.above)
|
||||
|
||||
|
||||
if minetest.is_protected(pt.under, placer:get_player_name()) then
|
||||
minetest.record_protection_violation(pt.under, placer:get_player_name())
|
||||
return
|
||||
@ -142,38 +162,102 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
-- check if pointing at the top of the node
|
||||
if pt.above.y ~= pt.under.y+1 then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
-- check if you can replace the node above the pointed node
|
||||
if not minetest.registered_nodes[above.name].buildable_to then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
-- check if pointing at soil
|
||||
if minetest.get_item_group(under.name, "soil") < 2 then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
tick(pt.above)
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
farming.grow_plant = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
local name = node.name
|
||||
local def = minetest.registered_nodes[name]
|
||||
|
||||
if not def.next_plant then
|
||||
-- disable timer for fully grown plant
|
||||
return
|
||||
end
|
||||
|
||||
-- grow seed
|
||||
if minetest.get_item_group(node.name, "seed") and def.fertility then
|
||||
local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
if not soil_node then
|
||||
tick_again(pos)
|
||||
return
|
||||
end
|
||||
-- omitted is a check for light, we assume seeds can germinate in the dark.
|
||||
for _, v in pairs(def.fertility) do
|
||||
if minetest.get_item_group(soil_node.name, v) ~= 0 then
|
||||
local placenode = {name = def.next_plant}
|
||||
if def.place_param2 then
|
||||
placenode.param2 = def.place_param2
|
||||
end
|
||||
minetest.swap_node(pos, placenode)
|
||||
if minetest.registered_nodes[def.next_plant].next_plant then
|
||||
tick(pos)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- check if on wet soil
|
||||
local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
if minetest.get_item_group(below.name, "soil") < 3 then
|
||||
tick_again(pos)
|
||||
return
|
||||
end
|
||||
|
||||
-- check light
|
||||
local light = minetest.get_node_light(pos)
|
||||
if not light or light < def.minlight or light > def.maxlight then
|
||||
tick_again(pos)
|
||||
return
|
||||
end
|
||||
|
||||
-- grow
|
||||
local placenode = {name = def.next_plant}
|
||||
if def.place_param2 then
|
||||
placenode.param2 = def.place_param2
|
||||
end
|
||||
minetest.swap_node(pos, placenode)
|
||||
|
||||
-- new timer needed?
|
||||
if minetest.registered_nodes[def.next_plant].next_plant then
|
||||
tick(pos)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Register plants
|
||||
farming.register_plant = function(name, def)
|
||||
local mname = name:split(":")[1]
|
||||
@ -199,8 +283,11 @@ farming.register_plant = function(name, def)
|
||||
def.fertility = {}
|
||||
end
|
||||
|
||||
farming.registered_plants[pname] = def
|
||||
|
||||
-- Register seed
|
||||
local g = {seed = 1, snappy = 3, attached_node = 1}
|
||||
local lbm_nodes = {mname .. ":seed_" .. pname}
|
||||
local g = {seed = 1, snappy = 3, attached_node = 1, flammable = 2}
|
||||
for k, v in pairs(def.fertility) do
|
||||
g[v] = 1
|
||||
end
|
||||
@ -213,6 +300,7 @@ farming.register_plant = function(name, def)
|
||||
groups = g,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
place_param2 = def.place_param2 or nil, -- this isn't actually used for placement
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
@ -220,34 +308,68 @@ farming.register_plant = function(name, def)
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
fertility = def.fertility,
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
dig = {name = "", gain = 0},
|
||||
dug = {name = "default_grass_footstep", gain = 0.2},
|
||||
place = {name = "default_place_node", gain = 0.25},
|
||||
}),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local udef = minetest.registered_nodes[node.name]
|
||||
if udef and udef.on_rightclick and
|
||||
not (placer and placer:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname)
|
||||
end
|
||||
end,
|
||||
next_plant = mname .. ":" .. pname .. "_1",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = def.minlight,
|
||||
maxlight = def.maxlight,
|
||||
})
|
||||
|
||||
-- Register harvest
|
||||
minetest.register_craftitem(":" .. mname .. ":" .. pname, {
|
||||
description = pname:gsub("^%l", string.upper),
|
||||
inventory_image = mname .. "_" .. pname .. ".png",
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
-- Register growing steps
|
||||
for i=1,def.steps do
|
||||
for i = 1, def.steps do
|
||||
local base_rarity = 1
|
||||
if def.steps ~= 1 then
|
||||
base_rarity = 8 - (i - 1) * 7 / (def.steps - 1)
|
||||
end
|
||||
local drop = {
|
||||
items = {
|
||||
{items = {mname .. ":" .. pname}, rarity = 9 - i},
|
||||
{items = {mname .. ":" .. pname}, rarity= 18 - i * 2},
|
||||
{items = {mname .. ":seed_" .. pname}, rarity = 9 - i},
|
||||
{items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2},
|
||||
{items = {mname .. ":" .. pname}, rarity = base_rarity},
|
||||
{items = {mname .. ":" .. pname}, rarity = base_rarity * 2},
|
||||
{items = {mname .. ":seed_" .. pname}, rarity = base_rarity},
|
||||
{items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2},
|
||||
}
|
||||
}
|
||||
local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}
|
||||
nodegroups[pname] = i
|
||||
minetest.register_node(mname .. ":" .. pname .. "_" .. i, {
|
||||
|
||||
local next_plant = nil
|
||||
|
||||
if i < def.steps then
|
||||
next_plant = mname .. ":" .. pname .. "_" .. (i + 1)
|
||||
lbm_nodes[#lbm_nodes + 1] = mname .. ":" .. pname .. "_" .. i
|
||||
end
|
||||
|
||||
minetest.register_node(":" .. mname .. ":" .. pname .. "_" .. i, {
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = def.paramtype2 or nil,
|
||||
place_param2 = def.place_param2 or nil,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = drop,
|
||||
@ -257,61 +379,20 @@ farming.register_plant = function(name, def)
|
||||
},
|
||||
groups = nodegroups,
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = next_plant,
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = def.minlight,
|
||||
maxlight = def.maxlight,
|
||||
})
|
||||
end
|
||||
|
||||
-- Growing ABM
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:" .. pname, "group:seed"},
|
||||
neighbors = {"group:soil"},
|
||||
interval = 9,
|
||||
chance = 20,
|
||||
-- replacement LBM for pre-nodetimer plants
|
||||
minetest.register_lbm({
|
||||
name = ":" .. mname .. ":start_nodetimer_" .. pname,
|
||||
nodenames = lbm_nodes,
|
||||
action = function(pos, node)
|
||||
local plant_height = minetest.get_item_group(node.name, pname)
|
||||
|
||||
-- return if already full grown
|
||||
if plant_height == def.steps then
|
||||
return
|
||||
end
|
||||
|
||||
local node_def = minetest.registered_items[node.name] or nil
|
||||
|
||||
-- grow seed
|
||||
if minetest.get_item_group(node.name, "seed") and node_def.fertility then
|
||||
local can_grow = false
|
||||
local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
if not soil_node then
|
||||
return
|
||||
end
|
||||
for _, v in pairs(node_def.fertility) do
|
||||
if minetest.get_item_group(soil_node.name, v) ~= 0 then
|
||||
can_grow = true
|
||||
end
|
||||
end
|
||||
if can_grow then
|
||||
minetest.set_node(pos, {name = node.name:gsub("seed_", "") .. "_1"})
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- check if on wet soil
|
||||
pos.y = pos.y - 1
|
||||
local n = minetest.get_node(pos)
|
||||
if minetest.get_item_group(n.name, "soil") < 3 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
|
||||
-- check light
|
||||
local ll = minetest.get_node_light(pos)
|
||||
|
||||
if not ll or ll < def.minlight or ll > def.maxlight then
|
||||
return
|
||||
end
|
||||
|
||||
-- grow
|
||||
minetest.set_node(pos, {name = mname .. ":" .. pname .. "_" .. plant_height + 1})
|
||||
end
|
||||
tick_again(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Return
|
||||
|
@ -2,7 +2,8 @@ farming.register_hoe(":farming:hoe_wood", {
|
||||
description = "Wooden Hoe",
|
||||
inventory_image = "farming_tool_woodhoe.png",
|
||||
max_uses = 30,
|
||||
material = "group:wood"
|
||||
material = "group:wood",
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
farming.register_hoe(":farming:hoe_stone", {
|
||||
|
@ -10,21 +10,26 @@ dofile(farming.path .. "/hoes.lua")
|
||||
-- WHEAT
|
||||
farming.register_plant("farming:wheat", {
|
||||
description = "Wheat seed",
|
||||
paramtype2 = "meshoptions",
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = default.LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
fertility = {"grassland"},
|
||||
groups = {flammable = 4},
|
||||
place_param2 = 3,
|
||||
})
|
||||
minetest.register_craftitem("farming:flour", {
|
||||
description = "Flour",
|
||||
inventory_image = "farming_flour.png",
|
||||
groups = {flammable = 1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
on_use = minetest.item_eat(5),
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
@ -47,7 +52,8 @@ farming.register_plant("farming:cotton", {
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = default.LIGHT_MAX,
|
||||
fertility = {"grassland", "desert"}
|
||||
fertility = {"grassland", "desert"},
|
||||
groups = {flammable = 4},
|
||||
})
|
||||
|
||||
minetest.register_alias("farming:string", "farming:cotton")
|
||||
@ -76,3 +82,28 @@ minetest.register_craft({
|
||||
{"farming:straw"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Fuels
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:straw",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:wheat",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:cotton",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:hoe_wood",
|
||||
burntime = 5,
|
||||
})
|
||||
|
61
mods/farming/license.txt
Normal file
61
mods/farming/license.txt
Normal file
@ -0,0 +1,61 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2014-2016 webdesigner97
|
||||
Copyright (C) 2012-2016 Various Minetest developers and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
License of media (textures)
|
||||
---------------------------
|
||||
|
||||
Attribution 3.0 Unported (CC BY 3.0)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2014-2016 BlockMen
|
||||
Copyright (C) 2015-2016 MasterGollum
|
||||
Copyright (C) 2015-2016 Gambit
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by/3.0/
|
@ -1,5 +1,4 @@
|
||||
minetest.override_item("default:dirt", {
|
||||
groups = {crumbly=3,soil=1},
|
||||
soil = {
|
||||
base = "default:dirt",
|
||||
dry = "farming:soil",
|
||||
@ -8,7 +7,6 @@ minetest.override_item("default:dirt", {
|
||||
})
|
||||
|
||||
minetest.override_item("default:dirt_with_grass", {
|
||||
groups = {crumbly=3,soil=1},
|
||||
soil = {
|
||||
base = "default:dirt_with_grass",
|
||||
dry = "farming:soil",
|
||||
@ -16,6 +14,22 @@ minetest.override_item("default:dirt_with_grass", {
|
||||
}
|
||||
})
|
||||
|
||||
minetest.override_item("default:dirt_with_dry_grass", {
|
||||
soil = {
|
||||
base = "default:dirt_with_dry_grass",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.override_item("default:dirt_with_rainforest_litter", {
|
||||
soil = {
|
||||
base = "default:dirt_with_rainforest_litter",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("farming:soil", {
|
||||
description = "Soil",
|
||||
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
|
||||
@ -80,11 +94,12 @@ minetest.register_node("farming:straw", {
|
||||
description = "Straw",
|
||||
tiles = {"farming_straw.png"},
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, flammable=4},
|
||||
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Farming soil",
|
||||
nodenames = {"group:field"},
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
@ -104,7 +119,7 @@ minetest.register_abm({
|
||||
end
|
||||
local nn_def = minetest.registered_nodes[nn.name] or nil
|
||||
pos.y = pos.y - 1
|
||||
|
||||
|
||||
if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then
|
||||
minetest.set_node(pos, {name = base})
|
||||
return
|
||||
@ -126,7 +141,7 @@ minetest.register_abm({
|
||||
if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then
|
||||
minetest.set_node(pos, {name = base})
|
||||
end
|
||||
|
||||
|
||||
-- if its wet turn it back into dry soil
|
||||
elseif wet_lvl == 1 then
|
||||
minetest.set_node(pos, {name = dry})
|
||||
@ -137,7 +152,7 @@ minetest.register_abm({
|
||||
})
|
||||
|
||||
|
||||
for i = 1, 5 do
|
||||
for i = 1, 5 do
|
||||
minetest.override_item("default:grass_"..i, {drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
@ -146,7 +161,7 @@ for i = 1, 5 do
|
||||
}
|
||||
}})
|
||||
end
|
||||
|
||||
|
||||
minetest.override_item("default:junglegrass", {drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user