private static AbstractRoomNode World_GetNode(On.World.orig_GetNode orig, World self, WorldCoordinate c) { bool foundError = false; try { if (self.GetAbstractRoom(c.room) == null) { foundError = true; CustomWorldMod.Log("ERROR at GetNode !!! c.room Abstract is null", true); } else if (self.GetAbstractRoom(c.room).nodes == null) { foundError = true; CustomWorldMod.Log("ERROR at GetNode !!! abstractRoomNodes is null", true); } else if (self.GetAbstractRoom(c.room).nodes.Length < 1) { foundError = true; CustomWorldMod.Log("ERROR at GetNode !!! abstractRoomNodes is empty", true); } } catch (Exception e) { CustomWorldMod.Log("ERROR!" + e, true); } if (foundError) { CustomWorldMod.Log("Fatal error while loading the world. This is probably caused by a broken connection. " + "Make sure you are not missing a comp patch.", true); } return(orig(self, c)); }
private static AbstractRoomNode World_GetNode(On.World.orig_GetNode orig, World self, WorldCoordinate c) { // this.GetAbstractRoom(c.room).nodes[c.abstractNode]; try { if (self.GetAbstractRoom(c.room) == null) { CustomWorldMod.Log("ERROR at GetNode !!! c.room Abstract is null", true); } else if (self.GetAbstractRoom(c.room).nodes == null) { CustomWorldMod.Log("ERROR at GetNode !!! abstractRoomNodes is null", true); } else if (self.GetAbstractRoom(c.room).nodes.Length < 1) { CustomWorldMod.Log("ERROR at GetNode !!! abstractRoomNodes is empty", true); } } catch (Exception e) { CustomWorldMod.Log("ERROR!" + e, true); } /* * string debug = $"Custom Regions: Nodes in [{self.GetAbstractRoom(c.room).name}]"+" {"; * for (int i = 0; i < self.GetAbstractRoom(c.room).nodes.Length; i++) * { * try * { * debug += self.GetAbstractRoom(c.room).nodes[i] + "/"; * } * catch (Exception e) { } * } * CustomWorldMod.CustomWorldLog(debug + "}"); */ return(orig(self, c)); }