forked from mtcontrib/mobs_redo
code tidy
This commit is contained in:
parent
bbaa1ff025
commit
6aead4ec5c
13
api.lua
13
api.lua
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
-- Mobs Api (29th March 2017)
|
-- Mobs Api (30th March 2017)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
|
@ -933,10 +933,10 @@ function smart_mobs(self, s, p, dist, dtime)
|
||||||
-- lets make way by digging/building if not accessible
|
-- lets make way by digging/building if not accessible
|
||||||
if self.pathfinding == 2 then
|
if self.pathfinding == 2 then
|
||||||
|
|
||||||
-- add block and remove one block above so
|
-- is player higher than mob?
|
||||||
-- there is room to jump if needed
|
|
||||||
if s.y < p1.y then
|
if s.y < p1.y then
|
||||||
|
|
||||||
|
-- build upwards
|
||||||
if not minetest.is_protected(s, "") then
|
if not minetest.is_protected(s, "") then
|
||||||
|
|
||||||
local ndef1 = minetest.registered_nodes[self.standing_in]
|
local ndef1 = minetest.registered_nodes[self.standing_in]
|
||||||
|
@ -952,9 +952,10 @@ function smart_mobs(self, s, p, dist, dtime)
|
||||||
-- assume mob is 2 blocks high so it digs above its head
|
-- assume mob is 2 blocks high so it digs above its head
|
||||||
s.y = s.y + sheight
|
s.y = s.y + sheight
|
||||||
|
|
||||||
|
-- remove one block above to make room to jump
|
||||||
if not minetest.is_protected(s, "") then
|
if not minetest.is_protected(s, "") then
|
||||||
|
|
||||||
local node1 = node_ok(s, "air").name -- minetest.get_node(s).name
|
local node1 = node_ok(s, "air").name
|
||||||
local ndef1 = minetest.registered_nodes[node1]
|
local ndef1 = minetest.registered_nodes[node1]
|
||||||
|
|
||||||
if node1 ~= "air"
|
if node1 ~= "air"
|
||||||
|
@ -983,7 +984,7 @@ function smart_mobs(self, s, p, dist, dtime)
|
||||||
|
|
||||||
if not minetest.is_protected(p1, "") then
|
if not minetest.is_protected(p1, "") then
|
||||||
|
|
||||||
local node1 = node_ok(p1, "air").name -- minetest.get_node(p1).name
|
local node1 = node_ok(p1, "air").name
|
||||||
local ndef1 = minetest.registered_nodes[node1]
|
local ndef1 = minetest.registered_nodes[node1]
|
||||||
|
|
||||||
if node1 ~= "air"
|
if node1 ~= "air"
|
||||||
|
@ -997,7 +998,7 @@ function smart_mobs(self, s, p, dist, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
p1.y = p1.y + 1
|
p1.y = p1.y + 1
|
||||||
node1 = node_ok(p1, "air").name -- minetest.get_node(p1).name
|
node1 = node_ok(p1, "air").name
|
||||||
ndef1 = minetest.registered_nodes[node1]
|
ndef1 = minetest.registered_nodes[node1]
|
||||||
|
|
||||||
if node1 ~= "air"
|
if node1 ~= "air"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user