Compare commits

...

208 Commits

Author SHA1 Message Date
3d15c1e3fd
Merge branch 'main' of https://github.com/OpenStarbound/OpenStarbound 2025-01-19 13:11:40 +02:00
Kae
449d05d195
Merge pull request #165 from OpenStarbound/pat-dungeonlogging
dungeon generation log messages include dungeon name
2025-01-17 17:10:21 +11:00
patman
1b3d1d5149 wait i forgot to commit this lol 2025-01-16 23:11:38 -06:00
patman
ccfe2a2cae dungeon generation log messages include dungeon name 2025-01-16 23:01:40 -06:00
Kae
8472b73cef ensure Linux build includes deb info after switch to Clang 2025-01-12 17:16:22 +11:00
Kae
6290a813d6 okay. nevermind! 2025-01-07 20:49:34 +11:00
Kae
4db9712c4c Update x64-linux-mixed.cmake 2025-01-07 20:32:02 +11:00
Kae
93bb981756 Update x64-linux-mixed.cmake 2025-01-07 20:26:05 +11:00
Kae
09c44f53bf Update linux-clang.cmake
[skip ci]
2025-01-07 20:18:44 +11:00
Kae
289e367e28 include base linux toolchain 2025-01-07 20:10:51 +11:00
Kae
d232fb77eb attempt to fix systemd clang comp 2025-01-07 19:53:04 +11:00
Kae
64df890864 update unifont
also added font sources
2025-01-07 19:52:29 +11:00
Kae
06ce4f042d add version logging for named asset sources 2025-01-05 15:22:20 +11:00
Kae
57a5afa13a fix net compat rules not being considered in client netLoad 2025-01-05 15:21:59 +11:00
Kae
c47bceb3f3 add time played support to server query results 2025-01-05 15:21:27 +11:00
Kae
9bc12f5f97 Lua 5.3.6 2025-01-05 15:16:15 +11:00
Kae
41f0b9001f
Update build.yml 2025-01-02 21:05:05 +11:00
Kae
bbc167de0f fix ArmorWearer sync flag not being set for two slots
no idea how I missed that
[skip ci]
2025-01-02 16:07:34 +11:00
Kae
aaa1587f0c Update StarPlayer.cpp
[skip ci]
2025-01-01 22:46:37 +11:00
Kae
2ccc2ac487 Update StarClientCommandProcessor.cpp
[skip ci]
2025-01-01 19:43:56 +11:00
Kae
5159b073bd /render: support for rendering out character and clothing sheets 2025-01-01 19:41:42 +11:00
Kae
a589a41fb4 Update vcpkg.json
[skip ci]
2024-12-31 20:40:42 +11:00
Kae
ad1c25a502 Update vcpkg.json
[skip ci]
2024-12-31 20:31:15 +11:00
Kae
c37265623d oops
[skip ci]
2024-12-31 20:13:23 +11:00
Kae
5247c48551 actually silence Clang unused warns
[skip ci]
2024-12-31 19:41:40 +11:00
Kae
cb893f0f52 disable jemalloc on Linux for Clang 2024-12-31 19:20:40 +11:00
Kae
d922be6612 decouple raw artifacts from assemble script 2024-12-31 19:11:20 +11:00
Kae
da76c1d95d defer test to after upload so I can debug locally 2024-12-31 19:06:37 +11:00
Kae
c14a99a7c3 guess I can't have atomic for an array in Clang. ok
also the indenting was mixed so I had to fix it which is why the diff here is so wacky
2024-12-31 18:55:37 +11:00
Kae
c0fd5c0a60 Update vcpkg.json 2024-12-31 18:34:28 +11:00
Kae
4f37d900c4 get rid of SDL2's dbus dependency 2024-12-31 18:21:12 +11:00
Kae
95b8727d0c Update build.yml 2024-12-31 18:11:52 +11:00
Kae
32f6d28d05 trying again 2024-12-31 17:59:05 +11:00
Kae
aa1d559854 okay libsystemd doesn't compile on clang right now :( 2024-12-31 16:06:10 +11:00
Kae
6076746ff3 Update build.yml 2024-12-31 15:51:26 +11:00
Kae
3a077eabeb make sure vcpkg is using clang 2024-12-31 15:36:10 +11:00
Kae
7b2ce5155a fix Clang warnings
those two tryLexicalCasts were literally just broken
2024-12-31 15:27:32 +11:00
Kae
4903d39eed clang hates that I guess 2024-12-31 15:26:01 +11:00
Kae
9e3341f2f2 Update StarMemory.cpp 2024-12-31 14:59:15 +11:00
Kae
5b520556cf switch Linux builds to Clang (this will surely end well!) 2024-12-31 14:50:10 +11:00
Kae
874ab3dd48 ?saturation discrepancies: fixed mostly on GCC, 100% (seemingly?) on Clang 2024-12-31 14:49:51 +11:00
Bottinator22
9beadf3e2c
oops
since my hhcolour shader (which doesn't have any parameters) was the first one in the list, it didn't need to load any parameters, which hid a bug that caused errors if the first shader in the menu had parameters
2024-12-29 12:23:26 -08:00
Bottinator22
fbae5b2223
Merge pull request #159 from Bottinator22/main
Documentation for renderer
2024-12-28 21:24:14 -08:00
Bottinator22
54b8f83b85
Documentation for renderer 2024-12-28 21:23:16 -08:00
Kae
b953042e56
Merge pull request #158 from Bottinator22/main
Scriptable shader uniforms
2024-12-29 15:29:20 +11:00
Bottinator22
ec6c8f0c3c
Update StarLuaConverters.hpp 2024-12-28 20:09:29 -08:00
Bottinator22
922427e25f
Update StarScrollArea.cpp 2024-12-28 20:08:17 -08:00
Bottinator22
f7dc97965d
Update StarRenderingLuaBindings.cpp 2024-12-28 20:07:34 -08:00
Bottinator22
1a0bf768f0
Update StarRenderer_opengl.cpp 2024-12-28 20:07:04 -08:00
Bottinator22
5e07241741
Update StarRenderer.hpp 2024-12-28 20:04:59 -08:00
Bottinator22
740cf89122
Update StarRenderer_opengl.hpp 2024-12-28 20:04:19 -08:00
Bottinator22
ebabc7bf8e
Update shaders.lua 2024-12-28 20:02:52 -08:00
Bottinator22
6b85d7094a
Update shaders.config 2024-12-28 20:02:37 -08:00
Bottinator22
e33d260e6d
Add files via upload 2024-12-28 20:02:00 -08:00
Bottinator22
d63501aa07
Add files via upload 2024-12-28 19:58:18 -08:00
Bottinator22
d2e1826865
Update universeclient.lua 2024-12-28 19:58:06 -08:00
Kae
75ff3cbba9 Update CMakeLists.txt 2024-12-28 13:42:00 +11:00
Kae
6b49f382e3 move image scaling functions to their own unit, as -O2 2024-12-28 13:07:51 +11:00
Kae
9da08e898d Update StarImageProcessing.cpp 2024-12-28 10:58:44 +11:00
Kae
81dfda9ea0 Update StarImageProcessing.cpp 2024-12-28 10:46:37 +11:00
Kae
10edbdc399 disable GCC unmath optimization in non-nearest scaling funcs 2024-12-28 10:29:47 +11:00
Kae
aba77ed2b4 Update StarImageProcessing.cpp
[skip ci]
2024-12-27 22:06:33 +11:00
Kae
45c89cefb6 Update StarImageProcessing.cpp 2024-12-27 21:54:59 +11:00
Kae
8f1cadbbf2 enable hardened runtime on macOS builds 2024-12-27 21:08:41 +11:00
Kae
5cf11ead98 temporary /render cmd for debugging 2024-12-27 20:14:36 +11:00
Kae
3205f3b283 fix item inventoryFilters handling 2024-12-27 08:47:40 +11:00
Kae
1210a75fb7 ! Fix head rotation not showing on other players 2024-12-26 22:12:44 +11:00
Kae
e092de711e fix compile error 2024-12-26 21:00:29 +11:00
Kae
0a1a82b18b Head Rotation
(way too hardcoded, not ideal but it will do in the meantime as many have been asking for it)
2024-12-26 20:53:06 +11:00
Kae
3df5cb78da oxipng pass
pointless but i like the smaller number yayyyy
2024-12-26 20:51:02 +11:00
Kae
5de1e6cbc9 items can now override inventory filters 2024-12-26 20:12:15 +11:00
Kae
6a1ea4aa30 change math constants to constexpr 2024-12-26 20:11:45 +11:00
Kae
0a506401aa Update StarUniverseClient.cpp 2024-12-19 20:03:51 +11:00
Kae
63903276e5
Merge pull request #157 from Bottinator22/main
Allow post process shaders to be grouped up and enabled/disabled via Lua or a shaders menu
2024-12-19 19:08:59 +11:00
Kae
2bf5be1af3
Merge pull request #152 from SilverSokolova/SilverSokolova-doc
More documentation [skip ci]
2024-12-19 19:08:39 +11:00
Kae
157eb7c141
Merge pull request #155 from SilverSokolova/main
Allow buying/crafting more than 1000 items at once [skip ci]
2024-12-19 19:07:34 +11:00
Bottinator22
300b8f2dba
Update build.yml 2024-12-18 22:45:26 -08:00
Bottinator22
ea21eb55d7
Update StarTitleScreen.cpp 2024-12-18 22:41:54 -08:00
Bottinator22
93839a2032
Update StarTitleScreen.hpp 2024-12-18 22:41:35 -08:00
Bottinator22
1f5606b4d5
Update StarClientApplication.cpp 2024-12-18 22:41:05 -08:00
Bottinator22
20f0efdcb8
add shader interface 2024-12-18 22:34:58 -08:00
Bottinator22
8dbbbcb086
Update graphicsmenu.config.patch.lua 2024-12-18 22:33:27 -08:00
Bottinator22
9cff2ce433
Update CMakeLists.txt 2024-12-18 22:30:16 -08:00
Bottinator22
bf6969dc7d
Add files via upload 2024-12-18 22:28:39 -08:00
Bottinator22
0c4682d304
Update StarGraphicsMenu.hpp 2024-12-18 22:26:59 -08:00
Bottinator22
e12860ad25
Update StarGraphicsMenu.cpp 2024-12-18 22:26:35 -08:00
Bottinator22
1303f54e30
Update StarOptionsMenu.cpp 2024-12-18 22:23:54 -08:00
Bottinator22
096ab486f6
Update StarOptionsMenu.hpp 2024-12-18 22:22:12 -08:00
Bottinator22
7bc0f942bc
Update StarMainInterface.cpp 2024-12-18 22:21:32 -08:00
Bottinator22
2ffe114686
Update StarClientApplication.cpp 2024-12-18 18:13:34 -08:00
Bottinator22
1d80822543
Update CMakeLists.txt 2024-12-18 18:10:07 -08:00
Bottinator22
b7aa4f6da6
Add files via upload 2024-12-18 18:09:19 -08:00
Bottinator22
226ff4e278
Update StarClientApplication.hpp 2024-12-18 18:07:58 -08:00
Bottinator22
e009a15ba7
Update StarClientApplication.cpp 2024-12-18 18:06:56 -08:00
Bottinator22
209d89a07d
Update StarClientApplication.cpp 2024-12-18 18:05:55 -08:00
Bottinator22
7253f40932
Update build.yml 2024-12-18 18:03:32 -08:00
Bottinator22
0a035226d8
Update client.config.patch 2024-12-18 18:02:08 -08:00
Kae
7d98cc8e04
Merge pull request #156 from SilverSokolova/merchantShineFix
Fix merchant shine when using Patch Project
2024-12-19 10:40:20 +11:00
SilverSokolova
c80f55bef2
Create merchant.config.patch 2024-12-18 13:59:10 -06:00
SilverSokolova
fa81726902
Delete assets/opensb/interface/merchant directory 2024-12-18 13:58:06 -06:00
SilverSokolova
28a8b54f43
Update StarMerchantInterface.cpp 2024-12-18 02:42:16 -06:00
SilverSokolova
ee918cb476
Update crafting.config.patch 2024-12-18 02:26:43 -06:00
SilverSokolova
621166242b
Update StarMerchantInterface.cpp 2024-12-18 02:24:50 -06:00
SilverSokolova
a362aa867a
Update StarMerchantInterface.hpp 2024-12-18 01:57:51 -06:00
SilverSokolova
41cb7dfde4
Update StarCraftingInterface.hpp 2024-12-18 01:57:19 -06:00
SilverSokolova
a57347c9b1
Update StarMerchantInterface.cpp 2024-12-18 01:50:56 -06:00
SilverSokolova
79e2c90ee0
Update StarCraftingInterface.cpp 2024-12-18 01:50:23 -06:00
SilverSokolova
476bdc619c
Update StarCraftingInterface.cpp 2024-12-18 01:49:41 -06:00
SilverSokolova
e875d5fccd
Allow changing maxBuyCount 2024-12-18 01:49:23 -06:00
SilverSokolova
de642ab8bf
Add maxSpinCount 2024-12-18 01:47:58 -06:00
SilverSokolova
54647362a0
Update StarCraftingInterface.cpp 2024-12-18 01:47:22 -06:00
SilverSokolova
341a9a3556
Update openstarbound.md 2024-12-11 00:18:08 -06:00
SilverSokolova
65741d6972
Update player.md 2024-12-10 23:35:51 -06:00
Kae
a52c213ebe Update bindings.lua 2024-12-10 19:48:16 +11:00
Kae
ad508c5322 add item copy-paste binds
decided against making them bound by default
2024-12-10 18:50:03 +11:00
Kae
d95eac3164 Input: binds can now make the clipboard available while held, config option to always allow 2024-12-10 18:49:29 +11:00
Kae
dd52188e53 add sky setting overrides to celestial.flyShip, pass net rules to packet read/write 2024-12-05 15:39:11 +11:00
Kae
3fc12923ce Merge branch 'chat' 2024-12-05 12:28:33 +11:00
Kae
cbde26aebe move loadstring out of LuaRoot 2024-11-30 09:17:44 +11:00
Kae
47de88c373 Update StarQuestManager.cpp 2024-11-29 13:17:11 +11:00
Kae
e437282d5c Update StarQuestManager.cpp 2024-11-27 21:29:53 +11:00
Kae
56c99c086f scriptable chat 2024-11-24 12:51:55 +11:00
Kae
d4c976bcb3 Add prefix Humanoid fix to portraits 2024-11-21 15:58:53 +11:00
Kae
a59ff847bc Fix UB when a unique effect script adds another unique effect during initialization 2024-11-21 15:31:28 +11:00
Kae
996dc77967
Merge pull request #145 from WasabiRaptor/dedicated-create-character-button
add dedicated create character button to the CharSelectionPane
2024-11-14 10:32:36 +11:00
WasabiRaptor
46f4b5b07e add dedicated create character button to the CharSelectionPane
so people don't have to scroll to the bottom of their character list to create new characters
2024-11-13 17:16:19 -05:00
Kae
3b40e89b32 Add camera bindings
override missing, but it's a start
2024-11-07 18:26:31 +11:00
Kae
9502b05ea4 Update StarQuestManager.cpp 2024-11-05 15:42:32 +11:00
Kae
7151c0cd9e fix /startquest parsing the argument in an annoying way 2024-11-05 15:42:21 +11:00
Kae
c2ec41c391 Update StarHumanoid.cpp 2024-11-05 12:07:54 +11:00
Kae
4b0b047448 Update StarQuestManager.cpp 2024-11-05 10:56:20 +11:00
Kae
662a376926 Update StarDirectives.cpp 2024-11-05 10:52:52 +11:00
Kae
49cadf7902 Fix crash when a quest adds a new quest in its update() call 2024-11-05 10:40:32 +11:00
Kae
01770c78db Disable stack capture on common Json patching exceptions
Speeds up asset loading
2024-11-05 10:40:05 +11:00
Kae
515d71409c support for an absurd hacky trick used by FD: appending to the frame ID via the directives parameter
wtf 😭
2024-11-05 10:23:03 +11:00
Kae
6435fd5e34 Merge branch 'main' of https://github.com/OpenStarbound/OpenStarbound 2024-11-05 09:57:02 +11:00
Kae
e1dea58e80 questPortrait callback 2024-11-05 09:44:46 +11:00
Kae
7dc8f4ae04
Merge pull request #139 from OpenStarbound/SilverSokolova-patch-1
Interface docs
[skip ci]
2024-10-30 14:39:46 +11:00
SilverSokolova
6423dead1f
Interface docs 2024-10-29 21:38:37 -05:00
Kae
cc5fbb0087 fix broken status.primaryDirectives
why did it even compile before. what the fuck!
2024-10-29 20:12:58 +11:00
Kae
391f148f11
Update StarItemTooltip.cpp 2024-10-28 15:04:46 +11:00
Kae
e065981ce2 Update StarWorldClient.cpp 2024-10-27 05:44:33 +11:00
Kae
beea448827 fix WorldClient::m_inWorld being false during during player init
this was breaking a few new checks
fixes #136
2024-10-26 10:46:46 +11:00
Kae
aeb3644d9b Merge branch 'main' of https://github.com/OpenStarbound/OpenStarbound 2024-10-25 11:59:42 +11:00
Kae
42a648ecc1 Update StarPlayerLuaBindings.cpp 2024-10-25 11:59:33 +11:00
Kae
98bc80a32c
Merge pull request #134 from dressupgeekout/netbsd
Add preliminary support for NetBSD
2024-10-25 11:19:41 +11:00
Kae
c2b9f5ac07 Only create a dump on stack overflow 2024-10-25 11:19:27 +11:00
Charlotte Koch
20c79e32f8 Add preliminary support for NetBSD 2024-10-24 15:42:26 -07:00
Kae
15d116b7ea fix broken minidumping 2024-10-23 15:05:00 +11:00
Kae
73e9ab3b8e player.callQuest 2024-10-21 20:05:07 +11:00
Kae
250869e215
Merge pull request #131 from KrashV/main
player.teamMembers callback
2024-10-21 16:55:59 +11:00
Kae
2796e8ed10 Update StarPlayerLuaBindings.cpp 2024-10-21 16:55:31 +11:00
Kae
5c669f4b3a change to trackedQuestId, add currentQuestId 2024-10-21 16:54:10 +11:00
Kae
e3aa302a8c Move teamMembers impl to Lua bindings
avoiding including UniverseClient.hpp and TeamClient.hpp in StarPlayer
2024-10-21 16:49:21 +11:00
Kae
99f78c3912 add player.trackedQuest 2024-10-21 16:21:53 +11:00
Degranon
f270c3f168 Player teammembers 2024-10-19 21:10:39 +05:00
Kae
aac3e53941 win: add minidumps to fatal errors 2024-10-18 14:18:40 +11:00
Kae
0a5e92ef38 unify UniverseClient & WorldClient LuaRoots & let universeClient scripts intercept packets
can be used for intercepting chat packets, for example!
2024-10-17 19:02:24 +11:00
LDA
9ba9eb2ac3 only set minimum opengl context version on macos 2024-10-17 00:16:44 -07:00
Kae
8aedf51957 add new quest Lua bindings to player 2024-10-15 16:16:57 +11:00
Kae
be884c33b4 change ImageMetadataDatabase caches to use a TTL 2024-10-15 16:11:17 +11:00
Kae
4b917e8c2f
Merge pull request #122 from JenyaRostov/takeallhotkey
Hotkey to Take All action in containers
2024-10-11 05:35:06 +11:00
Kae
9e2f39bc01 Update StarContainerInterface.cpp 2024-10-11 05:34:45 +11:00
Kae
8eea7862aa
Update README.md
[skip ci]
2024-10-11 05:32:44 +11:00
Kae
c9d45daac9 Don't trigger player slot reordering when autosaving after swapped 2024-10-11 05:16:09 +11:00
Kae
5db9e4e1c5 Fix keypad binding issue (#125) 2024-10-08 09:49:52 +11:00
Kae
1ff3072f89
Merge pull request #124 from SilverSokolova/SilverSokolova-readme
Update README.md [skip ci]
2024-10-08 09:36:00 +11:00
Kae
a6c413cd1c
Merge pull request #126 from SilverSokolova/SilverSokolova-doc
Docs: Fix player.setActionBarSlotLink and add player.currentState
2024-10-08 09:35:31 +11:00
SilverSokolova
11b91ff84f
Documentation: Fix player.setActionBarSlotLink doc and add player.currentState 2024-10-07 17:02:46 -05:00
SilverSokolova
c033774aa1
Update README.md
* Add answers for common installation questions ("Does it replace SB?", "Can I keep my characters and universe?", "Can I use Steam mods?")
* Inform users of some bug fixes and command changes
2024-10-07 16:53:02 -05:00
Kae
03b7e3a22b PlayerInventory: fix bag loading issue 2024-10-04 13:44:07 +10:00
Jenya
8f4b4d4f2e Merge remote-tracking branch 'origin/takeallhotkey' into takeallhotkey 2024-10-02 22:37:30 +03:00
Jenya
932ec4019a Actual code 2024-10-02 22:35:54 +03:00
Kae
25f3edbae3 shipworlds: store their own epoch time for consistent plant growth 2024-10-02 14:45:27 +10:00
Kae
80192714b7 Update StarSongbookInterface.cpp 2024-10-02 09:07:42 +10:00
Kae
3e8f914154 fix bool lexical casts
oops
2024-09-22 16:24:20 +10:00
Kae
ca48a137ec root.assetFrames & assets.frames 2024-09-22 15:59:45 +10:00
Kae
764751a825
Update README.md
[skip ci]
2024-09-17 00:04:54 +10:00
Kae
090441b80a make lexical casts (string -> int/float) faster 2024-09-16 23:02:22 +10:00
Kae
40299558dd Update StarThread_unix.cpp 2024-09-15 16:41:41 +10:00
Kae
304d32d5c0
Merge pull request #113 from OpenStarbound/wip/net-n-btree
PR for WIP net branch
2024-09-15 15:17:38 +10:00
Kae
4d92042369 Update StarJsonExtra.hpp 2024-09-15 13:46:15 +10:00
Kae
1dc14b116c Update StarJsonExtra.hpp 2024-09-15 13:43:06 +10:00
Kae
8155ec6715 protected dungeon ID optimization + /settileprotection improvements 2024-09-14 15:59:01 +10:00
Kae
9dbc4daacc Update StarWorldServer.cpp 2024-09-13 15:24:13 +10:00
Kae
253473f32c Update StarWorldServer.cpp 2024-09-13 15:05:28 +10:00
Kae
392c8e9bd7 Merge branch 'main' into wip/net-n-btree 2024-09-13 14:56:56 +10:00
Kae
85fbe0bab0 Update StarArmorWearer.cpp 2024-09-13 14:56:45 +10:00
Kae
834acaf6bd Merge branch 'main' into wip/net-n-btree 2024-09-12 23:52:01 +10:00
Kae
7a043e4727 Merge branch 'main' of https://github.com/OpenStarbound/OpenStarbound 2024-09-12 23:51:39 +10:00
Kae
9df51b51b8 fix windows pread and pwrite bug
reading without a byte offset specified can affect absolute reads afterward, this is a workaround (thanks windows...)
2024-09-12 23:49:21 +10:00
Kae
261ba6d643 Merge branch 'main' into wip/net-n-btree 2024-09-12 23:31:18 +10:00
Kae
0da6aa1bd9 Update StarFile_windows.cpp 2024-09-12 23:31:07 +10:00
Kae
79d8ca62d3 Merge branch 'main' into wip/net-n-btree 2024-09-12 23:06:24 +10:00
Kae
e8d59f9c2b fix windows pread and pwrite bug
reading without a byte offset specified can affect absolute reads afterward, this is a workaround (thanks windows...)
2024-09-12 23:06:13 +10:00
Kae
ba9335f801 Update StarFont.cpp 2024-09-12 23:03:15 +10:00
Kae
4da398e42d Merge branch 'main' into wip/net-n-btree 2024-09-12 19:13:57 +10:00
Kae
3c4a2eb71e tooltip stuff 2024-09-11 19:52:01 +10:00
Kae
a98ff51ef7 trigger build 2024-09-11 18:29:52 +10:00
Kae
3aedd5ae91 Update build.yml 2024-09-11 18:28:41 +10:00
Kae
7408981e13 use a version number rather than a bool
more flexible, allows for backwards compat with older OpenSB versions & not just vanilla Starbound
2024-09-11 18:22:44 +10:00
Kae
5a75473e16 try to fix that freaking rare font bug again 2024-09-11 18:18:20 +10:00
Kae
4c78b7365a Experimental BTree changes 2024-09-11 15:24:01 +10:00
Kae
a6b20df3f0 fix button click not playing when returning from a GUI and then clicking it again 2024-09-11 15:23:35 +10:00
Kae
c68ebd2e0e Tooltip improvements 2024-09-11 15:20:48 +10:00
Kae
37f3178d33 Network compatibility changes 2024-09-11 15:19:17 +10:00
Kae
7852ad9cf2
Merge pull request #112 from floydinator-git/image-fix
Fix images added by assets.add not working in-game.
2024-09-11 15:11:01 +10:00
floydinator-git
1f5e8a4629 Fix ImageMetadataDatabase::calculateImageSize calling Image::readPngMetadata on non-PNG images. 2024-09-10 23:04:09 -04:00
348 changed files with 11145 additions and 3649 deletions

262
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,262 @@
name: Build
on:
workflow_dispatch:
inputs:
linux:
type: boolean
description: Linux
default: true
windows:
type: boolean
description: Windows
default: false
macOS:
type: boolean
description: macOS
default: false
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
build_windows:
name: Build OpenStarbound Windows x64
runs-on: windows-latest
if: ${{ (github.event_name != 'workflow_dispatch') || (inputs.windows == true) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.2
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-${{ runner.os }}
max-size: 1000M
- uses: ilammy/msvc-dev-cmd@v1
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'windows-release'
buildPreset: 'windows-release'
testPreset: 'windows-release'
- name: Run Post-Build Task
working-directory: ${{ github.workspace }}
run: scripts\ci\windows\post_build.bat
- name: Assemble Files
working-directory: ${{ github.workspace }}
run: scripts\ci\windows\assemble.bat
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-All-DevOnly
path: dist/*
- name: Upload Client
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-Client
path: client_distribution/*
- name: Upload Server
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-Server
path: server_distribution/*
- name: Create Installer
working-directory: ${{ github.workspace }}
run: |
& "C:\Program Files (x86)\Inno Setup 6\iscc.exe" /Oinstaller scripts\inno\setup.iss
- name: Upload Installer
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-Installer
path: installer/*
build_linux:
name: Build OpenStarbound Linux x86_64
runs-on: ubuntu-22.04
if: ${{ (github.event_name != 'workflow_dispatch') || (inputs.linux == true) }}
env:
CC: clang
CXX: clang++
steps:
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libxmu-dev libxi-dev libgl-dev libglu1-mesa-dev libsdl2-dev
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-${{ runner.os }}
max-size: 250M
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'linux-release'
buildPreset: 'linux-release'
- name: Prepare Artifacts
working-directory: ${{ github.workspace }}
run: tar -cvf dist.tar dist
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Linux
path: dist.tar
- name: Run Tests
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
testPreset: 'linux-release'
- name: Assemble Files
working-directory: ${{ github.workspace }}
run: scripts/ci/linux/assemble.sh
- name: Upload Client Files
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Linux-Client
path: client.tar
- name: Upload Server Files
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Linux-Server
path: server.tar
build-mac-intel:
name: Build OpenStarbound macOS x86_64
runs-on: macos-13
if: ${{ (github.event_name != 'workflow_dispatch') || (inputs.macOS == true) }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.0
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-Intel-${{ runner.os }}
max-size: 250M
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'macos-release'
buildPreset: 'macos-release'
testPreset: 'macos-release'
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-macOS-Intel
path: dist/*
build-mac-arm:
name: Build OpenStarbound macOS arm64
runs-on: macos-14
if: ${{ (github.event_name != 'workflow_dispatch') || (inputs.macOS == true) }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.2
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-ARM-${{ runner.os }}
max-size: 250M
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'macos-arm-release'
buildPreset: 'macos-arm-release'
testPreset: 'macos-arm-release'
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-macOS-Silicon
path: dist/*

View File

@ -1,76 +0,0 @@
name: Ubuntu Linux
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
name: OpenStarbound Linux x86_64
runs-on: ubuntu-20.04
steps:
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libxmu-dev libxi-dev libgl-dev libglu1-mesa-dev libsdl2-dev
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-${{ runner.os }}
max-size: 250M
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'linux-release'
buildPreset: 'linux-release'
testPreset: 'linux-release'
- name: Assemble Files
working-directory: ${{ github.workspace }}
run: scripts/ci/linux/assemble.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Linux
path: dist.tar
- name: Upload Client Files
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Linux-Client
path: client.tar
- name: Upload Server Files
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Linux-Server
path: server.tar

View File

@ -1,97 +0,0 @@
name: macOS
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
jobs:
build-intel:
name: OpenStarbound macOS x86_64
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.0
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-Intel-${{ runner.os }}
max-size: 250M
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'macos-release'
buildPreset: 'macos-release'
testPreset: 'macos-release'
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-macOS-Intel
path: dist/*
build-arm:
name: OpenStarbound macOS arm64
runs-on: macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.2
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-ARM-${{ runner.os }}
max-size: 250M
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'macos-arm-release'
buildPreset: 'macos-arm-release'
testPreset: 'macos-arm-release'
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-macOS-Silicon
path: dist/*

View File

@ -1,89 +0,0 @@
name: Windows
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
name: Build OpenStarbound Windows x64
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install CMake & Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.2
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ github.job }}-${{ runner.os }}
max-size: 1000M
- uses: ilammy/msvc-dev-cmd@v1
- name: vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: '**/source/vcpkg.json'
vcpkgConfigurationJsonGlob: '**/source/vcpkg-configuration.json'
- name: Run CMake
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/source/CMakeLists.txt'
configurePreset: 'windows-release'
buildPreset: 'windows-release'
testPreset: 'windows-release'
- name: Run Post-Build Task
working-directory: ${{ github.workspace }}
run: scripts\ci\windows\post_build.bat
- name: Assemble Files
working-directory: ${{ github.workspace }}
run: scripts\ci\windows\assemble.bat
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-All-DevOnly
path: dist/*
- name: Upload Client
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-Client
path: client_distribution/*
- name: Upload Server
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-Server
path: server_distribution/*
- name: Create Installer
working-directory: ${{ github.workspace }}
run: |
& "C:\Program Files (x86)\Inno Setup 6\iscc.exe" /Oinstaller scripts\inno\setup.iss
- name: Upload Installer
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Windows-Installer
path: installer/*

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ enc_temp_folder/
.cache/
/attic/user/
/attic/chucklefish/
/attic/debug/
/tiled/
/assets/user/
/assets/devel/

View File

@ -14,22 +14,26 @@ It is still **work-in-progress**.
## Installation
You can download a nightly build below, or the [latest release](https://github.com/OpenStarbound/OpenStarbound/releases/latest). At the moment, you must copy the game assets (**packed.pak**) from your normal Starbound install to the OpenStarbound assets directory before playing.
OpenStarbound is a separate installation/executable than Starbound. You can copy your `storage` folder from Starbound to transfer your save data and settings. Launching OpenStarbound with Steam open will load your subscribed Steam mods.
An installer is available for Windows. otherwise, extract the client/server zip for your platform and copy the game assets (packed.pak) to the OpenStarbound assets folder. the macOS releases currently lack the sbinit.config and folder structure that the Linux & Windows zips have, so you'll need to create those before running them. For macOS releases, it is recommended to build them from source (See guide below).
### Nightly Builds
These link directly to the latest build from the [Actions](https://github.com/OpenStarbound/OpenStarbound/actions?query=branch%3Amain) tab.
[**Windows**](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_windows/main):
[Installer](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_windows/main/OpenStarbound-Windows-Installer.zip),
[Client](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_windows/main/OpenStarbound-Windows-Client.zip),
[Server](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_windows/main/OpenStarbound-Windows-Server.zip)
**Windows**
[Installer](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main/OpenStarbound-Windows-Installer.zip),
[Client](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main/OpenStarbound-Windows-Client.zip),
[Server](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main/OpenStarbound-Windows-Server.zip)
[**Linux**](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_linux/main):
[Client](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_linux/main/OpenStarbound-Linux-Client.zip),
[Server](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_linux/main/OpenStarbound-Linux-Server.zip)
**Linux**
[Client](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main/OpenStarbound-Linux-Client.zip),
[Server](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main/OpenStarbound-Linux-Server.zip)
[**macOS**](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_macos/main "overpriced aluminium"):
[Intel](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_macos/main/OpenStarbound-Dev-macOS-Intel.zip),
[ARM](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build_macos/main/OpenStarbound-Dev-macOS-Silicon.zip)
**macOS**
[Intel](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main/OpenStarbound-Dev-macOS-Intel.zip),
[ARM](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main/OpenStarbound-Dev-macOS-Silicon.zip)
[All Nightly Builds](https://nightly.link/OpenStarbound/OpenStarbound/workflows/build/main)
## Changes
Note: Not every function from [StarExtensions](https://github.com/StarExtensions/StarExtensions) has been ported yet, but near-full compatibility with mods that use StarExtensions features is planned.
@ -44,8 +48,16 @@ Note: Not every function from [StarExtensions](https://github.com/StarExtensions
* These scripts can modify, read, patch and create new assets!
* Lua patch files now exist - **.patch.lua**
* These can patch JSON assets, as well as images!
### Commands
**View OpenStarbound commands with `/help`! You can also view them [here](https://github.com/OpenStarbound/OpenStarbound/blob/main/assets/opensb/help.config.patch)**
* Changes to vanilla commands:
* `/settileprotection`
* You can now specify as many dungeon IDs as you want: `/settileprotection 69 420 false`
* You can now specify a range: /settileprotection 0..65535 true
### Bug Fixes
* Invalid character inventories are updated when loading in, allowing players to swap inventory mods with pre-existing characters.
* Fix vanilla world file size bloating issue.
* Modifying a single status property no longer re-networks every status property on the entity (server and client must be running at least OpenStarbound 0.15)
### Misc
* Player functions for saving/loading, modifying the humanoid identity, manipulating the inventory. [Documentation](https://github.com/OpenStarbound/OpenStarbound/blob/main/doc/lua/openstarbound.md)
* Character swapping (rewrite from StarExtensions, currently command-only: `/swap name` case-insensitive, only substring required)

View File

@ -3,7 +3,9 @@
"groups": {
"camera": { "name": "Camera" },
"voice": { "name": "Voice" },
"building": { "name": "Building" }
"building": { "name": "Building" },
"inventory": { "name": "Inventory" },
"editing" : { "name" : "Editing" }
},
"name": "Open^#ebd74a;Starbound",
"binds": {
@ -15,6 +17,11 @@
"group": "camera",
"name": "Zoom In"
},
"takeAll": {
"default": [],
"group": "inventory",
"name": "Take All From Container"
},
"zoomOut": {
"default": [{
"type": "key",
@ -42,6 +49,18 @@
"default": [],
"group": "building",
"name": "Shrink Building Radius"
},
"editingCopyItemJson": {
"default": [], // [{"type": "key", "value": "C","mods": ["LShift"]}],
"name": "Copy Item in Cursor",
"group": "editing",
"tags" : ["clipboard"]
},
"editingPasteItemJson": {
"default": [], // [{"type": "key", "value": "V", "mods": ["LShift"]}],
"name": "Paste Item in Cursor",
"group": "editing",
"tags" : ["clipboard"]
}
}
}

View File

@ -10,5 +10,6 @@
"scissor" : false,
"letterbox" : false
},
"postProcessLayers": []
"postProcessLayers": [],
"postProcessGroups": {}
}

View File

@ -0,0 +1,7 @@
m6x11: managore.itch.io/m6x11
beech: 04.jp.org
twemoji: github.com/jdecked/twemoji
unifont: github.com/stgiga/UnifontEX
dotsies: dotsies.org
newspaper: onlygfx.com/newspaper-cutout
pixelhobo: Chucklefish

Binary file not shown.

View File

@ -41,6 +41,7 @@
// Change planet name to support the new internal string formatting.
"planetNameFormatString" : "- {} -",
"planetTextOffset" : [0, 120],
"planetTextStyle" : {
"backDirectives" : "border=5;fff;fff?border=1;fff;fff7?multiply=000",
"fontSize" : 24

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 740 B

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 285 B

View File

@ -35,7 +35,7 @@ local function finishBind(a, b)
if (type(a) == "table") then
snareFinished(a)
else
snareFinished{ type = a, value = b, mods = getMods(value) }
snareFinished{ type = a, value = b, mods = getMods(b) }
for i, mod in ipairs(mods) do
mod.active = false
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 743 B

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,150 @@
{
"scripts" : ["/interface/opensb/shaders/shaders.lua"],
"scriptDelta" : 0,
"scriptWidgetCallbacks" : [
"selectGroup",
"toggleGroupEnabled",
"sliderOptionModified",
"textboxOptionModified",
"selectOptionPressed"
],
"gui" : {
"panefeature" : {
"type" : "panefeature",
"positionLocked" : false
},
"background" : {
"type" : "background",
"fileHeader" : "/interface/opensb/shaders/header.png",
"fileBody" : "/interface/opensb/shaders/body.png",
"fileFooter" : "/interface/opensb/shaders/footer.png"
},
"banner" : {
"type" : "canvas",
"rect" : [146, 187, 398, 215]
},
"groups" : {
"type" : "scrollArea",
"rect" : [4, 16, 145, 214],
"children" : {
"list" : {
"type" : "list",
"schema" : {
"selectedBG" : "/interface/opensb/shaders/groupback.png?multiply=0f0",
"unselectedBG" : "/interface/opensb/shaders/groupback.png?multiply=222",
"spacing" : [0, 1],
"memberSize" : [130, 16],
"listTemplate" : {
"background" : {
"type" : "image",
"file" : "/interface/opensb/shaders/groupback.png?multiply=222",
"position" : [0, 0],
"zlevel" : -1
},
"button" : {
"type" : "button",
"callback" : "selectGroup",
"caption" : "Unnamed",
"base" : "/interface/opensb/shaders/group.png?replace;fff=fff0;000=0007",
"hover" : "/interface/opensb/shaders/group.png?replace;fff=fff7;000=3337",
"press" : "/interface/opensb/shaders/group.png?replace;fff=000;000=7777",
"pressedOffset" : [0, 0],
"position" : [0, 0]
}
}
}
}
},
"buttons" : {
"horizontal" : {
"forward" : { "base" : "", "hover" : "", "pressed" : "" },
"backward" : { "base" : "", "hover": "", "pressed" : "" }
},
"vertical" : {
"forward" : {
"base" : "/interface/scrollarea/varrow-forward.png?setcolor=fff",
"hover" : "/interface/scrollarea/varrow-forwardhover.png",
"pressed" : ""
},
"backward" : {
"base" : "/interface/scrollarea/varrow-backward.png?setcolor=fff",
"hover" : "/interface/scrollarea/varrow-backwardhover.png",
"pressed" : ""
}
}
},
"thumbs" : {
"horizontal" : {
"base" : { "begin" : "", "end" : "", "inner" : "" },
"hover" : { "begin" : "", "end" : "", "inner" : "" },
"pressed" : { "begin" : "", "end" : "", "inner" : "" }
},
"vertical" : {
"base" : {
"begin" : "/interface/scrollarea/vthumb-begin.png",
"end" : "/interface/scrollarea/vthumb-end.png",
"inner" : "/interface/scrollarea/vthumb-inner.png"
},
"hover" : {
"begin" : "/interface/scrollarea/vthumb-beginhover.png",
"end" : "/interface/scrollarea/vthumb-endhover.png",
"inner" : "/interface/scrollarea/vthumb-innerhover.png"
},
"pressed" : {
"begin" : "/interface/scrollarea/vthumb-beginhover.png",
"end" : "/interface/scrollarea/vthumb-endhover.png",
"inner" : "/interface/scrollarea/vthumb-innerhover.png"
}
}
}
},
"options" : {
"type" : "scrollArea",
"rect" : [147, 16, 398, 185],
"children" : {},
"buttons" : {
"horizontal" : {
"forward" : { "base" : "", "hover" : "", "pressed" : "" },
"backward" : { "base" : "", "hover": "", "pressed" : "" }
},
"vertical" : {
"forward" : {
"base" : "/interface/scrollarea/varrow-forward.png?setcolor=fff",
"hover" : "/interface/scrollarea/varrow-forwardhover.png",
"pressed" : ""
},
"backward" : {
"base" : "/interface/scrollarea/varrow-backward.png?setcolor=fff",
"hover" : "/interface/scrollarea/varrow-backwardhover.png",
"pressed" : ""
}
}
},
"thumbs" : {
"horizontal" : {
"base" : { "begin" : "", "end" : "", "inner" : "" },
"hover" : { "begin" : "", "end" : "", "inner" : "" },
"pressed" : { "begin" : "", "end" : "", "inner" : "" }
},
"vertical" : {
"base" : {
"begin" : "/interface/scrollarea/vthumb-begin.png",
"end" : "/interface/scrollarea/vthumb-end.png",
"inner" : "/interface/scrollarea/vthumb-inner.png"
},
"hover" : {
"begin" : "/interface/scrollarea/vthumb-beginhover.png",
"end" : "/interface/scrollarea/vthumb-endhover.png",
"inner" : "/interface/scrollarea/vthumb-innerhover.png"
},
"pressed" : {
"begin" : "/interface/scrollarea/vthumb-beginhover.png",
"end" : "/interface/scrollarea/vthumb-endhover.png",
"inner" : "/interface/scrollarea/vthumb-innerhover.png"
}
}
}
}
}
}

View File

@ -0,0 +1,355 @@
--constants
local PATH = "/interface/opensb/shaders/"
local GROUP_LIST_WIDGET = "groups.list"
local OPTIONS_WIDGET = "options"
local fmt = string.format
local log = function() end
function update()
end
local function alphabeticalNameSortGreater(a, b) return a.name > b.name end
local function alphabeticalNameSortLesser(a, b) return a.name < b.name end
local sortedGroups = {}
local groups = {}
local widgetsToGroups = {}
local allSettings = {}
local shaderConfig
local function addGroupToList(data)
local name = widget.addListItem(GROUP_LIST_WIDGET)
widget.setText(fmt("%s.%s.button", GROUP_LIST_WIDGET, name), data.friendlyName)
log("Added group ^cyan;%s^reset; to list", data.friendlyName)
return name
end
local function parseGroups()
for name, data in next, renderer.postProcessGroups() do
if not data.hidden then
if not data.friendlyName then data.friendlyName = name end
data.groupId = name
data.name = data.friendlyName
groups[data.groupId] = data
end
end
for groupId, data in pairs(groups) do
sortedGroups[#sortedGroups + 1] = data
end
table.sort(sortedGroups, alphabeticalNameSortLesser)
for i = 1, #sortedGroups do
local data = sortedGroups[i]
data.index = i
local name = addGroupToList(data)
data.widget = name
widgetsToGroups[name] = data
end
if sortedGroups[1] then
local first = sortedGroups[1].widget
widget.setListSelected(GROUP_LIST_WIDGET, first)
selectGroup(first)
end
end
local activeGroup
local function addOptionGroup(data, i, added)
local y = (i - 1) * -14
local bg = {
type = "image",
file = PATH .. "groupname.png",
position = {-12, y}
}
local name = "group_" .. i
widget.addChild(BINDS_WIDGET, bg, name)
added[#added + 1] = name
local label = {
type = "label",
value = data.label,
wrapWidth = 120,
fontSize = 8,
hAnchor = "mid",
vAnchor = "mid",
position = {120, 6}
}
widget.addChild(fmt("%s.%s", BINDS_WIDGET, name), label, "text")
end
local function digitRegex(n)
local i = 0
while n ~= math.floor(n) do
n = n * 10
i = i + 1
end
return fmt("%%.%df",i) -- create format string %.nf, where n = %d (i with no decimal points)
end
local optionPrefix = "option_"
local optionOffset = #optionPrefix+1
local function addOption(data, i, added)
local y = (i - 1) * -14
local bg = {
type = "image",
file = PATH .. "optionname.png",
position = {-12, y}
}
local name = "label_" .. data.name
widget.addChild(OPTIONS_WIDGET, bg, name)
added[#added + 1] = name
local label = {
type = "label",
value = data.label,
wrapWidth = 120,
fontSize = 8,
hAnchor = "mid",
vAnchor = "mid",
position = {62, 6}
}
widget.addChild(fmt("%s.%s", OPTIONS_WIDGET, name), label, "text")
local value = data.default or 0
if not shaderConfig[activeGroup] then
shaderConfig[activeGroup] = {parameters={}}
end
if not shaderConfig[activeGroup].parameters then
shaderConfig[activeGroup].parameters = {}
end
if shaderConfig[activeGroup].parameters[data.name] ~= nil then
value = shaderConfig[activeGroup].parameters[data.name]
end
-- todo: finish this
if data.type == "slider" then
local range = data.range or {0,1}
local delta = data.delta or 0.01
-- for some reason ranges require ints so
local r = {range[1]/delta, range[2]/delta, 1}
local slider = {
type = "slider",
callback = "sliderOptionModified",
position = {110, y + 2},
gridImage = "/interface/optionsmenu/smallselection.png",
range = r
}
name = optionPrefix..data.name
added[#added + 1] = name
widget.addChild(OPTIONS_WIDGET, slider, name)
widget.setSliderValue(fmt("%s.%s",OPTIONS_WIDGET,name), value/delta)
local valLabel = {
type = "label",
value = fmt(digitRegex(delta),value),
position = {186, y + 2}
}
added[#added + 1] = name.."_value"
widget.addChild(OPTIONS_WIDGET, valLabel, name.."_value")
elseif data.type == "select" then
local n = #data.values
local width = math.floor(118/n)
local by = y
local buttons = {}
for i=0,n-1 do
local img = fmt("%sselect.png?crop=0;0;%.0f;13",PATH,width)
local button = {
type = "button",
callback="selectOptionPressed",
caption = data.values[i+1],
base = img,
hover = img.."?brightness=-25",
baseImageChecked = img.."?multiply=00ff00",
hoverImageChecked = img.."?multiply=00ff00?brightness=-25",
position = {110+width*i, by},
pressedOffset = {0, 0},
checkable = true,
checked = (value == i)
}
name = "select_"..data.name.."_"..i
added[#added + 1] = name
widget.addChild(OPTIONS_WIDGET, button, name)
table.insert(buttons,{widget=fmt("%s.%s",OPTIONS_WIDGET,name),index=i})
end
for k,v in next, buttons do
widget.setData(v.widget,{option=data,index=v.index,buttons=buttons})
end
--[[local bge = {
type = "image",
file = PATH.."selectend.png",
position = {110+width*3, by}
}
name = "bgend_"..data.name
added[#added + 1] = name
widget.addChild(OPTIONS_WIDGET, bge, name)]]
end
end
function sliderOptionModified(option, odata)
local oname = string.sub(option, optionOffset)
local parameter = groups[activeGroup].parameters[oname]
local value = widget.getSliderValue(fmt("%s.%s",OPTIONS_WIDGET,option))*parameter.delta
widget.setText(fmt("%s.%s",OPTIONS_WIDGET,option.."_value"), fmt(digitRegex(parameter.delta),value))
for k,v in next, parameter.effects do
renderer.setEffectParameter(v, oname, value)
end
shaderConfig[activeGroup].parameters[oname] = value
root.setConfiguration("postProcessGroups",shaderConfig)
end
function selectOptionPressed(button,bdata)
sb.logInfo(sb.print(bdata))
for k,v in next, bdata.buttons do
if v.index ~= bdata.index then
widget.setChecked(v.widget, false)
end
end
value = bdata.index
local oname = bdata.option.name
local parameter = groups[activeGroup].parameters[oname]
for k,v in next, parameter.effects do
renderer.setEffectParameter(v, oname, value)
end
shaderConfig[activeGroup].parameters[oname] = value
root.setConfiguration("postProcessGroups",shaderConfig)
end
local function addEnabled(groupname, i, added)
local y = (i - 1) * -14
local bg = {
type = "image",
file = PATH .. "optionname.png",
position = {-12, y}
}
local name = "label_" .. i
widget.addChild(OPTIONS_WIDGET, bg, name)
added[#added + 1] = name
local label = {
type = "label",
value = "Enabled",
wrapWidth = 120,
fontSize = 8,
hAnchor = "mid",
vAnchor = "mid",
position = {62, 6}
}
widget.addChild(fmt("%s.%s", OPTIONS_WIDGET, name), label, "text")
local checkbox = {
type = "button",
callback = "toggleGroupEnabled",
position = {165, y + 2},
pressedOffset = {0, 0},
base = "/interface/optionsmenu/checkboxnocheck.png",
hover = "/interface/optionsmenu/checkboxnocheckhover.png",
baseImageChecked = "/interface/optionsmenu/checkboxcheck.png",
hoverImageChecked = "/interface/optionsmenu/checkboxcheckhover.png",
checkable = true,
checked = renderer.postProcessGroupEnabled(groupname)
}
name = "check_"..groupname
added[#added + 1] = name
widget.addChild(OPTIONS_WIDGET, checkbox, name)
end
function toggleGroupEnabled(checkbox, cdata)
renderer.setPostProcessGroupEnabled(activeGroup, widget.getChecked(fmt("%s.%s",OPTIONS_WIDGET,checkbox)), true)
shaderConfig = root.getConfiguration("postProcessGroups")
end
function selectGroup()
local selected = widget.getListSelected(GROUP_LIST_WIDGET)
local group = widgetsToGroups[selected]
local dataFromPrev = widget.getData(OPTIONS_WIDGET)
if dataFromPrev then
for i, v in pairs(dataFromPrev) do
widget.removeChild(OPTIONS_WIDGET, v)
end
end
widgetsToOptions = {}
activeGroup = group.groupId
local bannerOptions = widget.bindCanvas("banner")
bannerOptions:clear()
local bannerName = tostring(group.bannerName or group.name or group.groupId)
bannerOptions:drawText(bannerName, {position = {127, 13}, horizontalAnchor = "mid", verticalAnchor = "mid"}, 16)
local added = {}
local index = 0
addEnabled(group.groupId,index,added)
if group.categories then
elseif group.parameters then
local sortedParams = {}
for k,v in next, group.parameters do
v.name = k
sortedParams[#sortedParams+1] = v
end
table.sort(sortedParams, alphabeticalNameSortLesser)
for k,v in next, sortedParams do
index = index + 1
addOption(v, index, added)
end
end
--[[
local categories = group.categories or {}
if not categories.unsorted then
categories.unsorted = {name = "Unsorted"}
end
local sortedCategories = {}
for categoryId, data in pairs(categories) do
data.name = tostring(data.name or categoryId)
data.sortedOptions = {}
sortedCategories[#sortedCategories + 1] = data
end
table.sort(sortedCategories, alphabeticalNameSortLesser)
for categoryId, data in pairs(categories) do
table.sort(data.sortedOptions, alphabeticalNameSortLesser)
end
local onlyUnsorted = not sortedGroups[2] and sortedGroups[1] == categories.unsorted
for iA = 1, #sortedCategories do
local category = sortedCategories[iA]
local optionsCount = #category.sortedOptions
if optionsCount > 0 then
if not onlyUnsorted then
index = index + 1
addOptionCategory(category, index, added)
end
for iB = 1, optionsCount do
index = index + 1
addOption(category.sortedOptions[iB], index, added)
end
end
end
]]
widget.setData(OPTIONS_WIDGET, added)
end
local function initCallbacks()
widget.registerMemberCallback(GROUP_LIST_WIDGET, "selectGroup", selectGroup)
end
function init()
shaderConfig = root.getConfiguration("postProcessGroups")
--log = chat and chat.addMessage or sb.logInfo
widget.clearListItems(GROUP_LIST_WIDGET)
initCallbacks()
parseGroups()
script.setUpdateDelta(1)
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 839 B

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 140 B

View File

@ -54,6 +54,24 @@
"instrumentSlider" : { "type" : "slider", "position" : [62, 158], "gridImage" : "/interface/optionsmenu/largeselection.png" },
"instrumentLabel" : { "type" : "label", "position" : [32, 158], "value" : "Tunes" },
"instrumentValueLabel" : { "type" : "label", "position" : [192, 158], "hAnchor" : "mid", "value" : "Replace Me" }
"instrumentValueLabel" : { "type" : "label", "position" : [192, 158], "hAnchor" : "mid", "value" : "Replace Me" },
"headRotationLabel" : {
"type" : "label",
"position" : [25, 51],
"hAnchor" : "left",
"value" : "HEAD ROTATION"
},
"headRotationCheckbox" : {
"type" : "button",
"pressedOffset" : [0, 0],
"position" : [104, 51],
"base" : "/interface/optionsmenu/checkboxnocheck.png",
"hover" : "/interface/optionsmenu/checkboxnocheckhover.png",
"baseImageChecked" : "/interface/optionsmenu/checkboxcheck.png",
"hoverImageChecked" : "/interface/optionsmenu/checkboxcheckhover.png",
"checkable" : true,
"checked" : true
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -0,0 +1,9 @@
{
"createCharButton" : {
"type" : "button",
"base" : "/interface/title/createcharacter.png",
"hover" : "/interface/title/createcharacterover.png",
"position" : [23, 241],
"pressedOffset" : [0, 0]
}
}

View File

@ -6,5 +6,9 @@
// This is only used if the crafting timer is enabled.
// This is how many crafts are ran when the crafting timer wraps.
"craftCount" : 1
"craftCount" : 1,
// This is how many of any item can be crafted at once.
// This is also used by merchants.
"maxSpinCount" : 9999
} }

View File

@ -13,6 +13,12 @@ local function shift(thing, x, y)
return thing
end
local function moveto(thing, otherthing)
thing.position[1] = otherthing.position[1]
thing.position[2] = otherthing.position[2]
return thing
end
-- patch function, called by the game
function patch(config)
local layout = config.paneLayout
@ -42,6 +48,10 @@ function patch(config)
shift(clone(layout, "multiTextureLabel", "hardwareCursorLabel"), 98, -11).value = "HARDWARE CURSOR"
shift(clone(layout, "multiTextureCheckbox", "hardwareCursorCheckbox"), 99, -11)
-- Create shader menu button
shift(moveto(clone(layout, "accept", "showShadersMenu"), layout.interfaceScaleSlider), 112, -2).caption = "Shaders"
shift(layout.title, 0, 24)
shift(layout.resLabel, 0, 28)
shift(layout.resSlider, 0, 28)

View File

@ -0,0 +1,12 @@
[
{
"op" : "test",
"path" : "/paneLayout/bgShine/position/1",
"value" : -12
},
{
"op" : "replace",
"path" : "/paneLayout/bgShine/position/1",
"value" : -19
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -12,5 +12,7 @@
"maxWireTrans" : 0.4
},
"inventoryFilters" : { "default" : {} },
"swapDance" : null // Set this to a valid dance to trigger on character swap.
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 168 B

View File

@ -2,7 +2,7 @@ local module = {}
modules.commands = module
local commands = {}
local function command(name, func)
local function register(name, func)
commands[name] = func
end
@ -12,8 +12,7 @@ function module.init()
end
end
command("run", function(src)
register("run", function(src)
local success, result = pcall(loadstring, src, "/run")
if not success then
return "^#f00;compile error: " .. result
@ -36,3 +35,5 @@ command("run", function(src)
end
end
end)
module.register = register

View File

@ -0,0 +1,81 @@
local module = {}
modules.copy_paste = module
local commands = modules.commands
local function getItemName(item)
return item.parameters.shortdescription
or root.itemConfig(item.name).config.shortdescription
or item.name
end
local function popupError(prefix, msg)
sb.logError("%s: %s", prefix, msg)
msg = #msg > 80 and msg:sub(1, 80) .. "..." or msg
local findNewLine = msg:find("\n", 1, true)
interface.queueMessage("^#f00;error:^reset; " .. (findNewLine and msg:sub(1, findNewLine - 1) or msg), 7)
end
local function getClipboardText()
local text = clipboard.hasText() and clipboard.getText()
return text and text:sub(1, 1) == "{" and text or nil
end
local function copyItem()
local item = player.swapSlotItem() or player.primaryHandItem() or player.altHandItem()
if not item then return end
clipboard.setText(sb.printJson(item, 2))
local message = string.format("Copied ^cyan;%s^reset; to clipboard", getItemName(item))
interface.queueMessage(message, 4, 0.5)
end
local function pasteItem()
if player.swapSlotItem() then return end
local data = getClipboardText()
if not data then return end
local success, result = pcall(sb.parseJson, data)
if not success then
popupError("Error parsing clipboard item", result)
else
local success, err = pcall(player.setSwapSlotItem, result)
if not success then popupError("Error loading clipboard item", err)
else
local message = string.format("Pasted ^cyan;%s^reset; from clipboard", getItemName(result))
interface.queueMessage(message, 4, 0.5)
end
end
end
function module.update()
if input.bindDown("opensb", "editingCopyItemJson") then
copyItem()
end
if input.bindDown("opensb", "editingPasteItemJson") then
pasteItem()
end
end
commands.register("exportplayer", function()
if not clipboard.available() then
return "Clipboard unavailable"
end
local success, text = pcall(sb.printJson, player.save(), 2)
if not success then return text end
clipboard.setText(text)
return "Exported player to clipboard"
end)
commands.register("importplayer", function()
local data = getClipboardText()
if not data then return "Clipboard does not contain JSON" end
local success, result = pcall(sb.parseJson, data)
if not success then
return "Error parsing player: " .. result
else
success, result = pcall(player.load, result)
return success and "Loaded player from clipboard" or "Error loading player: " .. result
end
end)

View File

@ -1,2 +1,2 @@
require "/scripts/opensb/util/modules.lua"
modules("/scripts/opensb/player/", {"commands"})
modules("/scripts/opensb/player/", {"commands", "copy_paste"})

View File

@ -0,0 +1,22 @@
-- Meant to manage loading various miscellaneous things from configuration, such as shader parameters.
local module = {}
modules.config_loader = module
function module.init()
local shaderConfig = root.getConfiguration("postProcessGroups") or {}
local postProcessGroups = renderer.postProcessGroups()
local changes = false
for k,v in next, shaderConfig do
local group = postProcessGroups[k]
if v.parameters then
for k2,v2 in next, group.parameters do
if v.parameters[k2] ~= nil then
for _,e in next, v2.effects do
renderer.setEffectParameter(e,k2,v.parameters[k2])
end
end
end
end
end
end

View File

@ -1,2 +1,2 @@
require "/scripts/opensb/util/modules.lua"
modules("/scripts/opensb/universeclient/", {"voicemanager"})
modules("/scripts/opensb/universeclient/", {"voicemanager","loadconfig"})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 145 B

View File

@ -76,9 +76,13 @@ Returns the asset source path of an asset, or nil if the asset doesn't exist. If
Without metadata: Returns an array with all the asset source paths.
With metadata: Returns a table, key/value being source path/metadata.
#### `?` root.assetImage(`String` image)
#### `Image` root.assetImage(`String` image)
*TODO*
Returns an image.
#### `Json` root.assetFrames(`String` imagePath)
Returns an array containing a `file` (the frames file used for the image) and `frames` (the frame data of the image).
#### `JsonArray` root.assetPatches(`String` asset)
@ -112,6 +116,131 @@ Sets a configuration value in `/storage/starbound.config` by path.
Returns all recipes.
---
# Interface
The interface table contains bindings which allow scripts to display a message at the bottom of the screen, among other things.
#### `void` interface.queueMessage(`String` message, [`float` cooldown, [`float` springState]])
Queues a message popup at the bottom of the screen with an optional **cooldown** and **springState**.
#### `void` interface.setHudVisible(`bool` visible)
Sets the HUD's visibility.
#### `bool` interface.hudVisible()
Returns the HUD's visibility.
#### `PaneId` interface.bindRegisteredPane(`string` paneName)
Binds a registered pane (defined in `/source/frontend/StarMainInterfaceTypes`) to a Lua value, which can then call widget functions on that pane.
<details><summary><b>Panes</b></summary>
EscapeDialog<br>
Inventory<br>
Codex<br>
Cockpit<br>
Tech<br>
Songbook<br>
Ai<br>
Popup<br>
Confirmation<br>
JoinRequest<br>
Options<br>
QuestLog<br>
ActionBar<br>
TeamBar<br>
StatusPane<br>
Chat<br>
WireInterface<br>
PlanetText<br>
RadioMessagePopup<br>
CraftingPlain<br>
QuestTracker<br>
MmUpgrade<br>
Collections<br>
</details>
#### `void` interface.displayRegisteredPane(`string` paneName)
Displays a registered pane.
#### `?` interface.bindCanvas()
TODO
#### `int` interface.scale()
Returns the scale used for interfaces.
---
# World
The world table now contains extra bindings.
---
#### `bool` world.isServer()
Returns whether the script is running on the server or client.
---
#### `bool` world.isClient()
Returns whether the script is running on the server or client.
---
The following additional world bindings are available only for scripts running on the client.
---
#### `entityId` world.mainPlayer()
Returns the entity ID of the player hosting the world.
---
#### `Vec2F` world.entityAimPosition(`entityId` entityId)
Returns the current cursor aim position of the specified entity.
---
#### `bool` world.inWorld()
Returns whether any players are in the world.
---
The following additional world bindings are available only for scripts running on the server.
---
#### `void` world.setExpiryTime(`float` expiryTime)
Sets the amount of time to persist a ephemeral world when it is inactive.
---
#### `string` world.id()
Returns a `String` representation of the world's id.
---
#### `?` world.callScriptContext(`?` ?)
TODO
---
#### `?` world.sendPacket(`?` ?)
?
---
# Player
@ -392,9 +521,9 @@ Returns whether the specified item can enter the specified item bag.
Returns the contents of the specified action bar link slot's specified hand.
#### `bool` player.setActionBarSlotLink(`String` itemBagName, `ItemDescriptor` item)
#### `bool` player.setActionBarSlotLink(`int` slot, `String` hand, `ItemSlot` itemSlot)
Returns whether the specified item can enter the specified item bag.
Links the specified slot's hand to the specified itemSlot.
---
@ -413,3 +542,64 @@ Sets the player's interact radius. This does not persist upon returning to the m
Returns all the recipes the player can craft with their currently held items and currencies.
---
#### `String` player.currentState()
Returns the player's current movement state.
<details><summary><b>Player States</b></summary>
idle<br>
walk<br>
run<br>
jump<br>
fall<br>
swim<br>
swimIdle<br>
lounge<br>
crouch<br>
teleportIn<br>
teleportOut<br>
</details>
---
#### `List<Json>` player.teamMembers()
Returns an array, each entry being a table with `name`, `uuid`, `entity`, `healthPercentage` and `energyPercentage`
---
# Renderer
The new renderer table is accessible from almost every clientside script and allows configuring shaders.
---
#### `void` renderer.setPostProcessGroupEnabled(String group, bool enabled, [bool save])
Enables or disables a post process shader group. If save is true, this change is saved to configuration as well.
---
#### `bool` renderer.postProcessGroupEnabled(String group)
Returns true if the specified post process group is enabled.
---
#### `Json` renderer.postProcessGroups()
Returns every post process group. Identical to grabbing them from client.config with root.assetJson.
---
#### `Json` renderer.setEffectParameter(String effectName, String parameterName, RenderEffectParameter value)
Sets the specified scriptable parameter of the specified shader effect to the provided value.
This is accessed from the shader as a uniform and must be defined in the effect's configuration.
---
#### `RenderEffectParameter` renderer.getEffectParameter(String effectName, String parameterName)
Returns the specified scriptable parameter of the specified shader effect.
---

View File

@ -51,6 +51,5 @@ cp \
scripts/steam_appid.txt \
server_distribution/linux/
tar -cvf dist.tar dist
tar -cvf client.tar client_distribution
tar -cvf server.tar server_distribution

View File

@ -80,6 +80,8 @@ if(NOT DEFINED STAR_SYSTEM)
set(STAR_SYSTEM "linux")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(STAR_SYSTEM "freebsd")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
set(STAR_SYSTEM "netbsd")
elseif(UNIX)
set(STAR_SYSTEM "unix")
else()
@ -208,6 +210,8 @@ elseif(STAR_SYSTEM STREQUAL "linux")
set_flag(STAR_SYSTEM_LINUX)
elseif(STAR_SYSTEM STREQUAL "freebsd")
set_flag(STAR_SYSTEM_FREEBSD)
elseif(STAR_SYSTEM STREQUAL "netbsd")
set_flag(STAR_SYSTEM_NETBSD)
endif()
if(STAR_SYSTEM_FAMILY STREQUAL "windows")
@ -281,14 +285,14 @@ if(STAR_COMPILER_GNU)
set(CMAKE_C_FLAGS_DEBUG "-g -Og")
set(CMAKE_CXX_FLAGS_DEBUG "-g -Og")
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast")
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast")
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_SKIP_BUILD_RPATH TRUE)
@ -312,14 +316,14 @@ elseif(STAR_COMPILER_CLANG)
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast")
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast")
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_SKIP_BUILD_RPATH TRUE)
@ -445,6 +449,10 @@ elseif(STAR_SYSTEM_FREEBSD)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt")
elseif(STAR_SYSTEM_NETBSD)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt -lexecinfo")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt -lexecinfo")
endif()
# Find all required external libraries, based on build settings...

View File

@ -46,12 +46,14 @@
"displayName": "Linux x64",
"binaryDir": "${sourceParentDir}/build/linux-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"VCPKG_TARGET_TRIPLET": "x64-linux-mixed",
"CMAKE_INCLUDE_PATH": "${sourceParentDir}/lib/linux/include",
"CMAKE_LIBRARY_PATH": "${sourceParentDir}/lib/linux",
"STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX": true,
"STAR_USE_JEMALLOC": true
"STAR_USE_JEMALLOC": false
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {

View File

@ -315,9 +315,11 @@ public:
SDL_GetWindowSize(m_sdlWindow, &width, &height);
m_windowSize = Vec2U(width, height);
#ifdef __APPLE__
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#endif
m_sdlGlContext = SDL_GL_CreateContext(m_sdlWindow);
if (!m_sdlGlContext)

View File

@ -120,7 +120,7 @@ public:
virtual void set(List<RenderPrimitive>& primitives) = 0;
};
typedef Variant<bool, int, float, Vec2F, Vec3F, Vec4F> RenderEffectParameter;
typedef Variant<float, int, Vec2F, Vec3F, Vec4F, bool> RenderEffectParameter;
class Renderer {
public:
@ -141,6 +141,9 @@ public:
// The effect config will specify named parameters and textures which can be
// set here.
virtual void setEffectParameter(String const& parameterName, RenderEffectParameter const& parameter) = 0;
virtual void setEffectScriptableParameter(String const& effectName, String const& parameterName, RenderEffectParameter const& parameter) = 0;
virtual Maybe<RenderEffectParameter> getEffectScriptableParameter(String const& effectName, String const& parameterName) = 0;
virtual Maybe<VariantTypeIndex> getEffectScriptableParameterType(String const& effectName, String const& parameterName) = 0;
virtual void setEffectTexture(String const& textureName, ImageView const& image) = 0;
virtual bool switchEffectConfig(String const& name) = 0;

View File

@ -107,8 +107,10 @@ OpenGlRenderer::OpenGlRenderer() {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_DEPTH_TEST);
if (GLEW_VERSION_4_3) {
//glEnable(GL_DEBUG_OUTPUT);
//glDebugMessageCallback(GlMessageCallback, this);
}
m_whiteTexture = createGlTexture(Image::filled({1, 1}, Vec4B(255, 255, 255, 255), PixelFormat::RGBA32),
TextureAddressing::Clamp,
@ -306,8 +308,25 @@ void OpenGlRenderer::loadEffectConfig(String const& name, Json const& effectConf
throw RendererException::format("Unrecognized effect parameter type '{}'", type);
}
if (p.second.getBool("scriptable",false)) {
if (Json def = p.second.get("default", {})) {
if (type == "bool") {
effectParameter.parameterValue = (RenderEffectParameter)def.toBool();
} else if (type == "int") {
effectParameter.parameterValue = (RenderEffectParameter)(int)def.toInt();
} else if (type == "float") {
effectParameter.parameterValue = (RenderEffectParameter)def.toFloat();
} else if (type == "vec2") {
effectParameter.parameterValue = (RenderEffectParameter)jsonToVec2F(def);
} else if (type == "vec3") {
effectParameter.parameterValue = (RenderEffectParameter)jsonToVec3F(def);
} else if (type == "vec4") {
effectParameter.parameterValue = (RenderEffectParameter)jsonToVec4F(def);
}
}
effect.scriptables[p.first] = effectParameter;
} else {
effect.parameters[p.first] = effectParameter;
if (Json def = p.second.get("default", {})) {
if (type == "bool") {
setEffectParameter(p.first, def.toBool());
@ -325,6 +344,7 @@ void OpenGlRenderer::loadEffectConfig(String const& name, Json const& effectConf
}
}
}
}
// Assign each texture parameter a texture unit starting with MultiTextureCount, the first
// few texture units are used by the primary textures being drawn. Currently,
@ -382,6 +402,50 @@ void OpenGlRenderer::setEffectParameter(String const& parameterName, RenderEffec
ptr->parameterValue = value;
}
void OpenGlRenderer::setEffectScriptableParameter(String const& effectName, String const& parameterName, RenderEffectParameter const& value) {
auto find = m_effects.find(effectName);
if (find == m_effects.end())
return;
Effect& effect = find->second;
auto ptr = effect.scriptables.ptr(parameterName);
if (!ptr || (ptr->parameterValue && *ptr->parameterValue == value))
return;
if (ptr->parameterType != value.typeIndex())
throw RendererException::format("OpenGlRenderer::setEffectScriptableParameter '{}' parameter type mismatch", parameterName);
ptr->parameterValue = value;
}
Maybe<RenderEffectParameter> OpenGlRenderer::getEffectScriptableParameter(String const& effectName, String const& parameterName) {
auto find = m_effects.find(effectName);
if (find == m_effects.end())
return {};
Effect& effect = find->second;
auto ptr = effect.scriptables.ptr(parameterName);
if (!ptr)
return {};
return ptr->parameterValue;
}
Maybe<VariantTypeIndex> OpenGlRenderer::getEffectScriptableParameterType(String const& effectName, String const& parameterName) {
auto find = m_effects.find(effectName);
if (find == m_effects.end())
return {};
Effect& effect = find->second;
auto ptr = effect.scriptables.ptr(parameterName);
if (!ptr)
return {};
return ptr->parameterType;
}
void OpenGlRenderer::setEffectTexture(String const& textureName, ImageView const& image) {
auto ptr = m_currentEffect->textures.ptr(textureName);
if (!ptr)
@ -1061,6 +1125,26 @@ void OpenGlRenderer::setupGlUniforms(Effect& effect, Vec2U screenSize) {
}
glUniform2f(m_screenSizeUniform, screenSize[0], screenSize[1]);
for (auto& param : effect.scriptables) {
auto ptr = &param.second;
auto mvalue = ptr->parameterValue;
if (mvalue) {
RenderEffectParameter value = mvalue.value();
if (auto v = value.ptr<bool>())
glUniform1i(ptr->parameterUniform, *v);
else if (auto v = value.ptr<int>())
glUniform1i(ptr->parameterUniform, *v);
else if (auto v = value.ptr<float>())
glUniform1f(ptr->parameterUniform, *v);
else if (auto v = value.ptr<Vec2F>())
glUniform2f(ptr->parameterUniform, (*v)[0], (*v)[1]);
else if (auto v = value.ptr<Vec3F>())
glUniform3f(ptr->parameterUniform, (*v)[0], (*v)[1], (*v)[2]);
else if (auto v = value.ptr<Vec4F>())
glUniform4f(ptr->parameterUniform, (*v)[0], (*v)[1], (*v)[2], (*v)[3]);
}
}
}
RefPtr<OpenGlRenderer::GlFrameBuffer> OpenGlRenderer::getGlFrameBuffer(String const& id) {

View File

@ -25,6 +25,9 @@ public:
void loadEffectConfig(String const& name, Json const& effectConfig, StringMap<String> const& shaders) override;
void setEffectParameter(String const& parameterName, RenderEffectParameter const& parameter) override;
void setEffectScriptableParameter(String const& effectName, String const& parameterName, RenderEffectParameter const& parameter) override;
Maybe<RenderEffectParameter> getEffectScriptableParameter(String const& effectName, String const& parameterName) override;
Maybe<VariantTypeIndex> getEffectScriptableParameterType(String const& effectName, String const& parameterName) override;
void setEffectTexture(String const& textureName, ImageView const& image) override;
void setScissorRect(Maybe<RectI> const& scissorRect) override;
@ -191,6 +194,7 @@ private:
GLuint program = 0;
Json config;
StringMap<EffectParameter> parameters;
StringMap<EffectParameter> scriptables; // scriptable parameters which can be changed when the effect is not loaded
StringMap<EffectTexture> textures;
StringMap<GLuint> attributes;

View File

@ -18,7 +18,6 @@ SET (star_base_HEADERS
StarMixer.hpp
StarPackedAssetSource.hpp
StarRootBase.hpp
StarVersion.hpp
StarVersionOptionParser.hpp
StarWorldGeometry.hpp
scripting/StarImageLuaBindings.hpp
@ -40,8 +39,7 @@ SET (star_base_SOURCES
scripting/StarImageLuaBindings.cpp
)
CONFIGURE_FILE (StarVersion.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/StarVersion.cpp)
ADD_LIBRARY (star_base OBJECT ${star_base_SOURCES} ${star_base_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/StarVersion.cpp)
ADD_LIBRARY (star_base OBJECT ${star_base_SOURCES} ${star_base_HEADERS})
IF(STAR_PRECOMPILED_HEADERS)
TARGET_PRECOMPILE_HEADERS (star_base REUSE_FROM star_core)

View File

@ -68,7 +68,7 @@ static void validatePath(AssetPath const& components, bool canContainSubPath, bo
throw AssetException::format("Path '{}' cannot contain directives", components);
}
static void validatePath(StringView const& path, bool canContainSubPath, bool canContainDirectives) {
static void validatePath(StringView path, bool canContainSubPath, bool canContainDirectives) {
std::string_view const& str = path.utf8();
size_t end = str.find_first_of(":?");
@ -102,6 +102,14 @@ Maybe<RectU> FramesSpecification::getRect(String const& frame) const {
}
}
Json FramesSpecification::toJson() const {
return JsonObject{
{"aliases", jsonFromMap(aliases)},
{"frames", jsonFromMapV(frames, jsonFromRectU)},
{"file", framesFile}
};
}
Assets::Assets(Settings settings, StringList assetSources) {
const char* AssetsPatchSuffix = ".patch";
const char* AssetsPatchListSuffix = ".patchlist";
@ -139,6 +147,12 @@ Assets::Assets(Settings settings, StringList assetSources) {
return *assetImage;
});
callbacks.registerCallback("frames", [this](String const& path) -> Json {
if (auto frames = imageFrames(path))
return frames->toJson();
return Json();
});
callbacks.registerCallback("scan", [this](Maybe<String> const& a, Maybe<String> const& b) -> StringList {
return b ? scan(a.value(), *b) : scan(a.value());
});

View File

@ -27,7 +27,8 @@ struct FramesSpecification {
// Get the target sub-rect of a given frame name (which can be an alias).
// Returns nothing if the frame name is not found.
Maybe<RectU> getRect(String const& frame) const;
// Converts to Json.
Json toJson() const;
// The full path to the .frames file from which this was loaded.
String framesFile;
// Named sub-frames

View File

@ -12,10 +12,12 @@ INCLUDE_DIRECTORIES (
SET (star_client_HEADERS
StarClientApplication.hpp
StarRenderingLuaBindings.hpp
)
SET (star_client_SOURCES
StarClientApplication.cpp
StarRenderingLuaBindings.cpp
)
IF (STAR_SYSTEM_WINDOWS)
@ -34,7 +36,11 @@ IF(STAR_PRECOMPILED_HEADERS)
ENDIF()
IF (UNIX)
set_target_properties (starbound PROPERTIES LINK_FLAGS "-Wl,-rpath,'$ORIGIN'")
SET_TARGET_PROPERTIES (starbound PROPERTIES LINK_FLAGS "-Wl,-rpath,'$ORIGIN'")
ENDIF()
IF (STAR_SYSTEM_MACOS)
SET_TARGET_PROPERTIES (starbound PROPERTIES XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
ENDIF()
TARGET_LINK_LIBRARIES (starbound ${STAR_EXT_LIBS} ${STAR_EXT_GUI_LIBS})

View File

@ -22,7 +22,9 @@
#include "StarInterfaceLuaBindings.hpp"
#include "StarInputLuaBindings.hpp"
#include "StarVoiceLuaBindings.hpp"
#include "StarCameraLuaBindings.hpp"
#include "StarClipboardLuaBindings.hpp"
#include "StarRenderingLuaBindings.hpp"
#if defined STAR_SYSTEM_WINDOWS
#include <windows.h>
@ -404,6 +406,7 @@ void ClientApplication::render() {
auto size = Vec2F(renderer->screenSize());
auto quad = renderFlatRect(RectF::withSize(size / -2, size), Vec4B::filled(0), 0.0f);
for (auto& layer : m_postProcessLayers) {
if (layer.group ? layer.group->enabled : true) {
for (unsigned i = 0; i < layer.passes; i++) {
for (auto& effect : layer.effects) {
renderer->switchEffectConfig(effect);
@ -412,6 +415,7 @@ void ClientApplication::render() {
}
}
}
}
renderer->switchEffectConfig("interface");
auto start = Time::monotonicMicroseconds();
m_mainInterface->renderInWorldElements();
@ -433,6 +437,8 @@ void ClientApplication::getAudioData(int16_t* sampleData, size_t frameCount) {
}
}
auto postProcessGroupsRoot = "postProcessGroups";
void ClientApplication::renderReload() {
auto assets = m_root->assets();
auto renderer = Application::renderer();
@ -463,18 +469,55 @@ void ClientApplication::renderReload() {
loadEffectConfig("world");
// define post process groups and set them to be enabled/disabled based on config
auto config = m_root->configuration();
if (!config->get(postProcessGroupsRoot).isType(Json::Type::Object))
config->set(postProcessGroupsRoot, JsonObject());
auto groupsConfig = config->get(postProcessGroupsRoot);
m_postProcessGroups.clear();
auto postProcessGroups = assets->json("/client.config:postProcessGroups").toObject();
for (auto& pair : postProcessGroups) {
auto name = pair.first;
auto groupConfig = groupsConfig.opt(name);
auto def = pair.second.getBool("enabledDefault",true);
if (!groupConfig)
config->setPath(strf("{}.{}", postProcessGroupsRoot, name),JsonObject());
m_postProcessGroups.add(name,PostProcessGroup{ groupConfig ? groupConfig.value().getBool("enabled", def) : def });
}
// define post process layers and optionally assign them to groups
m_postProcessLayers.clear();
auto postProcessLayers = assets->json("/client.config:postProcessLayers").toArray();
for (auto& layer : postProcessLayers) {
auto effects = jsonToStringList(layer.getArray("effects"));
for (auto& effect : effects)
loadEffectConfig(effect);
m_postProcessLayers.append(PostProcessLayer{ std::move(effects), (unsigned)layer.getUInt("passes", 1) });
PostProcessGroup* group = nullptr;
auto gname = layer.optString("group");
if (gname) {
group = &m_postProcessGroups.get(gname.value());
}
m_postProcessLayers.append(PostProcessLayer{ std::move(effects), (unsigned)layer.getUInt("passes", 1), group });
}
loadEffectConfig("interface");
}
void ClientApplication::setPostProcessGroupEnabled(String group, bool enabled, Maybe<bool> save) {
m_postProcessGroups.get(group).enabled = enabled;
if (save && save.value())
m_root->configuration()->setPath(strf("{}.{}.enabled", postProcessGroupsRoot, group),enabled);
}
bool ClientApplication::postProcessGroupEnabled(String group) {
return m_postProcessGroups.get(group).enabled;
}
Json ClientApplication::postProcessGroups() {
return m_root->assets()->json("/client.config:postProcessGroups");
}
void ClientApplication::changeState(MainAppState newState) {
MainAppState oldState = m_state;
m_state = newState;
@ -541,8 +584,11 @@ void ClientApplication::changeState(MainAppState newState) {
m_universeClient->setLuaCallbacks("input", LuaBindings::makeInputCallbacks());
m_universeClient->setLuaCallbacks("voice", LuaBindings::makeVoiceCallbacks());
if (!m_root->configuration()->get("safeScripts").toBool())
m_universeClient->setLuaCallbacks("clipboard", LuaBindings::makeClipboardCallbacks(appController()));
m_universeClient->setLuaCallbacks("camera", LuaBindings::makeCameraCallbacks(&m_worldPainter->camera()));
m_universeClient->setLuaCallbacks("renderer", LuaBindings::makeRenderingCallbacks(this));
Json alwaysAllow = m_root->configuration()->getPath("safe.alwaysAllowClipboard");
m_universeClient->setLuaCallbacks("clipboard", LuaBindings::makeClipboardCallbacks(appController(), alwaysAllow && alwaysAllow.toBool()));
auto heldScriptPanes = make_shared<List<MainInterface::ScriptPaneInfo>>();
@ -565,7 +611,7 @@ void ClientApplication::changeState(MainAppState newState) {
};
m_mainMixer->setUniverseClient(m_universeClient);
m_titleScreen = make_shared<TitleScreen>(m_playerStorage, m_mainMixer->mixer());
m_titleScreen = make_shared<TitleScreen>(m_playerStorage, m_mainMixer->mixer(), m_universeClient);
if (auto renderer = Application::renderer())
m_titleScreen->renderInit(renderer);
}
@ -682,8 +728,9 @@ void ClientApplication::changeState(MainAppState newState) {
m_mainInterface = make_shared<MainInterface>(m_universeClient, m_worldPainter, m_cinematicOverlay);
m_universeClient->setLuaCallbacks("interface", LuaBindings::makeInterfaceCallbacks(m_mainInterface.get()));
m_universeClient->setLuaCallbacks("chat", LuaBindings::makeChatCallbacks(m_mainInterface.get(), m_universeClient.get()));
m_universeClient->startLua();
m_mainInterface->displayDefaultPanes();
m_universeClient->startLua();
m_mainMixer->setWorldPainter(m_worldPainter);
if (auto renderer = Application::renderer()) {

View File

@ -18,6 +18,11 @@ STAR_CLASS(Input);
STAR_CLASS(Voice);
class ClientApplication : public Application {
public:
void setPostProcessGroupEnabled(String group, bool enabled, Maybe<bool> save);
bool postProcessGroupEnabled(String group);
Json postProcessGroups();
protected:
virtual void startup(StringList const& cmdLineArgs) override;
virtual void shutdown() override;
@ -53,9 +58,14 @@ private:
String password;
};
struct PostProcessGroup {
bool enabled;
};
struct PostProcessLayer {
List<String> effects;
unsigned passes;
PostProcessGroup* group;
};
void renderReload();
@ -104,6 +114,7 @@ private:
WorldRenderData m_renderData;
MainInterfacePtr m_mainInterface;
StringMap<PostProcessGroup> m_postProcessGroups;
List<PostProcessLayer> m_postProcessLayers;
// Valid if main app state == SinglePlayer

View File

@ -0,0 +1,45 @@
#include "StarRenderingLuaBindings.hpp"
#include "StarJsonExtra.hpp"
#include "StarLuaConverters.hpp"
#include "StarClientApplication.hpp"
#include "StarRenderer.hpp"
namespace Star {
LuaCallbacks LuaBindings::makeRenderingCallbacks(ClientApplication* app) {
LuaCallbacks callbacks;
// if the last argument is defined and true, this change will also be saved to starbound.config and read on next game start, use for things such as an interface that does this
callbacks.registerCallbackWithSignature<void, String, bool, Maybe<bool>>("setPostProcessGroupEnabled", bind(mem_fn(&ClientApplication::setPostProcessGroupEnabled), app, _1, _2, _3));
callbacks.registerCallbackWithSignature<bool, String>("postProcessGroupEnabled", bind(mem_fn(&ClientApplication::postProcessGroupEnabled), app, _1));
// not entirely necessary (root.assetJson can achieve the same purpose) but may as well
callbacks.registerCallbackWithSignature<Json>("postProcessGroups", bind(mem_fn(&ClientApplication::postProcessGroups), app));
// typedef Variant<float, int, Vec2F, Vec3F, Vec4F, bool> RenderEffectParameter;
// feel free to change this if there's a better way to do this
// specifically checks if the effect parameter is an int since Lua prefers converting the values to floats
callbacks.registerCallback("setEffectParameter", [app](String const& effectName, String const& effectParameter, RenderEffectParameter const& value) {
auto renderer = app->renderer();
auto mtype = renderer->getEffectScriptableParameterType(effectName, effectParameter);
if (mtype) {
auto type = mtype.value();
if (type == 1 && value.is<float>()) {
renderer->setEffectScriptableParameter(effectName, effectParameter, (int)value.get<float>());
} else {
renderer->setEffectScriptableParameter(effectName, effectParameter, value);
}
}
});
callbacks.registerCallback("getEffectParameter", [app](String const& effectName, String const& effectParameter) {
auto renderer = app->renderer();
return renderer->getEffectScriptableParameter(effectName, effectParameter);
});
return callbacks;
}
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "StarLua.hpp"
namespace Star {
STAR_CLASS(ClientApplication);
namespace LuaBindings {
LuaCallbacks makeRenderingCallbacks(ClientApplication* app);
}
}

View File

@ -41,6 +41,7 @@ SET (star_core_HEADERS
StarIdMap.hpp
StarImage.hpp
StarImageProcessing.hpp
StarImageScaling.hpp
StarInputEvent.hpp
StarInterpolation.hpp
StarRefPtr.hpp
@ -70,10 +71,12 @@ SET (star_core_HEADERS
StarMultiArray.hpp
StarMultiArrayInterpolator.hpp
StarMultiTable.hpp
StarNetCompatibility.hpp
StarNetElement.hpp
StarNetElementBasicFields.hpp
StarNetElementContainers.hpp
StarNetElementDynamicGroup.hpp
StarNetElementExt.hpp
StarNetElementFloatFields.hpp
StarNetElementGroup.hpp
StarNetElementSignal.hpp
@ -122,6 +125,7 @@ SET (star_core_HEADERS
StarUnicode.hpp
StarUuid.hpp
StarVector.hpp
StarVersion.hpp
StarVlqEncoding.hpp
StarWeightedPool.hpp
StarWorkerPool.hpp
@ -149,6 +153,7 @@ SET (star_core_SOURCES
StarIODevice.cpp
StarImage.cpp
StarImageProcessing.cpp
StarImageScaling.cpp
StarInputEvent.cpp
StarJson.cpp
StarJsonBuilder.cpp
@ -157,11 +162,13 @@ SET (star_core_SOURCES
StarJsonPatch.cpp
StarJsonRpc.cpp
StarFormattedJson.cpp
StarLexicalCast.cpp
StarListener.cpp
StarLogging.cpp
StarLua.cpp
StarLuaConverters.cpp
StarMemory.cpp
StarNetCompatibility.cpp
StarNetElement.cpp
StarNetElementBasicFields.cpp
StarNetElementGroup.cpp
@ -217,7 +224,8 @@ ELSEIF (STAR_SYSTEM_FAMILY_WINDOWS)
ENDIF ()
ADD_LIBRARY (star_core OBJECT ${star_core_SOURCES} ${star_core_HEADERS})
CONFIGURE_FILE (StarVersion.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/StarVersion.cpp)
ADD_LIBRARY (star_core OBJECT ${star_core_SOURCES} ${star_core_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/StarVersion.cpp)
IF(STAR_PRECOMPILED_HEADERS)
TARGET_PRECOMPILE_HEADERS (star_core PUBLIC StarPch.hpp)

View File

@ -1,6 +1,7 @@
#include "StarBTreeDatabase.hpp"
#include "StarSha256.hpp"
#include "StarVlqEncoding.hpp"
#include "StarLogging.hpp"
namespace Star {
@ -243,7 +244,7 @@ uint32_t BTreeDatabase::freeBlockCount() {
indexBlockIndex = indexBlock.nextFreeBlock;
}
count += m_availableBlocks.size() + m_pendingFree.size();
count += m_availableBlocks.size();
// Include untracked blocks at the end of the file in the free count.
count += (m_device->size() - m_deviceSize) / m_blockSize;
@ -272,7 +273,7 @@ uint32_t BTreeDatabase::leafBlockCount() {
return true;
}
BTreeDatabase* parent;
BTreeDatabase* parent = nullptr;
BlockIndex leafBlockCount = 0;
};
@ -293,8 +294,8 @@ void BTreeDatabase::rollback() {
m_availableBlocks.clear();
m_indexCache.clear();
m_uncommittedWrites.clear();
m_uncommitted.clear();
m_pendingFree.clear();
readRoot();
@ -305,6 +306,7 @@ void BTreeDatabase::rollback() {
void BTreeDatabase::close(bool closeDevice) {
WriteLocker writeLocker(m_lock);
if (m_open) {
if (!tryFlatten())
doCommit();
m_indexCache.clear();
@ -896,17 +898,25 @@ void BTreeDatabase::rawReadBlock(BlockIndex blockIndex, size_t blockOffset, char
if (size <= 0)
return;
if (auto buffer = m_uncommittedWrites.ptr(blockIndex))
buffer->copyTo(block, blockOffset, size);
else
m_device->readFullAbsolute(HeaderSize + blockIndex * (StreamOffset)m_blockSize + blockOffset, block, size);
}
void BTreeDatabase::rawWriteBlock(BlockIndex blockIndex, size_t blockOffset, char const* block, size_t size) const {
void BTreeDatabase::rawWriteBlock(BlockIndex blockIndex, size_t blockOffset, char const* block, size_t size) {
if (blockOffset > m_blockSize || size > m_blockSize - blockOffset)
throw DBException::format("Write past end of block, offset: {} size {}", blockOffset, size);
if (size <= 0)
return;
m_device->writeFullAbsolute(HeaderSize + blockIndex * (StreamOffset)m_blockSize + blockOffset, block, size);
StreamOffset blockStart = HeaderSize + blockIndex * (StreamOffset)m_blockSize;
auto buffer = m_uncommittedWrites.find(blockIndex);
if (buffer == m_uncommittedWrites.end())
buffer = m_uncommittedWrites.emplace(blockIndex, m_device->readBytesAbsolute(blockStart, m_blockSize)).first;
buffer->second.writeFrom(block, blockOffset, size);
}
auto BTreeDatabase::readFreeIndexBlock(BlockIndex blockIndex) -> FreeIndexBlock {
@ -991,12 +1001,12 @@ auto BTreeDatabase::leafTailBlocks(BlockIndex leafPointer) -> List<BlockIndex> {
}
void BTreeDatabase::freeBlock(BlockIndex b) {
if (m_uncommitted.contains(b)) {
if (m_uncommitted.contains(b))
m_uncommitted.remove(b);
if (m_uncommittedWrites.contains(b))
m_uncommittedWrites.remove(b);
m_availableBlocks.add(b);
} else {
m_pendingFree.append(b);
}
}
auto BTreeDatabase::reserveBlock() -> BlockIndex {
@ -1007,10 +1017,7 @@ auto BTreeDatabase::reserveBlock() -> BlockIndex {
FreeIndexBlock indexBlock = readFreeIndexBlock(m_headFreeIndexBlock);
for (auto const& b : indexBlock.freeBlocks)
m_availableBlocks.add(b);
// We cannot make available the block itself, because we must maintain
// atomic consistency. We will need to free this block later and commit
// the new free index block chain.
m_pendingFree.append(m_headFreeIndexBlock);
m_availableBlocks.add(m_headFreeIndexBlock);
m_headFreeIndexBlock = indexBlock.nextFreeBlock;
}
@ -1068,65 +1075,168 @@ void BTreeDatabase::readRoot() {
}
void BTreeDatabase::doCommit() {
if (m_availableBlocks.empty() && m_pendingFree.empty() && m_uncommitted.empty())
if (m_availableBlocks.empty() && m_uncommitted.empty())
return;
if (!m_availableBlocks.empty() || !m_pendingFree.empty()) {
if (!m_availableBlocks.empty()) {
// First, read the existing head FreeIndexBlock, if it exists
FreeIndexBlock indexBlock = FreeIndexBlock{InvalidBlockIndex, {}};
if (m_headFreeIndexBlock != InvalidBlockIndex) {
indexBlock = readFreeIndexBlock(m_headFreeIndexBlock);
if (indexBlock.freeBlocks.size() >= maxFreeIndexLength()) {
// If the existing head free index block is full, then we should start a
// new one and leave it alone
indexBlock.nextFreeBlock = m_headFreeIndexBlock;
indexBlock.freeBlocks.clear();
} else {
// If we are copying an existing free index block, the old free index
// block will be a newly freed block
indexBlock.freeBlocks.append(m_headFreeIndexBlock);
}
}
// Then, we need to write all the available blocks, which are safe to write
// to, and the pending free blocks, which are NOT safe to write to, to the
// FreeIndexBlock chain.
while (true) {
if (indexBlock.freeBlocks.size() < maxFreeIndexLength() && (!m_availableBlocks.empty() || !m_pendingFree.empty())) {
// If we have room on our current FreeIndexblock, just add a block to
// it. Prioritize the pending free blocks, because we cannot use those
// to write to.
BlockIndex toAdd;
if (m_pendingFree.empty())
toAdd = m_availableBlocks.takeFirst();
auto newBlock = [&]() -> BlockIndex {
if (!m_availableBlocks.empty())
return m_availableBlocks.takeFirst();
else
toAdd = m_pendingFree.takeFirst();
return makeEndBlock();
};
if (m_headFreeIndexBlock != InvalidBlockIndex)
indexBlock = readFreeIndexBlock(m_headFreeIndexBlock);
else
m_headFreeIndexBlock = newBlock();
// Then, we need to write all the available blocks to the FreeIndexBlock chain.
while (true) {
// If we have room on our current FreeIndexBlock, just add a block to it.
if (!m_availableBlocks.empty() && indexBlock.freeBlocks.size() < maxFreeIndexLength()) {
BlockIndex toAdd = m_availableBlocks.takeFirst();
indexBlock.freeBlocks.append(toAdd);
} else {
// If our index block is full OR we are out of blocks to free, then
// need to write a new head free index block.
if (m_availableBlocks.empty())
m_headFreeIndexBlock = makeEndBlock();
else
m_headFreeIndexBlock = m_availableBlocks.takeFirst();
// Update the current head free index block.
writeFreeIndexBlock(m_headFreeIndexBlock, indexBlock);
// If we're out of blocks to free, then we're done
if (m_availableBlocks.empty() && m_pendingFree.empty())
if (m_availableBlocks.empty())
break;
// If our head free index block is full, then
// need to write a new head free index block.
if (indexBlock.freeBlocks.size() >= maxFreeIndexLength()) {
indexBlock.nextFreeBlock = m_headFreeIndexBlock;
indexBlock.freeBlocks.clear();
m_headFreeIndexBlock = newBlock();
writeFreeIndexBlock(m_headFreeIndexBlock, indexBlock);
}
}
}
}
commitWrites();
writeRoot();
m_uncommitted.clear();
}
void BTreeDatabase::commitWrites() {
for (auto& write : m_uncommittedWrites)
m_device->writeFullAbsolute(HeaderSize + write.first * (StreamOffset)m_blockSize, write.second.ptr(), m_blockSize);
m_device->sync();
m_uncommittedWrites.clear();
}
bool BTreeDatabase::tryFlatten() {
if (m_headFreeIndexBlock == InvalidBlockIndex || m_rootIsLeaf || !m_device->isWritable())
return false;
BlockIndex freeBlockCount = 0;
BlockIndex indexBlockIndex = m_headFreeIndexBlock;
while (indexBlockIndex != InvalidBlockIndex) {
FreeIndexBlock indexBlock = readFreeIndexBlock(indexBlockIndex);
freeBlockCount += 1 + indexBlock.freeBlocks.size();
indexBlockIndex = indexBlock.nextFreeBlock;
}
BlockIndex expectedBlockCount = (m_deviceSize - HeaderSize) / m_blockSize;
float free = float(freeBlockCount) / float(expectedBlockCount);
if (free < 0.05f)
return false;
Logger::info("[BTreeDatabase] File '{}' is {:.2f}% free space, flattening", m_device->deviceName(), free * 100.f);
indexBlockIndex = m_headFreeIndexBlock;
{
List<BlockIndex> availableBlocksList;
do {
FreeIndexBlock indexBlock = readFreeIndexBlock(indexBlockIndex);
availableBlocksList.appendAll(indexBlock.freeBlocks);
availableBlocksList.append(indexBlockIndex);
indexBlockIndex = indexBlock.nextFreeBlock;
} while (indexBlockIndex != InvalidBlockIndex);
m_headFreeIndexBlock = InvalidBlockIndex;
sort(availableBlocksList);
for (auto& availableBlock : availableBlocksList)
m_availableBlocks.insert(m_availableBlocks.end(), availableBlock);
}
BlockIndex count = 1; // 1 to include root index
double start = Time::monotonicTime();
auto index = m_impl.loadIndex(m_impl.rootPointer());
if (flattenVisitor(index, count)) {
m_impl.deleteIndex(index);
index->self = InvalidBlockIndex;
m_root = m_impl.storeIndex(index);
}
m_availableBlocks.clear();
m_device->resize(m_deviceSize = HeaderSize + (StreamOffset)m_blockSize * count);
m_indexCache.clear();
commitWrites();
writeRoot();
m_uncommitted.clear();
Logger::info("[BTreeDatabase] Finished flattening '{}' in {:.2f} milliseconds", m_device->deviceName(), (Time::monotonicTime() - start) * 1000.f);
return true;
}
bool BTreeDatabase::flattenVisitor(BTreeImpl::Index& index, BlockIndex& count) {
auto pointerCount = index->pointerCount();
count += pointerCount;
bool canStore = !m_availableBlocks.empty();
bool needsStore = false;
if (m_impl.indexLevel(index) == 0) {
for (size_t i = 0; i != pointerCount; ++i) {
auto indexPointer = index->pointer(i);
auto tailBlocks = leafTailBlocks(indexPointer);
if (canStore) {
bool leafNeedsStore = m_availableBlocks.first() < indexPointer;
if (!leafNeedsStore)
for (size_t i = 0; !leafNeedsStore && i != tailBlocks.size(); ++i)
if (m_availableBlocks.first() < tailBlocks[i])
leafNeedsStore = true;
if (leafNeedsStore) {
auto leaf = m_impl.loadLeaf(indexPointer);
m_impl.deleteLeaf(leaf);
leaf->self = InvalidBlockIndex;
index->updatePointer(i, m_impl.storeLeaf(leaf));
tailBlocks = leafTailBlocks(leaf->self);
needsStore = true;
}
canStore = !m_availableBlocks.empty();
}
count += tailBlocks.size();
}
} else {
for (size_t i = 0; i != pointerCount; ++i) {
auto childIndex = m_impl.loadIndex(index->pointer(i));
if (canStore && flattenVisitor(childIndex, count)) {
m_impl.deleteIndex(childIndex);
childIndex->self = InvalidBlockIndex;
index->updatePointer(i, m_impl.storeIndex(childIndex));
canStore = !m_availableBlocks.empty();
needsStore = true;
}
}
}
return needsStore || (canStore && m_availableBlocks.first() < index->self);
}
void BTreeDatabase::checkIfOpen(char const* methodName, bool shouldBeOpen) const {
if (shouldBeOpen && !m_open)
throw DBException::format("BTreeDatabase method '{}' called when not open, must be open.", methodName);
@ -1146,7 +1256,7 @@ void BTreeDatabase::checkKeySize(ByteArray const& k) const {
}
uint32_t BTreeDatabase::maxFreeIndexLength() const {
return (m_blockSize - 2 - sizeof(BlockIndex) - 4) / sizeof(BlockIndex);
return (m_blockSize / sizeof(BlockIndex)) - 2 - sizeof(BlockIndex) - 4;
}
BTreeSha256Database::BTreeSha256Database() {

View File

@ -230,7 +230,7 @@ private:
void updateBlock(BlockIndex blockIndex, ByteArray const& block);
void rawReadBlock(BlockIndex blockIndex, size_t blockOffset, char* block, size_t size) const;
void rawWriteBlock(BlockIndex blockIndex, size_t blockOffset, char const* block, size_t size) const;
void rawWriteBlock(BlockIndex blockIndex, size_t blockOffset, char const* block, size_t size);
void updateHeadFreeIndexBlock(BlockIndex newHead);
@ -251,6 +251,9 @@ private:
void writeRoot();
void readRoot();
void doCommit();
void commitWrites();
bool tryFlatten();
bool flattenVisitor(BTreeImpl::Index& index, BlockIndex& count);
void checkIfOpen(char const* methodName, bool shouldBeOpen) const;
void checkBlockIndex(size_t blockIndex) const;
@ -285,14 +288,14 @@ private:
bool m_dirty;
// Blocks that can be freely allocated and written to without violating
// atomic consistency
// atomic consistency.
Set<BlockIndex> m_availableBlocks;
// Blocks to be freed on next commit.
Deque<BlockIndex> m_pendingFree;
// Blocks that have been written in uncommitted portions of the tree.
Set<BlockIndex> m_uncommitted;
// Temporarily holds written data so that it can be rolled back.
mutable Map<BlockIndex, ByteArray> m_uncommittedWrites;
};
// Version of BTreeDatabase that hashes keys with SHA-256 to produce a unique

View File

@ -322,6 +322,8 @@ Vec3F Color::toRgbF() const {
return Vec3F(redF(), greenF(), blueF());
}
#pragma GCC push_options
#pragma GCC optimize("-fno-fast-math")
Vec4F Color::toHsva() const {
float h, s, v;
@ -365,6 +367,7 @@ Vec4F Color::toHsva() const {
return Vec4F(h, s, v, alphaF());
}
#pragma GCC pop_options
String Color::toHex() const {
auto rgba = toRgba();

Some files were not shown because too many files have changed in this diff Show More