|
@@ -2,8 +2,11 @@
|
|
|
|
|
|
#include "Game.h"
|
|
#include "Game.h"
|
|
|
|
|
|
-FluidBlock::FluidBlock(int typeId, Framework::Vec3<int> pos, int dimensionId)
|
|
|
|
- : Block(typeId, 0, pos, dimensionId, 0)
|
|
|
|
|
|
+FluidBlock::FluidBlock(int typeId,
|
|
|
|
+ Framework::Vec3<int> pos,
|
|
|
|
+ int dimensionId, Vec3<float> lightWeights)
|
|
|
|
+ : Block(typeId, 0, pos, dimensionId, 0),
|
|
|
|
+ lightWeights(lightWeights)
|
|
{
|
|
{
|
|
transparent = 1;
|
|
transparent = 1;
|
|
passable = 1;
|
|
passable = 1;
|
|
@@ -153,7 +156,8 @@ void FluidBlock::onPostTick()
|
|
= getPos() + getDirection(getDirectionFromIndex(i));
|
|
= getPos() + getDirection(getDirectionFromIndex(i));
|
|
if (neighbourTypes[i] == BlockTypeEnum::AIR)
|
|
if (neighbourTypes[i] == BlockTypeEnum::AIR)
|
|
{
|
|
{
|
|
- FluidBlock* spawn = new FluidBlock(typeId, pos, dimensionId);
|
|
|
|
|
|
+ FluidBlock* spawn = new FluidBlock(
|
|
|
|
+ typeId, pos, dimensionId, lightWeights);
|
|
spawn->fluidAmount = 1;
|
|
spawn->fluidAmount = 1;
|
|
Game::INSTANCE->zDimension(getDimensionId())
|
|
Game::INSTANCE->zDimension(getDimensionId())
|
|
->placeBlock(pos, spawn);
|
|
->placeBlock(pos, spawn);
|
|
@@ -244,9 +248,20 @@ void FluidBlock::sortByAmound(FluidBlock** array, int count)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-FluidBlockType::FluidBlockType(
|
|
|
|
- int id, ModelInfo model, const char* name, int mapColor)
|
|
|
|
- : BlockType(id, 0, model, 1, 10, 0, name, true, mapColor)
|
|
|
|
|
|
+void FluidBlock::filterPassingLight(unsigned char rgb[3]) const
|
|
|
|
+{
|
|
|
|
+ rgb[0] = (unsigned char)(rgb[0] * lightWeights.x);
|
|
|
|
+ rgb[1] = (unsigned char)(rgb[1] * lightWeights.y);
|
|
|
|
+ rgb[2] = (unsigned char)(rgb[2] * lightWeights.z);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+FluidBlockType::FluidBlockType(int id,
|
|
|
|
+ ModelInfo model,
|
|
|
|
+ const char* name,
|
|
|
|
+ int mapColor,
|
|
|
|
+ Vec3<float> lightWeights)
|
|
|
|
+ : BlockType(id, 0, model, 1, 10, 0, name, true, mapColor),
|
|
|
|
+ lightWeights(lightWeights)
|
|
{}
|
|
{}
|
|
|
|
|
|
void FluidBlockType::loadSuperBlock(
|
|
void FluidBlockType::loadSuperBlock(
|
|
@@ -272,7 +287,13 @@ Item* FluidBlockType::createItem() const
|
|
|
|
|
|
Block* FluidBlockType::createBlock(Framework::Vec3<int> position, int dimensionId) const
|
|
Block* FluidBlockType::createBlock(Framework::Vec3<int> position, int dimensionId) const
|
|
{
|
|
{
|
|
- FluidBlock* result = new FluidBlock(getId(), position, dimensionId);
|
|
|
|
|
|
+ FluidBlock* result
|
|
|
|
+ = new FluidBlock(getId(), position, dimensionId, lightWeights);
|
|
result->fluidAmount = 1000;
|
|
result->fluidAmount = 1000;
|
|
return result;
|
|
return result;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool FluidBlockType::isFluid() const
|
|
|
|
+{
|
|
|
|
+ return true;
|
|
}
|
|
}
|