Tidied code, fixed DIR error in on_punch

This commit is contained in:
TenPlus1 2016-01-16 10:55:18 +00:00
parent 601edc655d
commit 55c0ed5712

14
api.lua
View File

@ -1,4 +1,4 @@
-- Mobs Api (11th January 2016) -- Mobs Api (16th January 2016)
mobs = {} mobs = {}
mobs.mod = "redo" mobs.mod = "redo"
@ -1168,7 +1168,7 @@ and self.state ~= "runaway" then
and self.fly_in == "default:water_source" and self.fly_in == "default:water_source"
and not lp then and not lp then
print ("out of water") --print ("out of water")
set_velocity(self, 0) set_velocity(self, 0)
@ -1632,9 +1632,9 @@ and self.state ~= "runaway" then
local kb = r * 5 local kb = r * 5
self.object:setvelocity({ self.object:setvelocity({
x = dir.x * kb, x = (dir.x or 0) * kb,
y = 2, y = 2,
z = dir.z * kb z = (dir.z or 0) * kb
}) })
self.pause_timer = r self.pause_timer = r
@ -1852,14 +1852,16 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
local new_chance = tonumber(minetest.setting_get(name .. "_chance")) local new_chance = tonumber(minetest.setting_get(name .. "_chance"))
if new_chance ~= nil then if new_chance ~= nil then
chance = new_chance
print ("[Mobs Redo] Chance setting for " .. name .. " is now " .. chance)
if chance == 0 then if chance == 0 then
print("[Mobs Redo] " .. name .. " has spawning disabled") print("[Mobs Redo] " .. name .. " has spawning disabled")
return return
end end
chance = new_chance
print ("[Mobs Redo] Chance setting for " .. name .. " is now " .. chance)
end end
minetest.register_abm({ minetest.register_abm({