squishjs 1.3.2 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squishjs",
3
- "version": "1.3.2",
3
+ "version": "1.3.6",
4
4
  "description": "squish & unsquish stuff",
5
5
  "scripts": {
6
6
  "test": "node testRunner.js"
package/src/Asset.js CHANGED
@@ -1,6 +1,19 @@
1
1
  const path = require('path');
2
2
  const { getAppDataPath } = require('./utils');
3
3
 
4
+ // assets is the old stuff, save it for backward compatibility
5
+ let _assetUrl = 'https://assets.homegames.io';
6
+
7
+ // dumb. probably a way to get around needing to do this in shared library between client and server
8
+ try {
9
+ _assetUrl = process?.env?.API_URL ? `${process.env.API_URL}/assets`: 'https://api.homegames.io/assets';
10
+ } catch (err) {
11
+ console.log('probably running in a browser');
12
+ console.error(err);
13
+ }
14
+
15
+ const ASSET_URL = _assetUrl;
16
+
4
17
  class Asset {
5
18
  constructor(info, data = null) {
6
19
  this.info = info;
@@ -162,11 +175,8 @@ class Asset {
162
175
  writeStream.on('close', () => {
163
176
  resolve(filePath);
164
177
  });
165
-
166
- const apiUrl = this.getConfigValue('API_URL', null);
167
- const assetUrl = apiUrl ? `${apiUrl}/assets` : 'https://assets.homegames.io';
168
178
 
169
- getModule.get(`${assetUrl}/${assetId}`, (res) => {
179
+ getModule.get(`${ASSET_URL}/${assetId}`, (res) => {
170
180
  if (res.statusCode !== 200) {
171
181
  reject('Bad response when downloading asset');
172
182
  } else {
package/src/Squisher.js CHANGED
@@ -122,15 +122,7 @@ class Squisher {
122
122
  }
123
123
 
124
124
  if (node.node.playerIds.length === 0 || node.node.playerIds.findIndex(i => Number(i) === Number(playerId)) >= 0) {
125
- if (node.node.asset) {
126
- const assetInfo = this.gameAssets[Object.keys(node.node.asset)[0]]?.info;
127
- if (assetInfo.type === 'audio' && !this.playerSettings[playerId]?.SOUND?.ENABLED) {
128
- } else {
129
- playerMap[playerId].push(squished);
130
- }
131
- } else {
132
- playerMap[playerId].push(squished);
133
- }
125
+ playerMap[playerId].push(squished);
134
126
  } else {
135
127
  playerIdsToRemove.add(playerId);
136
128
  }