summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHybridDog <adresse_test@t-online.de>2015-05-22 18:47:21 +0200
committerAuke Kok <sofar@foo-projects.org>2015-05-25 15:50:53 -0700
commit61815728f58b018256c924aa7d03deb7290d6003 (patch)
tree60d37ff55e1e8029f95ce834c6b0bb7dc0276f9f
parent5ff478e635e180d7513cc910182fa9e4a5ee0c71 (diff)
short settings code
-rw-r--r--init.lua18
1 files changed, 7 insertions, 11 deletions
diff --git a/init.lua b/init.lua
index 7382d2d..e3fd1f6 100644
--- a/init.lua
+++ b/init.lua
@@ -14,7 +14,8 @@ crops = {}
crops.plants = {}
crops.settings = {}
-local settings_easy = {
+local settings = {}
+settings.easy = {
chance = 4,
interval = 30,
light = 8,
@@ -27,7 +28,7 @@ local settings_easy = {
damage_tick_max = 1,
damage_max = 25,
}
-local settings_normal = {
+settings.normal = {
chance = 8,
interval = 30,
light = 10,
@@ -40,7 +41,7 @@ local settings_normal = {
damage_tick_max = 5,
damage_max = 50,
}
-local settings_difficult = {
+settings.difficult = {
chance = 16,
interval = 30,
light = 13,
@@ -80,15 +81,10 @@ if not crops.difficulty then
crops.difficulty = "normal"
minetest.log("error", "Defaulting to \"normal\" difficulty settings")
end
-if crops.difficulty == "easy" then
- crops.settings = settings_easy
-elseif crops.difficulty == "normal" then
- crops.settings = settings_normal
-elseif crops.difficulty == "difficult" then
- crops.settings = settings_difficult
-else
+crops.settings = settings[crops.difficulty]
+if not crops.settings then
minetest.log("error", "Defaulting to \"normal\" difficulty settings")
- crops.settings = settings_normal
+ crops.settings = settings.normal
end
local find_plant = function(node)