Open main menu
Home
Random
Log in
Settings
About Stardew Valley Wiki
Disclaimers
Stardew Valley Wiki
Search
Changes
← Older edit
Newer edit →
Modding:Modder Guide/APIs/Content
(view source)
Revision as of 02:53, 28 November 2022
20 bytes removed
,
02:53, 28 November 2022
→Edit a map
Line 383:
Line 383:
:: Edit or replace part of the map. This is basically a copy & paste operation, so the source map is applied over the loaded map. For example:
:: Edit or replace part of the map. This is basically a copy & paste operation, so the source map is applied over the loaded map. For example:
:: <syntaxhighlight lang="C#">
:: <syntaxhighlight lang="C#">
−
public void
Edit
<T>
(
IAssetData
asset
)
+
e.
Edit(asset
=>
{
{
var editor = asset.AsMap();
var editor = asset.AsMap();
Line 389:
Line 389:
Map sourceMap = this.Helper.ModContent.Load<Map>("custom-map.tmx");
Map sourceMap = this.Helper.ModContent.Load<Map>("custom-map.tmx");
editor.PatchMap(sourceMap, targetArea: new Rectangle(30, 10, 20, 20));
editor.PatchMap(sourceMap, targetArea: new Rectangle(30, 10, 20, 20));
−
}
+
}
);
</syntaxhighlight>
</syntaxhighlight>
Atravita
528
edits