Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Steamworks 1/4 #15

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
41 changes: 37 additions & 4 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,11 @@
"string": "Zip, combine assets into single file (not recommended)"
},
"application-win32": {
"string": "{type} Windows application (32-bit or 64-bit)",
"string": "{type} Windows application (32-bit)",
"context": "type will become something like 'NW.js' or 'Electron'. Do not translate 'Windows'."
},
"application-win64": {
"string": "{type} Windows application (64-bit only, not recommended)",
"string": "{type} Windows application (64-bit)",
"context": "type will become something like 'NW.js' or 'Electron'. Do not translate 'Windows'."
},
"application-win-arm": {
Expand All @@ -473,7 +473,7 @@
"context": "type will become something like 'NW.js' or 'Electron'. Do not translate 'macOS'."
},
"application-linux64": {
"string": "{type} Linux application (64-bit only)",
"string": "{type} Linux application (64-bit)",
"context": "type will become something like 'NW.js' or 'Electron'. Do not translate 'Linux'."
},
"application-linux-arm32": {
Expand Down Expand Up @@ -521,6 +521,39 @@
"maxTextureDimension": {
"string": "Increase max vector costume resolution to make large costumes look better. May increase memory use and cause crashes."
},
"steamworksExtension": {
"string": "Steamworks Extension",
"context": "Title of section that appears when using the Steamworks extension"
},
"steamworksMacWarning": {
"string": "Warning: macOS games published on Steam need to be notarized by Apple, which the packager doesn't support. You can still test your game on a Mac, but you won't be able to publish it for macOS yet.",
"developer_comment": "When using the Steamworks extension, warning that appears whenever macOS support is used or mentioned."
},
"steamworksDocumentation": {
"string": "See the extension's documentation for more details.",
"context": "Link to more documentation about the Steamworks extension"
},
"steamworksUnavailable": {
"string": "To enable the Steamworks extension, you must use one of these environments:"
},
"steamworksAvailable": {
"string": "This project is using the Steamworks extension. You can find your game's App ID in Steamworks, or use {n} for testing with the Steamworks demo game."
},
"steamworksAppId": {
"string": "App ID"
},
"steamworksOnError": {
"string": "If there is an error initializing Steamworks"
},
"steamworksIgnore": {
"string": "Do nothing"
},
"steamworksWarning": {
"string": "Show a warning but continue"
},
"steamworksError": {
"string": "Show an error and exit"
},
"package": {
"string": "Package",
"context": "Button to package the project"
Expand Down Expand Up @@ -620,4 +653,4 @@
"description": "Button to cancel import"
}
}
}
}
50 changes: 50 additions & 0 deletions src/p4/PackagerOptions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@
thing = 'Electron';
} else if (detail.asset === 'webview-mac') {
thing = 'WKWebView';
} else if (detail.asset === 'steamworks.js') {
thing = 'Steamworks.js';
}
if (thing) {
task.setProgressText($_('progress.loadingLargeAsset').replace('{thing}', thing));
Expand Down Expand Up @@ -1022,6 +1024,54 @@
</div>
{/if}

{#if projectData.project.analysis.usesSteamworks}
<Section
accent="#136C9F"
reset={() => {
resetOptions([
'steamworks'
]);
}}
>
<h2>{$_('options.steamworksExtension')}</h2>
{#if ['electron-win64', 'electron-linux64', 'electron-mac'].includes($options.target)}
<p>{$_('options.steamworksAvailable').replace('{n}', '480')}</p>
<label class="option">
{$_('options.steamworksAppId')}
<input pattern="\d+" minlength="1" bind:value={$options.steamworks.appId}>
</label>
<label class="option">
{$_('options.steamworksOnError')}
<select bind:value={$options.steamworks.onError}>
<option value="ignore">{$_('options.steamworksIgnore')}</option>
<option value="warning">{$_('options.steamworksWarning')}</option>
<option value="error">{$_('options.steamworksError')}</option>
</select>
</label>

{#if $options.target === 'electron-mac'}
<p class="warning">
{$_('options.steamworksMacWarning')}
</p>
{/if}
{:else}
<p>{$_('options.steamworksUnavailable')}</p>
<ul>
<li>{$_('options.application-win64').replace('{type}', 'Electron')}</li>
<li>
{$_('options.application-mac').replace('{type}', 'Electron')}
<br>
{$_('options.steamworksMacWarning')}
</li>
<li>{$_('options.application-linux64').replace('{type}', 'Electron')}</li>
</ul>
{/if}
</Section>
{/if}

<p>
<a href="https://extensions.turbowarp.org/steamworks">{$_('options.steamworksDocumentation')}</a>
</p>
<Section>
<DropArea on:drop={(e) => importOptionsFromDataTransfer(e.detail)}>
<div class="buttons">
Expand Down
2 changes: 2 additions & 0 deletions src/packager/download-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const unknownAnalysis = () => ({
stageVariables: [],
stageComments: [],
usesMusic: true,
usesSteamworks: false,
extensions: []
});

Expand Down Expand Up @@ -40,6 +41,7 @@ const analyzeScratch3 = (projectData) => {
.map((i) => i.text);
// TODO: usesMusic has possible false negatives
const usesMusic = projectData.extensions.includes('music');
const usesSteamworks = projectData.extensions.includes('steamworks');
const extensions = projectData.extensionURLs ? Object.values(projectData.extensionURLs) : [];
return {
...unknownAnalysis(),
Expand Down
Loading