Page 1 of 1

[Requested] /pillar [Height] - makes a pillar with height

PostPosted: 20 May 2014, 08:57
by tommyz_
This command was requested by Leeizazombie. Here ya go as requested. Enjoy!

Code: Select all
//created by tommyz_
using System;
using System.Collections.Generic;

namespace MCDzienny
{
    public class CmdPillar : Command
    {
        public override string name { get { return "pillar"; } }
        public override string shortcut { get { return "pil"; } }
        public override string type { get { return "build"; } }
        public override bool museumUsable { get { return false; } }
        public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
        public CmdPillar() { }

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }

            int num = 0;
            //test that message is a number
            try { num = Convert.ToInt32(message); }
            catch { Player.SendMessage(p, "Sorry you must only enter a number.");return; }
            if (num > 128)
            { Player.SendMessage(p, "You may only enter a value that is between 1 and 128."); }

            //get position of the player:
            ushort x1 = 0; ushort y1 = 0; ushort z1 = 0;
            x1 = (ushort)(p.pos[0] / 32);
            y1 = (ushort)((p.pos[1] / 32) - 1);
            z1 = (ushort)(p.pos[2] / 32);

            //I didn't do cuboid here because in some situations you would be clicking off the map and
            //it simply will not work that way
            //and ahhh it kinda spams the chat, I wish this software had bool silent = false;
            for (int i = 0; i <= num; i++)
            {
                Command.all.Find("line").Use(p, "stone"); //line
                Command.all.Find("click").Use(p, (x1) + " " + (y1) + " " + (z1));
                Command.all.Find("click").Use(p, (x1) + " " + (y1 + i) + " " + (z1));
            }
           
           
            Player.SendMessage(p, "&aPillar Completed!");
        }
        public override void Help(Player p)
        {
            Player.SendMessage(p, "/pillar [amount] - makes pillar [amount] high.");         
        }
    }
}

Re: [Requested] /pillar [Height] - makes a pillar with heigh

PostPosted: 23 May 2014, 16:48
by Leeizazombie
I've actually made my own pillar maker in the core code of the open source ClassiCube client, the only problem is servers preventing the click distance, but that was bypassed on my own server because it's basically the only server I use now but I used this:

Code: Select all
if (pillar)
                    {
                        int hits = blockstopillar;
                        while (hits > 0)
                        {
                            networkManager.sendBlockChange(x, y, z, button, blockID);
                            y++;
                            hits--;
                        }
                    }


And the same idea could be used in MCDzienny to prevent the spam problem! :)

Example:

Code: Select all
p.level.Blockchange(p, x, y, z, this.blocktoplace);


I appreciate your help!

Re: [Requested] /pillar [Height] - makes a pillar with heigh

PostPosted: 27 May 2014, 02:11
by tommyz_
Cool! Good job!