Add in the spypigoatsplosion mob with extreme rarity
This commit is contained in:
parent
59cebd0384
commit
bfb749e695
@ -55,6 +55,7 @@ mob_register.death_animation_timer = 0
|
||||
mob_register.dead = false
|
||||
|
||||
mob_register.mob = true
|
||||
mob_register.mobname = def.mobname
|
||||
|
||||
mob_register.hostile = def.hostile
|
||||
if def.friendly_in_daylight == true then
|
||||
@ -124,8 +125,6 @@ mob_register.hurt_color_timer = 0
|
||||
mob_register.damage_color = def.damage_color or "red"
|
||||
mob_register.custom_on_death = def.custom_on_death
|
||||
|
||||
mob_register.mob = true
|
||||
|
||||
mob_register.custom_on_activate = def.custom_on_activate
|
||||
|
||||
if def.pathfinds then
|
||||
|
@ -74,8 +74,6 @@ mobs.create_interaction_functions = function(def,mob_register)
|
||||
local y_top_diff = (pos.y + collisionbox[5]) - pos2.y
|
||||
|
||||
|
||||
|
||||
|
||||
local distance = vector.distance(vector.new(pos.x,0,pos.z),vector.new(pos2.x,0,pos2.z))
|
||||
|
||||
if distance <= collision_boundary + object_collision_boundary and y_base_diff >= 0 and y_top_diff >= 0 then
|
||||
@ -155,6 +153,7 @@ mobs.create_interaction_functions = function(def,mob_register)
|
||||
self.hostile_timer = 20
|
||||
if self.group_attack == true then
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, self.view_distance)) do
|
||||
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().mobname == self.mobname then
|
||||
object:get_luaentity().hostile = true
|
||||
object:get_luaentity().hostile_timer = 20
|
||||
|
@ -79,7 +79,7 @@ mobs.create_timer_functions = function(def,mob_register)
|
||||
if self.friendly_in_daylight_timer >= 2 then
|
||||
self.friendly_in_daylight_timer = 0
|
||||
local pos = self.object:get_pos()
|
||||
if minetest.get_node_light(pos) >= 13 then --1 greater than torch light
|
||||
if pos and minetest.get_node_light(pos) >= 13 then --1 greater than torch light
|
||||
if self.following == false then
|
||||
self.hostile = false
|
||||
end
|
||||
|
@ -699,12 +699,24 @@ mobs.register_mob(
|
||||
group_attack = true,
|
||||
|
||||
custom_on_activate = function(self)
|
||||
local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
|
||||
obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
|
||||
obj:set_properties({visual_size={x=1,y=1}})
|
||||
if math.random() > 0.998 then
|
||||
local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
|
||||
local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
|
||||
local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
|
||||
|
||||
obj2:get_luaentity().timer = 7
|
||||
obj2:get_luaentity().radius = 7
|
||||
|
||||
obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
|
||||
obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
|
||||
obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
|
||||
|
||||
obj:set_properties({visual_size={x=1,y=1}})
|
||||
obj2:set_properties({visual_size={x=1/3,y=1/3}})
|
||||
end
|
||||
end
|
||||
--explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
|
||||
--explosion_power = 7, -- how big the explosion has to be
|
||||
--explosion_time = 3, -- how long it takes for a mob to explode
|
||||
}
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user