Remove commented out cactus mob damage code
parent
d41d29be58
commit
b645a2ab67
|
@ -135,44 +135,4 @@ minetest.register_node("mcl_core:reeds", {
|
|||
end,
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
})
|
||||
|
||||
-- Moved cactus mob damage logic to /ENTITIES/mcl_mobs/physics.lua
|
||||
--[[
|
||||
local function cactus_damage_check(obj, is_mob)
|
||||
-- where am I?
|
||||
local pos = obj:get_pos()
|
||||
if pos then
|
||||
-- Am I near a cactus?
|
||||
local near = minetest.find_node_near(pos, 1, "mcl_core:cactus", true)
|
||||
if not near and near ~= nil then
|
||||
near = find_node_near({x=pos.x, y=pos.y-1, z=pos.z}, 1, "mcl_core:cactus", true)
|
||||
end
|
||||
if near then
|
||||
-- Am I touching the cactus? If so, it hurts
|
||||
local dist = vector.distance(pos, near)
|
||||
local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near)
|
||||
if dist < 1.1 or dist_feet < 1.1 or (is_mob and (dist < 1.25 or dist_feet < 1.9)) then
|
||||
if obj:get_hp() > 0 then
|
||||
mcl_util.deal_damage(obj, 1, {type = "cactus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local etime = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
etime = dtime + etime
|
||||
if etime < 0.5 then return end
|
||||
etime = 0
|
||||
--for _,pl in pairs(minetest.get_connected_players()) do
|
||||
--cactus_damage_check(pl) -- Another player cactus damage check code is in mcl_playerplus
|
||||
--end
|
||||
for _,ent in pairs(minetest.luaentities) do
|
||||
if ent.is_mob then
|
||||
cactus_damage_check(ent.object, true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
]]
|
||||
})
|
Loading…
Reference in New Issue