decoration of plants

master
ademant 2019-02-20 11:51:29 +01:00
parent d88510a8f8
commit 4561d59854
4 changed files with 49 additions and 37 deletions

View File

@ -1,5 +1,6 @@
minetest.register_abm({
-- change wetness of soil by time
label = "Farming soil",
nodenames = {"group:field"},
interval = 15,
@ -59,6 +60,7 @@ minetest.register_abm({
minetest.register_abm({
-- infect plants
label="crops getting ill",
nodenames="group:infectable",
intervall = 120,
@ -97,7 +99,7 @@ minetest.register_abm({
interval = farming.abm_planting+math.random(-1,1), -- little noise
chance = farming.abm_planting_chance,
action = function(pos)
local starttime=os.clock()
-- local starttime=os.clock()
local ptabove={x=pos.x,y=pos.y+1,z=pos.z}
local above = minetest.get_node(ptabove)
if above.name ~= "air" then
@ -140,7 +142,8 @@ minetest.register_abm({
end
end
if #sc > 0 then
minetest.add_node(ptabove, {name=sc[math.random(1,#sc)],param2=1})
local setplant=sc[math.random(1,#sc)]
minetest.add_node(ptabove, {name=setplant,param2=1})
minetest.get_node_timer(ptabove):start(math.random(10, 15))
farming.set_node_metadata(ptabove)
end

View File

@ -1,32 +1,32 @@
name,enabled,hijack,next_plant,rarety,rarety_grass_drop,rarety_junglegrass_drop,rarety_decoration,steps,harvest_max,eat_hp,drink,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,spawn_by
default,1,,,5,,,,8,3,1,,,,,,,,,,,,,,,,,,,3,,,15,80,10,80,-20,200,11,14,1000,90,1,120,6400,,,,,,
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,,,5,,,,5,,2,,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,,,,,,,,,
blackberry,1,,,10,,,0.001,4,,,4,,,,,1,1,1,,,,,,,,,,,3,1,4,,90,20,,,,9,,,,,,,,,,,,
blueberry,1,,,5,,,0.001,4,,,4,,,,,1,1,1,,,,,,,,,,,3,,,45,90,40,90,,,9,,,,,,,,,,,,
carrot,1,,,5,20,,,8,,2,2,,1,,1,,,,,,,,,,,2,,,3,,,,,30,90,,,8,,,,,,,,,,,farming:carrot_gold,
chili,1,,,5,,,,8,,,,,,,,,1,,,,,,,,,,,,3,,,55,90,,,20,1000,,,,,,,,,,,,,
coffee,1,,,5,,,,5,,,,,,,,,1,,,,,,,,1,4,,,3,,,55,120,50,150,20,1000,12,,,,,,,,,,,,
corn,1,,,10,,35,,8,4,2,,,,,1,,,2,1,,,,,,,4,1,,3,,2,35,90,30,,,,,,,,,,,,,,,farming:corn_cob,
cotton,1,,,10,10,10,0.001,8,,0,,,,1,1,,,,1,,,,1,,,,,,3,,2,45,90,20,,,,12,,,,,,,,,,,,
barley,1,,,10,15,,,7,,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,25,,30,,,,,,,,.01,,,farming:straw,,,farming:flour,farming:grain_roasted,
beetroot,1,,,5,,,,5,,2,,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,.1,,,,,,,,
blackberry,1,,,10,,,0.001,4,,,4,,,,,1,1,1,,,,,,,,,,,3,1,4,,90,20,,,,9,,,,.1,,,,,,,,
blueberry,1,,,5,,,0.001,4,,,4,,,,,1,1,1,,,,,,,,,,,3,,,45,90,40,90,,,9,,,,.1,,,,,,,,
carrot,1,,,5,20,,,8,,2,2,,1,,1,,,,,,,,,,,2,,,3,,,,,30,90,,,8,,,,.1,,,,,,,farming:carrot_gold,
chili,1,,,5,,,,8,,,,,,,,,1,,,,,,,,,,,,3,,,55,90,,,20,1000,,,,,.1,,,,,,,,
coffee,1,,,5,,,,5,,,,,,,,,1,,,,,,,,1,4,,,3,,,55,120,50,150,20,1000,12,,,,.1,,,,,,,,
corn,1,,,10,,35,,8,4,2,,,,,1,,,2,1,,,,,,,4,1,,3,,2,35,90,30,,,,,,,,.001,,,,,,,farming:corn_cob,
cotton,1,,,10,10,10,0.001,8,,0,,,,1,1,,,,1,,,,1,,,,,,3,,2,45,90,20,,,,12,,,,.01,,,,,,,,
culturewheat,1,,,1,,,,4,4,,,1,,1,1,,,2,2,,,,1,,1,3,,1,3,,2,25,,40,,,,10,,700,75,,,2400,farming:straw,,,farming:flour,farming:grain_roasted,
flax,,,,10,,,,7,,0,,,,1,1,,,,1,,,,1,,,,,,3,,2,25,,30,,,,,,,,,,,farming:flaw,,,,,
garlic,1,,,10,,,,5,4,,,,1,,1,,,,,1,,,,,,3,,,3,,,,,,,,,,,,,,,,,,,,,
garlic,1,,,10,,,,5,4,,,,1,,1,,,,,1,,,,,,3,,,3,,,,,,,,,,,,,.1,,,,,,,,
grapes,,,,1,,,,8,,2,5,1,,,1,,1,,1,,,,,1,,,,,3,,3,,,,,,,,,,,,,,,,farming:wildgrapes_seed,,,
hemp,1,,,25,,,,8,,0,,,,1,,,,,,,,,1,,,,,,3,,2,,120,,,,,8,,,,1E-05,55,360,farming:hemp_fibre,,,,,
hop,1,,,10,,,,7,,,,1,,,1,,1,2,2,,,,,1,,4,,,3,,2,55,,,,,50,,,,,,,,,,farming:wildhop_seed,,,
mustard,1,,,5,,,,5,,,,,,,,,,,1,,,,,,,,2,,3,,,,,,,,,,,,,,,,,,,,,
hemp,1,,,25,,,,8,,0,,,,1,,,,,,,,,1,,,,,,3,,2,,120,,,,,8,,,,1,55,360,farming:hemp_fibre,,,,,
hop,1,,,10,,,,7,,,,1,,,1,,1,2,2,,,,,1,,4,,,3,,2,55,,,,,50,,,,,.1,,,,,farming:wildhop_seed,,,
mustard,1,,,5,,,,5,,,,,,,,,,,1,,,,,,,,2,,3,,,,,,,,,,,,,.1,,,,,,,,
onion,,,,10,,,,5,,,,,1,,1,,,,,1,,,,,,,,,3,,,,,,,,,,,,,,,,,,,,,
potato,1,,,10,50,,,4,4,2,2,,,,1,,,2,1,,,,,,,4,1,,3,,2,,,,60,,,,,550,75,,,,,,,,farming:potato_baked,
raspberry,1,,,10,,,0.001,4,,,4,,,,,1,1,1,,,,,,,,,,,3,1,4,,,,,,,9,,,,,,,,,,,,group:tree
rhubarb,1,,,5,,,,3,,2,3,,1,,1,,,,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,,,,
spelt,1,,,10,15,,,7,,,,,,1,1,,,2,1,,,,1,,,3,,1,3,,2,,,,,,,,,,,,,,farming:straw,,,farming:flour,farming:grain_roasted,
strawberry,1,ethereal:strawberry,,10,,,,8,,4,4,,,,,1,1,1,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,,,,
sugarbeet,1,,,5,,,,5,,2,,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,,,,,,,,,
tea,1,,,5,,,,8,,,,,,,1,,1,,,,1,,,,,4,,,3,,2,30,70,30,70,20,1000,,,,,,,,,,farming:tea_leaves,,farming:tea_black,
tobaco,1,,,5,,50,,8,,,,,,,1,,1,,,2,1,,,,,4,,,3,,,,,,,,1000,,,,,,,,,,farming:tobaco_leaves,,,
tomato,1,,,5,,,,8,,2,8,,,1,1,,1,1,1,,,,,1,,,,,3,,,,,,,,,,,,,,,,,,,,,
nettle,1,,,25,,,0.001,5,,,,,,1,,,1,3,,1,,,1,,,2,,,3,1,3,5,150,0,100,,2000,8,,,,0.1,50,240,farming:nettle_fibre,,,,,
wheat,1,,farming:culturewheat,10,10,,,8,,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,,,30,70,,,,,,,,70,3600,farming:straw,10,,farming:flour,farming:grain_roasted,
potato,1,,,10,50,,,4,4,2,2,,,,1,,,2,1,,,,,,,4,1,,3,,2,,,,60,,,,,550,75,.01,,,,,,,farming:potato_baked,
raspberry,1,,,10,,,0.001,4,,,4,,,,,1,1,1,,,,,,,,,,,3,1,4,,,,,,,9,,,,.1,,,,,,,,group:tree
rhubarb,1,,,5,,,,3,,2,3,,1,,1,,,,,,,,,,,,,,3,,,,,,,,,9,,,,.1,,,,,,,,
spelt,1,,,10,15,,,7,,,,,,1,1,,,2,1,,,,1,,,3,,1,3,,2,,,,,,,,,,,.01,,,farming:straw,,,farming:flour,farming:grain_roasted,
strawberry,1,ethereal:strawberry,,10,,,,8,,4,4,,,,,1,1,1,,,,,,,,,,,3,,,,,,,,,9,,,,.1,,,,,,,,
sugarbeet,1,,,5,,,,5,,2,,,1,,1,,,,,,,,,,,,,,3,,,35,,30,,,,9,,,,.1,,,,,,,,
tea,1,,,5,,,,8,,,,,,,1,,1,,,,1,,,,,4,,,3,,2,30,70,30,70,20,1000,,,,,.1,,,,,farming:tea_leaves,,farming:tea_black,
tobaco,1,,,5,,50,,8,,,,,,,1,,1,,,2,1,,,,,4,,,3,,,,,,,,1000,,,,,.1,,,,,farming:tobaco_leaves,,,
tomato,1,,,5,,,,8,,2,8,,,1,1,,1,1,1,,,,,1,,,,,3,,,,,,,,,,,,,.1,,,,,,,,
nettle,1,,,25,,,0.001,5,,,,,,1,,,1,3,,1,,,1,,,2,,,3,1,3,5,150,0,100,,2000,8,,,,1,50,240,farming:nettle_fibre,,,,,
wheat,1,,farming:culturewheat,10,10,,,8,,,,,,1,1,,,2,1,,,,1,,1,3,,1,3,,2,,,30,70,,,,,,,.01,70,3600,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,3600,farming:straw,,,farming:flour,farming:grain_roasted,
wildgrapes,,,,10,,,,4,,,4,,,,,,,,,,,1,,,,,,,3,,,,,,,,,,,,,,,,,5,,,,

View File

@ -112,7 +112,7 @@ farming.register_plant = function(def)
local spread_def={name=def.step_name.."_1",
temp_min=edef.temperature_min,temp_max=edef.temperature_max,
hum_min=edef.humidity_min,hum_max=edef.humidity_max,
y_min=edef.elevation_min,y_max=edef.elevation_max,base_rate = math.floor(math.log(def.spread_rate)),
y_min=edef.elevation_min,y_max=edef.elevation_max,base_rate = math.floor((-1)*math.log(def.spread_rate)),
light_min=edef.light_min,light_max=edef.light_max}
farming.min_light = math.min(farming.min_light,edef.light_min)
-- add crop to spreading list, if base rate > 0
@ -174,7 +174,8 @@ farming.register_plant = function(def)
end
end
if def.rarety_decoration ~= nil then
farming.register_deco(def)
-- does not work yet
-- farming.register_deco(def)
end
farming.registered_plants[def.name] = def
end
@ -697,29 +698,37 @@ farming.register_deco = function(ddef)
if ddef.step_name == nil then
return
end
local deco_name = ddef.step_name.."_"..ddef.steps
if minetest.registered_items[deco_name] == nil then
return
end
local spread=math.random(95,105)
local deco_def={
deco_type = "simple",
place_on = farming.change_soil,
place_on = table.copy(farming.change_soil),
sidelen = 16,
noise_params = {
offset = 0,
scale = ddef.rarety_decoration,
spread = {x = math.random(95,105), y = math.random(95,105), z = 100},
spread = {x = spread, y = spread, z = spread},
seed = math.random(1,314159),
octaves = 3,
persist = 0.6
},
y_min = ddef.elevation_min,
y_max = ddef.elevation_max,
decoration = ddef.step_name.."_"..ddef.steps,
decoration = {deco_name},
name=deco_name,
}
if ddef.spawn_by then
deco_def.spawn_by=ddef.spawn_by
deco_def.num_spawn_by=1
if minetest.registered_items[ddef.spawn_by]~= nil then
deco_def.spawn_by=ddef.spawn_by
deco_def.num_spawn_by=1
end
end
print(dump2(deco_def))
print(dump2(minetest.registered_items[ddef.step_name.."_"..ddef.steps]))
-- print(dump2(deco_def))
-- print(dump2(farming.change_soil))
minetest.register_decoration(deco_def)
-- print(dump2(minetest.registered_decorations[deco_name]))
end

View File

@ -7,6 +7,6 @@ farming.wilt_time (Mean time for fullgrown crop to wilt) int 6400 5 5000
farming.min_light (Min light needed for crops to grow) int 10 1 14
farming.health_threshold (healthiness threshold) int 50 1 100
farming.factor_regrow (factor for regrow after punching) float 2
farming.abm_planting (time intervall for abm planting) int 60 5 500
farming.abm_planting (time intervall for abm planting) int 10 5 500
farming.abm_planting_change (change for abm planting for execution) int 750 5 20000
farming.abm_near_rarity (Rarety factor for planting near existing plants) int 2 2 100