1
0
mirror of https://github.com/The-Powder-Toy/The-Powder-Toy.git synced 2025-04-21 07:01:54 +02:00

6234 Commits

Author SHA1 Message Date
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
Tamás Bálint Misius
29e4e68041
Make heat display scale variable
No UI for it yet though.
2025-04-16 10:32:51 +02:00
Tamás Bálint Misius
b1290d2803
Unsplit RendererBasic
Some functionality was split into RendererBasic.cpp from Renderer.cpp in f0ffa2eeb1ea, where the FONTEDITOR macro was removed, whose purpose was to exclude all simulation-aware code from the font editor. I'm not entirely sure why this split was necessary; the font editor had been using Graphics and not Renderer even back then. I probably just took the simple route and split everything not under #ifndef FONTEDITOR into its own file. The only thing it relied on in RendererBasic.cpp was Gradient, which this commit splits off.
2025-04-16 08:54:02 +02:00
jacob1
5150811313
Fix infinite loop on some platforms when particle velocity is NaN 2025-03-27 00:32:22 -04:00
Tamás Bálint Misius
49991b5915
Clarify version number meaning in meson.build
Also make it easier to customize it without merge conflicts.
2025-03-20 00:29:58 +01:00
Tamás Bálint Misius
9992a26e7d
Fix elem.loadDefault handling element tools wrong
Firstly, it would not remove custom element tools when appropriate, reproduce with

	elem.allocate("CUSTOM", "FAKE")
	elem.element(elem.CUSTOM_PT_FAKE, elem.element(elem.DEFAULT_PT_SLCN))
	elem.loadDefault()
	elem.allocate("CUSTOM", "FAKE")
	elem.element(elem.CUSTOM_PT_FAKE, elem.element(elem.DEFAULT_PT_SLCN))

There will be two FAKE element tools, one of them in the Tools section, called NULL, and looking very default. Broken since ff4500620e56, where I assumed that builtinElements's size reflected the amount of enabled built-in elements. This has not been the case at all since dd875987b92b, where GetElements was made to return a PT_NUM-sized array instead of a vector with only built-in elements, and so its size increased to PT_NUM, including all possible element numbers. But, strictly speaking, even before that it had not been a correct assumption, because some entries (e.g. 146) of builtinElements could have been disabled, but were possible to allocate from Lua.

Secondly, it would not update built-in element tools when appropriate, reproduce with

	elem.property(elem.DEFAULT_PT_SLCN, "Name", "FAKE")
	elem.loadDefault()

SLCN's tool will still be called FAKE. Also broken since ff4500620e56, where I neglected to deal with element tools whose elements got updated under them. At the time this would have been done by calling AllocElementTool on them again, but today the appropriate way is UpdateElementTool.
2025-03-19 19:58:23 +01:00
Tamás Bálint Misius
91e4b0d173
Unmark some Lua tool callbacks as interface events
A future change will ensure that tools kept active by e.g. holding a mouse button have their appropriate callbacks run exactly once every simulation frame, which will make their "potency" constant from the simulation's point of view in terms of timescale. A past change already allows simulation frames to happen without a corresponding tick event in an interface context, which is when tool callbacks would be run. This necessitates unmarking some tool callbacks as interface events, as they will be called from a simulation context at times. A list of API changes follows.

 name                           | change
--------------------------------|----------------------------------------
 [tool].Drag callback           | unmade an interface event
 [tool].Draw callback           | unmade an interface event
 [tool].DrawFill callback       | unmade an interface event
 [tool].DrawLine callback       | unmade an interface event
 [tool].DrawRect callback       | unmade an interface event
 [tool].Perform callback        | unmade an interface event
