Tamás Bálint Misius
0fcad65d6f
Fix crash on exit if any modern particle callback is registered
...
All these smart pointers have to be cleared before the Lua state is closed. Ordinarily, we'd have a smart pointer to the Lua state defined earlier in LSI than these smart pointers, which would take care of destruction in the correct order, but tfw technical debt.
2022-01-28 08:03:14 +01:00
Tamás Bálint Misius
84d6ca6938
Fix -Dhttp=false builds
2021-12-13 15:23:33 +01:00
Tamás Bálint Misius
dbd971fb05
Convert float pavg[2] to int tmp3, tmp4
...
Also add GameSave::PressureInTmp3 to check for elements with pressure memory and fix TUNG not sampling pressure on creation. This does not in itself fix #822 because tmp3 and tmp4 are still saved in 16 bits each, so full ctypes still don't fit in tmp3.
2021-12-09 07:49:31 +01:00
Tamás Bálint Misius
afa9fd3d8f
Remove precompiled headers, fix a few problems they masked
2021-10-15 17:04:04 +02:00
jacob1
44590d82e9
Add a few more Lua functions
...
sim.replaceModeFlags
sim.listCustomGol
sim.addCustomGol
sim.removeCustomGol
tpt.perfectCircleBrush
sim.floodDeco
2021-08-27 23:57:55 -04:00
Tamás Bálint Misius
c0e065cc76
Fix certain Lua APIs mangling integers
...
Also fix a few warnings.
2021-07-18 20:33:50 +02:00
Tamás Bálint Misius
11188c85c3
Fix element identifiers not being accepted by tpt __newindex
...
Becuase *of course* whether it succeds or not depends on whether you've rebuilt menus.
With all seriousness, the real culprit here is GameModel::GetToolFromIdentifier, which looks for tools in the menu section tool lists, plus another list with tools that aren't in any menu section. This is absolutely blaphemous, but I don't feel like refactoring this right now. It also wouldn't be a problem in itself, but allocating an element also doesn't rebuild these lists, only changing the MenuSection property and a few other obscure operations do. This makes allocating elements also rebuild these lists.
2021-07-14 08:48:42 +02:00
Tamás Bálint Misius
a463180e2a
Fix elem.allocate corrupting LSI when running out of IDs
...
The can_move bits weren't guarded by newID != -1.
2021-07-14 07:29:50 +02:00
jacob1
6dd7d9bd46
Add bounds checking to sim. tool APIs (crash fix)
2021-06-27 21:43:14 -04:00
jacob1
d1016cf58d
move Platform.cpp to common/, seems to fit in a little better there
2021-06-26 00:58:37 -04:00
jacob1
6e0ace2e4d
Add / move some filesystem methods to Platform.cpp
2021-06-26 00:58:37 -04:00
Tamás Bálint Misius
dcf0764fd8
Return a reason for failure from sim.loadStamp
2021-06-21 08:04:32 +02:00
Tamás Bálint Misius
cb52495472
Use GameController::ClearSim in sim.clearSim
...
Unlike Simulation::clear_sim, this also resets the save info in GameModel, i.e. is equivalent to pressing the 'Erase everything' button.
2021-06-19 21:55:08 +02:00
jacob1
6bd1289bdd
restrict ambientAirTemp to valid limits when set from Lua
2021-06-18 23:37:04 -04:00
Tamás Bálint Misius
1851677dbe
Return version (aka history index) from sim.getSaveID
...
Makes sense because sim.loadSave has a history argument.
2021-06-05 08:26:43 +02:00
Tamás Bálint Misius
ffe730c615
Save ambient heat temperature and add it to options
2021-06-04 22:39:07 +02:00
Tamás Bálint Misius
ed29794fb8
Remove LuaSocket, add new socket API backed by libcurl
2021-05-27 15:13:43 +02:00
Tamás Bálint Misius
bcbcdbe06b
Make custom can_move settings persistent ( fixes #764 )
2021-04-17 21:23:39 +02:00
Tamás Bálint Misius
6a6b14f871
Redo and add type parameter to sim.neighbours
2021-04-17 10:40:10 +02:00
jacob1
ffb88259d6
Split Simulation::IsValidElement into IsElement and IsElementOrNone
...
Allows finer control over whether you want none included or not.
Fixes some invalid things being allowed for element 0 in legacy lua api
Fixes {ctype} signs showing 0 instead of NONE
2021-04-11 23:20:33 -04:00
Tamás Bálint Misius
1681ca77d8
Add Lua support for composition
2021-04-02 10:21:54 +02:00
Doxin
cc2022504a
Add ren.showBrush to the LUA api to allow hiding the brush
2021-03-18 16:13:15 -04:00
Tamás Bálint Misius
4b7e85c2fb
Fix a metric ton of MSVC warnings
2021-02-15 21:24:44 +01:00
Tamás Bálint Misius
92ccb12d70
Update luasocket, embed eventcompat.lua differently
2021-01-04 16:43:31 +01:00
Tamás Bálint Misius
360297c338
Mesonification
2020-12-14 20:16:52 +01:00
Vladimir
f137bad7f8
Limit redrawing frequency ( #693 )
...
Co-authored-by: Tamás Bálint Misius <lbphacker@gmail.com>
2020-10-11 11:58:52 +02:00
Tamás Bálint Misius
fd032eff36
Fix LuaSmartRefs acting on dead Lua states
...
This fixes problems with degenerate cases such as:
local button
assert(coroutine.resume(coroutine.create(function()
button = Button(10, 10, 20, 20)
end)))
button:action(function()
print("hi")
end)
2020-08-21 11:16:11 +02:00
QuanTech0
dda7747688
safeguard FloodParts and kill_part ( #717 )
2020-05-11 10:20:01 -04:00
QuanTech0
49963980e6
Constrain brushx and brushy values ( #716 )
2020-05-09 13:54:12 -04:00
Tamás Bálint Misius
a2a8c876b3
Finalize latin-1 supplement changes
...
Swap both versions of O with acute and grave accents
Fix a few ASCII-isms
Fix intro text; the latin-1 changes broke the line under The Powder Toy
2020-03-09 23:44:18 +03:00
jacob1
0c588c48fe
allow making POST requests with empty body
2020-01-20 11:11:56 -05:00
jacob1
afefd045c8
split http.request into http.get and http.post (for api reasons)
...
It's cleaner together, but it's not a good api.
2020-01-20 00:30:30 -05:00
Tamás Bálint Misius
89282806e6
Make NOHTTP transparent to the Lua API
...
Also, HTTPRequest:status would never have returned queued since
the request is started immediately on creation.
2020-01-18 01:33:40 +01:00
Tamás Bálint Misius
fe87203eb4
Add HTTP API for Lua
...
Also fix a bug with Requests where any connection that took
longer to finish than 15 seconds would be killed. Should have
used CURLOPT_CONNECTTIMEOUT instead of CURLOPT_TIMEOUT when
specifying the timeout, oops.
2020-01-16 20:05:31 +01:00
Tamás Bálint Misius
4d52531889
Ditch element and tool classes
2020-01-09 19:22:11 +01:00
jacob1
131b965af2
Add Lua apis to interact with DefaultProperties, Create, CreateAllowed, and ChangeType
2019-12-09 22:32:30 -05:00
jacob1
0078fb4c6f
Add DefaultProperties, replaces some of the case statements in create_part
...
The rest will will in a commit soon that adds the Create event and some other stuff
Lua events will come after that
PLSM default temp lowered to MAX_TEMP
2019-11-25 22:08:18 -05:00
jacob1
876a9b3096
Fix crashes if returning invalid arguments from graphics or ctypeDraw lua functions
2019-11-24 23:12:22 -05:00
jacob1
b09158220f
Fix crash if error happens in ctypeDraw lua function
2019-11-22 23:37:17 -05:00
Tamás Bálint Misius
d17c67b3a4
Fix unsigned integer properties being returned as signed integers from Lua functions
2019-11-14 00:28:27 +01:00
jacob1
9ed7f1e85a
Fix crash if any built-in scripts try to use the interface api
...
We don't have any scripts like this and never will. But if we did, this would fix the crash.
2019-10-17 23:56:40 -04:00
Tamás Bálint Misius
a6127bc1fb
Add Lua API for deco tool colour space, see 51e5f2b
2019-09-21 21:58:50 +02:00
Tamás Bálint Misius
51b78be139
Nicer implementation of sim.parts
2019-09-15 22:14:46 +02:00
jacob1
28d5345bf9
Fix off-by-one issue in sim.parts, fixes #678
2019-09-15 15:37:54 -04:00
Tamás Bálint Misius
de1fc0f906
Revise ctype-drawing ( fixes #657 )
2019-07-27 19:12:05 +02:00
jacob1
9faf95a858
misc whitespace changes
2019-07-23 00:11:48 -04:00
Tamás Bálint Misius
dbd5999d1c
Reinstate inversion of inclusion of pressure when shift is held
...
This feature was removed temporarily in a407aba
.
Whether pressure is included when saving or loading is
determined as follows:
* load-like operations (which invoke Simulation::Load) always
include pressure;
* save-like operations (which invoke Simulation::Save) include
pressure if the Simulation.IncludePressure preference node
is true;
* finally the state of the shift key inverts the decision.
2019-07-16 19:43:52 +02:00
Tamás Bálint Misius
a407aba087
Make Simulation.IncludePressure pref node accessible from OptionsView
...
Also remove ugly and messy behaviour depending on whether
shift is being held while copying or stamping.
2019-07-10 00:35:49 +02:00
Tamás Bálint Misius
8897c6daea
Make elem.free rebuild menus ( fixes #649 )
...
Also make sure removed elements don't stay selected.
2019-06-11 21:12:22 +02:00
Tamás Bálint Misius
75e6ece184
Expose transition constants to Lua ( fixes #654 )
2019-06-11 20:43:34 +02:00