diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-01 12:39:56 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-01 12:39:56 +0200 |
commit | 37276a4430e26f5b3ab56e07d5f30a194f75982e (patch) | |
tree | 95ba9a0a151dc9f4111d8b99e8af728993daa783 /source/Pawn.h | |
parent | Changed the crafting recipe for book to match vanilla since 1.3.1 (fix contributed by mgueydan) (diff) | |
download | cuberite-37276a4430e26f5b3ab56e07d5f30a194f75982e.tar cuberite-37276a4430e26f5b3ab56e07d5f30a194f75982e.tar.gz cuberite-37276a4430e26f5b3ab56e07d5f30a194f75982e.tar.bz2 cuberite-37276a4430e26f5b3ab56e07d5f30a194f75982e.tar.lz cuberite-37276a4430e26f5b3ab56e07d5f30a194f75982e.tar.xz cuberite-37276a4430e26f5b3ab56e07d5f30a194f75982e.tar.zst cuberite-37276a4430e26f5b3ab56e07d5f30a194f75982e.zip |
Diffstat (limited to 'source/Pawn.h')
-rw-r--r-- | source/Pawn.h | 149 |
1 files changed, 2 insertions, 147 deletions
diff --git a/source/Pawn.h b/source/Pawn.h index e0dca8b72..b1b8c71ec 100644 --- a/source/Pawn.h +++ b/source/Pawn.h @@ -8,71 +8,6 @@ -// fwd: -class cPawn; - - - - - -// tolua_begin -enum eDamageType -{ - // Canonical names for the types (as documented in the plugin wiki): - dtAttack, // Being attacked by a mob - dtLightning, // Hit by a lightning strike - dtFalling, // Falling down; dealt when hitting the ground - dtDrowning, // Drowning in water / lava - dtSuffocating, // Suffocating inside a block - dtStarving, // Hunger - dtCactusContact, // Contact with a cactus block - dtLavaContact, // Contact with a lava block - dtPoisoning, // Having the poison effect - dtOnFire, // Being on fire - dtFireContact, // Standing inside a fire block - dtInVoid, // Falling into the Void (Y < 0) - dtPotionOfHarming, - dtAdmin, // Damage applied by an admin command - - // Some common synonyms: - dtPawnAttack = dtAttack, - dtEntityAttack = dtAttack, - dtMob = dtAttack, - dtMobAttack = dtAttack, - dtFall = dtFalling, - dtDrown = dtDrowning, - dtSuffocation = dtSuffocating, - dtStarvation = dtStarving, - dtHunger = dtStarving, - dtCactus = dtCactusContact, - dtCactuses = dtCactusContact, - dtCacti = dtCactusContact, - dtLava = dtLavaContact, - dtPoison = dtPoisoning, - dtBurning = dtOnFire, - dtInFire = dtFireContact, - dtPlugin = dtAdmin, -} ; - - - - - -struct TakeDamageInfo -{ - eDamageType DamageType; // Where does the damage come from? Being hit / on fire / contact with cactus / ... - cPawn * Attacker; // The attacking pawn; valid only for dtAttack - int RawDamage; // What damage would the receiver get without any armor. Usually: attacker mob type + weapons - int FinalDamage; // What actual damage will be received. Usually: m_RawDamage minus armor - Vector3d Knockback; // The amount and direction of knockback received from the damage - // TODO: Effects - list of effects that the hit is causing. Unknown representation yet -} ; -// tolua_end - - - - - // tolua_begin class cPawn : public cEntity @@ -83,91 +18,11 @@ class cPawn : public: CLASS_PROTODEF(cPawn); - cPawn(eEntityType a_EntityType); - - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - - // tolua_begin - - /// Teleports to the entity specified - virtual void TeleportToEntity(cEntity & a_Entity); - - /// Teleports to the coordinates specified - virtual void TeleportTo(double a_PosX, double a_PosY, double a_PosZ); - - /// Heals the specified amount of HPs - void Heal(int a_HitPoints); - - /// Returns the health of this pawn - int GetHealth(void) const { return m_Health; } - - /// Makes this pawn take damage from an attack by a_Attacker. Damage values are calculated automatically and DoTakeDamage() called - void TakeDamage(cPawn & a_Attacker); - - /// Makes this pawn take the specified damage. The final damage is calculated using current armor, then DoTakeDamage() called - void TakeDamage(eDamageType a_DamageType, cPawn * a_Attacker, int a_RawDamage, double a_KnockbackAmount); - - /// Makes this pawn take the specified damage. The values are packed into a TDI, knockback calculated, then sent through DoTakeDamage() - void TakeDamage(eDamageType a_DamageType, cPawn * a_Attacker, int a_RawDamage, int a_FinalDamage, double a_KnockbackAmount); - - /// Makes this pawn take damage specified in the a_TDI. The TDI is sent through plugins first, then applied - virtual void DoTakeDamage(TakeDamageInfo & a_TDI); - - /// Called when the health drops below zero. a_Killer may be NULL (environmental damage) - virtual void KilledBy(cPawn * a_Killer); - - /// Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items - virtual int GetRawDamageAgainst(const cPawn & a_Receiver); - - /// Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover - virtual int GetArmorCoverAgainst(const cPawn * a_Attacker, eDamageType a_DamageType, int a_RawDamage); - - /// Returns the knockback amount that the currently equipped items would cause to a_Receiver on a hit - virtual double GetKnockbackAmountAgainst(const cPawn & a_Receiver); - - /// Returns the curently equipped weapon; empty item if none - virtual cItem GetEquippedWeapon(void) const { return cItem(); } - - /// Returns the currently equipped helmet; empty item if nonte - virtual cItem GetEquippedHelmet(void) const { return cItem(); } - - /// Returns the currently equipped chestplate; empty item if nonte - virtual cItem GetEquippedChestplate(void) const { return cItem(); } - - /// Returns the currently equipped leggings; empty item if nonte - virtual cItem GetEquippedLeggings(void) const { return cItem(); } - - /// Returns the currently equipped boots; empty item if nonte - virtual cItem GetEquippedBoots(void) const { return cItem(); } - - // tolua_end - - /// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy(). - virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL); - - enum MetaData {NORMAL, BURNING, CROUCHED, RIDING, SPRINTING, EATING, BLOCKING}; - - virtual void SetMetaData(MetaData a_MetaData); - virtual MetaData GetMetaData(void) const { return m_MetaData; } - - virtual void InStateBurning(float a_Dt); - - virtual void CheckMetaDataBurn(cChunk & a_Chunk); - - virtual void SetMaxHealth(short a_MaxHealth); - virtual short GetMaxHealth() { return m_MaxHealth; } - - bool IsBurning(void) const { return (m_MetaData == BURNING); } + cPawn(eEntityType a_EntityType, double a_Width, double a_Height); protected: - short m_Health; - short m_MaxHealth; - bool m_bBurnable; - - MetaData m_MetaData; - -}; // tolua_export +} ; // tolua_export |