Fix a gross hack related to big refactor.

master
Nicole Collings 2020-08-06 22:19:49 -07:00
parent db64794bcf
commit 2a952955bf
12 changed files with 5 additions and 64 deletions

View File

@ -164,8 +164,7 @@ void LocalPlayer::drawMenu(Renderer &renderer) {
}
//
// Private uncategorized.
// TODO: Categorize and optimize.
// Physics, camera, and player specific functionality.
//
bool LocalPlayer::getKey(Input& input, LocalPlayer::PlayerControl control) {

View File

@ -108,38 +108,3 @@ void LocalWorld::renderEntities(Renderer &renderer) {
activeDimension->renderEntities(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();
// }
//}

View File

@ -22,10 +22,6 @@ unsigned int DimensionBase::getInd() {
return ind;
}
void DimensionBase::update(double delta) {
updateBlockDamage(delta);
}
std::shared_ptr<Region> DimensionBase::getRegion(glm::ivec3 regionPosition) const {
auto l = getReadLock();
if (!regions.count(regionPosition)) return nullptr;
@ -146,16 +142,6 @@ World& DimensionBase::getWorld() {
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> src;
std::shared_ptr<Chunk> res;

View File

@ -26,7 +26,7 @@ public:
std::string getIdentifier() const;
unsigned int getInd();
virtual void update(double delta);
virtual void update(double delta) = 0;
std::shared_ptr<Region> getRegion(glm::ivec3 regionPosition) const;
void removeRegion(glm::ivec3 pos);
@ -53,8 +53,6 @@ public:
World& getWorld();
protected:
virtual void updateBlockDamage(double delta);
// 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.
// TODO: Make this more efficient using proper RIE traversal.

View File

@ -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)) {}
void LocalDimension::update(double delta) {
Dimension::update(delta);
finishMeshes();
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) {
std::string type, a, b;
unsigned int dim = d.read<unsigned int>();
d.read<unsigned int>();
std::shared_ptr<LocalLuaEntity> activeEntity = nullptr;
@ -179,8 +176,7 @@ void LocalDimension::serverEntitiesInfo(Deserializer& d) {
unsigned int id = d.read<unsigned int>();
if (serverEntityRefs.count(id)) activeEntity = serverEntityRefs.at(id)->entity.l();
else {
//TODO BEFORE COMMIT: *oh my god, please don't do this*
auto ent = std::make_shared<LocalLuaEntity>(game, DimensionPtr(std::shared_ptr<LocalDimension>(this, [](LocalDimension*){})));
auto ent = std::make_shared<LocalLuaEntity>(game, world.getDimension(getInd()));
auto entity = Api::Usertype::Entity(ent);
ent->setId(id);
serverEntities.push_back(entity);
@ -200,8 +196,7 @@ void LocalDimension::serverEntitiesInfo(Deserializer& d) {
}
void LocalDimension::serverEntitiesRemoved(Deserializer& d) {
unsigned int dim = d.read<unsigned int>();
d.read<unsigned int>();
while (!d.atEnd()) {
unsigned int id = d.read<unsigned int>();
if (!serverEntityRefs.count(id)) continue;

View File

@ -19,8 +19,6 @@ ServerDimension::ServerDimension(SubgamePtr game, ServerWorld& world, const std:
Dimension(game, static_cast<World&>(world), identifier, ind) {}
void ServerDimension::update(double delta) {
Dimension::update(delta);
//TODO: Thiss
// for (const auto& region : regions) {
// 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