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

2523 Commits

Author SHA1 Message Date
Даниїл Григор'єв
2e15a2f6d2
Always detach HUDSettingsMenu input receiver
Add a cleanup override for HUDSettingsMenu that detaches its input
receiver in case it is attached (i.e. when using the menu buttons to
open settings or return to main menu).
2025-07-21 17:25:40 +03:00
Даниїл Григор'єв
6366aa61dd
Split KEYCODES from KeyActionMapper
Move KEYCODES and related functions to a separate file. No further
refactoring is done yet.
2025-07-21 16:55:28 +03:00
Даниїл Григор'єв
bcda036c73
Minor CSS changes
Remove PostCSS plugins that are no longer needed, fix some styles and
partially remove the need to use a .keybinding class on kbd elements.
2025-07-20 18:13:07 +03:00
Даниїл Григор'єв
2240c00090
Introduce new Logger implementation
Remove old Logger class and replace it with a new implementation that
keeps the location of the log calls (for display in devtools). Remove
internals of the old implementation and their one external usage.
2025-07-18 14:37:30 +03:00
Даниїл Григор'єв
ce1cab3065
Remove unused logging code
Remove functions in logging.js that are no longer used. As this action
makes the circular-json npm package unused, drop it as well.
2025-07-18 07:14:33 +03:00
Даниїл Григор'єв
114a1f9d74
Update Electron to 37.x
Update electron package from 31.3.0 to 37.2.3, with Chromium 138 and
Node.js 22.17. Also follow the electron-packager -> @electron/packager
rename and upgrade the package.
2025-07-18 06:45:04 +03:00
EmeraldBlock
53df56f492 fix incorrect sprite size and position when using pixelAligned 2025-07-14 04:43:30 -04:00
cody-ferguson
0167b9d6a0
Handle directories in mod protocol handler (#87)
* Handle directories in mod protocol handler
Previously we would return an error about a file not existing, which kinda makes sense, considering a directory isn't a file.
Now with this commit, if the url resolve to a directory, it will return a json array with the relative paths of the file in that directory.

* Make directory index work with ASAR archives

Also fix directory index having higher priority than normal requests and
simplify URL handling.

---------

Co-authored-by: Даниїл Григор'єв <dengr1065@gmail.com>
2025-07-01 20:30:55 +03:00
Даниїл Григор'єв
ba2e74b993
Update webpack and simplify config
Update some webpack dependencies and remove unused ones. Replace
worker-loader with built-in worker loading functionality and remove
default/implied options from the webpack configuration files.
2025-07-01 18:04:38 +03:00
Даниїл Григор'єв
ca5dd9b3e5
Simplify pointless try/catch wrappers
Remove try/catch wrappers that just log and/or rethrow the error, use
the cause chain for rethrows with descriptions. Remove inner try/catch
for mod loading to make errors more obvious.
2025-07-01 05:03:34 +03:00
Даниїл Григор'єв
515c07c067
Re-implement error handler
shapez used to have a nice error handler, but later it was removed. To
help debug game in both development and release cases, add a simple
error handler/screen that displays the error stack trace, lists the
installed mods and shows some build information. It also allows copying
this information to the system clipboard.

Having such an error screen should make mod development easier once the
local mod error handling is removed.
2025-07-01 03:54:38 +03:00
Даниїл Григор'єв
c184d08ece
Replace usages of D() and S() SCSS mixins
Replace all instances of D() and S() mixins with rem units. Also,
replace deprecated slash division with math.div as suggested by
dart-sass. Finally, remove the mixins as they are no longer used.
2025-06-20 09:16:53 +03:00
Даниїл Григор'єв
06154b408e
Replace --ui-scale variable with rem unit
Replace --ui-scale inline style on the <html> element with font-size set
to UI scale * 10px and modify SCSS D(...) mixin to use the rem unit
instead of multiplying by var(--ui-scale). This makes it possible to get
rid of mixin hell and makes following UI scale in external stylesheets
(mods) much easier.
2025-06-20 07:01:58 +03:00
Даниїл Григор'єв
d845cb33a5
Remove and simplify SCSS styles
Remove some unused classes, mixins and variables, then inline ones that
have just a few usages. Also remove a few redundant properties and
replace align-items: center + justify-items: center with place-items:
center.
2025-06-20 06:42:20 +03:00
Даниїл Григор'єв
7c8e11573b
Do not reuse canvas between savegame loads
Remove lastCanvas/lastContext cache for reusing canvas as creating a new
canvas does not cause performance issue. Additionaly, remove smoothing
classes and buffer registration as they are not used anywhere. Finally,
remove redundant stageDestroyed calls in the InGameState.
2025-06-19 23:11:30 +03:00
Даниїл Григор'єв
449ff3cbda
Remove code related to trailer recording
Unlikely to be used and can be replicated with mods in a much better
way.
2025-06-19 20:45:09 +03:00
Даниїл Григор'єв
51c0352079
Remove unused config properties
Remove globalConfig properties that are not used anywhere, simplify
mobile device detection (mostly unused for normal builds) and merge or
inline config constants where it makes sense.
2025-06-19 20:21:06 +03:00
Даниїл Григор'єв
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