diff options
author | Samuel Barney <samjbarney@gmail.com> | 2013-12-28 21:25:41 +0100 |
---|---|---|
committer | Samuel Barney <samjbarney@gmail.com> | 2013-12-28 21:38:55 +0100 |
commit | ee00d189724c99f5fe5f7b1008b22632365f8235 (patch) | |
tree | 34f772a10bcb1d76c83f1501b7e4b9f7e44cbe8c | |
parent | Removed unnecessary base class and added some hooks. (diff) | |
download | cuberite-ee00d189724c99f5fe5f7b1008b22632365f8235.tar cuberite-ee00d189724c99f5fe5f7b1008b22632365f8235.tar.gz cuberite-ee00d189724c99f5fe5f7b1008b22632365f8235.tar.bz2 cuberite-ee00d189724c99f5fe5f7b1008b22632365f8235.tar.lz cuberite-ee00d189724c99f5fe5f7b1008b22632365f8235.tar.xz cuberite-ee00d189724c99f5fe5f7b1008b22632365f8235.tar.zst cuberite-ee00d189724c99f5fe5f7b1008b22632365f8235.zip |
-rw-r--r-- | src/Entities/Compoments/AIComponent.h | 14 | ||||
-rw-r--r-- | src/Entities/Compoments/AttackComponent.h | 14 | ||||
-rw-r--r-- | src/Entities/Compoments/Component.h | 38 | ||||
-rw-r--r-- | src/Entities/Compoments/EnvironmentComponent.h | 20 | ||||
-rw-r--r-- | src/Entities/Compoments/InteractionComponent.h | 20 | ||||
-rw-r--r-- | src/Entities/Compoments/ModelComponent.h | 18 | ||||
-rw-r--r-- | src/Entities/Compoments/MovementComponent.h | 12 |
7 files changed, 98 insertions, 38 deletions
diff --git a/src/Entities/Compoments/AIComponent.h b/src/Entities/Compoments/AIComponent.h new file mode 100644 index 000000000..483fe4164 --- /dev/null +++ b/src/Entities/Compoments/AIComponent.h @@ -0,0 +1,14 @@ +#pragma once + +#include "../Entity.h" + +class cAIComponent +{ +protected: + cEntity * m_Self; +public: + cAIComponent(cEntity * a_Entity) : m_Self(a_Entity){} + + virtual void Tick(float a_Dt, cChunk & a_Chunk){} + +};
\ No newline at end of file diff --git a/src/Entities/Compoments/AttackComponent.h b/src/Entities/Compoments/AttackComponent.h new file mode 100644 index 000000000..1b465ef4f --- /dev/null +++ b/src/Entities/Compoments/AttackComponent.h @@ -0,0 +1,14 @@ +#pragma once + +#include "../Entity.h" + +class cAttackComponent +{ +protected: + cEntity * m_Self; +public: + cAttackComponent(cEntity * a_Entity) : m_Self(a_Entity){} + + virtual void OnAttackEntity(cEntity * a_Entity){} + +};
\ No newline at end of file diff --git a/src/Entities/Compoments/Component.h b/src/Entities/Compoments/Component.h deleted file mode 100644 index 30b873823..000000000 --- a/src/Entities/Compoments/Component.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include "Entity.h" - -class cComponent -{ -protected: - cEntity * m_Self; -public: - cComponent(cEntity * a_Entity) : m_Self(a_Entity){} - - - // General - virtual void Tick(float a_Dt, cChunk & a_Chunk){} - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL){} - virtual void SpawnOn(cClientHandle & a_Client){} - - // World/Model Interaction - virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk){} - virtual void OnCollisionWithEntity(cEntity * a_Entity){} - - // Environmental Reactions - virtual void OnCollisionWithBlock(Vector3i & a_Position, BLOCKTYPE a_Block){} - virtual void OnStartedBurning(){} - virtual void OnFinishedBurning(){} - virtual void OnStartedDrowning(){} - virtual void OnFinishedDrowning(){} - - // Reactions - virtual void OnTakeDamage(TakeDamageInfo & a_TDI){} - virtual void OnRightClicked(){} - virtual void OnKilled(cEntity * a_Killer = NULL){} - // virtual void OnPickup(){} - // virtual void OnDestroy(){} - - // Logic - virtual void OnAttackEntity(cEntity * a_Entity){} -};
\ No newline at end of file diff --git a/src/Entities/Compoments/EnvironmentComponent.h b/src/Entities/Compoments/EnvironmentComponent.h new file mode 100644 index 000000000..84fd4e2f5 --- /dev/null +++ b/src/Entities/Compoments/EnvironmentComponent.h @@ -0,0 +1,20 @@ +#pragma once + +#include "../Entity.h" + +class cEnvironmentComponent +{ +protected: + cEntity * m_Self; +public: + cEnvironmentComponent(cEntity * a_Entity) : m_Self(a_Entity){} + + virtual void Tick(float a_Dt, cChunk & a_Chunk){} + + virtual void OnCollisionWithBlock(Vector3i & a_Position, BLOCKTYPE a_Block){} + virtual void OnStartedBurning(){} + virtual void OnFinishedBurning(){} + virtual void OnStartedDrowning(){} + virtual void OnFinishedDrowning(){} + +};
\ No newline at end of file diff --git a/src/Entities/Compoments/InteractionComponent.h b/src/Entities/Compoments/InteractionComponent.h new file mode 100644 index 000000000..bd5b7c281 --- /dev/null +++ b/src/Entities/Compoments/InteractionComponent.h @@ -0,0 +1,20 @@ +#pragma once + +#include "../Entity.h" + +class cInteractionComponent +{ +protected: + cEntity * m_Self; +public: + cInteractionComponent(cEntity * a_Entity) : m_Self(a_Entity){} + + virtual void OnCollisionWithEntity(cEntity * a_Entity){} + + virtual void OnTakeDamage(TakeDamageInfo & a_TDI){} + virtual void OnRightClicked(){} + virtual void OnKilled(cEntity * a_Killer = NULL){} + // virtual void OnPickup(){} + // virtual void OnDestroy(){} + +};
\ No newline at end of file diff --git a/src/Entities/Compoments/ModelComponent.h b/src/Entities/Compoments/ModelComponent.h new file mode 100644 index 000000000..820ac1130 --- /dev/null +++ b/src/Entities/Compoments/ModelComponent.h @@ -0,0 +1,18 @@ +#pragma once + +#include "../Entity.h" + +class cModelComponent +{ +protected: + cEntity * m_Self; +public: + cModelComponent(cEntity * a_Entity) : m_Self(a_Entity){} + virtual void SpawnOn(cClientHandle & a_Client){} + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL){} + + virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk){} + virtual void OnCollisionWithEntity(cEntity * a_Entity){} + + +};
\ No newline at end of file diff --git a/src/Entities/Compoments/MovementComponent.h b/src/Entities/Compoments/MovementComponent.h new file mode 100644 index 000000000..dda215ade --- /dev/null +++ b/src/Entities/Compoments/MovementComponent.h @@ -0,0 +1,12 @@ +#pragma once + +#include "../Entity.h" + +class cMovementComponent +{ +protected: + cEntity * m_Self; +public: + cMovementComponent(cEntity * a_Entity) : m_Self(a_Entity){} + +};
\ No newline at end of file |