From a56b9c2ce9f89e2c06465e49558ee113a1c475b6 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Wed, 7 Jun 2017 20:33:46 -0700 Subject: [PATCH] User alternate message if spawn chance is less than 1% --- spawn.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spawn.lua b/spawn.lua index 075c462..14b821b 100644 --- a/spawn.lua +++ b/spawn.lua @@ -10,7 +10,13 @@ local spawn_chance = tonumber(minetest.settings:get('sneeker.spawn_chance')) or local spawn_interval = tonumber(minetest.settings:get('sneeker.spawn_interval')) or time_min * 4 -- Default interval is 4 minutes local spawn_maxlight = tonumber(minetest.settings:get('sneeker.spawn_maxlight')) or 5 -- Maximum light of node for spawn -local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. '%' +-- Display spawn chance as percentage in log +local spawn_chance_percent = math.floor(1 / spawn_chance * 100) +if spawn_chance_percent < 1 then + spawn_chance_percent = 'Less than 1%' +else + spawn_chance_percent = tostring(spawn_chance_percent) .. '%' +end sneeker.log('Spawn cap: ' .. tostring(spawn_cap)) sneeker.log('Spawn chance: ' .. spawn_chance_percent)