This commit is contained in:
MarcEricMartel
2023-12-13 15:04:08 -05:00
parent 5e09305398
commit a85c5cc626
5 changed files with 61 additions and 42 deletions

View File

@@ -12,7 +12,7 @@ Bullet::~Bullet() {}
bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordered_map<uint64_t, Player*> mapPlayer, netprot::ChunkMod** chunkmod) {
int max = 100 / perframe;
float damage = 0.057f;
float damage = 0.098f;
for (int x = 0; x < max; ++x) {
m_currentpos += m_velocity * elapsedtime;
@@ -40,15 +40,17 @@ bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordere
if (!world->ChunkAt(m_currentpos))
return true;
else if (world->BlockAt(m_currentpos) != BTYPE_AIR) {
if (chunkmod) {
using namespace netprot;
*chunkmod = new ChunkMod();
(*chunkmod)->old_b_type = world->BlockAt(m_currentpos);
(*chunkmod)->b_type = BTYPE_AIR;
(*chunkmod)->pos = m_currentpos;
}
if (m_canhurt) {
if (chunkmod) {
using namespace netprot;
*chunkmod = new ChunkMod();
(*chunkmod)->old_b_type = world->BlockAt(m_currentpos);
(*chunkmod)->b_type = BTYPE_AIR;
(*chunkmod)->pos = m_currentpos;
}
world->ChangeBlockAtPosition(BTYPE_AIR, m_currentpos);
world->ChangeBlockAtPosition(BTYPE_AIR, m_currentpos);
}
return true;
}
else if ((m_currentpos - m_startpos).Length() > VIEW_DISTANCE) return true;

View File

@@ -37,8 +37,8 @@
#define STRENGTH_SPEED_BOOST 10 //Pourcentage
#define BULLET_TIME .1
#define SYNC_ACC 200
#define CMOD_ACC 1500
#define SYNC_ACC 200 // ms
#define CMOD_ACC 1500 // ms
typedef uint8_t BlockType;
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_GREENGRASS, BTYPE_LAST };

View File

@@ -45,6 +45,8 @@ public:
std::string m_username;
bool m_hit = false;
bool Eulogy = false;
private:
uint64_t getId() const;