assorted mob tweaks

This commit is contained in:
darkrose 2015-10-10 16:04:20 +10:00
parent f4b6ed653b
commit a62ff30da9
3 changed files with 27 additions and 6 deletions

View File

@ -768,9 +768,7 @@ void content_mob_init()
f->motion_type = MMT_WALK;
f->sound_random = "mob-sheep-env";
f->sound_random_extra = "mob-ducksheep-env";
f->spawn_min_height = 2;
f->spawn_max_height = 50;
f->spawn_group = 4;
f->spawn_naturally = false;
f->lifetime = 1800.0;
f->setCollisionBox(aabb3f(-0.4*BS, 0., -0.4*BS, 0.4*BS, 1.*BS, 0.4*BS));
lists::add("creative",CONTENT_TOOLITEM_MOB_SPAWNER,1,i);

View File

@ -1049,7 +1049,7 @@ void ServerEnvironment::step(float dtime)
// TODO: don't spawn if there was a recent one nearby
if (
active_object_count_wider < 5
active_object_count_wider < 6
&& (
block->last_spawn < m_time_of_day-6000
|| block->last_spawn > m_time_of_day+6000
@ -1073,7 +1073,7 @@ void ServerEnvironment::step(float dtime)
if (block->has_spawn_area) {
// dawn, passive mobs spawn
if (m_time_of_day > 7000 && m_time_of_day < 8000) {
if (active_object_count_wider < 2) {
if (!active_object_count_wider) {
if (block->water_spawn) {
if (n.getContent() == CONTENT_SAND)
mob_spawn_passive(block->spawn_area+block->getPosRelative(),block->water_spawn,this);
@ -1097,7 +1097,18 @@ void ServerEnvironment::step(float dtime)
// dusk, hostile mobs spawn, or fireflies
}else if (m_time_of_day > 19000 && m_time_of_day < 20000) {
if (light <= LIGHT_SPAWN_DARK) {
if (n.getContent() == CONTENT_STONE || n.getContent() == CONTENT_SAND) {
if (
(
n.getContent() == CONTENT_STONE
|| n.getContent() == CONTENT_SAND
) && (
block->water_spawn
|| (
block->getPos().Y > 0
|| myrand_range(0,5) == 0
)
)
) {
mob_spawn_hostile(block->spawn_area+block->getPosRelative(),block->water_spawn,this);
}else if (n1.getContent() == CONTENT_JUNGLEGRASS) {
mob_spawn(block->spawn_area+block->getPosRelative(),CONTENT_MOB_FIREFLY,this);

View File

@ -85,6 +85,12 @@ public:
v3f getPosition()
{
if (m_position.X > 30000*BS || m_position.X < -30000*BS)
m_position.X = ((s32)m_position.X)%(30000*BS);
if (m_position.Y > 30000*BS || m_position.Y < -30000*BS)
m_position.Y = ((s32)m_position.Y)%(30000*BS);
if (m_position.Z > 30000*BS || m_position.Z < -30000*BS)
m_position.Z = ((s32)m_position.Z)%(30000*BS);
return m_position;
}
@ -108,6 +114,12 @@ public:
virtual void setPosition(const v3f &position)
{
m_position = position;
if (m_position.X > 30000*BS || m_position.X < -30000*BS)
m_position.X = ((s32)m_position.X)%(30000*BS);
if (m_position.Y > 30000*BS || m_position.Y < -30000*BS)
m_position.Y = ((s32)m_position.Y)%(30000*BS);
if (m_position.Z > 30000*BS || m_position.Z < -30000*BS)
m_position.Z = ((s32)m_position.Z)%(30000*BS);
}
void setPitch(f32 pitch)