Beispiel #1
0
 private void AddSolid(SolidType solid)
 {
 }
Beispiel #2
0
        public override void Use(Player p, string message)
        {
            int    number = 0;
            string msg    = String.Empty;

            try
            {
                number = message.Split(' ').Length;
            }
            catch { }
            wait = 0;
            if (number > 2)
            {
                Help(p); wait = 1;  return;
            }
            if (number == 2)
            {
                int    pos  = message.IndexOf(' ');
                string t    = message.Substring(0, pos).ToLower();
                string s    = message.Substring(pos + 1).ToLower();
                byte   type = Block.Byte(t);
                if (type == 255)
                {
                    Player.SendMessage(p, "There is no block \"" + t + "\"."); wait = 1; return;
                }

                if (!Block.canPlace(p, type))
                {
                    Player.SendMessage(p, "Cannot place that."); wait = 1; return;
                }

                SolidType solid;
                if (s == "solid")
                {
                    solid = SolidType.solid;
                }
                else if (s == "hollow")
                {
                    solid = SolidType.hollow;
                }
                else if (s == "walls")
                {
                    solid = SolidType.walls;
                }
                else if (s == "holes")
                {
                    solid = SolidType.holes;
                }
                else if (s == "wire")
                {
                    solid = SolidType.wire;
                }
                else if (s == "random")
                {
                    solid = SolidType.random;
                }
                else
                {
                    Help(p); return;
                }
                CatchPos cpos; cpos.solid = solid; cpos.type = type;
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            else if (message != "")
            {
                SolidType solid = SolidType.solid;
                try
                {
                    msg = message.ToLower();
                }
                catch { }
                byte type; unchecked { type = (byte)-1; }
                if (msg == "solid")
                {
                    solid = SolidType.solid;
                }
                else if (msg == "hollow")
                {
                    solid = SolidType.hollow;
                }
                else if (msg == "walls")
                {
                    solid = SolidType.walls;
                }
                else if (msg == "holes")
                {
                    solid = SolidType.holes;
                }
                else if (msg == "wire")
                {
                    solid = SolidType.wire;
                }
                else if (msg == "random")
                {
                    solid = SolidType.random;
                }
                else
                {
                    byte t = Block.Byte(msg);
                    if (t == 255)
                    {
                        Player.SendMessage(p, "There is no block \"" + msg + "\"."); wait = 1; return;
                    }

                    if (!Block.canPlace(p, t))
                    {
                        Player.SendMessage(p, "Cannot place that."); wait = 1; return;
                    }

                    type = t;
                } CatchPos cpos; cpos.solid = solid; cpos.type = type;
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            else
            {
                CatchPos cpos; cpos.solid = SolidType.solid; unchecked { cpos.type = (byte)-1; }
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            if (p.pyramidsilent == false)
            {
                Player.SendMessage(p, "Place two blocks to determine the edges.");
            }
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Beispiel #3
0
 public void Set(SolidType solid)
 {
     Solid = solid;
 }
Beispiel #4
0
    public void SetUpControls()
    {
        int nbLiquids = (int)LiquidType.COUNT;

        List <SolidType>  solids  = new List <SolidType>(8);
        List <LiquidType> liquids = new List <LiquidType>(nbLiquids);

        for (int i = 0; i < nbLiquids; i++)
        {
            liquids.Add((LiquidType)i);
        }

        liquids.Remove(LiquidType.None);

        SetAlcholControl(0, LiquidType.None, SolidType.None);
        SetAlcholControl(1, LiquidType.None, SolidType.None);
        SetAlcholControl(2, LiquidType.None, SolidType.None);

        SetNotAlcholControl(0, LiquidType.None, SolidType.None);
        SetNotAlcholControl(1, LiquidType.None, SolidType.None);
        SetNotAlcholControl(2, LiquidType.None, SolidType.None);
        SetNotAlcholControl(3, LiquidType.None, SolidType.None);

        for (int measuresIi = 0; measuresIi < Cocktail.Measures.Count; measuresIi++)
        {
            CocktailMeasure measure = Cocktail.Measures[measuresIi];

            SolidType  solid  = SolidType.None; // @TODO. Maybe part of measure?
            LiquidType liquid = LiquidType.None;

            liquid = measure.LiquidType;

            if (solid != SolidType.None)
            {
                solids.Add(solid);
            }

            if (liquid != LiquidType.None)
            {
                liquids.Remove(liquid);

                if (liquid == LiquidType.Beer)
                {
                    continue;
                }

                LiquidAlcohol alcohol = GlassLiquid.LiquidTypeToLiquidAlcohol(liquid);

                if (alcohol == LiquidAlcohol.Yes)
                {
                    if (RandomAddAlcholControl(liquid, solid) == false)
                    {
                        if (RandomAddNotAlcholControl(liquid, solid) == false)
                        {
                            Debug.LogError("Cannot fit in ingredients. Recipe too complicated");
                        }
                    }
                }
                else
                {
                    if (RandomAddNotAlcholControl(liquid, solid) == false)
                    {
                        if (RandomAddAlcholControl(liquid, solid) == false)
                        {
                            Debug.LogError("Cannot fit in ingredients. Recipe too complicated");
                        }
                    }
                }
            }
        }

        // Actions
        for (int i = 0; i < 3; i++)
        {
            ControlMarker ctrl = GetAlcholControl(i);
            if (!(ctrl.Liquid == LiquidType.None && ctrl.Solid == SolidType.None))
            {
                continue;
            }

            LiquidType lt = GetUniqueRandomLiquid(liquids, LiquidAlcohol.Yes);
            SetAlcholControl(i, lt, SolidType.None);
        }

        // DPad
        for (int i = 0; i < 4; i++)
        {
            ControlMarker ctrl = GetNotAlcholControl(i);
            if (!(ctrl.Liquid == LiquidType.None && ctrl.Solid == SolidType.None))
            {
                continue;
            }

            LiquidType lt = GetUniqueRandomLiquid(liquids, LiquidAlcohol.No);
            SetNotAlcholControl(i, lt, SolidType.None);
        }
    }
Beispiel #5
0
 public void Reset()
 {
     Solid  = SolidType.None;
     Liquid = LiquidType.None;
 }
Beispiel #6
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            int number = message.Split(' ').Length;

            if (number > 2)
            {
                Help(p); return;
            }
            if (number == 2)
            {
                int    pos  = message.IndexOf(' ');
                string t    = message.Substring(0, pos).ToLower();
                string s    = message.Substring(pos + 1).ToLower();
                byte   type = Block.Byte(t);
                if (type == 255)
                {
                    p.SendMessage("There is no block \"" + t + "\"."); return;
                }
                SolidType solid;
                if (s == "solid")
                {
                    solid = SolidType.solid;
                }
                else if (s == "hollow")
                {
                    solid = SolidType.hollow;
                }
                else
                {
                    Help(p); return;
                }
                CatchPos cpos = new CatchPos(); cpos.solid = solid; cpos.type = type;
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            else if (message != "")
            {
                SolidType solid = SolidType.solid;
                message = message.ToLower();
                byte type; unchecked { type = (byte)-1; }
                if (message == "solid")
                {
                    solid = SolidType.solid;
                }
                else if (message == "hollow")
                {
                    solid = SolidType.hollow;
                }
                else
                {
                    byte t = Block.Byte(message);
                    if (t == 255)
                    {
                        p.SendMessage("There is no block \"" + t + "\"."); return;
                    }
                    type = t;
                } CatchPos cpos = new CatchPos(); cpos.solid = solid; cpos.type = type;
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            else
            {
                CatchPos cpos = new CatchPos(); cpos.solid = SolidType.solid; unchecked { cpos.type = (byte)-1; }
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            p.SendMessage("Place two blocks to determine the edges.");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Beispiel #7
0
 public SolidIngredient(SolidType type)
 {
     this.type = type;
 }
Beispiel #8
0
 public void SetType(SolidType type)
 {
     NativeAPI.solid_set_type(_solidInst, type);
 }
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                Player.SendMessage(p, "The console may not use megaboid!"); return;
            }
            if (p.megaBoid == true)
            {
                Player.SendMessage(p, "You may only have one Megaboid going at a time. Use /abort to cancel the current megaboid."); return;
            }
            if (p.level.permissionbuild > p.group.Permission)
            {
                Player.SendMessage(p, "You may not megaboid on this level!"); return;
            }
            int number = message.Split(' ').Length;

            if (number > 2)
            {
                Help(p); return;
            }
            if (number == 2)
            {
                int    pos  = message.IndexOf(' ');
                string t    = message.Substring(0, pos).ToLower();
                string s    = message.Substring(pos + 1).ToLower();
                byte   type = Block.Byte(t);
                if (type == 255)
                {
                    Player.SendMessage(p, "There is no block \"" + t + "\"."); return;
                }

                if (!Block.canPlace(p, type))
                {
                    Player.SendMessage(p, "Cannot place that."); return;
                }

                SolidType solid;
                if (s == "solid")
                {
                    solid = SolidType.solid;
                }
                else if (s == "hollow")
                {
                    solid = SolidType.hollow;
                }
                else if (s == "walls")
                {
                    solid = SolidType.walls;
                }
                else
                {
                    Help(p); return;
                }
                CatchPos cpos; cpos.solid = solid; cpos.type = type;
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            else if (message != "")
            {
                SolidType solid = SolidType.solid;
                message = message.ToLower();
                byte type; unchecked { type = (byte)-1; }
                if (message == "solid")
                {
                    solid = SolidType.solid;
                }
                else if (message == "hollow")
                {
                    solid = SolidType.hollow;
                }
                else if (message == "walls")
                {
                    solid = SolidType.walls;
                }
                else
                {
                    byte t = Block.Byte(message);
                    if (t == 255)
                    {
                        Player.SendMessage(p, "There is no block \"" + message + "\"."); return;
                    }
                    if (!Block.canPlace(p, t))
                    {
                        Player.SendMessage(p, "Cannot place that."); return;
                    }

                    type = t;
                } CatchPos cpos; cpos.solid = solid; cpos.type = type;
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            else
            {
                CatchPos cpos; cpos.solid = SolidType.solid; unchecked { cpos.type = (byte)-1; }
                cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            }
            Player.SendMessage(p, "Place two blocks to determine the edges.");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }