public static bool ButtonRelease(Physics P, Check C)
            {
                if (C.time < 4) { C.time++; return false; }

                if ((P.w.GetMeta(C.x, C.y, C.z) & 0x8) != 0)
                    P.AddUpdate(C.x, C.y, C.z, (byte)Blocks.ButtonStone, (byte)(P.w.GetMeta(C.x, C.y, C.z) ^ 0x8));
                return true;
            }
Example #2
0
            public static bool ButtonRelease(Physics P, Check C)
            {
                if (C.time < 4)
                {
                    C.time++; return(false);
                }

                if ((P.w.GetMeta(C.x, C.y, C.z) & 0x8) != 0)
                {
                    P.AddUpdate(C.x, C.y, C.z, (byte)Blocks.ButtonStone, (byte)(P.w.GetMeta(C.x, C.y, C.z) ^ 0x8));
                }
                return(true);
            }
Example #3
0
            public static bool LavaFlow(Physics P, Check C)
            {
                if (C.time < 6) { C.time++; return false; }

                byte meta = P.w.GetMeta(C.x, C.y, C.z);
                if (!P.HigherLiquidCheck(C.x, C.y, C.z, 10, meta) && !P.HigherLiquidCheck(C.x, C.y, C.z, 11, meta))
                {
                    if ((meta & 0x7) >= 0x6)
                        P.AddUpdate(C.x, C.y, C.z, 0, 0);
                    else
                    {
                        P.AddUpdate(C.x, C.y, C.z, 10, (byte)Math.Min(meta + 2, 0x6));
                        if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 10) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 11)) { C.time = 0; return false; }
                    }
                }
                else if ((meta & 0x8) != 0)
                {
                    if (!P.LavaFlowCheck(C.x, C.y - 1, C.z)) { meta = 0; goto flowOut; }
                    P.LavaFlow(C.x, C.y - 1, C.z, 0x8);
                }
                else if ((meta & 0x7) < 0x6)
                {
                    goto flowOut;
                }
                else
                {
                    P.LavaFlow(C.x, C.y - 1, C.z, 0x8);
                }
                return true;

                flowOut:
                if (P.LavaFlowCheck(C.x, C.y - 1, C.z))
                {
                    P.LavaFlow(C.x, C.y - 1, C.z, 0x8);
                    if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 10) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 11))
                    {
                        P.LavaFlow(C.x + 1, C.y, C.z, 0x6);
                        P.LavaFlow(C.x - 1, C.y, C.z, 0x6);
                        P.LavaFlow(C.x, C.y, C.z + 1, 0x6);
                        P.LavaFlow(C.x, C.y, C.z - 1, 0x6);
                    }
                }
                else
                {
                    if (P.AdjacentLiquidCheck(C.x, C.y, C.z, 8) || P.AdjacentLiquidCheck(C.x, C.y, C.z, 9))
                    {
                        if ((meta & 0x7) == 0)
                            P.AddUpdate(C.x, C.y, C.z, 49, 0);
                        else
                            P.AddUpdate(C.x, C.y, C.z, 4, 0);
                        Player.GlobalSoundEffect(C.x, (byte)C.y, C.z, 1004, P.w);
                        //Player.GlobalSoundEffect(C.x, (byte)C.y, C.z, 2000, 4, w);
                    }
                    else
                    {
                        meta += 2;
                        P.LavaFlow(C.x + 1, C.y, C.z, meta);
                        P.LavaFlow(C.x - 1, C.y, C.z, meta);
                        P.LavaFlow(C.x, C.y, C.z + 1, meta);
                        P.LavaFlow(C.x, C.y, C.z - 1, meta);

                        if (P.w.GetBlock(C.x, C.y - 1, C.z) == 8 || P.w.GetBlock(C.x, C.y - 1, C.z) == 9)
                        {
                            P.AddUpdate(C.x, C.y - 1, C.z, 4, 0);
                            Player.GlobalSoundEffect(C.x, (byte)C.y, C.z, 1004, P.w);
                        }
                    }
                }
                return true;
            }
