mirror of
https://notabug.org/TenPlus1/lucky_block.git
synced 2024-08-21 09:34:05 +02:00
tweaked entity checking
This commit is contained in:
parent
8bd2e86e87
commit
fc3313c337
16
init.lua
16
init.lua
@ -176,7 +176,7 @@ local function entity_physics(pos, radius)
|
|||||||
objs[n]:punch(objs[n], 1.0, {
|
objs[n]:punch(objs[n], 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = damage},
|
damage_groups = {fleshy = damage},
|
||||||
}, pos) -- nil)
|
}, pos)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -323,11 +323,10 @@ local lucky_block = function(pos, digger)
|
|||||||
entity = "mobs:sheep" .. colour
|
entity = "mobs:sheep" .. colour
|
||||||
end
|
end
|
||||||
|
|
||||||
local mob = minetest.add_entity(pos2, entity)
|
-- has entity been registered?
|
||||||
|
if minetest.registered_entities[entity] then
|
||||||
|
|
||||||
if mob and mob:get_luaentity() then
|
local ent = minetest.add_entity(pos2, entity):get_luaentity()
|
||||||
|
|
||||||
local ent = mob:get_luaentity()
|
|
||||||
|
|
||||||
if tame then
|
if tame then
|
||||||
ent.tamed = true
|
ent.tamed = true
|
||||||
@ -345,7 +344,6 @@ local lucky_block = function(pos, digger)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
mob:remove()
|
|
||||||
print ("[lucky_block] " .. entity .. " could not be spawned")
|
print ("[lucky_block] " .. entity .. " could not be spawned")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -477,12 +475,12 @@ local lucky_block = function(pos, digger)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local n = minetest.registered_nodes[nods[s]]
|
local n = minetest.registered_nodes[nods[s]]
|
||||||
|
|
||||||
|
if n then
|
||||||
|
|
||||||
local obj = minetest.add_entity(pos2, "__builtin:falling_node")
|
local obj = minetest.add_entity(pos2, "__builtin:falling_node")
|
||||||
|
|
||||||
if obj and n then
|
|
||||||
obj:get_luaentity():set_node(n)
|
obj:get_luaentity():set_node(n)
|
||||||
else
|
|
||||||
obj:remove()
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user