1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-10 00:31:51 +00:00
Commit Graph

2506 Commits

Author SHA1 Message Date
Даниїл Григор'єв
f949fb14bd
"Fix" ModInterface not accepting mod:// URLs
Remove the check of URL beginning with data:image. This is an old API,
so leave other quirks as-is.
2025-06-19 07:35:11 +03:00
Даниїл Григор'єв
7854e10173
Rename incorrectly named .d.ts files
These files do not describe existing JS types and instead define their
own. Usage of .d.ts extension prevents these types from being emitted
when using emitDeclarationOnly, which affects generation of typings for
mod development.
2025-06-19 05:48:23 +03:00
Даниїл Григор'єв
2990f55dfb
Minor "buffers" cleanup
Remove the canvas context loss handling as it was incorrect, simplify
the error conditions in makeOffscreenBuffer and remove commented out
code.
2025-06-19 05:38:39 +03:00
Даниїл Григор'єв
b106c35c03
Do not automatically open devtools
Remove the behavior of automatically opening developer tools when
launched with --dev command line switch. As --hide-devtools switch is
now unused, remove it as well.
2025-06-19 04:54:20 +03:00
Даниїл Григор'єв
9906397170
Build tools cleanup pass (#81)
* Fix tsconfig scopes affecting html.js

Since it's quite hard to use a DOM library type there, remove the type
entirely.

* Remove environment variables check

Nothing is using them anymore. It can be added back if needed later.

* Refactor Texture Packer downloading

Refactor local-config.js tasks file into a generic "environment"
category consisting of checking if Java is installed, downloading the
runnable Texture Packer if it's not yet downloaded and copying the local
configuration template; update README accordingly.

* Prepare environment only at postinstall

Remove environment.prepare task from default build pipelines, add a
postinstall script that calls the task, using environment.js as the
gulpfile to speed it up.

* Remove "docs" tasks and types generation script

Remove tasks from docs.js as they are unlikely to do anything meaningful
nowadays. Also remove the buildTypes script as it doesn't work anymore.
A better solution will be provided in the future.

* Simplify some globs

Use additional gulp.src options instead of specifying more or complex
globs.

* Extract built-temp location to a variable

Add the src/js/built-temp directory as a new variable in config.js,
replace all existing references to built-temp with this variable.
2025-06-19 04:51:34 +03:00
Даниїл Григор'єв
ae739be484
Tidy up ALEA RNG code
Not a performance improvement, just something that needed to be done.
Slightly simplifies the structure and removes useless functions
(changing the seed resets the RNG anyway - it is better to create a new
instance instead).
2025-06-16 23:26:11 +03:00
Даниїл Григор'єв
b3d0e30c07
Manually debounce force reload event
Remove chokidar built-in event debouncing/aggregating and replace it
with a basic custom implementation with a 250ms settle delay.
2025-06-14 22:54:06 +03:00
Даниїл Григор'єв
94b7c754ad
Remove non-standard attribute assignment
Don't set the non-existent "opaque", "webkitOpaque" and "mozOpaque"
properties on a canvas. Keep using { alpha: false } when initializing
the context, which is the correct way.
2025-06-14 22:11:14 +03:00
Даниїл Григор'єв
d6390e88a4
Replace Object#hasOwnProperty with Object.hasOwn
Change most, but not all usages. This is mostly to please the linter,
but Object.hasOwn is also slightly shorter, especially when compared to
the proper form, Object.prototype.hasOwnProperty...
2025-06-14 22:11:14 +03:00
Даниїл Григор'єв
9876d5305b
Remove mentions of ads and twitter
🚮
2025-06-14 22:09:02 +03:00
Даниїл Григор'єв
0bca522c59
Remove some outdated browser checks
Also remove some type definitions that are definitely no longer needed
or were never correct.
2025-06-14 22:08:57 +03:00
Даниїл Григор'єв
470fcb42f1
Remove unused Twitter link stuff
No longer exists, lmao.
2025-06-14 06:44:41 +03:00
Даниїл Григор'єв
a6a517a96b
Remove highly redundant utils functions
Remove isSupportedBrowser entirely and inline usages of getLogoSprite.
2025-06-14 06:14:58 +03:00
Даниїл Григор'єв
2f23c0174d
Inline {enable,disable}ImageSmoothing usages
The method isn't as complex as it used to be, and is only used in two
places. It is simpler to have it inlined instead.
2025-06-14 06:10:23 +03:00
Даниїл Григор'єв
36a3ae2da9
Do not compress translation files
Remove the compressjson loader and related defines in webpack config.
Also remove the remaining lz-string usages in the project and a local
copy.
2025-06-14 06:02:58 +03:00
Даниїл Григор'єв
713169a3eb
Ensure proper code splitting for translations
Make updateApplicationLanguage load translations asynchronously as
separate chunks in a slightly hacky way. Also implement a workaround for
old translation overrides registry ModInterface API.
2025-06-14 05:36:55 +03:00
Даниїл Григор'єв
06cfc3d29a
Remove unused G_HAVE_ASSERT define
Not used anywhere except exposing BUILD_OPTIONS for mods.
2025-06-14 04:55:15 +03:00
Даниїл Григор'єв
0670110593
Move beginCircle to polyfills.ts
Technically not a polyfill, but neither are two existing functions in
polyfills.ts.
2025-06-14 04:43:19 +03:00
Даниїл Григор'єв
a84837d913
Remove redundant/unused stuff from globals.d.ts
Remove things that no longer exist or are covered by built-in TypeScript
libraries. Also switch to webpack-provided types instead of defining
them manually.
2025-06-14 04:37:32 +03:00
Даниїл Григор'єв
bd4e31653c
Remove beginRoundedRect utility
No longer needed, as CanvasRenderingContext2D#roundRect is a built-in
way to achieve the same result now.
2025-06-14 04:24:46 +03:00
Даниїл Григор'єв
aff7a4e0a5
Remove DOM remove() polyfills
Remove polyfill functions for Element, CharacterData and DocumentType
classes, as these methods are all Baseline Widely Available. Also get
rid of redundant IIFE for the Math "polyfills".
2025-06-14 04:02:47 +03:00
TcePrepK
eb7564b1a9
Merge pull request #75 from tobspr-games/tceprepk/map-view-optimization
Added gameInitialized check to onEntityChanged in map_view.js
2025-06-12 17:03:08 +03:00
TcePrepK
c12bc13df6 Added gameInitialized check to onEntityChanged in map_view.js 2025-06-12 16:15:17 +03:00
Даниїл Григор'єв
e041369a7d
Avoid null uid in EntityManager#registerEntity
Apply suggestion by @chunkybanana to improve readability.
2025-06-12 15:27:38 +03:00
Даниїл Григор'єв
69fb06e817
Use Set for entities access during belt recompute
Create a method to return all entities with the specified component as a
set (without array indirection), and use the method for belt
recomputations.
2025-06-12 15:27:38 +03:00
Даниїл Григор'єв
9cbb797ef6
Use Map and Set for entity storage
This is not a big optimization but an optimization nonetheless. Mostly
based on awesome work by @Xiving. Further work should be done to get
most out of these changes.
2025-06-12 15:27:38 +03:00
Даниїл Григор'єв
cd7c132411
[TS] Rename EntityManager 2025-06-12 15:27:38 +03:00
Даниїл Григор'єв
6c3f91e587
Basic FS watcher for --load-mod mods
Add a --watch command line flag to be used in tandem with --load-mod.
Chokidar is used to detect file updates, and a page reload is triggered
when there are any changes to watched mod files. Only mods loaded via
--load-mod are affected.

This implementation has a minor issue with how cache is cleared -
removing disk cache is a bit too aggressive - but the only alternative I
could find is to use a non-persistent Electron session, which would get
rid of disk cache entirely (this is not a concern).
2025-06-12 15:22:15 +03:00
Даниїл Григор'єв
7cb3477a90
Compression: Terminate workers after use
While the browser engine can clean up workers automatically, it's a good
idea to terminate them as soon as we don't need those anymore. It's
generally suggested to reuse a single worker for repetitive operations,
but implementing such a system is much harder. In addition, spawning a
new worker for each operation allows (de)compressing multiple blobs in
parallel :)
2025-06-10 16:53:14 +03:00
Даниїл Григор'єв
82dae1158e
Re-implement compression workers and abstraction
Implement DefaultCompression class along with a generic interface to
facilitate easy to use compression in a background thread, and make use
of this class in Storage implementation by default.
2025-06-10 16:46:28 +03:00
Даниїл Григор'єв
3c331b8214
Fix main menu not waiting for savegame import
Does not fix the savegame list bugs. Note that savegame index
serialization happens a few times for some reason, this is out of scope
for this commit though.
2025-06-10 16:45:21 +03:00
Даниїл Григор'єв
45e99d47b8
Clean up Electron wrapper code
Remove a temporary console.log statement as well as now-unused msgpack
module.
2025-06-10 16:43:56 +03:00
Даниїл Григор'єв
efb9eee286
Remove main process compression
To be simplified and replaced with renderer-side web workers.
2025-06-10 12:15:38 +03:00
Даниїл Григор'єв
3abfa9c35d
Fix unhandled savegame error not being displayed
Move the file loading code into the try/catch block, as it can and will
produce errors eventually.
2025-05-04 03:19:22 +03:00
Даниїл Григор'єв
2b890466b0
Merge pull request #69 from tobspr-games/dengr1065/new-savegame-storage
Implement gzipped MessagePack savegame storage
2025-05-03 00:47:29 +03:00
Даниїл Григор'єв
6e81afd372
Remove some compression leftovers
Remove the CRC dependency and "binary file salt" in globalConfig.
2025-04-18 11:09:45 +03:00
Даниїл Григор'єв
f25c1db611
Enable Arabic language
As per author's request. The translation was already good enough, and
now the author wrote to me about this.
2025-04-16 16:46:34 +03:00
Даниїл Григор'єв
fc33cc2fbf
Add dedicated saves storage, new fs job types
Keep track of the storage ID in each renderer Storage instance and pass
it to the IPC bridge. Jobs are dispatched to the relevant handler (only
saves/ for now) and all (de)compression is handled there.

