forked from VoxeLibre/VoxeLibre
Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
cora | dba3f32d3a | |
cora | 127a0692fa | |
cora | b7dc1311ba | |
cora | 6cb9e936fc | |
cora | fa47f7cf06 | |
cora | c54a60fedf |
|
@ -309,7 +309,10 @@ end
|
|||
|
||||
-- set and return valid yaw
|
||||
local set_yaw = function(self, yaw, delay, dtime)
|
||||
|
||||
if true then
|
||||
self.object:set_yaw(yaw)
|
||||
return yaw
|
||||
end
|
||||
if not yaw or yaw ~= yaw then
|
||||
yaw = 0
|
||||
end
|
||||
|
@ -1944,7 +1947,7 @@ local monster_attack = function(self)
|
|||
|
||||
-- find specific mob to attack, failing that attack player/npc/animal
|
||||
if specific_attack(self.specific_attack, name)
|
||||
and (type == "player" or type == "npc"
|
||||
and (type == "player" or ( type == "npc" and self.attack_npcs )
|
||||
or (type == "animal" and self.attack_animals == true)) then
|
||||
|
||||
p = player:get_pos()
|
||||
|
@ -4022,6 +4025,7 @@ minetest.register_entity(name, {
|
|||
dogshoot_count_max = def.dogshoot_count_max or 5,
|
||||
dogshoot_count2_max = def.dogshoot_count2_max or (def.dogshoot_count_max or 5),
|
||||
attack_animals = def.attack_animals or false,
|
||||
attack_npcs = def.attack_npcs or false,
|
||||
specific_attack = def.specific_attack,
|
||||
runaway_from = def.runaway_from,
|
||||
owner_loyal = def.owner_loyal,
|
||||
|
|
|
@ -444,8 +444,26 @@ minetest.register_chatcommand("mobstats",{
|
|||
end
|
||||
})
|
||||
|
||||
if mobs_spawn then
|
||||
minetest.register_chatcommand("spawn_mob",{
|
||||
privs = { debug = true },
|
||||
func = function(n,param)
|
||||
local pos = minetest.get_player_by_name(n):get_pos()
|
||||
if mcl_mobs.spawn(pos,param) then
|
||||
return true, param.." spawned at "..minetest.pos_to_string(pos)
|
||||
end
|
||||
return false, "Couldn't spawn "..param
|
||||
end
|
||||
})
|
||||
|
||||
function mcl_mobs.spawn(pos,id)
|
||||
local def = minetest.registered_entities[id] or minetest.registered_entities["mobs_mc:"..id] or minetest.registered_entities["extra_mobs:"..id]
|
||||
if not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then
|
||||
return false
|
||||
end
|
||||
return minetest.add_entity(pos, def.name)
|
||||
end
|
||||
|
||||
if mobs_spawn then
|
||||
local perlin_noise
|
||||
|
||||
local function spawn_a_mob(pos, dimension, y_min, y_max)
|
||||
|
@ -508,6 +526,7 @@ if mobs_spawn then
|
|||
local mob_def = mob_library_worker_table[mob_index]
|
||||
local mob_type = minetest.registered_entities[mob_def.name].type
|
||||
local spawn_in_group = minetest.registered_entities[mob_def.name].spawn_in_group or 4
|
||||
local spawn_in_group_min = minetest.registered_entities[mob_def.name].spawn_in_group_min or 1
|
||||
local mob_count_wide = count_mobs(pos,aoc_range,mob_type)
|
||||
local mob_count = count_mobs(spawning_position,32,mob_type)
|
||||
if mob_def
|
||||
|
@ -540,10 +559,9 @@ if mobs_spawn then
|
|||
local object
|
||||
if spawn_in_group then
|
||||
object = spawn_group(spawning_position,mob_def,{gotten_node},spawn_in_group,spawn_in_group_min)
|
||||
else object = minetest.add_entity(spawning_position, mob_def.name)
|
||||
else object = mcl_mobs.spawn(pos,mob_def.name)
|
||||
end
|
||||
|
||||
|
||||
if object then
|
||||
return mob_def.on_spawn and mob_def.on_spawn(object, spawning_position)
|
||||
end
|
||||
|
|
|
@ -38,6 +38,7 @@ mcl_mobs:register_mob("mobs_mc:vindicator", {
|
|||
walk_velocity = 1.2,
|
||||
run_velocity = 2.4,
|
||||
attack_type = "dogfight",
|
||||
attack_npcs = true,
|
||||
drops = {
|
||||
{name = "mcl_core:emerald",
|
||||
chance = 1,
|
||||
|
|
|
@ -133,6 +133,7 @@ mcl_mobs:register_mob("mobs_mc:villager_zombie", {
|
|||
view_range = 16,
|
||||
fear_height = 4,
|
||||
harmed_by_heal = true,
|
||||
attack_npcs = true,
|
||||
})
|
||||
|
||||
mcl_mobs:spawn_specific(
|
||||
|
|
|
@ -95,6 +95,7 @@ local zombie = {
|
|||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
harmed_by_heal = true,
|
||||
attack_npcs = true,
|
||||
}
|
||||
|
||||
mcl_mobs:register_mob("mobs_mc:zombie", zombie)
|
||||
|
|
Loading…
Reference in New Issue