Changes

→‎What's an 'asset name'?: update Content Patcher info (no longer changing in 2.0)
Line 26: Line 26:  
|}
 
|}
   −
For legacy reasons, the asset name in [[Modding:Content Patcher|Content Patcher content packs]] does not include the language code. That will change in the upcoming Content Patcher 2.0.0.
+
Note that in [[Modding:Content Patcher|Content Patcher packs]], the asset name ''doesn't'' include the language code. For example, the Content Patcher asset name in the second row above is <samp>Maps/Desert</samp>.
    
===What does the content API do?===
 
===What does the content API do?===
Line 240: Line 240:  
     private void OnAssetRequested(object sender, AssetRequestedEventArgs e)
 
     private void OnAssetRequested(object sender, AssetRequestedEventArgs e)
 
     {
 
     {
         if (e.NameWithoutLocale.IsEquivalentTo("Data/ObjectInformation"))
+
         if (e.NameWithoutLocale.IsEquivalentTo("Data/Objects"))
 
         {
 
         {
 
             e.Edit(asset =>
 
             e.Edit(asset =>
 
             {
 
             {
                 var data = asset.AsDictionary<int, string>().Data;
+
                 var data = asset.AsDictionary<string, ObjectData>().Data;
   −
                 foreach ((int itemID, string itemData) in data)
+
                 foreach ((string itemID, ObjectData itemData) in data)
 
                 {
 
                 {
                     string[] fields = itemData.Split('/');
+
                     itemData.Price *= 2;
                    fields[1] = (int.Parse(fields[1]) * 2).ToString();
  −
                    data[itemID] = string.Join('/', fields);
   
                 }
 
                 }
 
             });
 
             });
Line 346: Line 344:  
| ''(optional)'' How the image should be patched. The possible values...
 
| ''(optional)'' How the image should be patched. The possible values...
 
* <samp>PatchMode.Replace</samp> (default): erase the original content within the area before pasting in the new content;
 
* <samp>PatchMode.Replace</samp> (default): erase the original content within the area before pasting in the new content;
* <samp>PatchMode.Overlay</samp>: draw the new content over the original content, so the original content shows through any ''fully'' transparent pixels.
+
* <samp>PatchMode.Overlay</samp>: draw the new content over the original content, so the original content shows through transparent or semi-transparent pixels.
 
|}
 
|}
    
:; ExtendImage
 
:; ExtendImage
:: Extend the image if needed to fit the given size. Note that '''this is an expensive operation''', creates a new texture instance, and extending a spritesheet horizontally may cause game errors or bugs. For example:
+
:: Extend the image if needed to fit the given size. Note that '''resizing the image is an expensive operation''', creates a new texture instance, and extending a spritesheet horizontally may cause game errors or bugs. For example:
 
:: <syntaxhighlight lang="C#">
 
:: <syntaxhighlight lang="C#">
  
translators
8,447

edits