Fix a gross hack related to big refactor.
parent
db64794bcf
commit
2a952955bf
|
@ -164,8 +164,7 @@ void LocalPlayer::drawMenu(Renderer &renderer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private uncategorized.
|
// Physics, camera, and player specific functionality.
|
||||||
// TODO: Categorize and optimize.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
bool LocalPlayer::getKey(Input& input, LocalPlayer::PlayerControl control) {
|
bool LocalPlayer::getKey(Input& input, LocalPlayer::PlayerControl control) {
|
||||||
|
|
|
@ -108,38 +108,3 @@ void LocalWorld::renderEntities(Renderer &renderer) {
|
||||||
activeDimension->renderEntities(renderer);
|
activeDimension->renderEntities(renderer);
|
||||||
player.l()->draw(renderer);
|
player.l()->draw(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void LocalWorld::updateBlockDamages(double delta) {
|
|
||||||
// auto it = crackEntities.cbegin();
|
|
||||||
// while (it != crackEntities.cend()) {
|
|
||||||
// bool deleteMe = false;
|
|
||||||
//
|
|
||||||
// auto curr = it++;
|
|
||||||
// auto block = curr->second;
|
|
||||||
//
|
|
||||||
// block->time += delta;
|
|
||||||
//
|
|
||||||
// if (block->damage >= block->maxHealth) {
|
|
||||||
// //Todo: Lua callback~
|
|
||||||
// setBlock(block->getPos(), DefinitionAtlas::AIR);
|
|
||||||
// setBlockDamage(block->getPos(), 0);
|
|
||||||
// deleteMe = true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (block->time > 2) {
|
|
||||||
// block->update();
|
|
||||||
// block->addDamage(-1);
|
|
||||||
// block->time = 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (block->damage < 0 || block->def.index != getBlock(block->getPos())) {
|
|
||||||
// deleteMe = true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (deleteMe) {
|
|
||||||
// delete block;
|
|
||||||
// it = crackEntities.erase(curr);
|
|
||||||
// }
|
|
||||||
// else block->update();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
|
@ -22,10 +22,6 @@ unsigned int DimensionBase::getInd() {
|
||||||
return ind;
|
return ind;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DimensionBase::update(double delta) {
|
|
||||||
updateBlockDamage(delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Region> DimensionBase::getRegion(glm::ivec3 regionPosition) const {
|
std::shared_ptr<Region> DimensionBase::getRegion(glm::ivec3 regionPosition) const {
|
||||||
auto l = getReadLock();
|
auto l = getReadLock();
|
||||||
if (!regions.count(regionPosition)) return nullptr;
|
if (!regions.count(regionPosition)) return nullptr;
|
||||||
|
@ -146,16 +142,6 @@ World& DimensionBase::getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DimensionBase::updateBlockDamage(double delta) {
|
|
||||||
// for (auto it = blockDamages.begin(); it != blockDamages.end();) {
|
|
||||||
// if (it->second.curr > it->second.max) {
|
|
||||||
// setBlock(it->first, DefinitionAtlas::AIR);
|
|
||||||
// it = blockDamages.erase(it);
|
|
||||||
// }
|
|
||||||
// else it++;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Chunk> DimensionBase::combinePartials(std::shared_ptr<Chunk> a, std::shared_ptr<Chunk> b) {
|
std::shared_ptr<Chunk> DimensionBase::combinePartials(std::shared_ptr<Chunk> a, std::shared_ptr<Chunk> b) {
|
||||||
std::shared_ptr<Chunk> src;
|
std::shared_ptr<Chunk> src;
|
||||||
std::shared_ptr<Chunk> res;
|
std::shared_ptr<Chunk> res;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
std::string getIdentifier() const;
|
std::string getIdentifier() const;
|
||||||
unsigned int getInd();
|
unsigned int getInd();
|
||||||
|
|
||||||
virtual void update(double delta);
|
virtual void update(double delta) = 0;
|
||||||
|
|
||||||
std::shared_ptr<Region> getRegion(glm::ivec3 regionPosition) const;
|
std::shared_ptr<Region> getRegion(glm::ivec3 regionPosition) const;
|
||||||
void removeRegion(glm::ivec3 pos);
|
void removeRegion(glm::ivec3 pos);
|
||||||
|
@ -53,8 +53,6 @@ public:
|
||||||
World& getWorld();
|
World& getWorld();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void updateBlockDamage(double delta);
|
|
||||||
|
|
||||||
// Combine two chunk partials, or a chunk and a chunk partial.
|
// Combine two chunk partials, or a chunk and a chunk partial.
|
||||||
// If both are partials `b` takes preference, if one is a fully generated chunk the partial takes preference.
|
// If both are partials `b` takes preference, if one is a fully generated chunk the partial takes preference.
|
||||||
// TODO: Make this more efficient using proper RIE traversal.
|
// TODO: Make this more efficient using proper RIE traversal.
|
||||||
|
|
|
@ -21,8 +21,6 @@ LocalDimension::LocalDimension(SubgamePtr game, LocalWorld& world, const std::st
|
||||||
Dimension(game, static_cast<World&>(world), identifier, ind), meshGenStream(std::make_shared<MeshGenStream>(game, *this)) {}
|
Dimension(game, static_cast<World&>(world), identifier, ind), meshGenStream(std::make_shared<MeshGenStream>(game, *this)) {}
|
||||||
|
|
||||||
void LocalDimension::update(double delta) {
|
void LocalDimension::update(double delta) {
|
||||||
Dimension::update(delta);
|
|
||||||
|
|
||||||
finishMeshes();
|
finishMeshes();
|
||||||
|
|
||||||
for (auto& entity : localEntities ) entity.entity.l()->update(delta);
|
for (auto& entity : localEntities ) entity.entity.l()->update(delta);
|
||||||
|
@ -168,8 +166,7 @@ void LocalDimension::removeLocalEntity(Api::Usertype::Entity entity) {
|
||||||
|
|
||||||
void LocalDimension::serverEntitiesInfo(Deserializer& d) {
|
void LocalDimension::serverEntitiesInfo(Deserializer& d) {
|
||||||
std::string type, a, b;
|
std::string type, a, b;
|
||||||
|
d.read<unsigned int>();
|
||||||
unsigned int dim = d.read<unsigned int>();
|
|
||||||
|
|
||||||
std::shared_ptr<LocalLuaEntity> activeEntity = nullptr;
|
std::shared_ptr<LocalLuaEntity> activeEntity = nullptr;
|
||||||
|
|
||||||
|
@ -179,8 +176,7 @@ void LocalDimension::serverEntitiesInfo(Deserializer& d) {
|
||||||
unsigned int id = d.read<unsigned int>();
|
unsigned int id = d.read<unsigned int>();
|
||||||
if (serverEntityRefs.count(id)) activeEntity = serverEntityRefs.at(id)->entity.l();
|
if (serverEntityRefs.count(id)) activeEntity = serverEntityRefs.at(id)->entity.l();
|
||||||
else {
|
else {
|
||||||
//TODO BEFORE COMMIT: *oh my god, please don't do this*
|
auto ent = std::make_shared<LocalLuaEntity>(game, world.getDimension(getInd()));
|
||||||
auto ent = std::make_shared<LocalLuaEntity>(game, DimensionPtr(std::shared_ptr<LocalDimension>(this, [](LocalDimension*){})));
|
|
||||||
auto entity = Api::Usertype::Entity(ent);
|
auto entity = Api::Usertype::Entity(ent);
|
||||||
ent->setId(id);
|
ent->setId(id);
|
||||||
serverEntities.push_back(entity);
|
serverEntities.push_back(entity);
|
||||||
|
@ -200,8 +196,7 @@ void LocalDimension::serverEntitiesInfo(Deserializer& d) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalDimension::serverEntitiesRemoved(Deserializer& d) {
|
void LocalDimension::serverEntitiesRemoved(Deserializer& d) {
|
||||||
unsigned int dim = d.read<unsigned int>();
|
d.read<unsigned int>();
|
||||||
|
|
||||||
while (!d.atEnd()) {
|
while (!d.atEnd()) {
|
||||||
unsigned int id = d.read<unsigned int>();
|
unsigned int id = d.read<unsigned int>();
|
||||||
if (!serverEntityRefs.count(id)) continue;
|
if (!serverEntityRefs.count(id)) continue;
|
||||||
|
|
|
@ -19,8 +19,6 @@ ServerDimension::ServerDimension(SubgamePtr game, ServerWorld& world, const std:
|
||||||
Dimension(game, static_cast<World&>(world), identifier, ind) {}
|
Dimension(game, static_cast<World&>(world), identifier, ind) {}
|
||||||
|
|
||||||
void ServerDimension::update(double delta) {
|
void ServerDimension::update(double delta) {
|
||||||
Dimension::update(delta);
|
|
||||||
|
|
||||||
//TODO: Thiss
|
//TODO: Thiss
|
||||||
// for (const auto& region : regions) {
|
// for (const auto& region : regions) {
|
||||||
// for (unsigned short i = 0; i < 64; i++) {
|
// for (unsigned short i = 0; i < 64; i++) {
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 866 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue