mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
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:
parent
80ea48ae7a
commit
f0693de778
@ -28,7 +28,7 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
public override void Use(Player p, string message) { RateMap(p, true); }
|
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";
|
string action = like ? "like" : "dislike";
|
||||||
if (p == null) { MessageInGameOnly(p); return false; }
|
if (p == null) { MessageInGameOnly(p); return false; }
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace MCGalaxy.Commands {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool CheckIsAuthor(Player p) {
|
protected static bool CheckIsAuthor(Player p) {
|
||||||
string[] authors = p.level.Authors.Split(',');
|
string[] authors = p.level.Authors.Split(',');
|
||||||
for (int i = 0; i < authors.Length; i++) {
|
for (int i = 0; i < authors.Length; i++) {
|
||||||
if (authors[i].CaselessEq(p.name)) return true;
|
if (authors[i].CaselessEq(p.name)) return true;
|
||||||
|
@ -128,7 +128,7 @@ namespace MCGalaxy.BlockPhysics {
|
|||||||
PhysicsArgs args = default(PhysicsArgs);
|
PhysicsArgs args = default(PhysicsArgs);
|
||||||
args.Type1 = PhysicsArgs.Wait; args.Value1 = 16;
|
args.Type1 = PhysicsArgs.Wait; args.Value1 = 16;
|
||||||
args.Type2 = PhysicsArgs.Revert; args.Value2 = rawBlock;
|
args.Type2 = PhysicsArgs.Revert; args.Value2 = rawBlock;
|
||||||
args.Door = true;
|
args.TDoor = true;
|
||||||
lvl.AddUpdate(index, Block.air, false, args);
|
lvl.AddUpdate(index, Block.air, false, args);
|
||||||
}
|
}
|
||||||
byte oDoor = Block.odoor(rawBlock);
|
byte oDoor = Block.odoor(rawBlock);
|
||||||
|
@ -26,7 +26,7 @@ namespace MCGalaxy.BlockPhysics {
|
|||||||
C.data.ResetTypes();
|
C.data.ResetTypes();
|
||||||
if (C.data.Type1 == PhysicsArgs.TntWars) return true;
|
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;
|
int waitTime = 0;
|
||||||
if (C.data.Type1 == PhysicsArgs.Wait) {
|
if (C.data.Type1 == PhysicsArgs.Wait) {
|
||||||
wait = true; waitTime = C.data.Value1;
|
wait = true; waitTime = C.data.Value1;
|
||||||
@ -60,9 +60,9 @@ namespace MCGalaxy.BlockPhysics {
|
|||||||
|
|
||||||
if (Block.Props[block].IsTDoor) {
|
if (Block.Props[block].IsTDoor) {
|
||||||
PhysicsArgs args = default(PhysicsArgs);
|
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.Type2 = PhysicsArgs.Revert; args.Value2 = block;
|
||||||
args.Door = true;
|
args.TDoor = true;
|
||||||
lvl.AddUpdate(index, Block.air, false, args);
|
lvl.AddUpdate(index, Block.air, false, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,12 +73,12 @@ namespace MCGalaxy.BlockPhysics {
|
|||||||
if (C.data.Type1 == PhysicsArgs.TntWars) return true;
|
if (C.data.Type1 == PhysicsArgs.TntWars) return true;
|
||||||
|
|
||||||
ExtraInfoArgs args = default(ExtraInfoArgs);
|
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.Type1, ref args, C.data.Value1);
|
||||||
ParseType(C.data.Type2, ref args, C.data.Value2);
|
ParseType(C.data.Type2, ref args, C.data.Value2);
|
||||||
|
|
||||||
if (args.Wait) {
|
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, 1, 0, 0));
|
Checktdoor(lvl, lvl.IntOffset(C.b, 1, 0, 0));
|
||||||
Checktdoor(lvl, lvl.IntOffset(C.b, 0, -1, 0));
|
Checktdoor(lvl, lvl.IntOffset(C.b, 0, -1, 0));
|
||||||
@ -182,7 +182,7 @@ namespace MCGalaxy.BlockPhysics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ExtraInfoArgs {
|
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 int WaitTime, DropNum, DissipateNum, ExplodeNum, RainbowNum;
|
||||||
public byte RevertType;
|
public byte RevertType;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace MCGalaxy.BlockPhysics {
|
|||||||
Raw |= (uint)value << 22; }
|
Raw |= (uint)value << 22; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Door {
|
public bool TDoor {
|
||||||
get { return (Raw & (1u << 30)) != 0; }
|
get { return (Raw & (1u << 30)) != 0; }
|
||||||
set { Raw &= ~(1u << 30);
|
set { Raw &= ~(1u << 30);
|
||||||
Raw |= (value ? 1u : 0u) << 30; }
|
Raw |= (value ? 1u : 0u) << 30; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user