1
0
cuberite-2a/src/Entities/TNTEntity.h
Tiger Wang 93adbdce9a
Use tracing for explosions (#4845)
* TNT: Implement tracing algorithm

+ Add intensity tracing
* Fix iterating over all players to SendExplosion, even those not in range

* Implemented TNT entity interaction

* Fixed misaligned destruction tracing

* Finalise TNT algorithm

- Remove BlockArea and just use chunks

Using SetBlock makes it so that we can update everything properly, and does appear to be faster.

* BlockInfo learns about explosion attentuation

* Rename Explodinator parameters

* TNT: pull block destruction into common function

Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-12 18:57:44 +00:00

44 lines
843 B
C++

#pragma once
#include "Entity.h"
// tolua_begin
class cTNTEntity:
public cEntity
{
// tolua_end
using Super = cEntity;
public: // tolua_export
CLASS_PROTODEF(cTNTEntity)
cTNTEntity(Vector3d a_Pos, unsigned a_FuseTicks = 80);
// cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
// tolua_begin
/** Explode the tnt */
void Explode(void);
/** Returns the fuse ticks until the tnt will explode */
unsigned GetFuseTicks(void) const { return m_FuseTicks; }
/** Set the fuse ticks until the tnt will explode */
void SetFuseTicks(unsigned a_FuseTicks) { m_FuseTicks = a_FuseTicks; }
// tolua_end
protected:
int m_FuseTicks; ///< How much ticks is left, while the tnt will explode
}; // tolua_export