mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Physics: fix trains colliding into each other causing one to disappear permanently (Thanks TheChellMaster), also fix drowning (Thanks JPlaysClassic)
This commit is contained in:
parent
18f71f8c23
commit
80c3628ee2
@ -29,24 +29,25 @@ namespace MCGalaxy.Blocks.Physics {
|
||||
ushort x, y, z;
|
||||
lvl.IntToPos(C.b, out x, out y, out z);
|
||||
|
||||
for (int cx = -dirX; cx != 2 * dirX; cx += dirX)
|
||||
for (int cy = -dirY; cy != 2 * dirY; cy += dirY)
|
||||
for (int cz = -dirZ; cz != 2 * dirZ; cz += dirZ)
|
||||
for (int dx = -dirX; dx != 2 * dirX; dx += dirX)
|
||||
for (int dy = -dirY; dy != 2 * dirY; dy += dirY)
|
||||
for (int dz = -dirZ; dz != 2 * dirZ; dz += dirZ)
|
||||
{
|
||||
byte tileBelow = lvl.GetTile((ushort)(x + cx),(ushort)(y + cy - 1), (ushort)(z + cz));
|
||||
byte tile = lvl.GetTile((ushort)(x + cx), (ushort)(y + cy), (ushort)(z + cz));
|
||||
byte tileBelow = lvl.GetTile((ushort)(x + dx),(ushort)(y + dy - 1), (ushort)(z + dz));
|
||||
byte tile = lvl.GetTile((ushort)(x + dx), (ushort)(y + dy), (ushort)(z + dz));
|
||||
|
||||
bool isRails = false;
|
||||
if (tileBelow != Block.custom_block) {
|
||||
isRails = Block.Props[tileBelow].IsRails;
|
||||
} else {
|
||||
byte extBelow = lvl.GetExtTile((ushort)(x + cx), (ushort)(y + cy - 1), (ushort)(z + cz));
|
||||
byte extBelow = lvl.GetExtTile((ushort)(x + dx), (ushort)(y + dy - 1), (ushort)(z + dz));
|
||||
isRails = lvl.CustomBlockProps[extBelow].IsRails;
|
||||
}
|
||||
|
||||
if (isRails && (tile == Block.air || tile == Block.water)) {
|
||||
lvl.AddUpdate(lvl.PosToInt((ushort)(x + cx),
|
||||
(ushort)(y + cy), (ushort)(z + cz)), Block.train);
|
||||
if (isRails && (tile == Block.air || tile == Block.water)
|
||||
&& !lvl.listUpdateExists.Get(x + dx, y + dy, z + dz)) {
|
||||
lvl.AddUpdate(lvl.PosToInt((ushort)(x + dx),
|
||||
(ushort)(y + dy), (ushort)(z + dz)), Block.train);
|
||||
lvl.AddUpdate(C.b, Block.air);
|
||||
byte newBlock = tileBelow == Block.op_air ? Block.glass : Block.obsidian;
|
||||
|
||||
|
@ -353,7 +353,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
internal void CheckSurvival(ushort x, ushort y, ushort z) {
|
||||
byte bFeet = GetSurvivalBlock(x, (ushort)(y - 2), z);
|
||||
byte bFeet = GetSurvivalBlock(x, (ushort)(y - 1), z);
|
||||
byte bHead = GetSurvivalBlock(x, y, z);
|
||||
if (level.PosToInt(x, y, z) != oldIndex || y != oldFallY) {
|
||||
byte conv = Block.Convert(bFeet);
|
||||
@ -382,7 +382,9 @@ namespace MCGalaxy {
|
||||
case Block.lavastill:
|
||||
fallCount = 0;
|
||||
drownCount++;
|
||||
if (drownCount > level.drown * (100/3)) {
|
||||
|
||||
// level drown is in 10ths of a second, and there are 100 ticks/second
|
||||
if (drownCount > level.drown * 10) {
|
||||
HandleDeath(Block.water, 0);
|
||||
drownCount = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user