bool CheckBlockPhysics(Player p, Level lvl, long seconds, int i) { Level.UndoPos undo = lvl.UndoBuffer[i]; byte b = lvl.GetTile(undo.index); DateTime time = Server.StartTime.AddTicks((undo.flags >> 2) * TimeSpan.TicksPerSecond); if (time.AddTicks(seconds * TimeSpan.TicksPerSecond) < DateTime.UtcNow) { return(false); } byte newType = (undo.flags & 2) != 0 ? Block.custom_block : undo.newRawType; if (b == newType || Block.Convert(b) == Block.water || Block.Convert(b) == Block.lava) { ushort x, y, z; lvl.IntToPos(undo.index, out x, out y, out z); int undoIndex = lvl.currentUndo; lvl.currentUndo = i; lvl.currentUndo = undoIndex; byte oldType = (undo.flags & 1) != 0 ? Block.custom_block : undo.oldRawType; byte oldExtType = (undo.flags & 1) != 0 ? undo.oldRawType : (byte)0; lvl.Blockchange(x, y, z, oldType, true, default(PhysicsArgs), oldExtType, false); } return(true); }
bool CheckBlockPhysics(Player p, Level lvl, int i) { Level.UndoPos undo = lvl.UndoBuffer[i]; byte b = lvl.GetTile(undo.index); DateTime time = Server.StartTime.AddTicks((undo.flags >> 2) * TimeSpan.TicksPerSecond); if (time < Start) { return(false); } byte newType = (undo.flags & 2) != 0 ? Block.custom_block : undo.newRaw; if (b == newType || Block.Convert(b) == Block.Water || Block.Convert(b) == Block.Lava) { ushort x, y, z; lvl.IntToPos(undo.index, out x, out y, out z); int undoIndex = lvl.currentUndo; lvl.currentUndo = i; lvl.currentUndo = undoIndex; ExtBlock oldBlock = ExtBlock.FromRaw(undo.oldRaw, (undo.flags & 1) != 0); lvl.Blockchange(x, y, z, oldBlock, true, default(PhysicsArgs), false); } return(true); }
bool CheckBlockPhysics(Player p, Level lvl, int i) { Level.UndoPos undo = lvl.UndoBuffer[i]; if (undo.Time < Start) { return(false); } ushort x, y, z; lvl.IntToPos(undo.Index, out x, out y, out z); BlockID cur = lvl.GetBlock(x, y, z); BlockID newBlock = undo.NewBlock; if (cur == newBlock || Block.Convert(cur) == Block.Water || Block.Convert(cur) == Block.Lava) { lvl.Blockchange(x, y, z, undo.OldBlock, true, default(PhysicsArgs), false); } return(true); }