forked from VoxeLibre/VoxeLibre
Compare commits
7 Commits
master
...
fix_struct
Author | SHA1 | Date |
---|---|---|
cora | f21a1a20ed | |
cora | aa73f06e03 | |
cora | 3515324011 | |
cora | b9e0d5a348 | |
cora | 5f63cce761 | |
cora | bde7c2fe36 | |
cora | a0c840d66d |
|
@ -3046,6 +3046,31 @@ local function check_item_pickup(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local check_herd_timer = 0
|
||||||
|
local function check_herd(self,dtime)
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
if not pos then return end
|
||||||
|
check_herd_timer = check_herd_timer + dtime
|
||||||
|
if check_herd_timer < 4 then return end
|
||||||
|
check_herd_timer = 0
|
||||||
|
for _,o in pairs(minetest.get_objects_inside_radius(pos,self.view_range)) do
|
||||||
|
local l = o:get_luaentity()
|
||||||
|
local p,y
|
||||||
|
if l and l.is_mob and l.name == self.name then
|
||||||
|
if self.horny and l.horny then
|
||||||
|
p = l.object:get_pos()
|
||||||
|
else
|
||||||
|
y = o:get_yaw()
|
||||||
|
end
|
||||||
|
if p then
|
||||||
|
go_to_pos(self,p)
|
||||||
|
elseif y then
|
||||||
|
set_yaw(self,y)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function damage_mob(self,reason,damage)
|
local function damage_mob(self,reason,damage)
|
||||||
if not self.health then return end
|
if not self.health then return end
|
||||||
damage = floor(damage)
|
damage = floor(damage)
|
||||||
|
@ -3927,6 +3952,10 @@ local mob_step = function(self, dtime)
|
||||||
yaw = yaw + random(-0.5, 0.5)
|
yaw = yaw + random(-0.5, 0.5)
|
||||||
yaw = set_yaw(self, yaw, 8)
|
yaw = set_yaw(self, yaw, 8)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
if self.move_in_group ~= false then
|
||||||
|
check_herd(self,dtime)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add water flowing for mobs from mcl_item_entity
|
-- Add water flowing for mobs from mcl_item_entity
|
||||||
|
|
|
@ -25,6 +25,7 @@ local table_remove = table.remove
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local dbg_spawn_attempts = 0
|
local dbg_spawn_attempts = 0
|
||||||
local dbg_spawn_succ = 0
|
local dbg_spawn_succ = 0
|
||||||
|
local dbg_spawn_counts = {}
|
||||||
-- range for mob count
|
-- range for mob count
|
||||||
local aoc_range = 136
|
local aoc_range = 136
|
||||||
|
|
||||||
|
@ -473,6 +474,11 @@ function mcl_mobs.spawn(pos,id)
|
||||||
if not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then
|
if not def or (def.can_spawn and not def.can_spawn(pos)) or not def.is_mob then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
if not dbg_spawn_counts[def.name] then
|
||||||
|
dbg_spawn_counts[def.name] = 1
|
||||||
|
else
|
||||||
|
dbg_spawn_counts[def.name] = dbg_spawn_counts[def.name] + 1
|
||||||
|
end
|
||||||
return minetest.add_entity(pos, def.name)
|
return minetest.add_entity(pos, def.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -564,13 +570,13 @@ if mobs_spawn then
|
||||||
local object
|
local object
|
||||||
if spawn_in_group and ( mob_type ~= "monster" or math.random(5) == 1 ) then
|
if spawn_in_group and ( mob_type ~= "monster" or math.random(5) == 1 ) then
|
||||||
if logging then
|
if logging then
|
||||||
minetest.log("action", "[mcl_mobs] A group of mob " .. mob_def.name .. " spawns at " .. minetest.pos_to_string(spawning_position, 1))
|
minetest.log("action", "[mcl_mobs] A group of mob " .. mob_def.name .. " spawns on " ..minetest.get_node(vector.offset(spawning_position,0,-1,0)).name .." at " .. minetest.pos_to_string(spawning_position, 1))
|
||||||
end
|
end
|
||||||
object = spawn_group(spawning_position,mob_def,{minetest.get_node(vector.offset(spawning_position,0,-1,0)).name},spawn_in_group,spawn_in_group_min)
|
object = spawn_group(spawning_position,mob_def,{minetest.get_node(vector.offset(spawning_position,0,-1,0)).name},spawn_in_group,spawn_in_group_min)
|
||||||
|
|
||||||
else
|
else
|
||||||
if logging then
|
if logging then
|
||||||
minetest.log("action", "[mcl_mobs] Mob " .. mob_def.name .. " spawns at " .. minetest.pos_to_string(spawning_position, 1))
|
minetest.log("action", "[mcl_mobs] Mob " .. mob_def.name .. " spawns on " ..minetest.get_node(vector.offset(spawning_position,0,-1,0)).name .." at ".. minetest.pos_to_string(spawning_position, 1))
|
||||||
end
|
end
|
||||||
object = mcl_mobs.spawn(spawning_position, mob_def.name)
|
object = mcl_mobs.spawn(spawning_position, mob_def.name)
|
||||||
end
|
end
|
||||||
|
@ -610,6 +616,7 @@ end
|
||||||
minetest.register_chatcommand("mobstats",{
|
minetest.register_chatcommand("mobstats",{
|
||||||
privs = { debug = true },
|
privs = { debug = true },
|
||||||
func = function(n,param)
|
func = function(n,param)
|
||||||
|
minetest.chat_send_player(n,dump(dbg_spawn_counts))
|
||||||
local pos = minetest.get_player_by_name(n):get_pos()
|
local pos = minetest.get_player_by_name(n):get_pos()
|
||||||
minetest.chat_send_player(n,"mobs within 32 radius of player:"..count_mobs(pos,32))
|
minetest.chat_send_player(n,"mobs within 32 radius of player:"..count_mobs(pos,32))
|
||||||
minetest.chat_send_player(n,"total mobs:"..count_mobs_total())
|
minetest.chat_send_player(n,"total mobs:"..count_mobs_total())
|
||||||
|
|
|
@ -157,6 +157,16 @@ cat.on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
cat.on_spawn = function(self)
|
||||||
|
if self.owner == "!witch!" then
|
||||||
|
self._texture = {"mobs_mc_cat_black.png"}
|
||||||
|
end
|
||||||
|
if not self._texture then
|
||||||
|
self._texture = cat.textures[math.random(#cat.textures)]
|
||||||
|
end
|
||||||
|
self.object:set_properties({textures = {self._texture}})
|
||||||
|
end
|
||||||
|
|
||||||
mcl_mobs:register_mob("mobs_mc:cat", cat)
|
mcl_mobs:register_mob("mobs_mc:cat", cat)
|
||||||
|
|
||||||
local base_spawn_chance = 5000
|
local base_spawn_chance = 5000
|
||||||
|
|
|
@ -28,6 +28,7 @@ pillager = {
|
||||||
shoot_interval = 3,
|
shoot_interval = 3,
|
||||||
shoot_offset = 1.5,
|
shoot_offset = 1.5,
|
||||||
armor = {fleshy = 100},
|
armor = {fleshy = 100},
|
||||||
|
can_despawn = false,
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
|
||||||
pathfinding = 1,
|
pathfinding = 1,
|
||||||
group_attack = true,
|
group_attack = true,
|
||||||
|
|
|
@ -15,6 +15,7 @@ mcl_mobs:register_mob("mobs_mc:evoker", {
|
||||||
description = S("Evoker"),
|
description = S("Evoker"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
can_despawn = false,
|
||||||
physical = true,
|
physical = true,
|
||||||
pathfinding = 1,
|
pathfinding = 1,
|
||||||
hp_min = 24,
|
hp_min = 24,
|
||||||
|
|
|
@ -16,6 +16,7 @@ mcl_mobs:register_mob("mobs_mc:witch", {
|
||||||
description = S("Witch"),
|
description = S("Witch"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
can_despawn = false,
|
||||||
hp_min = 26,
|
hp_min = 26,
|
||||||
hp_max = 26,
|
hp_max = 26,
|
||||||
xp_min = 5,
|
xp_min = 5,
|
||||||
|
|
|
@ -103,7 +103,6 @@ baby_pigman.description = S("Baby Zombie Pigman")
|
||||||
baby_pigman.collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.94, 0.25}
|
baby_pigman.collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.94, 0.25}
|
||||||
baby_pigman.xp_min = 13
|
baby_pigman.xp_min = 13
|
||||||
baby_pigman.xp_max = 13
|
baby_pigman.xp_max = 13
|
||||||
baby_pigman.visual_size = {x=pigman.visual_size.x/2, y=pigman.visual_size.y/2}
|
|
||||||
baby_pigman.textures = { {
|
baby_pigman.textures = { {
|
||||||
"mobs_mc_zombie_pigman.png", --baby
|
"mobs_mc_zombie_pigman.png", --baby
|
||||||
"default_tool_goldsword.png", --sword
|
"default_tool_goldsword.png", --sword
|
||||||
|
|
|
@ -69,12 +69,12 @@ mcl_structures.register_structure("pillager_outpost",{
|
||||||
if not peaceful then
|
if not peaceful then
|
||||||
if sp and #sp > 0 then
|
if sp and #sp > 0 then
|
||||||
for i=1,5 do
|
for i=1,5 do
|
||||||
local pos = sp[pr:next(1,#sp)]
|
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0)
|
||||||
if pos then
|
if pos then
|
||||||
minetest.add_entity(pos,"mobs_mc:pillager")
|
minetest.add_entity(pos,"mobs_mc:pillager")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pos = sp[pr:next(1,#sp)]
|
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0)
|
||||||
if pos then
|
if pos then
|
||||||
minetest.add_entity(pos,"mobs_mc:evoker")
|
minetest.add_entity(pos,"mobs_mc:evoker")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue