mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 14:54:12 -04:00
H:/PortableApps/GitPortable/App/Git/c4 now works as a mode instead of a separate command
This commit is contained in:
parent
9cec31fe67
commit
9162ca4be8
@ -37,7 +37,7 @@ namespace MCGalaxy.Blocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
byte above = lvl.GetTile(x, (ushort)(y + 1), z), extAbove = 0;
|
byte above = lvl.GetTile(x, (ushort)(y + 1), z), extAbove = 0;
|
||||||
if (above == Block.custom_block)
|
if (above == Block.custom_block)
|
||||||
extAbove = lvl.GetExtTile(x, (ushort)(y + 1), z);
|
extAbove = lvl.GetExtTile(x, (ushort)(y + 1), z);
|
||||||
|
|
||||||
block = (above == Block.Invalid || Block.LightPass(above, extAbove, lvl.CustomBlockDefs))
|
block = (above == Block.Invalid || Block.LightPass(above, extAbove, lvl.CustomBlockDefs))
|
||||||
@ -49,7 +49,7 @@ namespace MCGalaxy.Blocks {
|
|||||||
internal static void Stairs(Player p, byte block, ushort x, ushort y, ushort z) {
|
internal static void Stairs(Player p, byte block, ushort x, ushort y, ushort z) {
|
||||||
if (!(p.level.physics == 0 || p.level.physics == 5)
|
if (!(p.level.physics == 0 || p.level.physics == 5)
|
||||||
|| p.level.GetTile(x, (ushort)(y - 1), z) != Block.staircasestep) {
|
|| p.level.GetTile(x, (ushort)(y - 1), z) != Block.staircasestep) {
|
||||||
p.ChangeBlock(x, y, z, Block.staircasestep, 0); return;
|
p.ChangeBlock(x, y, z, Block.staircasestep, 0); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.SendBlockchange(x, y, z, Block.air); // send the air block back only to the user
|
p.SendBlockchange(x, y, z, Block.air); // send the air block back only to the user
|
||||||
@ -66,11 +66,27 @@ namespace MCGalaxy.Blocks {
|
|||||||
p.ChangeBlock(x, (ushort)(y - 1), z, Block.stone, 0);
|
p.ChangeBlock(x, (ushort)(y - 1), z, Block.stone, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal static void C4(Player p, byte block, ushort x, ushort y, ushort z) {
|
internal static void C4(Player p, byte block, ushort x, ushort y, ushort z) {
|
||||||
if (p.level.physics == 0 || p.level.physics == 5) {
|
if (p.level.physics == 0 || p.level.physics == 5) {
|
||||||
p.RevertBlock(x, y, z); return;
|
p.RevertBlock(x, y, z); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use red wool to detonate c4
|
||||||
|
byte held = p.RawHeldBlock;
|
||||||
|
if (held < Block.CpeCount) held = p.bindings[held];
|
||||||
|
if (held == Block.red) {
|
||||||
|
Player.Message(p, "Placed detonator block, delete it to detonate.");
|
||||||
|
C4Det(p, Block.c4det, x, y, z); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p.c4circuitNumber == -1) {
|
||||||
|
sbyte num = C4Physics.NextCircuit(p.level);
|
||||||
|
p.level.C4list.Add(new C4Data(num));
|
||||||
|
p.c4circuitNumber = num;
|
||||||
|
Player.Message(p, "Place more blocks for more c4, then place a &c{0} %Sblock for the detonator.", Block.Name(Block.red));
|
||||||
|
}
|
||||||
|
|
||||||
C4Data c4 = C4Physics.Find(p.level, p.c4circuitNumber);
|
C4Data c4 = C4Physics.Find(p.level, p.c4circuitNumber);
|
||||||
if (c4 != null) c4.list.Add(p.level.PosToInt(x, y, z));
|
if (c4 != null) c4.list.Add(p.level.PosToInt(x, y, z));
|
||||||
p.ChangeBlock(x, y, z, Block.c4, 0);
|
p.ChangeBlock(x, y, z, Block.c4, 0);
|
||||||
@ -78,13 +94,13 @@ namespace MCGalaxy.Blocks {
|
|||||||
|
|
||||||
internal static void C4Det(Player p, byte block, ushort x, ushort y, ushort z) {
|
internal static void C4Det(Player p, byte block, ushort x, ushort y, ushort z) {
|
||||||
if (p.level.physics == 0 || p.level.physics == 5) {
|
if (p.level.physics == 0 || p.level.physics == 5) {
|
||||||
p.c4circuitNumber = -1;
|
p.c4circuitNumber = -1;
|
||||||
p.RevertBlock(x, y, z); return;
|
p.RevertBlock(x, y, z); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4Data c4 = C4Physics.Find(p.level, p.c4circuitNumber);
|
C4Data c4 = C4Physics.Find(p.level, p.c4circuitNumber);
|
||||||
if (c4 != null) c4.detIndex = p.level.PosToInt(x, y, z);
|
if (c4 != null) c4.detIndex = p.level.PosToInt(x, y, z);
|
||||||
p.c4circuitNumber = -1;
|
p.c4circuitNumber = -1;
|
||||||
p.ChangeBlock(x, y, z, Block.c4det, 0);
|
p.ChangeBlock(x, y, z, Block.c4det, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/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 MCGalaxy.Blocks.Physics;
|
|
||||||
|
|
||||||
namespace MCGalaxy.Commands {
|
|
||||||
public sealed class CmdC4 : Command {
|
|
||||||
public override string name { get { return "c4"; } }
|
|
||||||
public override string shortcut { get { return ""; } }
|
|
||||||
public override string type { get { return CommandTypes.Other; } }
|
|
||||||
public override bool museumUsable { get { return true; } }
|
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
|
||||||
public CmdC4() { }
|
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
|
||||||
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
|
|
||||||
|
|
||||||
if (p.level.physics >= 1 && p.level.physics < 5) {
|
|
||||||
sbyte numb = C4Physics.NextCircuit(p.level);
|
|
||||||
C4Data c4 = new C4Data(numb);
|
|
||||||
p.level.C4list.Add(c4);
|
|
||||||
p.c4circuitNumber = numb;
|
|
||||||
Player.Message(p, "Place any block for c4 and place a &cred %Sblock for the detonator!");
|
|
||||||
p.Blockchange += PlacedNext;
|
|
||||||
} else {
|
|
||||||
Player.Message(p, "To use c4, the physics level must be 1, 2, 3 or 4");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlacedNext(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
|
|
||||||
p.ClearBlockchange();
|
|
||||||
if (type == Block.red) {
|
|
||||||
p.ManualChange(x, y, z, 1, Block.c4det);
|
|
||||||
Player.Message(p, "Placed detonator block!");
|
|
||||||
return;
|
|
||||||
} else if (type != Block.air) {
|
|
||||||
p.ManualChange(x, y, z, 1, Block.c4);
|
|
||||||
}
|
|
||||||
p.Blockchange += PlacedNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Help(Player p) {
|
|
||||||
Player.Message(p, "%T/c4");
|
|
||||||
Player.Message(p, "%HPlace c4!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -335,7 +335,6 @@
|
|||||||
<Compile Include="Commands\Moderation\ModActionCmd.cs" />
|
<Compile Include="Commands\Moderation\ModActionCmd.cs" />
|
||||||
<Compile Include="Commands\other\CmdAscend.cs" />
|
<Compile Include="Commands\other\CmdAscend.cs" />
|
||||||
<Compile Include="Commands\other\CmdBack.cs" />
|
<Compile Include="Commands\other\CmdBack.cs" />
|
||||||
<Compile Include="Commands\other\CmdC4.cs" />
|
|
||||||
<Compile Include="Commands\other\CmdChain.cs" />
|
<Compile Include="Commands\other\CmdChain.cs" />
|
||||||
<Compile Include="Commands\other\cmdCTFADSFD.cs" />
|
<Compile Include="Commands\other\cmdCTFADSFD.cs" />
|
||||||
<Compile Include="Commands\other\CmdDescend.cs" />
|
<Compile Include="Commands\other\CmdDescend.cs" />
|
||||||
|
@ -118,6 +118,7 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modeType != 0) block = modeType;
|
||||||
if (doDelete) {
|
if (doDelete) {
|
||||||
DeleteBlock(oldB, x, y, z, block, extBlock);
|
DeleteBlock(oldB, x, y, z, block, extBlock);
|
||||||
} else {
|
} else {
|
||||||
@ -150,12 +151,6 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlaceBlock(byte old, ushort x, ushort y, ushort z, byte block, byte extBlock) {
|
void PlaceBlock(byte old, ushort x, ushort y, ushort z, byte block, byte extBlock) {
|
||||||
if (modeType != 0) {
|
|
||||||
if (old == modeType) SendBlockchange(x, y, z, old);
|
|
||||||
else ChangeBlock(x, y, z, modeType, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HandlePlace handler = BlockBehaviour.placeHandlers[block];
|
HandlePlace handler = BlockBehaviour.placeHandlers[block];
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler(this, old, x, y, z);
|
handler(this, old, x, y, z);
|
||||||
|
@ -32,7 +32,7 @@ namespace MCGalaxy {
|
|||||||
public byte GetActualHeldBlock(out byte extBlock) {
|
public byte GetActualHeldBlock(out byte extBlock) {
|
||||||
byte block = RawHeldBlock;
|
byte block = RawHeldBlock;
|
||||||
extBlock = 0;
|
extBlock = 0;
|
||||||
if (modeType != 0) return modeType;
|
if (modeType != 0) return modeType;
|
||||||
|
|
||||||
if (block < Block.CpeCount) return bindings[block];
|
if (block < Block.CpeCount) return bindings[block];
|
||||||
extBlock = block;
|
extBlock = block;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user