Style: Move Block physics to Blocks folder.

This commit is contained in:
UnknownShadow200 2016-10-24 14:12:12 +11:00
parent 70c07f6bb1
commit ad7b0d4d1a
23 changed files with 41 additions and 33 deletions

View File

@ -78,28 +78,30 @@ namespace MCGalaxy.BlockPhysics {
}
}
internal static PhysicsArgs GetDoorArgs(byte b, out byte physForm) {
internal static PhysicsArgs GetDoorArgs(byte raw, bool isExt, out byte physForm) {
PhysicsArgs args = default(PhysicsArgs);
args.Type1 = PhysicsArgs.Wait; args.Value1 = 16 - 1;
args.Type2 = PhysicsArgs.Revert; args.Value2 = b;
args.Type2 = PhysicsArgs.Revert; args.Value2 = raw;
args.Door = true;
args.ExtBlock = isExt;
physForm = Block.door_tree_air; // air
if (b == Block.air_door || b == Block.air_switch) {
if (raw == Block.air_door || raw == Block.air_switch) {
args.Value1 = 4 - 1;
} else if (b == Block.door_green) {
} else if (raw == Block.door_green) {
physForm = Block.door_green_air; // red wool
} else if (b == Block.door_tnt) {
} else if (raw == Block.door_tnt) {
args.Value1 = 4 - 1; physForm = Block.door_tnt_air; // lava
}
return args;
}
internal static PhysicsArgs GetTDoorArgs(byte b) {
internal static PhysicsArgs GetTDoorArgs(byte raw, bool isExt) {
PhysicsArgs args = default(PhysicsArgs);
args.Type1 = PhysicsArgs.Wait; args.Value1 = 16;
args.Type2 = PhysicsArgs.Revert; args.Value2 = b;
args.Type2 = PhysicsArgs.Revert; args.Value2 = raw;
args.Door = true;
args.ExtBlock = isExt;
return args;
}
}

View File

@ -30,7 +30,10 @@ namespace MCGalaxy.BlockPhysics {
if (!C.data.HasWait) return false;
if (C.data.Door && C.data.Data == 0) {
bool tdoor = Block.Props[C.data.Value2].IsTDoor;
bool tdoor = false;
if (!C.data.ExtBlock) tdoor = Block.Props[C.data.Value2].IsTDoor;
else tdoor = lvl.CustomBlockProps[C.data.Value2].IsTDoor;
if (tdoor) DoorPhysics.tDoor(lvl, ref C);
else DoorPhysics.Door(lvl, ref C);
}
@ -44,7 +47,7 @@ namespace MCGalaxy.BlockPhysics {
if (C.data.Type2 == PhysicsArgs.Wait) C.data.Type2 = 0;
if (C.data.Door) {
lvl.AddUpdate(C.b, C.data.Value2); C.data.ResetTypes();
lvl.AddUpdate(C.b, C.data.Value2); C.data.ResetTypes();
C.data.Data = PhysicsArgs.RemoveFromChecks;
}
return false;
@ -62,7 +65,10 @@ namespace MCGalaxy.BlockPhysics {
if (args.Wait) {
if (C.data.Door && C.data.Data == 0) {
bool tdoor = Block.Props[C.data.Value2].IsTDoor;
bool tdoor = false;
if (!C.data.ExtBlock) tdoor = Block.Props[C.data.Value2].IsTDoor;
else tdoor = lvl.CustomBlockProps[C.data.Value2].IsTDoor;
if (tdoor) DoorPhysics.tDoor(lvl, ref C);
else DoorPhysics.Door(lvl, ref C);
}

View File

@ -513,28 +513,28 @@
<Compile Include="Levels\LevelEnv.cs" />
<Compile Include="Levels\LevelInfo.cs" />
<Compile Include="Levels\LevelOptions.cs" />
<Compile Include="Levels\Physics\ActivateablePhysics.cs" />
<Compile Include="Levels\Physics\AIPhysics.cs" />
<Compile Include="Levels\Physics\AirPhysics.cs" />
<Compile Include="Levels\Physics\BirdPhysics.cs" />
<Compile Include="Levels\Physics\C4Physics.cs" />
<Compile Include="Levels\Physics\DoorPhysics.cs" />
<Compile Include="Levels\Physics\ExtLiquidPhysics.cs" />
<Compile Include="Levels\Physics\ExtraInfoPhysics.cs" />
<Compile Include="Levels\Physics\FinitePhysics.cs" />
<Compile Include="Levels\Physics\FirePhysics.cs" />
<Compile Include="Levels\Physics\FireworkPhysics.cs" />
<Compile Include="Levels\Physics\HunterPhysics.cs" />
<Compile Include="Levels\Physics\LeafPhysics.cs" />
<Compile Include="Levels\Physics\LiquidPhysics.cs" />
<Compile Include="Levels\Physics\PhysicsArgs.cs" />
<Compile Include="Levels\Physics\SimpleLiquidPhysics.cs" />
<Compile Include="Levels\Physics\RocketPhysics.cs" />
<Compile Include="Levels\Physics\OtherPhysics.cs" />
<Compile Include="Levels\Physics\SnakePhysics.cs" />
<Compile Include="Levels\Physics\TrainPhysics.cs" />
<Compile Include="Levels\Physics\TntPhysics.cs" />
<Compile Include="Levels\Physics\ZombiePhysics.cs" />
<Compile Include="Blocks\Physics\ActivateablePhysics.cs" />
<Compile Include="Blocks\Physics\AIPhysics.cs" />
<Compile Include="Blocks\Physics\AirPhysics.cs" />
<Compile Include="Blocks\Physics\BirdPhysics.cs" />
<Compile Include="Blocks\Physics\C4Physics.cs" />
<Compile Include="Blocks\Physics\DoorPhysics.cs" />
<Compile Include="Blocks\Physics\ExtLiquidPhysics.cs" />
<Compile Include="Blocks\Physics\ExtraInfoPhysics.cs" />
<Compile Include="Blocks\Physics\FinitePhysics.cs" />
<Compile Include="Blocks\Physics\FirePhysics.cs" />
<Compile Include="Blocks\Physics\FireworkPhysics.cs" />
<Compile Include="Blocks\Physics\HunterPhysics.cs" />
<Compile Include="Blocks\Physics\LeafPhysics.cs" />
<Compile Include="Blocks\Physics\LiquidPhysics.cs" />
<Compile Include="Blocks\Physics\PhysicsArgs.cs" />
<Compile Include="Blocks\Physics\SimpleLiquidPhysics.cs" />
<Compile Include="Blocks\Physics\RocketPhysics.cs" />
<Compile Include="Blocks\Physics\OtherPhysics.cs" />
<Compile Include="Blocks\Physics\SnakePhysics.cs" />
<Compile Include="Blocks\Physics\TrainPhysics.cs" />
<Compile Include="Blocks\Physics\TntPhysics.cs" />
<Compile Include="Blocks\Physics\ZombiePhysics.cs" />
<Compile Include="Network\Heart.cs" />
<Compile Include="Network\IRCBot.cs" />
<Compile Include="Network\LevelChunkStream.cs" />
@ -719,7 +719,7 @@
<Folder Include="Generator\Foilage" />
<Folder Include="Levels\IO" />
<Folder Include="Generator" />
<Folder Include="Levels\Physics" />
<Folder Include="Blocks\Physics" />
<Folder Include="Economy" />
<Folder Include="Blocks" />
<Folder Include="Config" />