Difference between revisions of "Modding:Mod compatibility/entry"

From Stardew Valley Wiki
Jump to navigation Jump to search
m (Pathoschild moved page Module:SMAPI compatibility to Modding:SMAPI compatibility/entry without leaving a redirect: rv move due to MediaWiki bug)
(convert into wrapper for Module:SMAPI compatibility)
Line 1: Line 1:
<noinclude>
+
<noinclude>{{#invoke:SMAPI compatibility|header}}</noinclude>{{#invoke:SMAPI compatibility|entry
{| class="wikitable plainlinks"
+
|name    = {{{name|}}}
|-
+
|name2    = {{{name2|}}}
! mod name
+
|author  = {{{author|}}}
! author
+
|author2  = {{{author2|}}}
! compatibility
+
|id      = {{{id|}}}
! broke in
+
|old ids  = {{{old ids|}}}
! source
+
|nexus id = {{{nexus id|}}}
! &nbsp;
+
|cf id    = {{{cf id|}}}
</noinclude><!--
+
|url      = {{{url|}}}
 +
|github  = {{{github|}}}
 +
|source   = {{{source|}}}
 +
|links    = {{{links|}}}
 +
|warnings = {{{warnings|}}}
  
Define a few expensive variables here.
+
|status  = {{{status|}}}
 +
|summary  = {{{summary|}}}
 +
|broke in = {{{broke in|}}}
 +
|unofficial version = {{{unofficial version|}}}
 +
|unofficial url    = {{{unofficial url|}}}
  
   {{#arrayindex:vars|0}} = main status
+
|beta status   = {{{beta status|}}}
  {{#arrayindex:vars|1}} = main status (no subtag)
+
|beta summary  = {{{beta summary|}}}
  {{#arrayindex:vars|2}} = beta status
+
|beta broke in = {{{beta broke in|}}}
  {{#arrayindex:vars|3}} = beta status (no subtag)
+
|beta unofficial version = {{{beta unofficial version|}}}
  {{#arrayindex:statuscompare|0}} = whether the compatibility info is equivalent between main and beta ('same' or 'different')
+
|beta unofficial url    = {{{beta unofficial url|}}}
 +
}}<noinclude>
 +
{{#invoke:SMAPI compatibility|footer}}
  
-->{{#arraydefine:vars|<!--
+
This is a wrapper for <code><nowiki>{{#invoke:SMAPI compatibility|entry|...}}</nowiki></code>; see [[Module:SMAPI compatibility]] for more info.
  0-->{{Modding:SMAPI compatibility/entry/status|source={{#if:{{{github|}}}|{{{github}}}|{{{source|}}}}}|unofficial={{{unofficial url|}}}|broke in={{{broke in|}}}|status={{{status|}}}}},<!--
 
  1-->{{Modding:SMAPI compatibility/entry/status|source={{#if:{{{github|}}}|{{{github}}}|{{{source|}}}}}|unofficial={{{unofficial url|}}}|broke in={{{broke in|}}}|status={{{status|}}}|no subtag=1}},<!--
 
  2-->{{Modding:SMAPI compatibility/entry/status|source={{#if:{{{github|}}}|{{{github}}}|{{{source|}}}}}|unofficial={{{unofficial url|}}}|broke in={{{broke in|}}}|status={{{status|}}}|beta unofficial={{{beta unofficial url|}}}|beta broke in={{{beta broke in|}}}|beta status={{{beta status|}}}}},<!--
 
  3-->{{Modding:SMAPI compatibility/entry/status|source={{#if:{{{github|}}}|{{{github}}}|{{{source|}}}}}|unofficial={{{unofficial url|}}}|broke in={{{broke in|}}}|status={{{status|}}}|beta unofficial={{{beta unofficial url|}}}|beta broke in={{{beta broke in|}}}|beta status={{{beta status|}}}|no subtag=1}}
 
}}{{#arraydefine:statuscompare|<!--
 
  0-->{{Modding:SMAPI compatibility/entry/compare status|source={{#if:{{{github|}}}|{{{github}}}|{{{source|}}}}}|unofficial={{{unofficial url|}}}|broke in={{{broke in|}}}|status={{{status|}}}|beta unofficial={{{beta unofficial url|}}}|beta broke in={{{beta broke in|}}}|beta status={{{beta status|}}}}}
 
}}<!--
 
  
Build output
 
  
-->
+
[[Category:Modding]]
|- class="mod" id="{{{name}}}" data-status="{{#arrayindex:vars|1}}" data-beta-status="{{#arrayindex:vars|3}}" {{#if:{{{github|}}}|data-github="{{{github}}}"}} {{#if:{{{source|}}}|data-custom-source="{{{source|}}}"}} style="line-height: 1em; {{#switch:{{#arrayindex:vars|3}} |ok|optional=background: #9F9; |workaround|unofficial=background: #CF9; |broken=background: #F99; |obsolete|abandoned=background: #999}}"
+
</noinclude>
| {{#if:{{{nexus id|}}}|[{{nexus mod|{{{nexus id}}}}} <span class="mod-name">{{{name}}}</span>]|{{#if:{{{cf id|}}}|[https://community.playstarbound.com/resources/{{urlencode:{{{cf id}}}}} <span class="mod-name">{{{name}}}</span>]|{{#if:{{{url|}}}|[{{{url}}} <span class="mod-name">{{{name|}}}</span>]|<span class="mod-name">{{{name|}}}</span>}}}}}}{{#if:{{{name2|}}}|<br /><small style="font-size:0.75em;">(aka <span class="mod-name2">{{{name2}}}</span>)</small>}}
 
| <span class="mod-author">{{{author}}}</span>{{#if:{{{author2|}}}|<br /><small style="font-size:0.75em;">(aka <span class="mod-author2">{{{author2}}}</span>)</small>}}
 
|class="summary"|<!--
 
 
 
stable label (if different)-->{{#ifeq:{{#arrayindex:statuscompare|0}}|different|'''{{version|stable|link=0}}:'''&#32;}}<!--
 
 
 
stable summary--><span class="mod-summary">{{Modding:SMAPI compatibility/entry/summary
 
  |status            = {{#arrayindex:vars|0}}
 
  |summary            = {{{summary|}}}
 
  |unofficial url    = {{{unofficial url|}}}
 
  |unofficial version = {{{unofficial version|}}}
 
}}</span>{{#ifeq:{{#arrayindex:vars|0}}|optional|<ref name="optional-update" />}}<!--
 
 
 
beta summary (if different)-->{{#ifeq:{{#arrayindex:statuscompare|0}}|different|<br />'''{{version|beta|link=0}}-beta:'''&#32;<span class="mod-beta-summary">{{Modding:SMAPI compatibility/entry/summary
 
  |status            = {{#arrayindex:vars|2}}
 
  |summary            = {{{beta summary|}}}
 
  |unofficial url    = {{{beta unofficial url|}}}
 
  |unofficial version = {{{beta unofficial version|}}}
 
}}</span>{{#ifeq:{{#arrayindex:vars|2}}|optional|<ref name="optional-update" />}}}}{{#if:{{{warnings|}}}|<br />⚠&#32;{{#arraydefine:warningArray|{{{warnings}}}}}{{#arrayprint:warningArray|<br />⚠&#32;}}}}
 
| <small>{{#if:{{{beta broke in|}}}|<span class="mod-broke-in">{{{beta broke in}}}</span>|<span class="broke-in">{{{broke in|}}}</span>}}</small>
 
| {{#if:{{{github|}}}|[https://github.com/{{{github}}} source]|{{#if:{{{source|}}}|[{{{source}}} source]|<span style="color: red; font-size: 0.85em; opacity: 0.5;">closed source</span>}}}}
 
| <small>[[#{{{name|}}}|#]] {{#if:{{{hide-url|}}}|&#32;[{{{hide-url}}} o]}}{{#if:{{{links|}}}|&#32;{{#arraydefine:linkArray|{{{links}}}}}{{#arrayprint:linkArray|&#32;|@@@|[@@@ {{#expr:{{#arraysearch:linkArray|@@@}} + 1}}]}}}} {{#if:{{{id|}}}||⚠ no id}}</small><!--
 
 
 
machine-readable metadata (this must be HTML elements because we don't have Scribunto's attribute formatting)
 
--><div class="mod-metadata" style="display: none;">
 
  <div class="mod-anchor">{{anchorencode:{{{name|}}}}}</div>
 
  <div class="mod-id">{{#if:{{{id|}}}{{{old ids|}}}|{{#ifeq:{{{id}}}|none||{{{id}}}{{#if:{{{old ids|}}}|,}}}}{{{old ids|}}}}}</div>
 
  <div class="mod-url">{{#tag:nowiki|{{#if:{{{nexus id|}}}|{{nexus mod|{{{nexus id}}}}}|{{#if:{{{cf id|}}}|https://community.playstarbound.com/resources/{{urlencode:{{{cf id}}}}}|{{{url|}}}}}}}}}</div>
 
  {{#if:{{{nexus id|}}}|<div class="mod-nexus-id">{{{nexus id|}}}</div>}}
 
  {{#if:{{{cf id|}}}|<div class="mod-cf-id">{{{cf id|}}}</div>}}
 
  {{#if:{{{github|}}}|<div class="mod-github">{{{github|}}}</div>}}
 
  {{#if:{{{source|}}}|<div class="mod-custom-source">{{#tag:nowiki|{{{source|}}}}}</div>}}
 
  <div class="mod-status">{{#arrayindex:vars|1}}</div>
 
  {{#if:{{{broke in|}}}|<div class="mod-broke-in">{{{broke in|}}}</div>}}
 
  {{#if:{{{unofficial version|}}}|<div class="mod-unofficial-version">{{{unofficial version|}}}</div>}}
 
  {{#if:{{{unofficial url|}}}|<div class="mod-unofficial-url">{{#tag:nowiki|{{{unofficial url|}}}}}</div>}}
 
{{#ifeq:{{#arrayindex:statuscompare|0}}|different|
 
  <div class="mod-beta-status">{{#arrayindex:vars|3}}</div>
 
  {{#if:{{{beta broke in|}}}|<div class="mod-beta-broke-in">{{{beta broke in|}}}</div>}}
 
  {{#if:{{{beta unofficial version|}}}|<div class="mod-beta-unofficial-version">{{{beta unofficial version|}}}</div>}}
 
  {{#if:{{{beta unofficial url|}}}|<div class="mod-beta-unofficial-url">{{#tag:nowiki|{{{beta unofficial url|}}}}}</div>}}
 
}}
 
  {{#if:{{{warnings|}}}|<div class="mod-warnings">{{{warnings|}}}</div>}}
 
</div><noinclude>
 
|}
 
 
 
==Examples==
 
===Compatible mod===
 
<pre>
 
{{/entry
 
  |name    = Lookup Anything
 
  |author  = Pathoschild
 
  |id      = Pathoschild.LookupAnything
 
  |nexus id = 541
 
  |github  = Pathoschild/StardewMods
 
}}
 
</pre>
 
 
 
{| class="wikitable plainlinks"
 
|-
 
! mod name
 
! author
 
! compatibility
 
! broke in
 
! source
 
! &nbsp;
 
{{Modding:SMAPI_compatibility/entry
 
  |name    = Lookup Anything
 
  |author  = Pathoschild
 
  |id      = Pathoschild.LookupAnything
 
  |nexus id = 541
 
  |github  = Pathoschild/StardewMods
 
}}
 
|}
 
 
 
===Broken mod===
 
<pre>
 
{{/entry
 
  |name    = Lookup Anything
 
  |author  = Pathoschild
 
  |id      = Pathoschild.LookupAnything
 
  |nexus id = 541
 
  |github  = Pathoschild/StardewMods
 
  |summary  =
 
  |broke in = Stardew Valley 1.2
 
}}
 
</pre>
 
{| class="wikitable plainlinks"
 
|-
 
! mod name
 
! author
 
! compatibility
 
! broke in
 
! source
 
! &nbsp;
 
{{Modding:SMAPI_compatibility/entry
 
  |name    = Lookup Anything
 
  |author  = Pathoschild
 
  |id      = Pathoschild.LookupAnything
 
  |nexus id = 541
 
  |github  = Pathoschild/StardewMods
 
  |summary  =
 
  |broke in = Stardew Valley 1.2
 
}}
 
|}
 
 
 
===Unofficial update===
 
For an unofficial update, use the broken-mod template and add these under the other fields:
 
<pre>
 
  |unofficial url    = https://community.playstarbound.com/attachments/201345000
 
  |unofficial version = 1.18.2-unofficial.1-example
 
</pre>
 
{| class="wikitable plainlinks"
 
|-
 
! mod name
 
! author
 
! compatibility
 
! broke in
 
! source
 
! &nbsp;
 
{{Modding:SMAPI_compatibility/entry
 
  |name    = Lookup Anything
 
  |author  = Pathoschild
 
  |id      = Pathoschild.LookupAnything
 
  |nexus id = 541
 
  |github  = Pathoschild/StardewMods
 
  |summary  =
 
  |broke in = Stardew Valley 1.2
 
  |unofficial url    = https://community.playstarbound.com/attachments/201345000
 
  |unofficial version = 1.18.2-unofficial.1-example
 
}}
 
|}
 
 
 
==Usage==
 
===Main fields (shown above)===
 
{| class="wikitable"
 
|-
 
! field
 
! purpose
 
|-
 
| <code>name</code>
 
| The normalised display name for the mod. Combine with <code>name2</code> (see below) to add alternate names.
 
|-
 
| <code>author</code>
 
| The name of the author, as shown on Nexus or in its <tt>manifest.json</tt> file. Combine with <code>author2</code> (see below) to add alternate names.
 
|-
 
| <code>id</code>
 
| The latest unique mod ID, as listed in its <tt>manifest.json</tt> file. In rare cases where there are parallel current releases with different IDs, this can be comma-delimited. For very old mods with no ID, use <tt>none</tt> to disable validation checks.
 
|-
 
| <code>nexus id</code>
 
| The mod's unique ID on Nexus (if any). This is the number in the mod page's URL.
 
|-
 
| <code>github</code>
 
| The mod's GitHub repository in the form <tt>owner/repo</tt>.
 
|-
 
| <code>summary</code>
 
| Specify custom notes or instructions about the mod's compatibility. Should usually be blank.
 
|-
 
| <code>broke in</code>
 
| The SMAPI or Stardew Valley update which broke this mod (if applicable).
 
|}
 
 
 
===Other fields===
 
{| class="wikitable"
 
|-
 
! field
 
! purpose
 
|-
 
| <code>status</code>
 
| Whether the mod is compatible with the latest versions of Stardew Valley and SMAPI (see [[#Valid statuses]]). If not specified, it defaults to <code>unofficial</code> if an unofficial URL is given, else <code>broken</code> if <code>broke in</code> is specified, else <code>ok</code>.
 
|-
 
| <code>unofficial url</code>
 
| A page URL where the player can download an unofficial update, if any.
 
|-
 
| <code>unofficial version</code>
 
| The unofficial update's version number, if any.
 
|-
 
| <code>old ids</code>
 
| IDs which identify older versions of this mod.
 
|-
 
| <code>cf id</code>
 
| The mod's ID in the Chucklefish mod repository.
 
|-
 
| <code>url</code>
 
| The arbitrary mod URL, if not on Nexus or Chucklefish. Avoid if possible, since this makes crossreferencing more difficult.
 
|-
 
| <code>source</code>
 
| An arbitrary source code URL, if not on GitHub. Avoid if possible, since this makes crossreferencing more difficult.
 
|-
 
| <code>name2</code><br /><code>author2</code>
 
| Adds alternate mod and author names.
 
|-
 
| <code>hide-url</code>
 
| Use this instead of (<code>url</code>) to move it into a superscript link. Mainly useful for broken mods with a workaround, so players don't automatically click through to the old mod.
 
|-
 
| <code>links</code>
 
| A comma-delimited list of URLs to add as superscript links. Mainly useful for linking to pull requests.
 
|-
 
| <code>warnings</code>
 
| Text explaining additional compatibility warnings about the mod (e.g. not compatible with Linux/Mac).
 
|}
 
 
 
===Beta fields===
 
When there's a Stardew Valley beta, some mods may have different compatibility statuses for stable vs beta. You can specify these optional fields to specify a different beta status.
 
 
 
{| class="wikitable"
 
|-
 
! field
 
! purpose
 
|-
 
| <code>beta summary</code>
 
| Specify custom notes or instructions about the mod's compatibility. Should usually be blank.
 
|-
 
| <code>beta broke in</code>
 
| The SMAPI or Stardew Valley update which broke this mod (if applicable).
 
|-
 
| <code>beta status</code>
 
| Whether the mod is compatible with the latest versions of Stardew Valley and SMAPI (see [[#Valid statuses]]). If not specified, it defaults to <code>unofficial</code> if an unofficial URL is given, else <code>broken</code> if <code>broke in</code> is specified, else <code>ok</code>.
 
|-
 
| <code>beta unofficial url</code>
 
| A page URL where the player can download an unofficial update, if any.
 
|-
 
| <code>beta unofficial version</code>
 
| The unofficial update's version number, if any.
 
|}
 
 
 
===Valid statuses===
 
{| class="wikitable"
 
|-
 
! status
 
! description
 
|-
 
| <code>ok</code>
 
| The mod is compatible. This is the default and doesn't need to be specified.<br />Default summary: ''use latest version.''
 
|-
 
| <code>optional</code>
 
| The mod is compatible, if you use an optional download on the mod page.<br />Default summary: ''use optional download.<sup>[[#footnote|[1]]]</sup>''
 
|-
 
| <code>unofficial</code>
 
| The mod is compatible using an unofficial update. There's no need to specify this; if you also set <tt>unofficial url</tt> and <tt>unofficial version</tt>, you can remove the status field.
 
|-
 
| <code>workaround</code>
 
| The mod isn't compatible, but the player can fix it or there's a good alternative. A summary should be provided manually. If you also set <tt>unofficial url</tt> and <tt>unofficial version</tt>, you can remove the status field.
 
|-
 
| <code>broken</code>
 
| The mod isn't compatible. The message depends on whether the <code>source</code> link is set.<br />Default summary: ''broken, not updated yet'' or ''broken, not open-source.''
 
|-
 
| <code>abandoned</code>
 
| The mod is no longer maintained by the author, and an unofficial update or continuation is unlikely. This should only be used when the author has definitively abandoned the mod (either explicitly, or by removing the mod page or downloads).<br />Default summary: ''no longer maintained.''
 
|-
 
| <code>obsolete</code>
 
| The mod is no longer needed and should be removed.
 
|}
 
 
 
==Script==
 
This script generates the template call when run from a Nexus or Chucklefish mod page.
 
<source lang="javascript">
 
switch(location.host)
 
{
 
case "www.nexusmods.com":
 
var url = location.origin + location.pathname.replace(/\/*$/, '');
 
var name = $(".header-name").text();
 
var author = $(".uploader a").text();
 
var author2 = $(".header-author strong").text();
 
break;
 
 
 
case "community.playstarbound.com":
 
var url = location.origin + location.pathname.replace(/\/*$/, '');
 
var name = $.trim($("h1:first").contents().first().text());
 
var author = $(".primaryContent[data-author]:first").attr("data-author");
 
break;
 
 
 
default:
 
throw `Unknown domain: ${location.host}`;
 
}
 
 
 
var template = `
 
{{/entry
 
  |name    = ${name}
 
  |author  = ${author}`;
 
if(author2 && author2 != author)
 
  template += '\n' + `  |author2 = ${author2}`;
 
template += `
 
  |url    = ${url}
 
  |status  = ok
 
  |summary =
 
  |source  =
 
}}
 
`;
 
</source>
 
 
 
[[Category:Modding]]</noinclude>
 

Revision as of 01:48, 24 October 2018

This is a wrapper for {{#invoke:SMAPI compatibility|entry|...}}; see Module:SMAPI compatibility for more info.