Core: Fix non-solid custom door

This commit is contained in:
UnknownShadow200 2016-10-24 18:23:29 +11:00
parent 9fc8d8841a
commit 31fd171512
4 changed files with 24 additions and 81 deletions

View File

@ -184,10 +184,12 @@ namespace MCGalaxy {
[Obsolete]
public static bool mb(byte block) { return Props[block].IsMessageBlock; }
public static bool Physics(byte block) //returns false if placing block cant actualy cause any physics to happen
{
switch (block)
{
public static bool Physics(byte block) { //returns false if placing block cant actualy cause any physics to happen
if (Props[block].IsMessageBlock || Props[block].IsPortal) return false;
if (Props[block].IsDoor || Props[block].IsTDoor) return false;
if (Props[block].OPBlock) return false;
switch (block) {
case rock:
case stone:
case blackrock:
@ -205,78 +207,6 @@ namespace MCGalaxy {
case stonevine:
case obsidian:
case op_glass:
case opsidian:
case op_brick:
case op_stone:
case op_cobblestone:
case op_air:
case op_water:
case door_tree:
case door_obsidian:
case door_glass:
case door_stone:
case door_leaves:
case door_sand:
case door_wood:
case door_green:
case door_tnt:
case door_stair:
case door_iron:
case door_gold:
case door_dirt:
case door_grass:
case door_blue:
case door_book:
case door_cobblestone:
case door_red:
case door_orange:
case door_yellow:
case door_lightgreen:
case door_aquagreen:
case door_cyan:
case door_lightblue:
case door_purple:
case door_lightpurple:
case door_pink:
case door_darkpink:
case door_darkgrey:
case door_lightgrey:
case door_white:
case tdoor:
case tdoor2:
case tdoor3:
case tdoor4:
case tdoor5:
case tdoor6:
case tdoor7:
case tdoor8:
case tdoor9:
case tdoor10:
case tdoor11:
case tdoor12:
case tdoor13:
case air_door:
case air_switch:
case water_door:
case lava_door:
case MsgAir:
case MsgWater:
case MsgLava:
case MsgBlack:
case MsgWhite:
case blue_portal:
case orange_portal:
case air_portal:
case water_portal:
case lava_portal:
case deathair:
case deathlava:
case deathwater:

View File

@ -294,7 +294,7 @@ namespace MCGalaxy {
errorLocation = "Adding physics";
if (p.PlayingTntWars && block == Block.smalltnt) AddTntCheck(PosToInt(x, y, z), p);
if (physics > 0 && Block.Physics(block)) AddCheck(PosToInt(x, y, z));
if (physics > 0 && ActivatesPhysics(block, extBlock)) AddCheck(PosToInt(x, y, z));
changed = true;
backedup = false;
@ -386,7 +386,7 @@ namespace MCGalaxy {
IntToPos(b, out x, out y, out z);
RevertExtTileNoCheck(x, y, z);
}
if (physics > 0 && (Block.Physics(block) || data.Raw != 0))
if (physics > 0 && (ActivatesPhysics(block, extBlock) || data.Raw != 0))
AddCheck(b, false, data);
// Save bandwidth sending identical looking blocks, like air/op_air changes.

View File

@ -291,6 +291,7 @@ namespace MCGalaxy {
ListUpdate.Count = j;
}
public void ClearPhysics() {
for (int i = 0; i < ListCheck.Count; i++ )
RevertPhysics(ListCheck.Items[i]);
@ -330,6 +331,18 @@ namespace MCGalaxy {
default(PhysicsArgs), extBlock);
}
internal bool ActivatesPhysics(byte block, byte extBlock) {
if (block != Block.custom_block)
return Block.Physics(block);
BlockProps[] props = CustomBlockProps;
if (props[extBlock].IsMessageBlock || props[extBlock].IsPortal) return false;
if (props[extBlock].IsDoor || props[extBlock].IsTDoor) return false;
if (props[extBlock].OPBlock) return false;
return true;
}
internal bool CheckSpongeWater(ushort x, ushort y, ushort z) {
for (int yy = y - 2; yy <= y + 2; ++yy) {
if (yy < 0 || yy >= Height) continue;

View File

@ -134,9 +134,9 @@ namespace MCGalaxy {
if (!Database.TableExists("Messages" + name)) return;
using (DataTable table = Database.Backend.GetRows("Messages" + name, "*")) {
foreach (DataRow row in table.Rows) {
ushort x = ushort.Parse(row["EntryX"].ToString());
ushort y = ushort.Parse(row["EntryY"].ToString());
ushort z = ushort.Parse(row["EntryZ"].ToString());
ushort x = ushort.Parse(row["X"].ToString());
ushort y = ushort.Parse(row["Y"].ToString());
ushort z = ushort.Parse(row["Z"].ToString());
byte block = level.GetTile(x, y, z);
if (block == Block.custom_block) {