1
0

Miscellaneous improvements

This commit is contained in:
Tiger Wang 2014-01-24 21:55:04 +00:00
parent bf2af73899
commit a988063915
3 changed files with 19 additions and 30 deletions

View File

@ -6,20 +6,14 @@
#endif #endif
#include "Pickup.h" #include "Pickup.h"
#include "../ClientHandle.h"
#include "../Inventory.h"
#include "../World.h"
#include "../Simulator/FluidSimulator.h"
#include "../Server.h"
#include "Player.h" #include "Player.h"
#include "../ClientHandle.h"
#include "../World.h"
#include "../Server.h"
#include "../Bindings/PluginManager.h" #include "../Bindings/PluginManager.h"
#include "../Item.h"
#include "../Root.h" #include "../Root.h"
#include "../Chunk.h" #include "../Chunk.h"
#include "../Vector3d.h"
#include "../Vector3f.h"

View File

@ -74,13 +74,12 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
, m_AttackRate(3) , m_AttackRate(3)
, m_IdleInterval(0) , m_IdleInterval(0)
, m_bMovingToDestination(false) , m_bMovingToDestination(false)
, m_DestinationTime( 0 )
, m_DestroyTimer(0) , m_DestroyTimer(0)
, m_MobType(a_MobType) , m_MobType(a_MobType)
, m_SoundHurt(a_SoundHurt) , m_SoundHurt(a_SoundHurt)
, m_SoundDeath(a_SoundDeath) , m_SoundDeath(a_SoundDeath)
, m_AttackDamage(1.0f) , m_AttackDamage(1)
, m_AttackRange(2.0f) , m_AttackRange(2)
, m_AttackInterval(0) , m_AttackInterval(0)
, m_BurnsInDaylight(false) , m_BurnsInDaylight(false)
{ {
@ -492,7 +491,7 @@ void cMonster::KilledBy(cEntity * a_Killer)
void cMonster::CheckEventSeePlayer(void) void cMonster::CheckEventSeePlayer(void)
{ {
// TODO: Rewrite this to use cWorld's DoWithPlayers() // TODO: Rewrite this to use cWorld's DoWithPlayers()
cPlayer * Closest = m_World->FindClosestPlayer(GetPosition(), m_SightDistance); cPlayer * Closest = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
if (Closest != NULL) if (Closest != NULL)
{ {

View File

@ -168,6 +168,11 @@ protected:
If current Y is nonsolid, goes down to try to find a solid block, then returns that + 1 If current Y is nonsolid, goes down to try to find a solid block, then returns that + 1
If current Y is solid, goes up to find first nonsolid block, and returns that */ If current Y is solid, goes up to find first nonsolid block, and returns that */
int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ); int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ);
/** Returns if a monster can actually reach a given height by jumping */
inline bool IsNextYPosReachable(int a_PosY)
{
return (a_PosY > (int)floor(GetPosY())) && (a_PosY == (int)floor(GetPosY()) + 1);
}
/** A semi-temporary list to store the traversed coordinates during active pathfinding so we don't visit them again */ /** A semi-temporary list to store the traversed coordinates during active pathfinding so we don't visit them again */
std::vector<Vector3i> m_TraversedCoordinates; std::vector<Vector3i> m_TraversedCoordinates;
@ -188,14 +193,9 @@ protected:
/* ===========================*/ /* ===========================*/
float m_AttackRate;
float m_IdleInterval; float m_IdleInterval;
bool m_bPassiveAggressive;
float m_DestinationTime;
float m_DestroyTimer; float m_DestroyTimer;
eType m_MobType; eType m_MobType;
@ -203,21 +203,17 @@ protected:
AString m_SoundHurt; AString m_SoundHurt;
AString m_SoundDeath; AString m_SoundDeath;
float m_AttackRate;
int m_AttackDamage; int m_AttackDamage;
int m_AttackRange; int m_AttackRange;
float m_AttackInterval; float m_AttackInterval;
int m_SightDistance; int m_SightDistance;
void HandleDaylightBurning(cChunk & a_Chunk);
bool m_BurnsInDaylight; bool m_BurnsInDaylight;
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0); void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
void HandleDaylightBurning(cChunk & a_Chunk);
inline bool IsNextYPosReachable(int a_PosY)
{
return (a_PosY > (int)floor(GetPosY())) && (a_PosY == (int)floor(GetPosY()) + 1);
}
} ; // tolua_export } ; // tolua_export