Move enderman takable nodes to 0_gameconfig.lua
This commit is contained in:
parent
5cdc76936f
commit
aa01e83c51
@ -101,7 +101,32 @@ mobs_mc.follow = {
|
|||||||
-- TODO
|
-- TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- List of nodes which endermen can take
|
||||||
|
mobs_mc.enderman_takable = {
|
||||||
|
-- Generic handling, useful for entensions
|
||||||
|
"group:enderman_takable",
|
||||||
|
|
||||||
|
-- Generic nodes
|
||||||
|
"group:sand",
|
||||||
|
"group:flower",
|
||||||
|
|
||||||
|
-- Minetest Game
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt_with_dry_grass",
|
||||||
|
"default:dirt_with_snow",
|
||||||
|
"default:dirt_with_rainforest_litter",
|
||||||
|
"default:dirt_with_grass_footsteps",
|
||||||
|
"default:cactus",
|
||||||
|
"default:gravel",
|
||||||
|
"default:clay",
|
||||||
|
"flowers:mushroom_red",
|
||||||
|
"flowers:mushroom_brown",
|
||||||
|
"tnt:tnt",
|
||||||
|
|
||||||
|
-- Nether mod
|
||||||
|
"nether:rack",
|
||||||
|
}
|
||||||
|
|
||||||
-- Item name overrides from mobs_mc_gameconfig (if present)
|
-- Item name overrides from mobs_mc_gameconfig (if present)
|
||||||
if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
|
if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
|
||||||
@ -115,6 +140,8 @@ if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
|
|||||||
mobs_mc.follow[k] = v
|
mobs_mc.follow[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if mobs_mc.override.enderman_takable then
|
||||||
|
mobs_mc.enderman_takable = mobs_mc.override.enderman_takable
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
28
enderman.lua
28
enderman.lua
@ -15,32 +15,6 @@ local pr = PseudoRandom(os.time()*(-334))
|
|||||||
local take_frequency = 10
|
local take_frequency = 10
|
||||||
local place_frequency = 10
|
local place_frequency = 10
|
||||||
|
|
||||||
local takable = {
|
|
||||||
-- Generic handling, useful for entensions
|
|
||||||
"group:enderman_takable",
|
|
||||||
|
|
||||||
-- Generic nodes
|
|
||||||
"group:sand",
|
|
||||||
"group:flower",
|
|
||||||
|
|
||||||
-- Minetest Game
|
|
||||||
"default:dirt",
|
|
||||||
"default:dirt_with_grass",
|
|
||||||
"default:dirt_with_dry_grass",
|
|
||||||
"default:dirt_with_snow",
|
|
||||||
"default:dirt_with_rainforest_litter",
|
|
||||||
"default:dirt_with_grass_footsteps",
|
|
||||||
"default:cactus",
|
|
||||||
"default:gravel",
|
|
||||||
"default:clay",
|
|
||||||
"flowers:mushroom_red",
|
|
||||||
"flowers:mushroom_brown",
|
|
||||||
"tnt:tnt",
|
|
||||||
|
|
||||||
-- Nether mod
|
|
||||||
"nether:rack",
|
|
||||||
}
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:enderman", {
|
mobs:register_mob("mobs_mc:enderman", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
runaway = true,
|
runaway = true,
|
||||||
@ -89,7 +63,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
|||||||
-- Take random node
|
-- Take random node
|
||||||
self._take_place_timer = 0
|
self._take_place_timer = 0
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
local takable_nodes = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, takable)
|
local takable_nodes = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, mcl_core.enderman_takable)
|
||||||
if #takable_nodes >= 1 then
|
if #takable_nodes >= 1 then
|
||||||
local r = pr:next(1, #takable_nodes)
|
local r = pr:next(1, #takable_nodes)
|
||||||
local take_pos = takable_nodes[r]
|
local take_pos = takable_nodes[r]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user