From a4ed611778ee1ba0584deb736dc323f41e205c6a Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 26 Dec 2013 15:49:00 -0700 Subject: Initial Commit of the cComponent class. --- src/Entities/Compoments/Component.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/Entities/Compoments/Component.h diff --git a/src/Entities/Compoments/Component.h b/src/Entities/Compoments/Component.h new file mode 100644 index 000000000..3d7ebccaa --- /dev/null +++ b/src/Entities/Compoments/Component.h @@ -0,0 +1,9 @@ +#include "Entity.h" + +class cComponent +{ +protected: + cEntity * m_Self; +public: + cComponent(cEntity * a_Entity) : m_Self(a_Entity){} +}; \ No newline at end of file -- cgit v1.2.3 From e5d24470564f4abd39813a5b6da38ec3d1de44fe Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 26 Dec 2013 16:21:02 -0700 Subject: Added some possible virtual hooks --- src/Entities/Compoments/Component.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Entities/Compoments/Component.h b/src/Entities/Compoments/Component.h index 3d7ebccaa..24a13e62a 100644 --- a/src/Entities/Compoments/Component.h +++ b/src/Entities/Compoments/Component.h @@ -1,3 +1,5 @@ +#pragma once + #include "Entity.h" class cComponent @@ -6,4 +8,28 @@ 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(){} + + // Reactions + virtual void OnTakeDamage(TakeDamageInfo & a_TDI){} + virtual void OnRightClicked(){} + virtual void OnKilled(cEntity * a_Killer = NULL){} + //virtual void OnDestroy(){} + + // Logic + virtual void OnAttackEntity(cEntity * a_Entity){} }; \ No newline at end of file -- cgit v1.2.3 From a00a746cc701f14d217f41e789e1c052248b6cd5 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 26 Dec 2013 16:27:05 -0700 Subject: Added another possible hook. --- src/Entities/Compoments/Component.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Entities/Compoments/Component.h b/src/Entities/Compoments/Component.h index 24a13e62a..29fe8786f 100644 --- a/src/Entities/Compoments/Component.h +++ b/src/Entities/Compoments/Component.h @@ -28,7 +28,8 @@ public: virtual void OnTakeDamage(TakeDamageInfo & a_TDI){} virtual void OnRightClicked(){} virtual void OnKilled(cEntity * a_Killer = NULL){} - //virtual void OnDestroy(){} + // virtual void OnPickup(){} + // virtual void OnDestroy(){} // Logic virtual void OnAttackEntity(cEntity * a_Entity){} -- cgit v1.2.3 From 1b33094d816d0be0fff1d76cf2efc9d2b3100635 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 26 Dec 2013 16:50:31 -0700 Subject: Initial commit of sub component types. --- src/Entities/Compoments/AttackComponent.h | 1 + src/Entities/Compoments/EnvironmentalComponent.h | 1 + src/Entities/Compoments/LogicComponent.h | 1 + src/Entities/Compoments/MovementComponent.h | 1 + src/Entities/Compoments/PhysicalComponent.h | 1 + src/Entities/Compoments/ReactionComponent.h | 1 + 6 files changed, 6 insertions(+) create mode 100644 src/Entities/Compoments/AttackComponent.h create mode 100644 src/Entities/Compoments/EnvironmentalComponent.h create mode 100644 src/Entities/Compoments/LogicComponent.h create mode 100644 src/Entities/Compoments/MovementComponent.h create mode 100644 src/Entities/Compoments/PhysicalComponent.h create mode 100644 src/Entities/Compoments/ReactionComponent.h diff --git a/src/Entities/Compoments/AttackComponent.h b/src/Entities/Compoments/AttackComponent.h new file mode 100644 index 000000000..d0eb2eb89 --- /dev/null +++ b/src/Entities/Compoments/AttackComponent.h @@ -0,0 +1 @@ +#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/EnvironmentalComponent.h b/src/Entities/Compoments/EnvironmentalComponent.h new file mode 100644 index 000000000..d0eb2eb89 --- /dev/null +++ b/src/Entities/Compoments/EnvironmentalComponent.h @@ -0,0 +1 @@ +#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/LogicComponent.h b/src/Entities/Compoments/LogicComponent.h new file mode 100644 index 000000000..d0eb2eb89 --- /dev/null +++ b/src/Entities/Compoments/LogicComponent.h @@ -0,0 +1 @@ +#include "Component.h" \ 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..d0eb2eb89 --- /dev/null +++ b/src/Entities/Compoments/MovementComponent.h @@ -0,0 +1 @@ +#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/PhysicalComponent.h b/src/Entities/Compoments/PhysicalComponent.h new file mode 100644 index 000000000..d0eb2eb89 --- /dev/null +++ b/src/Entities/Compoments/PhysicalComponent.h @@ -0,0 +1 @@ +#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/ReactionComponent.h b/src/Entities/Compoments/ReactionComponent.h new file mode 100644 index 000000000..d0eb2eb89 --- /dev/null +++ b/src/Entities/Compoments/ReactionComponent.h @@ -0,0 +1 @@ +#include "Component.h" \ No newline at end of file -- cgit v1.2.3 From 173fcaf1c006f3d39f93227961b7a69988549534 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 26 Dec 2013 16:59:29 -0700 Subject: Removed unnecessary base class files. --- src/Entities/Compoments/AttackComponent.h | 1 - src/Entities/Compoments/LogicComponent.h | 1 - src/Entities/Compoments/MovementComponent.h | 1 - src/Entities/Compoments/PhysicalComponent.h | 1 - src/Entities/Compoments/ReactionComponent.h | 1 - 5 files changed, 5 deletions(-) delete mode 100644 src/Entities/Compoments/AttackComponent.h delete mode 100644 src/Entities/Compoments/LogicComponent.h delete mode 100644 src/Entities/Compoments/MovementComponent.h delete mode 100644 src/Entities/Compoments/PhysicalComponent.h delete mode 100644 src/Entities/Compoments/ReactionComponent.h diff --git a/src/Entities/Compoments/AttackComponent.h b/src/Entities/Compoments/AttackComponent.h deleted file mode 100644 index d0eb2eb89..000000000 --- a/src/Entities/Compoments/AttackComponent.h +++ /dev/null @@ -1 +0,0 @@ -#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/LogicComponent.h b/src/Entities/Compoments/LogicComponent.h deleted file mode 100644 index d0eb2eb89..000000000 --- a/src/Entities/Compoments/LogicComponent.h +++ /dev/null @@ -1 +0,0 @@ -#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/MovementComponent.h b/src/Entities/Compoments/MovementComponent.h deleted file mode 100644 index d0eb2eb89..000000000 --- a/src/Entities/Compoments/MovementComponent.h +++ /dev/null @@ -1 +0,0 @@ -#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/PhysicalComponent.h b/src/Entities/Compoments/PhysicalComponent.h deleted file mode 100644 index d0eb2eb89..000000000 --- a/src/Entities/Compoments/PhysicalComponent.h +++ /dev/null @@ -1 +0,0 @@ -#include "Component.h" \ No newline at end of file diff --git a/src/Entities/Compoments/ReactionComponent.h b/src/Entities/Compoments/ReactionComponent.h deleted file mode 100644 index d0eb2eb89..000000000 --- a/src/Entities/Compoments/ReactionComponent.h +++ /dev/null @@ -1 +0,0 @@ -#include "Component.h" \ No newline at end of file -- cgit v1.2.3 From 1564b24373edcb2dab75bcba359a244d93fedf4d Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 26 Dec 2013 17:05:30 -0700 Subject: Removed unnecessary base class and added some hooks. --- src/Entities/Compoments/Component.h | 2 ++ src/Entities/Compoments/EnvironmentalComponent.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 src/Entities/Compoments/EnvironmentalComponent.h diff --git a/src/Entities/Compoments/Component.h b/src/Entities/Compoments/Component.h index 29fe8786f..30b873823 100644 --- a/src/Entities/Compoments/Component.h +++ b/src/Entities/Compoments/Component.h @@ -23,6 +23,8 @@ public: 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){} diff --git a/src/Entities/Compoments/EnvironmentalComponent.h b/src/Entities/Compoments/EnvironmentalComponent.h deleted file mode 100644 index d0eb2eb89..000000000 --- a/src/Entities/Compoments/EnvironmentalComponent.h +++ /dev/null @@ -1 +0,0 @@ -#include "Component.h" \ No newline at end of file -- cgit v1.2.3 From ee00d189724c99f5fe5f7b1008b22632365f8235 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Sat, 28 Dec 2013 13:25:41 -0700 Subject: Switched to using Xoft's multibase inheritance structure. --- src/Entities/Compoments/AIComponent.h | 14 ++++++++++ src/Entities/Compoments/AttackComponent.h | 14 ++++++++++ src/Entities/Compoments/Component.h | 38 -------------------------- src/Entities/Compoments/EnvironmentComponent.h | 20 ++++++++++++++ src/Entities/Compoments/InteractionComponent.h | 20 ++++++++++++++ src/Entities/Compoments/ModelComponent.h | 18 ++++++++++++ src/Entities/Compoments/MovementComponent.h | 12 ++++++++ 7 files changed, 98 insertions(+), 38 deletions(-) create mode 100644 src/Entities/Compoments/AIComponent.h create mode 100644 src/Entities/Compoments/AttackComponent.h delete mode 100644 src/Entities/Compoments/Component.h create mode 100644 src/Entities/Compoments/EnvironmentComponent.h create mode 100644 src/Entities/Compoments/InteractionComponent.h create mode 100644 src/Entities/Compoments/ModelComponent.h create mode 100644 src/Entities/Compoments/MovementComponent.h 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 -- cgit v1.2.3 From 8d83297499db730b06b188eafd18ccbb2c8ac5d9 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Sun, 29 Dec 2013 07:26:29 -0700 Subject: Added line endings for *nix --- src/Entities/Compoments/AIComponent.h | 2 +- src/Entities/Compoments/AttackComponent.h | 2 +- src/Entities/Compoments/EnvironmentComponent.h | 2 +- src/Entities/Compoments/InteractionComponent.h | 2 +- src/Entities/Compoments/ModelComponent.h | 2 +- src/Entities/Compoments/MovementComponent.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Entities/Compoments/AIComponent.h b/src/Entities/Compoments/AIComponent.h index 483fe4164..1659e2304 100644 --- a/src/Entities/Compoments/AIComponent.h +++ b/src/Entities/Compoments/AIComponent.h @@ -11,4 +11,4 @@ public: 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 index 1b465ef4f..080f764b6 100644 --- a/src/Entities/Compoments/AttackComponent.h +++ b/src/Entities/Compoments/AttackComponent.h @@ -11,4 +11,4 @@ public: 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 index 84fd4e2f5..b080520f2 100644 --- a/src/Entities/Compoments/EnvironmentComponent.h +++ b/src/Entities/Compoments/EnvironmentComponent.h @@ -17,4 +17,4 @@ public: 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 index bd5b7c281..b8b99de79 100644 --- a/src/Entities/Compoments/InteractionComponent.h +++ b/src/Entities/Compoments/InteractionComponent.h @@ -17,4 +17,4 @@ public: // 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 index 820ac1130..bbc4bcc21 100644 --- a/src/Entities/Compoments/ModelComponent.h +++ b/src/Entities/Compoments/ModelComponent.h @@ -15,4 +15,4 @@ public: 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 index dda215ade..a9896c3b0 100644 --- a/src/Entities/Compoments/MovementComponent.h +++ b/src/Entities/Compoments/MovementComponent.h @@ -9,4 +9,4 @@ protected: public: cMovementComponent(cEntity * a_Entity) : m_Self(a_Entity){} -}; \ No newline at end of file +}; -- cgit v1.2.3 From 96f6a98b426b9ac823d9a3835512e2f23c33cb8f Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 6 Feb 2014 14:16:53 -0700 Subject: Added cMobModel. --- src/Entities/Compoments/MobModel.h | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/Entities/Compoments/MobModel.h diff --git a/src/Entities/Compoments/MobModel.h b/src/Entities/Compoments/MobModel.h new file mode 100644 index 000000000..576c46c31 --- /dev/null +++ b/src/Entities/Compoments/MobModel.h @@ -0,0 +1,6 @@ +#include "ModelComponent.h" + +class cMobModel : public cModelComponent { + int m_MobType; + cMobModel(cEntity * a_Entity, int a_MobType): cModelComponent(a_Entity), m_MobType(a_MobType){} +} \ No newline at end of file -- cgit v1.2.3