Example #4
0
            public static bool WaterFlow(Physics P, Check C)
            {
                //if (C.time < 5) { C.time++; return false; }

                byte meta = P.w.GetMeta(C.x, C.y, C.z);
                if (!P.HigherLiquidCheck(C.x, C.y, C.z, 8, meta) && !P.HigherLiquidCheck(C.x, C.y, C.z, 9, meta))
                {
                    if ((meta & 0x7) >= 0x7)
                        P.AddUpdate(C.x, C.y, C.z, 0, 0);
                    else
                    {
                        P.AddUpdate(C.x, C.y, C.z, 8, (byte)Math.Min(meta + 2, 0x7));
                        if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 8) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 9)) { C.time = 0; return false; }
                    }
                }
                else if ((meta & 0x8) != 0)
                {
                    if (!P.WaterFlowCheck(C.x, C.y - 1, C.z)) { meta = 0; goto flowOut; }
                    P.WaterFlow(C.x, C.y - 1, C.z, 0x8);
                }
                else if ((meta & 0x7) < 0x7)
                {
                    goto flowOut;
                }
                else
                {
                    P.WaterFlow(C.x, C.y - 1, C.z, 0x8);
                }
                return true;

                flowOut:
                if (P.WaterFlowCheck(C.x, C.y - 1, C.z))
                {
                    P.WaterFlow(C.x, C.y - 1, C.z, 0x8);
                    if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 8) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 9))
                    {
                        P.WaterFlow(C.x + 1, C.y, C.z, 0x7);
                        P.WaterFlow(C.x - 1, C.y, C.z, 0x7);
                        P.WaterFlow(C.x, C.y, C.z + 1, 0x7);
                        P.WaterFlow(C.x, C.y, C.z - 1, 0x7);
                    }
                }
                else
                {
                    meta++;
                    P.WaterFlow(C.x + 1, C.y, C.z, meta);
                    P.WaterFlow(C.x - 1, C.y, C.z, meta);
                    P.WaterFlow(C.x, C.y, C.z + 1, meta);
                    P.WaterFlow(C.x, C.y, C.z - 1, meta);
                }
                return true;
            }
Example #5
0
            public static bool WaterFlow(Physics P, Check C)
            {
                //if (C.time < 5) { C.time++; return false; }

                byte meta = P.w.GetMeta(C.x, C.y, C.z);

                if (!P.HigherLiquidCheck(C.x, C.y, C.z, 8, meta) && !P.HigherLiquidCheck(C.x, C.y, C.z, 9, meta))
                {
                    if ((meta & 0x7) >= 0x7)
                    {
                        P.AddUpdate(C.x, C.y, C.z, 0, 0);
                    }
                    else
                    {
                        P.AddUpdate(C.x, C.y, C.z, 8, (byte)Math.Min(meta + 2, 0x7));
                        if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 8) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 9))
                        {
                            C.time = 0; return(false);
                        }
                    }
                }
                else if ((meta & 0x8) != 0)
                {
                    if (!P.WaterFlowCheck(C.x, C.y - 1, C.z))
                    {
                        meta = 0; goto flowOut;
                    }
                    P.WaterFlow(C.x, C.y - 1, C.z, 0x8);
                }
                else if ((meta & 0x7) < 0x7)
                {
                    goto flowOut;
                }
                else
                {
                    P.WaterFlow(C.x, C.y - 1, C.z, 0x8);
                }
                return(true);

