bulletadd
This commit is contained in:
@@ -95,7 +95,7 @@ void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*
|
||||
if (outs >= 1000) {
|
||||
outs -= 1000;
|
||||
Sync sync;
|
||||
sync.hp = player.get()->GetHP();
|
||||
sync.hp = player->GetHP();
|
||||
sync.timestamp = out.timestamp;
|
||||
sync.position = out.position;
|
||||
sync.sid = m_loginfo.sid;
|
||||
@@ -109,13 +109,14 @@ void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*
|
||||
}
|
||||
}
|
||||
|
||||
void Connection::Run(World* world) {
|
||||
Timestamp Connection::Run(World* world) {
|
||||
Input in, last;
|
||||
Output out;
|
||||
Timestamp tstamp = 0;
|
||||
float el;
|
||||
|
||||
if (m_input_manifest.size() < 2)
|
||||
return;
|
||||
return tstamp;
|
||||
|
||||
while (m_last_in < m_input_vector.size() - 1) {
|
||||
in = m_input_vector.at(m_last_in + 1);
|
||||
@@ -129,30 +130,39 @@ void Connection::Run(World* world) {
|
||||
m_shoot_acc = 0;
|
||||
}
|
||||
|
||||
player.get()->SetDirection(in.direction);
|
||||
player.get()->ApplyPhysics(player.get()->GetInput(in.keys.forward,
|
||||
in.keys.backward,
|
||||
in.keys.left,
|
||||
in.keys.right,
|
||||
in.keys.jump, false, el), world, el);
|
||||
player->SetDirection(in.direction);
|
||||
player->ApplyPhysics(player->GetInput(in.keys.forward,
|
||||
in.keys.backward,
|
||||
in.keys.left,
|
||||
in.keys.right,
|
||||
in.keys.jump, false, el), world, el);
|
||||
|
||||
//if (in.keys.block)
|
||||
// ChunkDiffs.push_back()
|
||||
if (in.keys.block) {
|
||||
bool block = false;
|
||||
ChunkMod* cmod = world->ChangeBlockAtCursor(BLOCK_TYPE::BTYPE_METAL,
|
||||
player->GetPosition(),
|
||||
player->GetDirection(),
|
||||
block, true);
|
||||
if (cmod)
|
||||
ChunkDiffs.emplace_back(cmod);
|
||||
}
|
||||
|
||||
if (in.keys.shoot && m_shoot_acc <= 0.)
|
||||
Bullets.push_back(Bullet(player.get()->GetPOV() + player.get()->GetDirection(), player.get()->GetDirection()));
|
||||
Bullets.push_back(Bullet(player->GetPOV() + player->GetDirection(), player->GetDirection()));
|
||||
|
||||
|
||||
out.position = player.get()->GetPositionAbs();
|
||||
out.position = player->GetPositionAbs();
|
||||
out.direction = in.direction;
|
||||
out.timestamp = in.timestamp;
|
||||
out.id = m_playinfo.id;
|
||||
|
||||
m_output_manifest[out.timestamp] = out;
|
||||
m_output_vector.push_back(out);
|
||||
tstamp = out.timestamp;
|
||||
|
||||
++m_last_in;
|
||||
}
|
||||
|
||||
return tstamp;
|
||||
}
|
||||
|
||||
void Connection::CleanInputManifest(Timestamp time) {
|
||||
@@ -161,3 +171,5 @@ void Connection::CleanInputManifest(Timestamp time) {
|
||||
// while (wat != m_input_manifest.begin())
|
||||
// m_input_manifest.erase(wat--);
|
||||
}
|
||||
|
||||
Timestamp Connection::GetTStamp() const { return m_tstamp; }
|
||||
|
Reference in New Issue
Block a user