1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2024-12-28 11:40:16 +01:00

add random seed for each registered decoration, tidy code

This commit is contained in:
tenplus1 2022-09-13 18:30:55 +01:00
parent 97d15d3ea1
commit 6ac255d4c0
38 changed files with 170 additions and 181 deletions

View File

@ -72,7 +72,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.artichoke, scale = farming.artichoke,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 448, seed = 123,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -1,6 +1,9 @@
local S = farming.intllib
-- asparagus -- asparagus
minetest.register_craftitem("farming:asparagus", { minetest.register_craftitem("farming:asparagus", {
description = "asparagus", description = S("asparagus"),
inventory_image = "farming_asparagus.png", inventory_image = "farming_asparagus.png",
groups = {seed = 2, food_asparagus = 1, flammable = 2}, groups = {seed = 2, food_asparagus = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -14,36 +17,31 @@ local def = {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_asparagus_1.png"}, tiles = {"farming_asparagus_1.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = { selection_box = farming.select,
type = "fixed",
fixed = {-6 / 16, -8 / 8, -6 / 16, 6 / 16, 1 / 55, 6 / 16},
},
groups = { groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1 not_in_creative_inventory = 1, growing = 1
}, },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults()
place_param2 = 3
} }
-- stage 1 -- stage 1
minetest.register_node("farming:asparagus_1", table.copy(def)) minetest.register_node("farming:asparagus_1", table.copy(def))
-- stage 2 -- stage 2
def.tiles = {"farming_asparagus_2.png"} def.tiles = {"farming_asparagus_2.png"}
minetest.register_node("farming:asparagus_2", table.copy(def)) minetest.register_node("farming:asparagus_2", table.copy(def))
-- stage 3 -- stage 3
def.tiles = {"farming_asparagus_3.png"} def.tiles = {"farming_asparagus_3.png"}
minetest.register_node("farming:asparagus_3", table.copy(def)) minetest.register_node("farming:asparagus_3", table.copy(def))
-- stage 4 -- stage 4
def.tiles = {"farming_asparagus_4.png"} def.tiles = {"farming_asparagus_4.png"}
def.drop = { def.drop = {
@ -53,7 +51,6 @@ def.drop = {
} }
minetest.register_node("farming:asparagus_4", table.copy(def)) minetest.register_node("farming:asparagus_4", table.copy(def))
-- stage 5 -- stage 5
def.tiles = {"farming_asparagus_5.png"} def.tiles = {"farming_asparagus_5.png"}
def.drop = { def.drop = {
@ -64,7 +61,6 @@ def.drop = {
} }
minetest.register_node("farming:asparagus_5", table.copy(def)) minetest.register_node("farming:asparagus_5", table.copy(def))
-- add to registered_plants -- add to registered_plants
farming.registered_plants["farming:asparagus"] = { farming.registered_plants["farming:asparagus"] = {
crop = "farming:asparagus", crop = "farming:asparagus",
@ -83,10 +79,10 @@ minetest.register_decoration({
noise_params = { noise_params = {
offset = -0.1, offset = -0.1,
scale = farming.asparagus, scale = farming.asparagus,
spread = {x = 50, y = 50, z = 50}, spread = {x = 100, y = 100, z = 100},
seed = 4242, seed = 234,
octaves = 3, octaves = 3,
persist = 0.7 persist = 0.6
}, },
y_min = 8, y_min = 8,
y_max = 32, y_max = 32,

View File

@ -263,7 +263,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.beans, scale = farming.beans,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 345,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -97,7 +97,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.beetroot, scale = farming.beetroot,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 456,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -70,7 +70,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.blackberry, scale = farming.blackberry,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 567,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -107,7 +107,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.blueberry, scale = farming.blueberry,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 678,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -77,7 +77,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.cabbage, scale = farming.cabbage,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 789,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -137,7 +137,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.carrot, scale = farming.carrot,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 890,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -122,7 +122,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.chili, scale = farming.chili,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 760, seed = 901,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -113,7 +113,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.coffee, scale = farming.coffee,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 12,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -186,7 +186,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.corn, scale = farming.corn,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 134,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -80,7 +80,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.cucumber, scale = farming.cucumber,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 245,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -1,3 +1,4 @@
local S = farming.intllib local S = farming.intllib
-- eggplant -- eggplant
@ -74,10 +75,10 @@ minetest.register_decoration({
noise_params = { noise_params = {
offset = -0.1, offset = -0.1,
scale = farming.eggplant, scale = farming.eggplant,
spread = {x = 50, y = 50, z = 50}, spread = {x = 100, y = 100, z = 100},
seed = 4242, seed = 356,
octaves = 3, octaves = 3,
persist = 0.7 persist = 0.6
}, },
biomes = {"deciduous_forest"}, biomes = {"deciduous_forest"},
y_max = 31000, y_max = 31000,

View File

@ -144,7 +144,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.garlic, scale = farming.garlic,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 467,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -270,7 +270,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.grapes, scale = farming.grapes,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 578,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -71,7 +71,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.lettuce, scale = farming.lettuce,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 689,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -116,7 +116,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.melon, scale = farming.melon,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 790,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -97,7 +97,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.mint, scale = farming.mint,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 801,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -103,7 +103,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.onion, scale = farming.onion,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 912,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -64,7 +64,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.parsley, scale = farming.parsley,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 23,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -99,7 +99,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.peas, scale = farming.peas,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 132,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -166,7 +166,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.pepper, scale = farming.pepper,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 933, seed = 243,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -154,7 +154,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.pineapple, scale = farming.pineapple,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 917, seed = 354,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -120,7 +120,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.potato, scale = farming.potato,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 465,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -224,7 +224,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.pumpkin, scale = farming.pumpkin,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 576,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -88,7 +88,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.raspberry, scale = farming.raspberry,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 687,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -85,7 +85,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.rhubarb, scale = farming.rhubarb,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 798,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -207,7 +207,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.soy, scale = farming.soy,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 809,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -1,3 +1,4 @@
local S = farming.intllib local S = farming.intllib
-- spinach -- spinach
@ -75,10 +76,10 @@ minetest.register_decoration({
noise_params = { noise_params = {
offset = -0.1, offset = -0.1,
scale = farming.spinach, scale = farming.spinach,
spread = {x = 50, y = 50, z = 50}, spread = {x = 100, y = 100, z = 100},
seed = 4242, seed = 910,
octaves = 3, octaves = 3,
persist = 0.7 persist = 0.6
}, },
biomes = {"deciduous_forest"}, biomes = {"deciduous_forest"},
y_max = 31000, y_max = 31000,

View File

@ -102,7 +102,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.strawberry, scale = farming.strawberry,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 143,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -163,7 +163,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.sunflower, scale = farming.sunflower,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 254,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -114,7 +114,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.tomato, scale = farming.tomato,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 365,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -130,7 +130,7 @@ minetest.register_decoration({
offset = 0, offset = 0,
scale = farming.vanilla, scale = farming.vanilla,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 476,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },

View File

@ -2,6 +2,7 @@
local S = farming.intllib local S = farming.intllib
--= filter sea water into river water --= filter sea water into river water
minetest.register_craft({ minetest.register_craft({
output = "bucket:bucket_river_water", output = "bucket:bucket_river_water",
recipe = { recipe = {
@ -71,14 +72,14 @@ minetest.register_craft({
minetest.register_craftitem("farming:caramel", { minetest.register_craftitem("farming:caramel", {
description = S("Caramel"), description = S("Caramel"),
inventory_image = "farming_caramel.png", inventory_image = "farming_caramel.png"
}) })
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
cooktime = 6, cooktime = 6,
output = "farming:caramel", output = "farming:caramel",
recipe = "group:food_sugar", recipe = "group:food_sugar"
}) })
--= Salt --= Salt
@ -165,8 +166,9 @@ minetest.register_node("farming:salt_crystal", {
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
}, }
}) })
minetest.register_craft({ minetest.register_craft({
output = "farming:salt 9", output = "farming:salt 9",
recipe = { recipe = {
@ -367,13 +369,9 @@ minetest.register_craftitem("farming:cactus_juice", {
groups = {vessel = 1, drink = 1}, groups = {vessel = 1, drink = 1},
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
if user then if user then
if math.random(5) == 1 then local num = math.random(5) == 1 and -1 or 2
return minetest.do_item_eat(-1, "vessels:drinking_glass", return minetest.do_item_eat(num, "vessels:drinking_glass",
itemstack, user, pointed_thing) itemstack, user, pointed_thing)
else
return minetest.do_item_eat(2, "vessels:drinking_glass",
itemstack, user, pointed_thing)
end
end end
end end
}) })

View File

@ -314,13 +314,13 @@ local function throw_potion(itemstack, player)
local dir = player:get_look_dir() local dir = player:get_look_dir()
local velocity = 20 local velocity = 20
obj:setvelocity({ obj:set_velocity({
x = dir.x * velocity, x = dir.x * velocity,
y = dir.y * velocity, y = dir.y * velocity,
z = dir.z * velocity z = dir.z * velocity
}) })
obj:setacceleration({ obj:set_acceleration({
x = dir.x * -3, x = dir.x * -3,
y = -9.5, y = -9.5,
z = dir.z * -3 z = dir.z * -3
@ -386,15 +386,9 @@ minetest.register_tool("farming:scythe_mithril", {
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if not def then if not def
return or not def.drop
end or not def.groups
if not def.drop then
return
end
if not def.groups
or not def.groups.plant then or not def.groups.plant then
return return
end end

View File

@ -104,7 +104,7 @@ end
-- Growth Logic -- Growth Logic
local STAGE_LENGTH_AVG = tonumber( local STAGE_LENGTH_AVG = tonumber(
minetest.settings:get("farming_stage_length")) or 200 -- 160 minetest.settings:get("farming_stage_length")) or 200
local STAGE_LENGTH_DEV = STAGE_LENGTH_AVG / 6 local STAGE_LENGTH_DEV = STAGE_LENGTH_AVG / 6
@ -746,4 +746,9 @@ ddoo("spinach.lua", farming.eggplant)
dofile(farming.path .. "/food.lua") dofile(farming.path .. "/food.lua")
dofile(farming.path .. "/compatibility.lua") -- Farming Plus compatibility dofile(farming.path .. "/compatibility.lua") -- Farming Plus compatibility
if minetest.get_modpath("lucky_block") then
dofile(farming.path .. "/lucky_block.lua") dofile(farming.path .. "/lucky_block.lua")
end
print("[MOD] Farming Redo loaded")

View File

@ -1,8 +1,3 @@
-- add lucky blocks
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({ lucky_block:add_blocks({
{"dro", {"farming:corn"}, 5}, {"dro", {"farming:corn"}, 5},
{"dro", {"farming:coffee_cup_hot"}, 1}, {"dro", {"farming:coffee_cup_hot"}, 1},
@ -82,4 +77,3 @@ if minetest.get_modpath("lucky_block") then
}}, }},
{"dro", {"farming:chili_powder"}, 5} {"dro", {"farming:chili_powder"}, 5}
}) })
end