update mod.conf, fix nil bug

This commit is contained in:
tenplus1 2021-02-01 08:33:47 +00:00
parent f517964ce0
commit 1cfac454c0
2 changed files with 24 additions and 22 deletions

View File

@ -6,12 +6,12 @@ minetest.register_entity(fname, {
velocity = 0.1, velocity = 0.1,
damage = dmg, damage = dmg,
collisionbox = {0, 0, 0, 0, 0, 0}, collisionbox = {0, 0, 0, 0, 0, 0},
on_step = function(self, obj, pos) on_step = function(self, obj, pos)
local remove = minetest.after(2, function() local remove = minetest.after(2, function()
self.object:remove() self.object:remove()
end) end)
local pos = self.object:get_pos() local pos = self.object:get_pos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= fname and obj:get_luaentity().name ~= "dmobs:dragon_red" and obj:get_luaentity().name ~= "dmobs:dragon_blue" and obj:get_luaentity().name ~= "dmobs:dragon_black" and obj:get_luaentity().name ~= "dmobs:dragon_green" and obj:get_luaentity().name ~= "dmobs:dragon_great_tame" and obj:get_luaentity().name ~= "__builtin:item" then if obj:get_luaentity().name ~= fname and obj:get_luaentity().name ~= "dmobs:dragon_red" and obj:get_luaentity().name ~= "dmobs:dragon_blue" and obj:get_luaentity().name ~= "dmobs:dragon_black" and obj:get_luaentity().name ~= "dmobs:dragon_green" and obj:get_luaentity().name ~= "dmobs:dragon_great_tame" and obj:get_luaentity().name ~= "__builtin:item" then
@ -29,7 +29,7 @@ minetest.register_entity(fname, {
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.get_node(p).name local n = minetest.get_node(p).name
if n ~= fname and n ~="default:dirt_with_grass" and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then if n ~= fname and n ~="default:dirt_with_grass" and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then
if minetest.registered_nodes[n].groups.flammable --[[or math.random(1, 100) <= 1]] then if minetest.registered_nodes[n].groups.flammable --[[or math.random(1, 100) <= 1]] then
minetest.set_node(t, {name=replace_node}) minetest.set_node(t, {name=replace_node})
self.object:remove() self.object:remove()
@ -43,24 +43,23 @@ minetest.register_entity(fname, {
end end
end end
end end
local apos = self.object:get_pos() local apos = self.object:get_pos() ; if not apos then return end
local part = minetest.add_particlespawner( minetest.add_particlespawner({
6, --amount amount = 6,
0.3, --time time = 0.3,
{x=apos.x-variance, y=apos.y-variance, z=apos.z-variance}, --minpos minpos = {x=apos.x-variance, y=apos.y-variance, z=apos.z-variance},
{x=apos.x+variance, y=apos.y+variance, z=apos.z+variance}, --maxpos maxpos = {x=apos.x+variance, y=apos.y+variance, z=apos.z+variance},
{x=-0, y=-0, z=-0}, --minvel minvel = {x=-0, y=-0, z=-0},
{x=0, y=0, z=0}, --maxvel maxvel = {x=0, y=0, z=0},
{x=variance,y=-0.5-variance,z=variance}, --minacc minacc = {x=variance,y=-0.5-variance,z=variance},
{x=0.5+variance,y=0.5+variance,z=0.5+variance}, --maxacc maxacc = {x=0.5+variance,y=0.5+variance,z=0.5+variance},
0.1, --minexptime minexptime = 0.1,
0.3, --maxexptime maxexptime = 0.3,
size, --minsize minsize = size,
size+2, --maxsize maxsize = size+2,
false, --collisiondetection collisiondetection = false,
texture --texture texture = texture
) })
end, end,
}) })
end end

View File

@ -1 +1,4 @@
name = dmobs name = dmobs
depends = default, mobs, wool
optional_depends = farming, ethereal, caverealms
description = Adds new monsters and animals into your world.