Exported individual projectile classes to Lua API.
They used to be exported, but then they were moved to separate files and those werent' added to the ToLua processing list.
This commit is contained in:
parent
bcb839d07b
commit
0c0c762412
@ -33,15 +33,25 @@ $cfile "../StringUtils.h"
|
||||
$cfile "../Defines.h"
|
||||
$cfile "../ChatColor.h"
|
||||
$cfile "../ClientHandle.h"
|
||||
$cfile "../Entities/ArrowEntity.h"
|
||||
$cfile "../Entities/Entity.h"
|
||||
$cfile "../Entities/EntityEffect.h"
|
||||
$cfile "../Entities/ExpBottleEntity.h"
|
||||
$cfile "../Entities/FireChargeEntity.h"
|
||||
$cfile "../Entities/FireworkEntity.h"
|
||||
$cfile "../Entities/Floater.h"
|
||||
$cfile "../Entities/GhastFireballEntity.h"
|
||||
$cfile "../Entities/Pawn.h"
|
||||
$cfile "../Entities/Player.h"
|
||||
$cfile "../Entities/Painting.h"
|
||||
$cfile "../Entities/Pickup.h"
|
||||
$cfile "../Entities/ProjectileEntity.h"
|
||||
$cfile "../Entities/SplashPotionEntity.h"
|
||||
$cfile "../Entities/ThrownEggEntity.h"
|
||||
$cfile "../Entities/ThrownEnderPearlEntity.h"
|
||||
$cfile "../Entities/ThrownSnowballEntity.h"
|
||||
$cfile "../Entities/TNTEntity.h"
|
||||
$cfile "../Entities/EntityEffect.h"
|
||||
$cfile "../Entities/WitherSkullEntity.h"
|
||||
$cfile "../Server.h"
|
||||
$cfile "../World.h"
|
||||
$cfile "../Inventory.h"
|
||||
|
@ -74,26 +74,25 @@ set(BINDING_DEPENDENCIES
|
||||
../Cuboid.h
|
||||
../Defines.h
|
||||
../Enchantments.h
|
||||
../Entities/EntityEffect.h
|
||||
../Entities/Entity.h
|
||||
../Entities/Floater.h
|
||||
../Entities/Pawn.h
|
||||
../Entities/Painting.h
|
||||
../Entities/Pickup.h
|
||||
../Entities/Player.h
|
||||
../Entities/ProjectileEntity.h
|
||||
../Entities/ArrowEntity.h
|
||||
../Entities/ThrownEggEntity.h
|
||||
../Entities/ThrownEnderPearlEntity.h
|
||||
../Entities/Entity.h
|
||||
../Entities/EntityEffect.h
|
||||
../Entities/ExpBottleEntity.h
|
||||
../Entities/ThrownSnowballEntity.h
|
||||
../Entities/FireChargeEntity.h
|
||||
../Entities/FireworkEntity.h
|
||||
../Entities/Floater.h
|
||||
../Entities/GhastFireballEntity.h
|
||||
../Entities/Pawn.h
|
||||
../Entities/Player.h
|
||||
../Entities/Painting.h
|
||||
../Entities/Pickup.h
|
||||
../Entities/ProjectileEntity.h
|
||||
../Entities/SplashPotionEntity.h
|
||||
../Entities/ThrownEggEntity.h
|
||||
../Entities/ThrownEnderPearlEntity.h
|
||||
../Entities/ThrownSnowballEntity.h
|
||||
../Entities/TNTEntity.h
|
||||
../Entities/ExpOrb.h
|
||||
../Entities/HangingEntity.h
|
||||
../Entities/ItemFrame.h
|
||||
../Entities/WitherSkullEntity.h
|
||||
../Generating/ChunkDesc.h
|
||||
../Inventory.h
|
||||
../Item.h
|
||||
@ -123,6 +122,7 @@ if (NOT MSVC)
|
||||
DEPENDS ${BINDING_DEPENDENCIES}
|
||||
)
|
||||
endif ()
|
||||
|
||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.h PROPERTIES GENERATED TRUE)
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// ArrowEntity.h
|
||||
//
|
||||
|
||||
// Declares the cArrowEntity representing the arrow that has been shot by the player or by a skeleton
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -19,7 +24,7 @@ class cArrowEntity :
|
||||
typedef cProjectileEntity super;
|
||||
|
||||
public:
|
||||
/// Determines when the arrow can be picked up (depending on player gamemode). Corresponds to the MCA file "pickup" field
|
||||
/** Determines when the arrow can be picked up (depending on player gamemode). Corresponds to the MCA file "pickup" field */
|
||||
enum ePickupState
|
||||
{
|
||||
psNoPickup = 0,
|
||||
@ -31,33 +36,33 @@ public:
|
||||
|
||||
CLASS_PROTODEF(cArrowEntity)
|
||||
|
||||
/// Creates a new arrow with psNoPickup state and default damage modifier coeff
|
||||
/** 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
|
||||
/** 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
|
||||
/** Returns whether the arrow can be picked up by players */
|
||||
ePickupState GetPickupState(void) const { return m_PickupState; }
|
||||
|
||||
/// Sets a new pickup state
|
||||
/** Sets a new pickup state */
|
||||
void SetPickupState(ePickupState a_PickupState) { m_PickupState = a_PickupState; }
|
||||
|
||||
/// Returns the damage modifier coeff.
|
||||
/** Returns the damage modifier coeff. */
|
||||
double GetDamageCoeff(void) const { return m_DamageCoeff; }
|
||||
|
||||
/// Sets the damage modifier coeff
|
||||
/** 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
|
||||
/** 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
|
||||
/** Returns true if the arrow is set as critical */
|
||||
bool IsCritical(void) const { return m_IsCritical; }
|
||||
|
||||
/// Sets the IsCritical flag
|
||||
/** Sets the IsCritical flag */
|
||||
void SetIsCritical(bool a_IsCritical) { m_IsCritical = a_IsCritical; }
|
||||
|
||||
/** Gets the block arrow is in */
|
||||
@ -70,28 +75,28 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
/// Determines when the arrow can be picked up by players
|
||||
/** 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
|
||||
/** 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
|
||||
/** If true, the arrow deals more damage */
|
||||
bool m_IsCritical;
|
||||
|
||||
/// Timer for pickup collection animation or five minute timeout
|
||||
/** Timer for pickup collection animation or five minute timeout */
|
||||
float m_Timer;
|
||||
|
||||
/// Timer for client arrow position confirmation via TeleportEntity
|
||||
/** Timer for client arrow position confirmation via TeleportEntity */
|
||||
float 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
|
||||
/** 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
|
||||
/** Stores the block position that arrow is lodged into, sets m_IsInGround to false if it becomes air */
|
||||
Vector3i m_HitBlockPos;
|
||||
|
||||
// cProjectileEntity overrides:
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// ExpBottleEntity.h
|
||||
//
|
||||
|
||||
// Declares the cExpBottleEntity class representing the thrown exp bottle
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -33,6 +38,10 @@ 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);
|
||||
void Break(const Vector3d & a_HitPos);
|
||||
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// FireChargeEntity.h
|
||||
//
|
||||
|
||||
// Declares the cFireChargeEntity representing the fire charge shot by the blaze
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -34,3 +39,7 @@ protected:
|
||||
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
|
||||
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
cFireworkEntity::cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item) :
|
||||
super(pkFirework, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
|
||||
m_ExplodeTimer(0),
|
||||
m_TicksToExplosion(a_Item.m_FireworkItem.m_FlightTimeInTicks),
|
||||
m_FireworkItem(a_Item)
|
||||
{
|
||||
}
|
||||
@ -27,7 +27,9 @@ void cFireworkEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
|
||||
|
||||
if ((PosY < 0) || (PosY >= cChunkDef::Height))
|
||||
{
|
||||
goto setspeed;
|
||||
AddSpeedY(1);
|
||||
AddPosition(GetSpeed() * (a_Dt / 1000));
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_IsInGround)
|
||||
@ -50,7 +52,6 @@ void cFireworkEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
|
||||
}
|
||||
}
|
||||
|
||||
setspeed:
|
||||
AddSpeedY(1);
|
||||
AddPosition(GetSpeed() * (a_Dt / 1000));
|
||||
}
|
||||
@ -63,11 +64,13 @@ void cFireworkEntity::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
|
||||
if (m_ExplodeTimer == m_FireworkItem.m_FireworkItem.m_FlightTimeInTicks)
|
||||
if (m_TicksToExplosion <= 0)
|
||||
{
|
||||
// TODO: Notify the plugins
|
||||
m_World->BroadcastEntityStatus(*this, esFireworkExploding);
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
m_ExplodeTimer++;
|
||||
m_TicksToExplosion -= 1;
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// FireworkEntity.h
|
||||
//
|
||||
|
||||
// Declares the cFireworkEntity class representing the flying firework rocket
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -24,8 +29,23 @@ public:
|
||||
CLASS_PROTODEF(cFireworkEntity)
|
||||
|
||||
cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
/** Returns the item used to create the rocket (has all the firework effects on it) */
|
||||
const cItem & GetItem(void) const { return m_FireworkItem; }
|
||||
|
||||
/** Sets the item that is used to create the rocket (has all the firework effects on it) */
|
||||
void SetItem(const cItem & a_Item) { m_FireworkItem = a_Item; }
|
||||
|
||||
/** Returns the number of ticks left until the firework explosion. */
|
||||
int GetTicksToExplosion(void) const { return m_TicksToExplosion; }
|
||||
|
||||
/** Sets the number of ticks left until the firework explosion. */
|
||||
void SetTicksToExplosion(int a_TicksToExplosion) { m_TicksToExplosion = a_TicksToExplosion; }
|
||||
|
||||
// tolua_end
|
||||
|
||||
protected:
|
||||
|
||||
// cProjectileEntity overrides:
|
||||
@ -34,7 +54,11 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
int m_ExplodeTimer;
|
||||
int m_TicksToExplosion;
|
||||
cItem m_FireworkItem;
|
||||
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// GhastFireballEntity.h
|
||||
//
|
||||
|
||||
// Declares the cGhastFireballEntity class representing the ghast fireball in flight.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -36,3 +41,7 @@ protected:
|
||||
// TODO: Deflecting the fireballs by arrow- or sword- hits
|
||||
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -11,15 +11,22 @@
|
||||
class cPainting :
|
||||
public cEntity
|
||||
{
|
||||
// tolua_end
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cPainting)
|
||||
|
||||
cPainting(const AString & a_Name, int a_Direction, double a_X, double a_Y, double a_Z);
|
||||
const AString & GetName(void) const { return m_Name; } // tolua_export
|
||||
int GetDirection(void) const { return m_Direction; } // tolua_export
|
||||
|
||||
// tolua_begin
|
||||
|
||||
const AString & GetName(void) const { return m_Name; }
|
||||
int GetDirection(void) const { return m_Direction; }
|
||||
|
||||
// tolua_end
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
// ProjectileEntity.h
|
||||
|
||||
// Declares the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types
|
||||
// Declares the cProjectileEntity class representing the common base class for projectiles
|
||||
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class cProjectileEntity :
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
/// The kind of the projectile. The numbers correspond to the network type ID used for spawning via the 0x17 packet.
|
||||
/** The kind of the projectile. The numbers correspond to the network type ID used for spawning them in the protocol. */
|
||||
enum eKind
|
||||
{
|
||||
pkArrow = 60,
|
||||
@ -48,22 +48,22 @@ public:
|
||||
|
||||
static cProjectileEntity * Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem * a_Item, const Vector3d * a_Speed = NULL);
|
||||
|
||||
/// Called by the physics blocktracer when the entity hits a solid block, the hit position and the face hit (BLOCK_FACE_) is given
|
||||
/** Called by the physics blocktracer when the entity hits a solid block, the hit position and the face hit (BLOCK_FACE_) is given */
|
||||
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace);
|
||||
|
||||
/// Called by the physics blocktracer when the entity hits another entity
|
||||
/** Called by the physics blocktracer when the entity hits another entity */
|
||||
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
|
||||
{
|
||||
UNUSED(a_EntityHit);
|
||||
UNUSED(a_HitPos);
|
||||
}
|
||||
|
||||
/// Called by Chunk when the projectile is eligible for player collection
|
||||
/** Called by Chunk when the projectile is eligible for player collection */
|
||||
virtual void CollectedBy(cPlayer & a_Dest);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
/// Returns the kind of the projectile (fast class identification)
|
||||
/** Returns the kind of the projectile (fast class identification) */
|
||||
eKind GetProjectileKind(void) const { return m_ProjectileKind; }
|
||||
|
||||
/** Returns the unique ID of the entity who created this projectile
|
||||
@ -76,15 +76,15 @@ public:
|
||||
*/
|
||||
AString GetCreatorName(void) const { return m_CreatorData.m_Name; }
|
||||
|
||||
/// Returns the string that is used as the entity type (class name) in MCA files
|
||||
/** Returns the string that is used as the entity type (class name) in MCA files */
|
||||
AString GetMCAClassName(void) const;
|
||||
|
||||
/// Returns true if the projectile has hit the ground and is stuck there
|
||||
/** Returns true if the projectile has hit the ground and is stuck there */
|
||||
bool IsInGround(void) const { return m_IsInGround; }
|
||||
|
||||
// tolua_end
|
||||
|
||||
/// Sets the internal InGround flag. To be used by MCA loader only!
|
||||
/** Sets the internal InGround flag. To be used by MCA loader only! */
|
||||
void SetIsInGround(bool a_IsInGround) { m_IsInGround = a_IsInGround; }
|
||||
|
||||
protected:
|
||||
@ -114,7 +114,7 @@ protected:
|
||||
*/
|
||||
CreatorData m_CreatorData;
|
||||
|
||||
/// True if the projectile has hit the ground and is stuck there
|
||||
/** True if the projectile has hit the ground and is stuck there */
|
||||
bool m_IsInGround;
|
||||
|
||||
// cEntity overrides:
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// SplashPotionEntity.h
|
||||
//
|
||||
|
||||
// Declares the cSplashPotionEntity class representing a splash potion that has been thrown
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -32,6 +37,7 @@ public:
|
||||
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; }
|
||||
@ -40,6 +46,8 @@ public:
|
||||
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;
|
||||
@ -77,3 +85,7 @@ private:
|
||||
/** Time in ticks to wait for the hit animation to begin before destroying */
|
||||
int m_DestroyTimer;
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -44,6 +44,27 @@ void cThrownEggEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_Hit
|
||||
|
||||
|
||||
|
||||
void cThrownEggEntity::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
if (m_DestroyTimer > 0)
|
||||
{
|
||||
m_DestroyTimer--;
|
||||
if (m_DestroyTimer == 0)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cThrownEggEntity::TrySpawnChicken(const Vector3d & a_HitPos)
|
||||
{
|
||||
if (m_World->GetTickRandomNumber(7) == 1)
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// ThrownEggEntity.h
|
||||
//
|
||||
|
||||
// Declares the cThrownEggEntity class representing a regular thrown egg
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -29,23 +34,8 @@ 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 (float a_Dt, cChunk & a_Chunk) override
|
||||
{
|
||||
if (m_DestroyTimer > 0)
|
||||
{
|
||||
m_DestroyTimer--;
|
||||
if (m_DestroyTimer == 0)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
}
|
||||
}
|
||||
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
||||
// Randomly decides whether to spawn a chicken where the egg lands.
|
||||
void TrySpawnChicken(const Vector3d & a_HitPos);
|
||||
@ -56,3 +46,7 @@ private:
|
||||
int m_DestroyTimer;
|
||||
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||
|
||||
#include "ThrownEnderPearlEntity.h"
|
||||
@ -45,6 +46,27 @@ void cThrownEnderPearlEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d
|
||||
|
||||
|
||||
|
||||
void cThrownEnderPearlEntity::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
if (m_DestroyTimer > 0)
|
||||
{
|
||||
m_DestroyTimer--;
|
||||
if (m_DestroyTimer == 0)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos)
|
||||
{
|
||||
if (m_CreatorData.m_Name.empty())
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// ThrownEnderPearlEntity.h
|
||||
//
|
||||
|
||||
// Declares the cThrownEnderPeralEntity class representing an ender pearl being thrown
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -29,23 +34,8 @@ 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 (float a_Dt, cChunk & a_Chunk) override
|
||||
{
|
||||
if (m_DestroyTimer > 0)
|
||||
{
|
||||
m_DestroyTimer--;
|
||||
if (m_DestroyTimer == 0)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
}
|
||||
}
|
||||
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
||||
/** Teleports the creator where the ender pearl lands */
|
||||
void TeleportCreator(const Vector3d & a_HitPos);
|
||||
@ -56,3 +46,7 @@ private:
|
||||
int m_DestroyTimer;
|
||||
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -43,3 +43,28 @@ void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d &
|
||||
|
||||
m_DestroyTimer = 5;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cThrownSnowballEntity::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
if (m_DestroyTimer > 0)
|
||||
{
|
||||
m_DestroyTimer--;
|
||||
if (m_DestroyTimer == 0)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
//
|
||||
|
||||
// ThrownSnowballEntity.h
|
||||
//
|
||||
|
||||
// Declares the cThrownSnowballEntity representing a snowball that has been thrown
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -29,23 +34,8 @@ 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 (float a_Dt, cChunk & a_Chunk) override
|
||||
{
|
||||
if (m_DestroyTimer > 0)
|
||||
{
|
||||
m_DestroyTimer--;
|
||||
if (m_DestroyTimer == 0)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
}
|
||||
}
|
||||
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
||||
private:
|
||||
|
||||
@ -53,3 +43,7 @@ private:
|
||||
int m_DestroyTimer;
|
||||
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
// Declares the cWitherSkullEntity class representing the entity used by both blue and black wither skulls
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ProjectileEntity.h"
|
||||
@ -30,6 +34,10 @@ 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 OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
|
||||
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user