summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2018-07-19 09:19:00 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2018-07-19 09:19:00 +0100
commit4badcec3187cb10a561bd68b126747600ac343d4 (patch)
tree1534c223dfee172d02ce07021f3f0980d702682e
parent63c9812dad43adfb5736408f48a61ff02267d9ed (diff)
add check for no drops
-rw-r--r--api.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/api.lua b/api.lua
index e7fc566..ccd3ee9 100644
--- a/api.lua
+++ b/api.lua
@@ -3,7 +3,7 @@
mobs = {}
mobs.mod = "redo"
-mobs.version = "20180710"
+mobs.version = "20180719"
-- Intllib
@@ -350,6 +350,11 @@ end
-- drop items
local item_drop = function(self, cooked)
+ -- check for nil or no drops
+ if not self.drops or #self.drops == 0 then
+ return
+ end
+
-- no drops if disabled by setting
if not mobs_drop_items then return end
@@ -359,13 +364,11 @@ local item_drop = function(self, cooked)
local obj, item, num
local pos = self.object:get_pos()
- self.drops = self.drops or {} -- nil check
-
for n = 1, #self.drops do
if random(1, self.drops[n].chance) == 1 then
- num = random(self.drops[n].min or 1, self.drops[n].max or 1)
+ num = random(self.drops[n].min or 0, self.drops[n].max or 1)
item = self.drops[n].name
-- cook items when true