From c9c2a4f479474fe03acce598ba2687a0f4817083 Mon Sep 17 00:00:00 2001 From: JoannisO Date: Mon, 26 May 2014 08:44:16 +0200 Subject: Added Arrow- and FireCharge-Dispensing to DispenserEntity. --- src/BlockEntities/DispenserEntity.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index fdfe4e5b4..02a34be37 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -12,11 +12,11 @@ class cDispenserEntity : public cDropSpenserEntity { typedef cDropSpenserEntity super; - + public: // tolua_end - + /// Constructor used for normal operation cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); @@ -25,14 +25,13 @@ public: private: // cDropSpenser overrides: virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override; - + /// If such a bucket can fit, adds it to m_Contents and returns true bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); - + + // Returns how to aim the projectile + Vector3d GetProjectileLookVector(cChunk & a_Chunk); + /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); } ; // tolua_export - - - - -- cgit v1.2.3 From 74801f564775ae4c6b70834f76167a54b8a84826 Mon Sep 17 00:00:00 2001 From: JoannisO Date: Mon, 26 May 2014 14:47:04 +0200 Subject: - Added support for more types of projectiles in the Dispenser - Improved the method of spawning projectiles in the world - Added another method for spawning the projectiles --- src/BlockEntities/DispenserEntity.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 02a34be37..9290bee5c 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -29,9 +29,16 @@ private: /// If such a bucket can fit, adds it to m_Contents and returns true bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); + // Spawns a projectile of the given kind in front of the dispenser + void spawnProjectileFromDispenser(cChunk& a_Chunk, int& DispX, int& DispY, int& DispZ, cProjectileEntity::eKind kind); + // Returns how to aim the projectile Vector3d GetProjectileLookVector(cChunk & a_Chunk); /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); } ; // tolua_export + + + + -- cgit v1.2.3 From 1128dc783f4ee0913f3395c0a79ebdbbce2cfdee Mon Sep 17 00:00:00 2001 From: Joannis Date: Tue, 27 May 2014 11:08:06 +0200 Subject: - Fixed the ampersands and asterisks to fit the format. - Fixed the method "SpawnProjectileFromDispenser" to use CamelCasing. --- src/BlockEntities/DispenserEntity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 9290bee5c..8bc2475c9 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -30,7 +30,7 @@ private: bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); // Spawns a projectile of the given kind in front of the dispenser - void spawnProjectileFromDispenser(cChunk& a_Chunk, int& DispX, int& DispY, int& DispZ, cProjectileEntity::eKind kind); + void SpawnProjectileFromDispenser(cChunk& a_Chunk, int& DispX, int& DispY, int& DispZ, cProjectileEntity::eKind kind); // Returns how to aim the projectile Vector3d GetProjectileLookVector(cChunk & a_Chunk); -- cgit v1.2.3 From e5fd782524cdf4b838ad689baef44a61aa4933c2 Mon Sep 17 00:00:00 2001 From: Joannis Date: Wed, 28 May 2014 09:10:09 +0200 Subject: - Implemented vertical dispensing for projectiles. - Fixed some terrible commit issues on my side. --- src/BlockEntities/DispenserEntity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 8bc2475c9..0b7cd6bea 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -30,7 +30,7 @@ private: bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); // Spawns a projectile of the given kind in front of the dispenser - void SpawnProjectileFromDispenser(cChunk& a_Chunk, int& DispX, int& DispY, int& DispZ, cProjectileEntity::eKind kind); + void SpawnProjectileFromDispenser(cChunk & a_Chunk, int & DispX, int & DispY, int & DispZ, cProjectileEntity::eKind kind); // Returns how to aim the projectile Vector3d GetProjectileLookVector(cChunk & a_Chunk); -- cgit v1.2.3 From ab633c8bd65b333630053334cb1119f38788698d Mon Sep 17 00:00:00 2001 From: JoannisO Date: Thu, 29 May 2014 20:19:36 +0200 Subject: - Prefixed all args with "a_" - Added braces around the cases. --- src/BlockEntities/DispenserEntity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 0b7cd6bea..76aaccd3c 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -30,7 +30,7 @@ private: bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); // Spawns a projectile of the given kind in front of the dispenser - void SpawnProjectileFromDispenser(cChunk & a_Chunk, int & DispX, int & DispY, int & DispZ, cProjectileEntity::eKind kind); + void SpawnProjectileFromDispenser(cChunk & a_Chunk, int & a_DispX, int & a_DispY, int & a_DispZ, cProjectileEntity::eKind a_kind); // Returns how to aim the projectile Vector3d GetProjectileLookVector(cChunk & a_Chunk); -- cgit v1.2.3 From b436359237a9faa1dc5709e4359b73aa6faf4f78 Mon Sep 17 00:00:00 2001 From: JoannisO Date: Sat, 31 May 2014 16:08:15 +0200 Subject: - Changed the name of the ProjectileLookVector method. Note: I still think the new name is unclear. Any other suggestions are welcome. --- src/BlockEntities/DispenserEntity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 76aaccd3c..adbe2070c 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -33,7 +33,7 @@ private: void SpawnProjectileFromDispenser(cChunk & a_Chunk, int & a_DispX, int & a_DispY, int & a_DispZ, cProjectileEntity::eKind a_kind); // Returns how to aim the projectile - Vector3d GetProjectileLookVector(cChunk & a_Chunk); + Vector3d GetShootVector(cChunk & a_Chunk); /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); -- cgit v1.2.3 From 545478802b7a8b81ecb9d20ad3355eff1427f575 Mon Sep 17 00:00:00 2001 From: Joannis Date: Tue, 3 Jun 2014 09:26:14 +0200 Subject: - Added doxy comments and exported to lua - Manipulation of the ShootVector is not to be done by the function that wants to spawn a projectile. --- src/BlockEntities/DispenserEntity.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index adbe2070c..558cf41c5 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -22,6 +22,12 @@ public: static const char * GetClassStatic(void) { return "cDispenserEntity"; } + /** Spawns a projectile of the given kind in front of the dispenser */ + void SpawnProjectileFromDispenser(cChunk & a_Chunk, int & a_DispX, int & a_DispY, int & a_DispZ, cProjectileEntity::eKind a_kind, Vector3d a_ShootVector); // tolua_export + + /** Returns how to aim the projectile */ + Vector3d GetShootVector(cChunk & a_Chunk); // tolua_export + private: // cDropSpenser overrides: virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override; @@ -29,12 +35,6 @@ private: /// If such a bucket can fit, adds it to m_Contents and returns true bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); - // Spawns a projectile of the given kind in front of the dispenser - void SpawnProjectileFromDispenser(cChunk & a_Chunk, int & a_DispX, int & a_DispY, int & a_DispZ, cProjectileEntity::eKind a_kind); - - // Returns how to aim the projectile - Vector3d GetShootVector(cChunk & a_Chunk); - /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); } ; // tolua_export -- cgit v1.2.3 From daae75b30b7d5e70a26e1518cd7c75988dbfdf9f Mon Sep 17 00:00:00 2001 From: JoannisO Date: Tue, 3 Jun 2014 17:21:38 +0200 Subject: - Cleaned up the code massively - Stopped using cChunk in the GetShootVector class. Parameter is now the Metadata of the block - Stopped using cChunk in the SpawnProjectileFromDispenser method now using coordinates and finding the chunk by itself. - Removed the matrix calculations from GetShootVector. --- src/BlockEntities/DispenserEntity.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 558cf41c5..5a2de7965 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -23,10 +23,10 @@ public: static const char * GetClassStatic(void) { return "cDispenserEntity"; } /** Spawns a projectile of the given kind in front of the dispenser */ - void SpawnProjectileFromDispenser(cChunk & a_Chunk, int & a_DispX, int & a_DispY, int & a_DispZ, cProjectileEntity::eKind a_kind, Vector3d a_ShootVector); // tolua_export + void SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_kind, Vector3d a_ShootVector); /** Returns how to aim the projectile */ - Vector3d GetShootVector(cChunk & a_Chunk); // tolua_export + Vector3d GetShootVector(NIBBLETYPE & a_Meta); private: // cDropSpenser overrides: @@ -38,7 +38,3 @@ private: /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); } ; // tolua_export - - - - -- cgit v1.2.3 From 2c103a713e0ce77ccb8b86c98e2571d5ba6dd9c0 Mon Sep 17 00:00:00 2001 From: JoannisO Date: Wed, 4 Jun 2014 12:35:45 +0200 Subject: - Fixed a lot of astethics --- src/BlockEntities/DispenserEntity.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 5a2de7965..9410a1129 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -23,7 +23,7 @@ public: static const char * GetClassStatic(void) { return "cDispenserEntity"; } /** Spawns a projectile of the given kind in front of the dispenser */ - void SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_kind, Vector3d a_ShootVector); + void SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_Kind, Vector3d a_ShootVector); /** Returns how to aim the projectile */ Vector3d GetShootVector(NIBBLETYPE & a_Meta); @@ -38,3 +38,6 @@ private: /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); } ; // tolua_export + + + -- cgit v1.2.3 From 220e6f5880354c9984e18718f723331bb904df45 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 11 Jun 2014 19:46:24 +0200 Subject: DispenserEntity code cleanup after PR merge. --- src/BlockEntities/DispenserEntity.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/BlockEntities/DispenserEntity.h') diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index 9410a1129..b33d08342 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -17,25 +17,30 @@ public: // tolua_end - /// Constructor used for normal operation + /** Constructor used for normal operation */ cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); static const char * GetClassStatic(void) { return "cDispenserEntity"; } - /** Spawns a projectile of the given kind in front of the dispenser */ - void SpawnProjectileFromDispenser(int & a_BlockX, int & a_BlockY, int & a_BlockZ, cProjectileEntity::eKind a_Kind, Vector3d a_ShootVector); + // tolua_begin + + /** Spawns a projectile of the given kind in front of the dispenser with the specified speed. */ + void SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_Speed); - /** Returns how to aim the projectile */ - Vector3d GetShootVector(NIBBLETYPE & a_Meta); + /** Returns a unit vector in the cardinal direction of where the dispenser is facing. */ + Vector3d GetShootVector(NIBBLETYPE a_Meta); + + // tolua_end private: // cDropSpenser overrides: virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override; - /// If such a bucket can fit, adds it to m_Contents and returns true + /** If such a bucket can fit, adds it to m_Contents and returns true */ bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); - /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true + /** If the a_BlockInFront can be washed away by liquid and the empty bucket can fit, + does the m_Contents processing and returns true. Returns false otherwise. */ bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); } ; // tolua_export -- cgit v1.2.3