summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/CaveSpider.cpp2
-rw-r--r--src/Mobs/Monster.cpp28
-rw-r--r--src/Mobs/Monster.h9
3 files changed, 15 insertions, 24 deletions
diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp
index ad3dda09e..7e0dd30c5 100644
--- a/src/Mobs/CaveSpider.cpp
+++ b/src/Mobs/CaveSpider.cpp
@@ -25,7 +25,7 @@ void cCaveSpider::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
return;
}
- m_EMPersonality = (GetWorld()->GetTimeOfDay() < (12000 + 1000)) ? PASSIVE : AGGRESSIVE;
+ m_EMPersonality = (GetWorld()->GetTimeOfDay() < 13000_tick) ? PASSIVE : AGGRESSIVE;
}
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 09c0974a0..74cceff91 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -1150,34 +1150,26 @@ cMonster::eFamily cMonster::FamilyFromType(eMonsterType a_Type)
case mtZombieHorse: return mfPassive;
case mtZombiePigman: return mfHostile;
case mtZombieVillager: return mfHostile;
-
- default:
- {
- ASSERT(!"Unhandled mob type");
- return mfUnhandled;
- }
+ case mtInvalidType: break;
}
+ UNREACHABLE("Unhandled mob type");
}
-int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily)
+cTickTime cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily)
{
switch (a_MobFamily)
{
- case mfHostile: return 40;
- case mfPassive: return 40;
- case mfAmbient: return 40;
- case mfWater: return 400;
- case mfNoSpawn: return -1;
- default:
- {
- ASSERT(!"Unhandled mob family");
- return -1;
- }
+ case mfHostile: return 40_tick;
+ case mfPassive: return 40_tick;
+ case mfAmbient: return 40_tick;
+ case mfWater: return 400_tick;
+ case mfNoSpawn: return -1_tick;
}
+ UNREACHABLE("Unhandled mob family");
}
@@ -1654,7 +1646,7 @@ bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
if (
(Chunk->GetBlock(Rel) != E_BLOCK_SOULSAND) && // Not on soulsand
- (GetWorld()->GetTimeOfDay() < 12000 + 1000) && // Daytime
+ (GetWorld()->GetTimeOfDay() < 13000_tick) && // Daytime
Chunk->IsWeatherSunnyAt(Rel.x, Rel.z) && // Not raining
!IsInWater() // Isn't swimming
)
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 830919c22..aca32e0ef 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -32,8 +32,7 @@ public:
mfAmbient = 2, // Bats
mfWater = 3, // Squid, Guardian
- mfNoSpawn,
- mfUnhandled, // Nothing. Be sure this is the last and the others are in order
+ mfNoSpawn
} ;
// tolua_end
@@ -187,11 +186,11 @@ public:
/** Returns the mob family based on the type */
static eFamily FamilyFromType(eMonsterType a_MobType);
- /** Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family */
- static int GetSpawnDelay(cMonster::eFamily a_MobFamily);
-
// tolua_end
+ /** Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family */
+ static cTickTime GetSpawnDelay(cMonster::eFamily a_MobFamily);
+
/** Translates the MobType enum to the vanilla nbt name */
static AString MobTypeToVanillaNBT(eMonsterType a_MobType);