2025-03-19 18:28:47 +01:00
Tamás Bálint Misius
d4363b7f0a
Allow common use cases of sim.createParts/Line/Box in simulation contexts 2025-03-16 21:31:02 +01:00
Tamás Bálint Misius
00bfd304ac
Reword workaround_elusive_bzip2 description
According to the wording on the wiki, which I like more.
2025-03-15 12:40:29 +01:00
Tamás Bálint Misius
97d443531e
Move version strings to meson.build
This makes it possible for meson to detect changes to these version numbers, unlike when they were just the default values for options that build sites would retain and fall out of sync.
2025-03-15 12:09:03 +01:00
jm211
56ede6caad
Fog/Rime can absorb gas to become acidic, condense to acid () 2025-03-15 00:12:25 -04:00
jacob1
917b299ecd
Use transfer_part_to_pipe in special sim code that puts energy particles inside PIPE
This fixes heat and deco not being handled in line with recent changes.

PIPE's update loop could also be changed to handle energy particles there. This would be better, and I might do it (compatibility risks are probably low)
2025-03-15 00:03:07 -04:00
jacob1
c64d2ecb8c
Snapshot 386 snapshot-386 2025-03-12 23:39:15 -04:00
jacob1
9931906f8d
Change TPT -> The Powder Toy in credits ui 2025-03-12 23:37:01 -04:00
Tamás Bálint Misius
3e791bb235
Restrict some of the Lua API to interface events
This makes it easier to separate the simulation and related structures from the main thread later. A list of API changes follows.

 name                           | change
