Bithack / principia

Open source physics-based sandbox game.
https://principia-web.se
Other
258 stars 25 forks source link

Remove String/Table/Listen on input toggles #100

Closed griffi-gh closed 1 year ago

griffi-gh commented 1 year ago

principia_cdKFviehZB

There's literally no reason to disable them.
These UI toggles should probably be hidden.
(Maybe their state should only be preserved for compatibility?; Forcing them on should't break any existing levels unless they expect these to be nil for some weird reason)

String/Table toggles

These toggles are only relevant to the initialization time and have a negligible impact, taking less than 0.1ms.

https://github.com/Bithack/principia/blob/c42b202f4ae20b4e2f8adf1391beb9471414768f/src/src/escript.cc#L3940-L3948

Listen on input

I'm not 100% sure about disabling this one. If the on_input function global is not defined, this toggle will be automatically disabled. Therefore, there is no reason to keep it off.

https://github.com/Bithack/principia/blob/c42b202f4ae20b4e2f8adf1391beb9471414768f/src/src/escript.cc#L3950-L3952

Part that disables it:

https://github.com/Bithack/principia/blob/c42b202f4ae20b4e2f8adf1391beb9471414768f/src/src/escript.cc#L4011-L4015

griffi-gh commented 1 year ago

101

This is kind of a brute force naive approach. Another way is to respect these options for current scripts and turn them on automatically when the code is changed.