diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2015-05-04 01:52:41 -0700 |
---|---|---|
committer | Auke Kok <auke-jan.h.kok@intel.com> | 2015-05-04 01:52:41 -0700 |
commit | 0bb0aceabe6e9bad9b5635f4926ee6f9951b6319 (patch) | |
tree | c6c7b352d56e0041662fa20fdc774ddcf3ccb073 /potato.lua | |
parent | 01925abc36b51313a5720215fb4ef91d55a85944 (diff) |
Humidity for melons.
Lots of more templated code here. Use swap_node throughout. Each
plant has it's own properties table now, which trims the settings.txt
file. Will be easier to maintain and extend.
Had to add a withered texture for the melon plant... yes melon
plants will be able to wither on hard settings.
Diffstat (limited to 'potato.lua')
-rw-r--r-- | potato.lua | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -123,7 +123,6 @@ minetest.register_abm({ return end local meta = minetest.get_meta(pos) - local water = meta:get_int("crops_water") local damage = meta:get_int("crops_damage") if damage == 100 then minetest.set_node(pos, { name = "crops:potato_plant_5" }) @@ -132,9 +131,7 @@ minetest.register_abm({ local n = string.gsub(node.name, "3", "4") n = string.gsub(n, "2", "3") n = string.gsub(n, "1", "2") - minetest.set_node(pos, { name = n }) - meta:set_int("crops_water", water) - meta:set_int("crops_damage", damage) + minetest.swap_node(pos, { name = n }) end }) @@ -174,7 +171,18 @@ crops.potato_die = function(pos) end end -table.insert(crops.plants, { name = "crops:potato_plant_1", wateruse = 1.0, wither = crops.potato_die }) -table.insert(crops.plants, { name = "crops:potato_plant_2", wateruse = 1.0, wither = crops.potato_die }) -table.insert(crops.plants, { name = "crops:potato_plant_3", wateruse = 1.0, wither = crops.potato_die }) -table.insert(crops.plants, { name = "crops:potato_plant_4", wateruse = 1.0, wither = crops.potato_die }) +local properties = { + wither = crops.potato_die, + waterstart = 30, + wateruse = 1, + night = 5, + soak = 80, + soak_damage = 90, + wither = 20, + wither_damage = 10, +} + +table.insert(crops.plants, { name = "crops:potato_plant_1", properties = properties }) +table.insert(crops.plants, { name = "crops:potato_plant_2", properties = properties }) +table.insert(crops.plants, { name = "crops:potato_plant_3", properties = properties }) +table.insert(crops.plants, { name = "crops:potato_plant_4", properties = properties }) |