6281 Commits

Author SHA1 Message Date
Tamás Bálint Misius
db0e56fc6e Fix a few warnings 2025-08-26 17:23:50 +02:00
Tamás Bálint Misius
ea160ff701 Unhardcode APPVENDOR here and there
This should have been done in a674498a96.
2025-08-19 17:55:17 +02:00
Tamás Bálint Misius
21b533ae47 Fix opening URIs hanging the game on freedesktop systems
Apparently xdg-open was meant to hang all this time and we're supposed to not wait for it, ok then: 5f7169ec0f/scripts/desc/xdg-open.xml (L148)

Also stop using system(3).
2025-08-16 14:34:23 +02:00
Tamás Bálint Misius
8cbb17471f Snapshot 389 snapshot-389 2025-08-16 09:39:32 +02:00
Tamás Bálint Misius
ac0e075eef Move "FP included" logic to SearchSavesRequest 2025-08-14 23:19:18 +02:00
Saveliy Skresanov
66b40b6442 Add a BASE + CAUS = SLTW reaction. 2025-08-05 22:05:46 +07:00
Saveliy Skresanov
b8da68da1c Merge branch 'master' of github.com:The-Powder-Toy/The-Powder-Toy 2025-08-01 13:47:18 +07:00
Saveliy Skresanov
6a15d83362 Added BASE. Tweaked element dissolve rates. 2025-08-01 13:43:31 +07:00
Tamás Bálint Misius
968b9e1d11 Add serve-wasm.py to the emscripten bundle 2025-07-26 21:57:21 +02:00
Tamás Bálint Misius
e2b1d99572 Remove the last few references to zlib
These were meant to go in 6e54da7a17, oops.
2025-07-07 09:02:40 +02:00
Tamás Bálint Misius
154e9e8565 Remove favourite status as a sorting criterion in element searches
It was added as one in c73dfe8ca0, as the highest priority criterion too. Nobody remembers why and it doesn't make much sense, so out it goes.
2025-07-06 20:59:37 +02:00
Tamás Bálint Misius
2babec6d2b Make some free-floating arrays sim data 2025-07-06 20:16:48 +02:00
Tamás Bálint Misius
5e0fc38b8f Fix simulation-only screenshots being WINDOWW pixels wide
That is, rather than XRES pixels wide. Broken since f52e047037, where RendererFrame started being dumped directly rather than via Renderer::DumpFrame, which took care of the required cropping.
2025-06-30 21:05:55 +02:00
Tamás Bálint Misius
1f04a7dfb7 Fix the "fullscreen" parameter of tpt.screenshot being inverted
Broken since c8c0f90871, where this got accidentally inverted.
2025-06-30 21:05:43 +02:00
Tamás Bálint Misius
18e3784ab7 Move IsHeatInsulator where it belongs 2025-06-27 20:50:34 +02:00
Tamás Bálint Misius
365162e131 Snapshot 388 snapshot-388 2025-06-25 12:25:00 +02:00
Saveliy Skresanov
d30aa74ac6 Fix infinite air heat near the boundary 2025-06-25 11:57:32 +02:00
Saveliy Skresanov
b77a1cba2c Add vorticity confinement
This also adds a vorticity view and appropriate Lua bindings.
2025-06-25 11:56:59 +02:00
Tamás Bálint Misius
8f7bf47d78 Clean up RequestManager configuration code slightly 2025-06-25 11:33:52 +02:00
Tamás Bálint Misius
61dfba1e80 Apply proxy settings to Lua API sockets 2025-06-25 10:28:59 +02:00
Tamás Bálint Misius
6e54da7a17 Update tpt-libs 2025-06-22 20:35:52 +02:00
Tamás Bálint Misius
7c3f922406 Disable pretty powders while loading saves
This should and indeed mostly does not have any observable effect because any particle created with create_part for being loaded from a save is overwritten with data from the save anyway. However, if pretty powders is on, create_part uses Simulation::rng to make powders pretty, and that just gets in the way of debugging when relying on determinism.
2025-06-12 19:15:14 +02:00
Tamás Bálint Misius
8c321a03bb Fix returning true from event handlers not doing anything
Returning true is meant to consume the event, thereby preventing remaining event handlers and the rest of the game from handling it, but the check that implements this was accidentally removed in 87b81ceb45, oops.
2025-06-08 18:41:40 +02:00
Sergei Trofimovich
2df4e31e5f src/lua/LuaSocketDefault.cpp: add missing <climits> include (#1007)
Without the change the build fails on upcoming `gcc-16` as:

    ../src/lua/LuaSocketDefault.cpp: In function 'void LuaSocket::Timeout(double)':
    ../src/lua/LuaSocketDefault.cpp:21:31: error: 'INT_MAX' was not declared in this scope
       21 |                 if (timeout > INT_MAX) timeout = INT_MAX;
          |                               ^~~~~~~
    ../src/lua/LuaSocketDefault.cpp:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
        5 | #include <sys/time.h>
      +++ |+#include <climits>
        6 | #include <time.h>
2025-06-07 20:28:19 +00:00
Tamás Bálint Misius
611be5b94e Add TempScale enum 2025-06-07 20:36:49 +02:00
Tamás Bálint Misius
e7cc43e689 Use X macros here and there
Specifically for lists of element and tool numbers, and clipboard implementations. These higher-level macros allow lower-level macros meant to be applied to each item in a list to be defined at the application site of the higher-level macro, slightly increasing readability. See https://en.wikipedia.org/wiki/X_macro
2025-06-05 00:16:18 +02:00
Tamás Bálint Misius
ebb3638413 Fix various warnings that had piled up 2025-06-04 21:31:39 +02:00
Tamás Bálint Misius
bb4251adef Bump some ghactions jobs to windows-2022 2025-06-04 15:53:23 +02:00
Tamás Bálint Misius
d14d35982a Fix parsing HTTP headers after redirects 2025-06-04 14:39:16 +02:00
Tamás Bálint Misius
9c35c537e5 Cache running status of Lua HTTP requests
This ensures that the API is used correctly (i.e. without relying on blocking loops) by guaranteeing that blocking behaviour freezes the game.

Blocking until requests finish has always been bad practice and could/would freeze the game until the request manager finished handling the request, which could take as much as 30 seconds in some cases, or however much of your time the network felt like wasting, or it could even be guaranteed to permanently freeze the game on e.g. emscripten, where the request manager runs on the same thread as the rest of the game. It's just "luck" that in the vast majority of cases this was imperceptible because of good connectivity and because nobody uses the emscripten port.
2025-06-04 14:34:52 +02:00
Tamás Bálint Misius
bf7f40108e Specify working directory for the serve-locally target
Meson doc says that run_targets are run in an unspecified directory.
2025-05-12 19:49:14 +02:00
Tamás Bálint Misius
0096d27d25 Add run-target serve-locally to emscripten builds
Invoke with:

	ninja serve-locally

Also fix emscripten builds on some systems where emscripten suddenly needs USE_PTHREADS (?????). Also fix JS-unsafe app_exe values breaking builds.
2025-05-10 16:15:17 +02:00
jacob1
ad9a63128b Fix STKM never darkening in FIND mode ... unless you were trying to find it
(broken since ef04068a85)
2025-05-07 23:53:03 -04:00
Tamás Bálint Misius
6784d8a10f Share object files between powder/render/font
I'm not sure why we weren't using static_libraries to begin with; most likely because the object files (as opposed to the sources) were not possible to share due to different sets of macros being defined in cpp_args, see 3a591b8539 to 4f0c365e05.
2025-05-07 19:23:17 +02:00
Tamás Bálint Misius
3511d047ac Fix CI
I forgot to adjust the pattern build.sh looked for in 49991b5915 so this commit started out as a simple fix that did that, but then I realized that the project call in meson.build had grown too complicated to be tractable with grep so I moved version number enforcement to prepare.py.
snapshot-387
2025-05-07 12:48:22 +02:00
Tamás Bálint Misius
4ffa7f0ce8 Snapshot 387 2025-05-07 11:50:35 +02:00
Tamás Bálint Misius
940c9eb209 Move some Lua context asserts to LSI's header 2025-05-06 21:38:47 +02:00
Tamás Bálint Misius
3adf6ef91c Disallow particle lifetime management in some contexts
Namely, in Create and ChangeType callbacks, which are themselves called by such lifetime management functions. Lifetime management includes explicit actions via partCreate and partKill, but also implicit ones such as changing the type property or changing x or y properties to values that move the particle beyond the edges and causes it to be killed.
2025-05-06 21:36:07 +02:00
Tamás Bálint Misius
f65c4ee4e1 Make tools (and thus elements) read-only in some contexts
Namely, in Select and Click tool callbacks, which are otherwise interface contexts and allow changing tools. This may cause use-after-free but it's much more likely to cause stack overflows. Importantly, the setter usage of ui.activeTool is considered to change tool state because it invokes Select callbacks.
2025-05-06 21:32:41 +02:00
Tamás Bálint Misius
b464c3aa3f Make the simulation read-only in some contexts
Namely, BEFORESIMDRAW/AFTERSIMDRAW event handlers, and CreateAllowed and Graphics functions.
2025-05-06 21:32:39 +02:00
Tamás Bálint Misius
6d720bc79c Restrict graphics functions to graphics contexts
gfx.textSize/getColors/getHexColor are exempt because they don't change any state that we care about and seem easy to deal with in general.
2025-05-06 17:57:01 +02:00
Tamás Bálint Misius
e44e77f6d6 Prevent CtypeDraw from being called in simulation contexts
CtypeDraw is already not an interface event, so to prevent parts of the call stack from being upgraded back to interface event status is not why this change is necessary. Rather, it is necessary because some Lua functions that are allowed to be called from non-interface events may indirectly invoke CtypeDraw, which is most likely unintended. Ctype-drawing is intended to be an interface feature, not something that e.g. an Update function creating a circle of particles should invoke.

Also make the flags parameter mandatory across all relevant functions because it's too easy to add a millionth int parameter and forget to update all call sites.
2025-05-06 15:57:42 +02:00
Tamás Bálint Misius
e6f297680b Formalize event handlers as stackable
It seems event handlers may be invoked from event handlers, which 87b81ceb45 did not anticipate, oops.
2025-05-05 10:32:59 +02:00
Tamás Bálint Misius
96cd4b6996 Fix intermittent failure to call event handlers
The wrong value got duplicated in 87b81ceb45, oops. Makes you wonder how the script in the commit message worked at all.
2025-05-05 10:32:32 +02:00
Tamás Bálint Misius
87b81ceb45 Simplify event handler management
Semantics are mostly the same:

 - event.register pushes a handler at the end of the handler chain, such that it has the lowest priority
 - event.unregister removes at most one handler, which is the first one that matches
 - a handler failing causes it to be removed from the chain

But removing handlers from the chain doesn't mess up handler order for the frame anymore: until this commit, removing a handler from the chain would shift all handlers in the chain while it was being traversed, which meant that some handlers were always skipped whenever any were removed.

Validate this with the following script:

	local t = {}
	for i = 1, 10 do
		table.insert(t, i)
	end
	for i = #t - 1, 1, -1 do
		local j = math.random(1, i)
		t[i], t[j] = t[j], t[i]
	end
	print(table.concat(t, " "))
	event.register(event.MOUSEDOWN, function()
		print("=====")
	end)
	for i = 1, #t do
		local c = t[i]
		local function f()
			print(i)
			c = c - 1
			if c == 0 then
				event.unregister(event.MOUSEDOWN, f)
			end
		end
		event.register(event.MOUSEDOWN, f)
	end

The expected behaviour is that numbered event handlers are removed once they've been run as many times as the correspondingly numbered entry in t dictates. This, among other things, means that exactly one event handler is removed every MOUSEDOWN. This was absolutely not the case until now; removals were all over the place.
2025-05-03 16:56:27 +02:00
Tamás Bálint Misius
70298b63d0 Print messages to stdout even if the console is open
The idea behind not calling GameModel::Log in tpt.log is that that would not only print the message to stdout but also add it to GameView's list of log entries, which the console doesn't want. Sadly, this meant that messages also didn't make it to stdout when the console was open.
2025-05-03 12:13:17 +02:00
Tamás Bálint Misius
e301c7fe01 Add 'console' command line argument
This opens a console window on Windows but does nothing anywhere else. Overrides 'redirect'.

Useful on Windows because the only way to access standard streams there is by tail -f'ing stdout/err.txt.
2025-05-03 12:13:17 +02:00
Saveliy Skresanov
afe35312e1 Reduce gravity effects on ambient heat. 2025-04-19 11:13:44 +07:00
Tamás Bálint Misius
f2cd4dd15c Enable dynamic heat display with Shift+6 2025-04-16 18:59:14 +02:00
Tamás Bálint Misius
0bf4bf41f8 Take COLOUR_HEAT into account in heat display limit calculation 2025-04-16 18:29:55 +02:00