Fix a couple mapgen bugs from last commit
parent
119b6dfa55
commit
aee43750f4
|
@ -162,14 +162,17 @@ void MapGen::generateBlocks(chunk_partial& chunk) {
|
|||
unsigned short x = i / 16;
|
||||
unsigned short z = i % 16;
|
||||
|
||||
lp = {x, 0, z};
|
||||
auto& biome = biomes.getBiomeAt(chunk.first->temperature.get(lp), chunk.first->humidity.get(lp), chunk.first->roughness.get(lp));
|
||||
|
||||
for (unsigned short y = 0; y < 16; y++) {
|
||||
lp = {x, y, z};
|
||||
lp.y = y;
|
||||
unsigned short ind = Space::Block::index(lp);
|
||||
|
||||
chunk.second->biomes[ind] = biome.index;
|
||||
|
||||
if (chunk.second->blocks[ind] != DefinitionAtlas::INVALID) continue;
|
||||
|
||||
int d = std::floor(chunk.first->depth[ind]);
|
||||
chunk.second->blocks[ind]
|
||||
= d <= 1 ? DefinitionAtlas::AIR
|
||||
|
@ -208,7 +211,7 @@ void MapGen::generateStructures(chunk_partials_map& chunks, chunk_partial& chunk
|
|||
lp = {x, y, z};
|
||||
unsigned short ind = Space::Block::index(lp);
|
||||
|
||||
if (chunk.first->depth[ind] <= 2 && chunk.first->depth[ind] > 1) {
|
||||
if (chunk.first->depth[ind] > 0 && chunk.first->depth[ind] <= 1.1) {
|
||||
|
||||
glm::ivec3 off = {};
|
||||
glm::ivec3 p = wp * 16 + lp;
|
||||
|
@ -254,7 +257,7 @@ std::shared_ptr<BlockChunk> MapGen::combinePartials(std::shared_ptr<BlockChunk>
|
|||
}
|
||||
|
||||
for (unsigned int i = 0; i < 4096; i++) {
|
||||
if (src->getBlock(i) != DefinitionAtlas::INVALID) res->setBlock(i, src->getBlock(i));
|
||||
if (src->getBlock(i) > DefinitionAtlas::INVALID) res->setBlock(i, src->getBlock(i));
|
||||
}
|
||||
|
||||
res->generated = src->generated || res->generated;
|
||||
|
|
|
@ -78,7 +78,7 @@ void LocalLuaEntity::set_scale(float scale) {
|
|||
}
|
||||
|
||||
float LocalLuaEntity::get_scale() {
|
||||
return entity->getScale().x; //TODO: Make this return a vector - maybe?
|
||||
return entity->getScale().x;
|
||||
}
|
||||
|
||||
void LocalLuaEntity::set_display_type(const std::string &type, const std::string &arg, sol::optional<std::string> arg2) {
|
||||
|
|
|
@ -86,7 +86,7 @@ inline bool BlockChunk::setBlock(const glm::ivec3& pos, unsigned int blk) {
|
|||
}
|
||||
|
||||
inline unsigned int BlockChunk::getBlock(unsigned int ind) const {
|
||||
if (ind > 4096) return DefinitionAtlas::INVALID;
|
||||
if (ind >= 4096) return DefinitionAtlas::INVALID;
|
||||
return blocks[ind];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,20 +4,20 @@ zepha.register_entity("zeus:default:test", {
|
|||
display_texture = "zeus:default:player",
|
||||
|
||||
on_create = fn(self) {
|
||||
self.object.anims:define({
|
||||
walk = {0, 300}
|
||||
})
|
||||
self.object.anims:set_anim("walk"):play()
|
||||
## self.object.anims:define({
|
||||
## walk = {0, 300}
|
||||
## })
|
||||
## self.object.anims:set_anim("walk"):play()
|
||||
self.object.scale = 1/4
|
||||
},
|
||||
on_update = fn(self, delta) {
|
||||
## self.object.pos = vector.add(vector.multiply(v(0.6 * math.sin(math.rad(self.object.yaw)), 0,
|
||||
## 0.6 * math.cos(math.rad(self.object.yaw))), delta), self.object.pos)
|
||||
## self.object.yaw += 50 * delta
|
||||
self.object.pos = vector.add(vector.multiply(v(0.6 * math.sin(math.rad(self.object.yaw)), 0,
|
||||
0.6 * math.cos(math.rad(self.object.yaw))), delta), self.object.pos)
|
||||
self.object.yaw += 50 * delta
|
||||
}
|
||||
})
|
||||
|
||||
if (zepha.client) {
|
||||
if (zepha.server) {
|
||||
local entity = zepha.add_entity("zeus:default:test", v(0, 0, 0))
|
||||
##zepha.delay(() => { zepha.remove_entity(entity) }, 10)
|
||||
}
|
Loading…
Reference in New Issue