Blocks: Make tdoor take the same time to revert, regardless of whether it was activated by a door or a tdoor.

This commit is contained in:
UnknownShadow200 2016-09-13 12:19:54 +10:00
parent 80ea48ae7a
commit f0693de778
4 changed files with 10 additions and 10 deletions

View File

@ -28,7 +28,7 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) { RateMap(p, true); }
protected static bool RateMap(Player p, bool like) {
protected bool RateMap(Player p, bool like) {
string action = like ? "like" : "dislike";
if (p == null) { MessageInGameOnly(p); return false; }
@ -48,7 +48,7 @@ namespace MCGalaxy.Commands {
return true;
}
protected bool CheckIsAuthor(Player p) {
protected static bool CheckIsAuthor(Player p) {
string[] authors = p.level.Authors.Split(',');
for (int i = 0; i < authors.Length; i++) {
if (authors[i].CaselessEq(p.name)) return true;

View File

@ -128,7 +128,7 @@ namespace MCGalaxy.BlockPhysics {
PhysicsArgs args = default(PhysicsArgs);
args.Type1 = PhysicsArgs.Wait; args.Value1 = 16;
args.Type2 = PhysicsArgs.Revert; args.Value2 = rawBlock;
args.Door = true;
args.TDoor = true;
lvl.AddUpdate(index, Block.air, false, args);
}
byte oDoor = Block.odoor(rawBlock);

View File

@ -26,7 +26,7 @@ namespace MCGalaxy.BlockPhysics {
C.data.ResetTypes();
if (C.data.Type1 == PhysicsArgs.TntWars) return true;
bool wait = false, door = C.data.Door;
bool wait = false, door = C.data.TDoor;
int waitTime = 0;
if (C.data.Type1 == PhysicsArgs.Wait) {
wait = true; waitTime = C.data.Value1;
@ -60,9 +60,9 @@ namespace MCGalaxy.BlockPhysics {
if (Block.Props[block].IsTDoor) {
PhysicsArgs args = default(PhysicsArgs);
args.Type1 = PhysicsArgs.Wait; args.Value1 = 10;
args.Type1 = PhysicsArgs.Wait; args.Value1 = 16;
args.Type2 = PhysicsArgs.Revert; args.Value2 = block;
args.Door = true;
args.TDoor = true;
lvl.AddUpdate(index, Block.air, false, args);
}
}
@ -73,12 +73,12 @@ namespace MCGalaxy.BlockPhysics {
if (C.data.Type1 == PhysicsArgs.TntWars) return true;
ExtraInfoArgs args = default(ExtraInfoArgs);
args.Door = C.data.Door;
args.TDoor = C.data.TDoor;
ParseType(C.data.Type1, ref args, C.data.Value1);
ParseType(C.data.Type2, ref args, C.data.Value2);
if (args.Wait) {
if (args.Door && C.data.Data < 2) {
if (args.TDoor && C.data.Data < 2) {
Checktdoor(lvl, lvl.IntOffset(C.b, -1, 0, 0));
Checktdoor(lvl, lvl.IntOffset(C.b, 1, 0, 0));
Checktdoor(lvl, lvl.IntOffset(C.b, 0, -1, 0));
@ -182,7 +182,7 @@ namespace MCGalaxy.BlockPhysics {
}
struct ExtraInfoArgs {
public bool Wait, Drop, Dissipate, Revert, Door, Explode, Rainbow;
public bool Wait, Drop, Dissipate, Revert, TDoor, Explode, Rainbow;
public int WaitTime, DropNum, DissipateNum, ExplodeNum, RainbowNum;
public byte RevertType;
}

View File

@ -58,7 +58,7 @@ namespace MCGalaxy.BlockPhysics {
Raw |= (uint)value << 22; }
}
public bool Door {
public bool TDoor {
get { return (Raw & (1u << 30)) != 0; }
set { Raw &= ~(1u << 30);
Raw |= (value ? 1u : 0u) << 30; }