--------------------------------|----------------------------------------
 [autorun.lua]                  | made an interface event
 [console input]                | made an interface event
 [sign].displayText             | restricted to interface events
 [sign].height                  | restricted to interface events
 [sign].justification           | restricted to interface events
 [sign].screenX                 | restricted to interface events
 [sign].screenY                 | restricted to interface events
 [sign].text                    | restricted to interface events
 [sign].width                   | restricted to interface events
 [sign].x                       | restricted to interface events
 [sign].y                       | restricted to interface events
 [tool].Click callback          | made an interface event
 [tool].Drag callback           | made an interface event
 [tool].Draw callback           | made an interface event
 [tool].DrawFill callback       | made an interface event
 [tool].DrawLine callback       | made an interface event
 [tool].DrawRect callback       | made an interface event
 [tool].Perform callback        | made an interface event
 [tool].Select callback         | made an interface event
 Button:action callback         | made an interface event
 Button:action                  | restricted to interface events
 Button:enabled                 | restricted to interface events
 Button:position                | restricted to interface events
 Button:size                    | restricted to interface events
 Button:text                    | restricted to interface events
 Button:visible                 | restricted to interface events
 Checkbox:action callback       | made an interface event
 Checkbox:action                | restricted to interface events
 Checkbox:checked               | restricted to interface events
 Checkbox:position              | restricted to interface events
 Checkbox:size                  | restricted to interface events
 Checkbox:text                  | restricted to interface events
 Checkbox:visible               | restricted to interface events
 HTTPRequest:cancel             | restricted to interface events
 HTTPRequest:finish             | restricted to interface events
 HTTPRequest:progress           | restricted to interface events
 HTTPRequest:status             | restricted to interface events
 Label:position                 | restricted to interface events
 Label:size                     | restricted to interface events
 Label:text                     | restricted to interface events
 Label:visible                  | restricted to interface events
 ProgressBar:position           | restricted to interface events
 ProgressBar:progress           | restricted to interface events
 ProgressBar:size               | restricted to interface events
 ProgressBar:status             | restricted to interface events
 ProgressBar:visible            | restricted to interface events
 Slider:onValueChanged callback | made an interface event
 Slider:onValueChanged          | restricted to interface events
 Slider:position                | restricted to interface events
 Slider:size                    | restricted to interface events
 Slider:steps                   | restricted to interface events
 Slider:value                   | restricted to interface events
 Slider:visible                 | restricted to interface events
 TCPSocket:close                | restricted to interface events
 TCPSocket:connect              | restricted to interface events
 TCPSocket:getpeername          | restricted to interface events
 TCPSocket:getsockname          | restricted to interface events
 TCPSocket:lasterror            | restricted to interface events
 TCPSocket:receive              | restricted to interface events
 TCPSocket:send                 | restricted to interface events
 TCPSocket:setoption            | restricted to interface events
 TCPSocket:settimeout           | restricted to interface events
 TCPSocket:shutdown             | restricted to interface events
 TCPSocket:status               | restricted to interface events
 Textbox:onTextChanged callback | made an interface event
 Textbox:onTextChanged          | restricted to interface events
 Textbox:position               | restricted to interface events
 Textbox:readonly               | restricted to interface events
 Textbox:size                   | restricted to interface events
 Textbox:text                   | restricted to interface events
 Textbox:visible                | restricted to interface events
 Window:addComponent            | restricted to interface events
 Window:onBlur callback         | made an interface event
 Window:onBlur                  | restricted to interface events
 Window:onDraw callback         | made an interface event
 Window:onDraw                  | restricted to interface events
 Window:onExit callback         | made an interface event
 Window:onExit                  | restricted to interface events
 Window:onFocus callback        | made an interface event
 Window:onFocus                 | restricted to interface events
 Window:onInitialized callback  | made an interface event
 Window:onInitialized           | restricted to interface events
 Window:onKeyPress callback     | made an interface event
 Window:onKeyPress              | restricted to interface events
 Window:onKeyRelease callback   | made an interface event
 Window:onKeyRelease            | restricted to interface events
 Window:onMouseDown callback    | made an interface event
 Window:onMouseDown             | restricted to interface events
 Window:onMouseMove callback    | made an interface event
 Window:onMouseMove             | restricted to interface events
 Window:onMouseUp callback      | made an interface event
 Window:onMouseUp               | restricted to interface events
 Window:onMouseWheel callback   | made an interface event
 Window:onMouseWheel            | restricted to interface events
 Window:onTick callback         | made an interface event
 Window:onTick                  | restricted to interface events
 Window:onTryExit callback      | made an interface event
 Window:onTryExit               | restricted to interface events
 Window:onTryOkay callback      | made an interface event
 Window:onTryOkay               | restricted to interface events
 Window:position                | restricted to interface events
 Window:removeComponent         | restricted to interface events
 Window:size                    | restricted to interface events
 elem.allocate                  | restricted to interface events
 elem.element                   | setter restricted to interface events
 elem.free                      | restricted to interface events
 elem.loadDefault               | restricted to interface events
 elem.property                  | setter restricted to interface events
 evt.AFTERSIMDRAW callback         | made an interface event
 evt.BEFORESIMDRAW callback         | made an interface event
 evt.BLUR callback              | made an interface event
 evt.CLOSE callback             | made an interface event
 evt.KEYPRESS callback          | made an interface event
 evt.KEYRELEASE callback        | made an interface event
 evt.MOUSEDOWN callback         | made an interface event
 evt.MOUSEMOVE callback         | made an interface event
 evt.MOUSEUP callback           | made an interface event
 evt.MOUSEWHEEL callback        | made an interface event
 evt.TEXTEDITING callback       | made an interface event
 evt.TEXTINPUT callback         | made an interface event
 evt.TICK callback              | made an interface event
 evt.getModifiers               | restricted to interface events
 evt.register                   | restricted to interface events
 evt.unregister                 | restricted to interface events
 fs.copy                        | restricted to interface events
 fs.exists                      | restricted to interface events
 fs.isDirectory                 | restricted to interface events
 fs.isFile                      | restricted to interface events
 fs.isLink                      | restricted to interface events
 fs.list                        | restricted to interface events
 fs.makeDirectory               | restricted to interface events
 fs.move                        | restricted to interface events
 fs.removeDirectory             | restricted to interface events
 fs.removeFile                  | restricted to interface events
 http.getAuthToken              | restricted to interface events
 http.get                       | restricted to interface events
 http.post                      | restricted to interface events
 plat.clipboardCopy             | restricted to interface events
 plat.clipboardPaste            | restricted to interface events
 plat.openLink                  | restricted to interface events
 plat.restart                   | restricted to interface events
 ren.colorMode                  | restricted to interface events
 ren.debugHud                   | restricted to interface events
 ren.decorations                | restricted to interface events
 ren.depth3d                    | restricted to interface events
 ren.displayMode                | restricted to interface events
 ren.fireSize                   | restricted to interface events
 ren.grid                       | restricted to interface events
 ren.hud                        | restricted to interface events
 ren.renderMode                 | restricted to interface events
 ren.separateThread             | restricted to interface events
 ren.showBrush                  | restricted to interface events
 ren.useDisplayPreset           | restricted to interface events
 ren.zoomEnabled                | restricted to interface events
 ren.zoomScope                  | restricted to interface events
 ren.zoomWindow                 | restricted to interface events
 sim.addCustomGol               | restricted to interface events
 sim.adjustCoords               | restricted to interface events
 sim.ambientAirTemp             | setter restricted to interface events
 sim.ambientHeatSim             | setter restricted to interface events
 sim.brush                      | restricted to interface events
 sim.canMove                    | setter restricted to interface events
 sim.clearRect                  | restricted to interface events
 sim.clearSim                   | restricted to interface events
 sim.createBox                  | restricted to interface events
 sim.createLine                 | restricted to interface events
 sim.createParts                | restricted to interface events
 sim.createWallBox              | restricted to interface events
 sim.createWallLine             | restricted to interface events
 sim.createWalls                | restricted to interface events
 sim.customGravity              | setter restricted to interface events
 sim.decoBox                    | restricted to interface events
 sim.decoBrush                  | restricted to interface events
 sim.decoColor                  | restricted to interface events
 sim.decoLine                   | restricted to interface events
 sim.decoSpace                  | restricted to interface events
 sim.deleteStamp                | restricted to interface events
 sim.edgeMode                   | setter restricted to interface events
 sim.ensureDeterminism          | restricted to interface events
 sim.floodDeco                  | restricted to interface events
 sim.floodParts                 | restricted to interface events
 sim.floodWalls                 | restricted to interface events
 sim.frameRender                | restricted to interface events
 sim.getSaveID                  | restricted to interface events
 sim.golSpeedRatio              | restricted to interface events
 sim.gravityGrid                | restricted to interface events
 sim.gravityMode                | setter restricted to interface events
 sim.hash                       | restricted to interface events
 sim.heatSim                    | setter restricted to interface events
 sim.historyForward             | restricted to interface events
 sim.historyRestore             | restricted to interface events
 sim.lastUpdatedID              | restricted to interface events
 sim.listStamps                 | restricted to interface events
 sim.loadSave                   | restricted to interface events
 sim.loadStamp                  | restricted to interface events
 sim.newtonianGravity           | setter restricted to interface events
 sim.paused                     | restricted to interface events
 sim.randomSeed                 | restricted to interface events
 sim.reloadSave                 | restricted to interface events
 sim.removeCustomGol            | restricted to interface events
 sim.replaceModeFlags           | restricted to interface events
 sim.resetPressure              | restricted to interface events
 sim.resetSpark                 | restricted to interface events
 sim.resetTemp                  | restricted to interface events
 sim.resetVelocity              | restricted to interface events
 sim.saveStamp                  | restricted to interface events
 sim.signs.delete               | restricted to interface events
 sim.signs.new                  | restricted to interface events
 sim.takeSnapshot               | restricted to interface events
 sim.temperatureScale           | restricted to interface events
 sim.toolBox                    | restricted to interface events
 sim.toolBrush                  | restricted to interface events
 sim.toolLine                   | restricted to interface events
 sim.updateUpTo                 | restricted to interface events
 sim.waterEqualization          | setter restricted to interface events
 socket.getTime                 | restricted to interface events
 socket.sleep                   | restricted to interface events
 socket.tcp                     | restricted to interface events
 tools.allocate                 | restricted to interface events
 tools.exists                   | restricted to interface events
 tools.free                     | restricted to interface events
 tools.isCustom                 | restricted to interface events
 tools.property                 | restricted to interface events
 tpt.debug                      | restricted to interface events
 tpt.drawCap                    | restricted to interface events
 tpt.fpsCap                     | restricted to interface events
 tpt.getUserName                | restricted to interface events
 tpt.installScriptManager       | restricted to interface events
 tpt.record                     | restricted to interface events
 tpt.screenshot                 | restricted to interface events
 ui.activeMenu                  | restricted to interface events
 ui.activeTool                  | restricted to interface events
 ui.addComponent                | restricted to interface events
 ui.beginConfirm callback       | made an interface event
 ui.beginConfirm                | restricted to interface events
 ui.beginInput callback         | made an interface event
 ui.beginInput                  | restricted to interface events
 ui.beginMessageBox callback    | made an interface event
 ui.beginMessageBox             | restricted to interface events
 ui.beginThrowError callback    | made an interface event
 ui.beginThrowError             | restricted to interface events
 ui.brushID                     | restricted to interface events
 ui.brushRadius                 | restricted to interface events
 ui.button                      | restricted to interface events
 ui.checkbox                    | restricted to interface events
 ui.closeWindow                 | restricted to interface events
 ui.console                     | restricted to interface events
 ui.dropTextInput               | restricted to interface events
 ui.grabTextInput               | restricted to interface events
 ui.label                       | restricted to interface events
 ui.menuEnabled                 | restricted to interface events
 ui.mousePosition               | restricted to interface events
 ui.numMenus                    | restricted to interface events
 ui.perfectCircleBrush          | restricted to interface events
 ui.progressBar                 | restricted to interface events
 ui.removeComponent             | restricted to interface events
 ui.showWindow                  | restricted to interface events
 ui.slider                      | restricted to interface events
 ui.textbox                     | restricted to interface events
 ui.textInputRect               | restricted to interface events
 ui.window                      | restricted to interface events
 ui.windowSize                  | restricted to interface events