Add dedicated fs-job types to read or write and (de)compress data
from/to the file picked by the user. Remove redundant utility functions
that used web APIs instead.
2025-04-15 01:57:00 +03:00
Даниїл Григор'єв
6b7cfa1b1b
Pass storage object to ReadWriteProxy
Make it slightly easier to replace the storage interface used for
app_settings.bin and savegames.bin in case it's ever needed. Savegames
always use app.storage for now, but this should be easier to change as
well.
2025-04-14 17:48:35 +03:00
Даниїл Григор'єв
c61825e8b3
Remove savegame object compression
Preparation for further changes. Savegames that are not compressed are
much bigger, but this is a rather complex algorithm that shouldn't
exist.
2025-04-14 03:17:08 +03:00
Даниїл Григор'єв
2b8709dd3e
Fix savegame load error on missing mod website
Not a proper fix, but this thing needs a huge refactor anyway. Goodbye,
a bug that existed ever since the first version of mod support!
2025-04-13 04:15:55 +03:00
Даниїл Григор'єв
d95fce7033
Fix broken mods state appearance
Not a complete rework. This is just a temporary improvement.
2025-04-13 03:44:30 +03:00
Даниїл Григор'єв
c9d2a16ada
Create ModInterfaceV2 for cool stuff
For now it only includes a helper function to resolve file URLs and a
method that adds a CSS stylesheet to the document.
2025-04-13 02:58:41 +03:00
Даниїл Григор'єв
7b4cb25d5d
Respect --safe-mode once again
The new mod locator system now respects the --safe-mode command line
switch, ignoring the user and distro mod directories.
2025-04-13 01:42:06 +03:00
Даниїл Григор'єв
ad8e39bdf4
WIP: Basic ASAR modding in renderer
Also fix a few issues in Electron code. This is not as polished yet, UI
from old mod support was reused for now and is likely broken. Mods can
be loaded, but there isn't much QoL around the support for now.
2025-04-12 20:06:03 +03:00
Даниїл Григор'єв
321f517593
Remove game version check
Doesn't make much sense with how experimental CE is right now. A
different logic for checking whether a mod is compatible will be used
later.
2025-04-11 00:04:14 +03:00
Даниїл Григор'єв
0ba90b7b43
Remove externalModUrl
Remove the debug option and code that used it. It is redundant due to
existence of --load-mod in the Electron wrapper.
2025-04-11 00:01:57 +03:00
Даниїл Григор'єв
499dbd269a
Basic ignore of duplicate mods
Only load the mod with highest priority for now. Proper behavior would
be to keep metadata for all duplicates and load the first that isn't
disabled. This allows easy mod source switching (for example, user mods
and development mods)
2025-04-11 00:01:57 +03:00
Даниїл Григор'єв
c4e9d417b3
Re-use global app variable in ModLoader
The linkApp method is removed as it was unused. A getter is used to
ensure best development experience. It can be further improved by adding
a guard for cases where GLOBAL_APP is not set yet.
2025-04-11 00:01:57 +03:00
Даниїл Григор'єв
412221c4b8
Remove leftover callback check
Was removed completely along with the preloader script.
2025-04-11 00:01:57 +03:00