mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-12-05 07:47:43 +01:00
Merge remote-tracking branch 'origin/main' into feat/native-linux-support
This commit is contained in:
commit
6032f0d3a0
1 file changed
+27
-29
+27
-29
@@ -441,7 +441,6 @@ void Boat::tick()
|
||||
|
||||
shared_ptr<Entity> driver = rider.lock();
|
||||
shared_ptr<Player> player = driver != nullptr ? dynamic_pointer_cast<Player>(driver) : nullptr;
|
||||
bool steer = (player != nullptr) ? isLocallyDriven() : !level->isClientSide;
|
||||
|
||||
if (player != nullptr)
|
||||
{
|
||||
@@ -455,7 +454,7 @@ void Boat::tick()
|
||||
inputLeft = inputRight = inputUp = inputDown = false;
|
||||
}
|
||||
|
||||
if (lSteps > 0 && !steer)
|
||||
if (lSteps > 0 && !isLocallyDriven())
|
||||
{
|
||||
double xt = x + (lx - x) / lSteps;
|
||||
double yt = y + (ly - y) / lSteps;
|
||||
@@ -468,25 +467,13 @@ void Boat::tick()
|
||||
setRot(yRot, xRot);
|
||||
}
|
||||
|
||||
if (steer)
|
||||
{
|
||||
if (player == nullptr && !level->isClientSide) setPaddleState(false, false);
|
||||
if (!level->isClientSide && player == nullptr)
|
||||
setPaddleState(false, false);
|
||||
|
||||
floatBoat();
|
||||
floatBoat();
|
||||
if (level->isClientSide)
|
||||
controlBoat();
|
||||
move(xd, yd, zd);
|
||||
}
|
||||
else
|
||||
{
|
||||
xd = 0.0;
|
||||
yd = 0.0;
|
||||
zd = 0.0;
|
||||
|
||||
if (player != nullptr && !level->isClientSide)
|
||||
{
|
||||
setPaddleState(inputRight || inputUp, inputLeft || inputUp);
|
||||
}
|
||||
}
|
||||
move(xd, yd, zd);
|
||||
|
||||
const float paddleStroke = PI / 8.0f;
|
||||
const float paddleSplash = PI / 4.0f;
|
||||
@@ -495,18 +482,24 @@ void Boat::tick()
|
||||
{
|
||||
if (getPaddleState(side))
|
||||
{
|
||||
if (!level->isClientSide && fmod(paddlePositions[side], paddleCycle) <= paddleSplash && fmod(paddlePositions[side] + paddleStroke, paddleCycle) >= paddleSplash)
|
||||
if (!level->isClientSide &&
|
||||
fmod(paddlePositions[side], paddleCycle) <= paddleSplash &&
|
||||
fmod(paddlePositions[side] + paddleStroke, paddleCycle) >= paddleSplash)
|
||||
{
|
||||
int sound = -1;
|
||||
if (status == ON_LAND) sound = eSoundType_ENTITY_BOAT_PADDLE_LAND;
|
||||
else if (status != IN_AIR) sound = eSoundType_ENTITY_BOAT_PADDLE_WATER;
|
||||
|
||||
if (status == ON_LAND)
|
||||
sound = eSoundType_ENTITY_BOAT_PADDLE_LAND;
|
||||
else if (status != IN_AIR)
|
||||
sound = eSoundType_ENTITY_BOAT_PADDLE_WATER;
|
||||
|
||||
if (sound >= 0)
|
||||
{
|
||||
double viewX = -Mth::sin(yRot * PI / 180);
|
||||
double viewZ = Mth::cos(yRot * PI / 180);
|
||||
double xOffset = side == 1 ? -viewZ : viewZ;
|
||||
double zOffset = side == 1 ? viewX : -viewX;
|
||||
level->playSound(x + xOffset, y, z + zOffset, sound, 1.0f, 0.8f + 0.4f * random->nextFloat());
|
||||
level->playSound(x + xOffset,y,z + zOffset,sound,1.0f,0.8f + 0.4f * random->nextFloat());
|
||||
}
|
||||
}
|
||||
paddlePositions[side] += paddleStroke;
|
||||
@@ -526,22 +519,27 @@ void Boat::tick()
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
int yy = Mth::floor(bb->y0) + j;
|
||||
if (level->getTile(xx, yy, zz) == Tile::waterlily_Id) level->destroyTile(xx, yy, zz, true);
|
||||
if (level->getTile(xx, yy, zz) == Tile::waterlily_Id)
|
||||
level->destroyTile(xx, yy, zz, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
vector<shared_ptr<Entity>> *entities = level->getEntities(shared_from_this(), bb->grow(0.2f, -0.01f, 0.2f));
|
||||
|
||||
vector<shared_ptr<Entity> > *entities = level->getEntities(shared_from_this(), bb->grow(0.2f, -0.01f, 0.2f));
|
||||
if (entities != nullptr && !entities->empty())
|
||||
{
|
||||
bool canMount = !level->isClientSide && player == nullptr;
|
||||
|
||||
for (auto &e : *entities)
|
||||
{
|
||||
if (e == nullptr || hasRider(e) || e->riding.get() == this) continue;
|
||||
if (!e->isPushable()) continue;
|
||||
if (e == nullptr || hasRider(e) || e->riding.get() == this)
|
||||
continue;
|
||||
|
||||
if (canMount && getPassengerCount() < 2 && e->riding == nullptr && e->bbWidth < bbWidth && e->instanceof(eTYPE_LIVINGENTITY)
|
||||
&& !e->instanceof(eTYPE_WATERANIMAL) && !e->instanceof(eTYPE_PLAYER))
|
||||
if (!e->isPushable())
|
||||
continue;
|
||||
|
||||
if (canMount && getPassengerCount() < 2 && e->riding == nullptr &&
|
||||
e->bbWidth < bbWidth && e->instanceof(eTYPE_LIVINGENTITY) && !e->instanceof(eTYPE_WATERANIMAL) && !e->instanceof(eTYPE_PLAYER))
|
||||
{
|
||||
e->ride(shared_from_this());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user