6220 Commits

Author SHA1 Message Date
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 (#976) 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 (#983) 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 #580 . 2025-02-21 21:41:17 +07:00
Clay Stan
0eed65ae80
Fixed a typo in the rules (#994) 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
Tamás Bálint Misius
c97a43b58f
Fix some tick schedule bugs
Client wouldn't get ticked if the simulation was paused >_> Also fix some old bugs that would allow weird delay values to be derived when tick schedule was given weird target FPS values.
2025-01-25 21:22:19 +01:00
Tamás Bálint Misius
bdcc753dff
Fix misleading message about updates
Specifically, when TPT is actually configured at build time to ignore updates.
2025-01-25 21:18:42 +01:00
Tamás Bálint Misius
53230ee102
Disable fake newer version check for stable builds
It's really annoying when a stable workflow fails because nextVersion didn't get updated, whereas we actively seek out this variable when planning a new version between stables.
2025-01-25 19:38:32 +01:00
jacob1
2b163b4b5d
Version 99.1 (Build 380) v99.1.380 2025-01-25 13:18:58 -05:00
jm211
b5872657c5
Fix ACID sometimes eating one more particle than allowed (#982) 2025-01-25 00:19:45 -05:00
jacob1
04dac4c020
Very safe optimizations 2025-01-24 22:28:50 -05:00
Tamás Bálint Misius
e8921ca6db
Separate emscripten debug info 2025-01-24 11:55:34 +01:00
Tamás Bálint Misius
cb65cf8ffd
Fix crash on startup on emscripten
Parts::data was never initialized, and this mattered on emscripten, even though it didn't matter anywhere else.
2025-01-24 01:19:24 +01:00
Tamás Bálint Misius
ea93bae302
Make emscripten work with draw limits 2025-01-23 23:59:55 +01:00
Tamás Bálint Misius
e87f404d90
Provide a default refresh rate when it cannot be queried 2025-01-23 23:31:38 +01:00
Saveliy Skresanov
79f2bbcae5 Fix LITH breaking temperature limits. 2025-01-23 19:50:46 +07:00
Saveliy Skresanov
3da994c3b8 Prevent heat convection in liquids looking farther than 1px away. 2025-01-23 01:19:07 +07:00
Saveliy Skresanov
2e27cbfddf Fix "far away" air heat and velocity code working correctly only in one direction. 2025-01-23 00:50:02 +07:00
Tamás Bálint Misius
c32166efdc
Make the fps cap a per-view property
And have ui.fpsCap set only GameView's fps cap. This is the closest we'll be getting to the fps cap being true to its name (i.e. actually controlling frames per second, rather than ticks per second) with this iteration of the user interface. Also disable SRT if the sim is paused. Together, these changes fix some old problems such as non-sim user interfaces burning CPU for no reason when the fps cap is removed.
2025-01-22 17:22:10 +01:00