summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/Entities
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/ArrowEntity.h46
-rw-r--r--src/Entities/Boat.cpp8
-rw-r--r--src/Entities/Boat.h6
-rw-r--r--src/Entities/EnderCrystal.cpp2
-rw-r--r--src/Entities/EntityEffect.cpp50
-rw-r--r--src/Entities/EntityEffect.h72
-rw-r--r--src/Entities/ExpBottleEntity.h14
-rw-r--r--src/Entities/ExpOrb.cpp6
-rw-r--r--src/Entities/ExpOrb.h4
-rw-r--r--src/Entities/FallingBlock.cpp10
-rw-r--r--src/Entities/FallingBlock.h6
-rw-r--r--src/Entities/FireChargeEntity.h16
-rw-r--r--src/Entities/FireworkEntity.cpp10
-rw-r--r--src/Entities/FireworkEntity.h18
-rw-r--r--src/Entities/Floater.cpp8
-rw-r--r--src/Entities/Floater.h4
-rw-r--r--src/Entities/GhastFireballEntity.h18
-rw-r--r--src/Entities/HangingEntity.h2
-rw-r--r--src/Entities/Minecart.cpp20
-rw-r--r--src/Entities/Minecart.h38
-rw-r--r--src/Entities/Pickup.cpp8
-rw-r--r--src/Entities/SplashPotionEntity.cpp8
-rw-r--r--src/Entities/SplashPotionEntity.h22
-rw-r--r--src/Entities/TNTEntity.cpp2
-rw-r--r--src/Entities/TNTEntity.h16
-rw-r--r--src/Entities/ThrownEggEntity.h16
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp6
-rw-r--r--src/Entities/ThrownEnderPearlEntity.h16
-rw-r--r--src/Entities/ThrownSnowballEntity.h14
-rw-r--r--src/Entities/WitherSkullEntity.cpp4
-rw-r--r--src/Entities/WitherSkullEntity.h14
31 files changed, 242 insertions, 242 deletions
diff --git a/src/Entities/ArrowEntity.h b/src/Entities/ArrowEntity.h
index 2ecc16d1c..7ed99b79e 100644
--- a/src/Entities/ArrowEntity.h
+++ b/src/Entities/ArrowEntity.h
@@ -22,7 +22,7 @@ class cArrowEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
/** Determines when the arrow can be picked up (depending on player gamemode). Corresponds to the MCA file "pickup" field */
enum ePickupState
@@ -31,78 +31,78 @@ public:
psInSurvivalOrCreative = 1,
psInCreative = 2,
} ;
-
+
// tolua_end
-
+
CLASS_PROTODEF(cArrowEntity)
-
+
/** Creates a new arrow with psNoPickup state and default damage modifier coeff */
cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
/** Creates a new arrow as shot by a player, initializes it from the player object */
cArrowEntity(cPlayer & a_Player, double a_Force);
-
+
// tolua_begin
-
+
/** Returns whether the arrow can be picked up by players */
ePickupState GetPickupState(void) const { return m_PickupState; }
-
+
/** Sets a new pickup state */
void SetPickupState(ePickupState a_PickupState) { m_PickupState = a_PickupState; }
-
+
/** Returns the damage modifier coeff. */
double GetDamageCoeff(void) const { return m_DamageCoeff; }
/** Sets the damage modifier coeff */
void SetDamageCoeff(double a_DamageCoeff) { m_DamageCoeff = a_DamageCoeff; }
-
+
/** Returns true if the specified player can pick the arrow up */
bool CanPickup(const cPlayer & a_Player) const;
-
+
/** Returns true if the arrow is set as critical */
bool IsCritical(void) const { return m_IsCritical; }
-
+
/** Sets the IsCritical flag */
void SetIsCritical(bool a_IsCritical) { m_IsCritical = a_IsCritical; }
/** Gets the block arrow is in */
Vector3i GetBlockHit(void) const { return m_HitBlockPos; }
-
+
// tolua_end
/** Sets the block arrow is in. To be used by the MCA loader only! */
void SetBlockHit(const Vector3i & a_BlockHit) { m_HitBlockPos = a_BlockHit; }
-
+
protected:
-
+
/** Determines when the arrow can be picked up by players */
ePickupState m_PickupState;
-
+
/** The coefficient applied to the damage that the arrow will deal, based on the bow enchantment. 2.0 for normal arrow */
double m_DamageCoeff;
-
+
/** If true, the arrow deals more damage */
bool m_IsCritical;
-
+
/** Timer for pickup collection animation or five minute timeout */
std::chrono::milliseconds m_Timer;
-
+
/** Timer for client arrow position confirmation via TeleportEntity */
std::chrono::milliseconds m_HitGroundTimer;
-
+
// Whether the arrow has already been teleported into the proper position in the ground.
bool m_HasTeleported;
-
+
/** If true, the arrow is in the process of being collected - don't go to anyone else */
bool m_bIsCollected;
/** Stores the block position that arrow is lodged into, sets m_IsInGround to false if it becomes air */
Vector3i m_HitBlockPos;
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
virtual void CollectedBy(cPlayer & a_Player) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
+
}; // tolua_export
diff --git a/src/Entities/Boat.cpp b/src/Entities/Boat.cpp
index 4ad418be4..e81e57529 100644
--- a/src/Entities/Boat.cpp
+++ b/src/Entities/Boat.cpp
@@ -74,17 +74,17 @@ void cBoat::OnRightClicked(cPlayer & a_Player)
a_Player.Detach();
return;
}
-
+
if (m_Attachee->IsPlayer())
{
// Another player is already sitting in here, cannot attach
return;
}
-
+
// Detach whatever is sitting in this boat now:
m_Attachee->Detach();
}
-
+
// Attach the player to this boat
a_Player.AttachTo(this);
}
@@ -124,7 +124,7 @@ void cBoat::HandleSpeedFromAttachee(float a_Forward, float a_Sideways)
{
return;
}
-
+
Vector3d ToAddSpeed = m_Attachee->GetLookVector() * (a_Sideways * 0.4) ;
ToAddSpeed.y = 0;
diff --git a/src/Entities/Boat.h b/src/Entities/Boat.h
index a873ff822..d168f5072 100644
--- a/src/Entities/Boat.h
+++ b/src/Entities/Boat.h
@@ -19,17 +19,17 @@ class cBoat :
public cEntity
{
typedef cEntity super;
-
+
public:
CLASS_PROTODEF(cBoat)
-
+
// cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways) override;
-
+
cBoat(double a_X, double a_Y, double a_Z);
} ;
diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp
index b71d70bdd..79d0c50cb 100644
--- a/src/Entities/EnderCrystal.cpp
+++ b/src/Entities/EnderCrystal.cpp
@@ -46,7 +46,7 @@ void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI)
m_World->DoExplosionAt(6.0, GetPosX(), GetPosY(), GetPosZ(), true, esEnderCrystal, this);
Destroy();
-
+
m_World->SetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT, E_BLOCK_BEDROCK, 0);
m_World->SetBlock(POSX_TOINT, POSY_TOINT + 1, POSZ_TOINT, E_BLOCK_FIRE, 0);
}
diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp
index 214cbcc2b..6d56f4196 100644
--- a/src/Entities/EntityEffect.cpp
+++ b/src/Entities/EntityEffect.cpp
@@ -69,7 +69,7 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
// Base duration in ticks
int base = 0;
double TierCoeff = 1, ExtCoeff = 1, SplashCoeff = 1;
-
+
switch (GetPotionEffectType(a_ItemDamage))
{
case cEntityEffect::effRegeneration:
@@ -78,7 +78,7 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
base = 900;
break;
}
-
+
case cEntityEffect::effSpeed:
case cEntityEffect::effFireResistance:
case cEntityEffect::effNightVision:
@@ -89,7 +89,7 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
base = 3600;
break;
}
-
+
case cEntityEffect::effWeakness:
case cEntityEffect::effSlowness:
{
@@ -98,22 +98,22 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
}
default: break;
}
-
+
// If potion is level II, half the duration. If not, stays the same
TierCoeff = (GetPotionEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1;
-
+
// If potion is extended, multiply duration by 8 / 3. If not, stays the same
// Extended potion if sixth lowest bit is set
ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1;
-
+
// If potion is splash potion, multiply duration by 3 / 4. If not, stays the same
SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75;
-
+
// Ref.:
// http://minecraft.gamepedia.com/Data_values#.22Tier.22_bit
// http://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit
// http://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit
-
+
return static_cast<int>(base * TierCoeff * ExtCoeff * SplashCoeff);
}
@@ -138,7 +138,7 @@ cEntityEffect::cEntityEffect():
m_Intensity(0),
m_DistanceModifier(1)
{
-
+
}
@@ -151,7 +151,7 @@ cEntityEffect::cEntityEffect(int a_Duration, short a_Intensity, double a_Distanc
m_Intensity(a_Intensity),
m_DistanceModifier(a_DistanceModifier)
{
-
+
}
@@ -164,7 +164,7 @@ cEntityEffect::cEntityEffect(const cEntityEffect & a_OtherEffect):
m_Intensity(a_OtherEffect.m_Intensity),
m_DistanceModifier(a_OtherEffect.m_DistanceModifier)
{
-
+
}
@@ -189,7 +189,7 @@ cEntityEffect * cEntityEffect::CreateEntityEffect(cEntityEffect::eType a_EffectT
switch (a_EffectType)
{
case cEntityEffect::effNoEffect: return new cEntityEffect (a_Duration, a_Intensity, a_DistanceModifier);
-
+
case cEntityEffect::effAbsorption: return new cEntityEffectAbsorption (a_Duration, a_Intensity, a_DistanceModifier);
case cEntityEffect::effBlindness: return new cEntityEffectBlindness (a_Duration, a_Intensity, a_DistanceModifier);
case cEntityEffect::effFireResistance: return new cEntityEffectFireResistance(a_Duration, a_Intensity, a_DistanceModifier);
@@ -214,7 +214,7 @@ cEntityEffect * cEntityEffect::CreateEntityEffect(cEntityEffect::eType a_EffectT
case cEntityEffect::effWeakness: return new cEntityEffectWeakness (a_Duration, a_Intensity, a_DistanceModifier);
case cEntityEffect::effWither: return new cEntityEffectWither (a_Duration, a_Intensity, a_DistanceModifier);
}
-
+
ASSERT(!"Unhandled entity effect type!");
return nullptr;
}
@@ -326,7 +326,7 @@ void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target)
{
// Base amount = 6, doubles for every increase in intensity
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
-
+
if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.TakeDamage(dtPotionOfHarming, nullptr, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage
@@ -346,7 +346,7 @@ void cEntityEffectInstantDamage::OnActivate(cPawn & a_Target)
{
// Base amount = 6, doubles for every increase in intensity
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
-
+
if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.Heal(amount);
@@ -370,10 +370,10 @@ void cEntityEffectRegeneration::OnTick(cPawn & a_Target)
{
return;
}
-
+
// Regen frequency = 50 ticks, divided by potion level (Regen II = 25 ticks)
int frequency = FloorC(50.0 / static_cast<double>(m_Intensity + 1));
-
+
if ((m_Ticks % frequency) != 0)
{
return;
@@ -392,7 +392,7 @@ void cEntityEffectRegeneration::OnTick(cPawn & a_Target)
void cEntityEffectHunger::OnTick(cPawn & a_Target)
{
super::OnTick(a_Target);
-
+
if (a_Target.IsPlayer())
{
cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
@@ -410,10 +410,10 @@ void cEntityEffectHunger::OnTick(cPawn & a_Target)
void cEntityEffectWeakness::OnTick(cPawn & a_Target)
{
super::OnTick(a_Target);
-
+
// Damage reduction = 0.5 damage, multiplied by potion level (Weakness II = 1 damage)
// double dmg_reduc = 0.5 * (a_Effect.GetIntensity() + 1);
-
+
// TODO: Implement me!
// TODO: Weakened villager zombies can be turned back to villagers with the god apple
}
@@ -428,11 +428,11 @@ void cEntityEffectWeakness::OnTick(cPawn & a_Target)
void cEntityEffectPoison::OnTick(cPawn & a_Target)
{
super::OnTick(a_Target);
-
+
if (a_Target.IsMob())
{
cMonster & Target = reinterpret_cast<cMonster &>(a_Target);
-
+
// Doesn't effect undead mobs, spiders
if (
Target.IsUndead() ||
@@ -443,10 +443,10 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target)
return;
}
}
-
+
// Poison frequency = 25 ticks, divided by potion level (Poison II = 12 ticks)
int frequency = FloorC(25.0 / static_cast<double>(m_Intensity + 1));
-
+
if ((m_Ticks % frequency) == 0)
{
// Cannot take poison damage when health is at 1
@@ -467,7 +467,7 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target)
void cEntityEffectWither::OnTick(cPawn & a_Target)
{
super::OnTick(a_Target);
-
+
// Damage frequency = 40 ticks, divided by effect level (Wither II = 20 ticks)
int frequency = FloorC(25.0 / static_cast<double>(m_Intensity + 1));
diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h
index 7cf9cd3d5..aa18b500e 100644
--- a/src/Entities/EntityEffect.h
+++ b/src/Entities/EntityEffect.h
@@ -6,7 +6,7 @@ class cPawn;
class cEntityEffect
{
public:
-
+
/** All types of entity effects (numbers correspond to protocol / storage types) */
enum eType
{
@@ -35,46 +35,46 @@ public:
effAbsorption = 22,
effSaturation = 23,
} ;
-
+
/** Returns the potion color (used by the client for visuals), based on the potion's damage value */
static int GetPotionColor(short a_ItemDamage);
-
-
+
+
/** Translates the potion's damage value into the entity effect that the potion gives */
static cEntityEffect::eType GetPotionEffectType(short a_ItemDamage);
-
-
+
+
/** Retrieves the intensity level from the potion's damage value. Returns 0 for level I potions, 1 for level II potions. */
static short GetPotionEffectIntensity(short a_ItemDamage);
-
-
+
+
/** Returns the effect duration, in ticks, based on the potion's damage value */
static int GetPotionEffectDuration(short a_ItemDamage);
-
+
/** Returns true if the potion with the given damage is drinkable */
static bool IsPotionDrinkable(short a_ItemDamage);
-
+
// tolua_end
-
+
/** Creates an empty entity effect */
cEntityEffect(void);
-
+
/** Creates an entity effect of the specified type
@param a_Duration How long this effect will last, in ticks
@param a_Intensity How strong the effect will be applied
@param a_DistanceModifier The distance modifier for affecting potency, defaults to 1 */
cEntityEffect(int a_Duration, short a_Intensity, double a_DistanceModifier = 1);
-
+
/** Creates an entity effect by copying another
@param a_OtherEffect The other effect to copy */
cEntityEffect(const cEntityEffect & a_OtherEffect);
-
+
/** Creates an entity effect by copying another
@param a_OtherEffect The other effect to copy */
cEntityEffect & operator =(cEntityEffect a_OtherEffect);
-
+
virtual ~cEntityEffect(void) {}
-
+
/** Creates a pointer to the proper entity effect from the effect type
@warning This function creates raw pointers that must be manually managed.
@param a_EffectType The effect type to create the effect from
@@ -82,44 +82,44 @@ public:
@param a_Intensity How strong the effect will be applied
@param a_DistanceModifier The distance modifier for affecting potency, defaults to 1 */
static cEntityEffect * CreateEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, double a_DistanceModifier);
-
+
/** Returns how many ticks this effect has been active for */
int GetTicks(void) const { return m_Ticks; }
-
+
/** Returns the duration of the effect */
int GetDuration(void) const { return m_Duration; }
-
+
/** Returns how strong the effect will be applied */
short GetIntensity(void) const { return m_Intensity; }
-
+
/** Returns the distance modifier for affecting potency */
double GetDistanceModifier(void) const { return m_DistanceModifier; }
-
+
void SetTicks(int a_Ticks) { m_Ticks = a_Ticks; }
void SetDuration(int a_Duration) { m_Duration = a_Duration; }
void SetIntensity(short a_Intensity) { m_Intensity = a_Intensity; }
void SetDistanceModifier(double a_DistanceModifier) { m_DistanceModifier = a_DistanceModifier; }
-
+
/** Called on each tick.
By default increases the m_Ticks, descendants may override to provide additional processing. */
virtual void OnTick(cPawn & a_Target);
-
+
/** Called when the effect is first added to an entity */
virtual void OnActivate(cPawn & a_Target) { }
-
+
/** Called when the effect is removed from an entity */
virtual void OnDeactivate(cPawn & a_Target) { }
-
+
protected:
/** How many ticks this effect has been active for */
int m_Ticks;
-
+
/** How long this effect will last, in ticks */
int m_Duration;
-
+
/** How strong the effect will be applied */
short m_Intensity;
-
+
/** The distance modifier for affecting potency */
double m_DistanceModifier;
}; // tolua_export
@@ -220,7 +220,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
virtual void OnActivate(cPawn & a_Target) override;
};
@@ -237,7 +237,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
virtual void OnActivate(cPawn & a_Target) override;
};
@@ -284,7 +284,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
virtual void OnTick(cPawn & a_Target) override;
};
@@ -391,7 +391,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
// cEntityEffect overrides:
virtual void OnTick(cPawn & a_Target) override;
};
@@ -409,7 +409,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
// cEntityEffect overrides:
virtual void OnTick(cPawn & a_Target) override;
};
@@ -427,7 +427,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
// cEntityEffect overrides:
virtual void OnTick(cPawn & a_Target) override;
};
@@ -445,7 +445,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
// cEntityEffect overrides:
virtual void OnTick(cPawn & a_Target) override;
};
@@ -493,7 +493,7 @@ public:
super(a_Duration, a_Intensity, a_DistanceModifier)
{
}
-
+
virtual void OnTick(cPawn & a_Target) override;
};
diff --git a/src/Entities/ExpBottleEntity.h b/src/Entities/ExpBottleEntity.h
index 715b9947e..ea0c2b5a9 100644
--- a/src/Entities/ExpBottleEntity.h
+++ b/src/Entities/ExpBottleEntity.h
@@ -21,17 +21,17 @@ class cExpBottleEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cExpBottleEntity)
-
+
cExpBottleEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
protected:
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
@@ -39,7 +39,7 @@ protected:
/** Breaks the bottle, fires its particle effects and sounds
@param a_HitPos The position where the bottle will break */
void Break(const Vector3d & a_HitPos);
-
+
}; // tolua_export
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp
index 676370508..f51bbb300 100644
--- a/src/Entities/ExpOrb.cpp
+++ b/src/Entities/ExpOrb.cpp
@@ -55,9 +55,9 @@ void cExpOrb::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward);
a_ClosestPlayer->DeltaExperience(m_Reward);
-
+
m_World->BroadcastSoundEffect("random.orb", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
-
+
Destroy();
}
a_Distance.Normalize();
@@ -68,7 +68,7 @@ void cExpOrb::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
BroadcastMovementUpdate();
}
HandlePhysics(a_Dt, a_Chunk);
-
+
m_Timer += a_Dt;
if (m_Timer >= std::chrono::minutes(5))
{
diff --git a/src/Entities/ExpOrb.h b/src/Entities/ExpOrb.h
index 9aac4f748..bb4c79c8e 100644
--- a/src/Entities/ExpOrb.h
+++ b/src/Entities/ExpOrb.h
@@ -12,7 +12,7 @@ class cExpOrb :
public cEntity
{
typedef cEntity super;
-
+
public:
// tolua_end
@@ -39,7 +39,7 @@ public:
protected:
int m_Reward;
-
+
/** The number of ticks that the entity has existed / timer between collect and destroy; in msec */
std::chrono::milliseconds m_Timer;
} ; // tolua_export
diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp
index bae13ea66..be98ba44b 100644
--- a/src/Entities/FallingBlock.cpp
+++ b/src/Entities/FallingBlock.cpp
@@ -36,11 +36,11 @@ void cFallingBlock::SpawnOn(cClientHandle & a_ClientHandle)
void cFallingBlock::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// GetWorld()->BroadcastTeleportEntity(*this); // Test position
-
+
int BlockX = POSX_TOINT;
int BlockY = static_cast<int>(GetPosY() - 0.5);
int BlockZ = POSZ_TOINT;
-
+
if (BlockY < 0)
{
// Fallen out of this world, just continue falling until out of sight, then destroy:
@@ -50,13 +50,13 @@ void cFallingBlock::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
return;
}
-
+
if (BlockY >= cChunkDef::Height)
{
// Above the world, just wait for it to fall back down
return;
}
-
+
BLOCKTYPE BlockBelow = a_Chunk.GetBlock(BlockX - a_Chunk.GetPosX() * cChunkDef::Width, BlockY, BlockZ - a_Chunk.GetPosZ() * cChunkDef::Width);
NIBBLETYPE BelowMeta = a_Chunk.GetMeta(BlockX - a_Chunk.GetPosX() * cChunkDef::Width, BlockY, BlockZ - a_Chunk.GetPosZ() * cChunkDef::Width);
if (cSandSimulator::DoesBreakFallingThrough(BlockBelow, BelowMeta))
@@ -86,7 +86,7 @@ void cFallingBlock::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
Destroy(true);
return;
}
-
+
float MilliDt = a_Dt.count() * 0.001f;
AddSpeedY(MilliDt * -9.8f);
AddPosition(GetSpeed() * MilliDt);
diff --git a/src/Entities/FallingBlock.h b/src/Entities/FallingBlock.h
index 0027bfa2a..3e80564e5 100644
--- a/src/Entities/FallingBlock.h
+++ b/src/Entities/FallingBlock.h
@@ -18,7 +18,7 @@ class cFallingBlock :
public cEntity
{
typedef cEntity super;
-
+
public:
CLASS_PROTODEF(cFallingBlock)
@@ -27,11 +27,11 @@ public:
BLOCKTYPE GetBlockType(void) const { return m_BlockType; }
NIBBLETYPE GetBlockMeta(void) const { return m_BlockMeta; }
-
+
// cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
+
private:
BLOCKTYPE m_BlockType;
NIBBLETYPE m_BlockMeta;
diff --git a/src/Entities/FireChargeEntity.h b/src/Entities/FireChargeEntity.h
index 25f04cb7c..e17b25903 100644
--- a/src/Entities/FireChargeEntity.h
+++ b/src/Entities/FireChargeEntity.h
@@ -21,23 +21,23 @@ class cFireChargeEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cFireChargeEntity)
-
+
cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
protected:
-
+
void Explode(Vector3i a_Block);
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
-
+
} ; // tolua_export
diff --git a/src/Entities/FireworkEntity.cpp b/src/Entities/FireworkEntity.cpp
index 89f69f113..552549b7c 100644
--- a/src/Entities/FireworkEntity.cpp
+++ b/src/Entities/FireworkEntity.cpp
@@ -26,14 +26,14 @@ void cFireworkEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_C
int RelX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width;
int RelZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width;
int PosY = POSY_TOINT;
-
+
if ((PosY < 0) || (PosY >= cChunkDef::Height))
{
AddSpeedY(1);
AddPosition(GetSpeed() * (static_cast<double>(a_Dt.count()) / 1000));
return;
}
-
+
if (m_IsInGround)
{
if (a_Chunk.GetBlock(RelX, POSY_TOINT + 1, RelZ) == E_BLOCK_AIR)
@@ -53,7 +53,7 @@ void cFireworkEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_C
return;
}
}
-
+
AddSpeedY(1);
AddPosition(GetSpeed() * (static_cast<double>(a_Dt.count()) / 1000));
}
@@ -65,7 +65,7 @@ void cFireworkEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_C
void cFireworkEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
-
+
if (m_TicksToExplosion <= 0)
{
// TODO: Notify the plugins
@@ -73,6 +73,6 @@ void cFireworkEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
Destroy();
return;
}
-
+
m_TicksToExplosion -= 1;
}
diff --git a/src/Entities/FireworkEntity.h b/src/Entities/FireworkEntity.h
index c0a38a943..228960fb1 100644
--- a/src/Entities/FireworkEntity.h
+++ b/src/Entities/FireworkEntity.h
@@ -21,13 +21,13 @@ class cFireworkEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cFireworkEntity)
-
+
cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item);
// tolua_begin
@@ -45,18 +45,18 @@ public:
void SetTicksToExplosion(int a_TicksToExplosion) { m_TicksToExplosion = a_TicksToExplosion; }
// tolua_end
-
+
protected:
-
+
// cProjectileEntity overrides:
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
+
private:
-
+
int m_TicksToExplosion;
cItem m_FireworkItem;
-
+
}; // tolua_export
diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp
index 0b96f12df..b405c5f65 100644
--- a/src/Entities/Floater.cpp
+++ b/src/Entities/Floater.cpp
@@ -49,7 +49,7 @@ public:
m_MinCoeff = LineCoeff;
m_HitEntity = a_Entity;
}
-
+
// Don't break the enumeration, we want all the entities
return false;
}
@@ -91,7 +91,7 @@ public:
m_EntityExists = true;
return false;
}
-
+
bool DoesExist(void) const { return m_EntityExists; }
protected:
bool m_EntityExists;
@@ -153,7 +153,7 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_ParticlePos = (m_ParticlePos + (GetPosition() - m_ParticlePos) / 6);
m_World->GetBroadcaster().BroadcastParticleEffect("splash", static_cast<Vector3f>(m_ParticlePos), Vector3f{}, 0, 15);
}
-
+
m_CountDownTime--;
if (m_World->GetHeight(POSX_TOINT, POSZ_TOINT) == POSY_TOINT)
{
@@ -186,7 +186,7 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
if ((GetSpeed().Length() > 4) && (m_AttachedMobID == cEntity::INVALID_ID))
{
cFloaterEntityCollisionCallback Callback(this, GetPosition(), GetPosition() + GetSpeed() / 20);
-
+
a_Chunk.ForEachEntity(Callback);
if (Callback.HasHit())
{
diff --git a/src/Entities/Floater.h b/src/Entities/Floater.h
index e7818c915..89ee8cc08 100644
--- a/src/Entities/Floater.h
+++ b/src/Entities/Floater.h
@@ -12,7 +12,7 @@ class cFloater :
public cEntity
{
typedef cEntity super;
-
+
public:
// tolua_end
@@ -22,7 +22,7 @@ public:
virtual void SpawnOn(cClientHandle & a_Client) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
+
// tolua_begin
bool CanPickup(void) const { return m_CanPickupItem; }
UInt32 GetOwnerID(void) const { return m_PlayerID; }
diff --git a/src/Entities/GhastFireballEntity.h b/src/Entities/GhastFireballEntity.h
index dc136dfc2..620efd9e6 100644
--- a/src/Entities/GhastFireballEntity.h
+++ b/src/Entities/GhastFireballEntity.h
@@ -21,25 +21,25 @@ class cGhastFireballEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cGhastFireballEntity)
-
+
cGhastFireballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
protected:
-
+
void Explode(Vector3i a_Block);
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
-
+
// TODO: Deflecting the fireballs by arrow- or sword- hits
-
+
} ; // tolua_export
diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h
index 003c22082..113d195f9 100644
--- a/src/Entities/HangingEntity.h
+++ b/src/Entities/HangingEntity.h
@@ -20,7 +20,7 @@ public:
CLASS_PROTODEF(cHangingEntity)
cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
-
+
// tolua_begin
/** Returns the direction in which the entity is facing. */
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 7274a7a41..9e91eec59 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -129,7 +129,7 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
BroadcastMovementUpdate();
return;
}
-
+
int RelPosX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width;
int RelPosZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width;
cChunk * Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(RelPosX, RelPosZ);
@@ -199,7 +199,7 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_bIsOnDetectorRail = true;
m_DetectorRailPosition = Vector3i(POSX_TOINT, POSY_TOINT, POSZ_TOINT);
}
-
+
// Broadcast positioning changes to client
BroadcastMovementUpdate();
}
@@ -214,7 +214,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::millisecon
NOTE: Please bear in mind that taking away from negatives make them even more negative,
adding to negatives make them positive, etc.
*/
-
+
switch (a_RailMeta)
{
case E_META_RAIL_ZM_ZP: // NORTHSOUTH
@@ -230,7 +230,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::millisecon
{
return;
}
-
+
if (GetSpeedZ() != NO_SPEED) // Don't do anything if cart is stationary
{
if (GetSpeedZ() > 0)
@@ -440,7 +440,7 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
{
return;
}
-
+
if (GetSpeedZ() != NO_SPEED)
{
if (GetSpeedZ() > NO_SPEED)
@@ -1022,7 +1022,7 @@ bool cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
if (GetHealth() <= 0)
{
Destroy();
-
+
cItems Drops;
switch (m_Payload)
{
@@ -1052,7 +1052,7 @@ bool cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
break;
}
}
-
+
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ());
}
return true;
@@ -1100,17 +1100,17 @@ void cRideableMinecart::OnRightClicked(cPlayer & a_Player)
a_Player.Detach();
return;
}
-
+
if (m_Attachee->IsPlayer())
{
// Another player is already sitting in here, cannot attach
return;
}
-
+
// Detach whatever is sitting in this minecart now:
m_Attachee->Detach();
}
-
+
// Attach the player to this minecart
a_Player.AttachTo(this);
}
diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h
index 1ae4e1359..e48df8fda 100644
--- a/src/Entities/Minecart.h
+++ b/src/Entities/Minecart.h
@@ -21,10 +21,10 @@ class cMinecart :
public cEntity
{
typedef cEntity super;
-
+
public:
CLASS_PROTODEF(cMinecart)
-
+
/** Minecart payload, values correspond to packet subtype */
enum ePayload
{
@@ -35,22 +35,22 @@ public:
mpHopper = 5, // Minecart-with-hopper, can be hopper
// TODO: Spawner minecarts, (and possibly any block in a minecart with NBT editing)
} ;
-
+
// cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
virtual void Destroyed() override;
-
+
int LastDamage(void) const { return m_LastDamage; }
ePayload GetPayload(void) const { return m_Payload; }
-
+
protected:
ePayload m_Payload;
int m_LastDamage;
Vector3i m_DetectorRailPosition;
bool m_bIsOnDetectorRail;
-
+
cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z);
/** Handles physics on normal rails
@@ -88,10 +88,10 @@ class cRideableMinecart :
public cMinecart
{
typedef cMinecart super;
-
+
public:
CLASS_PROTODEF(cRideableMinecart)
-
+
cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height);
const cItem & GetContent(void) const {return m_Content;}
@@ -114,10 +114,10 @@ class cMinecartWithChest :
public cEntityWindowOwner
{
typedef cMinecart super;
-
+
public:
CLASS_PROTODEF(cMinecartWithChest)
-
+
cMinecartWithChest(double a_X, double a_Y, double a_Z);
enum
@@ -125,7 +125,7 @@ public:
ContentsHeight = 3,
ContentsWidth = 9,
};
-
+
const cItem & GetSlot(int a_Idx) const { return m_Contents.GetSlot(a_Idx); }
void SetSlot(int a_Idx, const cItem & a_Item) { m_Contents.SetSlot(a_Idx, a_Item); }
@@ -149,7 +149,7 @@ protected:
m_World->MarkChunkDirty(GetChunkX(), GetChunkZ());
}
}
-
+
// cEntity overrides:
virtual void OnRightClicked(cPlayer & a_Player) override;
} ;
@@ -162,12 +162,12 @@ class cMinecartWithFurnace :
public cMinecart
{
typedef cMinecart super;
-
+
public:
CLASS_PROTODEF(cMinecartWithFurnace)
-
+
cMinecartWithFurnace(double a_X, double a_Y, double a_Z);
-
+
// cEntity overrides:
virtual void OnRightClicked(cPlayer & a_Player) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
@@ -194,10 +194,10 @@ class cMinecartWithTNT :
public cMinecart
{
typedef cMinecart super;
-
+
public:
CLASS_PROTODEF(cMinecartWithTNT)
-
+
cMinecartWithTNT(double a_X, double a_Y, double a_Z);
} ;
@@ -209,9 +209,9 @@ class cMinecartWithHopper :
public cMinecart
{
typedef cMinecart super;
-
+
public:
CLASS_PROTODEF(cMinecartWithHopper)
-
+
cMinecartWithHopper(double a_X, double a_Y, double a_Z);
} ;
diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp
index e4576a8f2..c2bcf3960 100644
--- a/src/Entities/Pickup.cpp
+++ b/src/Entities/Pickup.cpp
@@ -117,7 +117,7 @@ void cPickup::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
BroadcastMovementUpdate(); // Notify clients of position
m_Timer += a_Dt;
-
+
if (!m_bCollected)
{
int BlockY = POSY_TOINT;
@@ -128,10 +128,10 @@ void cPickup::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// Position might have changed due to physics. So we have to make sure we have the correct chunk.
GET_AND_VERIFY_CURRENT_CHUNK(CurrentChunk, BlockX, BlockZ)
-
+
int RelBlockX = BlockX - (CurrentChunk->GetPosX() * cChunkDef::Width);
int RelBlockZ = BlockZ - (CurrentChunk->GetPosZ() * cChunkDef::Width);
-
+
// If the pickup is on the bottommost block position, make it think the void is made of air: (#131)
BLOCKTYPE BlockBelow = (BlockY > 0) ? CurrentChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
BLOCKTYPE BlockIn = CurrentChunk->GetBlock(RelBlockX, BlockY, RelBlockZ);
@@ -199,7 +199,7 @@ bool cPickup::CollectedBy(cPlayer & a_Dest)
// LOG("Pickup %d cannot be collected by \"%s\", because it has already been collected.", m_UniqueID, a_Dest->GetName().c_str());
return false; // It's already collected!
}
-
+
// Two seconds if player created the pickup (vomiting), half a second if anything else
if (m_Timer < (m_bIsPlayerCreated ? std::chrono::seconds(2) : std::chrono::milliseconds(500)))
{
diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp
index ba806e50e..e61df0525 100644
--- a/src/Entities/SplashPotionEntity.cpp
+++ b/src/Entities/SplashPotionEntity.cpp
@@ -34,7 +34,7 @@ public:
m_EntityEffect(a_EntityEffect)
{
}
-
+
/** Called by cWorld::ForEachEntity(), adds the stored entity effect to the entity, if it is close enough. */
virtual bool Item(cEntity * a_Entity) override
{
@@ -55,7 +55,7 @@ public:
// TODO: better equation
double Reduction = -0.25 * SplashDistance + 1.0;
Reduction = std::max(Reduction, 0.0);
-
+
static_cast<cPawn *>(a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), Reduction);
return false;
}
@@ -65,7 +65,7 @@ private:
cEntityEffect::eType m_EntityEffectType;
const cEntityEffect & m_EntityEffect;
};
-
+
@@ -120,7 +120,7 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos)
{
cSplashPotionCallback Callback(a_HitPos, m_EntityEffectType, m_EntityEffect);
m_World->ForEachEntity(Callback);
-
+
m_World->BroadcastSoundParticleEffect(
EffectID::PARTICLE_SPLASH_POTION,
FloorC(a_HitPos.x),
diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h
index 264dc0eb9..c9831ce88 100644
--- a/src/Entities/SplashPotionEntity.h
+++ b/src/Entities/SplashPotionEntity.h
@@ -23,37 +23,37 @@ class cSplashPotionEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cSplashPotionEntity)
-
+
cSplashPotionEntity(
cEntity * a_Creator,
double a_X, double a_Y, double a_Z,
const Vector3d & a_Speed,
const cItem & a_Item
);
-
+
// tolua_begin
cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; }
cEntityEffect GetEntityEffect(void) const { return m_EntityEffect; }
int GetPotionColor(void) const { return m_PotionColor; }
-
+
void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; }
void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; }
void SetPotionColor(int a_PotionColor) { m_PotionColor = a_PotionColor; }
// tolua_end
-
+
protected:
-
+
cEntityEffect::eType m_EntityEffectType;
cEntityEffect m_EntityEffect;
int m_PotionColor;
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
@@ -74,11 +74,11 @@ protected:
super::Tick(a_Dt, a_Chunk);
}
}
-
+
/** Splashes the potion, fires its particle effects and sounds
@param a_HitPos The position where the potion will splash */
void Splash(const Vector3d & a_HitPos);
-
+
virtual void SpawnOn(cClientHandle & a_Client) override;
private:
diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp
index d849bd4c9..4d533ebe4 100644
--- a/src/Entities/TNTEntity.cpp
+++ b/src/Entities/TNTEntity.cpp
@@ -58,7 +58,7 @@ void cTNTEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
BroadcastMovementUpdate();
-
+
m_FuseTicks -= 1;
if (m_FuseTicks <= 0)
{
diff --git a/src/Entities/TNTEntity.h b/src/Entities/TNTEntity.h
index 9f894338e..5f1faa6b4 100644
--- a/src/Entities/TNTEntity.h
+++ b/src/Entities/TNTEntity.h
@@ -11,31 +11,31 @@ class cTNTEntity :
public cEntity
{
typedef cEntity super;
-
+
public:
// tolua_end
CLASS_PROTODEF(cTNTEntity)
cTNTEntity(double a_X, double a_Y, double a_Z, int a_FuseTicks = 80);
cTNTEntity(const Vector3d & a_Pos, int a_FuseTicks = 80);
-
+
// cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
+
// tolua_begin
-
+
/** Explode the tnt */
void Explode(void);
-
+
/** Returns the fuse ticks until the tnt will explode */
int GetFuseTicks(void) const { return m_FuseTicks; }
-
+
/** Set the fuse ticks until the tnt will explode */
void SetFuseTicks(int a_FuseTicks) { m_FuseTicks = a_FuseTicks; }
-
+
// tolua_end
-
+
protected:
int m_FuseTicks; ///< How much ticks is left, while the tnt will explode
}; // tolua_export
diff --git a/src/Entities/ThrownEggEntity.h b/src/Entities/ThrownEggEntity.h
index 620927c5d..f20cd41a1 100644
--- a/src/Entities/ThrownEggEntity.h
+++ b/src/Entities/ThrownEggEntity.h
@@ -21,22 +21,22 @@ class cThrownEggEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cThrownEggEntity)
-
+
cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
protected:
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
+
// Randomly decides whether to spawn a chicken where the egg lands.
void TrySpawnChicken(const Vector3d & a_HitPos);
@@ -44,7 +44,7 @@ private:
/** Time in ticks to wait for the hit animation to begin before destroying */
int m_DestroyTimer;
-
+
} ; // tolua_export
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index 12d826042..4b2e2f9ff 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -23,7 +23,7 @@ void cThrownEnderPearlEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockF
{
// TODO: Tweak a_HitPos based on block face.
TeleportCreator(a_HitPos);
-
+
m_DestroyTimer = 2;
}
@@ -35,10 +35,10 @@ void cThrownEnderPearlEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d
{
int TotalDamage = 0;
// TODO: If entity is Ender Crystal, destroy it
-
+
TeleportCreator(a_HitPos);
a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1);
-
+
m_DestroyTimer = 5;
}
diff --git a/src/Entities/ThrownEnderPearlEntity.h b/src/Entities/ThrownEnderPearlEntity.h
index 94f3ab5cb..03d54e911 100644
--- a/src/Entities/ThrownEnderPearlEntity.h
+++ b/src/Entities/ThrownEnderPearlEntity.h
@@ -21,22 +21,22 @@ class cThrownEnderPearlEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cThrownEnderPearlEntity)
-
+
cThrownEnderPearlEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
protected:
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
-
+
/** Teleports the creator where the ender pearl lands */
void TeleportCreator(const Vector3d & a_HitPos);
@@ -44,7 +44,7 @@ private:
/** Time in ticks to wait for the hit animation to begin before destroying */
int m_DestroyTimer;
-
+
} ; // tolua_export
diff --git a/src/Entities/ThrownSnowballEntity.h b/src/Entities/ThrownSnowballEntity.h
index 391b0c40b..d22930f8f 100644
--- a/src/Entities/ThrownSnowballEntity.h
+++ b/src/Entities/ThrownSnowballEntity.h
@@ -21,17 +21,17 @@ class cThrownSnowballEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cThrownSnowballEntity)
-
+
cThrownSnowballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
protected:
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
@@ -41,7 +41,7 @@ private:
/** Time in ticks to wait for the hit animation to begin before destroying */
int m_DestroyTimer;
-
+
} ; // tolua_export
diff --git a/src/Entities/WitherSkullEntity.cpp b/src/Entities/WitherSkullEntity.cpp
index dc95e3edd..03385b283 100644
--- a/src/Entities/WitherSkullEntity.cpp
+++ b/src/Entities/WitherSkullEntity.cpp
@@ -39,10 +39,10 @@ void cWitherSkullEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_H
{
// TODO: If entity is Ender Crystal, destroy it
a_EntityHit.TakeDamage(dtRangedAttack, this, 0, 1);
-
+
// TODO: Explode
// TODO: Apply wither effect to entity and others nearby
-
+
Destroy(true);
}
diff --git a/src/Entities/WitherSkullEntity.h b/src/Entities/WitherSkullEntity.h
index 43a520388..11b6fe3aa 100644
--- a/src/Entities/WitherSkullEntity.h
+++ b/src/Entities/WitherSkullEntity.h
@@ -21,21 +21,21 @@ class cWitherSkullEntity :
public cProjectileEntity
{
typedef cProjectileEntity super;
-
+
public:
-
+
// tolua_end
-
+
CLASS_PROTODEF(cWitherSkullEntity)
-
+
cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
-
+
protected:
-
+
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
-
+
} ; // tolua_export