2025-03-12 20:42:18 +01:00
jacob1
dd8f7eb9f2
Fix crash when VIBR releases heat during explosion 2025-03-04 10:42:22 -05:00
jacob1
d2f83797b0
Snapshot 385 snapshot-385 2025-03-03 22:28:51 -05:00
jacob1
e2e2568200
Preserve deco in pipe, as long as the pipe wasn't already decorated 2025-02-27 00:37:05 -05:00
jacob1
38b7111821
Allow creating heat pipes by replacing BRCK with HEAC before color generation
Uses same flood-fill function as PPIP. Only runs before pipe is initialized, to prevent breaking older saves that may have HEAC next to pipe.
2025-02-27 00:04:28 -05:00
JasonS05
5ad7f35b02
Add heat conduction to pipes () 2025-02-26 23:02:06 -05:00
Tamás Bálint Misius
3e571db922
Check cell count for being at most 255 when saving
Not important for vanilla but it might surprise modders when their saves get truncated. Better than a static_assert on CELLS because that's further upstream, and mods might like to be able to work even if they can't save.
2025-02-26 09:11:20 +01:00
Rebmiami
794045731a
Update element descriptions () 2025-02-25 23:47:50 -05:00
Tamás Bálint Misius
9991dc5524
Make sure elements include their headers
This helps catch type mismatches.
2025-02-23 20:58:18 +01:00
jacob1
53a1f8d8bc
Version 99.3 (Build 3384) snapshot-384 v99.3.384 2025-02-21 20:53:37 -05:00
Tamás Bálint Misius
3aed58545f
Missing element fix no.823712
Off-by-one in 4c2c95c72bcb. This would cause the most recently added element in any specific version of the game between versions 78.1 and 96.0 to be reported as missing in saves made with that version of the game.
2025-02-21 19:47:03 +01:00
Saveliy Skresanov
3b19f846b9 Fix infinite air in the lower right corner . 2025-02-21 21:41:17 +07:00
Clay Stan
0eed65ae80
Fixed a typo in the rules () 2025-02-20 22:09:13 -05:00
Saveliy Skresanov
f226f18db7 Revert the STKM change since it breaks controllers.
This reverts commit cb7d9ff310938370b071eb9178e1ef07c5d87c1c.
2025-02-20 21:58:41 +07:00
Saveliy Skresanov
cb7d9ff310 Use a more "relaxed" default position for stickmen. 2025-02-20 21:20:34 +07:00
jacob1
4e346cc7d2
Snapshot 383 snapshot-383 2025-02-15 22:36:30 -05:00
Tamás Bálint Misius
f15ecdd09b
Fix prop sampling ignoring temperature scale
So it would always sample in K. For example, sampling something with a temp of 20C would sample the string "295.15" without specifying a scale, which would then translate to 295.15C once OK'd.
2025-02-15 20:44:17 +01:00
jacob1
bca4d66ace
Fix possible game crash when using invalid coordinates in !bubble
Point arguments are supposed to look like "x,y", but if you gave it anything after y, it would crash. The comma split data is stored by reference, but the String it was referencing goes out of scope and is potentially destructed. Fix it by expliticly keeping a String object in scope until we're done.
2025-02-12 23:07:01 -05:00
jacob1
a153b614ea
Fix !set commands defaulting to Kelvin, instead of to current temperature scale
An old hack got deleted that converted values for "temp" to StringType, to force it down the string conversion flow which handles temperature scales. I added that code back.
2025-02-12 23:03:11 -05:00
jacob1
9c45e99c36
fix rx/ry arguments to toolBox 2025-02-08 18:52:59 -05:00
Tamás Bálint Misius
c07ac20d99
Fix compatibility sim.TOOL_* constants 2025-02-08 20:53:36 +01:00
jacob1
8a9713cd83
CAUS.cpp - return 1 when type changes to RFRG
CAUS will convert multiple nearby GAS to RFRG when this reaction triggers. Perhaps it should have been a 1:1 conversion, but it's been like this from the start and nerfing the conversion rate could break reactors that don't input enough CAUS
2025-02-05 23:46:02 -05:00
jacob1
8926e48103
VIBR.cpp: change std::clamp to restrict_flt to handle NaNs 2025-02-04 23:36:34 -05:00
jacob1
03770dff78
cap VIBR .tmp and explosion .temp 2025-02-04 10:11:35 -05:00
Tamás Bálint Misius
51f5259de3
Make gravity mask accessible from Lua 2025-02-04 08:24:02 +01:00
Tamás Bálint Misius
da111d5244
Add gravity mask to snapshots
This fact that this was missing was overlooked in 7e9d9686dda4 because the gravity mask had not been stored in Snapshots even then, ever since edad8f46af6c.
2025-02-04 08:23:58 +01:00
jacob1
1b900031f6
Version 99.2 (Build 382) snapshot-382 v99.2.382 2025-02-01 17:00:17 -05:00
Tamás Bálint Misius
22a68d257f
Fix some jerky animations on emscripten 2025-02-01 19:02:54 +01:00
Tamás Bálint Misius
b131567345
Remove remaining dependence on tick rate
Similar to ce2f36c0a999, except this fixes up all code that assumed that dt was always 1, which is even funnier.
2025-01-31 16:11:39 +01:00
Tamás Bálint Misius
d1c0680a54
Snapshot 381 snapshot-381 2025-01-30 22:56:36 +01:00
Tamás Bálint Misius
ce2f36c0a9
Remove dt 2025-01-30 22:50:03 +01:00
Tamás Bálint Misius
fa4f2ae54f
Do simulation rendering at a lower rate than UI rendering
Specifically, either at the UI rendering rate or the FPS cap, whichever is lower, or simply at the UI rendering rate if there is no FPS cap.

Also, always render the UI at the screen refresh rate; importantly, even when the simulation is unpaused. Unpausing the simulation would lower the UI rendering rate to the FPS cap to prevent rendering from being too out of sync with the simulation, but this is now impossible.

Also stop displaying 0 FPS when the simulation is paused. This now closely matches the way FPS used to be displayed, i.e. display simulation tick rate when the simulation is unpaused, display renderer tick rate when it's paused, and don't display SDL tick rate anywhere.
2025-01-30 22:50:03 +01:00
Tamás Bálint Misius
3d2d8f4936
Prevent our colour codes from making it to stdout 2025-01-26 10:25:32 +01:00
Tamás Bálint Misius
3ee6741fcb
Fix PIPE rendering garbage when carrying PIPE
Broken since 0f1218df0ca3 where I neglected to port a memset over.
2025-01-25 23:59:19 +01:00