depend to basic_function
parent
4a4b4e6c53
commit
e3302d3f5e
|
@ -249,7 +249,7 @@ farming.timer_step = function(pos, elapsed)
|
||||||
local lightamount=meta:get_int("farming:lightamount")
|
local lightamount=meta:get_int("farming:lightamount")
|
||||||
|
|
||||||
if lightamount ~= nil then
|
if lightamount ~= nil then
|
||||||
local ls = farming.light_stat[def.light_min]
|
local ls = farming.light_stat[tostring(def.light_min)]
|
||||||
if ls.amount ~= nil and lightamount > 0 then
|
if ls.amount ~= nil and lightamount > 0 then
|
||||||
-- time till next step is stretched. Less light means longer growing time
|
-- time till next step is stretched. Less light means longer growing time
|
||||||
wait_factor = ls.amount / lightamount
|
wait_factor = ls.amount / lightamount
|
||||||
|
@ -439,7 +439,7 @@ farming.timer_wilt = function(pos, elapsed)
|
||||||
-- get soil nodes with air above
|
-- get soil nodes with air above
|
||||||
for j=1,#neighb do
|
for j=1,#neighb do
|
||||||
local jpos=neighb[j]
|
local jpos=neighb[j]
|
||||||
if farming.has_value({"air","default:grass_1","default:grass_2","default:grass_3","default:grass_4","default:grass_5"},minetest.get_node({x=jpos.x,y=jpos.y+1,z=jpos.z}).name) then
|
if basic_functions.has_value({"air","default:grass_1","default:grass_2","default:grass_3","default:grass_4","default:grass_5"},minetest.get_node({x=jpos.x,y=jpos.y+1,z=jpos.z}).name) then
|
||||||
table.insert(freen,1,jpos)
|
table.insert(freen,1,jpos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,6 +52,11 @@ farming.spreading_crops = {}
|
||||||
-- register for crops
|
-- register for crops
|
||||||
farming.registered_plants = {}
|
farming.registered_plants = {}
|
||||||
|
|
||||||
|
-- temp list for grass drop
|
||||||
|
farming.grass_drop={max_items=1,items = {items={"default:grass_1"}}}
|
||||||
|
farming.junglegrass_drop={max_items=1,items = {items={"default:junglegrass"}}}
|
||||||
|
|
||||||
-- reading light statistics. needed for calculation of grow time
|
-- reading light statistics. needed for calculation of grow time
|
||||||
farming.light_stat = farming.import_csv(farming.path.."/light_stat.txt",{
|
farming.light_stat = basic_functions.import_csv(farming.path.."/light_stat.txt",{
|
||||||
col_num={"day_start","amount","name"}})
|
col_num={"day_start","amount","name"}})
|
||||||
|
print(dump2(farming.light_stat))
|
||||||
|
|
|
@ -65,7 +65,7 @@ local drink_or_eat = function(hp_change,replace_with_item,itemstack,user,pointed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if farming.has_value(modlist,"vessels") and farming.has_value(modlist,"bucket") then
|
if basic_functions.has_value(modlist,"vessels") and basic_functions.has_value(modlist,"bucket") then
|
||||||
minetest.register_craftitem(modname..":nettle_water",{
|
minetest.register_craftitem(modname..":nettle_water",{
|
||||||
description = "Nettle Water",
|
description = "Nettle Water",
|
||||||
inventory_image = "farming_tool_glass_nettle.png",
|
inventory_image = "farming_tool_glass_nettle.png",
|
||||||
|
@ -138,7 +138,7 @@ else
|
||||||
print("Mod vessels/bucket not available. Seriously? -> no COFFEE!")
|
print("Mod vessels/bucket not available. Seriously? -> no COFFEE!")
|
||||||
end
|
end
|
||||||
|
|
||||||
if farming.has_value(modlist,"wool") then
|
if basic_functions.has_value(modlist,"wool") then
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output="wool:white",
|
output="wool:white",
|
||||||
type="shapeless",
|
type="shapeless",
|
||||||
|
|
12
crops.lua
12
crops.lua
|
@ -10,6 +10,8 @@ Actual columns:
|
||||||
next_plant text For wild crop the name of the cultured crop. By change you get the seed or harvest of the cultured one
|
next_plant text For wild crop the name of the cultured crop. By change you get the seed or harvest of the cultured one
|
||||||
Should be a name of another crop in this list
|
Should be a name of another crop in this list
|
||||||
Rarety How often the crop spawn in the wild
|
Rarety How often the crop spawn in the wild
|
||||||
|
Rarety_grass_drop Change to get crop as drop item when digging grass
|
||||||
|
Rarety_junglegrass_drop Change to get crop as drop item when digging jungle grass
|
||||||
Steps Amount of steps the growing needs till full grown plant. Must be set
|
Steps Amount of steps the growing needs till full grown plant. Must be set
|
||||||
harvest_max Max. amount of harvest or seed you can dig out of full grown plant
|
harvest_max Max. amount of harvest or seed you can dig out of full grown plant
|
||||||
eat_hp eat health point: How many HP you get by eating the seed.
|
eat_hp eat health point: How many HP you get by eating the seed.
|
||||||
|
@ -84,16 +86,16 @@ Actual columns:
|
||||||
local S = farming.intllib
|
local S = farming.intllib
|
||||||
farming.path = minetest.get_modpath("farming")
|
farming.path = minetest.get_modpath("farming")
|
||||||
|
|
||||||
local has_value = farming.has_value
|
local has_value = basic_functions.has_value
|
||||||
local crop_cols={
|
local crop_cols={
|
||||||
col_num={"rarety","steps","harvest_max","eat_hp",
|
col_num={"rarety","steps","harvest_max","eat_hp",
|
||||||
"temperature_min","temperature_max","humidity_min","humidity_max",
|
"temperature_min","temperature_max","humidity_min","humidity_max",
|
||||||
"elevation_min","elevation_max","light_min","light_max",
|
"elevation_min","elevation_max","light_min","light_max",
|
||||||
"infect_rate_base","infect_rate_monoculture","spread_rate","grow_time_mean","roast_time","wilt_time"},
|
"infect_rate_base","infect_rate_monoculture","spread_rate","grow_time_mean","roast_time","wilt_time","rarety_grass_drop"},
|
||||||
groups_num={"to_culture","to_dig","has_harvest","on_soil","punchable","infectable","is_bush",
|
groups_num={"to_culture","to_dig","has_harvest","on_soil","punchable","infectable","is_bush",
|
||||||
"seed_extractable","use_flail","use_trellis","snappy","infection_defence","seed_roastable",
|
"seed_extractable","use_flail","use_trellis","snappy","infection_defence","seed_roastable",
|
||||||
"seed_grindable","for_flour","for_coffee","damage_per_second","liquid_viscosity","wiltable"}}
|
"seed_grindable","for_flour","for_coffee","damage_per_second","liquid_viscosity","wiltable"}}
|
||||||
local crop_definition = farming.import_csv(farming.path.."/crops.txt",crop_cols)
|
local crop_definition = basic_functions.import_csv(farming.path.."/crops.txt",crop_cols)
|
||||||
-- for the default entry is checked, which numeric values are filled
|
-- for the default entry is checked, which numeric values are filled
|
||||||
-- this values are copied into void fields of the crops
|
-- this values are copied into void fields of the crops
|
||||||
if crop_definition["default"] ~= nil then
|
if crop_definition["default"] ~= nil then
|
||||||
|
@ -132,3 +134,7 @@ for i,tdef in pairs(crop_definition) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.override_item("default:grass_5",{drop=farming.grass_drop})
|
||||||
|
minetest.override_item("default:grass_4",{drop=farming.grass_drop})
|
||||||
|
minetest.override_item("default:junglegrass",{drop=farming.junglegrass_drop})
|
||||||
|
|
62
crops.txt
62
crops.txt
|
@ -1,31 +1,31 @@
|
||||||
name,enabled,next_plant,rarety,steps,harvest_max,eat_hp,to_culture,to_dig,has_harvest,on_soil,is_bush,punchable,wiltable,infectable,infection_defence,seed_extractable,no_seed,use_flail,use_trellis,for_coffee,seed_roastable,seed_grindable,for_flour,snappy,damage_per_second,liquid_viscosity,temperature_min,temperature_max,humidity_min,humidity_max,elevation_min,elevation_max,light_min,light_max,infect_rate_base,infect_rate_monoculture,spread_rate,grow_time_mean,wilt_time,straw,culture_rate,seed_drop,grind,roast
|
name,enabled,next_plant,rarety,rarety_grass_drop,rarety_junglegrass_drop,steps,harvest_max,eat_hp,to_culture,to_dig,has_harvest,on_soil,is_bush,punchable,wiltable,infectable,infection_defence,seed_extractable,no_seed,use_flail,use_trellis,for_coffee,seed_roastable,seed_grindable,for_flour,snappy,damage_per_second,liquid_viscosity,temperature_min,temperature_max,humidity_min,humidity_max,elevation_min,elevation_max,light_min,light_max,infect_rate_base,infect_rate_monoculture,spread_rate,grow_time_mean,wilt_time,straw,culture_rate,seed_drop,grind,roast
|
||||||
default,1,,10,8,3,1,,,,,,,,,,,,,,,,,,3,,,15,80,10,80,0,200,11,14,10,5,0.0001,60,120,,,,,
|
default,1,,10,,,8,3,1,,,,,,,,,,,,,,,,,,3,,,15,80,10,80,-20,200,11,14,10,5,1,60,1200,,,,,
|
||||||
barley,1,,10,7,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,25,,30,,,,,,,,,,,farming:straw,,,farming:flour,farming:grain_roasted
|
barley,1,,10,15,,7,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,25,,30,,,,,,,,,,,farming:straw,,,farming:flour,farming:grain_roasted
|
||||||
beetroot,1,,10,5,,2,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,,,,,,,,
|
beetroot,1,,10,,,5,,2,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,,,,,,,,
|
||||||
blackberry,1,,10,4,,,,,,,1,1,1,,,,,,,,,,,3,1,4,,90,20,,,,9,,,,,,,,,,,
|
blackberry,1,,10,,,4,,,,,,,1,1,1,,,,,,,,,,,3,1,4,,90,20,,,,9,,,,,,,,,,,
|
||||||
blueberry,1,,10,4,,,,,,,1,1,1,,,,,,,,,,,3,,,45,90,40,90,,,9,,,,,,,,,,,
|
blueberry,1,,10,,,4,,,,,,,1,1,1,,,,,,,,,,,3,,,45,90,40,90,,,9,,,,,,,,,,,
|
||||||
carrot,1,,10,8,,2,,1,,1,,,,,,,,,,,2,,,3,,,,,30,90,,,8,,,,,,,,,,,farming:carrot_gold
|
carrot,1,,10,20,,8,,2,,1,,1,,,,,,,,,,,2,,,3,,,,,30,90,,,8,,,,,,,,,,,farming:carrot_gold
|
||||||
chili,1,,20,8,,,,,,,,1,,,,,,,,,,,,3,,,55,90,,,20,1000,,,,,,,,,,,,
|
chili,1,,20,,,8,,,,,,,,1,,,,,,,,,,,,3,,,55,90,,,20,1000,,,,,,,,,,,,
|
||||||
coffee,1,,20,5,,,,,,,,1,,,,,,,,1,4,,,3,,,55,120,50,150,20,1000,12,,,,,,,,,,,
|
coffee,1,,20,,,5,,,,,,,,1,,,,,,,,1,4,,,3,,,55,120,50,150,20,1000,12,,,,,,,,,,,
|
||||||
corn,1,,10,8,4,2,,,,1,,,2,1,,,,,,,4,1,,3,,2,35,90,30,,,,,,,,,,,,,,,farming:corn_cob
|
corn,1,,10,,35,8,4,2,,,,1,,,2,1,,,,,,,4,1,,3,,2,35,90,30,,,,,,,,,,,,,,,farming:corn_cob
|
||||||
cotton,1,,10,8,,,,,1,1,,,,1,,,,1,,,,,,3,,2,45,90,20,,,,12,,,,,,,,,,,
|
cotton,1,,10,10,10,8,,,,,1,1,,,,1,,,,1,,,,,,3,,2,45,90,20,,,,12,,,,,,,,,,,
|
||||||
culturewheat,1,,100,4,4,,1,,1,1,,,2,2,,,,1,,1,3,,1,3,,2,25,,40,,,,10,,,,,,100,farming:straw,,,farming:flour,farming:grain_roasted
|
culturewheat,1,,100,,,4,4,,1,,1,1,,,2,2,,,,1,,1,3,,1,3,,2,25,,40,,,,10,,,,,,100,farming:straw,,,farming:flour,farming:grain_roasted
|
||||||
flax,,,10,7,,,,,1,1,,,,1,,,,1,,,,,,3,,2,25,,30,,,,,,,,,,,farming:flaw,,,,
|
flax,,,10,,,7,,,,,1,1,,,,1,,,,1,,,,,,3,,2,25,,30,,,,,,,,,,,farming:flaw,,,,
|
||||||
garlic,,,10,5,,,,1,,1,,,,,,,,,,,3,,,3,,,,,,,,,,,,,,,,,,,,
|
garlic,,,10,,,5,,,,1,,1,,,,,,,,,,,3,,,3,,,,,,,,,,,,,,,,,,,,
|
||||||
grapes,,,10,8,,2,1,,,1,,1,,1,,,,,1,,,,,3,,3,,,,,,,,,,,,,,,,farming:wildgrapes_seed,,
|
grapes,,,10,,,8,,2,1,,,1,,1,,1,,,,,1,,,,,3,,3,,,,,,,,,,,,,,,,farming:wildgrapes_seed,,
|
||||||
hemp,1,,10,8,,,,,1,,,,,,,,,1,,,,,,3,,2,,120,,,,,8,,,,1E-05,55,,farming:hemp_fibre,,,,
|
hemp,1,,10,,,8,,,,,1,,,,,,,,,1,,,,,,3,,2,,120,,,,,8,,,,1E-05,55,,farming:hemp_fibre,,,,
|
||||||
hop,1,,10,7,,,1,,,1,,1,2,2,,,,,1,,4,,,3,,2,55,,,,,50,,,,,,,,,,farming:wildhop_seed,,
|
hop,1,,10,,,7,,,1,,,1,,1,2,2,,,,,1,,4,,,3,,2,55,,,,,50,,,,,,,,,,farming:wildhop_seed,,
|
||||||
mustard,1,,10,5,,,,,,,,,,1,,,,,,,,2,,3,,,,,,,,,,,,,,,,,,,,
|
mustard,1,,10,,,5,,,,,,,,,,1,,,,,,,,2,,3,,,,,,,,,,,,,,,,,,,,
|
||||||
potato,1,,10,4,4,2,,,,1,,,2,1,,,,,,,4,1,,3,,2,,,,60,,,,,,,,,,,,,,farming:potato_baked
|
potato,1,,10,50,,4,4,2,,,,1,,,2,1,,,,,,,4,1,,3,,2,,,,60,,,,,,,,,,,,,,farming:potato_baked
|
||||||
raspberry,1,,10,4,,,,,,,1,1,1,,,,,,,,,,,3,1,4,,,,,,,9,,,,,,,,,,,
|
raspberry,1,,10,,,4,,,,,,,1,1,1,,,,,,,,,,,3,1,4,,,,,,,9,,,,,,,,,,,
|
||||||
rhubarb,1,,10,3,,2,,1,,1,,,,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,,,
|
rhubarb,1,,10,,,3,,2,,1,,1,,,,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,,,
|
||||||
spelt,1,,10,7,,,,,1,1,,,2,1,,,,1,,,3,,1,3,,2,,,,,,,,,,,,,,farming:straw,,,farming:flour,farming:grain_roasted
|
spelt,1,,10,15,,7,,,,,1,1,,,2,1,,,,1,,,3,,1,3,,2,,,,,,,,,,,,,,farming:straw,,,farming:flour,farming:grain_roasted
|
||||||
strawberry,1,,10,4,,,,,,,1,1,1,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,,,
|
strawberry,1,,10,,,4,,,,,,,1,1,1,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,,,
|
||||||
sugarbeet,1,,10,5,,2,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,,,,,,,,
|
sugarbeet,1,,10,,,5,,2,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,,,,,,,,
|
||||||
tea,1,,20,8,,,,,,1,,1,,,,1,,,,,4,,,3,,2,30,70,30,70,20,1000,,,,,,,,,,farming:tea_leaves,,farming:tea_black
|
tea,1,,20,,,8,,,,,,1,,1,,,,1,,,,,4,,,3,,2,30,70,30,70,20,1000,,,,,,,,,,farming:tea_leaves,,farming:tea_black
|
||||||
tobaco,1,,10,8,,,,,,1,,1,,,2,1,,,,,4,,,3,,,,,,,,1000,,,,,,,,,,farming:tobaco_leaves,,
|
tobaco,1,,10,,50,8,,,,,,1,,1,,,2,1,,,,,4,,,3,,,,,,,,1000,,,,,,,,,,farming:tobaco_leaves,,
|
||||||
tomato,,,10,8,,,,,1,1,,1,1,1,,,,,1,,,,,3,,,,,,,,,,,,,,,,,,,,
|
tomato,,,10,,,8,,,,,1,1,,1,1,1,,,,,1,,,,,3,,,,,,,,,,,,,,,,,,,,
|
||||||
nettle,1,,10,5,,,,,1,,,1,3,,1,,,1,,,2,,,3,1,3,5,150,0,100,,2000,8,,,,0.1,50,,farming:nettle_fibre,,,,
|
nettle,1,,10,,,5,,,,,1,,,1,3,,1,,,1,,,2,,,3,1,3,5,150,0,100,,2000,8,,,,0.1,50,,farming:nettle_fibre,,,,
|
||||||
wheat,1,farming:culturewheat,10,8,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,,,30,70,,,,,,,,70,100,farming:straw,10,,farming:flour,farming:grain_roasted
|
wheat,1,farming:culturewheat,10,10,,8,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,,,30,70,,,,,,,,70,100,farming:straw,10,,farming:flour,farming:grain_roasted
|
||||||
wildoat,1,,10,7,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,,,30,70,,,,,,,,70,100,farming:straw,,,farming:flour,farming:grain_roasted
|
wildoat,1,,10,,,7,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,,,30,70,,,,,,,,70,100,farming:straw,,,farming:flour,farming:grain_roasted
|
||||||
wildgrapes,,,10,4,,,,,,,,,,,,,1,,,,,,,3,,,,,,,,,,,,,,,,,5,,,
|
wildgrapes,,,10,,,4,,,,,,,,,,,,,1,,,,,,,3,,,,,,,,,,,,,,,,,5,,,
|
||||||
|
|
1
init.lua
1
init.lua
|
@ -13,7 +13,6 @@ minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- start loadi
|
||||||
-- Load files
|
-- Load files
|
||||||
|
|
||||||
|
|
||||||
dofile(farming.path .. "/functions.lua") --few helping functions
|
|
||||||
dofile(farming.path .. "/config.lua") -- configuration of mod
|
dofile(farming.path .. "/config.lua") -- configuration of mod
|
||||||
|
|
||||||
dofile(farming.path .. "/actions_register.lua") -- several actions defined
|
dofile(farming.path .. "/actions_register.lua") -- several actions defined
|
||||||
|
|
1
mod.conf
1
mod.conf
|
@ -3,5 +3,6 @@ title = Farming
|
||||||
author = ademant
|
author = ademant
|
||||||
description = An enhanced farming mod with spreding crops which wilt if not harvested.
|
description = An enhanced farming mod with spreding crops which wilt if not harvested.
|
||||||
optional_depends = intllib,default,wool,vessels,bucket,thirsty
|
optional_depends = intllib,default,wool,vessels,bucket,thirsty
|
||||||
|
depends = basic_functions
|
||||||
license = MIT
|
license = MIT
|
||||||
version = 1.0.0
|
version = 1.0.0
|
||||||
|
|
|
@ -149,6 +149,17 @@ farming.register_plant = function(def)
|
||||||
farming.register_coffee(def)
|
farming.register_coffee(def)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if def.rarety_grass_drop ~= nil then
|
||||||
|
if def.harvest_name ~= nil then
|
||||||
|
table.insert(farming.grass_drop.items,1,{items={def.harvest_name},rarety=def.rarety_grass_drop})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if def.rarety_junglegrass_drop ~= nil then
|
||||||
|
if def.harvest_name ~= nil then
|
||||||
|
table.insert(farming.junglegrass_drop.items,1,{items={def.harvest_name},rarety=def.rarety_junglegrass_drop})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
farming.registered_plants[def.name] = def
|
farming.registered_plants[def.name] = def
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
local S = farming.intllib
|
local S = farming.intllib
|
||||||
farming.path = minetest.get_modpath("farming")
|
farming.path = minetest.get_modpath("farming")
|
||||||
|
|
||||||
local has_value = farming.has_value
|
local has_value = basic_functions.has_value
|
||||||
local crop_cols={
|
local crop_cols={
|
||||||
col_num={"max_uses","farming_change","max_level","damage","times"},
|
col_num={"max_uses","farming_change","max_level","damage","times"},
|
||||||
groups_num={"snappy"}}
|
groups_num={"snappy"}}
|
||||||
local tool_definition = farming.import_csv(farming.path.."/tools.txt",crop_cols)
|
local tool_definition = basic_functions.import_csv(farming.path.."/tools.txt",crop_cols)
|
||||||
|
|
||||||
for i,line in pairs(tool_definition) do
|
for i,line in pairs(tool_definition) do
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue