commit
3101b1b5f8
@ -12,9 +12,6 @@
|
||||
"ru_RU": {
|
||||
"name": "Русский"
|
||||
},
|
||||
"su_SU": {
|
||||
"name": "Советский"
|
||||
},
|
||||
"uk_UA": {
|
||||
"name": "Українська"
|
||||
}
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
# Общее
|
||||
Yes=Да
|
||||
No=Нет
|
||||
Ok = Понятно
|
||||
Cancel=Отмена
|
||||
Back = Обратно
|
||||
Continue=Продолжить
|
||||
|
||||
error.pack-not-found=Не удалось найти пакет
|
||||
|
||||
# Меню
|
||||
menu.New World = Новый Мир
|
||||
menu.Quit=Выход
|
||||
menu.Continue=Продолжить
|
||||
menu.Save and Quit to Menu=Сохранить и Вернуться на Главную
|
||||
menu.missing-content=Отсутствует некоторое наполнение!
|
||||
menu.Controls=Управление
|
||||
menu.Back to Main Menu=Вернуться на Главную
|
||||
menu.Settings=Настройки
|
||||
menu.Content=Наполнение
|
||||
menu.Seed=Семя
|
||||
menu.Name=Название
|
||||
menu.Create World=Создать Мир
|
||||
|
||||
world.convert-request=Есть изменения в индексах! Преобразовать мир?
|
||||
|
||||
# Настройки
|
||||
settings.Load Distance=Дальность Загрузки
|
||||
settings.Load Speed=Скорость Загрузки
|
||||
settings.Fog Curve=Искривление Тумана
|
||||
settings.Backlight=Подсветка
|
||||
settings.V-Sync=Вертикальная Синхронизация
|
||||
|
||||
settings.FOV=Поле Зрения
|
||||
settings.Mouse Sensitivity=Чувствительность Мыши
|
||||
settings.Language=Язык
|
||||
|
||||
# Управление
|
||||
movement.forward=Вперёд
|
||||
movement.back=Назад
|
||||
movement.left=Влево
|
||||
movement.right=Вправо
|
||||
movement.jump=Прыжок
|
||||
movement.sprint=Ускорение
|
||||
movement.crouch=Красться
|
||||
movement.cheat=Чит
|
||||
hud.inventory=Инвентарь
|
||||
player.pick=Подобрать Блок
|
||||
player.attack=Атаковать / Сломать
|
||||
player.build=Поставить Блок
|
||||
player.flight=Полёт
|
||||
camera.zoom=Приближение
|
||||
camera.mode=Сменить Режим Камеры
|
||||
@ -70,7 +70,7 @@ void BlocksController::updateBlock(int x, int y, int z) {
|
||||
if (vox == nullptr)
|
||||
return;
|
||||
const Block* def = level->content->indices->getBlockDef(vox->id);
|
||||
if (def->grounded && !chunks->isSolid(x, y-1, z)) {
|
||||
if (def->grounded && !chunks->isSolidBlock(x, y-1, z)) {
|
||||
breakBlock(nullptr, def, x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ void PlayerController::updateInteraction(){
|
||||
if (!level->physics->isBlockInside(x,y,z, player->hitbox)
|
||||
|| !def->obstacle){
|
||||
Block* def = contentIds->getBlockDef(chosenBlock);
|
||||
if (def->grounded && !chunks->isSolid(x, y-1, z)) {
|
||||
if (def->grounded && !chunks->isSolidBlock(x, y-1, z)) {
|
||||
chosenBlock = 0;
|
||||
}
|
||||
if (chosenBlock != vox->id) {
|
||||
|
||||
@ -23,7 +23,7 @@ int l_is_solid_at(lua_State* L) {
|
||||
int y = lua_tointeger(L, 2);
|
||||
int z = lua_tointeger(L, 3);
|
||||
|
||||
lua_pushboolean(L, scripting::level->chunks->isSolid(x, y, z));
|
||||
lua_pushboolean(L, scripting::level->chunks->isSolidBlock(x, y, z));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ int l_is_replaceable_at(lua_State* L) {
|
||||
int y = lua_tointeger(L, 2);
|
||||
int z = lua_tointeger(L, 3);
|
||||
|
||||
lua_pushboolean(L, scripting::level->chunks->isReplaceable(x, y, z));
|
||||
lua_pushboolean(L, scripting::level->chunks->isReplaceableBlock(x, y, z));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ struct AABB {
|
||||
}
|
||||
|
||||
/* Check if given point is inside */
|
||||
inline bool inside(const glm::vec3 pos) const {
|
||||
inline bool contains(const glm::vec3 pos) const {
|
||||
const glm::vec3 p = min();
|
||||
const glm::vec3 s = size();
|
||||
return !(pos.x < p.x || pos.y < p.y || pos.z < p.z ||
|
||||
|
||||
@ -46,7 +46,7 @@ void PhysicsSolver::step(
|
||||
hitbox->grounded = false;
|
||||
for (float x = (px-half.x+E); x <= (px+half.x-E); x+=s){
|
||||
for (float z = (pos.z-half.z+E); z <= (pos.z+half.z-E); z+=s){
|
||||
if (chunks->isObstacle(x,y,z)){
|
||||
if (chunks->isObstacleAt(x,y,z)){
|
||||
hitbox->grounded = true;
|
||||
break;
|
||||
}
|
||||
@ -58,7 +58,7 @@ void PhysicsSolver::step(
|
||||
hitbox->grounded = false;
|
||||
for (float x = (pos.x-half.x+E); x <= (pos.x+half.x-E); x+=s){
|
||||
for (float z = (pz-half.z+E); z <= (pz+half.z-E); z+=s){
|
||||
if (chunks->isObstacle(x,y,z)){
|
||||
if (chunks->isObstacleAt(x,y,z)){
|
||||
hitbox->grounded = true;
|
||||
break;
|
||||
}
|
||||
@ -88,7 +88,7 @@ void PhysicsSolver::colisionCalc(
|
||||
for (float y = (pos.y-half.y+E); y <= (pos.y+half.y-E); y+=s){
|
||||
for (float z = (pos.z-half.z+E); z <= (pos.z+half.z-E); z+=s){
|
||||
float x = (pos.x-half.x-E);
|
||||
if ((aabb = chunks->isObstacle(x,y,z))){
|
||||
if ((aabb = chunks->isObstacleAt(x,y,z))){
|
||||
vel.x *= 0.0f;
|
||||
pos.x = floor(x) + aabb->max().x + half.x + E;
|
||||
break;
|
||||
@ -100,7 +100,7 @@ void PhysicsSolver::colisionCalc(
|
||||
for (float y = (pos.y-half.y+E); y <= (pos.y+half.y-E); y+=s){
|
||||
for (float z = (pos.z-half.z+E); z <= (pos.z+half.z-E); z+=s){
|
||||
float x = (pos.x+half.x+E);
|
||||
if ((aabb = chunks->isObstacle(x,y,z))){
|
||||
if ((aabb = chunks->isObstacleAt(x,y,z))){
|
||||
vel.x *= 0.0f;
|
||||
pos.x = floor(x) - half.x + aabb->min().x - E;
|
||||
break;
|
||||
@ -113,7 +113,7 @@ void PhysicsSolver::colisionCalc(
|
||||
for (float y = (pos.y-half.y+E); y <= (pos.y+half.y-E); y+=s){
|
||||
for (float x = (pos.x-half.x+E); x <= (pos.x+half.x-E); x+=s){
|
||||
float z = (pos.z-half.z-E);
|
||||
if ((aabb = chunks->isObstacle(x,y,z))){
|
||||
if ((aabb = chunks->isObstacleAt(x,y,z))){
|
||||
vel.z *= 0.0f;
|
||||
pos.z = floor(z) + aabb->max().z + half.z + E;
|
||||
break;
|
||||
@ -126,7 +126,7 @@ void PhysicsSolver::colisionCalc(
|
||||
for (float y = (pos.y-half.y+E); y <= (pos.y+half.y-E); y+=s){
|
||||
for (float x = (pos.x-half.x+E); x <= (pos.x+half.x-E); x+=s){
|
||||
float z = (pos.z+half.z+E);
|
||||
if ((aabb = chunks->isObstacle(x,y,z))){
|
||||
if ((aabb = chunks->isObstacleAt(x,y,z))){
|
||||
vel.z *= 0.0f;
|
||||
pos.z = floor(z) - half.z + aabb->min().z - E;
|
||||
break;
|
||||
@ -139,7 +139,7 @@ void PhysicsSolver::colisionCalc(
|
||||
for (float x = (pos.x-half.x+E); x <= (pos.x+half.x-E); x+=s){
|
||||
for (float z = (pos.z-half.z+E); z <= (pos.z+half.z-E); z+=s){
|
||||
float y = (pos.y-half.y-E);
|
||||
if ((aabb = chunks->isObstacle(x,y,z))){
|
||||
if ((aabb = chunks->isObstacleAt(x,y,z))){
|
||||
vel.y *= 0.0f;
|
||||
pos.y = floor(y) + aabb->max().y + half.y;
|
||||
hitbox->grounded = true;
|
||||
@ -152,7 +152,7 @@ void PhysicsSolver::colisionCalc(
|
||||
for (float x = (pos.x-half.x+E); x <= (pos.x+half.x-E); x+=s){
|
||||
for (float z = (pos.z-half.z+E); z <= (pos.z+half.z-E); z+=s){
|
||||
float y = (pos.y+half.y+E);
|
||||
if ((aabb = chunks->isObstacle(x,y,z))){
|
||||
if ((aabb = chunks->isObstacleAt(x,y,z))){
|
||||
vel.y *= 0.0f;
|
||||
pos.y = floor(y) - half.y + aabb->min().y - E;
|
||||
break;
|
||||
|
||||
@ -45,17 +45,15 @@ Chunks::~Chunks(){
|
||||
chunks[i] = nullptr;
|
||||
}
|
||||
delete[] chunks;
|
||||
delete[] chunksSecond;
|
||||
}
|
||||
|
||||
voxel* Chunks::get(int x, int y, int z){
|
||||
x -= ox * CHUNK_W;
|
||||
z -= oz * CHUNK_D;
|
||||
int cx = x / CHUNK_W;
|
||||
int cy = y / CHUNK_H;
|
||||
int cz = z / CHUNK_D;
|
||||
if (x < 0) cx--;
|
||||
if (y < 0) cy--;
|
||||
if (z < 0) cz--;
|
||||
int cx = floordiv(x, CHUNK_W);
|
||||
int cy = floordiv(y, CHUNK_H);
|
||||
int cz = floordiv(z, CHUNK_D);
|
||||
if (cx < 0 || cy < 0 || cz < 0 || cx >= w || cy >= 1 || cz >= d)
|
||||
return nullptr;
|
||||
shared_ptr<Chunk> chunk = chunks[cz * w + cx]; // chunks is 2D-array
|
||||
@ -67,7 +65,7 @@ voxel* Chunks::get(int x, int y, int z){
|
||||
return &chunk->voxels[(ly * CHUNK_D + lz) * CHUNK_W + lx];
|
||||
}
|
||||
|
||||
const AABB* Chunks::isObstacle(float x, float y, float z){
|
||||
const AABB* Chunks::isObstacleAt(float x, float y, float z){
|
||||
int ix = floor(x);
|
||||
int iy = floor(y);
|
||||
int iz = floor(z);
|
||||
@ -82,7 +80,7 @@ const AABB* Chunks::isObstacle(float x, float y, float z){
|
||||
if (def->rt.solid) {
|
||||
return &hitbox;
|
||||
} else {
|
||||
if (hitbox.inside({x - ix, y - iy, z - iz}))
|
||||
if (hitbox.contains({x - ix, y - iy, z - iz}))
|
||||
return &hitbox;
|
||||
return nullptr;
|
||||
}
|
||||
@ -90,20 +88,27 @@ const AABB* Chunks::isObstacle(float x, float y, float z){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Chunks::isSolid(int x, int y, int z) {
|
||||
bool Chunks::isSolidBlock(int x, int y, int z) {
|
||||
voxel* v = get(x, y, z);
|
||||
if (v == nullptr)
|
||||
return false;
|
||||
return contentIds->getBlockDef(v->id)->rt.solid;
|
||||
}
|
||||
|
||||
bool Chunks::isReplaceable(int x, int y, int z) {
|
||||
bool Chunks::isReplaceableBlock(int x, int y, int z) {
|
||||
voxel* v = get(x, y, z);
|
||||
if (v == nullptr)
|
||||
return false;
|
||||
return contentIds->getBlockDef(v->id)->replaceable;
|
||||
}
|
||||
|
||||
bool Chunks::isObstacleBlock(int x, int y, int z) {
|
||||
voxel* v = get(x, y, z);
|
||||
if (v == nullptr)
|
||||
return false;
|
||||
return contentIds->getBlockDef(v->id)->obstacle;
|
||||
}
|
||||
|
||||
ubyte Chunks::getLight(int x, int y, int z, int channel){
|
||||
x -= ox * CHUNK_W;
|
||||
z -= oz * CHUNK_D;
|
||||
@ -233,7 +238,7 @@ voxel* Chunks::rayCast(vec3 start,
|
||||
|
||||
while (t <= maxDist){
|
||||
voxel* voxel = get(ix, iy, iz);
|
||||
if (!voxel){ return nullptr; }
|
||||
if (voxel == nullptr){ return nullptr; }
|
||||
|
||||
const Block* def = contentIds->getBlockDef(voxel->id);
|
||||
if (def->selectable){
|
||||
@ -338,7 +343,7 @@ vec3 Chunks::rayCastToObstacle(vec3 start, vec3 dir, float maxDist) {
|
||||
|
||||
while (t <= maxDist) {
|
||||
voxel* voxel = get(ix, iy, iz);
|
||||
if (!voxel) { return vec3(px + t * dx, py + t * dy, pz + t * dz); }
|
||||
if (voxel == nullptr) { return vec3(px + t * dx, py + t * dy, pz + t * dz); }
|
||||
|
||||
const Block* def = contentIds->getBlockDef(voxel->id);
|
||||
if (def->obstacle) {
|
||||
|
||||
@ -53,9 +53,10 @@ public:
|
||||
|
||||
glm::vec3 rayCastToObstacle(glm::vec3 start, glm::vec3 dir, float maxDist);
|
||||
|
||||
const AABB* isObstacle(float x, float y, float z);
|
||||
bool isSolid(int x, int y, int z);
|
||||
bool isReplaceable(int x, int y, int z);
|
||||
const AABB* isObstacleAt(float x, float y, float z);
|
||||
bool isSolidBlock(int x, int y, int z);
|
||||
bool isReplaceableBlock(int x, int y, int z);
|
||||
bool isObstacleBlock(int x, int y, int z);
|
||||
|
||||
// does not move chunks inside
|
||||
void _setOffset(int x, int z);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user