flowOut:
                if (P.WaterFlowCheck(C.x, C.y - 1, C.z))
                {
                    P.WaterFlow(C.x, C.y - 1, C.z, 0x8);
                    if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 8) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 9))
                    {
                        P.WaterFlow(C.x + 1, C.y, C.z, 0x7);
                        P.WaterFlow(C.x - 1, C.y, C.z, 0x7);
                        P.WaterFlow(C.x, C.y, C.z + 1, 0x7);
                        P.WaterFlow(C.x, C.y, C.z - 1, 0x7);
                    }
                }
                else
                {
                    meta++;
                    P.WaterFlow(C.x + 1, C.y, C.z, meta);
                    P.WaterFlow(C.x - 1, C.y, C.z, meta);
                    P.WaterFlow(C.x, C.y, C.z + 1, meta);
                    P.WaterFlow(C.x, C.y, C.z - 1, meta);
                }
                return(true);
            }
Example #6
0
            public static bool LavaFlow(Physics P, Check C)
            {
                if (C.time < 6)
                {
                    C.time++; return(false);
                }

                byte meta = P.w.GetMeta(C.x, C.y, C.z);

                if (!P.HigherLiquidCheck(C.x, C.y, C.z, 10, meta) && !P.HigherLiquidCheck(C.x, C.y, C.z, 11, meta))
                {
                    if ((meta & 0x7) >= 0x6)
                    {
                        P.AddUpdate(C.x, C.y, C.z, 0, 0);
                    }
                    else
                    {
                        P.AddUpdate(C.x, C.y, C.z, 10, (byte)Math.Min(meta + 2, 0x6));
                        if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 10) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 11))
                        {
                            C.time = 0; return(false);
                        }
                    }
                }
                else if ((meta & 0x8) != 0)
                {
                    if (!P.LavaFlowCheck(C.x, C.y - 1, C.z))
                    {
                        meta = 0; goto flowOut;
                    }
                    P.LavaFlow(C.x, C.y - 1, C.z, 0x8);
                }
                else if ((meta & 0x7) < 0x6)
                {
                    goto flowOut;
                }
                else
                {
                    P.LavaFlow(C.x, C.y - 1, C.z, 0x8);
                }
                return(true);

flowOut:
                if (P.LavaFlowCheck(C.x, C.y - 1, C.z))
                {
                    P.LavaFlow(C.x, C.y - 1, C.z, 0x8);
                    if (!P.AdjacentLiquidCheck(C.x, C.y, C.z, 10) && !P.AdjacentLiquidCheck(C.x, C.y, C.z, 11))
                    {
                        P.LavaFlow(C.x + 1, C.y, C.z, 0x6);
                        P.LavaFlow(C.x - 1, C.y, C.z, 0x6);
                        P.LavaFlow(C.x, C.y, C.z + 1, 0x6);
                        P.LavaFlow(C.x, C.y, C.z - 1, 0x6);
                    }
                }
                else
                {
                    if (P.AdjacentLiquidCheck(C.x, C.y, C.z, 8) || P.AdjacentLiquidCheck(C.x, C.y, C.z, 9))
                    {
                        if ((meta & 0x7) == 0)
                        {
                            P.AddUpdate(C.x, C.y, C.z, 49, 0);
                        }
                        else
                        {
                            P.AddUpdate(C.x, C.y, C.z, 4, 0);
                        }
                        Player.GlobalSoundEffect(C.x, (byte)C.y, C.z, 1004, P.w);
                        //Player.GlobalSoundEffect(C.x, (byte)C.y, C.z, 2000, 4, w);
                    }
                    else
                    {
                        meta += 2;
                        P.LavaFlow(C.x + 1, C.y, C.z, meta);
                        P.LavaFlow(C.x - 1, C.y, C.z, meta);
                        P.LavaFlow(C.x, C.y, C.z + 1, meta);
                        P.LavaFlow(C.x, C.y, C.z - 1, meta);

                        if (P.w.GetBlock(C.x, C.y - 1, C.z) == 8 || P.w.GetBlock(C.x, C.y - 1, C.z) == 9)
                        {
                            P.AddUpdate(C.x, C.y - 1, C.z, 4, 0);
                            Player.GlobalSoundEffect(C.x, (byte)C.y, C.z, 1004, P.w);
                        }
                    }
                }
                return(true);
            }