Scripting WIP (#70)
* Scripting introduced * AppImage workflow fixes * AppImage workflow simplified * README.md update * README.md update * small fix
This commit is contained in:
@@ -16,6 +16,14 @@ const uint FACE_PZ = 5;
|
||||
|
||||
const uint BLOCK_AABB_GRID = 16;
|
||||
|
||||
struct block_funcs_set {
|
||||
bool init: 1;
|
||||
bool update: 1;
|
||||
bool onplaced: 1;
|
||||
bool onbroken: 1;
|
||||
bool randupdate: 1;
|
||||
};
|
||||
|
||||
struct CoordSystem {
|
||||
glm::ivec3 axisX;
|
||||
glm::ivec3 axisY;
|
||||
@@ -70,6 +78,7 @@ public:
|
||||
bool replaceable = false;
|
||||
bool breakable = true;
|
||||
bool rotatable = false;
|
||||
bool grounded = false;
|
||||
AABB hitbox;
|
||||
BlockRotProfile rotations;
|
||||
|
||||
@@ -78,6 +87,7 @@ public:
|
||||
bool solid = true;
|
||||
bool emissive = false;
|
||||
AABB hitboxes[BlockRotProfile::MAX_COUNT];
|
||||
block_funcs_set funcsset {};
|
||||
} rt;
|
||||
|
||||
Block(std::string name);
|
||||
|
||||
@@ -90,6 +90,13 @@ const AABB* Chunks::isObstacle(float x, float y, float z){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Chunks::isSolid(int x, int y, int z) {
|
||||
voxel* v = get(x, y, z);
|
||||
if (v == nullptr)
|
||||
return false;
|
||||
return contentIds->getBlockDef(v->id)->rt.solid;
|
||||
}
|
||||
|
||||
ubyte Chunks::getLight(int x, int y, int z, int channel){
|
||||
x -= ox * CHUNK_W;
|
||||
z -= oz * CHUNK_D;
|
||||
@@ -167,7 +174,7 @@ void Chunks::set(int x, int y, int z, int id, uint8_t states){
|
||||
else if (y + 1 > chunk->top) chunk->top = y + 1;
|
||||
else if (id == 0) chunk->updateHeights();
|
||||
|
||||
if (lx == 0 && (chunk = getChunk(cx+ox-1, cz+oz)))
|
||||
if (lx == 0 && (chunk = getChunk(cx+ox-1, cz+oz)))
|
||||
chunk->setModified(true);
|
||||
if (lz == 0 && (chunk = getChunk(cx+ox, cz+oz-1)))
|
||||
chunk->setModified(true);
|
||||
|
||||
@@ -54,6 +54,7 @@ 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);
|
||||
|
||||
// does not move chunks inside
|
||||
void _setOffset(int x, int z);
|
||||
|
||||
Reference in New Issue
Block a user