diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2018-06-17 08:43:52 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2018-06-17 08:43:52 +0100 |
commit | e23f47922b4ae0815209a35a5c3db64337dd92b4 (patch) | |
tree | 7ebeee124ef3a5e9509185cb124fcfe220235608 | |
parent | 4a5563854d1c2b3e17139e9e2117f2aad3de63f5 (diff) |
tidy code and bug found (thanks hamlet)
-rw-r--r-- | api.lua | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -3,7 +3,7 @@ mobs = {} mobs.mod = "redo" -mobs.version = "20180604" +mobs.version = "20180617" -- Intllib @@ -1446,7 +1446,7 @@ local npc_attack = function(self) return end - local p, sp, obj, min_player + local p, sp, obj, min_player, dist local s = self.object:get_pos() local min_dist = self.view_range + 1 local objs = minetest.get_objects_inside_radius(s, self.view_range) @@ -2355,7 +2355,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) if self.do_punch then -- when false skip going any further - if self.do_punch(self, hitter, tflp, tool_caps, dir) == false then + if self.do_punch(self, hitter, tflp, tool_capabilities, dir) == false then return end end @@ -3333,21 +3333,20 @@ end -- MarkBu's spawn function function mobs:spawn(def) - local name = def.name - local nodes = def.nodes or {"group:soil", "group:stone"} - local neighbors = def.neighbors or {"air"} - local min_light = def.min_light or 0 - local max_light = def.max_light or 15 - local interval = def.interval or 30 - local chance = def.chance or 5000 - local active_object_count = def.active_object_count or 1 - local min_height = def.min_height or -31000 - local max_height = def.max_height or 31000 - local day_toggle = def.day_toggle - local on_spawn = def.on_spawn - - mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, - chance, active_object_count, min_height, max_height, day_toggle, on_spawn) + mobs:spawn_specific( + def.name, + def.nodes or {"group:soil", "group:stone"}, + def.neighbors or {"air"}, + def.min_light or 0, + def.max_light or 15, + def.interval or 30, + def.chance or 5000, + def.active_object_count or 1, + def.min_height or -31000, + def.max_height or 31000, + def.day_toggle, + def.on_spawn + ) end |