Line 103: |
Line 103: |
| private void OnSaveLoaded(object sender, SaveLoadedEventArgs args) | | private void OnSaveLoaded(object sender, SaveLoadedEventArgs args) |
| { | | { |
− | // load the map file from your mod folder
| |
− | this.Helper.Content.Load<Map>("assets/map.tbin", ContentSource.ModFolder);
| |
− |
| |
| // get the internal asset key for the map file | | // get the internal asset key for the map file |
| string mapAssetKey = this.Helper.Content.GetActualAssetKey("assets/map.tbin", ContentSource.ModFolder); | | string mapAssetKey = this.Helper.Content.GetActualAssetKey("assets/map.tbin", ContentSource.ModFolder); |
| | | |
− | // add the new location | + | // add the location |
| GameLocation location = new GameLocation(mapAssetKey, "YourLocationName") { IsOutdoors = false, IsFarm = false }; | | GameLocation location = new GameLocation(mapAssetKey, "YourLocationName") { IsOutdoors = false, IsFarm = false }; |
| Game1.locations.Add(location); | | Game1.locations.Add(location); |
Line 116: |
Line 113: |
| | | |
| : '''Note:''' | | : '''Note:''' |
− | :# Your map has to be build in a certain pattern; look at the maps in the <tt>Content/Maps</tt> directory for an example on how a map has to be built. | + | :# Your map has to be built in a certain pattern; look at the maps in the <tt>Content/Maps</tt> directory for an example on how a map has to be built. |
| :# After loading your save file, you can use this command to jump to the map: <tt>debug warp YourLocationName X Y</tt> | | :# After loading your save file, you can use this command to jump to the map: <tt>debug warp YourLocationName X Y</tt> |
| | | |
| If you're using Tiled: | | If you're using Tiled: |
| : You can create the map in Tiled, but you need SMAPI to add it to the game. | | : You can create the map in Tiled, but you need SMAPI to add it to the game. |
− |
| |
− | {{SMAPI upcoming|3.0|You no longer need to load the map file before using its asset key.}}
| |
| | | |
| ===Custom tilesheet=== | | ===Custom tilesheet=== |