Merge branch 'master' of github.com:Hetal728/MCGalaxy

This commit is contained in:
UnknownShadow200 2016-05-20 09:48:40 +10:00
commit 5c05d40d6c
14 changed files with 188 additions and 65 deletions

View File

@ -1,3 +1,34 @@
v 1.8.7.0
- Added: /infoswap.
- Added: Tab list separately handled from in-game entities, allowing for a server-wise tab list.
- Added: Cloudy (perlin noise) brush like fcraft.
- Added: /main <level> to set the main level from ingame.
- Added: Allow generating any size divisible by 16, not just powers of two divisible by 16.
- Added: Actual /sphere command.
- Added: /hide persists across sessions.
- Added: /Triangle draw operation.
- Added: Configuring weather speed, cloud speed, and weather fade/falloff rate.
- Added: /where to show a player's position and orientation.
- Fixed: /explode me not working.
- Fixed: 'is afk' always showing in /whois.
- Fixed: If older backups directories were missing, existing backup directories are overwritten.
- Fixed: /compload for visual basic commands.
- Fixed: tpaccept/tpdeny not working.
- Fixed: /botremove not working.
- Fixed: /mi env not working on loaded levels.
- Improved: /about now shows the 'real' custom block id, not just ID of custom_block.
- Improved: Reduced logging information to main console window, shown in logs-->sytstem instead.
- Improved: /torus now draws like fcraft /torus.
- Improved: outline/copy cut/rainbow/hollow are now draw ops, allowing them to be undone/redone.
- Improved: When using only /copy, air blocks (Since not pasted) do not count towards draw limit.
- Improved: More commands now have the fCraft command names/aliases as aliases too.
- Improved: Now uses the same block names as classicube/classicalsharp clients.
- Improved: /help commands split into separate /commands, which can use name and rank sorting.
- Improved: /host combined into /sinfo, /sinfo simplified.
- Improved: IRC bot now tries to reclaim its normal nick upon reconnection.
- Improved: Map tab redesigned to be more visually appealing.
- Removed: /ban #name and /uban name, just use /xban name.
v 1.8.6.0
- Fixed: /award not working when neither 'give' nor 'take' is used.
- Added: Allow customising infect messages for zombie survival.

View File

