use pallete for garden soil. Better default timing.
@ -135,11 +135,11 @@ function composter_on_timer(pos, elapsed)
|
|||||||
|
|
||||||
if (amount>0) then
|
if (amount>0) then
|
||||||
local timer = minetest.get_node_timer(pos);
|
local timer = minetest.get_node_timer(pos);
|
||||||
timer:set(base_production_time*speed, 0);
|
timer:start(base_production_time*speed, 0);
|
||||||
end
|
end
|
||||||
composter_update_node(pos, node, meta);
|
composter_update_node(pos, node, meta);
|
||||||
|
|
||||||
return amount>0;
|
return false; -- timer:start force timer to continue, return true will erase new timer setting
|
||||||
end
|
end
|
||||||
|
|
||||||
local short_desc = S("Composter");
|
local short_desc = S("Composter");
|
||||||
|
112
garden_soil.lua
@ -1,8 +1,13 @@
|
|||||||
local S = composting.translator
|
local S = composting.translator
|
||||||
|
|
||||||
local time_divider = composting.settings.soil_time_divider;
|
local time_divider = composting.settings.soil_time_divider;
|
||||||
|
local time_const_base = 365*24*3600/256;
|
||||||
|
local wet_points = composting.settings.wet_points;
|
||||||
|
|
||||||
composting.watering_cans = {}
|
composting.watering_cans = {}
|
||||||
|
composting.fertilize_items = {
|
||||||
|
["composting:compost_clod"] = 127
|
||||||
|
}
|
||||||
|
|
||||||
if minetest.get_modpath("bucket") then
|
if minetest.get_modpath("bucket") then
|
||||||
-- bucket mod
|
-- bucket mod
|
||||||
@ -36,17 +41,26 @@ if minetest.get_modpath("wateringcan") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
composting.watering_cans["wateringcan:wateringcan_water"] = empty_wateringcan;
|
composting.watering_cans["wateringcan:wateringcan_water"] = empty_wateringcan;
|
||||||
|
|
||||||
|
if wateringcan and wateringcan.wettable_nodes then
|
||||||
|
wateringcan.wettable_nodes["composting:garden_soil"] = function(pos)
|
||||||
|
local node = minetest.get_node(pos);
|
||||||
|
node.name = "composting:garden_soil_wet";
|
||||||
|
node.param1 = wet_points;
|
||||||
|
minetest.swap_node(pos, node);
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local garden_soil_tiles = {"composting_garden_soil.png"};
|
local garden_soil_tiles = nil;
|
||||||
local garden_soil_wet_tiles = {"composting_garden_soil_wet.png"};
|
local garden_soil_wet_tiles = nil;
|
||||||
if minetest.get_modpath("farming") then
|
if minetest.get_modpath("farming") then
|
||||||
garden_soil_tiles = {"composting_garden_soil.png^farming_soil.png", "composting_garden_soil.png"};
|
garden_soil_tiles = {{name="farming_soil.png",color="white"}, ""};
|
||||||
garden_soil_tiles = {"composting_garden_soil_wet.png^farming_soil_wet.png", "composting_garden_soil.png^farming_soil_wet_side.png"};
|
garden_soil_wet_tiles = {{name="farming_soil_wet.png",color="white"}, {name="farming_soil_wet_side.png",color="white"}};
|
||||||
end
|
end
|
||||||
if minetest.get_modpath("hades_farming") then
|
if minetest.get_modpath("hades_farming") then
|
||||||
garden_soil_tiles = {"composting_garden_soil.png^hades_farming_soil.png", "composting_garden_soil.png"};
|
garden_soil_tiles = {{name="hades_farming_soil.png",color="white"}, ""};
|
||||||
garden_soil_tiles = {"composting_garden_soil_wet.png^hades_farming_soil_wet.png", "composting_garden_soil.png^hades_farming_soil_wet_side.png"};
|
garden_soil_wet_tiles = {{name="hades_farming_soil_wet.png",color="white"}, {name="hades_farming_soil_wet_side.png",color="white"}};
|
||||||
end
|
end
|
||||||
|
|
||||||
-- garden soil
|
-- garden soil
|
||||||
@ -83,29 +97,34 @@ minetest.register_node("composting:garden_soil", {
|
|||||||
short_description = short_desc,
|
short_description = short_desc,
|
||||||
description = desc,
|
description = desc,
|
||||||
_tt_help = tt_help,
|
_tt_help = tt_help,
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "composting_garden_soil_palette.png",
|
||||||
|
color = "#6A4B31",
|
||||||
tiles = {"composting_garden_soil.png"},
|
tiles = {"composting_garden_soil.png"},
|
||||||
|
overlay_tiles = garden_soil_tiles,
|
||||||
-- soil have to be 2, because farming code detect wet soil via soil value
|
-- soil have to be 2, because farming code detect wet soil via soil value
|
||||||
groups = {crumbly = 3, soil = 2, grassland = 1},
|
groups = {crumbly = 3, soil = 2, grassland = 1},
|
||||||
drop = "default:dirt",
|
drop = "default:dirt",
|
||||||
sounds = node_sounds,
|
sounds = node_sounds,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local node = minetest.get_node(pos);
|
local node = minetest.get_node(pos);
|
||||||
node.param1 = 255;
|
node.param2 = 255;
|
||||||
minetest.swap_node(pos, node);
|
minetest.swap_node(pos, node);
|
||||||
local timer = minetest.get_node_timer(pos);
|
local timer = minetest.get_node_timer(pos);
|
||||||
timer:start((3422/time_divider)/effect_of_flora(pos));
|
timer:start((time_const_base/time_divider)/effect_of_flora(pos));
|
||||||
end,
|
end,
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
local node = minetest.get_node(pos);
|
local node = minetest.get_node(pos);
|
||||||
if (node.param1>0) then
|
if (node.param2>0) then
|
||||||
node.param1 = node.param1-1;
|
node.param2 = node.param2-1;
|
||||||
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||||
node.name = "composting:garden_soil_wet";
|
node.name = "composting:garden_soil_wet";
|
||||||
end
|
end
|
||||||
minetest.swap_node(pos, node);
|
minetest.swap_node(pos, node);
|
||||||
local timer = minetest.get_node_timer(pos);
|
local timer = minetest.get_node_timer(pos);
|
||||||
timer:start((3422/time_divider)/effect_of_flora(pos));
|
--print(dump(pos)..timer:get_timeout().." gt:"..minetest.get_gametime())
|
||||||
return true;
|
timer:set((time_const_base/time_divider)/effect_of_flora(pos), 0);
|
||||||
|
return false;
|
||||||
else
|
else
|
||||||
minetest.set_node(pos, {name="farming:soil"});
|
minetest.set_node(pos, {name="farming:soil"});
|
||||||
end
|
end
|
||||||
@ -114,12 +133,25 @@ minetest.register_node("composting:garden_soil", {
|
|||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
if puncher then
|
if puncher then
|
||||||
local item = puncher:get_wielded_item();
|
local item = puncher:get_wielded_item();
|
||||||
local watering_can = composting.watering_cans[item:get_name()];
|
local item_name = item:get_name();
|
||||||
|
local watering_can = composting.watering_cans[item_name];
|
||||||
if watering_can then
|
if watering_can then
|
||||||
node.name = "composting:garden_soil_wet"
|
node.name = "composting:garden_soil_wet"
|
||||||
node.param2 = 4;
|
node.param1 = wet_points;
|
||||||
minetest.swap_node(pos, node);
|
minetest.swap_node(pos, node);
|
||||||
puncher:set_wielded_item(watering_can(puncher, item));
|
puncher:set_wielded_item(watering_can(puncher, item));
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local compost_clod = composting.fertilize_items[item_name];
|
||||||
|
if compost_clod then
|
||||||
|
node.param2 = node.param2+127;
|
||||||
|
if (node.param2>255) then
|
||||||
|
node.param2 = 255;
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos, node);
|
||||||
|
item:take_item(1)
|
||||||
|
puncher:set_wielded_item(item);
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -135,39 +167,44 @@ minetest.register_node("composting:garden_soil_wet", {
|
|||||||
short_description = short_desc,
|
short_description = short_desc,
|
||||||
description = desc,
|
description = desc,
|
||||||
_tt_help = tt_help,
|
_tt_help = tt_help,
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "composting_garden_soil_palette.png",
|
||||||
|
color = "$6A4B31",
|
||||||
tiles = {"composting_garden_soil_wet.png"},
|
tiles = {"composting_garden_soil_wet.png"},
|
||||||
|
overlay_tiles = garden_soil_wet_tiles,
|
||||||
groups = {crumbly = 3, soil = 5, grassland = 1, wet = 1, not_in_creative_inventory = 1},
|
groups = {crumbly = 3, soil = 5, grassland = 1, wet = 1, not_in_creative_inventory = 1},
|
||||||
drop = "default:dirt",
|
drop = "default:dirt",
|
||||||
sounds = node_sounds,
|
sounds = node_sounds,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local node = minetest.get_node(pos);
|
local node = minetest.get_node(pos);
|
||||||
node.param1 = 255;
|
node.param2 = 255;
|
||||||
node.param2 = 4;
|
node.param1 = wet_point;
|
||||||
minetest.swap_node(pos, node);
|
minetest.swap_node(pos, node);
|
||||||
local timer = minetest.get_node_timer(pos);
|
local timer = minetest.get_node_timer(pos);
|
||||||
timer:start((1711/time_divider)/effect_of_flora(pos));
|
timer:start(((time_const_base/2)/time_divider)/effect_of_flora(pos));
|
||||||
end,
|
end,
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
local node = minetest.get_node(pos);
|
local node = minetest.get_node(pos);
|
||||||
if (node.param1>0) then
|
if (node.param2>0) then
|
||||||
local timer_const = 3422;
|
local timer_const = time_const_base/2;
|
||||||
node.param1 = node.param1-1;
|
node.param2 = node.param2-1;
|
||||||
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||||
node.param2 = 4;
|
node.param1 = wet_points;
|
||||||
end
|
end
|
||||||
if (node.param2>0) then
|
if (node.param1>0) then
|
||||||
node.param2 = node.param2-1;
|
node.param1 = node.param1-1;
|
||||||
else
|
else
|
||||||
if not minetest.find_node_near(pos, 3, {"ignore"}) then
|
if not minetest.find_node_near(pos, 3, {"ignore"}) then
|
||||||
node.name = "composting:garden_soil";
|
node.name = "composting:garden_soil";
|
||||||
timer_const = 1711;
|
timer_const = time_const_base;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.swap_node(pos, node);
|
minetest.swap_node(pos, node);
|
||||||
local timer = minetest.get_node_timer(pos);
|
local timer = minetest.get_node_timer(pos);
|
||||||
|
--print(dump(pos)..timer:get_timeout().." gt:"..minetest.get_gametime())
|
||||||
timer:start((timer_const/time_divider)/effect_of_flora(pos));
|
timer:start((timer_const/time_divider)/effect_of_flora(pos));
|
||||||
return true;
|
return false;
|
||||||
elseif (node.param2>0) then
|
elseif (node.param1>0) then
|
||||||
minetest.set_node(pos, {name="farming:soil_wet"});
|
minetest.set_node(pos, {name="farming:soil_wet"});
|
||||||
else
|
else
|
||||||
minetest.set_node(pos, {name="farming:soil"});
|
minetest.set_node(pos, {name="farming:soil"});
|
||||||
@ -177,14 +214,27 @@ minetest.register_node("composting:garden_soil_wet", {
|
|||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
if puncher then
|
if puncher then
|
||||||
local item = puncher:get_wielded_item();
|
local item = puncher:get_wielded_item();
|
||||||
local watering_can = composting.watering_cans[item:get_name()];
|
local item_name = item:get_name();
|
||||||
|
local watering_can = composting.watering_cans[item_name];
|
||||||
if watering_can then
|
if watering_can then
|
||||||
node.param2 = node.param2+4;
|
node.param1 = node.param1+wet_points;
|
||||||
if (node.param2>5) then
|
if (node.param1>wet_points) then
|
||||||
node.param2 = 5;
|
node.param1 = wet_points;
|
||||||
end
|
end
|
||||||
minetest.swap_node(pos, node);
|
minetest.swap_node(pos, node);
|
||||||
puncher:set_wielded_item(watering_can(puncher, item));
|
puncher:set_wielded_item(watering_can(puncher, item));
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local compost_clod = composting.fertilize_items[item_name];
|
||||||
|
if compost_clod then
|
||||||
|
node.param2 = node.param2+127;
|
||||||
|
if (node.param2>255) then
|
||||||
|
node.param2 = 255;
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos, node);
|
||||||
|
item:take_item(1);
|
||||||
|
puncher:set_wielded_item(item);
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 367 B |
BIN
scripts/composting_garden_soil_palette.png
Normal file
After Width: | Height: | Size: 223 B |
@ -23,4 +23,10 @@ palette = []
|
|||||||
for i in range(16):
|
for i in range(16):
|
||||||
add_pixels(palette, help_colors[i], (48,48,48,255), 16)
|
add_pixels(palette, help_colors[i], (48,48,48,255), 16)
|
||||||
img.putdata(palette)
|
img.putdata(palette)
|
||||||
img.save("palette.png")
|
img.save("composting_composter_palette.png")
|
||||||
|
|
||||||
|
img = Image.new(mode="RGBA",size=(16,16),color=(0,0,0,255));
|
||||||
|
palette = []
|
||||||
|
add_pixels(palette, (106,75,49,255), (70,40,10,255), 256)
|
||||||
|
img.putdata(palette)
|
||||||
|
img.save("composting_garden_soil_palette.png")
|
||||||
|
@ -11,9 +11,10 @@ end
|
|||||||
|
|
||||||
local settings = {
|
local settings = {
|
||||||
amount_limit = settings_get_int("composting_amount_per_composter", 200),
|
amount_limit = settings_get_int("composting_amount_per_composter", 200),
|
||||||
clod_cost = settings_get_int("composting_clod_cost", 100),
|
clod_cost = settings_get_int("composting_clod_cost", 25),
|
||||||
composting_time_divider = settings_get_int("composting_time_divider", 72),
|
composting_time_divider = settings_get_int("composting_time_divider", 3600),
|
||||||
soil_time_divider = settings_get_int("composting_soil_time_divider", 72),
|
soil_time_divider = settings_get_int("composting_soil_time_divider", 720),
|
||||||
|
wet_points = settings_get_int("composting_soil_wet_points", 25),
|
||||||
}
|
}
|
||||||
|
|
||||||
composting.settings = settings;
|
composting.settings = settings;
|
||||||
|
@ -1,9 +1,34 @@
|
|||||||
|
|
||||||
composting_amount_per_composter (Maximum amount of biomase per composter) int 200
|
composting_amount_per_composter (Maximum amount of biomase per composter) int 200
|
||||||
|
|
||||||
composting_clod_cost (How much amount of compost cost compost clod) int 100
|
# Compost clod cost
|
||||||
|
#
|
||||||
|
# If compost is optimally fulled, it takes around 20 minutes for one compost clod to be finished (time_divider set to 3600).
|
||||||
|
#
|
||||||
|
composting_clod_cost (How much amount of compost cost compost clod) int 25
|
||||||
|
|
||||||
composting_time_divider (Time divider for composting speed) int 72
|
# Basic composting speed is one year.
|
||||||
|
# Minetest use default day length 20 minutes, which means that time is divided by 72.
|
||||||
|
# time_divider 72 -> ideal composting time 122 hours.
|
||||||
|
# time_divider 720 -> ideal composting time 12 hours.
|
||||||
|
# time_divider 3600 -> ideal composting time 2.5 hours.
|
||||||
|
# time_divider 7200 -> ideal composting time 1.25 hours.
|
||||||
|
#
|
||||||
|
composting_time_divider (Time divider for composting speed) int 3600
|
||||||
|
|
||||||
composting_soil_time_divider (Time divider for garden soil timer) int 72
|
# Garden soil time divider set how long it take to garden soil be exhauset and changed into farming soil.
|
||||||
|
#
|
||||||
|
# soil_time_divider 72 -> change to dirt in 122 hours
|
||||||
|
# soil_time_divider 720 -> change to dirt in 12 hours
|
||||||
|
# soil_time_divider 3600 -> change to dirt in 2.5 hours
|
||||||
|
# soil_time_divider 7200 -> change to dirt in 1.25 hours
|
||||||
|
#
|
||||||
|
composting_soil_time_divider (Time divider for garden soil timer) int 720
|
||||||
|
|
||||||
|
# Wet points of garden soil
|
||||||
|
#
|
||||||
|
# Times is valid for soil_time_divider set to 720.
|
||||||
|
# soil_wet_points 25 -> get dry in 71 minutes
|
||||||
|
#
|
||||||
|
composting_soil_wet_points (Wet points of garden soil) int 25
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 752 B After Width: | Height: | Size: 611 B |
BIN
textures/composting_garden_soil_palette.png
Normal file
After Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 640 B |