mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-08 14:48:47 -04:00
Split up /spin into /spin and /mirror
This commit is contained in:
parent
341df3498a
commit
f7a53b081f
@ -41,7 +41,6 @@ namespace MCGalaxy.Gui {
|
||||
Type: IndexOutOfRangeException
|
||||
Source: System.Windows.Forms
|
||||
Message: Index was outside the bounds of the array.
|
||||
Target: UpdatePropertiesViewTabVisibility
|
||||
Trace: at System.Windows.Forms.PropertyGrid.UpdatePropertiesViewTabVisibility ()
|
||||
at System.Windows.Forms.PropertyGrid.ShowEventsButton (System.Boolean value)
|
||||
at System.Windows.Forms.PropertyGrid.set_SelectedObjects (System.Object[] value)
|
||||
@ -58,7 +57,6 @@ Trace: at System.Windows.Forms.PropertyGrid.UpdatePropertiesViewTabVisibility
|
||||
Type: IndexOutOfRangeException
|
||||
Source: System.Windows.Forms
|
||||
Message: Index was outside the bounds of the array.
|
||||
Target: RefreshProperties
|
||||
Trace: at System.Windows.Forms.PropertyGrid.RefreshProperties (System.Boolean clearCached)
|
||||
at System.Windows.Forms.PropertyGrid.Refresh (System.Boolean clearCached)
|
||||
at System.Windows.Forms.PropertyGrid.Refresh ()
|
||||
|
63
MCGalaxy/Commands/building/CmdMirror.cs
Normal file
63
MCGalaxy/Commands/building/CmdMirror.cs
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
|
||||
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.Collections.Generic;
|
||||
using MCGalaxy.Drawing;
|
||||
|
||||
namespace MCGalaxy.Commands.Building {
|
||||
public sealed class CmdMirror : Command2 {
|
||||
public override string name { get { return "Mirror"; } }
|
||||
public override string type { get { return CommandTypes.Building; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
public override bool SuperUseable { get { return false; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new [] { new CommandAlias("Flip") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message, CommandData data) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
if (p.CurrentCopy == null) {
|
||||
p.Message("You haven't copied anything yet"); return;
|
||||
}
|
||||
|
||||
CopyState cState = p.CurrentCopy;
|
||||
BlockDefinition[] defs = p.level.CustomBlockDefs;
|
||||
|
||||
foreach (string arg in message.SplitSpaces())
|
||||
{
|
||||
if (arg.CaselessEq("x")) {
|
||||
Flip.MirrorX(cState, defs);
|
||||
p.Message("Flipped copy across the X (east/west) axis.");
|
||||
} else if (arg.CaselessEq("y") || arg.CaselessEq("u")) {
|
||||
Flip.MirrorY(cState, defs);
|
||||
p.Message("Flipped copy across the Y (vertical) axis.");
|
||||
} else if (arg.CaselessEq("z")) {
|
||||
Flip.MirrorZ(cState, defs);
|
||||
p.Message("Flipped copy across the Z (north/south) axis.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
p.Message("&T/Mirror X/Y/Z");
|
||||
p.Message("&HFlips/Mirrors the copied object around that axis.");
|
||||
p.Message(" &HX = horizontal axis (east-west)");
|
||||
p.Message(" &HY = vertical axis");
|
||||
p.Message(" &HZ = horizontal axis (north-south)");
|
||||
}
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands.Building {
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
public override bool SuperUseable { get { return false; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new [] { new CommandAlias("Mirror", "mirror"), new CommandAlias("Rotate") }; }
|
||||
get { return new [] { new CommandAlias("Rotate") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message, CommandData data) {
|
||||
@ -38,38 +38,26 @@ namespace MCGalaxy.Commands.Building {
|
||||
string opt = message.ToLower();
|
||||
BlockDefinition[] defs = p.level.CustomBlockDefs;
|
||||
|
||||
// Mirroring
|
||||
if (opt == "mirrorx" || opt == "mirror x") {
|
||||
Flip.MirrorX(cState, defs);
|
||||
p.Message("Flipped copy across the X (east/west) axis.");
|
||||
} else if (opt == "mirrory" || opt == "mirror y" || opt == "u") {
|
||||
Flip.MirrorY(cState, defs);
|
||||
p.Message("Flipped copy across the Y (vertical) axis.");
|
||||
} else if (opt == "mirrorz" || opt == "mirror z" || opt == "m") {
|
||||
Flip.MirrorZ(cState, defs);
|
||||
p.Message("Flipped copy across the Z (north/south) axis.");
|
||||
} else {
|
||||
string[] args = opt.SplitSpaces();
|
||||
char axis = 'Y';
|
||||
int angle = 90;
|
||||
if (!Handle(ref axis, ref angle, args[0])) { Help(p); return; }
|
||||
if (args.Length > 1 && !Handle(ref axis, ref angle, args[1])) { Help(p); return; }
|
||||
|
||||
CopyState newState = cState;
|
||||
if (angle == 0) {
|
||||
} else if (axis == 'X') {
|
||||
newState = Flip.RotateX(cState, angle, defs);
|
||||
} else if (axis == 'Y') {
|
||||
newState = Flip.RotateY(cState, angle, defs);
|
||||
} else if (axis == 'Z') {
|
||||
newState = Flip.RotateZ(cState, angle, defs);
|
||||
}
|
||||
string[] args = opt.SplitSpaces();
|
||||
char axis = 'Y';
|
||||
int angle = 90;
|
||||
if (!Handle(ref axis, ref angle, args[0])) { Help(p); return; }
|
||||
if (args.Length > 1 && !Handle(ref axis, ref angle, args[1])) { Help(p); return; }
|
||||
|
||||
CopyState newState = cState;
|
||||
if (angle == 0) {
|
||||
} else if (axis == 'X') {
|
||||
newState = Flip.RotateX(cState, angle, defs);
|
||||
} else if (axis == 'Y') {
|
||||
newState = Flip.RotateY(cState, angle, defs);
|
||||
} else if (axis == 'Z') {
|
||||
newState = Flip.RotateZ(cState, angle, defs);
|
||||
}
|
||||
|
||||
newState.CopySource = cState.CopySource;
|
||||
newState.CopyTime = cState.CopyTime;
|
||||
p.CurrentCopy = newState;
|
||||
p.Message("Rotated copy {0} degrees around the {1} axis", angle, axis);
|
||||
}
|
||||
newState.CopySource = cState.CopySource;
|
||||
newState.CopyTime = cState.CopyTime;
|
||||
p.CurrentCopy = newState;
|
||||
p.Message("Rotated copy {0} degrees around the {1} axis", angle, axis);
|
||||
}
|
||||
|
||||
bool Handle(ref char axis, ref int angle, string arg) {
|
||||
@ -87,8 +75,6 @@ namespace MCGalaxy.Commands.Building {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
p.Message("&T/Spin mirrorx/mirrory/mirrorz");
|
||||
p.Message("&HFlips/Mirrors the copied object around that axis.");
|
||||
p.Message("&T/Spin X/Y/Z 90/180/270");
|
||||
p.Message("&HRotates the copied object around that axis by the given angle. " +
|
||||
"If no angle is given, 90 degrees is used.");
|
||||
|
@ -304,7 +304,7 @@ namespace MCGalaxy.Games {
|
||||
Player target = PlayerInfo.FindMatches(p, name);
|
||||
if (target == null) return false;
|
||||
|
||||
p.Message("{0} was queued.", p.FormatNick(target));
|
||||
p.Message("{0} &Swas queued.", p.FormatNick(target));
|
||||
QueuedZombie = target.name;
|
||||
|
||||
if (Map != null) Map.Message(target.ColoredName + " &Swas queued as the next zombie.");
|
||||
|
@ -137,6 +137,7 @@
|
||||
<Compile Include="Commands\building\CmdMaze.cs" />
|
||||
<Compile Include="Commands\building\CmdMeasure.cs" />
|
||||
<Compile Include="Commands\building\CmdMessageBlock.cs" />
|
||||
<Compile Include="Commands\building\CmdMirror.cs" />
|
||||
<Compile Include="Commands\building\CmdMode.cs" />
|
||||
<Compile Include="Commands\building\CmdOutline.cs" />
|
||||
<Compile Include="Commands\building\CmdPaint.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user