@ -27,9 +27,9 @@ namespace MCGalaxy.Commands
public override string name { get { return "cuboid"; } }
public override string shortcut { get { return "z"; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("cw", "wire"),
new CommandAlias("ch", "hollow"), new CommandAlias("walls", "walls"),
new CommandAlias("box"), new CommandAlias("hbox", "hollow") }; }
get { return new[] { new CommandAlias("cw", null, "wire"),
new CommandAlias("ch", null, "hollow"), new CommandAlias("walls", null, "walls"),
new CommandAlias("box"), new CommandAlias("hbox", null, "hollow") }; }
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {

View File

@ -73,22 +73,22 @@ namespace MCGalaxy.Commands {
default:
Help(p); return;
}
ushort radius = 0, height = 0;
string[] args = cpos.message.Split(' ');
if ((op.UsesHeight && !CheckTwoArgs(p, op, args)) ||
(!op.UsesHeight && !CheckOneArg(p, op, args))) return;
if ((op.UsesHeight && !CheckTwoArgs(p, ref radius, ref height, args)) ||
(!op.UsesHeight && !CheckOneArg(p, ref radius, args))) return;
int brushOffset = op.UsesHeight ? 3 : 2;
Brush brush = GetBrush(p, cpos, brushOffset);
if (brush == null) return;
Vec3S32[] marks = {
new Vec3S32(x - op.Radius, y, z - op.Radius),
new Vec3S32(x + op.Radius, y, z + op.Radius) };
new Vec3S32(x - radius, y, z - radius),
new Vec3S32(x + radius, y, z + radius) };
if (op.UsesHeight) {
marks[1].Y += op.Height;
marks[1].Y += height;
} else {
marks[0].Y -= op.Radius;
marks[1].Y += op.Radius;
marks[0].Y -= radius; marks[1].Y += radius;
}
if (!DrawOp.DoDrawOp(op, brush, p, marks))
@ -99,18 +99,18 @@ namespace MCGalaxy.Commands {
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { }
bool CheckTwoArgs(Player p, AdvDrawOp op, string[] parts) {
bool CheckTwoArgs(Player p, ref ushort radius, ref ushort height, string[] parts) {
if (parts.Length < 3) { Help(p); return false; }
if (!ushort.TryParse(parts[parts.Length - 3], out op.Height) || op.Height > 2000 ||
!ushort.TryParse(parts[parts.Length - 2], out op.Radius) || op.Radius > 2000) {
if (!ushort.TryParse(parts[parts.Length - 3], out height) || height > 2000 ||
!ushort.TryParse(parts[parts.Length - 2], out radius) || radius > 2000) {
Player.Message(p, "Radius and height must be positive integers less than 2000."); return false;
}
return true;
}
bool CheckOneArg(Player p, AdvDrawOp op, string[] parts) {
bool CheckOneArg(Player p, ref ushort radius, string[] parts) {
if (parts.Length < 2) { Help(p); return false; }
if (!ushort.TryParse(parts[parts.Length - 2], out op.Radius) || op.Radius > 2000) {
if (!ushort.TryParse(parts[parts.Length - 2], out radius) || radius > 2000) {
Player.Message(p, "Radius must be a positive integer less than 2000."); return false;
}
return true;

View File

@ -26,7 +26,8 @@ namespace MCGalaxy.Commands {
public sealed class CmdLine : DrawCmd {
public override string name { get { return "line"; } }
public override string shortcut { get { return "l"; } }
public override string shortcut { get { return "l"; } }
protected override string PlaceMessage { get { return "Place two blocks to determine the endpoints."; } }
protected override DrawMode ParseMode(string msg) {
if (msg == "normal") return DrawMode.solid;

View File

@ -0,0 +1,80 @@
/*
Copyright 2015 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using MCGalaxy.Drawing;
using MCGalaxy.Drawing.Ops;
using MCGalaxy.Drawing.Brushes;
namespace MCGalaxy.Commands {
public sealed class CmdSphere : DrawCmd {
public override string name { get { return "sphere"; } }
public override string shortcut { get { return "sp"; } }
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("sphereh", null, "hollow"), new CommandAlias("sph", null, "hollow") }; }
}
protected override string PlaceMessage { get { return "Place a block for the centre, then another for the radius."; } }
protected override DrawMode ParseMode(string msg) {
if (msg == "solid") return DrawMode.solid;
else if (msg == "hollow") return DrawMode.hollow;
return DrawMode.normal;
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
DrawOp op = null;
Func<BrushArgs, Brush> constructor = null;
switch (cpos.mode) {
case DrawMode.solid:
op = new AdvSphereDrawOp();
constructor = SolidBrush.Process; break;
case DrawMode.hollow:
op = new AdvHollowSphereDrawOp(); break;
default:
op = new AdvSphereDrawOp(); break;
}
int brushOffset = cpos.mode == DrawMode.normal ? 0 : 1;
Brush brush = GetBrush(p, cpos, brushOffset, constructor);
if (brush == null) return;
int dx = cpos.x - x, dy = cpos.y - y, dz = cpos.z - z;
int R = (int)Math.Sqrt(dx * dx + dy * dy + dz * dz);
Vec3S32[] marks = { new Vec3S32(cpos.x - R, cpos.y - R, cpos.z - R),
new Vec3S32(cpos.x + R, cpos.y + R, cpos.z + R) };
if (!DrawOp.DoDrawOp(op, brush, p, marks))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
public override void Help(Player p) {
Player.Message(p, "%T/sphere [brush args] <mode>");
Player.Message(p, "%HCreates a sphere, with the first point as the centre, " +
"and second being the radius.");
Player.Message(p, " %HFor help about brushes, type %T/help brush%H.");
Player.Message(p, " %HModes: &fsolid/hollow");
}
}
}

View File

@ -27,8 +27,7 @@ namespace MCGalaxy.Commands {
public override string name { get { return "spheroid"; } }
public override string shortcut { get { return "e"; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("sphere"), new CommandAlias("eh", "hollow"),
new CommandAlias("cylinder", "vertical") }; }
get { return new[] { new CommandAlias("eh", null, "hollow"), new CommandAlias("cylinder", null, "vertical") }; }
}
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {

View File

@ -26,33 +26,40 @@ namespace MCGalaxy.Commands {
public override string name { get { return "torus"; } }
public override string shortcut { get { return "tor"; } }
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("donut"), new CommandAlias("bagel") }; }
}
protected override string PlaceMessage { get { return "Place a block for the centre, then another for the radius."; } }
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
RevertAndClearState(p, x, y, z);
CatchPos cpos = (CatchPos)p.blockchangeObject;
GetRealBlock(type, extType, p, ref cpos);
DrawOp drawOp = new TorusDrawOp();
Brush brush = GetBrush(p, cpos, 0);
if (brush == null) return;
int dx = cpos.x - x, dy = cpos.y - y, dz = cpos.z - z;
int horR = (int)Math.Sqrt(dx * dx + dz * dz), verR = Math.Abs(dy);
Vec3S32[] marks = { new Vec3S32(cpos.x - horR, cpos.y - verR, cpos.z - horR),
new Vec3S32(cpos.x + horR, cpos.y + verR, cpos.z + horR) };
if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
if (!DrawOp.DoDrawOp(drawOp, brush, p, marks))
return;
if (p.staticCommands)
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
protected override DrawMode ParseMode(string msg) {
return DrawMode.normal;
}
protected override DrawMode ParseMode(string msg) { return DrawMode.normal; }
public override void Help(Player p) {
Player.Message(p, "%T/torus [brush args]");
Player.Message(p, "%HDraws a torus(circular tube) between two points.");
Player.Message(p, "%HDraws a torus(circular tube), with the first point as the centre, " +
"and second being the radius.");
Player.Message(p, " %HFor help about brushes, type %T/help brush%H.");
Player.Message(p, " %HNote: radius of tube itself is calculated based on " +
"vertical difference between the two corners.");
Player.Message(p, " %HNote: radius of the tube itself is the vertical difference between the two points.");
}
}
}

View File

@ -30,23 +30,24 @@ namespace MCGalaxy.Drawing.Ops {
public override string Name { get { return "Adv Cone"; } }
public override long GetBlocksAffected(Level lvl, Vec3S32[] marks) {
long R = Radius, H = Height;
long R = Radius, H = Max.Y - Min.Y;
return (long)(Math.PI / 3 * (R * R * H));
}
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush) {
Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max);
Vec3S32 C = (Min + Max) / 2;
int height = Max.Y - Min.Y;
for (ushort y = p1.Y; y <= p2.Y; y++)
for (ushort z = p1.Z; z <= p2.Z; z++)
for (ushort x = p1.X; x <= p2.X; x++)
{
int xx = C.X - x, yy = y - Min.Y, zz = C.Z - z;
int curHeight = Invert ? yy : Height - yy;
int curHeight = Invert ? yy : height - yy;
if (curHeight == 0) continue;
double curRadius = Radius * ((double)curHeight / (double)Height);
double curRadius = Radius * ((double)curHeight / (double)height);
int dist = xx * xx + zz * zz;
if (dist > curRadius * curRadius) continue;
@ -62,7 +63,7 @@ namespace MCGalaxy.Drawing.Ops {
public override string Name { get { return "Adv Hollow Cone"; } }
public override long GetBlocksAffected(Level lvl, Vec3S32[] marks) {
long R = Radius, H = Height;
long R = Radius, H = Max.Y - Min.Y;
double outer = (int)(Math.PI / 3 * (R * R * H));
double inner = (int)(Math.PI / 3 * ((R - 1) * (R - 1) * (H - 1)));
return (long)(outer - inner);
@ -71,16 +72,17 @@ namespace MCGalaxy.Drawing.Ops {
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush) {
Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max);
Vec3S32 C = (Min + Max) / 2;
int height = Max.Y - Min.Y;
for (ushort y = p1.Y; y <= p2.Y; y++)
for (ushort z = p1.Z; z <= p2.Z; z++)
for (ushort x = p1.X; x <= p2.X; x++)
{
int xx = C.X - x, yy = y - Min.Y, zz = C.Z - z;
int curHeight = Invert ? yy : Height - yy;
int curHeight = Invert ? yy : height - yy;
if (curHeight == 0) continue;
double curRadius = Radius * ((double)curHeight / (double)Height);
double curRadius = Radius * ((double)curHeight / (double)height);
int dist = xx * xx + zz * zz;
if (dist > curRadius * curRadius || dist < (curRadius - 1) * (curRadius - 1))
continue;
@ -97,23 +99,24 @@ namespace MCGalaxy.Drawing.Ops {
public override string Name { get { return "Adv Volcano"; } }
public override long GetBlocksAffected(Level lvl, Vec3S32[] marks) {
long R = Radius, H = Height;
long R = Radius, H = Max.Y - Min.Y;
return (long)(Math.PI / 3 * (R * R * H));
}
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush) {
Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max);
Vec3S32 C = (Min + Max) / 2;
int height = Max.Y - Min.Y;
for (ushort y = p1.Y; y <= p2.Y; y++)
for (ushort z = p1.Z; z <= p2.Z; z++)
for (ushort x = p1.X; x <= p2.X; x++)
{
int xx = C.X - x, yy = y - Min.Y, zz = C.Z - z;
int curHeight = Height - yy;
int curHeight = height - yy;
if (curHeight == 0) continue;
double curRadius = Radius * ((double)curHeight / (double)Height);
double curRadius = Radius * ((double)curHeight / (double)height);
int dist = xx * xx + zz * zz;
if (dist > curRadius * curRadius) continue;

View File

@ -26,7 +26,8 @@ using MCGalaxy.Drawing.Brushes;
namespace MCGalaxy.Drawing.Ops {
public abstract class AdvDrawOp : DrawOp {
public ushort Radius, Height;
public int Radius { get { return (Max.X - Min.X) / 2; } }
public bool Invert;
public virtual bool UsesHeight { get { return true; } }
}

View File

@ -30,29 +30,29 @@ namespace MCGalaxy.Drawing.Ops {
public override string Name { get { return "Adv Pyramid"; } }
public override long GetBlocksAffected(Level lvl, Vec3S32[] marks) {
long R = Radius, H = Height;
long R = Radius, H = Max.Y - Min.Y;
return (R * R * H) / 3;
}
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush) {
Vec3U16 P = (Vec3U16)marks[0];
int minX = Math.Max(P.X - Radius, 0) - P.X, maxX = Math.Min(P.X + Radius, lvl.Width - 1) - P.X;
int minZ = Math.Max(P.Z - Radius, 0) - P.Z, maxZ = Math.Min(P.Z + Radius, lvl.Length - 1) - P.Z;
int maxY = Math.Min(P.Y + Height, lvl.Height - 1) - P.Y;
for (int yy = 0; yy <= maxY; yy++)
for (int zz = minZ; zz <= maxZ; zz++)
for (int xx = minX; xx <= maxX; xx++)
Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max);
Vec3S32 C = (Min + Max) / 2;
for (ushort y = p1.Y; y <= p2.Y; y++)
for (ushort z = p1.Z; z <= p2.Z; z++)
for (ushort x = p1.X; x <= p2.X; x++)
{
int curHeight = Invert ? yy : Height - yy;
if (curHeight == 0) continue;
int cx = P.X + xx, cy = P.Y + (Height - curHeight), cz = P.Z + zz;
int height = Max.Y - Min.Y;
int xx = C.X - x, yy = y - Min.Y, zz = C.Z - z;
int curHeight = Invert ? yy : height - yy;
if (curHeight == 0) continue;
double curRadius = Radius * ((double)curHeight / (double)Height);
double curRadius = Radius * ((double)curHeight / (double)height);
if (Math.Abs(xx) > curRadius || Math.Abs(zz) > curRadius)
continue;
byte ctile = lvl.GetTile((ushort)cx, (ushort)cy, (ushort)cz);
byte ctile = lvl.GetTile(x, y, z);
if (ctile != 0) continue;
PlaceBlock(p, lvl, (ushort)cx, (ushort)cy, (ushort)cz, brush);
PlaceBlock(p, lvl, x, y, z, brush);
}
}
}
@ -62,33 +62,33 @@ namespace MCGalaxy.Drawing.Ops {
public override string Name { get { return "Adv Hollow Pyramid"; } }
public override long GetBlocksAffected(Level lvl, Vec3S32[] marks) {
long R = Radius, H = Height;
long R = Radius, H = Max.Y - Min.Y;
long outer = (R * R * H) / 3;
long inner = ((R - 1) * (R - 1) * (H - 1)) / 3;
return outer - inner;
}
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush) {
Vec3U16 P = Clamp(marks[0]);
int minX = Math.Max(P.X - Radius, 0) - P.X, maxX = Math.Min(P.X + Radius, lvl.Width - 1) - P.X;
int minZ = Math.Max(P.Z - Radius, 0) - P.Z, maxZ = Math.Min(P.Z + Radius, lvl.Length - 1) - P.Z;
int maxY = Math.Min(P.Y + Height, lvl.Height - 1) - P.Y;
for (int yy = 0; yy <= maxY; yy++)
for (int zz = minZ; zz <= maxZ; zz++)
for (int xx = minX; xx <= maxX; xx++)
Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max);
Vec3S32 C = (Min + Max) / 2;
int height = Max.Y - Min.Y;
for (ushort y = p1.Y; y <= p2.Y; y++)
for (ushort z = p1.Z; z <= p2.Z; z++)
for (ushort x = p1.X; x <= p2.X; x++)
{
int curHeight = Invert ? yy : Height - yy;
if (curHeight == 0) continue;
int cx = P.X + xx, cy = P.Y + (Height - curHeight), cz = P.Z + zz;
int xx = C.X - x, yy = y - Min.Y, zz = C.Z - z;
int curHeight = Invert ? yy : height - yy;
if (curHeight == 0) continue;
double curRadius = Radius * ((double)curHeight / (double)Height);
double curRadius = Radius * ((double)curHeight / (double)height);
int absx = Math.Abs(xx), absz = Math.Abs(zz);
if (absx > curRadius || absz > curRadius) continue;
if (absx < (curRadius - 1) && absz < (curRadius - 1)) continue;
byte ctile = lvl.GetTile((ushort)cx, (ushort)cy, (ushort)cz);
byte ctile = lvl.GetTile(x, y, z);
if (ctile != 0) continue;
PlaceBlock(p, lvl, (ushort)cx, (ushort)cy, (ushort)cz, brush);
PlaceBlock(p, lvl, x, y, z, brush);
}
}
}

View File

@ -143,6 +143,7 @@
<Compile Include="Commands\building\CmdRainbow.cs" />
<Compile Include="Commands\building\CmdRedo.cs" />
<Compile Include="Commands\building\CmdReplaceBrush.cs" />
<Compile Include="Commands\building\CmdSphere.cs" />
<Compile Include="Commands\building\CmdTriangle.cs" />
<Compile Include="Commands\building\ReplaceCmd.cs" />
<Compile Include="Commands\building\CmdRestartPhysics.cs" />

Binary file not shown.

Binary file not shown.

View File

@ -26,7 +26,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MCGalaxy")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyCopyright("Copyright © 2015-2016")]
[assembly: AssemblyTrademark("Forging the Way")]
//[assembly: AssemblyDevs("MCGalaxy Development Team")]
@ -37,7 +37,7 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("24d9085c-78ba-4f53-b69c-f2b52153683f")]
[assembly: AssemblyVersion("1.8.6.0")]
[assembly: AssemblyVersion("1.8.7.0")]
// Version information for an assembly consists of the following four values:
//