private void UpdateBlock(bool inverted) { Vector3i wantedPosition; if ((!inverted && _orientation == Orientation.NORTH) || (inverted && _orientation == Orientation.SOUTH)) { wantedPosition = new Vector3i(this.Position3i.x, this.Position3i.y, this.Position3i.z + 1); } else if ((!inverted && _orientation == Orientation.EAST) || (inverted && _orientation == Orientation.WEST)) { wantedPosition = new Vector3i(this.Position3i.x + 1, this.Position3i.y, this.Position3i.z); } else if ((!inverted && _orientation == Orientation.SOUTH) || (inverted && _orientation == Orientation.NORTH)) { wantedPosition = new Vector3i(this.Position3i.x, this.Position3i.y, this.Position3i.z - 1); } else if ((!inverted && _orientation == Orientation.WEST) || (inverted && _orientation == Orientation.EAST)) { wantedPosition = new Vector3i(this.Position3i.x - 1, this.Position3i.y, this.Position3i.z); } else { wantedPosition = new Vector3i(this.Position3i.x, this.Position3i.y, this.Position3i.z); } // check front then front-top then front-bottom Vector3i blockTop = wantedPosition + new Vector3i(0, 1, 0); Vector3i blockBottom = wantedPosition + new Vector3i(0, -1, 0); IEnumerable <WorldObject> list = WorldObjectManager.GetObjectsWithin(this.Position3i, 5f); if (list == null) { return; } foreach (WorldObject item in list) { if (item == null) { return; } List <Vector3i> occupancy = item.WorldOccupancy; if (occupancy == null) { return; } foreach (Vector3i position in occupancy) { if (!inverted) { if (front == null && (position == wantedPosition || position == blockTop || position == blockBottom)) { front = item.GetComponent <PublicStorageComponent>(); // ChatManager.ServerMessageToAll(Localizer.Format("WHAT IT IS FROM ? {0}", con.GetStatus()), true); return; } } else { if (back == null && (position == wantedPosition || position == blockTop || position == blockBottom)) { back = item.GetComponent <PublicStorageComponent>(); // ChatManager.ServerMessageToAll(Localizer.Format("UPDATE BACK {0}", back), true); return; } } } } }