From f0693de77826f0dd11dec12ee442a965b7beae40 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 13 Sep 2016 12:19:54 +1000 Subject: [PATCH] Blocks: Make tdoor take the same time to revert, regardless of whether it was activated by a door or a tdoor. --- Commands/Fun/RateMapCmds.cs | 4 ++-- Levels/Physics/DoorPhysics.cs | 2 +- Levels/Physics/ExtraInfoPhysics.cs | 12 ++++++------ Levels/Physics/PhysicsArgs.cs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Commands/Fun/RateMapCmds.cs b/Commands/Fun/RateMapCmds.cs index 2be9e716e..59cf98f8d 100644 --- a/Commands/Fun/RateMapCmds.cs +++ b/Commands/Fun/RateMapCmds.cs @@ -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; diff --git a/Levels/Physics/DoorPhysics.cs b/Levels/Physics/DoorPhysics.cs index 9cf77e4fb..201cc553f 100644 --- a/Levels/Physics/DoorPhysics.cs +++ b/Levels/Physics/DoorPhysics.cs @@ -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); diff --git a/Levels/Physics/ExtraInfoPhysics.cs b/Levels/Physics/ExtraInfoPhysics.cs index 09e4a4ca5..ecb41cd26 100644 --- a/Levels/Physics/ExtraInfoPhysics.cs +++ b/Levels/Physics/ExtraInfoPhysics.cs @@ -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; } diff --git a/Levels/Physics/PhysicsArgs.cs b/Levels/Physics/PhysicsArgs.cs index 0d3454eda..bf929d0c2 100644 --- a/Levels/Physics/PhysicsArgs.cs +++ b/Levels/Physics/PhysicsArgs.cs @@ -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; }