public override void updateMap() { // Always create an empty map, to avoid crashes // (give it maximum size, so game doesn't mess with warp locations on network) if (this.map == null) { this.map = CreateEmptyMap("DEEPWOODSEMPTY", Settings.Map.MaxMapWidth, Settings.Map.MaxMapHeight); } // Check if level is properly initialized if (this.Seed == 0) { return; } // Check that network data has been sent and initialized by server if (!this.HasReceivedNetworkData) { return; } // Check if map is already created if (this.map != null && this.map.Id == this.Name) { return; } // Check that mapWidth and mapHeight are set if (mapWidth.Value == 0 || mapHeight.Value == 0) { return; } // Create map with proper size this.map = CreateEmptyMap(this.Name, mapWidth, mapHeight); // Build the map! ModEntry.GetAPI().CallBeforeMapGeneration(this); if (ModEntry.GetAPI().CallOverrideMapGeneration(this)) { this.isOverrideMap.Value = true; // Make sure map id is our name, otherwise game will reload the map every frame crashing the game this.map.Id = this.Name; } else { DeepWoodsBuilder.Build(this, this.map, DeepWoodsEnterExit.CreateExitDictionary(this.EnterDir, this.EnterLocation, this.exits)); } ModEntry.GetAPI().CallAfterMapGeneration(this); }
public static void WarpFarmerIntoDeepWoods(DeepWoods deepWoods) { if (deepWoods == null) { return; } Game1.player.FacingDirection = DeepWoodsEnterExit.EnterDirToFacingDirection(deepWoods.EnterDir); if (deepWoods.EnterDir == EnterDirection.FROM_TOP) { Game1.warpFarmer(deepWoods.Name, deepWoods.enterLocation.X, deepWoods.enterLocation.Y + 1, false); } else if (deepWoods.EnterDir == EnterDirection.FROM_RIGHT) { Game1.warpFarmer(deepWoods.Name, deepWoods.enterLocation.X + 1, deepWoods.enterLocation.Y, false); } else { Game1.warpFarmer(deepWoods.Name, deepWoods.enterLocation.X, deepWoods.enterLocation.Y, false); } }
public static void WarpFarmerIntoDeepWoodsFromServerObelisk(string name, Vector2 enterLocation) { Game1.player.FacingDirection = DeepWoodsEnterExit.EnterDirToFacingDirection(EnterDirection.FROM_TOP); Game1.warpFarmer(name, (int)enterLocation.X, (int)enterLocation.Y + 1, false); }