1594 Commits

Author SHA1 Message Date
Eero
9d6cb5225a Refactor server event processing and entity updates 2026-05-02 00:28:12 +08:00
NotAlwaysTrue
8b6da6b033 Added a null check for STW
Changed positions of notes
2026-04-30 22:35:30 +08:00
NotAlwaysTrue
02689d0d86 Refactor single-thread worker
Re-parallel Hull Update
Use new gap shaffle algorithm
2026-04-30 20:05:23 +08:00
NotAlwaysTrue
099d664731 Fixed issues bring by update 2026-04-25 13:21:25 +08:00
NotAlwaysTrue
1f7d695bba Removed LuaSafeUserData to sync with upstream 2026-04-25 13:11:05 +08:00
NotAlwaysTrue
50327a4d83 Merge branch 'heads/upstream' into OBT/1.2.0(SpringUpdate) 2026-04-25 13:08:16 +08:00
NotAlwaysTrue
9b35f6b23f Sync with upstream
* Update bug-reports.yml

* Fix modifyChatMessage hook

* Add LuaCsSetup.Lua back for compatibility

* Fix Game.AssignOnExecute having command arguments be passed as varargs instead of a table

* Actually use the PackageId const everywhere we need to refer to our content package

* Load languages files even if the package is disabled

* Fix Hook.Remove not being implemented properly

* - Changed event aliases to be case insensitive.

* - Fixed assembly logging style.
- Fixed double logging during execution.

* Fix garbage network data being read by the game when reading LuaCs network messages

* PackageId -> PackageName

* Added caching toggle to PluginManagementService

* Fix LuaCs initializing too late for singleplayer campaigns and rework the C# prompt to only show when enabling mods/joining server

* Oops, fix NRE crash

* Fix hide username in logs config not doing anything

* Fix Cs prompt showing up more than one between rounds

* Fix server host being prompted twice with the C# popup

* Ignore our workshop packages from the game's dependency thing since it doesn't really make sense

* Load console commands after executing and possible fix for the not console command permitted

* Added fallback friendly name resolution for ModConfig assembly contents.

* Register Voronoi2 stuff

* Added configinfo null check to SettingBase.cs

* Add safety check so this stops crashing when we look at it the wrong way

* Fixed "Folder" attribute files not being found.

* Keep the LuaCsConfig class laying around for compatibility, not sure anywhere in our code base (and shouldn't be)

* Added fallback compilation for UseInternalsAwareAssembly if the publicized script compilation fails.

* Added legacy overload of AddCommand for mod compat.

* Added LoggerService to Lua env. Made ILoggerService compliant with LuaCsLogger API.

* Changed csharp script compilation algorithm to be best effort.

* Added "RunUnrestricted" mode for lua scripts that need to run outside of sandbox.

* - Fixed networking sync vars failing to sync initially.
- Fixed lua failing to differentiate overloads ISettingBase.

* Add alias for human.CPRSuccess and human.CPRFailed

* - Fixed up the settings menu.
- Made SettingEntry throw an error if "Value" attribute is not found in XML.
- Fixed saved values for settings sometimes not reloading after disabling and re-enabling a package.

* Fix LuaCs net messages received during connection initialization to be read incorrectly, happened because we would reset the BitPosition in our harmony patch which would cause the message to be read incorrectly later

* Allow reloadlua to force the state to running

* New icon for settings and make the top left text more user friendly

* Fix client.packages hook sending normal packages

* Fixed OnUpdate() not passing in deltaTime instead of totalTime.

* Missing diffs from bb21a09244

* Added networking tests for configs.

* Added missing diffs for f61f852a25.

* Some tweaks to the text

* Remove missing Value error, it should just use the default value if it's not specified

* Fix UseInternalAccessName

* Always purge cashes for plugin content on unloading.

* Fix texture not multiple of 4

* v1.12.7.0 (Spring Update 2026 Hotfix 1)

---------

Co-authored-by: Joonas Rikkonen <poe.regalis@gmail.com>
Co-authored-by: Evil Factory <36804725+evilfactory@users.noreply.github.com>
Co-authored-by: MapleWheels <njainanan@hotmail.com>
2026-04-25 12:10:24 +08:00
Evil Factory
928cfb4fde Re-add loaded Lua hook call 2026-04-09 12:09:00 -03:00
Evil Factory
a9634988e9 Fix signalReceived hook not being called 2026-04-09 11:18:18 -03:00
MapleWheels
87e0191a97 - Debug tests. 2026-04-09 08:35:17 -04:00
Evil Factory
790378d2a5 Merge remote-tracking branch 'upstream/master' into develop 2026-04-09 09:12:16 -03:00
Regalis11
a4607dffad v1.12.6.2 (Spring Update 2026) 2026-04-09 15:10:07 +03:00
MapleWheels
ef66d27ffe - Fixed network synchro of vars, needs synctype testing. 2026-04-09 05:34:50 -04:00
MapleWheels
84cb7cfeb7 server auth var. 2026-04-09 01:29:48 -04:00
MapleWheels
53be3f0073 Fixed lua attempting to invoke the base interface type. 2026-04-08 19:49:57 -04:00
MapleWheels
89aa818c0b Made Config initialization errors more forgiving to noobs. 2026-04-08 19:38:31 -04:00
Evil Factory
3a5fbfde1e Fix cs enabled for session state not being preserved between reloads 2026-04-08 20:12:20 -03:00
Evil Factory
b9b457262f Test Lua config mod 2026-04-08 19:56:32 -03:00
Evil Factory
e161d92117 Fix settings not being properly exposed to Lua 2026-04-08 19:44:16 -03:00
MapleWheels
2e656509a8 - Added null check to get string value. 2026-04-08 17:53:12 -04:00
MapleWheels
b0b4acf392 - Made readonly readonly. 2026-04-08 17:29:56 -04:00
Evil Factory
e9673bf7f5 Update moonsharp 2026-04-08 18:29:29 -03:00
Evil Factory
eeeb3d9db3 Expose all settings in Lua 2026-04-08 18:29:07 -03:00
Evil Factory
c882b0bb45 Update moonsharp 2026-04-08 18:07:12 -03:00
Evil Factory
6c32873d4e Only register ILuaConfigService 2026-04-08 18:04:25 -03:00
MapleWheels
bdd4dcfb9e Disabled caching on the ConfigService. 2026-04-08 16:27:01 -04:00
MapleWheels
ebe8ec455f LuaCs CSharp Enabled Rework
- New UI for the prompt

- Third time's the charm.

- Fixed TOCTOU for cs prompt on main menu. - Fixed SubEditor not running lua when don't run is selected for cs.

- LuaCs CSharp Enabled Rework
2026-04-08 16:31:42 -03:00
Evil Factory
d440ccbce2 Register IConfigService and add back some missing APIs 2026-04-08 15:32:31 -03:00
MapleWheels
1294ba6dec - Added API to get package by name to PackageManagementService.cs and LuaScriptManagementService.cs
- Added ILuaConfigService to Lua API.
2026-04-08 11:03:52 -04:00
MapleWheels
4c8e016dea - Added extra source code translation (for CTS).
- Added localization to SettingList.cs display dropdown.
2026-04-08 08:09:45 -04:00
MapleWheels
232f7203e2 Fixed shared Csharp src files not being included if there weren't also architecture-specific files. 2026-04-07 16:07:55 -04:00
MapleWheels
df0a4e62f5 Added logging for additional plugin loading exceptions. 2026-04-07 15:43:01 -04:00
MapleWheels
7055480015 - Fixed publicized Barotrauma.dll missing error on DedicatedServer.
- Fixed non-implemented folder search for ModConfig resources.
2026-04-05 13:09:34 -04:00
Evil Factory
0e14983e88 Allow System.Console 2026-04-05 11:20:08 -03:00
Evil Factory
9b05c51ae5 Fix calling Hook.Call directly from Lua being broken 2026-04-04 22:52:27 -03:00
Evil Factory
5e003bcf11 Fix missing Game.Commands 2026-04-04 22:30:46 -03:00
Evil Factory
121f670c8b Fix character.death hook getting called a billion times per second 2026-04-04 13:04:34 -03:00
Evil Factory
f05d4ef129 Fic CSharp enabling message printing before config got loaded 2026-04-04 12:24:12 -03:00
Evil Factory
4167448279 Fix Game.Settings being nil 2026-04-04 11:50:35 -03:00
MapleWheels
413cc3ed4c - Added setting to disable lua scripts caching in the storage service for scenarios that use extern editors. 2026-04-02 23:29:21 -04:00
MapleWheels
4f2da55a8e - Added legacy LuaCsPerformanceCounter.cs
- Added legacy redirects.
- Added IConsoleCommandsService injection to plugins.
2026-03-31 10:48:44 -04:00
Maplewheels
f1808d9231 Added verbose cs compilation. 2026-03-29 00:30:18 -04:00
Evil Factory
bcec409618 Fix deep-fried main menu text 2026-03-28 22:20:22 -03:00
Evil Factory
14c610e6c7 Re-added the install_cl_lua command 2026-03-28 21:50:13 -03:00
Evil Factory
958335a01c Replicate old Add() method signature structure 2026-03-28 14:14:11 -03:00
Evil Factory
b358882016 This should be ItemPrefab, not Item, also add it the source code compat 2026-03-28 14:03:28 -03:00
Evil Factory
b8f1642d9d Simplify command register 2026-03-28 13:04:11 -03:00
Evil Factory
64818775cb Whoops 2026-03-28 13:04:04 -03:00
Evil Factory
5bfa15564a Move partial classes to extension methods, the ones that can't, turn into Lua compatibility members 2026-03-28 12:51:53 -03:00
Evil Factory
2ea97d3d5e Add CallLuaFunction legacy redirect 2026-03-28 10:52:33 -03:00
Evil Factory
bb2490eb13 Fix wrong arguments in RemovePatch 2026-03-27 21:58:06 -03:00
Evil Factory
57daa3ccb7 Fix missing type register 2026-03-27 21:40:44 -03:00
MapleWheels
c1fdedf955 Fixed ConfigService not filtering out configs that it shouldn't be loading. 2026-03-24 10:36:46 -04:00
MapleWheels
b70b6bf326 Fixed deadlock scenario in the event dispatcher CRUD API. 2026-03-24 02:44:08 -04:00
MapleWheels
28acf02de0 Updated client-side/common files tracking list for luacsinstaller. 2026-03-23 08:47:19 -04:00
MapleWheels
1e76377b63 - Added full implementation of lua event "modifyChatMessage" in IEvents. 2026-03-23 07:51:49 -04:00
MapleWheels
3dd9cfa741 Implemented plugin assembly lookup api. 2026-03-23 07:30:15 -04:00
Maplewheels
26ac37ed46 Added fallback native assembly resolver. 2026-03-23 00:25:51 -04:00
Maplewheels
5c136aab41 Added test debug settings for settings list. 2026-03-22 23:56:27 -04:00
Maplewheels
cf6104f630 Added Dropdown menu implementation for settings list. 2026-03-22 23:56:26 -04:00
Maplewheels
7c8dd452cf SettingsList implementation.
Merge conflict resolution.
2026-03-22 23:56:25 -04:00
MapleWheels
cf3a50d6b5 - Added back modifyChatMessage.
- Added missing commit file for previous commit.
2026-03-22 18:05:21 -04:00
MapleWheels
ac329a70a4 - Reduced console spam when failing to load config file in release builds.
- Added console logging for failing to unload assembly load ctx.
- Removed unused StorageService instance.
- Removed unused luacs settings.
- Added plugin event service and event service dispatcher api.
2026-03-22 18:01:19 -04:00
Evil Factory
e62450c763 Actually subscribe to IEventAssemblyUnloading 2026-03-22 17:24:02 -03:00
Evil Factory
44a9ce2417 Guh? 2026-03-22 12:44:17 -03:00
Evil Factory
23e0ff7aa6 Remove types that have been registered when unloading 2026-03-22 12:42:23 -03:00
Evil Factory
de53b4514e Fix console command registration 2026-03-22 12:42:09 -03:00
Maplewheels
994610869d Fixed deadlock scenario caused by unsubscribing during an event. 2026-03-22 01:56:30 -04:00
Evil Factory
b0e3faa2ad Make LuaCsLogger public 2026-03-21 15:59:48 -03:00
MapleWheels
fe34dcb0bd Added null location check to assembly inclusion list. 2026-03-17 10:58:48 -04:00
Evil Factory
8717706b1c Fix check ready to run not working properly 2026-03-15 18:44:15 -03:00
Evil Factory
b402e09b82 Move MainMenu code to a separate service that just injects our stuff into the mainmenu 2026-03-15 17:52:40 -03:00
Maplewheels
80832459b9 Added api for getting content package associatged with a plugin type. 2026-03-14 23:47:44 -04:00
Evil Factory
cf2c8b8e0e Add missing HttpGet in the interface 2026-03-14 14:45:03 -03:00
Evil Factory
f802356b0a Add legacy redirect for LuaCsSetup.Timer 2026-03-14 14:31:03 -03:00
Evil Factory
ecc4d8a6c1 Update moonsharp 2026-03-14 14:00:59 -03:00
Evil Factory
d4b774642b ModUtils namespace compatibility 2026-03-14 13:41:12 -03:00
Evil Factory
103f28481d Register setting types 2026-03-14 12:07:23 -03:00
Evil Factory
dd51bdae3f Revert "performance fixes for IDE/attached debugger stuttering."
This reverts commit e5aa381e38.
2026-03-14 12:04:29 -03:00
NotAlwaysTrue
5207b381b7 OBT/1.1.1 (#51)
Reverted an outdated change which is no longer in use
Removed CL-EP install command due to partical system issues
2026-03-13 13:34:21 +08:00
MapleWheels
e5aa381e38 performance fixes for IDE/attached debugger stuttering. 2026-03-10 03:22:30 -04:00
Maplewheels
8190b3f312 Fixed cs enabled prompt for hosts. 2026-03-08 22:07:56 -04:00
MapleWheels
e26cfa2e52 [Untested][Save/Sync]
- Fix for IsCsEnabled check.
2026-03-06 18:49:55 -05:00
MapleWheels
5b52d22b1f Added references cache for some hot paths services. 2026-03-06 18:15:44 -05:00
MapleWheels
5a452709c3 Minor adjustment to setting entry height and styles. 2026-03-06 08:31:09 -05:00
MapleWheels
8470e81dc7 Added tooltips and SettingControl input listener to the settings menu. Minor cosmetic adjustments. 2026-03-06 04:57:00 -05:00
MapleWheels
947a481400 Added spacer to settings labels. 2026-03-05 19:43:04 -05:00
MapleWheels
368b18d440 - Fixed shet. 2026-03-05 17:48:27 -05:00
MapleWheels
1fe68aa861 - Added float, double settingentry types. Adjusted display formatting.
- Added menu refresh on Apply button.
- Fixed package name resolution for invalid chars.
- Added helper console command to get xml-safe name for use in localization files.
- Made error messages for bad settings xml more descriptive.
- Modified GUISlider.
- Converted HarmonyEventPatchesService to a System.
- Fixed package name resolution for incompatible names in Xml and files, in many places.
- Fixed base textbox implementation for settings.
2026-03-05 15:45:00 -05:00
MapleWheels
f38a7bd574 The gameplay settings menu kinda works (only for luacsforbarotrauma). 2026-03-04 20:39:13 -05:00
MapleWheels
ce8b984542 Fixed Csharp/Shared path resolution in ModConfigService. 2026-03-04 14:51:31 -05:00
MapleWheels
d0969cc723 - Fixed assembly references not resolving for minor dll signature differences.
- Fixed deadlock during assembly resolution.
2026-03-04 14:38:00 -05:00
MapleWheels
a66b9041ec Fixed reference name error. 2026-03-03 22:44:56 -05:00
MapleWheels
83c198bc26 [Save/Sync] Commit work before .NET 10 tests. 2026-03-03 20:45:51 -05:00
MapleWheels
26b3827210 - Made publicizer only copy the required assemblies. 2026-03-02 08:46:03 -05:00
Maplewheels
4b04131fe3 Added post-publishing publicized assemblies copy task. 2026-03-02 02:45:43 -05:00
MapleWheels
168ce83820 Fixed potential NRE that shouldn't happen so long as the LuaCsForBarotrauma exists. 2026-03-01 17:13:15 -05:00
Evil Factory
5cbb635e54 Ok this should be the last one 2026-03-01 14:39:07 -03:00
Evil Factory
0452c1fc2d oops 2026-03-01 14:18:51 -03:00
Evil Factory
800dec3b84 I guess this doesnt exist anymore 2026-03-01 14:06:45 -03:00
Evil Factory
580f26b526 New CI files 2026-03-01 13:40:08 -03:00
Evil Factory
f8ff97d2b7 Fix debug console commands 2026-03-01 13:26:36 -03:00
Evil Factory
9ee4728e2a Better logging 2026-03-01 13:09:05 -03:00
Evil Factory
22a74bf1fd Move compat hooks 2026-03-01 12:43:59 -03:00
Evil Factory
845fcefad7 Fix Start(0 not returning an empty write only message 2026-03-01 09:50:52 -03:00
Maplewheels
9b55bf4847 [Save/Sync] Work on the settings menu. 2026-03-01 06:03:31 -05:00
Maplewheels
e74f083300 LuaCs package bug fixed. 2026-02-28 22:32:01 -05:00
Maplewheels
09bc2d0891 - Weird LuaCs Settings Menu bug present: package is loaded on startup but is then unloaded if the settingsmenu is opened and the package is not in the enabled list. 2026-02-28 22:10:29 -05:00
Evil Factory
28b355911d Add missing ILuaCsNetworking APIs 2026-02-28 17:57:02 -03:00
Evil Factory
e2c4282477 Add netMessageReceived hook back 2026-02-28 16:56:14 -03:00
Evil Factory
3192cc8b00 Remove need to define custom network header in upstream 2026-02-28 16:47:18 -03:00
Evil Factory
de73a18637 Compatibility for in memory scripts that used GameMain.LuaCs 2026-02-28 16:13:07 -03:00
Evil Factory
8e8b8eb8aa GameMain.LuaCs is no more 2026-02-28 16:05:20 -03:00
MapleWheels
c676233dfd [Save/Sync] Work on SettingsMenu 2026-02-27 17:56:47 -05:00
MapleWheels
9b61cda6cf - SettingsMenu work.
- Fixed NRE on NetSync in SettingEntry<T>
2026-02-27 17:25:25 -05:00
MapleWheels
ebf2935fb4 - Some menu implementation. 2026-02-27 15:21:40 -05:00
MapleWheels
6e556a02d4 I'm cooked, will finish this later. 2026-02-26 19:16:50 -05:00
MapleWheels
94556fd6e7 - SettingsMenuService added.
- Added Settings Tab to vanilla SettingsMenu
- Fixed ISystem implementation.
2026-02-25 15:19:01 -05:00
MapleWheels
d9d980122d - Moved all console commands to their respective services and added via injector service.
- Fixed LuaCs IsCsEnabled prompt not working.
- Add settings profiles support.
2026-02-24 15:26:49 -05:00
NotAlwaysTrue
679ffd380b OBT/1.1.0 (#50)
Finished CL-EP
Restored early Parallelism setting
2026-02-24 15:16:41 +08:00
MapleWheels
394856fa04 - Final commit before migration to /dev
- Localization files added.
2026-02-23 17:40:59 -05:00
Maplewheels
a28333ff4e Implemented ConfigProfiles internally. 2026-02-23 01:01:23 -05:00
Maplewheels
f4138d2398 - Added networking permission checks to SettingEntry.
- Removed error logging for missing save data for settings.
2026-02-22 06:35:37 -05:00
Evil Factory
91992194a9 Fix return events not working in Lua 2026-02-20 20:40:06 -03:00
Evil Factory
a7e9dc8c9c oops 2026-02-20 20:39:53 -03:00
Evil Factory
da5b9389db Fix missing HookMethod APIs in the interface 2026-02-20 20:20:15 -03:00
Evil Factory
ddd9dac2fb Fix Descriptors not being populated correctly 2026-02-20 19:32:15 -03:00
Evil Factory
124b1e545d Fix missing ILuaCsNetworking API 2026-02-20 19:32:03 -03:00
Evil Factory
f52617deab The great event move 2026-02-20 18:45:41 -03:00
Joonas Rikkonen
c8657caefa Update .NET SDK version from 6 to 8 in README 2026-02-20 19:56:19 +02:00
NotAlwaysTrue
de1f1c599f OBT/1.0.17
Removed Client Kick to see if this will fix some of "Received an update for an entity that doesn't exist"
Revert some change from pervious updates due to performance issue
Sync with upstream
2026-02-20 14:54:04 +08:00
Maplewheels
c28a08a713 Revert "Oops"
This reverts commit a0287b8561.
2026-02-16 02:22:19 -05:00
Maplewheels
a0287b8561 Oops 2026-02-16 02:22:14 -05:00
Maplewheels
6ac49a10f4 - XML GUI Asset service implemented (alpha, requires testing). 2026-02-16 02:22:14 -05:00
Evil Factory
f70251fa3b Event pain 2026-02-15 17:58:25 -03:00
Evil Factory
13bfffa777 More events moved 2026-02-15 16:57:16 -03:00
Evil Factory
a50dce8fc2 Forgot to remove old Hook Call 2026-02-13 19:56:33 -03:00
Evil Factory
a36bd70505 Strip down the original logger class 2026-02-13 18:58:35 -03:00
Evil Factory
36471f2239 Move more events to be Harmony patches 2026-02-13 18:44:27 -03:00
NotAlwaysTrue
d16707a2f3 OBT/1.0.16
Fixed the GapList bug again to see if this will work

P L E A S E   W O R K
2026-02-13 15:02:17 +08:00
MapleWheels
dff38f7609 - Added XmlDoc for InternalScript instance. 2026-02-12 20:21:46 -05:00
Evil Factory
5f38b4a43a Fix bullshit Lua issues 2026-02-12 21:50:13 -03:00
MapleWheels
07d838eee0 Finished removing Impromptu Interfaces package. 2026-02-12 14:59:24 -05:00
MapleWheels
5747d896eb - Removed ImpromptuInterfaces 2026-02-12 14:53:33 -05:00
MapleWheels
ad152ee747 - pOoosh 2026-02-11 15:19:40 -05:00
MapleWheels
471e256353 Revert "-- MonoMod.Hook replacement."
This reverts commit 948b7c48c5.
2026-02-11 15:17:32 -05:00
MapleWheels
59584fefc1 - Updated dependencies versions.
- Made EventService handle errors again.
2026-02-11 15:16:04 -05:00
MapleWheels
948b7c48c5 -- MonoMod.Hook replacement. 2026-02-11 12:57:49 -05:00
MapleWheels
5e33a908d2 Removed NIException. 2026-02-10 19:15:23 -05:00
MapleWheels
9e2fc13460 - Fixed the server not loading saved convars and not having absolute authority. 2026-02-10 18:48:31 -05:00
Evil Factory
6bbe5be5e6 Fix networking being completely bamboozled 2026-02-10 20:26:46 -03:00
MapleWheels
9dde5cac7d Fixed Evil's obsession with OnKeyUpdate. 2026-02-10 15:11:46 -05:00
MapleWheels
6b9e48f96a - Added ISystem (automatically run services) service type. 2026-02-10 14:28:22 -05:00
MapleWheels
30149b504d - Added publicized assemblies to LuaCsForBarotrauma package via ModConfig.xml
- Added XmlAttribute tags for ModConfig.xml defined properties.
- GetType and GetImplementingTypes<T> rework.
2026-02-09 21:32:57 -05:00
Evil Factory
fb4648d759 Converting everything into Harmony patches part 1 2026-02-09 21:54:44 -03:00
Evil Factory
d14c353115 Remove old LuaCsNetworking 2026-02-09 21:01:07 -03:00
MapleWheels
f1bae4c1ca - Added Copy-On-Build for publicized assemblies to the luatrauma localmods folder. 2026-02-09 18:37:27 -05:00
Evil Factory
a61e705dbf Better LoggerService 2026-02-09 19:51:31 -03:00
MapleWheels
64831bd580 - Made the assembly compilation logs output in production builds.
- Removed double logging in debug builds.
2026-02-09 17:43:59 -05:00
MapleWheels
dc1093eeed Added LuaCs package lookup to the info provider. 2026-02-09 17:18:50 -05:00
MapleWheels
95376622fa - Added LuaCsForBarotrauma check to enabled packages list. 2026-02-09 16:58:53 -05:00
MapleWheels
511f98ec18 - Added pre-touch to the ContentPath.FullPath to make them thread-safe. 2026-02-09 15:52:37 -05:00
NotAlwaysTrue
740ace88f0 OBT/1.0.15
* Removed PF support again
Fixed Object reference not set to an instance of an object exception in EnemyAIController.cs UpdateLimbAttack()

* Reverted pervious fix on EnemyAIController bcuz the fix will not fix anything
Reduced MaxDegreeOfParallelism by 1 bcuz already a task there

* Re-removed all PF related stuff to fix issue
Removed all RUN_PHYSICS_IN_SEPARATE_THREAD related code because these codes are no longer functional
Removed a duplicated loop in GameScreen
Removed mulitple unnessary parallel operations

* Potentially fixed #44 and #43

* added a ToList for Gap.GapList
2026-02-09 15:34:07 +08:00
Evil Factory
70e98467e8 nuh uh 2026-02-08 23:47:02 -03:00
Evil Factory
e8bec96970 THE REQUIRE PATHS WORK!@!!!!!!11! 2026-02-08 23:38:52 -03:00
Maplewheels
a505d48a4c - Loading/Saving for Settings via console. 2026-02-08 20:23:49 -05:00
Evil Factory
bcc4357a16 Pass in cs enabled check in ExecuteLoadedScripts 2026-02-08 21:46:00 -03:00
Evil Factory
668197ad6f Fix Lua/Cs execute order 2026-02-08 21:45:17 -03:00
Evil Factory
0a91b89694 Add publicized assemblies to metadata references 2026-02-08 21:29:31 -03:00
Evil Factory
5b10661874 Legacy network stuff 2026-02-08 18:26:59 -03:00
Evil Factory
36a126774a Register INetworkIdProvider 2026-02-08 15:06:22 -03:00
Evil Factory
705137e993 Finalize networking service 2026-02-08 15:03:03 -03:00
Evil Factory
ce4cd1fefd Implement most of the net var networking functionality 2026-02-08 11:51:09 -03:00
Maplewheels
224e32ccf1 Some work on save/load for configs. 2026-02-08 06:39:44 -05:00
Evil Factory
f01ee61278 Clear file cache when resetting LuaScriptManagementService 2026-02-08 01:37:24 -03:00
Evil Factory
c637e34b48 Fix GUI enums in Lua 2026-02-08 01:30:44 -03:00
Maplewheels
67c195034d Network Sync work. Added network unique key. 2026-02-07 22:58:56 -05:00
Evil Factory
02b1f524b6 Re-enable DefaultHook.lua 2026-02-07 23:29:22 -03:00
Evil Factory
e76aaf5a34 Fix deadlock when reloading packages 2026-02-07 23:29:00 -03:00
Evil Factory
422e8a6185 Misc Lua fixes 2026-02-07 20:11:46 -05:00
Evil Factory
ba10d9d031 Working NetworkingService without net vars 2026-02-07 20:11:46 -05:00
Maplewheels
87dc9be10e -Changed NetworkSync interfaces. 2026-02-07 20:11:46 -05:00
Evil Factory
d47b75c778 Give Lua references to IEvent and finally add an alias for think 2026-02-07 20:11:46 -05:00
MapleWheels
2c29969bfb - Oops. 2026-02-07 20:11:46 -05:00
Evil Factory
c84d9660e2 Add command cfg_getvalue 2026-02-07 20:11:46 -05:00
MapleWheels
dcd7df4860 Fixed TrySetValue returning an incorrect result. 2026-02-07 20:11:46 -05:00
Evil Factory
b3d0fbeb5d Add cfg_setvalue command 2026-02-07 20:11:46 -05:00
MapleWheels
fa340e91de Fixed an issue affecting parsing the required runstate to edit a setting. 2026-02-07 20:11:46 -05:00
MapleWheels
771e73a798 - Basic Config & Settings working (read-only, changes must be made via debug halt). 2026-02-07 20:11:46 -05:00
MapleWheels
e75208507d - Config Services almost ready.
- Refactored and flattened namespaces.
2026-02-07 20:11:46 -05:00
MapleWheels
863ee23583 - Some work on config service. 2026-02-07 20:11:46 -05:00
MapleWheels
9cc20a03c0 Fixed networking references errors. 2026-02-07 20:11:46 -05:00
MapleWheels
cae3741953 Made most of the networking interfaces public. 2026-02-07 20:11:46 -05:00
Evil Factory
80555ef933 IT WORKS!!!!!!!!!!!!!!!!!!!! 2026-02-07 20:11:45 -05:00
Evil Factory
cf251451ed Fix EventService.Call not implemented correctly 2026-02-07 20:11:45 -05:00
MapleWheels
4cf4b1604b Fixed some NREs. 2026-02-07 20:11:45 -05:00
MapleWheels
fd037153ee - Fixed recursion deadlock due to the EventService.Reset() being called during event publishing. 2026-02-07 20:11:45 -05:00
MapleWheels
02a7338ab8 Removed duplicate rawrrs 2026-02-07 20:11:45 -05:00
Evil Factory
70dd602bcf Move the Lua IL patching bullshit to a separate service 2026-02-07 20:11:45 -05:00
MapleWheels
ea602f6d2f Woof 2026-02-07 20:11:45 -05:00
MapleWheels
06348d3ba5 It works. Except (HookMethod->Harmony: L189) is throwing NRE. 2026-02-07 20:11:45 -05:00
MapleWheels
2eb593f461 - Debugging LuaCsHook compat issues. 2026-02-07 20:11:45 -05:00
MapleWheels
244c0fbec3 Made ACsMod even more useless so hopefully people stop using it... 2026-02-07 20:11:45 -05:00
MapleWheels
7b529bce57 Revert "- Removed ACsMod.cs"
This reverts commit 54a3e2e5de0cff38ea4fc3750d2eb90f5ea73fe9.
2026-02-07 20:11:45 -05:00
MapleWheels
36bed09bde - Fixed stack ovewrflow from ServicesProvider (???). 2026-02-07 20:11:45 -05:00
Maplewheels
024b07d5f4 Added logging to the EventService. 2026-02-07 20:11:45 -05:00
Maplewheels
0cab7954f8 Fixed immediate errors (untested). 2026-02-07 20:11:45 -05:00
Maplewheels
b325a01eea Rewrote the EventService. 2026-02-07 20:11:45 -05:00
MapleWheels
7e541cef3d - Removed ACsMod.cs 2026-02-07 20:11:45 -05:00
MapleWheels
bb8869268e - Refactored the EventService interfaces and event system, incomplete. 2026-02-07 20:11:45 -05:00
Maplewheels
cb171d350d Alpha PluginManagementService, plugin loading functionality implemented. 2026-02-07 20:11:45 -05:00
Evil Factory
5777b64a18 Move LuaUserData and registration into a proper service 2026-02-07 20:11:41 -05:00
Maplewheels
9b9529107c Added limited multithreaded compatibility. Still requires locks. 2026-02-07 20:11:33 -05:00
MapleWheels
5421c7df4f - Made SyncPackages function always complete the unload->reload process.
- Basic assembly loading is completed (alpha), unloading/disposal not yet supported.
2026-02-07 20:11:33 -05:00
Evil Factory
4f02cb4967 Working Hook.Patch and old patch methods 2026-02-07 20:11:33 -05:00
Evil Factory
6b8a0a7dca Take in account ForcedAutorun for legacy as well 2026-02-07 20:11:32 -05:00
Evil Factory
dfb31eef16 Move Lua classes to the appropriate places 2026-02-07 20:11:16 -05:00
Evil Factory
c6c0aadb00 Rename LuaCsHook 2026-02-07 20:11:08 -05:00
Evil Factory
3b65ea9008 Remove unused LuaCsConfig 2026-02-07 20:11:08 -05:00
Evil Factory
708fe93efe Some extra logging and bring back LuaCsTimer 2026-02-07 20:11:08 -05:00
MapleWheels
13a9bc443e - Some work on PluginManagementService, IAssemblyLoaderService and IAssemblyManagementService refactors.
- Fixed mod list sync not checking for zero package diff length.
- Fixed the services provider not being able to inject itself as a dependcency.
- Added UseInternalName data spec to ModConfig.xml
- Changed Basic.Reference.Assemblies to Net80.
2026-02-07 20:11:08 -05:00
MapleWheels
37e3a195dc - Now logs results from SyncLoadedPackagesList 2026-02-07 20:11:08 -05:00
MapleWheels
a28a6f3320 - Added LuaCs ordering filter. 2026-02-07 20:11:07 -05:00
Evil Factory
67d3d5f587 Reimplementation of DoString with lua/cl_lua commands and fix Lua scripts not being loaded properly 2026-02-07 20:11:07 -05:00
Evil Factory
f0f09c20fa Plugin moment 2026-02-07 20:11:07 -05:00
Evil Factory
f28749d455 Missing IsAutorun 2026-02-07 20:11:07 -05:00
Evil Factory
ab2638b2cb Fix event service not clearing _luaOrphanSubscribers 2026-02-07 20:11:07 -05:00
MapleWheels
22f587b7b9 Changed ModConfig.xml spec: RunFile => IsAutorun. 2026-02-07 20:11:07 -05:00
MapleWheels
92232d114b Ensures that ILuaCsHook will resolve to the existing event service instance. 2026-02-07 20:11:07 -05:00
Evil Factory
6619def365 The concurrent toolbox dictionary situation is crazy 2026-02-07 20:11:07 -05:00
MapleWheels
c776a5424d Made GetType return interfaces by default. 2026-02-07 20:11:07 -05:00
MapleWheels
2a1d7760e6 - Enabled caching for LuaScriptLoader.cs 2026-02-07 20:11:07 -05:00
MapleWheels
009957e3b6 - Added alpha legacy mod support.
- StorageService: Fixed ContentPackages' directories not properly resolving.
- TODO: Rewrite StorageService LocalData functions to use ContentPath for resolution.
2026-02-07 20:11:07 -05:00
Evil Factory
297f6a38cb Basic legacy Lua converter 2026-02-07 20:11:07 -05:00
MapleWheels
440cbed76a - Fixed find files in package using the wrong ContentPackage property. 2026-02-07 20:11:07 -05:00
MapleWheels
b36224f480 Removed unused data interfaces. 2026-02-07 20:11:06 -05:00
MapleWheels
f9a467453a - Removed all MoveImmute situations.
- Added filtering and ordering functions for package resources.
2026-02-07 20:11:06 -05:00
Maplewheels
60ed549605 - Removed unused scheduler context. 2026-02-07 20:11:06 -05:00
Evil Factory
3d51abc56b Semi-working Lua scripts 2026-02-07 20:11:06 -05:00
Maplewheels
295c365a8f - The return null situation is no longer crazy. 2026-02-07 20:11:06 -05:00
Maplewheels
adf9303a7e - The GetType lag situation is less crazy. 2026-02-07 20:11:06 -05:00
Maplewheels
b626fd1e47 - The GetType lag situation is craazy. 2026-02-07 20:11:06 -05:00
Maplewheels
ed09908c3b - Added default load context type resolution. 2026-02-07 20:11:06 -05:00
Maplewheels
0a9c673753 - Removed unused settings
- Added Settings.xml
2026-02-07 20:11:06 -05:00
Maplewheels
c2aa7dd948 Added packages to running packages list on execution. 2026-02-07 20:11:05 -05:00
Evil Factory
25081466be Add the content package and move the Lua files to it 2026-02-07 20:11:02 -05:00
Evil Factory
8dedc54468 Add Any for Platform and Target enums 2026-02-07 20:10:55 -05:00
Maplewheels
d0f5cb87e7 - Fixed resource data not returning into the correct context. 2026-02-07 20:10:55 -05:00
Evil Factory
8dc58445f9 MoveToImmutable -> ToImmutable 2026-02-07 20:10:55 -05:00
Evil Factory
6faf1a0fcb Fix perfidious task moment 2026-02-07 20:10:55 -05:00
Evil Factory
ee0988588f Add ModConfig for test mod 2026-02-07 20:10:55 -05:00
MapleWheels
6e66a3114a - Made Package loading conditional on resources being available.
- Made States registration use named parameters.
- Changed IPluginManagementService interface to better suit expected return results.
2026-02-07 20:10:55 -05:00
MapleWheels
15e0a2bd10 Disabled LuaCsConfig until ModConfig.xml and ISettingEntry<T> are completed. 2026-02-07 20:10:55 -05:00
MapleWheels
09faa8403a Fixed StatemMachine State delegate assignment being backwards. 2026-02-07 20:10:55 -05:00
MapleWheels
7e0e671539 - ConfigService.cs alpha testing. 2026-02-07 20:10:54 -05:00
MapleWheels
cc07db941f - Fixed the "deadlock" (tasks not started). 2026-02-07 20:10:54 -05:00
Evil Factory
f1e1b9238d The deadlock situation is craaaaazy
Fix
2026-02-07 20:10:54 -05:00
MapleWheels
dda26df250 For sure this time....right guys? 2026-02-07 20:10:54 -05:00
MapleWheels
6e7b7c804c - Added other package locations to if statement check. 2026-02-07 20:10:54 -05:00
Maplewheels
6a21255a38 - IT BUILDS!!2:BARO BOOGALOO 2026-02-07 20:10:54 -05:00
MapleWheels
6362a9c34f - Work on LuaCs system state machine. 2026-02-07 20:10:54 -05:00
MapleWheels
3ddaceb5ac - SafeStorageService glow up.
- ILuaScriptLoader now inherits the ISafeStorageValidation interface.
 - LuaScriptLoader now uses the SafeStorageService.
2026-02-07 20:10:54 -05:00
MapleWheels
055a508901 - Deleted unused service IPackageListRetrievalService.cs
- Added caching function to LuaScriptLoader.cs
- Added sample async code to LuaScriptManagementService.cs
- Removed most of the State functions in LuaCsSetup.cs (requires rewrite).
- Fixed CsEnabled check.
- Moved IsRunningWorkshop check to client-only project.
2026-02-07 20:10:54 -05:00
MapleWheels
0bfceacaf3 - Completed most of PackageManagementService.cs
- Some areas of code need to be rewritten for the simplified loading and execution process.
2026-02-07 20:10:54 -05:00
Maplewheels
0438d3c4ba [Save/Sync]
- Work on PMS.
2026-02-07 20:10:54 -05:00
MapleWheels
3e81e27160 [Save/Sync] In-Progress ModConfigXml loading rewrite.
+ Fixed async operations lock for Dispose() pattern in working files.
+ Rewrote StorageService.cs:
--- Now uses ContentPath instead of raw strings where possible.
--- Now throws exceptions for developer errors and critical program states.
+ Rewrote ModConfigService.cs:
--- All functions are now completely async.
+ Removed ConfigProfilesResources completely as they exist in common Config xml files.
+ Somewhat simplified package data and processes.
2026-02-07 20:10:54 -05:00
MapleWheels
42acb32c69 Marked Async-compatibility issue with Log() in LoggerService.cs 2026-02-07 20:10:53 -05:00
Maplewheels
d6968f4ea9 [Save/Sync] Work on ModConfig loading. 2026-02-07 20:10:53 -05:00
Evil Factory
75da3a398d This should be full path 2026-02-07 20:10:53 -05:00
Evil Factory
1dad2babb7 Move Lua compatibility files around and start adding them to LuaScriptManagementService 2026-02-07 20:10:53 -05:00
Evil Factory
fe982b15b0 Fix LuaScriptManagementService compile error 2026-02-07 20:10:53 -05:00
Maplewheels
595470ccfb [Save/Sync] In-Progress rewrite of ConfigService and ModConfigService 2026-02-07 20:10:53 -05:00
MapleWheels
7d39c092c6 [Save/Sync] Big If tru Rewrite in progress.
- Removed IProcessors
- Removed old ModConfigService format.
- Converting to ContentPath from absolute paths where possible.
- Added: Microsoft.Toolkit.Diagnostics package.
2026-02-07 20:10:53 -05:00
MapleWheels
6a6be3caa4 - Removed all package dependency lookup code.
- Changed from absolute file paths to the upstream `ContentPath` system.
2026-02-07 20:10:53 -05:00
Evil Factory
1daf68dea1 Oops 2026-02-07 20:10:53 -05:00
Evil Factory
4f8531332e Implement LogResults 2026-02-07 20:10:53 -05:00
Evil Factory
d70885711b Fix some runstate if checks 2026-02-07 20:10:53 -05:00
Evil Factory
6499e7608c Fix package management service constructor and create [DebugOnlyTest]TestLuaMod 2026-02-07 20:10:53 -05:00
MapleWheels
569e14f50f - Removed generic exception from LuaCsSetup.cs services retrival, replaced with exception propagation.
- Fixed `PerScopeLifetime` and `Transient` lifetimes for container services.
2026-02-07 20:10:53 -05:00
Evil Factory
71c2e54afd Remove CheckUpdate 2026-02-07 20:10:53 -05:00
Maplewheels
bd5d04f5ab Work on plugin loader. 2026-02-07 20:10:53 -05:00
Maplewheels
26b657a96f [In-Progress] Plugin system rewrite.
Game starts up, runs until unimplemented functions are reached without errors.
2026-02-07 20:10:52 -05:00
Maplewheels
cce5bf26c8 Completed SafeStorageService.cs 2026-02-07 20:10:52 -05:00
Evil Factory
4d97a427f9 WIP Lua script management service 2026-02-07 20:10:52 -05:00
MapleWheels
aa7e825e70 - Deleted old assembly loader. 2026-02-07 20:10:52 -05:00
MapleWheels
2778df0fe7 - Changes to the Lua ScriptSystem spec. 2026-02-07 20:10:52 -05:00
MapleWheels
c6713f37bb IT BUILDS!!!
- Removed LocalizationServices and other sus things.
- Rewrote AssemblyLoader
[In Progress] SafeStorageService
[In Progress] LuaScriptLoader
2026-02-07 20:10:52 -05:00
MapleWheels
52d920d969 [Milestone] PackageManagementService completed.
- ContentPackageInfoLookup Service completed.
- Implemented ModConfigService.cs
- Implemented some of the resource processors.
2026-02-07 20:10:45 -05:00
EvilFactory
cb88d215fa LuaGame legacy service 2026-02-07 20:10:39 -05:00
MapleWheels
7436ea3e8c - Finished most of LuaCsSetup top-level functionality.
- Removed some unneeded interface definitions.
- Clean-slated some Services that need to be re-written.
2026-02-07 20:10:39 -05:00
MapleWheels
d2b9ca4c1b [Refactor-Minor]
- Refactored interface definition.
- Plugin Loading System Refactor (incomplete).
2026-02-07 20:10:39 -05:00
MapleWheels
4b2bac7cd8 [Milestone] StorageService completed. 2026-02-07 20:10:39 -05:00
Regalis11
1da82cdec2 v1.7.7.0 (Winter Update 2024) 2026-02-07 20:10:39 -05:00
MapleWheels
76fc52e042 - Work on storage service. Pre-squash commit. 2026-02-07 20:10:39 -05:00
MapleWheels
6880e5e9ee [Milestone] AssemblyLoader completed.
Details:
- Assembly Mgmt Service for loading now a separate interface, not intended for normal use.
- Assembly Loader work; implemented custom dictionary key and table.
- Assembly loading work.
- EventService completed.
- Moved assembly extensions to ModUtils.cs
- Work to event service.
NetworkService work
- Added ImpromptuInterfaces package.
- Networking Service work to support NetVars
- Event Service
- Added assemblies references package for script compilation. Updated Roslyn version for compatibility.
- Package Loading work.
Swap Harmony to HarmonyX
- More refactor conversion to FluentResults.
- Updated StylesService to return Results.
- Refactor of PackageService partially complete.
- Made IService.Reset() required to return a Result.
- Moved plugin/assembly related code to their own folder (same namespace).
- Updated interfaces to reflect the use of Result<T>.
- Partial refactor, incomplete.
- Added 'FluentResults' so we can stop using cursed Exception-based flow control in loading code.
- Added 'OneOf' nuget package: https://github.com/mcintyre321/OneOf
for the implementation of the Optional<T> pattern and complex discrete return types instead of cursed enums (see current AssemblyManager.cs).
- Reapplied old branch changes.
2026-02-07 20:10:26 -05:00
MapleWheels
01cc1d331b -- Squash:
- In progress implementation of services model.
2026-02-07 20:10:04 -05:00
Evil Factory
9e957a75b0 Update MoonSharp 2026-02-02 21:30:06 -03:00
Evil Factory
a546615f69 Oops accidentally broke this check 2026-02-01 09:18:11 -03:00
Evil Factory
9f1c3fa823 Move UserData checks out of Lua 2026-01-31 17:44:36 -03:00
NotAlwaysTrue
8bfe8a2c37 OBT/1.0.14
Fixed parallelism count issue
Added SingleThreadWorker to handle single-thread related works
Fixed incorrect order when updating gaps
Potentially Fixed #39
2026-01-08 12:40:30 +08:00
NotAlwaysTrue
f3c22315a1 OBT/1.0.13
Fixed another crash(Object reference not set to an instance of an object.)
2026-01-02 18:34:12 +08:00
NotAlwaysTrue
59da9211f6 OBT/1.0.2 (#35)
* Fixed? the cause of gap crashes. May require further monitor and check :(

* Fixed a bug that will cause the server stop responding

* Fixed (?) an issue causing a SetPosition() will crash the game
Removed CL release, Added manual dispatcher inputs
2026-01-01 14:14:40 +08:00
NotAlwaysTrue
82d26b5bb8 OBT/1.0.11
Fixed a bug that caused the server to stop responding
Fixed an issue in gap.Update that may cause the server to crash
2025-12-30 17:41:50 +08:00
NotAlwaysTrue
4c151a4cf1 OBT/1.0.10
Reverted a fixed bug that caused a rare crash but the fix itself will do impact on server performance
2025-12-29 22:52:29 +08:00
NotAlwaysTrue
85b71f1dd6 Revert a change made in 1.0.9 due to large-scale performence impact.
Note : This may cause server crash
2025-12-29 22:36:38 +08:00
NotAlwaysTrue
24484496d2 OBT/1.0.9
Fixed an issue causing gap.update crashes the game(engine issue)
Fixed an potential issue that on MacOS we cannot get core count and cause MaxDegreeOfParallelism will be set to 0. Now if we cant get that number we simply use a fixed 16 instead
2025-12-29 16:33:37 +08:00
NotAlwaysTrue
190c98d8f2 Fixed 2 issues
Fixed an issue causing gap.update crashes the game(engine issue)
Fixed an potential issue that on MacOS we cannot get core count and cause MaxDegreeOfParallelism will be set to 0. Now if we cant get that number we simply use a fixed 16 instead
2025-12-29 16:28:34 +08:00
Eero
046483b9da Revert "OBT1.1.0 Merge branch 'dev_pte' into dev"
This reverts commit 177cf89756, reversing
changes made to 42ba733cd4.
2025-12-29 11:18:11 +08:00
Eero
177cf89756 OBT1.1.0 Merge branch 'dev_pte' into dev 2025-12-29 11:15:41 +08:00
Eero
e167a34f32 Make entity lists thread-safe with copy-on-write wrappers
Replaced static entity lists (e.g., HullList, GapList, MapEntityList, etc.) with thread-safe copy-on-write wrappers to improve concurrency and prevent race conditions. Updated usages and related methods to support the new thread-safe collections, ensuring atomic operations and lock-free reads throughout the codebase.
2025-12-28 21:59:03 +08:00
Eero
bd1e624eb1 Remove unnecessary thread-safety code from entity spawning
Eliminated redundant locks and related comments in EntitySpawner and Entity classes, simplifying the spawn and remove queue handling. Also removed outdated comments in GameScreen regarding thread safety. These changes assume entity spawning and removal are no longer performed from multiple threads, improving code clarity and maintainability.
2025-12-28 17:45:51 +08:00
Eero
1db14631df Defer physics transforms to ensure thread safety
Refactored multiple components to defer Farseer physics transform operations using PhysicsBodyQueue, preventing unsafe calls from parallel contexts. This change addresses thread safety issues with Farseer's DynamicTree and ensures transforms are executed in a safe context. Also increased the spawn amount limit in DebugConsole from 100 to 100000.
2025-12-28 17:14:16 +08:00
Eero
59bf2749dd Improve thread safety in sound and physics systems
Refactored SoundChannel and SoundManager to use explicit locking for OpenAL operations and channel assignment, preventing race conditions during parallel sound playback. Added thread-local stacks in DynamicTree to ensure thread safety during parallel physics queries and raycasts. These changes address concurrency issues when sounds or physics queries are triggered from multiple threads.
2025-12-28 16:18:49 +08:00
Eero
ad0bcddaa4 CL_Fix Use TryAdd when adding afflictions to dictionary
Replaces afflictions.Add with afflictions.TryAdd to prevent exceptions if the affliction already exists in the dictionary.
2025-12-28 15:11:56 +08:00
Eero
f485583621 Unstable 0.2 Defer physics operations during parallel updates
Introduces a thread-safe queue for deferring physics operations (such as body creation and transforms) to the main thread, ensuring Farseer Physics is not accessed from parallel contexts. Updates Holdable, Item, MapEntity, and GameScreen to use the new PhysicsBodyQueue for safe physics operations during parallel updates, and refactors PhysicsBodyQueue to support general deferred physics actions.
2025-12-28 15:10:06 +08:00
Eero
49355fe32b Unstable Add thread-safe queue for deferred physics body creation
Introduces PhysicsBodyQueue to safely defer physics body creation to the main thread, addressing thread-safety issues with Farseer Physics during parallel updates. Updates LevelResource, TriggerComponent, BallastFloraBehavior, and MapEntity to use the queue for all physics body creation and refresh operations, ensuring they are processed outside of parallel loops. Also adds cleanup of the queue at round end.
2025-12-28 14:42:17 +08:00
NotAlwaysTrue
356ae6cf74 OBT/1.0.8
Fixed an mod conflict due to execute order
2025-12-28 14:36:09 +08:00
NotAlwaysTrue
770f76a658 Fixed a potential conflict with mods 2025-12-28 14:21:32 +08:00
NotAlwaysTrue
42ba733cd4 Fixed a potential conflict with mods 2025-12-28 14:17:01 +08:00
Eero
45312af297 WIP Make static collections thread-safe using ThreadStatic and ThreadLocal
Refactored various static and instance collections to use [ThreadStatic], ThreadLocal, or local variables to prevent concurrent modification issues during parallel updates. This affects status effect targets, affliction lists, damage modifiers, and cached data in Character, CharacterHealth, Limb, Explosion, Hull, Submarine, and ToolBox classes. Also replaced Dictionary caches with ConcurrentDictionary where appropriate for thread safety.
2025-12-28 14:14:53 +08:00
NotAlwaysTrue
baee73e132 OBT/1.0.7
Fixed #7
Fixed #22/#25
Fixed a potential cause to teleport/etc stuff
Added a Client counter in PM
Fixed typo
2025-12-28 14:01:44 +08:00
NotAlwaysTrue
279f40c82e Merge branch 'master' into master-1.0.6 2025-12-28 14:00:03 +08:00
NotAlwaysTrue
aaf0763e09 Removed a potential issue 2025-12-28 13:54:29 +08:00
Eero
c5fa49405f WIP Make networking code thread-safe and refactor update ID
Replaces direct increments of LastClientListUpdateID with a thread-safe IncrementLastClientListUpdateID method and uses Interlocked for atomic operations. Refactors EntitySpawner to lock access to the spawn/remove queue for thread safety. Updates INetSerializableStruct to use concurrent collections for cached variables and type behaviors, improving thread safety in networking code.
2025-12-28 13:10:17 +08:00
NotAlwaysTrue
3d96e4adb6 Fixed #22 2025-12-28 13:05:56 +08:00
NotAlwaysTrue
42af6f2ec0 Fixed #22 2025-12-28 13:02:31 +08:00
Eero
31812d524d Make collections thread-safe for AI and character systems
Refactored various collections (lists, dictionaries, queues, and caches) in AI, character, animation, and item component systems to use thread-safe patterns and concurrent data structures. This includes introducing copy-on-write wrappers, ConcurrentDictionary, ConcurrentQueue, and ThreadLocal where appropriate to ensure safe concurrent access and mutation, improving stability in multi-threaded scenarios.
2025-12-28 12:53:10 +08:00
NotAlwaysTrue
21a2863a1a Fixed a typo using e instead of a :( 2025-12-28 11:45:55 +08:00
NotAlwaysTrue
bd643503b3 Added ClientCount for PerformenceMonitor
Add a marker to help distinguish EP from other SV Executables
Fixed a "Failed to copy object. Source is null." introduced by last update
Uses dynamic ThreadCount instead of fixed 16
Re-Removed most PF support
Re-Parallelzed Level update and Character Update(a conflict warning will be issued
2025-12-28 11:45:21 +08:00
NotAlwaysTrue
51a1fb1235 Re-applied multiple fixs 2025-12-28 11:43:49 +08:00
NotAlwaysTrue
8f0eec7031 Fixed #7 (re-applied) 2025-12-28 11:43:15 +08:00
Evil Factory
6dd36a1575 Fix memory leak that happens when you press retry in singleplayer 2025-12-28 11:42:03 +08:00
Eero
46595b1399 WIP Make collections thread-safe and add safe iteration
Replaced static lists and dictionaries with thread-safe ConcurrentDictionary or ThreadLocal collections for various item components and systems. Updated all relevant code to use snapshots (ToArray, ToList) for safe iteration, and added helper methods for marking and clearing changed connections. These changes improve thread safety and prevent potential concurrency issues in multi-threaded scenarios.
2025-12-28 04:59:56 +08:00
Eero
90962b2328 Refactor Item collections for thread safety and performance
Replaces static Item.ItemList and related collections with thread-safe data structures using ConcurrentDictionary and ImmutableHashSet. Adds thread-safe helpers for marking items for deconstruction and managing item lists. Updates all usages of Item.ItemList and DeconstructItems to use new APIs, improving performance and safety in multi-threaded contexts. Also refactors MeleeWeapon and Projectile impact queues to use ConcurrentQueue, and updates related logic throughout the codebase.
2025-12-28 03:57:04 +08:00
NotAlwaysTrue
edd50ef181 Update publish-release.yml 2025-12-27 20:54:06 +08:00
NotAlwaysTrue
ced6dca7a3 OBT/1.0.6
Fixed a typo using "e" instead of "a" in word "performance"
2025-12-27 20:33:51 +08:00
NotAlwaysTrue
559aeb3c3f Fixed a typo using e instead of a :( 2025-12-27 18:47:50 +08:00
NotAlwaysTrue
16131e0acc Fixed a typo 2025-12-27 18:45:51 +08:00
NotAlwaysTrue
e8f377c20d Sync with Main
Sync with Main
2025-12-27 16:08:15 +08:00
NotAlwaysTrue
27896d53ef OBT/1.0.5
OBT/1.0.5
2025-12-27 16:06:23 +08:00
NotAlwaysTrue
a44d89f953 Revert "Revert back to 1.0.3" 2025-12-27 16:05:20 +08:00
NotAlwaysTrue
75465f2f21 OBT/1.0.5
Same as 1.0.4
Fixed a crash introduced by 1.0.4
2025-12-27 16:02:38 +08:00
NotAlwaysTrue
3aadff7a3c Improved thread safety for Gap.update() 2025-12-27 15:55:50 +08:00
NotAlwaysTrue
c65101537d Merge pull request #17 from NotAlwaysTrue/revert-16-master-fix
Revert back to 1.0.3
2025-12-27 15:35:07 +08:00
NotAlwaysTrue
b35eee5561 Revert "OBT/1.0.4" 2025-12-27 15:32:16 +08:00
NotAlwaysTrue
cdfe87c81b OBT/1.0.4
Add a marker to help distinguish EP from other SV Executables
Fixed a "Failed to copy object. Source is null." introduced by last update
Uses dynamic ThreadCount instead of fixed 16
Re-Removed most PF support
Re-Parallelzed Level update and Character Update(a conflict warning will be issued
2025-12-27 13:26:30 +08:00
NotAlwaysTrue
7e899d900a Added ClientCount for PerformenceMonitor
Add a marker to help distinguish EP from other SV Executables
Fixed a "Failed to copy object. Source is null." introduced by last update
Uses dynamic ThreadCount instead of fixed 16
Re-Removed most PF support
Re-Parallelzed Level update and Character Update(a conflict warning will be issued
2025-12-27 13:19:36 +08:00
NotAlwaysTrue
a037e616bf OBT/1.0.3
Restored multiple removed parallel stuff
Restored PF support(why)
Fixed #7
2025-12-27 02:12:25 +08:00
NotAlwaysTrue
f7650bd6df Re-applied multiple fixs 2025-12-27 02:06:04 +08:00
NotAlwaysTrue
716a35701c Revision 6032010
Removed a potential issue causing the server to stuck in GameScreen.cs (Internal reports)
Added an Warning message to SEEM
2025-12-27 01:59:17 +08:00
Eero
6032010847 Improve parallelization in map and game screen updates
Refactored update logic in MapEntity and GameScreen to use more granular and conditional parallelization, reducing unnecessary allocations and improving performance. Updates to hulls, structures, items, and physics bodies are now executed in parallel where safe, and item updates are only performed when necessary. Also parallelized submarine and physics body transform updates.
2025-12-26 21:04:07 +08:00
NotAlwaysTrue
5446795196 Fixed #7 (re-applied) 2025-12-26 11:07:54 +08:00
NotAlwaysTrue
31ed540939 OBT/1.0.2
Fixed #10
Fixed #12
Sync with upstream
2025-12-26 01:19:04 +08:00
NotAlwaysTrue
e715fdc835 Fixed #10
Fixed #12
2025-12-26 01:16:05 +08:00
Evil Factory
81f44969ee Fix memory leak that happens when you press retry in singleplayer 2025-12-25 23:42:55 +08:00
Evil Factory
886eebdbb2 Fix memory leak that happens when you press retry in singleplayer 2025-12-23 20:47:40 -03:00
NotAlwaysTrue
fc35d888fc Merge pull request #6 from NotAlwaysTrue/master-dev 2025-12-23 23:12:38 +08:00
NotAlwaysTrue
eb01597dd3 Try-catch Sever Entity Event Manager thread-safety issue 2025-12-23 22:38:06 +08:00
Eero
572430cc2b Add server-only usage warning to README
Added prominent warnings in both English and Chinese indicating that this release is intended for server-side use only and should not be run on the client. Users are advised to thoroughly test compatibility before deployment.
2025-12-23 13:19:10 +08:00
eero
7b263676e0 Reapply "Refactor ServerEntityEventManager event processing"
This reverts commit bdd6c52e4e.
2025-12-23 00:36:47 +08:00
NotAlwaysTrue
c8123383d5 Add another try-catch to avoid Destination array was not long enough. Check the destination index, length, and the array's lower bounds issue 2025-12-23 00:17:45 +08:00
eero
bdd6c52e4e Revert "Refactor ServerEntityEventManager event processing"
This reverts commit de65cd88bc.
2025-12-23 00:16:02 +08:00
eero
de65cd88bc Refactor ServerEntityEventManager event processing
Introduces async event processing with cancellation support using SemaphoreSlim and CancellationTokenSource. Improves client event handling logic, separates in-game and mid-round sync clients, and adds proper disposal of resources. Enhances robustness and maintainability of event management.
2025-12-23 00:07:47 +08:00
NotAlwaysTrue
83ca51a99b Fixed compile errors :( 2025-12-22 22:58:22 +08:00
NotAlwaysTrue
1def7b7b8d add catch code for previous commit :( 2025-12-22 22:54:33 +08:00
NotAlwaysTrue
dadd6c598f try-finally multiple UniqueEvents.ToList() to avoid issues(Destination array was not long enough. Check the destination index, length, and the array's lower bounds) 2025-12-22 22:43:02 +08:00
NotAlwaysTrue
b891ec7793 Add a try-finally in HumanPrefab to fix an issue causing issue(Destination array was not long enough. )
Fixed another Collection was modified in SubmarineBody.Update()
2025-12-22 21:51:07 +08:00
eero
5b823d8684 Clarify thread safety in update methods
Updated comments in GameScreen.cs to indicate that StatusEffect.UpdateAll and Character.UpdateAnimAll are not thread-safe and must be executed on the main thread. Also removed a non-English comment from MapEntity.cs for consistency.
2025-12-22 18:07:17 +08:00
eero
b146fa326d Refactor MapEntity.UpdateAll for improved parallelism
Rewrites MapEntity.UpdateAll to use more granular parallelism, reducing contention and improving performance by parallelizing hull, structure, and gap resets, while keeping order-dependent and non-thread-safe updates sequential. Updates GameScreen to pass ParallelOptions to UpdateAll.
2025-12-22 17:48:14 +08:00
NotAlwaysTrue
bab02fca8a Tried to fix all errors realted to UniqueEvent and Events(Collection was modified) 2025-12-22 17:16:49 +08:00
NotAlwaysTrue
0b6882c37f Reduced max threadcount for main thread to avoid issue 2025-12-22 17:00:03 +08:00
NotAlwaysTrue
b1072b7a50 Merge branch 'Dev' of https://github.com/NotAlwaysTrue/LuaCsForBarotraumaEP into Dev 2025-12-22 16:58:00 +08:00
NotAlwaysTrue
70a039da83 Added a command to show server perfomence (ShowServerPerf)
Removed unwanted PhysicsTask that was accideltally readded via revert action
Removed a parallel operation for SE.UpdateAll and ME.UpdateAll.
Cancelled roll back for ServerEntityEventManager
2025-12-22 16:57:58 +08:00
eero
7efb112058 Add contributors and Chinese documentation to README
Added a Main Contributors section and acknowledgements to the README. Also included a full Chinese translation of the project introduction, contributors, acknowledgements, and setup instructions.
2025-12-22 16:57:43 +08:00
NotAlwaysTrue
9c2f300325 Rolled back ServerEntityEventManager 2025-12-22 15:56:29 +08:00
eero
4d4f1f8351 Parallelize game update loops for performance
Refactored GameScreen update logic to use Parallel.Invoke and Parallel.ForEach for physics bodies, submarines, particles, level, characters, map entities, and status effects. This change aims to improve performance by leveraging multi-core processing. Also removed a debug Console.WriteLine from GameMain.
2025-12-22 15:47:15 +08:00
eero
9dc98192f4 Merge branch 'Dev' of https://github.com/NotAlwaysTrue/LuaCsForBarotraumaEP into Dev 2025-12-22 10:08:24 +08:00
eero
b1a9757b40 Revert "Enable and improve threaded physics execution"
This reverts commit 7d9642a5b1.
2025-12-22 10:07:24 +08:00
NotAlwaysTrue
522f58511c (Temp) Fixed an issue causing SV to crash due to PhysicsThread(Cannot modify the transform of a body when the World is locked) 2025-12-22 09:14:27 +08:00
NotAlwaysTrue
d98f9de5d4 Updated PM, uses 60s average to match message update time, modified message to display Server Running Time(Total Time Elapsed) in h:m:s.ms format
Readded perviously removed update interval condition
2025-12-22 00:24:33 +08:00
eero
7d9642a5b1 Enable and improve threaded physics execution
Activated the RUN_PHYSICS_IN_SEPARATE_THREAD directive and refactored the physics threading logic. Added cancellation support, improved error handling, and used synchronization primitives to coordinate physics updates. These changes aim to improve performance and stability when running physics in a separate thread.
2025-12-22 00:16:25 +08:00
NotAlwaysTrue
dc08b6b92a Merge branch 'Dev' of https://github.com/NotAlwaysTrue/LuaCsForBarotraumaEP into Dev 2025-12-22 00:07:04 +08:00
NotAlwaysTrue
220ccb2eac Updated CreateEvent() to make it thread safe 2025-12-22 00:07:01 +08:00
eero
eb8c59efb5 Add .vscode/settings.json to .gitignore
Exclude VS Code workspace settings from version control to prevent local configuration from being committed.
2025-12-22 00:02:02 +08:00
NotAlwaysTrue
f87e943a1a Move a lot of thing around to fix collection was modified.
Note: For now I can only adjust orders and cannot make some real thing. It will take time to check and refactor everything necessary.
2025-12-20 14:16:51 +08:00
NotAlwaysTrue
2f845b40ca Moved Item related stuff to the end of MapEntity.UpdateAll to avoid issues
Added a threadlock to avoid some issue(someday i will take care of)
Add a function that automatically log server performence every 60s
2025-12-20 00:08:42 +08:00
NotAlwaysTrue
d0a5d13a0e Update README.md
Use same stuff in main branch
2025-12-19 13:59:32 +08:00
NotAlwaysTrue
fff157d5ca Added a Performence Monitor for debug
Many multi-threading work in ServerSource
2025-12-19 13:43:12 +08:00
Evil Factory
c38d519ee6 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2025-12-18 08:15:42 -03:00
Evil Factory
352625af28 Merge remote-tracking branch 'upstream/master' 2025-12-08 12:35:44 -03:00
Evil Factory
0d223636f6 Merge branch 'master' of https://github.com/regalis11/Barotrauma 2025-10-22 10:55:51 -03:00
Evil Factory
9799a2a97b Merge remote-tracking branch 'upstream/master' 2025-10-10 08:41:26 -03:00
Evil Factory
e902ba673d Merge remote-tracking branch 'upstream/master' 2025-10-02 08:12:37 -03:00
Evil Factory
da13162c60 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2025-09-25 09:00:20 -03:00
Evil Factory
a88ad75645 Merge branch 'develop' 2025-09-17 08:36:43 -03:00
Evil Factory
cfab935b75 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-09-17 08:30:35 -03:00
EvilFactory
ad837423a8 Merge branch 'develop' 2025-07-01 17:56:36 -03:00
EvilFactory
b8fd8980a7 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-07-01 17:55:43 -03:00
EvilFactory
f8b02b372c Run tests on dotnet version 8 too 2025-06-17 15:54:38 -03:00
EvilFactory
a5d4d0c88e CI dotnet version 8.0 2025-06-17 15:52:34 -03:00
EvilFactory
2368640841 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-06-17 15:45:16 -03:00
Ydrec
8af2267c53 Add ScriptClr convesion for GUITextBlock.ClickableArea.OnClickDelegate (#254) 2025-05-31 16:43:26 -03:00
EvilFactory
90a1453755 Upgraded MonoMod.RuntimeDetour to 25.2.3 2025-05-04 10:12:15 -03:00
EvilFactory
64faf5c967 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2025-04-29 07:27:36 -03:00
EvilFactory
4916de359c Upgrade HarmonyX to 2.14.0 2025-04-18 19:33:03 -03:00
EvilFactory
5e321a5abd Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-04-16 18:08:37 -03:00
EvilFactory
3ac4ae992c Added new monomod dlls to refs 2025-04-10 16:00:25 -03:00
EvilFactory
126253d81d Trigger push 2025-04-10 11:34:53 -03:00
EvilFactory
5158f53786 guh 2025-04-10 11:23:27 -03:00
EvilFactory
9679880059 gotta be kidding me 2025-04-10 11:15:54 -03:00
EvilFactory
ca3e99a095 Fixed CI 2025-04-10 11:07:29 -03:00
EvilFactory
546450712d Fixed compiler errors 2025-04-10 10:55:39 -03:00
EvilFactory
103871a4e9 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-04-10 10:37:09 -03:00
EvilFactory
fdfc3a77f3 HarmonyX 2025-04-04 09:59:38 -03:00
EvilFactory
6da26ffa93 Merge remote-tracking branch 'upstream/master' into develop 2024-12-11 10:44:53 -03:00
EvilFactory
b4f264df04 Fixed destination path not being checked 2024-11-25 15:48:55 -03:00
EvilFactory
9e9ac6cd32 Merge remote-tracking branch 'upstream/master' into develop 2024-10-31 06:31:11 -03:00
EvilFactory
6ab0e7bee4 Fixed IsRunningInsideWorkshop check being inverted 2024-10-29 18:18:19 -03:00
EvilFactory
d906066425 Merge remote-tracking branch 'upstream/master' into develop 2024-10-28 10:10:02 -03:00
EvilFactory
0daaaf9fca Fixed character.giveJobItems being in the wrong order due to the merge 2024-10-26 13:51:56 -03:00
EvilFactory
0cf0fce4d9 Don't run network test if we don't have the Content folder present 2024-10-22 14:33:29 -03:00
EvilFactory
32525b5676 Fixed broken tests 2024-10-22 14:12:44 -03:00
EvilFactory
14d3402b8d Fixes for the new update 2024-10-22 13:02:59 -03:00
EvilFactory
30a8f0c561 Merge remote-tracking branch 'upstream/master' into develop 2024-10-22 12:42:35 -03:00
EvilFactory
3e4b649162 Update moonsharp and move extension methods to register Lua file 2024-10-07 19:22:24 -03:00
EvilFactory
068d49f9c5 Register Lua conversion for Character,Character 2024-10-04 18:39:29 -03:00
EvilFactory
01207c86ff Make NetworkConnection.TimeoutThreshold non constant 2024-09-11 21:36:00 -03:00
EvilFactory
307c81c3bd Fixed lag caused by character.damageLimb 2024-09-06 18:58:08 -03:00
EvilFactory
911fff14e9 Fixed bug report form 2024-09-06 17:48:41 -03:00
EvilFactory
09cd745765 Merge remote-tracking branch 'upstream/master' into develop 2024-09-06 17:45:41 -03:00
dependabot[bot]
1394e52635 Bump zgosalvez/github-actions-ensure-sha-pinned-actions (#217)
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 3.0.10 to 3.0.11.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](b88cd0aad2...3c16e895bb)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-30 16:53:29 -03:00
EvilFactory
0657efce21 Fixed compile error 2024-08-28 13:09:33 -03:00
EvilFactory
d71ced9d05 Merge https://github.com/Regalis11/Barotrauma into develop 2024-08-28 12:57:31 -03:00
EvilFactory
a823eabea2 Make everything in NetConfig static instead of constant so mods can change it 2024-08-27 22:16:38 -03:00
EvilFactory
03b8efc95f Updated manual install doc 2024-08-27 19:42:29 -03:00
EvilFactory
303f1cfb0b Fixed fields have incorrect realm 2024-08-26 18:59:39 -03:00
EvilFactory
7455b5b1c1 Added constructors to docs 2024-08-25 17:22:55 -03:00
EvilFactory
4e9ef97fac Added GUI.* to Lua docs 2024-08-25 16:49:45 -03:00
EvilFactory
fd29b395a7 Fixed formatting 2024-08-25 14:31:04 -03:00
EvilFactory
5e02b3e082 Fixed links 2024-08-25 14:20:07 -03:00
EvilFactory
3788e4641c Improved CSharp documentation 2024-08-25 14:06:17 -03:00
dependabot[bot]
74d27d8fd3 Bump actions/upload-artifact from 4.3.4 to 4.3.6 (#216)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.4 to 4.3.6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b2256b8c0...834a144ee9)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-17 12:38:10 -03:00
EvilFactory
8d3d01c9e3 Added LuaUserData.HasMember and made CreateStatic automatically add call metatable if it the type has a constructor 2024-08-08 19:30:41 -03:00
EvilFactory
496ce0fb91 Added FarseerCollision stuff to default register 2024-08-08 18:53:25 -03:00
EvilFactory
6e622162e9 Revert "Upgrade Harmony to 2.3.3 (will revert if it causes issues)"
This reverts commit 071bfa2032.
2024-08-01 20:06:02 -03:00
EvilFactory
071bfa2032 Upgrade Harmony to 2.3.3 (will revert if it causes issues) 2024-08-01 18:19:07 -03:00
dependabot[bot]
bfd5c2ac8c Bump actions/checkout from 4.1.6 to 4.1.7 (#209)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.6 to 4.1.7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](a5ac7e51b4...692973e3d9)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 18:33:36 -03:00
dependabot[bot]
fa7bd754cf Bump zgosalvez/github-actions-ensure-sha-pinned-actions (#211)
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 3.0.5 to 3.0.10.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](40e45e738b...b88cd0aad2)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 18:33:28 -03:00
dependabot[bot]
e0ee2779d3 Bump actions/upload-artifact from 4.3.3 to 4.3.4 (#212)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.3 to 4.3.4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65462800fd...0b2256b8c0)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 18:33:19 -03:00
dependabot[bot]
2ae31cac3f Bump actions/download-artifact from 4.1.7 to 4.1.8 (#213)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.7 to 4.1.8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](65a9edc588...fa0a91b85d)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 18:33:09 -03:00
dependabot[bot]
2bd862fd3c Bump actions/setup-dotnet from 4.0.0 to 4.0.1 (#214)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](4d6c8fcf3c...6bd8b7f777)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 18:32:54 -03:00
EvilFactory
03f1ec4c1d Added GUIContextMenu and ContextMenuOption 2024-07-03 12:04:41 -03:00
EvilFactory
490ff655f3 CrewManagement -> HRManagerUI 2024-06-27 11:41:52 -03:00
EvilFactory
55e97a8baa Merge remote-tracking branch 'upstream/master' into develop 2024-06-27 10:52:55 -03:00
EvilFactory
f4219b0c75 Merge remote-tracking branch 'upstream/master' into develop 2024-06-19 12:45:44 -03:00
EvilFactory
91cc7dd1cd Fixed compiler errors and project files 2024-06-18 12:41:37 -03:00
EvilFactory
e163f7ed73 Merge remote-tracking branch 'upstream/master' into develop 2024-06-18 12:19:13 -03:00
dependabot[bot]
60d0a8d453 Bump actions/checkout from 4.1.2 to 4.1.6 (#206)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](9bb56186c3...a5ac7e51b4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 15:07:53 -03:00
dependabot[bot]
feb6ebb432 Bump dorny/test-reporter from 1.9.0 to 1.9.1 (#205)
Bumps [dorny/test-reporter](https://github.com/dorny/test-reporter) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/dorny/test-reporter/releases)
- [Changelog](https://github.com/dorny/test-reporter/blob/main/CHANGELOG.md)
- [Commits](c40d89d5e9...31a54ee7eb)

---
updated-dependencies:
- dependency-name: dorny/test-reporter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 15:07:36 -03:00
dependabot[bot]
04989c33f5 Bump zgosalvez/github-actions-ensure-sha-pinned-actions (#204)
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 3.0.4 to 3.0.5.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](19ebcb0bab...40e45e738b)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 15:07:23 -03:00
dependabot[bot]
15c6f0fd53 Bump actions/download-artifact from 4.1.5 to 4.1.7 (#201)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.5 to 4.1.7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](8caf195ad4...65a9edc588)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 15:07:05 -03:00
dependabot[bot]
6e876b38b0 Bump actions/upload-artifact from 4.3.2 to 4.3.3 (#198)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.2 to 4.3.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](1746f4ab65...65462800fd)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 15:06:56 -03:00
EvilFactory
757a7a1c37 Treat forced mods as normal is true by default 2024-05-23 13:07:58 -03:00
EvilFactory
c518b696f6 Merge remote-tracking branch 'upstream/master' into develop 2024-05-02 12:25:49 -03:00
EvilFactory
b98dec4c3b Merge remote-tracking branch 'upstream/master' into develop 2024-04-26 12:31:21 -03:00
EvilFactory
bfca2816c3 Added enum CanEnterSubmarine 2024-04-25 06:33:19 -03:00
EvilFactory
079b0c3648 Fixed merge errors 2024-04-24 12:34:59 -03:00
EvilFactory
0a9ff43986 Merge remote-tracking branch 'upstream/master' into develop 2024-04-24 12:20:11 -03:00
EvilFactory
10ad5d296e Renamed GUI.Style to match the rest 2024-04-21 14:34:20 -03:00
EvilFactory
38f8e26635 Added IReadMessage and IWriteMessage plus some enums to the documentation 2024-04-20 19:45:42 -03:00
dependabot[bot]
fb725f9433 Bump actions/download-artifact from 4.1.4 to 4.1.5 (#197)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.4 to 4.1.5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](c850b930e6...8caf195ad4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 18:49:33 -03:00
dependabot[bot]
968de086ed Bump actions/upload-artifact from 4.3.1 to 4.3.2 (#196)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.1 to 4.3.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](5d5d22a312...1746f4ab65)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 18:49:22 -03:00
dependabot[bot]
10cb862269 Bump zgosalvez/github-actions-ensure-sha-pinned-actions (#195)
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 3.0.3 to 3.0.4.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](ba37328d4e...19ebcb0bab)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 18:49:00 -03:00
dependabot[bot]
54e1c62fc5 Bump peaceiris/actions-gh-pages from 3.9.3 to 4.0.0 (#194)
Bumps [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages) from 3.9.3 to 4.0.0.
- [Release notes](https://github.com/peaceiris/actions-gh-pages/releases)
- [Changelog](https://github.com/peaceiris/actions-gh-pages/blob/main/CHANGELOG.md)
- [Commits](373f7f263a...4f9cc6602d)

---
updated-dependencies:
- dependency-name: peaceiris/actions-gh-pages
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 18:48:44 -03:00
dependabot[bot]
c562982b05 Bump dorny/test-reporter from 1.8.0 to 1.9.0 (#193)
Bumps [dorny/test-reporter](https://github.com/dorny/test-reporter) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/dorny/test-reporter/releases)
- [Changelog](https://github.com/dorny/test-reporter/blob/main/CHANGELOG.md)
- [Commits](eaa763f6ff...c40d89d5e9)

---
updated-dependencies:
- dependency-name: dorny/test-reporter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 18:48:19 -03:00
EvilFactory
71376cfe5f You can now grab the parameters passed into XML status effects and added a variation of the Hook Add method that only takes the event name 2024-04-20 18:47:07 -03:00
EvilFactory
123a212251 Register KarmaManager 2024-04-17 20:00:25 -03:00
EvilFactory
ac69537784 Merge remote-tracking branch 'upstream/master' into develop 2024-04-16 12:20:09 -03:00
EvilFactory
5e89e2ea11 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2024-04-12 12:11:06 -03:00
EvilFactory
895924b537 Register EpicAccountId 2024-04-11 06:31:35 -03:00
EvilFactory
3f014660cc Pass in a copy of the config instead 2024-04-02 12:49:04 -03:00
EvilFactory
077cd0bec3 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2024-04-02 12:28:51 -03:00
EvilFactory
7dc75c6dd2 Fixed stackoverflow caused by ParseDerived due to GetDerivedNonAbstract not returning abstract types 2024-03-29 11:32:35 -03:00
EvilFactory
ee337e4f18 Fixed config not saving 2024-03-28 23:39:29 -03:00
EvilFactory
06a226a26e Fixed wrong xml attribute name 2024-03-28 21:20:02 -03:00
EvilFactory
85a6a26fcd Include BarotraumaCore in the publicized assemblies 2024-03-28 18:59:59 -03:00
EvilFactory
5a4a85564a Forgor to change this text 2024-03-28 18:15:34 -03:00
EvilFactory
8b4f5d1d04 Fixed the prevent-crash-on-missing-dir patch 2024-03-28 16:54:25 -03:00
EvilFactory
19af26ddbe Fixed the disable-interactivity CI patch 2024-03-28 16:48:50 -03:00
EvilFactory
a55b165d9e Added new assemblies to CI 2024-03-28 16:39:43 -03:00
EvilFactory
bf34934e9c Merge fixes 2024-03-28 16:19:53 -03:00
EvilFactory
a95ef7ac08 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2024-03-28 16:18:15 -03:00
EvilFactory
eabbf92c16 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2024-03-28 15:14:18 -03:00
EvilFactory
7a74cd052f Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2024-03-28 14:26:18 -03:00
EvilFactory
b3ac01cb22 Remove all uses of the Cs Package now that we don't need it anymore
LuaCs Settings no longer uses LuaCsConfig
Cs Package is no longer is used for enabling CSharp Scripting (except for dedicated server, to not make those people confused)
Added popups for when you have CSharp mods enabled but don't have CSharp enabled when going to singleplayer/multiplayer
2024-03-19 19:03:32 -03:00
dependabot[bot]
4079e0ef65 Bump actions/checkout from 4.1.1 to 4.1.2 (#192)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](b4ffde65f4...9bb56186c3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:28:23 -03:00
dependabot[bot]
4b9325bdc8 Bump actions/download-artifact from 4.1.1 to 4.1.4 (#191)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.1 to 4.1.4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](6b208ae046...c850b930e6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:28:15 -03:00
dependabot[bot]
3538f9c954 Bump actions/upload-artifact from 4.3.0 to 4.3.1 (#189)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.0 to 4.3.1.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](26f96dfa69...5d5d22a312)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:28:08 -03:00
dependabot[bot]
f41c1a6e2c Bump actions/download-artifact from 4.1.0 to 4.1.1 (#181)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](f44cd7b40b...6b208ae046)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 15:20:45 -03:00
dependabot[bot]
9419e2f79f Bump actions/upload-artifact from 4.0.0 to 4.3.0 (#185)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.0.0 to 4.3.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](c7d193f32e...26f96dfa69)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 15:20:37 -03:00
dependabot[bot]
038f4b57cd Bump dorny/test-reporter from 1.7.0 to 1.8.0 (#187)
Bumps [dorny/test-reporter](https://github.com/dorny/test-reporter) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/dorny/test-reporter/releases)
- [Changelog](https://github.com/dorny/test-reporter/blob/main/CHANGELOG.md)
- [Commits](afe6793191...eaa763f6ff)

---
updated-dependencies:
- dependency-name: dorny/test-reporter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 15:20:31 -03:00
EvilFactory
a159c4188b Fix up links 2024-01-13 17:04:45 -03:00
EvilFactory
1a651372f6 Updated CS docs 2024-01-13 16:49:31 -03:00
EvilFactory
40beade15a Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2024-01-11 11:42:33 -03:00
dependabot[bot]
8b3d8ba027 Bump zgosalvez/github-actions-ensure-sha-pinned-actions (#178)
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](b1b635d242...ba37328d4e)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-20 20:52:09 -03:00
dependabot[bot]
40f21c6f5b Bump actions/upload-artifact from 3.1.3 to 4.0.0 (#176)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.3 to 4.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](a8a3f3ad30...c7d193f32e)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-20 20:52:02 -03:00
dependabot[bot]
d313ba2f4a Bump actions/download-artifact from 3.0.2 to 4.1.0 (#179)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3.0.2 to 4.1.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](9bc31d5ccc...f44cd7b40b)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-20 20:51:50 -03:00
EvilFactory
2ebaa72a12 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-12-20 11:34:03 -03:00
EvilFactory
2043f6411c Set TreatForcedModsAsNormal to true by default 2023-12-17 14:58:13 -03:00
EvilFactory
a0044d03c2 Fixed Lua dispose method not being called if you reload manually 2023-12-17 12:34:30 -03:00
EvilFactory
a846ff2ea5 Fixed whoopie in the Hide UserNames setting 2023-12-14 13:05:35 -03:00
EvilFactory
b8d238618f Remove System.ValueType since it causes issues with enums 2023-12-14 13:02:24 -03:00
EvilFactory
7c890b158c Fixed compile errors 2023-12-14 12:13:42 -03:00
EvilFactory
448e4cdfbb Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-12-14 11:56:39 -03:00
dependabot[bot]
283d9db518 Bump zgosalvez/github-actions-ensure-sha-pinned-actions (#174)
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](b35f285b9b...b1b635d242)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-10 12:44:52 -03:00
dependabot[bot]
5d27d6d2ab Bump actions/github-script from 6.4.1 to 7.0.1 (#172)
Bumps [actions/github-script](https://github.com/actions/github-script) from 6.4.1 to 7.0.1.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](d7906e4ad0...60a0d83039)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-10 12:44:35 -03:00
EvilFactory
8eee3b070b Removed CS8602 warning as error so CI stops blowing up due to an error in upstream 2023-12-10 12:42:04 -03:00
dependabot[bot]
d45a320b42 Bump actions/setup-dotnet from 3.2.0 to 4.0.0 (#173)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 3.2.0 to 4.0.0.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](3447fd6a9f...4d6c8fcf3c)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-10 12:38:02 -03:00
EvilFactory
4fa52406a0 Turn the acl unloading warning into just a debug message 2023-12-10 12:29:11 -03:00
EvilFactory
9149fcbdc4 Fixed System.ValueType register 2023-12-10 12:26:50 -03:00
EvilFactory
c7b8cda902 Hide host machine UserName when displaying error logs 2023-12-10 12:26:38 -03:00
EvilFactory
e5e85e948b Register FileSender 2023-11-19 12:09:31 -03:00
EvilFactory
e544105a3e Register System.ValueType`2 2023-11-12 11:00:06 -03:00
EvilFactory
eeb7e3080f Potential fix for #158 2023-11-10 10:59:03 -03:00
dependabot[bot]
e67b2c8121 Bump zgosalvez/github-actions-ensure-sha-pinned-actions (#168)
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 2.1.4 to 3.0.1.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](f32435541e...b35f285b9b)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-10 09:52:24 -03:00
EvilFactory
b841dee7ad Fixed Initialize being called instead of CheckInitialized if you downloaded mods from the mod screen 2023-11-06 20:28:24 -03:00
EvilFactory
46a841b5c1 Potential fix for the wrong publicized folder being loaded 2023-11-02 19:40:36 -03:00
EvilFactory
759f66cf9f Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-10-30 12:40:09 -03:00
MapleWheels
17b304a349 - Made it only load the barotrauma or dedicatedserver publicized dll. 2023-10-26 19:05:05 -04:00
MapleWheels
09ed9d60fb - saving changes before repo reset. 2023-10-26 17:43:37 -04:00
MapleWheels
e2695db011 - Fixed ACL name not being shown in warnings.
- Fixed thread lock recursion causing fileloadexceptions.
2023-10-26 16:25:01 -04:00
MapleWheels
2a931142a0 - Added NRE check for types list rebuilding. 2023-10-26 12:26:27 -04:00
MapleWheels
342a6bbcf9 - Added try-catch to assembly compilation call.
- Added empty list checks for metadata references building.
- Made ACL cleanup more reliable.
- Updated some GET functions in AssemblyManager to have better reliability and error handling.
2023-10-26 10:07:01 -04:00
EvilFactory
e237389ad9 Added extra info to the ACL failed log 2023-10-25 20:22:57 -03:00
EvilFactory
36f767f388 Removed GC.WaitForPendingFinalizers because it just causes the entire program to hang 2023-10-25 20:21:08 -03:00
EvilFactory
79dd55836f Fixed asm mods not being considered when prompting the user 2023-10-25 14:26:47 -03:00
EvilFactory
9a7ddd2e18 Removed a pointless warning and made turned some warnings into actual warnings 2023-10-25 12:25:37 -03:00
MapleWheels
aaa4a91e01 Squash. (#164)
- Added use internals attrib option to RunConfig
- Changed compilation and resolution to ignore disposed ACLs.
2023-10-25 06:29:01 -03:00
MapleWheels
9e48dda739 Scriptloading overhaul (#163)
* - Added option to RunConfig.cs for mods to compile with non-publicized assemblies.
- Added default values attrib to RunConfig.cs
- Added thread sleeping to CsPackageManager.Dispose() to give time before generating a strong-ref to check acl unload status.

* - Added PrintWarning to ModUtils.cs
- Made previously unloaded ACLs warning only.
- Made plugins unload after lua script disposal.
- Small code cleanups.
- Cleared acl record references on unloading.
- Made ACL unload run via event hook.

* Made non-pub asm compilation name the same long-a** name in XML, as per Evil's request.
2023-10-24 18:51:48 -03:00
MapleWheels
e984633ca5 - Fixed NRE in TryBeginDispose
- Made `OnException` event useful.
- Added some null checks where expected.
- Fixed overridden Unload not being called.
- Removed partial from AssemblyManager.cs
- Made ClearTypesList() actually work.
- Made exception details show in console on release builds.
- Made content package name show on plugin load.
- Made execution standard instead of none for autogenerated and erroneous RunConfigs.
2023-10-22 20:54:28 -03:00
EvilFactory
ac068aa3f9 Added CI for generating the refs zip 2023-10-21 09:22:03 -03:00
EvilFactory
d0dd49b70b Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2023-10-20 12:20:18 -03:00
EvilFactory
92e1469e8b Fixed a NRE in RunConfig 2023-10-20 10:59:48 -03:00
EvilFactory
39005ca32c Fixed inverted check in override traitors 2023-10-19 16:30:47 -03:00
EvilFactory
f6bac4f484 Added some traitor stuff to Lua register/lib 2023-10-19 16:09:14 -03:00
EvilFactory
b5d89c8c7b Fixed roundEnd not being called on the server 2023-10-19 15:27:17 -03:00
EvilFactory
3af538bd87 Fixed NRE with status effect luahook 2023-10-19 14:32:17 -03:00
EvilFactory
465b800471 Fixed Mac projects failing to compile (why does every update Mac specifically breaks slightly differently every time) 2023-10-19 13:56:47 -03:00
EvilFactory
b89f3fdd79 Reverted the if check in IsFriendlyNPCTurnedHostile check 2023-10-19 13:38:29 -03:00
EvilFactory
7f311a6526 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2023-10-19 13:36:40 -03:00
EvilFactory
a65d99021c Fixed merge and some errors 2023-10-19 12:53:49 -03:00
EvilFactory
ea1111cd6e Merge branch 'develop' of https://github.com/evilfactory/LuaCsForBarotrauma into develop 2023-10-19 12:45:23 -03:00
EvilFactory
9838cc59ee Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-10-19 12:18:30 -03:00
dependabot[bot]
8e10ca08ec Bump actions/checkout from 4.1.0 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8ade135a41...b4ffde65f4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-17 20:40:24 -03:00
dependabot[bot]
fc236be769 Bump actions/upload-artifact from 3.1.2 to 3.1.3
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b7f8abb15...a8a3f3ad30)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-10 16:18:09 -03:00
dependabot[bot]
064e3ca207 Bump actions/checkout from 3.5.3 to 4.1.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 4.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](c85c95e3d7...8ade135a41)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-10 16:18:01 -03:00
dependabot[bot]
ceb9579b07 Bump dorny/test-reporter from 1.6.0 to 1.7.0
Bumps [dorny/test-reporter](https://github.com/dorny/test-reporter) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/dorny/test-reporter/releases)
- [Changelog](https://github.com/dorny/test-reporter/blob/main/CHANGELOG.md)
- [Commits](c9b3d0e2bd...afe6793191)

---
updated-dependencies:
- dependency-name: dorny/test-reporter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-10 16:17:47 -03:00
EvilFactory
966236652a Copy publicized folder on install script and clean up 2023-10-08 17:49:46 -03:00
MapleWheels
3c4810264c Removed Debug-Only from StillUnloadingACLs. 2023-10-06 12:06:42 -03:00
MapleWheels
523ee8d641 - Added friendly name to ACLs for identification during unloading.
- Added debug messages showing mods that have not unloaded from a previous session.
2023-10-06 12:06:42 -03:00
MapleWheels
40c8f3e666 Changed publicized assembly discovery to fallback to the alternate option if the /Pubicized folder cannot be found. IE. Workshop Lua folder if Game folder is missing and vice versa. 2023-10-06 12:06:42 -03:00
MapleWheels
3708e837e7 Added duplicate package filtering to cs loader. Prioritizes loading LocalMods packages. 2023-10-06 12:06:42 -03:00
MapleWheels
a62b62185f Made it to load Publicized Assemblies from the Workshop folder if "Use Workshop Lua Setup" is checked in the main menu lua config. 2023-10-06 12:06:42 -03:00
MapleWheels
27c8a3ca2e Added CLR Type-search to GetTypesByName. Fixed error caused by generic type searching from Lua. 2023-10-06 12:06:42 -03:00
MapleWheels
5e03954afe Added threading controls to AppDomain type search. 2023-10-06 12:06:42 -03:00
MapleWheels
9bd23efd3c - Added additional validation to type name and added AppDomain-wide fallback search using Type.GetType if a type with the given name cannot be found in the cache. 2023-10-06 12:06:42 -03:00
MapleWheels
414d46b33e Assembly and Script Loading Overhauled. 2023-10-06 12:06:42 -03:00
EvilFactory
a58cb8251f Fixed afflictionUpdate only being called server-side 2023-09-25 09:43:06 -03:00
peelz
b8e8fbd3b3 Add tests for Hook.Patch overload disambiguation 2023-09-07 10:51:09 -03:00
dependabot[bot]
711b745145 Bump zgosalvez/github-actions-ensure-sha-pinned-actions
Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 2.1.3 to 2.1.4.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](555a30da26...f32435541e)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-11 12:03:45 -03:00
EvilFactory
8724254247 Fixed initialization not being called on the client if there's csharp mods present without the cs package 2023-08-11 11:52:44 -03:00
EvilFactory
1e385e9ed3 Update Networking docs 2023-07-10 18:58:31 -03:00
dependabot[bot]
5d0fdd5900 Bump notpeelz/action-gh-create-release from 5.0.0 to 5.0.1
Bumps [notpeelz/action-gh-create-release](https://github.com/notpeelz/action-gh-create-release) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/notpeelz/action-gh-create-release/releases)
- [Commits](a12edfc71d...c1bebd17c8)

---
updated-dependencies:
- dependency-name: notpeelz/action-gh-create-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-03 16:01:53 -03:00
EvilFactory
90e2105bc8 Fixed receive queue being given the wrong net message, causing the rest of the ReadIds message to be read incorrectly 2023-07-02 16:13:36 -03:00
EvilFactory
c9c6ca410b Register VisualSlot 2023-06-24 14:46:16 -03:00
EvilFactory
6b149e0498 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2023-06-21 10:36:16 -03:00
EvilFactory
fd74c08a8f Removed GapUpdateInterval (no longer required) 2023-06-15 13:53:28 -03:00
EvilFactory
da670e791c Removed AITrigger from registers 2023-06-15 12:49:11 -03:00
EvilFactory
a318e2a0c4 Fixed compile error 2023-06-15 12:32:26 -03:00
EvilFactory
15daa64f66 Merge https://github.com/Regalis11/Barotrauma into develop 2023-06-15 12:13:50 -03:00
EvilFactory
6b461e1026 Added cl_toggleluadebug to the multiplayer permitted commands 2023-06-11 13:33:38 -03:00
EvilFactory
3bc8f06e58 Throw a nicer error message if the user tries to use cl_lua without it being initialized 2023-06-10 20:36:29 -03:00
dependabot[bot]
b606cc770f Bump actions/checkout from 3.5.2 to 3.5.3
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e5e7e5ab8...c85c95e3d7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-10 20:34:04 -03:00
peelz
8cfb698c67 Fix upstream CS9104 compile error
This should let us build the project again while we wait for the upstream fix.
2023-06-05 20:03:27 -03:00
peelz
c7123aeec2 Fix run-tests workflow checking out incorrect target 2023-06-05 20:03:27 -03:00
peelz
0496e4ab75 Fix empty target error on scheduled nightly CI builds 2023-06-05 20:03:27 -03:00
EvilFactory
4ea50ee0f6 Fixed invalid type Voting
i am going insane
2023-06-05 19:53:54 -03:00
EvilFactory
2006294c94 Fixed create enum invalid type VoteType 2023-06-05 19:44:39 -03:00
EvilFactory
296feca265 Added Voting and VoteType to default lib 2023-06-02 17:48:12 -03:00
dependabot[bot]
c769ecf693 Bump actions/setup-dotnet from 3.1.0 to 3.2.0
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](aa983c550d...3447fd6a9f)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 21:16:54 -03:00
peelz
cf386943a5 Fix check-if-release-needed check for create-prerelease workflow 2023-05-28 00:15:27 -03:00
Evil Factory
560ebed848 Merge pull request #139 from notpeelz/feat-nightly-ci-builds
Add nightly CI builds
2023-05-27 23:29:09 -03:00
peelz
5e84d65cdc Rename CI workflow 'ref' inputs to 'target' 2023-05-27 22:23:34 -04:00
peelz
c6b9c753fe Change dependabot's config to target the dev branch 2023-05-27 22:23:34 -04:00
peelz
6348ddae63 Prevent CI from running publish-release for non-code changes 2023-05-27 22:23:34 -04:00
peelz
a36157e40f Add CI workflow for generating nightly builds 2023-05-27 22:23:33 -04:00
dependabot[bot]
a26b00a5d8 Bump notpeelz/action-gh-create-release from 4.0.0 to 5.0.0
Bumps [notpeelz/action-gh-create-release](https://github.com/notpeelz/action-gh-create-release) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/notpeelz/action-gh-create-release/releases)
- [Commits](35fc26709d...a12edfc71d)

---
updated-dependencies:
- dependency-name: notpeelz/action-gh-create-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-27 19:28:37 -04:00
dependabot[bot]
f08ec51640 Bump notpeelz/action-gh-create-release from 1.0.2 to 4.0.0
Bumps [notpeelz/action-gh-create-release](https://github.com/notpeelz/action-gh-create-release) from 1.0.2 to 4.0.0.
- [Release notes](https://github.com/notpeelz/action-gh-create-release/releases)
- [Commits](a3caaff31c...35fc26709d)

---
updated-dependencies:
- dependency-name: notpeelz/action-gh-create-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-27 16:27:13 -03:00
dependabot[bot]
b7c152df52 Bump actions/setup-dotnet from 3.0.3 to 3.1.0
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 3.0.3 to 3.1.0.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](607fce577a...aa983c550d)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-27 16:26:42 -03:00
peelz
1309a9a273 Add dependabot config 2023-05-26 20:39:32 -03:00
EvilFactory
abb9e1eb1d Added Util.GetItemGroup and Util.RegisterItemGroup 2023-05-26 19:56:17 -03:00
peelz
be178715a8 Use upstream deploy scripts in CI 2023-05-26 16:23:50 -03:00
peelz
8890607c53 Remove workaround for upstream duplicate-file-on-publish OSX issue 2023-05-26 16:23:50 -03:00
peelz
a5baf9cfba Migrate asm publicization to msbuild (#132)
* Make publish-release workflow fail on missing build artifacts
* Remove assembly publicization step from CI
* Add AssemblyPublicizer MSBuild task
* Add explanation for SatelliteResourceLanguages prop
* Move and document workaround for duplicate-file-on-publish OSX issue
* Move the Luatrauma.props import to the bottom of project files, this should give us a chance to override properties/items defined in the project file.
2023-05-25 16:31:46 -03:00
EvilFactory
f32da0bff7 Got rid of old unused properties, moved the remaining stuff to the separate props file and renamed the props file to Luatrauma.props 2023-05-25 13:32:18 -03:00
peelz
4017feca6d Remove vendored CI release action (#131) 2023-05-24 16:49:39 -03:00
EvilFactory
3836ed40d6 Fixed file access with the io module when using append mode 2023-05-23 17:56:05 -03:00
EvilFactory
2093e7ca7f Added GUIComponent to the GUI lib 2023-05-18 17:28:52 -03:00
EvilFactory
6b96927b23 Added docs for the util functions and fixed timer docs 2023-05-17 10:14:16 -03:00
EvilFactory
09c36a9213 Merge https://github.com/Regalis11/Barotrauma into develop 2023-05-11 11:22:12 -03:00
EvilFactory
9f84941792 Quick fix for failing MacOS builds 2023-05-10 12:06:51 -03:00
EvilFactory
2c45c3d020 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-05-10 11:55:46 -03:00
github-actions[bot]
768a1f309c Update submodule: Libraries/moonsharp 2023-05-09 15:51:56 +00:00
peelz
0219b3de73 Add publicized assemblies to CI archives (#129) 2023-05-09 12:39:52 -03:00
Evil Factory
eb3c126aea Merge pull request #128 from notpeelz/harden-ci-security
Vendor publish-release CI action
Add ensure-sha-pinned-actions action to CI pipeline
Pin CI actions to specific commit hashes
2023-05-09 11:26:15 -03:00
peelz
0a8fa6f5d4 Pin CI actions to specific commit hashes 2023-05-08 20:02:45 -04:00
peelz
4c1557e7fd Add ensure-sha-pinned-actions action to CI pipeline 2023-05-08 20:02:45 -04:00
peelz
32645c0dd2 Vendor publish-release CI action
This replaces `marvinpinto/action-automatic-releases`, which hasn't been
updated since Jan 29 2022.
2023-05-08 20:02:45 -04:00
EvilFactory
886fa9ed80 Prevent some types from being re-registered 2023-05-08 13:13:47 -03:00
Evil Factory
836e5daca6 Merge pull request #127 from notpeelz/add-server-files-to-ci-client-patch
Simplify CI publish-release script
Remove dotnet 3.1 from CI dependencies
Add server files to CI client patch archives
2023-05-08 12:54:58 -03:00
peelz
e9e0e852ba Add server files to CI client patch archives 2023-05-08 11:42:18 -04:00
peelz
9974c33c89 Remove dotnet 3.1 from CI dependencies 2023-05-08 11:42:18 -04:00
peelz
1b4cc62bcc Simplify CI publish-release script 2023-05-08 11:42:18 -04:00
EvilFactory
bf988aa9ef Correctly handle errors in util methods 2023-05-06 13:38:52 -03:00
EvilFactory
8e6f8cc5e6 Added support for workshop install for other platforms (MacOS is likely still borked, but I don't have a Mac to test it) 2023-05-03 12:38:29 -03:00
EvilFactory
8df9f7798e Implemented a custom PlatformAccessor and re-added the rest of the io and os libraries 2023-05-01 13:24:18 -03:00
EvilFactory
29a2e07b1f Set TopLevelBinderFlags to IgnoreAccessibility for CsMods, so they are able to access non-public members by default 2023-04-28 14:45:45 -03:00
EvilFactory
5de8d0293f Registered MathUtils and XMLExtensions as extension types, moved GetType to a better place 2023-04-25 21:27:11 -03:00
EvilFactory
93a5065171 Added conversion for OnAttacked and OnDeath handlers and added new hook character.damageLimb 2023-04-25 10:20:24 -03:00
EvilFactory
9415219141 Register DamageModifier 2023-04-20 12:48:40 -03:00
EvilFactory
828cb99644 Added basic documentation for LuaUserData 2023-04-14 14:46:55 -03:00
EvilFactory
fa9b9baf68 Register some missing GUI types 2023-04-14 14:26:34 -03:00
EvilFactory
1186719e62 Fixed some types not being able to be registered when they actually should 2023-04-12 12:45:06 -03:00
EvilFactory
aa0be735f9 Initialize Lua on tutorials and register Exception (for compatibility) 2023-04-12 12:32:25 -03:00
EvilFactory
20cb4bf320 Fixed new lines in manual install page (thanks ldocs) 2023-04-12 12:19:48 -03:00
EvilFactory
e2a70f3b4a Merge https://github.com/Regalis11/Barotrauma into develop 2023-04-12 11:44:22 -03:00
EvilFactory
ee7ca80d88 Merge branch 'feature/lua-debugging' into develop 2023-04-12 11:40:16 -03:00
EvilFactory
80f79864f5 Added MoonSharp.VsCodeDebugger.dll to CI 2023-04-12 11:38:29 -03:00
EvilFactory
f2a3c38c79 Added item.removed to docs and fixed some minor things 2023-04-11 12:34:15 -03:00
EvilFactory
d0519cb982 Register WallSection 2023-04-10 06:31:25 -03:00
EvilFactory
0f49932604 Re-enabled the lua type filter again 2023-04-09 14:10:34 -03:00
EvilFactory
675b4f349c Added LuaUserData.IsRegistered 2023-04-09 14:07:26 -03:00
EvilFactory
8b225abea6 Improved manual install docs 2023-04-05 13:21:56 -03:00
EvilFactory
df79d22e93 Return empty table if we try to get ClientList in singleplayer 2023-04-01 11:40:25 -03:00
EvilFactory
ca1c294c7a Fixed character.death not getting called on the client 2023-03-30 18:37:13 -03:00
EvilFactory
728796494e Added a metatable to the GUI table that has an __index that points to the GUI clr 2023-03-28 19:20:49 -03:00
EvilFactory
2b37abf264 Made this gsub case insensitive so it doesn't break in case the mod's filelist has an incorrect case 2023-03-28 18:58:22 -03:00
EvilFactory
4303cf3111 Added support for MoonSharp's VsCodeDebugger 2023-03-27 15:20:14 -03:00
EvilFactory
9dc87c34f3 Fixed error "Attempt to perform operations with resources owned by different script" that would sometimes happen when reloading lua 2023-03-23 12:30:20 -03:00
EvilFactory
5fc25c2453 Added LuaUserData.MakePropertyAccessible 2023-03-22 14:09:10 -03:00
EvilFactory
e5043e79ea Remove unnecessary casts and added registration for ImmutableArray 2023-03-20 16:42:17 -03:00
EvilFactory
64215c5722 Allow specifying realm when generating docs for a single type and added PlayerInput to docs 2023-03-18 15:43:10 -03:00
EvilFactory
6974c5338a Simplify how None is handled and fixed libs getting loaded too late 2023-03-17 20:24:54 -03:00
EvilFactory
cf88aa4c5d Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-03-16 12:53:53 -03:00
EvilFactory
fa6b6a590f Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2023-03-13 14:43:39 -03:00
EvilFactory
05c325ac02 Fixed broken Option<T> conversion 2023-03-13 14:31:53 -03:00
EvilFactory
5a3f9ebc80 1.0 Merge fixes 2023-03-13 13:37:24 -03:00
EvilFactory
4a229c6427 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-03-13 13:32:14 -03:00
EvilFactory
3fe775405c Added more util functions 2023-03-08 17:22:49 -03:00
EvilFactory
ef28f7c5fe Initialize with the quickstart command (fixes #121) 2023-03-06 20:08:26 -03:00
EvilFactory
e8ca69dede Added debug symbols to the installer script 2023-03-06 12:59:55 -03:00
EvilFactory
4e0f2e1a49 Added Timer.NextFrame 2023-03-04 14:23:16 -03:00
EvilFactory
d9789b8438 Added some missing math functions from lua 2023-03-03 17:26:53 -03:00
EvilFactory
27cde50c08 Register particles, added Game.Paused which is always false to server-side, and exposed ParticleManager 2023-02-28 16:57:17 -03:00
EvilFactory
fb374a9ae3 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-02-21 13:27:49 -03:00
EvilFactory
8d745e3e6b Improved docs: Enums are now automatically generated 2023-02-16 13:51:35 -03:00
EvilFactory
757998a1e4 Improved docs: Members now have their realm set automatically and server-only members are now also included 2023-02-15 19:24:54 -03:00
EvilFactory
4e4e6c5465 Registered and added Event types to default lib 2023-02-15 16:55:10 -03:00
EvilFactory
5003d0beb7 Fixed GetComponentString not working with custom types and registered/added missing types 2023-02-13 17:06:48 -03:00
IDEKENTERPRISES
aaffb54141 Added saving http response content as a byte array to a file. (#124) 2023-02-09 17:48:01 -03:00
EvilFactory
3e1c0ca9af Added ability to include custom headers when sending http requests and made use of the new HttpClient 2023-02-07 17:08:37 -03:00
EvilFactory
4b206ada3e Fixed formatting again on the lua docs generator project 2023-02-06 18:11:17 -03:00
EvilFactory
cd5901f73a Removed leftover dead code from generate_docs.sh 2023-02-06 12:15:41 -03:00
EvilFactory
14c45e4900 Fixed indentation on docs generator project 2023-02-04 14:20:55 -03:00
EvilFactory
81970b3fd4 Added MissionType, Mission, MissionPrefab to default lib 2023-02-01 16:35:16 -03:00
EvilFactory
1023ca2062 Fixed NRE when calling receive in singleplayer (should just do nothing) 2023-02-01 15:27:11 -03:00
EvilFactory
ca9f232aaf Added Remove method for removing net messages 2023-01-31 19:16:38 -03:00
EvilFactory
0c00839458 Only send network debug when verbose logging is enabled and enabled compatibility for the net lobby screen 2023-01-31 14:47:27 -03:00
EvilFactory
bd5811eb48 Fixed failing tests 2023-01-31 13:37:33 -03:00
EvilFactory
a8171bd4e4 Fixed compile errors 2023-01-31 13:26:59 -03:00
EvilFactory
d60efb17cd Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-01-31 13:17:15 -03:00
EvilFactory
ba543aef2c Improved Networking
Network messages are now sent through a 2-byte Id to minimize overhead of using strings.
2023-01-29 13:21:19 -03:00
EvilFactory
5d552d9dd8 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-01-29 13:17:30 -03:00
EvilFactory
c0f7b1548a Merge https://github.com/Regalis11/Barotrauma into develop 2023-01-22 13:16:41 -03:00
EvilFactory
3ee27aaec3 Added AITarget to default lib 2023-01-21 19:10:01 -03:00
EvilFactory
8fcf0f7c8c Removed CsScriptRunner since its useless 2023-01-18 22:53:55 -03:00
EvilFactory
2073cdf5e5 Fixed timer crash once for all - yes it was a race condition 2023-01-17 14:17:43 -03:00
EvilFactory
17d125e6d5 Fixed RoundStarted returning incorrect values in sub editor 2023-01-17 13:16:30 -03:00
EvilFactory
a8da4f9cd1 Removed unused variable and added exception in case timer is null 2023-01-16 17:52:31 -03:00
EvilFactory
070d2c11a7 Fixed incorrect logger compatibility 2023-01-13 21:15:56 -03:00
EvilFactory
c9ea347789 Merge remote-tracking branch 'upstream/master' into develop 2023-01-13 20:36:45 -03:00
EvilFactory
c6f67ec01e Update intro.md 2023-01-12 23:39:14 -03:00
EvilFactory
5b44483600 Fixed typo 2023-01-09 18:08:22 -03:00
EvilFactory
3fe21dc782 Fixed incorrect handling of Lua hook return results 2023-01-08 17:21:52 -03:00
EvilFactory
94c68b9fe6 Added error overlay which is used to display errors in a more user friendly way, currently only used if the CSharp compilation fails 2023-01-06 19:58:15 -03:00
EvilFactory
9fcab5ff60 Added a ToString method for Lua primitive types and made the value public 2023-01-06 12:31:23 -03:00
EvilFactory
90a68edb4e Fixed unknown error logs being silently ignored and fixed timers causing crashes in some weird rare circumstances 2023-01-06 12:05:00 -03:00
EvilFactory
e9092d5620 Accidentally put the log compatibility class inside the logger class 2023-01-05 01:09:43 -03:00
EvilFactory
f252fce6ef Fixed steam items not being updated correctly 2023-01-03 17:13:07 -03:00
EvilFactory
6de4a1bd09 Expose logger to Lua 2022-12-29 15:58:51 -03:00
EvilFactory
82934cf9ed Added popups telling you to run CSharp when joining a server with CSharp mods enabled but without the Cs package 2022-12-29 15:58:51 -03:00
EvilFactory
c665d3e9c7 Added settings that allow you to force turn on CSharp, treat forced mods as normal and allow for the workshop lua setup to be the preferred one 2022-12-29 15:58:51 -03:00
EvilFactory
8fdf2156dc Introduce the LuaCsLogger class and make everything use that instead 2022-12-29 15:58:51 -03:00
EvilFactory
5807900556 Merge https://github.com/Regalis11/Barotrauma into develop 2022-12-20 12:29:13 -03:00
EvilFactory
5288b58d47 Register ConvertUtils and ToolBox 2022-12-18 15:00:23 -03:00
EvilFactory
dd71aacc49 Fix NRE in LuaCsInstaller in case the package isn't found 2022-12-17 22:24:24 -03:00
EvilFactory
2b871c8c48 Fix think hook getting called twice on the client 2022-12-15 09:12:03 -03:00
EvilFactory
fe2d0bdddb Fix Voip causing crashes 2022-12-14 13:57:20 -03:00
Evil Factory
e8389beef9 Publish releases even if tests failed
upstream is genius and has failing tests
2022-12-14 12:16:26 -03:00
EvilFactory
f520260f42 Merge branch 'develop-unstable' into develop 2022-12-14 12:11:08 -03:00
EvilFactory
5f4f0af89c Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop-unstable 2022-12-14 12:10:23 -03:00
EvilFactory
9d83afe905 Update docs 2022-12-12 19:44:57 -03:00
EvilFactory
015caba66d Register ContentFile, Steering and OutpostGenerator 2022-12-12 19:14:25 -03:00
EvilFactory
c739ea3952 Unstable fixes 2022-12-09 20:19:36 -03:00
EvilFactory
90c3cef977 Merge remote-tracking branch 'upstream/dev' into develop 2022-12-09 17:33:44 -03:00
EvilFactory
83c9c25164 Remove sandboxing statement from CS docs 2022-12-07 22:56:56 -03:00
EvilFactory
28225d880f Remove unused CsScriptFilter.cs 2022-12-07 22:50:59 -03:00
EvilFactory
505b6af2ee Fix LuaUserData.IsTargetType not behaving as originally due to it comparing types 2022-12-06 18:58:28 -03:00
EvilFactory
244dd8fad6 Register some missing GUI types and missions 2022-12-03 22:23:09 -03:00
EvilFactory
644238997b Disable this for now 2022-11-28 20:51:51 -03:00
EvilFactory
1ea26f1891 Fix threading issue introduced by #117 once for all 2022-11-28 16:49:11 -03:00
EvilFactory
08f18e2e69 Rename members to use correct case 2022-11-26 22:16:40 -03:00
EvilFactory
6f72df831e Add MapEntity to default lib 2022-11-26 21:59:53 -03:00
EvilFactory
0e8990ef02 Register EntityGrid 2022-11-24 16:59:24 -03:00
EvilFactory
16426c2605 Make status effect user accessible by default 2022-11-24 15:37:03 -03:00
EvilFactory
aee83bdf74 Fix threading issues introduced by #117 2022-11-22 14:10:13 -03:00
EvilFactory
ee1a87be19 Fix Game.RoundStarted reporting incorrect values on Singleplayer 2022-11-21 17:38:44 -03:00
EvilFactory
2931ef00ea Added TypeOf 2022-11-14 14:31:38 -03:00
EvilFactory
3ba75e5c44 You can now specify the types in LuaUserData.MakeMethodAccessible and cleaned the code up a bit 2022-11-14 14:20:52 -03:00
EvilFactory
1533d07f23 Fix roundStart and roundEnd hooks being called twice in sub editor 2022-11-14 14:07:38 -03:00
EvilFactory
6bc6e39e46 Fix typo in ACsMod 2022-11-13 23:36:47 -03:00
EvilFactory
0853357300 Move think hook to a better place 2022-11-13 15:56:37 -03:00
EvilFactory
a89840b4a7 Fix failing tests 2022-11-10 21:28:17 -03:00
EvilFactory
217f7b63a2 Added Md5Hash and made FIFO queue less cursed
Starting to run out of food.
2022-11-06 17:49:17 -03:00
EvilFactory
f7b046e950 Day 327: Still haven't managed to fix rare NRE that happens with timers
Starting to run out of food.
2022-11-03 21:07:29 -03:00
EvilFactory
dbc67cc489 Register WaterRenderer stuff 2022-11-03 20:38:07 -03:00
MapleWheels
d250c439d0 Support for Reflection Lookup of Mod Types (#117)
* Modified reflection utils to support lookup across multiple assemblies.
* Added registration of generated mod assembly to LuaCs Compiler.
2022-11-02 22:12:51 -03:00
EvilFactory
4164e36ec4 Fix Cs mods sometimes being added twice 2022-10-31 13:40:58 -03:00
EvilFactory
ef0bb33def Register Cargo and Upgrade types and remove old debug print 2022-10-30 19:21:15 -03:00
EvilFactory
6e4d4b0950 Fix inverted check 2022-10-30 18:57:16 -03:00
EvilFactory
3aff717600 Added Hook.Exists 2022-10-30 18:00:30 -03:00
EvilFactory
ba1157b07d Make init logs nicer 2022-10-30 16:34:01 -03:00
EvilFactory
e7d98dc887 Update Moonsharp for the new pcall exception handling 2022-10-29 20:30:02 -03:00
EvilFactory
b77dde156b Get docs in line and added networking manual 2022-10-29 19:44:23 -03:00
EvilFactory
09979cb4c9 Fix client-side commands working when they shouldn't 2022-10-28 15:14:43 -03:00
EvilFactory
d88a6b5ef0 Move logging stuff to a separate file 2022-10-28 13:19:23 -03:00
EvilFactory
9502d70290 Rename field and remove unnecessary usings 2022-10-28 12:42:35 -03:00
EvilFactory
5e29d1d8ba Fix mixed spaces and tabs 2022-10-28 12:29:35 -03:00
EvilFactory
43810a3509 Use WorkshopId instead and minor cleanup 2022-10-28 12:26:47 -03:00
EvilFactory
79b4edf7a8 Added VideoPlayer and Video 2022-10-27 12:48:29 -03:00
EvilFactory
8158213471 Added AccountId, Endpoint and TimeSpan for later 2022-10-25 12:50:17 -03:00
EvilFactory
c624ec6568 Added variations for some commands and improved their descriptions 2022-10-22 10:49:26 -03:00
EvilFactory
599db6be5e Merge https://github.com/Regalis11/Barotrauma 2022-10-20 12:14:02 -03:00
EvilFactory
032572de52 Added some missing level types 2022-10-14 12:53:06 -03:00
Evil Factory
4cf62f9fa5 Merge pull request #115 from notpeelz/feat-workflow-update-moonsharp
Add workflow for updating MoonSharp
2022-10-13 06:27:37 -03:00
peelz
6e70c9d094 Add workflow for updating MoonSharp 2022-10-13 00:35:59 -04:00
Evil Factory
942775570d Merge pull request #114 from notpeelz/fix-byref-properties
Fix accessing ByRef properties
2022-10-12 20:03:04 -03:00
peelz
591e3a71ea Update MoonSharp 2022-10-12 18:54:55 -04:00
EvilFactory
0ea644c6ca Fix build.ps1 copying files incorrectly 2022-10-08 11:17:06 -03:00
EvilFactory
18ee41c610 Remove unnecessary null checks and added missing return statement 2022-10-07 11:30:59 -03:00
EvilFactory
8fef89a255 Merge https://github.com/Regalis11/Barotrauma 2022-10-06 12:44:55 -03:00
EvilFactory
bbca25854c Register SettingsMenu 2022-10-06 12:43:37 -03:00
EvilFactory
1eed13fcd0 added support for None<T> and Some<T> and added some missing types from last update 2022-10-05 20:55:15 -03:00
Evil Factory
1123211fe2 Update publish CI to use net6.0 paths 2022-10-05 13:10:02 -03:00
EvilFactory
73720a07be Fix MacOS project compile error 2022-10-05 12:57:16 -03:00
EvilFactory
abec71bcf8 Merge branch 'unstable' 2022-10-05 12:22:18 -03:00
EvilFactory
41e3eb48ea Merge https://github.com/Regalis11/Barotrauma into unstable 2022-10-05 12:19:53 -03:00
EvilFactory
729110484f texture loader and option support 2022-10-05 12:17:40 -03:00
EvilFactory
011ac43226 Fix ForcedAutorun being called two times in some cases 2022-10-03 13:12:59 -03:00
EvilFactory
a3eff91c1a Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into unstable 2022-09-30 12:14:01 -03:00
EvilFactory
6c38a555bb Re-add ForceVoice and ForceLocalVoice as compatibility 2022-09-29 16:20:47 -03:00
Evil Factory
ada9a564f8 Merge pull request #112 from notpeelz/feat-publish-tarball
Publish tarballs for linux builds
2022-09-29 14:43:20 -03:00
EvilFactory
faad59f20d fix projects and compile errors 2022-09-29 14:08:59 -03:00
EvilFactory
77c63541eb Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into unstable 2022-09-29 12:13:55 -03:00
EvilFactory
2d5cff1752 More sound and content types 2022-09-29 11:47:31 -03:00
peelz
81701ae430 Add tarballs for linux artifacts 2022-09-29 01:27:57 -04:00
peelz
5a59b8204a Add support for wildcard files in publish-release workflow 2022-09-29 01:27:57 -04:00
EvilFactory
1a026c90a9 added some missing sound types 2022-09-27 20:23:37 -03:00
Evil Factory
91f212cb74 Merge pull request #111 from notpeelz/fix-overload-cache-corruption
Fix method overload cache corruption
2022-09-23 22:21:22 -03:00
peelz
82b4e6877d Update MoonSharp 2022-09-23 21:18:10 -04:00
EvilFactory
245e76cd8d Fix #106 turn list into an array before looping through hooks 2022-09-23 11:42:49 -03:00
Evil Factory
460a5f7a85 Merge pull request #109 from notpeelz/fix-patch-confusing-ctor-with-cctor
Fix Hook.Patch confusing .ctor with .cctor
2022-09-17 10:15:43 -03:00
peelz
c261f0c205 Add tests for ambiguous Hook.Patch signatures 2022-09-17 00:11:09 -04:00
peelz
cc414692be Change Hook.Patch exceptions to lua errors 2022-09-17 00:11:09 -04:00
peelz
cd8316ea4c Fix NRE in LuaUserData.GetType 2022-09-17 00:11:09 -04:00
peelz
6da732e997 Fix Hook.Patch confusing .ctor with .cctor 2022-09-17 00:11:09 -04:00
Evil Factory
6add57aa62 Merge pull request #108 from notpeelz/feat-patch-ctor
Add constructor support to Hook.Patch
2022-09-16 13:19:03 -03:00
peelz
2cdd3f3ec5 Add constructor support to Hook.Patch 2022-09-15 19:31:47 -04:00
peelz
8774a33914 Fix possible NRE when stopping while a patched method is running 2022-09-15 19:31:47 -04:00
peelz
025b840625 Fix test concurrency issues 2022-09-15 19:31:41 -04:00
peelz
32a96e39ee Update MoonSharp 2022-09-15 18:09:32 -04:00
EvilFactory
3914831921 register PropertyConditional and Xml classes, and create global references for them 2022-09-14 14:09:33 -03:00
EvilFactory
ae3b68d417 remove non-functional error handler 2022-09-14 14:08:56 -03:00
EvilFactory
35abb5d147 added new manual install video tutorial 2022-09-13 14:45:46 -03:00
EvilFactory
56d997624e added notice for mac installing from scratch 2022-09-06 06:17:38 -03:00
EvilFactory
f41962f75d forgot a Voronoi2 class 2022-09-02 19:51:16 -03:00
EvilFactory
e972777cf6 register Voronoid Elements 2022-09-02 14:13:34 -03:00
EvilFactory
d6b82cd591 better error handling in LuaUserData.lua 2022-08-31 14:53:32 -03:00
EvilFactory
9ef581ecfb register EventManager and EventManagerSettings 2022-08-31 14:52:33 -03:00
EvilFactory
4d156b6509 register HumanoidAnimController and FishAnimController 2022-08-25 13:38:11 -03:00
EvilFactory
f3b53afc3c remove video 2022-08-23 16:59:58 -03:00
EvilFactory
ca89cbe418 refactor workshop installation: make LuaCsInstaller a little less cursed 2022-08-23 14:58:42 -03:00
Evil Factory
5a38255ba7 Merge pull request #105 from notpeelz/reorder-docs-kinds
Enforce kinds ordering in lua docs
2022-08-20 22:28:19 -03:00
peelz
a46c925858 Enforce kinds ordering in lua docs 2022-08-20 21:10:55 -04:00
EvilFactory
199d9b78f0 fix LuaCsUpdateChecker throwing fatal error when having a missing file 2022-08-20 19:43:47 -03:00
Evil Factory
f19228f366 Merge pull request #104 from notpeelz/fix-hook-cs-compat
Fix Hook.Add compatibility with C# mods
2022-08-20 12:38:44 -03:00
peelz
13d0510d37 Make lua converters private 2022-08-20 11:32:18 -04:00
peelz
d547c97c80 Fix Hook.Add compatibility with C# mods 2022-08-20 11:32:18 -04:00
EvilFactory
9fb25252a6 added custom converters for GUICustomComponent's delegates 2022-08-20 12:03:05 -03:00
EvilFactory
0365956c9b replaced Lua Examples with a link to a repository 2022-08-18 15:31:05 -03:00
Evil Factory
da7ab6b205 Merge pull request #103 from notpeelz/fix-gui-lua-converter-nre
Fix NRE in GUI lua converters
2022-08-17 20:58:59 -03:00
peelz
860449aaed Fix NRE in GUI lua converters 2022-08-17 19:49:08 -04:00
EvilFactory
b8707c1f32 register TextPack 2022-08-16 13:24:52 -03:00
Evil Factory
c43cd4f2b5 Merge pull request #101 from notpeelz/fix-docs-ps1-modules
Fix docs ps1 script module errors
2022-08-14 19:30:43 -03:00
peelz
8d40a106dc Fix docs ps1 script module errors 2022-08-14 18:03:56 -04:00
EvilFactory
53b92e3a44 added RespawnManager to Game 2022-08-14 10:54:50 -03:00
Evil Factory
52cb7ecfd7 Merge pull request #100 from notpeelz/fix-publish-sigil-dll
Fix missing Sigil.dll in patch zip releases
2022-08-12 21:10:22 -03:00
peelz
9ba466a455 Fix missing Sigil.dll in patch zip releases 2022-08-12 20:07:19 -04:00
Evil Factory
d73a8ac7e4 Merge pull request #98 from notpeelz/fix-report-test-results
Fix workflow not reporting test results when ran from a PR
2022-08-12 06:15:20 -03:00
Evil Factory
d8e2a52b0b Merge pull request #97 from notpeelz/generate-patch-zip-release
Create zip files to make deployment easier for existing installs
2022-08-12 06:15:09 -03:00
peelz
d34cea51cf Fix workflow not reporting test results when ran from a PR 2022-08-12 03:18:22 -04:00
peelz
3a6ce4c219 Update manual installation instructions 2022-08-11 22:26:58 -04:00
peelz
5c3274153e Fix markdown spacing for ul, ol and iframe 2022-08-11 22:26:58 -04:00
peelz
1049296705 Fix incorrect path to scripts/install.sh in lua docs build script 2022-08-11 22:26:58 -04:00
peelz
430dd9ae93 Change release workflow to create zip files for existing installs 2022-08-11 22:26:58 -04:00
EvilFactory
582d6a5c26 fix inverted check for SaveGame 2022-08-11 19:14:14 -03:00
EvilFactory
53c586b22f add save folder to whitelist 2022-08-11 12:59:20 -03:00
EvilFactory
6c7a93d53e docs: added Sigil.dll to "Adding Lua For Barotrauma to an existing client" 2022-08-11 06:29:45 -03:00
EvilFactory
4bccc33c4f added Game.ServerSettings for clients and Game.Client/Game.Server 2022-08-10 16:52:54 -03:00
EvilFactory
412a9e0055 register GameMain, BanList and BannedPlayer 2022-08-10 16:52:27 -03:00
EvilFactory
40814a1723 expose AccumulatorMax 2022-08-10 16:35:12 -03:00
Evil Factory
93737e27ba Merge pull request #96 from notpeelz/hook-api-il-patch
Improve Hook.Patch API
2022-08-10 16:30:12 -03:00
peelz
eabc611a63 Fix typo in cl_xxx commands 2022-08-10 05:59:41 -04:00
peelz
dd1b404c9b Refactor error/exception/message handling
This adds:
- LuaCsSetup.ExceptionHandler so we can decide how we want to handle
exceptions for unit tests
- LuaCsSetup.MessageHandler so we can redirect logs to the XUnit output
  helper
2022-08-10 05:59:41 -04:00
peelz
3de2d8e550 Change on-push workflow to run unit tests
This changes workflows to run unit tests for every new commit (including
PRs). A new release will only be published if all tests pass on the
master branch.
2022-08-10 05:55:43 -04:00
peelz
508f8d3dcd Fix dotnet-release workflow not cloning submodules 2022-08-10 05:36:17 -04:00
peelz
4f17a88781 Fix incorrect LuaXXX type converter used in overload disambiguation 2022-08-10 05:36:17 -04:00
peelz
267644695a Add Sigil.dll to the list of files to deploy/update 2022-08-10 05:36:17 -04:00
peelz
4e41d5c4fb Fix item.interact hook not passing the correct parameters 2022-08-10 05:36:17 -04:00
peelz
33a29741df Change DefaultHook.lua to use Hook.Patch 2022-08-10 05:36:17 -04:00
peelz
c25f4df6bc Add lua docs for new Hook.Patch API 2022-08-10 05:36:17 -04:00
peelz
014bddf5ee Add support [readonly] modifier to lua docs 2022-08-10 05:36:17 -04:00
peelz
987907bd05 Improve color constrast of headers in lua docs 2022-08-10 05:36:17 -04:00
peelz
e0defa82e2 Fix invalid @realm tags 2022-08-10 05:36:17 -04:00
peelz
7e99cdef29 Implement rudimentary cache busting for lua docs 2022-08-10 05:36:17 -04:00
peelz
97021f127c Add support for deprecation reason in lua docs 2022-08-10 05:36:17 -04:00
peelz
477cbeccc6 Fix paragraph spacing inconsistencies in lua docs 2022-08-10 05:36:16 -04:00
peelz
843055a5dc Update repo url in lua docs 2022-08-10 05:36:16 -04:00
peelz
4a6e13a0dc Refactor LuaDocs generator 2022-08-10 05:36:16 -04:00
peelz
545c38c26c Fix parameter mismatch errors in lua docs 2022-08-10 05:36:16 -04:00
peelz
b393a4e00f Add .editorconfig 2022-08-10 05:36:16 -04:00
peelz
2f5add1999 Don't conflate fields with tables 2022-08-10 05:36:16 -04:00
peelz
512b95d89c Fix lua docs sidebar items not being indexable 2022-08-10 05:36:16 -04:00
peelz
897466d295 Move hooks docs to their own section 2022-08-10 05:36:16 -04:00
peelz
1bb7843811 Move docs to luacs-docs/{lua,cs,landing-page}
luacs-docs/cs also has a proper http server for testing locally
2022-08-10 05:36:16 -04:00
peelz
53ea2b8973 Simplify github workflow for docs generation
This also fixes not being able to generate docs from other branches.
2022-08-10 05:36:16 -04:00
peelz
69c627b651 Deprecate Hook.HookMethod 2022-08-10 05:36:16 -04:00
peelz
ca51130517 Add @deprecated tag to lua docs 2022-08-10 05:36:16 -04:00
peelz
5d11c28db6 Clean up lua docs scripts
- ldoc is now a git submodule
- ldoc can be installed using scripts/install.{sh,ps1}
- lua docs can be build using scripts/build.{sh,ps1}
- all lua docs-related files now reside inside of the docs folder
2022-08-10 05:33:26 -04:00
peelz
9a621237f0 Add unit tests for LuaCsHook Patch API 2022-08-09 17:50:00 -04:00
peelz
d9dc84425d Make LuaCsSetup easier to integrate into unit tests 2022-08-09 17:50:00 -04:00
peelz
d98daf008e Add lua types for C# primitives 2022-08-09 17:50:00 -04:00
peelz
fb1005d255 Clean up dependencies 2022-08-09 17:50:00 -04:00
peelz
08836088fb Refactor hooking API
This completely changes how method patching works under the hood. Unlike
the previous API (`Hook.HookMethod`), the new API (`Hook.Patch`)
generates a Harmony patch method at runtime, using IL generation.

This fixes methods with ByRef (out/ref) parameters getting silently corrupted
due to the ByRef semantics being lost when passed through the `object[] __args`
parameter.

This new API also makes it possible to:
  - modify parameters (including ByRef params)
  - change the return value to `null` (old API would use `return nil`
    for Harmony control flow)
  - prevent execution of the original method (and other harmony
    patches), independently of modifying the return value
2022-08-09 17:50:00 -04:00
peelz
768abd5ce1 Remove LuaResult 2022-08-09 17:50:00 -04:00
peelz
a5bffce33b Move prohibitedHooks check to a method 2022-08-09 17:50:00 -04:00
peelz
7ce7e6e763 Support resolving methods with ref/out parameters 2022-08-09 17:50:00 -04:00
Evil Factory
9386181fce Merge branch 'Regalis11:master' into master 2022-08-09 13:39:27 -03:00
EvilFactory
0948c6dc35 added Quality.SetValue 2022-08-08 17:36:50 -03:00
EvilFactory
9fd550e8f5 fixed wrong type of CharacterEditorScreen 2022-07-31 08:14:58 -03:00
EvilFactory
069567c681 LuaCs is now initialized after sub editor screen is first selected, added Game.IsSubEditor, Game.SubEditorScreen and registered editor screens 2022-07-27 20:01:20 -03:00
EvilFactory
1b020ff99e don't prevent further cs mods from being executed if one of them has a runtime error 2022-07-25 09:25:06 -03:00
EvilFactory
3fc6892571 fix exceptions not being handled correctly inside Network.Receive and Timer.Wait 2022-07-23 12:23:27 -03:00
Evil Factory
d37bf9eef9 Merge branch 'Regalis11:master' into master 2022-07-19 13:31:23 -03:00
EvilFactory
31b0bbd3d9 fix jobsAssigned hook not working for respawn shuttles 2022-07-16 11:28:33 -03:00
Evil Factory
b9ebf04a6a fix undefined identifiers in patches overriding each other 2022-07-14 20:55:39 -03:00
Evil Factory
a083f8f69e fix compiler error 2022-07-14 12:33:31 -03:00
Evil Factory
c5860d13d5 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-07-14 12:25:44 -03:00
Evil Factory
5540330295 register HeadInfo/HeadPreset 2022-07-13 20:23:25 -03:00
Evil Factory
275bb9204d chatMessage hook now works on singleplayer 2022-07-11 21:03:50 -03:00
Evil Factory
646ef7fba1 register Radiation 2022-07-11 12:46:59 -03:00
Evil Factory
09971905e1 whoops 2022-07-10 19:22:57 -03:00
Evil Factory
32fb3c3317 attempt in fixing mysterious timer crash again 2022-07-10 14:06:48 -03:00
Evil Factory
8153e4af0c print out to the console if the content package Lua folder is being used or not 2022-07-08 19:44:23 -03:00
Evil Factory
1af1fe45ca potential fix for the RunConfig.xml being used by another process 2022-07-07 10:36:38 -03:00
Evil Factory
e73cd0f398 fix crash if a cs mod errors in the dispose method 2022-07-07 09:52:29 -03:00
Evil Factory
bf0ea54cdd fixed cs mods not being loaded when downloading directly from server 2022-07-05 19:16:01 -03:00
Evil Factory
583f7f7108 fix ForcedAutorun mods not being executed when joining a server 2022-07-05 18:14:37 -03:00
Evil Factory
e5d4a38fd7 minor refactor to CsScriptLoader plus fixed source category regex not working as expected with some paths 2022-07-05 17:47:52 -03:00
Evil Factory
4b917625c0 added note to docs 2022-07-04 12:22:35 -03:00
Evil Factory
aaa27229cf fix error not being handled if name is null 2022-07-03 12:41:15 -03:00
Evil Factory
57032eeb11 whoops 2022-07-03 10:39:42 -03:00
Evil Factory
316f1a5007 improve error handling in Hook 2022-07-03 10:19:41 -03:00
Evil Factory
71b0410138 register Map 2022-07-02 15:01:31 -03:00
Evil Factory
90c83edcb6 delete WorkshopInstaller, no longer needed 2022-07-02 11:17:07 -03:00
Evil Factory
dc32ee6f08 add static MapEntityPrefab 2022-07-02 10:52:36 -03:00
Evil Factory
a6f7a4aff8 fix error handling in patches 2022-07-01 14:14:44 -03:00
Evil Factory
4a706c504a debug check for weird timer crash 2022-06-29 20:22:33 -03:00
Evil Factory
3418132b90 fix compile error 2022-06-29 17:08:33 -03:00
Evil Factory
20dabf502a cleanup 2022-06-29 16:48:34 -03:00
Evil Factory
4ad3b2cba0 Decursefication of patches 2022-06-29 16:13:51 -03:00
Evil Factory
47e0351403 fix some of the formatting and remove usage of CsScriptFilter as it's pretty much useless 2022-06-29 12:12:47 -03:00
Evil Factory
95de8a721b fix ServerLog doc 2022-06-26 17:35:07 -03:00
Evil Factory
986f010628 add AutoItemPlacer 2022-06-25 11:50:29 -03:00
Evil Factory
f64c7ff68c Level register stuff 2022-06-24 11:49:43 -03:00
Evil Factory
654e72fe6a allow setting HiddenSubs 2022-06-24 11:40:44 -03:00
Evil Factory
33efc519a3 fix talents not updating (forgor to make the type nullable) 2022-06-23 19:48:08 -03:00
Evil Factory
a154558f0b fix HttpGet method 2022-06-22 20:38:49 -03:00
Evil Factory
814870d80c whoops 2022-06-22 19:54:31 -03:00
Evil Factory
9fec4e378f add hook character.updateTalent 2022-06-22 19:53:39 -03:00
Evil Factory
3976fc8f64 make command cl_reloadlua freely usable 2022-06-20 18:32:54 -03:00
Evil Factory
64c81146fb added PerformanceCounter 2022-06-19 11:50:51 -03:00
Evil Factory
78716f4695 allow use of any http method 2022-06-19 10:58:01 -03:00
Evil Factory
a2f8d0019f fix threading issues with initialization 2022-06-17 14:29:10 -03:00
Evil Factory
349cf89eb5 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-06-17 10:33:06 -03:00
Evil Factory
916fd7522e add Game.ForceVoice and Game.ForceLocalVoice
guess what i am going to use this for
2022-06-16 20:34:31 -03:00
Evil Factory
1136342b60 added Game.ActiveChatMode 2022-06-16 13:15:48 -03:00
Evil Factory
cfb6fc5fe1 fix IsTargetType 2022-06-15 17:18:22 -03:00
Evil Factory
66c97ad100 re-add satellite resource language 2022-06-15 15:40:53 -03:00
Evil Factory
c647295ccb fix projects 2022-06-15 15:28:02 -03:00
Evil Factory
063853c0be fix CI part 1 2022-06-15 14:37:46 -03:00
Evil Factory
7c662da164 attempt fix CI 2022-06-15 14:35:31 -03:00
Evil Factory
a6948a09bd added some new enums 2022-06-15 13:51:04 -03:00
Evil Factory
7a09711296 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-06-15 13:26:49 -03:00
Evil Factory
efd1243754 Minor refactor for LuaUserData.lua 2022-06-14 13:09:52 -03:00
Evil Factory
438f10f484 fix underscores in docs 2022-06-14 13:09:00 -03:00
Evil Factory
fa3eed52b3 added CharacterHealth to docs 2022-06-11 16:34:49 -03:00
Evil Factory
9041f5ef0d forgot to include a file in the last commit (ed1fbdbe5) 2022-06-09 16:03:36 -03:00
Evil Factory
ed1fbdbe5e Potential fix for threading issues and added CSActive var 2022-06-09 16:02:18 -03:00
Evil Factory
23ad3ea00b fix manual install doc 2022-06-09 12:08:38 -03:00
Evil Factory
bafbb73389 fix RequestPostHTTP compatibility 2022-06-08 17:10:55 -03:00
Evil Factory
ffad50ae55 update common questions 2022-06-07 16:29:21 -03:00
Evil Factory
a778918fe3 update networking docs 2022-06-07 16:11:06 -03:00
Evil Factory
7c073d5801 update docs jobsAssigned 2022-06-07 16:10:06 -03:00
Evil Factory
0f72df789b call round end on sub editor 2022-06-07 15:05:39 -03:00
Evil Factory
cac80c3d86 call round start on sub editor 2022-06-07 15:04:33 -03:00
Evil Factory
abc61e7728 WearableType enum and WearableSprite 2022-06-07 14:36:54 -03:00
Evil Factory
d974791d1f JobVariant register 2022-06-06 06:29:59 -03:00
Evil Factory
59d4ec8ad7 Game.LoadGame, Game.SaveGame and Game.LoadCampaign 2022-06-05 14:25:40 -03:00
Evil Factory
7354e3fab2 when installing cl lua via workshop, create LuaDedicatedServer.bat 2022-06-04 13:39:30 -03:00
Evil Factory
38e990ddd2 decal manager register 2022-06-03 06:19:31 -03:00
Evil Factory
4ddbe69ee5 Merge pull request #92 from Cintique/LuaUserData-CreateUserDataOfType
Add `LuaUserData.CreateUserDataOfType`.
2022-06-02 12:47:49 -03:00
Cintique
c39bf9f800 Allow wrapping unregistered types.
`LuaUserData.CreateUserDataFromType` will instantiate a default `StandardUserDataDescriptor` to allow wrapping unregistered types. Whoops!
2022-06-02 21:34:34 +10:00
Evil Factory
88b19b2220 renamed http methods (with compatibility) and added a way to start http listeners 2022-06-01 14:23:06 -03:00
Cintique
62c0dc0580 Better doc 2022-06-01 19:46:40 +10:00
Cintique
ebcbcae46d Typo 2022-05-31 14:59:17 +10:00
Cintique
fb6c335f0f Add LuaUserData.CreateUserDataOfType.
Converts a Lua value to a desired CLR type and wraps it in a userdata to avoid automatic conversions.
Example: a Lua script needs to pass a List`1 to a CLR method expecting System.Object, MoonSharp gets
in the way by converting the List`1 to a MoonSharp.Interpreter.Table and breaking everything.
Wrapping the value in a userdata preserves the original type during conversions.
2022-05-31 14:54:09 +10:00
Evil Factory
c9ad6efb54 re-enable the lua command in public servers 2022-05-30 12:43:32 -03:00
Evil Factory
6922900bf1 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-05-30 12:29:28 -03:00
Evil Factory
de1062df22 Update MoonSharp 2022-05-30 12:26:45 -03:00
Evil Factory
6ddfc985d3 fix AddCommand arguments being wrong and fixed getValidArgs not doing anything 2022-05-28 15:06:22 -03:00
Evil Factory
60b8cd981d add video to installing manually 2022-05-27 17:10:57 -03:00
Evil Factory
83bfc50c9e updated docs and Scissor component registrar 2022-05-27 11:54:00 -03:00
Evil Factory
00da9ba10c Merge pull request #91 from oiltanker/master
path regex fix for unix systems
2022-05-26 12:23:01 -03:00
Oiltanker
6c22eea887 path regex fix for unix systems 2022-05-26 13:23:46 +03:00
Evil Factory
7951754203 fix some hooks not getting triggered in singleplayer 2022-05-25 13:18:52 -03:00
Evil Factory
3218f0a55b disable usage of lua execute commands in public servers 2022-05-24 14:53:57 -03:00
Evil Factory
cf09acfd52 ItemSound and RoundSound 2022-05-24 14:53:43 -03:00
Evil Factory
cf4774a6a7 register ContentXElement and SpriteBatch 2022-05-23 17:59:54 -03:00
Evil Factory
05e9978671 Sounds and LightManager 2022-05-22 13:29:55 -03:00
Evil Factory
1dad86b02f ItemPrefab registers 2022-05-22 12:24:21 -03:00
Evil Factory
7ee81aca24 fix formatting 2022-05-21 12:48:35 -03:00
Evil Factory
c9e13ad412 more io methods 2022-05-19 16:45:01 -03:00
Evil Factory
4078fe024b ExecutionNumber variable that counts how many times lua has been executed 2022-05-19 16:45:00 -03:00
Evil Factory
01168bd852 fix CI
zip-release branch got renamed from master to main
2022-05-19 16:36:53 -03:00
Evil Factory
104983fd37 fix error checking 2022-05-19 14:51:11 -03:00
Evil Factory
ca0da04ad0 better LuaUserData error handling and add Steam.GetWorkshopCollection 2022-05-19 14:26:21 -03:00
Evil Factory
6ee6b5cd15 improve custom converters 2022-05-18 19:09:28 -03:00
Evil Factory
144e731d5e Merge pull request #88 from oiltanker/master
fix cs doc generation
2022-05-18 16:05:42 -03:00
Oiltanker
6d239160e9 fix cs doc generation 2022-05-18 21:56:50 +03:00
Evil Factory
88dedcf9c1 fix DownloadWorkshopItemAsync 2022-05-17 20:37:51 -03:00
Evil Factory
74bf5d12ca added Steam.DownloadWorkshopItem and Steam.GetWorkshopItem 2022-05-17 19:15:44 -03:00
Evil Factory
cf500081d1 renamed hooks (with compatibility), added new hook: character.giveJobItems (because of how often its used) and updated hook docs 2022-05-17 12:24:52 -03:00
Evil Factory
fd6b833c98 misc doc fixes 2022-05-16 13:53:39 -03:00
Evil Factory
cb29c27752 fix Game docs 2022-05-16 13:27:24 -03:00
Evil Factory
73d5edfafa GUI and skill registers 2022-05-15 12:57:07 -03:00
Evil Factory
fbec2aa8b0 Merge pull request #87 from oiltanker/master
cs RunConfig fix
2022-05-15 10:22:10 -03:00
Oiltanker
1ce8cb8cac cs RunConfig fix 2022-05-15 16:07:12 +03:00
Evil Factory
264ed1f4de Merge branch 'Regalis11:master' into master 2022-05-14 22:53:07 -03:00
Evil Factory
a9d605bffc misc registers 2022-05-14 11:06:17 -03:00
Evil Factory
003aeb2cec Update Harmony (fixes patch hooks being randomly removed) 2022-05-14 00:09:17 -03:00
Evil Factory
c6ced9bdc3 Merge pull request #86 from oiltanker/master
added RunConfig cs documentation
2022-05-13 21:26:22 -03:00
Oiltanker
69d4b2c355 added RunConfig cs documentation 2022-05-14 02:54:30 +03:00
Evil Factory
6c81532ffe Merge pull request #85 from oiltanker/master
declared & forced runs of cs mods
2022-05-13 19:49:07 -03:00
Oiltanker
f2ca5fa57d declared & forced runs of cs mods 2022-05-14 01:44:01 +03:00
Evil Factory
3c84a5a1a5 Merge pull request #84 from oiltanker/master
RespawnManager Update method hook
2022-05-13 14:50:37 -03:00
Oiltanker
b830d87564 RespawnManager Update method hook 2022-05-13 20:48:19 +03:00
Evil Factory
cf5a29e0c7 update links 2022-05-13 12:33:08 -03:00
Evil Factory
9378c901bf Revert "accidentally left this line commented"
This reverts commit c289cbf94e.
2022-05-12 15:16:51 -03:00
Evil Factory
c289cbf94e accidentally left this line commented 2022-05-11 11:37:20 -03:00
Evil Factory
2630c8354c added item.deconstructed hook, misc registers and luacs is now initialized before campaign/sub editor is loaded 2022-05-10 13:55:10 -03:00
Evil Factory
45efbd8e08 register character params 2022-05-09 19:55:51 -03:00
Evil Factory
56262a4655 fix chatmessagetype doc 2022-05-09 19:18:22 -03:00
Evil Factory
bffb09cf54 added missionsEnded hook 2022-05-09 12:54:51 -03:00
Evil Factory
0b49a790b6 Merge branch 'Regalis11:master' into master 2022-05-07 16:55:09 -03:00
Evil Factory
e7510cad76 fix Game.RoundStarted and improve error handling 2022-05-07 15:36:47 -03:00
Evil Factory
0d560a688c also remove GC Collect from script runner 2022-05-07 14:28:42 -03:00
Evil Factory
11220bcff2 why are we manually collecting GC in cs 2022-05-07 14:20:16 -03:00
Evil Factory
4aa5c79edb disable warnings for missing XML comments 2022-05-07 13:38:59 -03:00
Evil Factory
789d728f7a prevent access error if you do workshop cl install but its already installed 2022-05-07 13:16:33 -03:00
Evil Factory
c101711512 only generate docs when necessary 2022-05-07 12:30:14 -03:00
Evil Factory
93a69d98c9 Merge pull request #82 from oiltanker/master
doxygen cs documentation
2022-05-07 12:17:34 -03:00
Oiltanker
eb94a1bdcd documentaion generation 2022-05-07 13:13:09 +03:00
Oiltanker
f5b2268150 doxygen cs documentation 2022-05-06 22:35:47 +03:00
Evil Factory
64f0e2f137 Fixes for PR #80 2022-05-06 13:10:50 -03:00
Evil Factory
e890126d9f Merge pull request #80 from Cintique/timer-blocking-fix
Fix blocking issue in `LuaCsTimer`
2022-05-06 12:20:15 -03:00
Cintique
1484c75595 Fix indents 2022-05-06 19:21:12 +10:00
Cintique
726399a87d Fix formatting 2022-05-06 19:20:20 +10:00
Cintique
5aef20aae2 Move LuaCsTimer to its own file. 2022-05-06 15:46:22 +10:00
Cintique
d244869377 Fix blocking issue in LuaCsTimer
Logic for scheduling actions in `LuaCsHook` (see `Enqueue()` and `Update()`) caused tasks with long delays to block the execution of tasks with shorter delays.
Moved logic for `Timer.Wait()` from `LuaCsHook` to `LuaCsTimer` and corrected the blocking issue.
2022-05-06 15:43:17 +10:00
Evil Factory
13274aecd6 added GUIColorPicker 2022-05-05 17:18:54 -03:00
Evil Factory
8db1703709 register RagdollParams 2022-05-05 16:59:37 -03:00
Evil Factory
9a43a87fc1 fix outdated info on getting started page 2022-05-05 14:22:32 -03:00
Evil Factory
53e16c3586 remove setmodulepaths after setting package path 2022-05-05 14:03:16 -03:00
Evil Factory
c8ec13fb56 added powered update interval 2022-05-05 13:18:50 -03:00
Evil Factory
f132fdb36e Merge pull request #79 from Cintique/minor-luacssetup-loadfile-loadstring
LuaCsSetup: lua.LoadFile -> lua.LoadString
2022-05-04 21:25:30 -03:00
Jacobin
87550af37d lua.LoadFile -> lua.LoadString 2022-05-05 10:23:17 +10:00
Evil Factory
d0bcdd858f Merge pull request #78 from Cintique/docs/error-handling
Add info on error handling to docs.
2022-05-04 21:12:12 -03:00
Jacobin
cc7d3b69f6 oops 2022-05-05 09:44:31 +10:00
Jacobin
59d757c2fb Add info on error handling to docs 2022-05-05 09:41:54 +10:00
Evil Factory
bbea195e7d fix formatting in lua require and better error handling with dofile,loadfile,etc 2022-05-04 08:50:17 -03:00
Evil Factory
7a6ddccbb7 Merge branch 'Cintique-lua-require/exception-handler' 2022-05-04 08:46:42 -03:00
Evil Factory
95a9c618e6 fix naming 2022-05-04 08:45:05 -03:00
Evil Factory
b322ba53be fix naming 2022-05-04 07:56:54 -03:00
Jacobin
43f172a190 Remove exception handling on Require
This was just eating exceptions; exceptions should instead propagate to a more appropriate handler (`pcall` should now work).
2022-05-04 11:37:44 +10:00
Evil Factory
c5b6cc5f0d made it possible to change the round summary traitor results 2022-05-03 20:06:34 -03:00
Evil Factory
5d7d6fb276 Merge pull request #76 from Cintique/docs/getting-started-require
Update Docs: Add some info about `require`.
2022-05-03 11:23:55 -03:00
Jacobin
7dc6d8a86f Educate others about how useful require is. 2022-05-03 21:44:58 +10:00
Evil Factory
9b9bfa7440 whoops 2022-05-02 19:33:42 -03:00
Evil Factory
4a07975ab8 Merge branch 'Regalis11:master' into master 2022-05-02 19:09:48 -03:00
Evil Factory
79daf2ed32 better error handling 2022-05-02 16:36:55 -03:00
Evil Factory
4b024d525f update docs 2022-05-02 15:51:03 -03:00
Evil Factory
776e6d8ffd Merge pull request #75 from oiltanker/master
fix for non-local mods folder regex and mod assembly type not found
2022-05-02 11:32:48 -03:00
Oiltanker
fb079bf443 fix for non-local mods folder regex and mod assembly type not found 2022-05-02 15:23:57 +03:00
Evil Factory
8acbb0dcd1 fix docs 2022-05-01 09:24:53 -03:00
Evil Factory
e08587523f i swear i had Explosion registered 2022-05-01 09:17:07 -03:00
Evil Factory
5745afeb84 register order prefab collection 2022-04-30 16:39:41 -03:00
Evil Factory
4010f73ea2 register Order stuff 2022-04-30 16:26:18 -03:00
Evil Factory
1e4b6cc595 docs ClientPermissions 2022-04-30 16:21:18 -03:00
Evil Factory
0604a27efb added performance counter for think hook 2022-04-30 12:54:34 -03:00
Evil Factory
3f221c0d23 fix nullable errors 2022-04-29 17:58:56 -03:00
Evil Factory
6b886fe80e register GUIFont 2022-04-29 16:59:45 -03:00
Evil Factory
af47136bbd use cs package from backup packages 2022-04-29 14:00:53 -03:00
Evil Factory
be76cd5f35 Fix PR #74 2022-04-29 12:10:49 -03:00
Evil Factory
72b2492f0d fix patch hooks not working correctly with void return types 2022-04-29 12:10:20 -03:00
Evil Factory
96bdb143ee Merge pull request #74 from oiltanker/master
install_cl_lua custom dependency fix
2022-04-29 06:04:48 -03:00
Oiltanker
f1c7be0b4c install_cl_lua custom dependency fix 2022-04-29 05:07:08 +03:00
Evil Factory
a3ffc8c479 make automatic builds release because github user interface is kinda stupid 2022-04-28 17:17:07 -03:00
Evil Factory
5ced4f9f5d Merge pull request #73 from Terragen/Terragen-patch-1
Update RegisterShared.lua to remove duplicate call
2022-04-28 14:29:31 -03:00
Terragen
14bcf946e2 Update RegisterShared.lua to remove duplicate call
Removed duplicate call to RegisterBarotrauma("AIObjectiveOperateItem")
2022-04-28 13:24:21 -04:00
Evil Factory
5c34bc8db9 tell patch method name if an error happens 2022-04-28 13:42:22 -03:00
Evil Factory
f815ebd1db Merge pull request #72 from oiltanker/master
Cs source folder filter
2022-04-28 13:33:00 -03:00
Evil Factory
36a2dafbd5 fix broken Mac project 2022-04-28 13:32:42 -03:00
Evil Factory
9b5932760c fix compile errors 2022-04-28 12:50:39 -03:00
Evil Factory
4277dd447c Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-04-28 12:36:24 -03:00
Oiltanker
e5215fb976 Cs source folder filter 2022-04-28 17:13:13 +03:00
Evil Factory
cb50c69fc6 Merge pull request #70 from oiltanker/master
Cs mod store folder method for storing configs, etc.
2022-04-27 16:04:23 -03:00
Oiltanker
abe17df121 better LuaCsPatch parameters 2022-04-27 16:40:16 +03:00
Oiltanker
ed92a12db6 Cs mod store folder method for storing configs, etc. 2022-04-27 16:40:16 +03:00
Evil Factory
60ddfb831b Added so you can increase the amount of packets per update in file sender 2022-04-25 16:45:05 -03:00
Evil Factory
27ec9f4928 Register Wallet 2022-04-25 12:29:31 -03:00
Evil Factory
818e4e9de1 Merge pull request #69 from oiltanker/master
CSharp preprocessor definitions
2022-04-25 12:16:50 -03:00
Oiltanker
6a23dece35 CSharp preprocessor definitions 2022-04-25 18:11:27 +03:00
Evil Factory
370c0e3288 Merge pull request #68 from zhu-rengong/define_constant
define cosntants for csharp parse options.
2022-04-25 12:08:23 -03:00
Evil Factory
7884c48c6e Added GUIMessageBox 2022-04-25 11:53:00 -03:00
zhurengong
8a34ead2ef define cosntants for csharp parse options. 2022-04-25 21:15:30 +08:00
Evil Factory
3aec67aa8e Merge pull request #66 from oiltanker/master
Missing filters for types, e.g. Vector2
2022-04-24 19:26:13 -03:00
Oiltanker
8a0c2d2166 Missing filters for types, e.g. Vector2 2022-04-25 00:10:14 +03:00
Evil Factory
ec3e8fecd1 Merge pull request #65 from Cintique/improve-require
Alter `LuaRequire`
2022-04-24 10:42:11 -03:00
Jacobin
7a4a8fc856 Small fixes in ModLoader.lua 2022-04-24 18:13:14 +10:00
Jacobin
ac920a8da9 Improve LuaRequire 2022-04-24 18:12:53 +10:00
Evil Factory
2c1329fa36 we don't actually need to check for threads if theres only one (multiplayer) 2022-04-24 00:01:43 -03:00
Evil Factory
fe3d17d1d9 AddCallMetaTable for sub userdatas 2022-04-23 12:42:19 -03:00
Evil Factory
910118303a fix clientWriteList Hook 2022-04-23 11:30:25 -03:00
Evil Factory
e799eed64e don't call stop hook if we are not in the main thread anymore (likely caused by the exiting of the program) 2022-04-22 16:26:33 -03:00
Evil Factory
e77ef4de26 Check thread access before executing any Lua function, if thats the case, throw a warning and ignore 2022-04-22 15:53:44 -03:00
Evil Factory
fd0c3ba19d Merge branch 'unstable-tests' 2022-04-21 11:21:30 -03:00
Evil Factory
58efac86c0 Merge pull request #62 from zhu-rengong/improves_fixes
some improves and fixes
2022-04-21 11:20:46 -03:00
Evil Factory
559a5fa20f added talent stuff 2022-04-21 11:19:02 -03:00
Evil Factory
9e03779f2d added detection of a special file called "usecurrentdirectoryforsaves" for shady hosting providers 2022-04-20 22:42:28 -03:00
Evil Factory
0aa2976697 only allow cs commands if cs package present 2022-04-20 20:04:49 -03:00
Evil Factory
5db4be7db5 Update installing-lua-for-barotrauma-manually.md 2022-04-20 18:00:22 -03:00
Evil Factory
fb159fd93d fix names 2022-04-20 15:55:10 -03:00
Evil Factory
2e14ff79fc fix hook calls not working correctly 2022-04-20 15:38:15 -03:00
Evil Factory
01eff8e434 fix docs 2022-04-20 14:48:32 -03:00
Evil Factory
a074e9d352 fix name 2022-04-20 14:33:11 -03:00
Evil Factory
5946a4c043 fix package names 2022-04-20 14:20:38 -03:00
Evil Factory
7817116ec1 forgor about linux client 2022-04-20 13:40:35 -03:00
Evil Factory
dc38ad266a fix CI (again) 2022-04-20 13:35:29 -03:00
Evil Factory
e833099fb5 hopefully *fix* CI 2022-04-20 13:27:53 -03:00
Evil Factory
fef3e5812f fix linux project 2022-04-20 13:21:06 -03:00
Evil Factory
6246588072 change package name 2022-04-20 13:17:03 -03:00
Evil Factory
2b5d077d04 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-04-20 12:59:43 -03:00
Evil Factory
8d1990d878 Merge branch 'unstable-tests' 2022-04-20 12:56:20 -03:00
Evil Factory
0a747c42fd update Lua examples 2022-04-20 12:54:33 -03:00
zhurengong
7c4d7d374b some improves and fixes:
1. should get the last loadded aseembly by checking its version instead of reversing.
2. fixed throw an exception when CsScriptRunner run the second time.
3. an argument carried by an UnregisterType called somewhere have had been accidentally removed.
2022-04-20 14:56:32 +08:00
Evil Factory
928428cabd update docs 2022-04-19 22:54:34 -03:00
Evil Factory
7a440e009b add Cs package check back and fix typos 2022-04-19 16:59:02 -03:00
Evil Factory
edb6571aa2 Merge pull request #59 from oiltanker/unstable-tests
fixes and mod warning for cs mods
2022-04-19 16:41:00 -03:00
Oiltanker
df83b1904e rebase to origin/unstable-tests 2022-04-19 22:39:05 +03:00
Oiltanker
da251099a3 working serialization + cs mods one-time warning 2022-04-19 22:35:08 +03:00
Evil Factory
ce85d50dbf prioritize enabled package 2022-04-19 13:31:25 -03:00
Evil Factory
8f79054537 only use package if enabled 2022-04-19 13:29:19 -03:00
Evil Factory
099bd87167 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git into unstable-tests 2022-04-19 12:03:29 -03:00
Evil Factory
de18b1c2c0 Update MoonSharp 2022-04-19 11:28:51 -03:00
Oiltanker
8f4d5c4410 Merge pull request #1 from zhu-rengong/fix_leakage
Fix leakage of the dynamic assembly and unable to unloaded immediately.
2022-04-19 17:13:42 +03:00
zhurengong
592492a56f forgot this. 2022-04-19 19:01:10 +08:00
zhurengong
1b0c865459 should get the last assembly 2022-04-19 18:51:53 +08:00
Evil Factory
4939121016 Merge pull request #61 from Cintique/unstable-tests
Alter logic related to `require()`
2022-04-19 06:12:28 -03:00
zhurengong
6e0eae141b fixed assembly can't be unloaded 2022-04-19 15:45:51 +08:00
Jacobin
e0fef433fd Update ModLoader.lua
Lua mods are now executed after the module path has been set.
2022-04-19 15:22:03 +10:00
Jacobin
72063cdf93 Update require() behaviour
The behaviour of `require()` has been changed to align more closely with standard Lua (caching return results).
2022-04-19 15:20:52 +10:00
Oiltanker
767ff55604 fixes and custom serialization 2022-04-18 15:52:46 +03:00
Oiltanker
8bcd19a4ff fix the return of LuaResult from hook call 2022-04-18 15:13:32 +03:00
Oiltanker
d7368475fe Merge branch 'unstable-tests' of https://github.com/evilfactory/Barotrauma-lua-attempt into unstable-tests 2022-04-17 23:14:46 +03:00
Oiltanker
5c714ce124 fix CsScriptRunner 2022-04-17 22:59:12 +03:00
Evil Factory
bab2a88533 cs print message 2022-04-17 15:13:12 -03:00
Evil Factory
edb665a22c only run cs mods if package is present 2022-04-17 15:09:24 -03:00
Oiltanker
94f0068509 Merge branch 'unstable-tests' of https://github.com/evilfactory/Barotrauma-lua-attempt into unstable-tests 2022-04-17 20:41:06 +03:00
Oiltanker
7458108fc0 fix cs filter metadata bug 2022-04-17 20:39:23 +03:00
Evil Factory
6277a6ce5d Merge pull request #58 from oiltanker/unstable-tests
cs script runner + mod store + cs-lua interface
2022-04-17 14:31:44 -03:00
Oiltanker
22f82c7cb2 fix cs filter metadata bug 2022-04-17 19:55:45 +03:00
Oiltanker
e52f762861 safer HookMethod and more sandboxed cs mods 2022-04-17 19:26:54 +03:00
Evil Factory
6da4481c83 fix names 2022-04-17 13:03:24 -03:00
Oiltanker
03881f1240 new working type filter 2022-04-17 18:23:41 +03:00
Oiltanker
a7b4004058 cs script runner + mod store + cs-lua interface 2022-04-17 16:05:00 +03:00
Evil Factory
6aeac06112 swap exception 2022-04-16 15:01:50 -03:00
Evil Factory
7f3aac186d fix typo 2022-04-16 13:37:09 -03:00
Evil Factory
2f4485405b Structure default lib/register 2022-04-16 12:49:12 -03:00
Evil Factory
f439cabc9a fix patch hooks and rename delegates 2022-04-16 12:44:50 -03:00
Evil Factory
0d8d88b7fb Merge pull request #57 from zhu-rengong/add_gui_event_handler
added OnValueEnteredHandler handler
2022-04-16 12:01:52 -03:00
Evil Factory
7400ceceda expose Descriptors 2022-04-16 11:58:30 -03:00
zhurengong
67767d5c9d added OnValueEnteredHandler handler 2022-04-16 18:16:31 +08:00
Evil Factory
9d9b8e7cee Merge branch 'unstable-tests' of https://github.com/evilfactory/Barotrauma-lua-attempt into unstable-tests 2022-04-15 19:08:54 -03:00
Evil Factory
b7395bedea Refactor and fix #56 2022-04-15 19:08:27 -03:00
Evil Factory
42df433d3e Refactor and fix #56 2022-04-15 19:05:24 -03:00
Oiltanker
d71a06a465 my missing hook :'( 2022-04-15 22:05:51 +03:00
Oiltanker
6eb575ea81 remove unnecessary method from ACsMod 2022-04-15 21:48:34 +03:00
Oiltanker
56a0d4b1e1 working rebase 2022-04-15 21:35:01 +03:00
Oiltanker
e4ea88d598 hook addition name case-insensitivity fix 2022-04-15 21:29:14 +03:00
Oiltanker
2f0e83badd hook fixes, keybinds are not working 2022-04-15 21:29:14 +03:00
Oiltanker
3eba20ecb7 new hook call method + function to delegate conversion 2022-04-15 21:29:12 +03:00
Oiltanker
891efb4c4f working host game begin and host game exit 2022-04-15 21:28:24 +03:00
Oiltanker
5d06df437e hook merge + hook wrappers 2022-04-15 21:28:22 +03:00
Oiltanker
1e6ac68e86 initial cs-lua merge work 2022-04-15 21:25:58 +03:00
Oiltanker
ae2b84cceb wip, net hook class 2022-04-15 21:23:17 +03:00
Oiltanker
0b501ab4a1 Initial sandboxing implementation 2022-04-15 21:23:17 +03:00
Oiltanker
429557ad7d Some initial CSharp scripting functionality 2022-04-15 21:23:17 +03:00
Evil Factory
86a88c6e20 fix nil values being assigned a metatable 2022-04-15 14:48:23 -03:00
Evil Factory
7a28df8fd3 remove reference to LuaSetup when loading mods 2022-04-15 12:28:06 -03:00
Evil Factory
58337222c2 organize better default Lua stuff 2022-04-14 23:32:11 -03:00
Evil Factory
8238e8058c Game.Settings 2022-04-14 21:00:08 -03:00
Evil Factory
c3c233c92f new Hook to make writeClientList easier to use 2022-04-14 16:37:43 -03:00
Evil Factory
3549cadd12 Revert "MaxPlayers above 30 breaks stuff... why?"
This reverts commit d5eb804de9.
2022-04-14 16:34:25 -03:00
Evil Factory
5ceaa510eb added implicit conversion to Identifier 2022-04-14 16:22:33 -03:00
Evil Factory
eb20ff1a4e added component register 2022-04-14 15:21:14 -03:00
Evil Factory
3517b4c3ce improve update checker 2022-04-14 13:10:21 -03:00
Evil Factory
0ccac372a8 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git into unstable-tests 2022-04-14 12:14:19 -03:00
Evil Factory
5dd44dacf3 added workshop update checker 2022-04-13 19:41:43 -03:00
Evil Factory
e87e9341ef added Game.MyID 2022-04-13 15:46:52 -03:00
Evil Factory
e8b308bf53 fix client-side remove button 2022-04-12 13:14:43 -03:00
Evil Factory
3dc7a4689d SlotReference and Inventory static reference 2022-04-11 21:23:09 -03:00
Evil Factory
0cf4edbecf Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git into unstable-tests 2022-04-11 15:58:36 -03:00
Evil Factory
290a8bb5ae initialize Lua in multiplayer after you downloaded mods 2022-04-11 13:16:24 -03:00
Evil Factory
96fdefb9ed lua now runs on sub editor, added Game.GetEnabledContentPackages back for compatibility and printerror 2022-04-10 18:58:25 -03:00
Evil Factory
d5eb804de9 MaxPlayers above 30 breaks stuff... why? 2022-04-10 17:38:21 -03:00
Evil Factory
55752b592f *actually* fix content packages 2022-04-10 14:06:13 -03:00
Evil Factory
e625c88939 content package fixes 2022-04-10 12:39:02 -03:00
Evil Factory
b7d0376320 fixed restrictMessageSize and added writeClientList back 2022-04-10 12:21:07 -03:00
Evil Factory
dc7a7bd74d bunch of fixes that include fixing lua networking, script loading and client side lua installation 2022-04-09 21:44:18 -03:00
Evil Factory
454a0a22d1 fix file loading 2022-04-09 14:40:55 -03:00
Evil Factory
e1d0b8235f fix LuaRandom compatibility 2022-04-09 14:36:34 -03:00
Evil Factory
dfdea02b89 fix LuaRandom compatibility 2022-04-09 14:35:46 -03:00
Evil Factory
e1e0fd6acf Bunch of fixes 2022-04-09 09:06:29 -03:00
Evil Factory
b37fd8d9c9 Fixing stuff part 1 2022-04-08 16:08:59 -03:00
Evil Factory
f6241048c0 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git into unstable-tests 2022-04-08 15:28:28 -03:00
Evil Factory
ccf5600ad1 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git into unstable-tests 2022-04-08 12:52:28 -03:00
Evil Factory
0702d41a73 register KeyboardState 2022-04-07 16:25:57 -03:00
Evil Factory
1c6fa1a261 InputType should be registered 2022-04-07 16:19:37 -03:00
Evil Factory
6cc0c9eb6e register Barotrauma.GUINumberInput and Barotrauma.GUI 2022-04-07 15:24:45 -03:00
Evil Factory
b20128b8cb register ScalableFont 2022-04-07 12:11:23 -03:00
Evil Factory
c6439d3e41 added Matrix datatype to registration 2022-04-02 21:28:48 -03:00
Evil Factory
34ffbea69d MakeMethodAccessible and MakeFieldAccessible now are recursive, so they include private members in inherit members 2022-04-02 20:54:54 -03:00
Evil Factory
2520fe7268 Most enums are now just tables, no need for registration 2022-04-02 16:55:43 -03:00
Evil Factory
4113b1ca2d improve HookMethod errors 2022-04-02 16:09:01 -03:00
Evil Factory
a404ed1680 dont register the InputType enum, leaving it as numbers is more convenient 2022-04-02 15:59:05 -03:00
Evil Factory
3bcf97201a InputType enum 2022-04-02 15:44:12 -03:00
Evil Factory
d3a7795be7 Merge pull request #55 from zhu-rengong/refactor_handle_reg
Fix bad code style, try to prevent brain damage
2022-03-31 14:00:12 -03:00
zhurengong
97ed4cc9f3 try to prevent brain damage 2022-04-01 00:57:02 +08:00
Evil Factory
d23627f0af ability enums 2022-03-31 13:32:03 -03:00
Evil Factory
0a41d083fa Merge pull request #54 from zhu-rengong/register_gui_handlers
implemented script to clr conversions for all gui event handlers, fixes #53
2022-03-31 13:20:36 -03:00
zhurengong
246c84d5d1 implemented script to clr conversions for all gui event handlers 2022-03-31 23:57:59 +08:00
Evil Factory
0164a776c7 added item.created and item.removed hooks 2022-03-29 14:01:31 -03:00
Evil Factory
bd0a5980fb add static reference to all components 2022-03-29 11:52:26 -03:00
Evil Factory
f527f88d3a removed applyAffliction and added character.applyDamage and character.applyAffliction 2022-03-29 11:25:53 -03:00
Evil Factory
b2587f2307 campaign related registers 2022-03-28 20:03:10 -03:00
Evil Factory
e15d997df4 Generics support and merge pull request that fixes #52 2022-03-28 18:31:54 -03:00
Evil Factory
11bf1ea294 added a way to decrease character updates 2022-03-28 18:16:52 -03:00
Evil Factory
9307fc0219 fix docs 2022-03-27 20:52:35 -03:00
Evil Factory
5fe506b73a Automatically convert Lua types in HookMethod 2022-03-27 16:07:34 -03:00
Evil Factory
fe03f56217 Oiltanker's special hook (adds hook gameSession.getSessionCrewCharacters) 2022-03-26 14:32:13 -03:00
Evil Factory
05a65a1207 improve docs 2022-03-26 14:19:39 -03:00
Evil Factory
fd377454a3 register Sonar 2022-03-26 13:04:31 -03:00
Evil Factory
91106ef7bd fix brain fart in LuaUserData 2022-03-25 20:45:27 -03:00
Evil Factory
f9d7c0c2be All descriptors are now accessible via a global table, for easier access 2022-03-25 15:06:13 -03:00
Evil Factory
469abd6e86 nicer error message for when you already have cl lua installed, but you try to install it again 2022-03-24 16:15:51 -03:00
Evil Factory
68124fa8a5 allow status effect hook to trigger on characters 2022-03-24 14:01:19 -03:00
Evil Factory
61b8c132eb fix signalReceived hook not working correctly 2022-03-24 13:33:01 -03:00
Evil Factory
d4dd6afec9 forgot to add callmethod 2022-03-22 15:11:04 -03:00
Evil Factory
ab4f318806 added AttackResult 2022-03-22 15:08:25 -03:00
Evil Factory
6eed83f1ee Ability to tag the patch, and can overwrite and remove the tagged patch
ability to tag the patch, and can overwrite and remove the tagged patch.
pull request #51 from zhu-rengong/tag_patches
2022-03-22 10:22:14 -03:00
Evil Factory
267f65dcfd added Faction 2022-03-22 10:02:27 -03:00
Evil Factory
8986faebdb default register gamemodes 2022-03-22 09:58:02 -03:00
zhurengong
9b2b47ec28 lowercase identifier 2022-03-22 20:52:16 +08:00
zhurengong
a1ec0fc807 ability to tag the patch, and can overwrite and remove the tagged patch. 2022-03-22 18:09:18 +08:00
Evil Factory
9694895b71 fix client crash 2022-03-21 17:48:28 -03:00
Evil Factory
72cbbce35d added Game.Paused 2022-03-21 13:44:41 -03:00
Evil Factory
a54c55004b Fix crash with some function hooks #49 from Qowyn/patch-1
Fix crash with some function hooks
2022-03-21 13:41:49 -03:00
Evil Factory
ab7c6bbd43 Add AddLinked to MapEntity #50 from Qowyn/patch-2
Add AddLinked to MapEntity
2022-03-21 12:56:22 -03:00
Evil Factory
26939d9052 Fix CreateServerEventString #48 from Qowyn/fix-CreateServerEventString
Fix CreateServerEventString
2022-03-21 12:55:14 -03:00
Roland Firmont
caac190a05 Add AddLinked to MapEntity
MapEntity.linkedTo is readonly and arrives as a table on lua side, making it impossible to add new Links.

Introducing AddLinked as an Addition makes it possible to link things.
2022-03-21 16:24:42 +01:00
Roland Firmont
d80d4d91a3 Fix crash with some function hooks
Hooking functions that return float, ushort or byte causes a crash as the returned value will not match the expected type.
This fix will allow to return LuaFloat, LuaByte and LuaUShort instead.
Example hook that would crash without this: ItemComponent.DegreeOfSuccess
2022-03-21 16:12:29 +01:00
Roland Firmont
65dbc6fc00 Fix CreateServerEventString
Prevents AmbiguousMatchException
Reuses GetComponentString to get the component
Fixes wrong Invoke Parameters
2022-03-21 15:32:35 +01:00
Evil Factory
a3263ce3eb make docs a little more clear 2022-03-19 11:12:14 -03:00
Evil Factory
7dfccab05d better distinguish better client and server Lua and fixed crash when force stopping the game via alt f4 2022-03-19 11:05:26 -03:00
Evil Factory
f7155c4fcc fix IsSingleplayer with capital P 2022-03-17 14:42:03 -03:00
Evil Factory
1d1747a2ca remove unnecessary stuff 2022-03-17 12:53:37 -03:00
Evil Factory
86066282cc make my eyes happier: Random is now deprecated, moved lots of code around in a way that makes more sense and better LuaUserData error handling 2022-03-17 12:47:19 -03:00
Evil Factory
6026a0246d move InstallClientSideLua Function 2022-03-17 11:56:34 -03:00
Evil Factory
53c7bcc6d5 fix errors when executing Lua mods being weird (not completely tested) 2022-03-16 06:39:57 -03:00
Evil Factory
cc2a4b1b7b fix a small mistake that caused lua mods to not properly load 💀 2022-03-12 22:24:14 -03:00
Evil Factory
33b181784a added ItemSlot register 2022-03-12 22:23:35 -03:00
Evil Factory
62c2769eb8 fix not being able to input parameter names with length 0 in HookMethod 2022-03-11 12:35:55 -03:00
Evil Factory
394dda97f3 fix broken client-side registration 2022-03-09 21:01:39 -03:00
Evil Factory
2a7837138e Accidentally left Vector2 without the metatable 2022-03-09 17:33:52 -03:00
Evil Factory
631d434a8e Update README.md 2022-03-09 13:46:16 -03:00
Evil Factory
a5228583d0 Updated Moonsharp Interpreter, added support for implicit conversions, new types: LuaByte, LuaUShort and LuaFloat added to solve method overload conflict, support for setting UserData metatables, remove LuaUserData.AddCallMetaMethod and moved GUI object to Lua 2022-03-09 13:35:11 -03:00
Evil Factory
92dbca40a8 Potential solution for #46: Merge pull request #47 from Qowyn/lua 2022-03-08 14:26:03 -03:00
Qowyn
2237aaafb3 Dummy commands instead of dropping unknown cmds
AddCommand now replaces commands for connected players and saved perms
2022-03-08 18:00:30 +01:00
Evil Factory
245619ab72 added File.CreateDirectory 2022-03-07 16:29:32 -03:00
Evil Factory
9dbab36575 added IsSinglePlayer and IsMultiplayer to Game 2022-03-07 12:15:58 -03:00
Evil Factory
e7ceaf9f78 Workaround: Hooks aren't called while in singlepalyer loading screen (fixes weird threading error) 2022-03-06 18:44:19 -03:00
Evil Factory
509b35352f Update readme.
Added link for the VS Code documentation made by zhurengong
2022-03-06 10:57:30 -03:00
Evil Factory
a2dc2c5ed0 update docs 2022-03-06 10:44:54 -03:00
Evil Factory
422edc7fa4 new status effect tag added: "LuaHook", can be used to call lua hooks inside status effects 2022-03-05 22:30:30 -03:00
Evil Factory
9c0bcaa44f use Game.GameSettings instead of GetEnabledContentPackages 2022-03-05 21:32:31 -03:00
Evil Factory
abf329dd21 add Unregister functions to LuaUserData 2022-03-05 12:01:38 -03:00
Evil Factory
a8fdc0f9c5 Improve Lua Networking 2022-03-03 19:34:52 -03:00
Evil Factory
dd42269f31 visual studio is unable to delete this file via normal means 2022-03-03 13:58:43 -03:00
Evil Factory
7cfee859a1 fix massive brain damage in Timer.Wait (why did i choose to use async) 2022-03-03 13:54:46 -03:00
Evil Factory
ffeef7a0d3 Fix #45: mapEntityUpdateInterval and gapUpdateInterval are preserved between sessions 2022-03-01 13:09:43 -03:00
Evil Factory
08e0f72cbe fix merge issue: swapped net message types, fixes medical clinic and ready check 2022-02-28 21:46:54 -03:00
Evil Factory
6d00e210f0 added GameSettings and ChatBox 2022-02-28 19:57:06 -03:00
Evil Factory
acfec0986e Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-02-25 14:52:18 -03:00
Evil Factory
4c6549a39c fix crash when a FriendlyNPC attack another npc 2022-02-24 19:37:15 -03:00
Evil Factory
3d39a84850 Lua messages/errors message colours! 2022-02-24 16:06:27 -03:00
Evil Factory
f31142b754 Fix Map Entity Updates 2022-02-24 16:06:08 -03:00
Evil Factory
147307c891 register CrewManager 2022-02-24 16:05:53 -03:00
Evil Factory
df55ad1902 Fix errors 2022-02-24 14:34:01 -03:00
Evil Factory
6340304ae4 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git 2022-02-24 14:30:39 -03:00
Evil Factory
db7a6a0bea register WreckAI and WreckAIConfig 2022-02-21 11:45:00 -03:00
Evil Factory
d3e0625ef4 Lua is automatically initialized when entering singleplayer campaigns (doesn't include submarine editor) and roundStart && roundEnd hooks now work in CL Lua 2022-02-14 16:19:53 -03:00
Evil Factory
0d5ba52a15 added script to clr conversions for two gui event handles: Merge pull request #41 from zhu-rengong/gui_event_handle
added script to clr conversions for two gui event handles
2022-02-14 12:34:49 -03:00
zhurengong
6a539be58e added script to clr conversion for TextGetterHandler and OnSelectedHandler 2022-02-14 18:26:04 +08:00
Evil Factory
8f3ab34b50 remove semi colons from LuaSetup.lua 2022-02-11 18:19:06 -03:00
Evil Factory
21f314aed0 Revert "limit how many errors can be sent per second (prevents message queue from overflowing and stopping all commands from working) and removed useless semicolons that i added for some reason here"
This reverts commit 62cda52342.
2022-02-11 18:16:10 -03:00
Evil Factory
62cda52342 limit how many errors can be sent per second (prevents message queue from overflowing and stopping all commands from working) and removed useless semicolons that i added for some reason here 2022-02-10 12:59:32 -03:00
Evil Factory
7a575e9b55 add some type method to LuaUserData: Merge pull request #37 from zhu-rengong/add_type_method
add some type method to LuaUserData
2022-02-10 12:27:27 -03:00
Evil Factory
2482abda5c allow make private static field/method accessiable: Merge pull request #38 from zhu-rengong/make_static_member_accessible
allow make private static field/method accessiable
2022-02-10 12:27:09 -03:00
zhurengong
8dca5fa491 allow make private static field/method accessiable 2022-02-10 15:16:41 +08:00
zhurengong
9d68458eb2 add some type method to LuaUserData
1. RegisterGenericType: solves some types that cannot be found directly by strings, such as MapEntity.SelectedList(HashSet<MapEntity>)
2. IsTargetType: can be used to know whether MapEntity is Item, Character, or Structure.
2022-02-10 15:03:24 +08:00
Evil Factory
8ac7e08aac fix clients not getting correctly banned if this hook is present 2022-02-07 18:14:27 -03:00
Evil Factory
ffe544d406 add some networking registration 2022-02-07 18:06:46 -03:00
Evil Factory
4e73235276 fix broken registration, these classes aren't needed anyway 2022-02-07 17:34:17 -03:00
Evil Factory
0adcb7c3e2 add new hooks: human.CPRSuccess and human.CPRFailed 2022-02-07 17:12:26 -03:00
Evil Factory
1f751152db added loaded hook, called after all mods been loaded 2022-02-06 19:27:26 -03:00
Evil Factory
438070a81f improve docs and remove irrelevant example 2022-02-02 22:42:03 -03:00
Evil Factory
53231347bb rename hooks, introduce statusEffect.apply and update docs 2022-02-02 12:26:29 -03:00
Evil Factory
6b723c6fd0 add action type enum 2022-02-02 11:53:28 -03:00
Evil Factory
15294a4a61 rename item hooks to use the new name scheme, register body, new meleeWeapon.handleImpact hook and statusEffect.apply.ItemIdentifier hook 2022-02-02 11:52:08 -03:00
Evil Factory
efc62387ff add an try catch to better see what might be causing this unknown crash, 2022-02-01 22:38:44 -03:00
Evil Factory
28b08becd1 add LimbType, fix broken links in docs and improve docs in general 2022-01-29 21:00:22 -03:00
Evil Factory
aec4d5482e ability to patch private method: Merge pull request #36 from zhu-rengong/patch_private_method
ability to patch private method
2022-01-28 10:26:05 -03:00
zhurengong
a728e1f209 ability to patch private method 2022-01-28 15:41:41 +08:00
Evil Factory
48d6fd99cd Merge pull request #34 from zhu-rengong/improve_harmony_hook
Improve Harmony Hook
2022-01-27 12:11:35 -03:00
zhurengong
6daf410e50 Improve Harmony Hook
1. Hook.HookMethod can patch overloaded methods based on parameter types
2. Hook.HookMethod can add more patches to the method
3. Find all hook methods by the address of the function (origin method), not by the method path (string).
4. Fixed unable to add postfix patch to method (__params changed to __args)
5. Fix patching method will cause duplicate patches to be added
2022-01-27 22:50:34 +08:00
Evil Factory
740e51ce48 add "Range`1[System.Single]" to the default registration list 2022-01-23 19:50:39 -03:00
Evil Factory
6c5dddaae5 make event names case insensitive 2022-01-23 16:08:41 -03:00
Evil Factory
fe57d1eb87 update harmony to fix problem with __args not working correctly with static methods 2022-01-23 13:07:59 -03:00
Evil Factory
0a47c85a72 clientList.job hook 2022-01-19 19:42:54 -03:00
Evil Factory
33ca66fcae EntitySpawnerComponent 2022-01-17 10:10:59 -03:00
Evil Factory
36f201692a fix error in docs 2022-01-14 18:29:32 -03:00
Evil Factory
994d881366 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git 2022-01-13 12:41:56 -03:00
Evil Factory
f5fe166e8c ballast flora registers 2022-01-11 22:00:43 -03:00
Evil Factory
5049b2ecbd remove itemThink because it uses so much cpu time, because it can literally be called 1000 times a second, blame jimmyl for committing this horrible hook 2022-01-08 16:55:05 -03:00
Evil Factory
750d8948f1 add static ban method for endpoints 2022-01-08 00:44:58 -03:00
Evil Factory
0ef0a82f6c switch debug console functions to luasetup error handling 2022-01-06 16:49:38 -03:00
Evil Factory
b3757b49ff include mysterious .net core file in the files to be copied 2022-01-04 11:26:48 -03:00
Evil Factory
fcd0b2cc6d implement priority item updates, seems to work correctly after heavy testing in random servers 2022-01-02 18:57:35 -03:00
Evil Factory
afd58681d7 Update installing-lua-for-barotrauma-manually.md 2022-01-02 12:05:56 -03:00
Evil Factory
595f80e429 fix broken GUI library 2022-01-01 15:27:31 -03:00
Evil Factory
729cef7f3c allow client-side lua to be reloaded in multiplayer 2022-01-01 11:38:29 -03:00
Evil Factory
c399da8038 remove file move 2021-12-30 18:29:32 -03:00
Evil Factory
8a6259b9a3 Delete blacklist_files.zip 2021-12-30 17:27:48 -03:00
Evil Factory
036b42ca7e new performance improvement setting and client-side lua fixes 2021-12-30 17:26:51 -03:00
Evil Factory
fee9cf4fa3 fix installing docs 2021-12-29 21:33:19 -03:00
Evil Factory
d8d5bcb5fa update docs 2021-12-29 21:20:50 -03:00
Evil Factory
370ee8f1b3 convert UInt64 type to string, to avoid loosing precision with SteamIDs 2021-12-28 15:16:43 -03:00
Evil Factory
89cb0389d1 wrong hook name 2021-12-28 12:38:52 -03:00
Evil Factory
e6d170329a tryChangeClientName, LidgrenHandleConnection, handlePendingClient hooks and some other things 2021-12-28 12:37:51 -03:00
Evil Factory
71e39f1422 add NetEntityEvent, CreateEntityEvent and item.readPropertyChange hook 2021-12-27 15:41:45 -03:00
Evil Factory
f04d897370 fix client-side lua errors 2021-12-26 13:32:45 -03:00
Evil Factory
d033a43fc7 added restrictMessageSize 2021-12-25 18:25:34 -03:00
Evil Factory
d39d4c8297 added clientList.hasCrown 2021-12-23 15:33:38 -03:00
Evil Factory
350d4c6e6d added clientList.hasPermission hook 2021-12-23 12:29:41 -03:00
Evil Factory
6f6ceb4084 fix issue which caused bots to duplicate 2021-12-18 02:29:42 -03:00
Evil Factory
f71f598976 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git 2021-12-16 15:09:48 -03:00
Evil Factory
9927b5370e Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git into Regalis11-dev 2021-12-16 12:46:42 -03:00
Evil Factory
82ed9ff2fb Fix error which caused the server to crash if there was any bot present
When merged from the updated repo, for some reason it added this duplicated line of code
2021-12-16 12:19:15 -03:00
Evil Factory
368a037389 fix missing references in linux/mac projects 2021-12-15 16:00:10 -03:00
Evil Factory
24f63c78cb fix errors 2021-12-15 15:35:10 -03:00
Evil Factory
bb1631a21c Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git into Regalis11-master 2021-12-15 14:45:31 -03:00
Evil Factory
72f770d83b whoops, don't execute mods if using client-side lua 2021-12-13 18:04:06 -03:00
Evil Factory
3b1cb7a265 add job to default lib 2021-12-13 12:38:20 -03:00
Evil Factory
803291669d add call meta member to Job 2021-12-13 12:29:04 -03:00
Evil Factory
26058a4632 update install page 2021-12-12 22:28:46 -03:00
Evil Factory
b58d528502 fix 2021-12-11 23:45:54 -03:00
Evil Factory
d7655fa1a7 fixed empty functions causing errors 2021-12-09 11:59:11 -03:00
Evil Factory
1f2eaf765f remove c# lua loading, because it's not needed anymore 2021-12-08 19:30:08 -03:00
Evil Factory
2144c89efb add TextManager as static lib 2021-12-08 19:25:41 -03:00
Evil Factory
87e23db3cb Update README.md 2021-12-07 17:57:58 -03:00
Evil Factory
907061ec00 add SpawnType enum 2021-12-07 17:55:47 -03:00
Evil Factory
cee62b3869 whoops 2021-12-07 17:53:02 -03:00
Evil Factory
d078b3e2fe update docs and register Upgrade 2021-12-07 17:52:41 -03:00
Evil Factory
b4b5325c7b update docs 2021-12-06 15:17:13 -03:00
Evil Factory
f2e4106a0c fix error handling with Action callbacks causing server crashes 2021-12-06 14:58:58 -03:00
Evil Factory
7ab00eb161 exposed ServerPeer and ClientPeer to lua 2021-12-06 11:31:39 -03:00
Evil Factory
4ea4e4e0bd allow some degree of control over human bots 2021-12-04 13:15:04 -03:00
Evil Factory
fe563a417c update docs 2021-12-03 11:31:38 -03:00
Evil Factory
e70b0c9edc added NetworkConnections to registration list 2021-12-02 14:32:37 -03:00
Evil Factory
aaf049697e Merge branch 'Regalis11:master' into master 2021-12-02 12:32:44 -03:00
Evil Factory
edc1b131b2 add Content to whitelist 2021-12-01 19:41:07 -03:00
Evil Factory
e4885bc525 fix lua added commands breaking after reloadlua 2021-11-30 15:39:38 -03:00
Evil Factory
d30fb74d9a whoops mistake in docs 2021-11-30 11:38:45 -03:00
Evil Factory
7c8536127c added a way for lua to override people's jobs 2021-11-30 11:36:00 -03:00
Evil Factory
1972772fb3 fixed EnqueueFunction, apparently AddItem function doesn't actually adds an item. 2021-11-28 16:22:09 -03:00
Evil Factory
a65160dcbd fix item hooks not working properly 2021-11-28 13:52:36 -03:00
Evil Factory
878dbb30bc register bunch of components and fix enumerations in documentation 2021-11-26 22:56:29 -03:00
Evil Factory
a5721295bc register IdCard 2021-11-26 22:17:18 -03:00
Evil Factory
573806b823 added inventory docs 2021-11-26 18:55:40 -03:00
Evil Factory
72eb15248b fix duplicate in docs 2021-11-25 19:42:33 -03:00
Evil Factory
83a40bad6f added -- @remove, for removing duplicates from docs 2021-11-24 22:36:33 -03:00
Evil Factory
3127bfa037 fixed wrong hook type 2021-11-24 21:25:18 -03:00
Evil Factory
4436dd5226 improved docs 2021-11-24 21:25:10 -03:00
Evil Factory
da5ddbc073 fix compatibility itemprefab.AddToSpawnQueue not working 2021-11-23 18:17:59 -03:00
Evil Factory
48aaca0fa7 Merge pull request #31 from zhu-rengong/fix_set_radio_range
fix bugs that call Player.SetRadioRange cause different results in di…
2021-11-22 13:58:40 -03:00
zhurengong
9dcfc5f80d fix bugs that call Player.SetRadioRange cause different results in different languages 2021-11-23 00:36:03 +08:00
Evil Factory
ec89822fb3 make ClientPermissions a static table
Registering the enum is not possible, explained in the pull request #30
2021-11-21 13:45:05 -03:00
Evil Factory
63fb9e3354 fix reversed disableDisconnectCharacter 2021-11-19 16:21:32 -03:00
Evil Factory
af3293ffbf Merge pull request #29 from zhu-rengong/check_permission_no_return
Fix the CheckPermission method does not return
2021-11-19 13:05:21 -03:00
zhurengong
8b312c0f65 Fix the CheckPermission method does not return 2021-11-19 23:48:26 +08:00
Evil Factory
1f84c0c801 fix module path not working correctly in workshop version and update workshop 2021-11-18 18:51:46 -03:00
Evil Factory
9582052e7d Merge pull request #27 from zhu-rengong/enable_control_husk
allow client to force control husk and add a hook
2021-11-18 17:32:21 -03:00
zhurengong
b291624544 allow client to force control husk and add a hook 2021-11-19 03:32:29 +08:00
Evil Factory
3a4f3cded4 added job assigned hook 2021-11-16 19:41:02 -03:00
Evil Factory
2823f288ff added EndGame (was pretty sure this was already added) 2021-11-16 16:21:49 -03:00
Evil Factory
46166f124a add firesource 2021-11-13 12:16:08 -03:00
Evil Factory
f723e29277 prettier error messages 2021-11-12 13:50:25 -03:00
Evil Factory
6f510137d9 Merge branch 'Regalis11:master' into master 2021-11-11 13:08:55 -03:00
Evil Factory
f9302b36b5 forgot to include compatibility Lua lib in 6cda213 2021-11-11 12:23:32 -03:00
Evil Factory
02d0c14d00 fix localhost not working for direct connection 2021-11-11 12:12:34 -03:00
Evil Factory
50618c252d Merge pull request #26 from zhu-rengong/master
modified way to patch, can realize params map for compatibility, and try to hook Item in lua.
2021-11-11 11:18:53 -03:00
zhurengong
d1188a1ea5 do a hook call inside callback param of HookMethod, and wrapped __params 2021-11-11 22:13:35 +08:00
zhurengong
9635db22fc Merge remote-tracking branch 'public/master' 2021-11-10 21:12:31 +08:00
zhurengong
6b1aca8efa modified way to patch, can realize params map for compatibility, and try to hook Item in lua. 2021-11-10 21:07:19 +08:00
Evil Factory
6cda213441 move LuaPlayer and CreateVector to a separate compatibility lua file 2021-11-09 17:58:48 -03:00
Evil Factory
5c6450c6a2 provide instance in Hook Method 2021-11-08 22:27:27 -03:00
Evil Factory
192c103597 fix compile error 2021-11-08 20:04:18 -03:00
Evil Factory
89942fb8f5 added -ip so you are able to specify which ip to bind the server 2021-11-08 19:57:13 -03:00
Evil Factory
50427390f2 calling lua function inside an async function causes lots of issues (probably caused by the fact that it runs on a separate thread?), solved by creating a queue of functions to be called on the main thread 2021-11-08 14:29:07 -03:00
Evil Factory
07b6bcc32b Merge pull request #25 from zhu-rengong/improve
move the registration of generic types to the lua side in a simple way
2021-11-08 13:52:08 -03:00
zhurengong
83d1c29917 move the registration of generic types to the lua side in a simple way 2021-11-09 00:16:48 +08:00
Evil Factory
9d45eb7402 fix http requests somehow causing weird errors when an exception happened inside it, for some reason i used registertype instead of createstatic, fix that, and added override disconnect character time 2021-11-08 12:12:35 -03:00
Evil Factory
72fff4ab73 replace harmony with a custom one that includes __params, some fixes in the lua setup and hook method is now actually useful 2021-11-05 20:40:50 -03:00
Evil Factory
a8a0c96d57 move most of the registration code to Lua, include harmony, add useful perf methods to Time and a more useful(but still useless) error handling in the hook call 2021-11-04 11:30:36 -03:00
Evil Factory
2048389896 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git into Regalis11-master 2021-11-02 11:31:46 -03:00
Evil Factory
f4d6c686fe forgot to remove the member of the descriptor in case it already existed 2021-10-31 12:32:16 -03:00
Evil Factory
77bd8c3720 makes NetLobbyScreen.subs accessible by Lua and clean a bit the types 2021-10-31 11:52:20 -03:00
Evil Factory
5712589ef3 add new talents 2021-10-28 18:55:18 -03:00
Evil Factory
07f7aba4f2 Merge pull request #22 from Regalis11/master
this is weird
2021-10-27 14:42:42 -03:00
Evil Factory
5d0dc39ee3 Merge branch 'Regalis11-master' 2021-10-27 14:42:06 -03:00
Evil Factory
bae2390eb1 Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git into Regalis11-master 2021-10-27 14:41:47 -03:00
Evil Factory
8ef6ec90ca Revert "what the fuck"
This reverts commit 16e90bea61.

Revert "fix merge conflicts, warning: still broken"

This reverts commit 1f0f411d4f.
2021-10-27 13:59:19 -03:00
Evil Factory
16e90bea61 what the fuck 2021-10-27 13:47:14 -03:00
Evil Factory
1f0f411d4f fix merge conflicts, warning: still broken 2021-10-27 13:35:10 -03:00
Evil Factory
9d80de3ecf fix problem with wifi link to chat 2021-10-25 11:49:22 -03:00
Evil Factory
9c07262480 added new hooks to docs 2021-10-16 18:07:16 -03:00
Evil Factory
3a7355ed21 add many item and inventory related hooks 2021-10-16 17:58:24 -03:00
Evil Factory
fad7d2d001 dropdown thing 2021-10-14 10:17:28 -03:00
Evil Factory
8ba8b7c0c6 traitor hooks 2021-10-11 12:36:22 -03:00
Evil Factory
65f956741f i should probably use reflection to automatically register all components 2021-10-09 10:45:50 -03:00
Evil Factory
0000605186 for some reason you can move files but not delete, so i might aswell send them directly into the trash bin 🚊 2021-10-08 11:29:15 -03:00
Evil Factory
8500525722 client side lua install command thing 2021-10-08 10:44:24 -03:00
Evil Factory
58dbfdb13b hm? 2021-10-07 11:47:51 -03:00
Evil Factory
578bba38a2 changes to client-side commands and added some physics related things 2021-10-07 11:46:57 -03:00
Evil Factory
33f74c4a73 version text 2021-10-06 15:13:43 -03:00
Evil Factory
da98c04927 events apparently don't work 2021-10-05 16:16:40 -03:00
Evil Factory
1262c47e64 even more GUI 2021-10-04 11:46:13 -03:00
Evil Factory
fc811c67fb basic file sandboxing 2021-10-03 19:27:27 -03:00
Evil Factory
8ff490bfee make spam filter disabler actually work 2021-10-03 18:31:02 -03:00
Evil Factory
446686e18c docs update and entity.spawner 2021-10-03 12:13:45 -03:00
Evil Factory
a5233b4686 more GUI stuff 2021-10-01 19:13:25 -03:00
Evil Factory
31fcb5a1e2 added more actions and moved lobby update to networking which makes more sense 2021-10-01 12:54:06 -03:00
Evil Factory
6345166742 you can now load submarines dynamically and load them into the lobby screen and added entity spawner 2021-10-01 12:41:58 -03:00
Evil Factory
1da9b5870c docs update and registered few things 2021-09-30 14:56:19 -03:00
Evil Factory
04f7fe2630 Merge branch 'master' of https://github.com/evilfactory/Barotrauma-lua-attempt 2021-09-30 00:08:17 -03:00
Evil Factory
b34374ece4 new docs generator and docs update: electric boogaloo 2021-09-30 00:08:00 -03:00
Evil Factory
1c4b124cf3 don't create fatal errors in case of warnings 2021-09-30 00:07:19 -03:00
Evil Factory
1fd68c02ea Merge pull request #20 from mc-oofert/patch-6
itemThink deltaTime
2021-09-29 10:54:02 -03:00
jimmyl
d1da7ce521 deltatime 2021-09-29 11:44:11 +02:00
Evil Factory
e4b3743bdb fix wifi components not working correctly 2021-09-28 17:26:53 -03:00
Evil Factory
fc2095e7fb Merge pull request #19 from mc-oofert/patch-6
register relay and memory component
2021-09-28 10:54:50 -03:00
jimmyl
0ad10245f9 register relay and memory component 2021-09-28 12:53:38 +02:00
Evil Factory
2387c6c2c7 fix itemThink 2021-09-27 15:28:12 -03:00
Evil Factory
ffcf220f1f updated docs 2021-09-27 15:19:23 -03:00
Evil Factory
c99df6b820 registered Job 2021-09-26 21:25:55 -03:00
Evil Factory
b65b84539c fix voice 2021-09-26 15:03:29 -03:00
Evil Factory
96747345e9 Merge pull request #18 from mc-oofert/patch-5
itemThink
2021-09-26 11:30:42 -03:00
jimmyl
26352d744a final 2021-09-26 11:05:10 +02:00
jimmyl
8183ad60d6 how the fuck does this syntax work 2021-09-26 11:03:20 +02:00
jimmyl
26b8391ad4 dumb 2021-09-26 11:01:21 +02:00
Evil Factory
17ecef8c67 added a way to create console commands 2021-09-25 20:33:17 -03:00
Evil Factory
a058d0a1bc some GUI 2021-09-25 11:14:03 -03:00
Evil Factory
d81684cd19 fixed reloadlua breaking __call metamethods, fixed singleplayer crash, added fun things to client-side lua :) 2021-09-23 21:29:18 -03:00
Evil Factory
8d52f2d664 updated docs 2021-09-23 16:14:39 -03:00
Evil Factory
1f04fea3cc fixed http request halting the main thread 2021-09-23 16:09:38 -03:00
Evil Factory
dac0734401 finally Userdata() syntax, no more nasty CreateUserdata or Userdata.Create 2021-09-22 19:34:08 -03:00
Evil Factory
772edcfe5b updated docs 2021-09-22 13:27:31 -03:00
Evil Factory
88eb227284 increased max players and made Signal work with __new 2021-09-22 13:10:41 -03:00
Evil Factory
b07e5d9b0b refactor hooks with new LuaResult 2021-09-21 17:11:49 -03:00
Evil Factory
784baf550f added client and server network communication 2021-09-20 16:15:29 -03:00
Evil Factory
c5d365eaa7 added Game.NetLobbyScreen 2021-09-19 19:40:48 -03:00
Evil Factory
d6652fdaa9 inputtype and key 2021-09-19 16:04:26 -03:00
Evil Factory
6c1cd3c5d3 docs update and server event for item components 2021-09-19 13:26:35 -03:00
Evil Factory
75c0dd7425 registered reactor component 2021-09-18 11:57:26 -03:00
Evil Factory
f7d62efc29 added ai character 2021-09-17 19:44:56 -03:00
Evil Factory
1496313fd8 added Game.GameSession 2021-09-16 20:06:27 -03:00
Evil Factory
b26a6d7ccc sending error messages longer than 1024 bytes for some reason breaks barotrauma, fixed my splitting the message into multiple chunks 2021-09-16 12:00:48 -03:00
Evil Factory
beb9b10eb3 docs updated now with fields 2021-09-15 19:17:31 -03:00
Evil Factory
a07ca2fd62 fixed content packages with different name than the folder name not working 2021-09-15 14:47:58 -03:00
Evil Factory
b0ed126891 added more stuff to docs 2021-09-15 14:27:58 -03:00
Evil Factory
d44d03fd9e whoops i just noticed the wrong link in the readme 2021-09-15 13:06:08 -03:00
Evil Factory
4075e71f7a separated Lua source by client, server and shared
github desktop bugged
2021-09-15 12:59:58 -03:00
Evil Factory
5678f81326 docs update 2021-09-15 12:52:14 -03:00
Evil Factory
e25e77bcf6 better documentation about Character Creation 2021-09-14 21:08:36 -03:00
Evil Factory
6e5de74f37 new GetComponentString, and docs updated 2021-09-13 16:47:05 -03:00
Evil Factory
b480e6797c workshop installer program fix 2021-09-13 12:57:31 -03:00
Evil Factory
265e2b84b6 forgot to document the rest of the hooks 2021-09-13 10:30:10 -03:00
Evil Factory
d3dfe0e51b register AI controllers 2021-09-12 23:11:41 -03:00
Evil Factory
3555ddad79 update documentation link 2021-09-12 22:49:49 -03:00
Evil Factory
0449b7b890 whoops 2021-09-12 22:02:51 -03:00
Evil Factory
b4575864a9 fixed missing assets 2021-09-12 21:41:19 -03:00
Evil Factory
8722890b97 whoops 2021-09-12 16:34:16 -03:00
Evil Factory
7f750773ee generate-docs-fix 2021-09-12 16:29:07 -03:00
Evil Factory
5a2f8edf25 Create generate-docs.yml 2021-09-12 16:21:46 -03:00
Evil Factory
656af7df2f new documentation and some fixes in code 2021-09-12 15:58:59 -03:00
Evil Factory
3cd5a23af7 forgot to add itemprefab 2021-09-11 13:14:18 -03:00
Evil Factory
748e3e39bc Merge pull request #17 from Regalis11/master
thank now, now i have to update my mod
2021-09-11 12:13:02 -03:00
Evil Factory
ffb24594bc refactoring things out, removing unused additions 2021-09-10 19:10:05 -03:00
Evil Factory
813aaf29b8 making things more organized, turning Player deprecated, preparing for nlua and using partial classes for additions to another barotrauma classes 2021-09-10 18:32:19 -03:00
Evil Factory
176a24cb43 Merge pull request #16 from Regalis11/master
v0.14.9.1
2021-09-09 12:12:44 -03:00
Evil Factory
8d26ef859d add holdable, registered explosion and hook fixes 2021-09-09 11:19:43 -03:00
Evil Factory
01eec1e9ad lets hope this doesn't break anything: returned type by hook is now the last hook registered 2021-09-08 13:05:34 -03:00
Evil Factory
eb28b3a7f1 fixed: barotrauma for some reason ignores content packages that only contain lua scripts 2021-09-08 11:41:20 -03:00
Evil Factory
a8fb910e8d made lua loader only execute enabled mods, with a config bypass at the top, also ignoring it for dedicated server 2021-09-08 11:16:08 -03:00
Evil Factory
2888383b8f moved lua initialization to be after the server is running 2021-09-07 17:32:20 -03:00
Evil Factory
76f389dff9 new signalReceived hook with better performance
signalReceived.YourComponent, with the checks in the lua-side this hook was being called too many times and it was using up to 10% cpu of the server
2021-09-07 11:02:24 -03:00
Evil Factory
5df4207521 made the loader a lua script and added a few useful functions 2021-09-06 23:30:52 -03:00
Evil Factory
995d0d9488 added IsDedicated 2021-09-06 15:39:06 -03:00
Evil Factory
4c137167da fixed component exception and removed client permission temporary 2021-09-04 21:17:48 -03:00
Evil Factory
07114e52f8 Merge pull request #14 from mc-oofert/patch-2
SubmarineInfo and SubmarineBody
2021-09-04 10:53:35 -03:00
jimmyl
f938607119 more types 2021-09-04 13:04:47 +02:00
Evil Factory
6fff9875da clientpermissions enum 2021-09-03 15:10:38 -03:00
Evil Factory
2512513561 added Game.RoundStarted 2021-09-03 12:47:54 -03:00
Evil Factory
ce0da8581a serverLog hook and added a way to notify clients in custom interface 2021-09-03 12:15:29 -03:00
Evil Factory
2ddedf16b3 ... 2021-09-02 21:48:20 -03:00
Evil Factory
f14b088cca make readme better 2021-09-02 21:39:31 -03:00
Evil Factory
a7f658b54f I probably don't want to run this on pull requests and webhook fix 2021-09-02 20:34:30 -03:00
Evil Factory
fc6a212fc4 adding automatic builds because
its super painful to build each project individually and zipping them, thank-god this exists
2021-09-02 20:23:42 -03:00
Evil Factory
02c16f5979 Merge branch 'master' of https://github.com/evilfactory/Barotrauma-lua-attempt 2021-09-02 18:39:03 -03:00
Evil Factory
1fbd7ee7f8 added a way to know which content packages are enabled 2021-09-02 18:39:00 -03:00
Evil Factory
d5e8d4fb07 afflictionUpdate hook from mc-oofert/patch-1
afflictionUpdate hook
2021-09-02 15:27:26 -03:00
jimmyl
7dd50987df add hook 2021-09-02 20:14:10 +02:00
Evil Factory
8b54f93f66 registered pair of jobprefab so you can get job preferences 2021-09-02 11:25:54 -03:00
Evil Factory
169555b041 added Hook.Remove and increased perfomance of hooks slightly 2021-09-02 11:06:03 -03:00
Evil Factory
7359b1846a dofile, loadfile, require, dostring, load replaced 2021-09-01 14:08:46 -03:00
Evil Factory
53fd4b1258 made modules partially work and replace/removed useless functions 2021-09-01 13:47:30 -03:00
Evil Factory
4d1297eca5 whoops fix error 2021-08-31 18:18:46 -03:00
Evil Factory
767f0d6b44 hook character create 2021-08-31 18:17:21 -03:00
Evil Factory
4d494ce9b2 whoopps again 2021-08-31 16:50:01 -03:00
Evil Factory
0190c81a97 whoops included NLua 2021-08-31 16:46:14 -03:00
Evil Factory
c98c37743f add hook for changing local voice range 2021-08-29 17:30:29 -03:00
Evil Factory
dd5ea6e4f8 Merge pull request #11 from mc-oofert/patch-1
characterDeath with killer and killing affliction
2021-08-29 15:42:01 -03:00
jimmyl
67dd27f4fe made changes as suggested by evilfactory 2021-08-29 20:40:07 +02:00
jimmyl
f212631e1a remove characterdeath from shared 2021-08-29 20:06:00 +02:00
jimmyl
63ef6c82cb characterdeath with killer and killing affliction
why this wasnt already a feature i do not know
2021-08-29 20:03:37 +02:00
Evil Factory
e24797dd05 refactor: no more dynvalues or userdatas 2021-08-29 00:16:33 -03:00
Evil Factory
fdb9ca1d30 Merge branch 'master' of https://github.com/evilfactory/Barotrauma-lua-attempt 2021-08-28 22:28:35 -03:00
Evil Factory
c248a192c9 map entity prefab and fabricator component 2021-08-28 22:28:30 -03:00
Evil Factory
b03638b6b6 Merge pull request #10 from Regalis11/master
dependa bot thing
2021-08-28 00:13:36 -03:00
Evil Factory
327a287a0b update data package 2021-08-25 13:36:42 -03:00
Evil Factory
83360b3b7e revert wificomponent 2021-08-25 13:31:16 -03:00
Evil Factory
970ee8a93f Merge pull request #9 from Regalis11/master
0.14.9.0
2021-08-25 13:18:02 -03:00
Evil Factory
5ffe372908 test 2021-08-25 13:17:10 -03:00
Evil Factory
5d75b1c6f1 http request support 2021-08-20 21:11:45 -03:00
Evil Factory
1ff03398d6 file io 2021-08-20 19:01:28 -03:00
Evil Factory
529c1643a8 fix character death 2021-08-19 16:16:32 -03:00
Evil Factory
b8fffad6c8 firesources 2021-08-18 22:56:28 -03:00
Evil Factory
c11d889d51 custom intefaces 2021-08-17 23:59:14 -03:00
Evil Factory
9f2261827a better way of creating items 2021-08-17 19:13:24 -03:00
Evil Factory
98fd600696 falldamage and invslotype 2021-08-17 17:04:25 -03:00
Evil Factory
a2cb256aa6 plenty of new things 2021-08-15 17:17:49 -03:00
Evil Factory
06f40fa368 more 2021-08-10 23:34:07 -03:00
Evil Factory
694f7adcc6 use 2021-08-09 23:45:12 -03:00
Evil Factory
64ed424a6b new hooks and item removing 2021-08-09 23:43:38 -03:00
Evil Factory
7f0fac3553 new affliction hook 2021-08-09 17:00:50 -03:00
Evil Factory
5caeee45ad character team type 2021-08-09 14:23:20 -03:00
Evil Factory
31173567d1 mac support 2021-08-08 19:40:41 -03:00
Evil Factory
933b6dcb8f fix killedbytraitor and message icon 2021-08-06 19:26:16 -03:00
Evil Factory
bae0dbd0e5 replace dofile function 2021-08-06 15:53:12 -03:00
Evil Factory
199dde05d0 Update README.md 2021-08-05 19:35:57 -03:00
Evil Factory
058b27af32 list array for affliction prefabs 2021-08-05 15:47:55 -03:00
Evil Factory
e5b1f1cf46 fixed duplicate log and registered more classes 2021-08-05 15:26:37 -03:00
Evil Factory
cdda8a2ffd characterdeath 2021-08-02 21:58:25 -03:00
Evil Factory
49d162fb12 better vectors 2021-08-01 11:14:25 -03:00
Evil Factory
193b1207f8 Update README.md 2021-07-30 12:07:23 -03:00
Evil Factory
eb7ae833b4 workshop 2021-07-28 15:15:51 -03:00
Evil Factory
8a8018509d fixes 2021-07-19 00:12:41 -03:00
Evil Factory
a241512857 Update HumanAIController.cs 2021-07-18 22:02:28 -03:00
Evil Factory
1162375194 removed examples 2021-07-14 19:00:37 -03:00
Evil Factory
0e6eae600a Update RespawnManager.cs 2021-07-09 19:17:42 -03:00
Evil Factory
52648d1a0e Update WifiComponent.cs 2021-06-28 22:40:21 -03:00
Evil Factory
0e039515f6 hotfix 2021-06-28 17:34:22 -03:00
Evil Factory
4c94614526 Update README.md 2021-06-17 13:08:18 -03:00
Evil Factory
4c157ded2b traitormod 2021-06-17 13:06:17 -03:00
Evil Factory
0b5505cb34 Merge pull request #6 from Regalis11/master
Thunder Under The Ice repo update
2021-06-17 12:35:28 -03:00
Evil Factory
26b6ecf4dd Update README.md 2021-06-17 12:35:08 -03:00
Evil Factory
0bfbe9a504 Update README.md 2021-06-17 12:34:22 -03:00
Evil Factory
823af95742 Update WifiComponent.cs 2021-06-17 12:33:58 -03:00
Evil Factory
16b0ea3625 end round 2021-06-03 21:48:08 -03:00
Evil Factory
9546c4e7c7 example update 2021-05-30 16:29:21 -03:00
Evil Factory
07658676c9 linux fixes 2021-05-14 10:52:31 -03:00
Evil Factory
197e34ccd5 examples update 2021-04-30 11:34:21 -03:00
Evil Factory
9dd746b92b wifi fix 2021-04-30 11:28:34 -03:00
Evil Factory
a72d6f034e Merge pull request #5 from Regalis11/master
0.13.3.11
2021-04-29 13:15:54 -03:00
Evil Factory
250163e1f5 wifi wiring 2021-04-26 23:46:58 -03:00
Evil Factory
b84d6a2872 Merge pull request #4 from Regalis11/master
Fixed compiler error
2021-04-22 17:18:17 -03:00
Evil Factory
17336ed9a4 respawn shuttle not moving fix 2021-04-22 17:06:34 -03:00
Evil Factory
54b49209ed fixes 2021-04-22 13:59:27 -03:00
Evil Factory
08ecfb0098 Merge branch 'Regalis11-master' 2021-04-22 13:36:49 -03:00
Evil Factory
5991eef8df example update 2021-04-22 13:33:23 -03:00
Evil Factory
e8c99c14eb example 2021-04-22 13:33:22 -03:00
Evil Factory
756708b0d3 expose more things to lua 2021-04-22 13:33:21 -03:00
Evil Factory
8fc389a108 test 2021-04-22 13:33:20 -03:00
Evil Factory
5ea18c8d1e better addon structure 2021-04-22 13:33:20 -03:00
Evil Factory
7f38b48a59 dofile 2021-04-22 13:33:19 -03:00
Evil Factory
c143a275fe make things less shit 2021-04-22 13:33:19 -03:00
Evil Factory
318333f466 REFACTOR SOON 2021-04-22 13:33:18 -03:00
Evil Factory
585a629c6f more 2021-04-22 13:31:57 -03:00
Evil Factory
93ba73c33f Update README.md 2021-04-22 13:31:55 -03:00
Evil Factory
48326a11fd Update README.md 2021-04-22 13:31:55 -03:00
Evil Factory
f97d92edea stuff 2021-04-22 13:31:55 -03:00
Evil Factory
f412cf476e Update README.md 2021-04-22 13:31:54 -03:00
Evil Factory
d85f01b779 Update README.md 2021-04-22 13:31:53 -03:00
Evil Factory
8ab7b96d87 my attempt 2021-04-22 13:31:53 -03:00
Evil Factory
1b5fb6bccb example update 2021-04-17 23:04:13 -03:00
Evil Factory
bb0ea74961 example 2021-04-14 01:00:56 -03:00
Evil Factory
d557b4491d expose more things to lua 2021-03-26 16:56:59 -03:00
Evil Factory
df6332f020 test 2021-03-23 17:09:19 -03:00
Evil Factory
76514cc758 better addon structure 2021-03-22 21:57:02 -03:00
Evil Factory
4b207ebbf6 dofile 2021-02-28 17:34:27 -03:00
Evil Factory
33be4802f0 Merge branch 'master' of https://github.com/evilfactory/Barotrauma-lua-attempt 2021-02-28 16:27:12 -03:00
Evil Factory
2ddffa3308 make things less shit 2021-02-28 16:27:08 -03:00
Evil Factory
e6a76c79b7 Merge pull request #2 from Regalis11/master
v0.12.0.3
2021-02-17 19:59:47 -03:00
Evil Factory
ec74cf912b REFACTOR SOON 2021-02-15 11:11:59 -03:00
Evil Factory
ed2091a4ab more 2021-02-12 19:26:18 -03:00
Evil Factory
05ea1d2a3a Update README.md 2021-02-11 16:29:07 -03:00
Evil Factory
0e7feaf5c7 Update README.md 2021-02-11 16:20:05 -03:00
Evil Factory
96d27d3c42 stuff 2021-02-11 16:16:55 -03:00
Evil Factory
8b6bf92d56 Merge branch 'master' of https://github.com/evilfactory/Barotrauma-lua-attempt 2021-02-10 17:00:49 -03:00
Evil Factory
93915963cd Update README.md 2021-02-10 17:00:38 -03:00
Evil Factory
0f64196bdb Merge pull request #1 from Regalis11/master
update my fork
2021-02-10 12:13:12 -03:00
Evil Factory
084e47636e Update README.md 2021-01-12 21:07:41 -03:00
Evil Factory
a0c6794b01 my attempt 2021-01-12 20:52:35 -03:00
570 changed files with 47876 additions and 4596 deletions

View File

@@ -1,6 +1,41 @@
[*.cs]
root = true
[*]
charset = utf-8
insert_final_newline = true
[*.{sln,cs}]
# VS defaults to utf-8 with BOM -- let's not create more merge conflicts
# XXX: csproj files dont't have a BOM for some reason?
charset = utf-8-bom
[*.cs]
indent_style = space
indent_size = 4
csharp_prefer_braces = when_multiline:warning
csharp_indent_case_contents_when_block = false
# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = none
# IDE0090: Use 'new(...)'
csharp_style_implicit_object_creation_when_type_is_apparent = false
dotnet_diagnostic.CA1806.severity = silent
[*.{html,xml,csproj}]
indent_style = space
indent_size = 2
[*.{sh,ps1}]
indent_style = space
indent_size = 2
[*.py]
indent_style = space
indent_size = 4
[*.{js,json}]
indent_style = space
indent_size = 2
[*.lua]
indent_style = space
indent_size = 2

View File

@@ -73,7 +73,7 @@ body:
label: Version
description: Which version of the game did the bug happen in? You can see the current version number in the bottom left corner of your screen in the main menu.
options:
- v1.11.5.0 (Winter Update 2025 Hotfix 1)
- v1.12.6.2 (Spring Update 2026)
- Other
validations:
required: true

View File

@@ -1,5 +1,101 @@
blank_issues_enabled: false
contact_links:
- name: Bug reports
url: https://github.com/FakeFishGames/Barotrauma/discussions/categories/bug-reports
about: Please post your bug reports in the Discussions section.
name: Bug Report
description: Found a bug? Help us squash it by making a bug report!
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report a bug! Actionable reports are very important in identifying and fixing bugs, so please fill out all the fields carefully and provide as much information as you can while being concise. Please also note that we get lots of reports and may not always write back to each individually that does not mean we have not read it.
- type: checkboxes
id: checks
attributes:
label: "Disclaimers"
options:
- label: "I have searched the issue tracker to check if the issue has already been reported."
required: true
- label: "My issue happened while using mods."
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Please tell us also what you expected should have happened if the game was behaving correctly.
placeholder: "Using the bike horn crashes the game."
validations:
required: true
- type: textarea
id: repro
attributes:
label: Reproduction steps
description: |
If possible, describe how the developers can get the bug to happen (or, in other words, what actions lead to you encountering the bug). **This is by far the most important part of the report** - it is often extremely difficult, or even impossible, to diagnose an issue if we don't know the conditions it occurs in.
If you have a save, a submarine file, screenshots or any other files that might help us diagnose the issue, you can attach them here. Note that GitHub doesn't support the .save or .sub file extensions, so you should .zip those types of files to allow them to be attached.
placeholder: |
1. Start a multiplayer campaign
2. Spawn a bike horn with console commands
3. Use the bike horn
4. Observe how the game crashes
validations:
required: true
- type: dropdown
id: prevalence
attributes:
label: Bug prevalence
description: "How often do you or others encounter this bug?"
options:
- Just once
- Happens every now and then
- Happens regularly
- Happens every time I play
validations:
required: true
- type: dropdown
id: mporsp
attributes:
label: Single player or multiplayer?
description: Did the issue happen in single player, multiplayer, or both? How was the server being hosted?
options:
- Single player
- Multiplayer hosted from the in-game menu (= using a listen server)
- Multiplayer hosted using a dedicated server
- Happens in both single player and multiplayer
- Happens outside single player or multiplayer game modes (e.g. game launches on startup, something broken in the main menu)
- Other
validations:
required: true
- type: input
id: othermporsp
attributes:
label: "-"
description: If you selected "Other" in the above dropdown, please clarify here.
- type: dropdown
id: version
attributes:
label: Version
description: Which version of the game did the bug happen in? You can see the current version number in the bottom left corner of your screen in the main menu.
options:
- Latest Stable
- Unstable
- Other
validations:
required: true
- type: input
id: otherversion
attributes:
label: "-"
description: If you selected "Other" in the above dropdown because you are e.g. using a custom build, please tell us more about it here.
- type: dropdown
id: operating-systems
attributes:
label: Which operating system did you encounter this bug on?
options:
- Windows
- MacOS
- Linux
validations:
required: true
- type: textarea
id: errors
attributes:
label: Relevant error messages and crash reports
description: If the game produces any text relevant to your issue, please include those in full. You can copy error messages from the in-game console by right clicking the error and selecting "copy". Crash reports will be named crashreport.log or servercrashreport.log and they're automatically generated into the root of the game's installation folder on your computer. You can usually find the game files location through Steam (Right click Barotrauma in your Steam Library -> Properties -> Local files -> Browse local files).
render: shell

9
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
version: 2
updates:
- package-ecosystem: github-actions
target-branch: develop
directory: /
schedule:
interval: daily

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

@@ -0,0 +1,51 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
on:
workflow_dispatch:
workflow_call:
inputs:
target:
required: true
type: string
env:
CI_DIR: 717a3c49-f5dc-42eb-b332-fcf2988d00e3
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: |
8.0.x
- name: Run deploy script
run: |
set -e
shopt -s globstar nullglob
shopt -u dotglob
cd Deploy
git apply < ./patches/disable-interactivity.diff
git apply < ./patches/prevent-crash-on-missing-dir.diff
./DeployAll.sh
- name: Create tarball
run: |
mkdir -p "$CI_DIR"
tar -czf "$CI_DIR/build.tar.gz" -C Deploy/bin/content .
- name: Upload tarball
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: build
path: ${{ env.CI_DIR }}/build.tar.gz

89
.github/workflows/create-prerelease.yml vendored Normal file
View File

@@ -0,0 +1,89 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Create pre-release
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
check-if-release-needed:
runs-on: ubuntu-latest
outputs:
latest-commit-sha: ${{ steps.get-latest-commit.outputs.result }}
has-new-commits: ${{ steps.check-for-new-commits.outputs.has-new-commits }}
steps:
- name: Extract branch name
id: extract-branch-name
run: |
echo "result=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
- name: Sanity checks
if: ${{ github.event_name == 'workflow_dispatch' && steps.extract-branch-name.outputs.result != 'develop' }}
run: |
echo "::error::this workflow can only be run on the \"develop\" branch"
exit 1
- name: Get latest nightly-tagged commit
id: get-latest-tag
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
result-encoding: string
script: |
try {
const ref = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/nightly",
});
return ref.data.object.sha;
} catch (err) {
if (err.name === "HttpError" && err.status === 404) {
return "tag-doesnt-exist";
}
throw err;
}
- name: Get latest commit on dev branch
id: get-latest-commit
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
result-encoding: string
script: |
const ref = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "heads/develop",
});
return ref.data.object.sha;
- name: Check for new commits
id: check-for-new-commits
if: ${{ steps.get-latest-tag.outputs.result != 'tag-doesnt-exist' }}
env:
LATEST_TAGGED_SHA: "${{ steps.get-latest-tag.outputs.result }}"
LATEST_SHA: "${{ steps.get-latest-commit.outputs.result }}"
run: |
if [[ -z "$LATEST_TAGGED_SHA" ]]; then
echo "::error::LATEST_TAGGED_SHA env var is invalid"
exit 1
fi
if [[ -z "$LATEST_SHA" ]]; then
echo "::error::LATEST_TAGGED_SHA env var is invalid"
exit 1
fi
if [[ "$LATEST_TAGGED_SHA" == "$LATEST_SHA" ]]; then
echo "has-new-commits=false" >> "$GITHUB_OUTPUT"
else
echo "has-new-commits=true" >> "$GITHUB_OUTPUT"
fi
publish-release:
needs: [check-if-release-needed]
if: ${{ needs.check-if-release-needed.outputs.has-new-commits == 'true' }}
uses: ./.github/workflows/publish-release.yml
with:
target: ${{ needs.check-if-release-needed.outputs.latest-commit-sha }}
tag: nightly
prerelease: true

View File

@@ -0,0 +1,21 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Harden CI security
on:
workflow_call:
inputs:
target:
required: true
type: string
jobs:
ensure-sha-pinned-actions:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
- name: Ensure all actions are pinned to a specific commit
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@3c16e895bb662b4d7e284f032cbe8835a57773cc # v3.0.11

22
.github/workflows/on-push-master.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: On push to master branch
on:
push:
branches: [master]
paths-ignore:
- ".github/**"
- "*.md"
jobs:
run-tests:
uses: ./.github/workflows/run-tests.yml
with:
target: ${{ github.event.ref }}
publish-release:
uses: ./.github/workflows/publish-release.yml
with:
target: ${{ github.event.ref }}
tag: latest

View File

@@ -0,0 +1,16 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: On push to a secondary branch
on:
push:
branches-ignore: [master]
paths-ignore:
- ".github/**"
- "*.md"
jobs:
run-tests:
uses: ./.github/workflows/run-tests.yml
with:
target: ${{ github.event.ref }}

17
.github/workflows/on-push-pr.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: On push to a PR
on:
pull_request:
jobs:
harden-ci-security:
uses: ./.github/workflows/harden-ci-security.yml
with:
target: ${{ github.event.pull_request.head.sha }}
run-tests-for-pr:
uses: ./.github/workflows/run-tests.yml
with:
target: ${{ github.event.pull_request.head.sha }}

View File

@@ -0,0 +1,14 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: On changes to .github
on:
push:
paths-ignore:
- "./.github/**"
jobs:
harden-ci-security:
uses: ./.github/workflows/harden-ci-security.yml
with:
target: ${{ github.event.ref }}

232
.github/workflows/publish-release.yml vendored Normal file
View File

@@ -0,0 +1,232 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish release
on:
workflow_dispatch:
inputs:
target:
description: "The git ref to checkout, build from and release"
required: true
type: string
tag:
description: "The tag of the release"
required: true
type: string
prerelease:
description: "Prerelease"
required: false
default: false
type: boolean
workflow_call:
inputs:
target:
description: "The git ref to checkout, build from and release"
required: true
type: string
tag:
description: "The tag of the release"
required: true
type: string
prerelease:
description: "Prerelease"
required: false
default: false
type: boolean
env:
CI_DIR: 2049ef39-42a2-46d2-b513-ee6d2e3a7b15
RELEASES: |
windows:server:Windows/Server
linux:server:Linux/Server
mac:server:Mac/Server
windows:client:Windows/Client
linux:client:Linux/Client
mac:client:Mac/Client/Barotrauma.app/Contents/MacOS
ARCHIVE_BASE_NAME: luacsforbarotraumaEP
# XXX: these file names are subject to shell expansion.
# Be careful when using special characters.
ARCHIVE_FILES_SERVER: |
DedicatedServer.deps.json
DedicatedServer.dll
DedicatedServer.pdb
Publicized/DedicatedServer.dll
ARCHIVE_FILES_CLIENT: |
Barotrauma.deps.json
Barotrauma.dll
Barotrauma.pdb
DedicatedServer.deps.json
DedicatedServer.dll
DedicatedServer.pdb
Publicized/Barotrauma.dll
Publicized/DedicatedServer.dll
ARCHIVE_FILES_SHARED: |
BarotraumaCore.dll
BarotraumaCore.pdb
Publicized/BarotraumaCore.dll
0Harmony.dll
Sigil.dll
MoonSharp.Interpreter.dll
MoonSharp.VsCodeDebugger.dll
MonoMod.Backports.dll
MonoMod.Core.dll
MonoMod.RuntimeDetour.dll
MonoMod.ILHelpers.dll
MonoMod.Utils.dll
MonoMod.Iced.dll
Mono.Cecil.dll
Mono.Cecil.Mdb.dll
Mono.Cecil.Pdb.dll
Mono.Cecil.Rocks.dll
LightInject.dll
OneOf.dll
FluentResults.dll
Basic.Reference.Assemblies.Net80.dll
Microsoft.Extensions.Logging.Abstractions.dll
Microsoft.Toolkit.Diagnostics.dll
Microsoft.CodeAnalysis.CSharp.dll
Microsoft.CodeAnalysis.dll
System.Collections.Immutable.dll
System.Reflection.Metadata.dll
System.Runtime.CompilerServices.Unsafe.dll
mscordaccore_amd64_amd64_*
LocalMods/LuaCsForBarotrauma
jobs:
build:
uses: ./.github/workflows/build.yml
with:
target: ${{ inputs.target }}
publish-release:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download build artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: build
path: ${{ env.CI_DIR }}
- name: Extract build artifacts
run: |
artifacts_dir="$(realpath -m "$CI_DIR/artifacts")"
mkdir -p "$artifacts_dir"
tar -xzf "$CI_DIR/build.tar.gz" -C "$artifacts_dir"
rm "$CI_DIR/build.tar.gz"
- name: Create archives
run: |
set -e
shopt -s globstar nullglob
shopt -u dotglob
# This converts a newline-separated (LF) list into a Bash array
# NOTE: this doesn't discard the trailing LF that GitHub actions
# append (which results in an extra entry in the array).
lines_to_array() {
IFS=$'\n' readarray -td $'\n' "$1" <<< "${!1}"
}
lines_to_array ARCHIVE_FILES_SHARED
lines_to_array ARCHIVE_FILES_CLIENT
lines_to_array ARCHIVE_FILES_SERVER
lines_to_array RELEASES
artifacts_dir="$(realpath -m "$CI_DIR/artifacts")"
mkdir -p "$artifacts_dir"
archives_dir="$(realpath -m "$CI_DIR/archives")"
mkdir -p "$archives_dir"
refs_dir="$(realpath -m "$CI_DIR/refs")"
mkdir -p "${refs_dir}"
mkdir -p "${refs_dir}/Windows"
mkdir -p "${refs_dir}/Linux"
mkdir -p "${refs_dir}/OSX"
# Archive Refs, used by mod developers
cp "${artifacts_dir}/Windows/Client/Publicized/Barotrauma.dll" "${refs_dir}/Windows/Barotrauma.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/DedicatedServer.dll" "${refs_dir}/Windows/DedicatedServer.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/BarotraumaCore.dll" "${refs_dir}/Windows/BarotraumaCore.dll"
cp "${artifacts_dir}/Linux/Client/Publicized/Barotrauma.dll" "${refs_dir}/Linux/Barotrauma.dll"
cp "${artifacts_dir}/Linux/Client/Publicized/DedicatedServer.dll" "${refs_dir}/Linux/DedicatedServer.dll"
cp "${artifacts_dir}/Linux/Client/Publicized/BarotraumaCore.dll" "${refs_dir}/Linux/BarotraumaCore.dll"
cp "${artifacts_dir}/Mac/Client/Barotrauma.app/Contents/MacOS/Publicized/Barotrauma.dll" "${refs_dir}/OSX/Barotrauma.dll"
cp "${artifacts_dir}/Mac/Client/Barotrauma.app/Contents/MacOS/Publicized/DedicatedServer.dll" "${refs_dir}/OSX/DedicatedServer.dll"
cp "${artifacts_dir}/Mac/Client/Barotrauma.app/Contents/MacOS/Publicized/BarotraumaCore.dll" "${refs_dir}/OSX/BarotraumaCore.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/MonoGame.Framework.Windows.NetStandard.dll" "${refs_dir}/MonoGame.Framework.Windows.NetStandard.dll"
cp "${artifacts_dir}/Linux/Client/Publicized/MonoGame.Framework.Linux.NetStandard.dll" "${refs_dir}/MonoGame.Framework.Linux.NetStandard.dll"
cp "${artifacts_dir}/Mac/Client/Barotrauma.app/Contents/MacOS/Publicized/MonoGame.Framework.MacOS.NetStandard.dll" "${refs_dir}/MonoGame.Framework.MacOS.NetStandard.dll"
# Those are the same across all the platforms, so i guess it doesn't matter?
cp "${artifacts_dir}/Windows/Client/Publicized/0Harmony.dll" "${refs_dir}/0Harmony.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/MonoMod.Utils.dll" "${refs_dir}/MonoMod.Utils.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/MonoMod.RuntimeDetour.dll" "${refs_dir}/MonoMod.RuntimeDetour.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/MonoMod.ILHelpers.dll" "${refs_dir}/MonoMod.ILHelpers.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/MonoMod.Iced.dll" "${refs_dir}/MonoMod.Iced.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/MonoMod.Backports.dll" "${refs_dir}/MonoMod.Backports.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/Farseer.NetStandard.dll" "${refs_dir}/Farseer.NetStandard.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/Lidgren.NetStandard.dll" "${refs_dir}/Lidgren.NetStandard.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/Mono.Cecil.dll" "${refs_dir}/Mono.Cecil.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/MoonSharp.Interpreter.dll" "${refs_dir}/MoonSharp.Interpreter.dll"
cp "${artifacts_dir}/Windows/Client/Publicized/XNATypes.dll" "${refs_dir}/XNATypes.dll"
cd "${refs_dir}"
zip -r "${archives_dir}/${ARCHIVE_BASE_NAME}_refs.zip" .
for i in "${!RELEASES[@]}"; do
[[ -z "${RELEASES[i]}" ]] && continue
(
IFS=':' read platform side publish_dir _rest <<< "${RELEASES[i]}"
cd "${artifacts_dir}/${publish_dir}"
echo "Creating build_${platform}_${side}.zip"
zip --must-match -qr "${archives_dir}/${ARCHIVE_BASE_NAME}_build_${platform}_${side}.zip" *
echo "Creating build_${platform}_${side}.tar.gz"
tar -czf "${archives_dir}/${ARCHIVE_BASE_NAME}_build_${platform}_${side}.tar.gz" \
--owner=0 --group=0 \
*
if [[ "$side" == "client" ]]; then
files=(
${ARCHIVE_FILES_SHARED[@]}
${ARCHIVE_FILES_CLIENT[@]}
)
elif [[ "$side" == "server" ]]; then
files=(
${ARCHIVE_FILES_SHARED[@]}
${ARCHIVE_FILES_SERVER[@]}
)
else
echo "Invalid side: $side"
exit 1
fi
echo "Creating patch_${platform}_${side}.zip"
zip \
--must-match \
-qr \
"${archives_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_${side}.zip" \
"${files[@]}"
echo "Creating patch_${platform}_${side}.tar.gz"
tar \
-zcf "${archives_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_${side}.tar.gz" \
--owner=0 --group=0 \
"${files[@]}"
)
done
- name: Publish release
uses: notpeelz/action-gh-create-release@c1bebd17c8a128e8db4165a68be4dc4e3f106ff1 # v5.0.1
with:
target: ${{ inputs.target }}
tag: ${{ inputs.tag }}
prerelease: ${{ inputs.prerelease }}
strategy: replace
title: "Automatic build"
body: "Automatic build"
files: |
${{ env.CI_DIR }}/archives/${{ env.ARCHIVE_BASE_NAME }}_{build,patch}_{windows,linux,mac}_{client,server}.zip
${{ env.CI_DIR }}/archives/${{ env.ARCHIVE_BASE_NAME }}_{build,patch}_linux_{client,server}.tar.gz
${{ env.CI_DIR }}/archives/${{ env.ARCHIVE_BASE_NAME }}_refs.zip

View File

@@ -0,0 +1,27 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Report test results
# HACK: the "on-push-pr" workflow gets run with read-only perms.
# This workflow will run in our repo with write permissions after
# the PR checks are done running.
on:
workflow_run:
workflows:
- On push to master branch
- On push to a secondary branch
- On push to a PR
types: [completed]
jobs:
report-test-results:
runs-on: ubuntu-latest
steps:
- name: Report test results
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
with:
name: Test results
artifact: test-results
path: test-results.trx
fail-on-error: false
reporter: dotnet-trx

47
.github/workflows/run-tests.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Run tests
on:
workflow_call:
inputs:
target:
required: true
type: string
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.target }}
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: |
8.0.x
- name: Initialize environment
run: |
mkdir -p ~/".local/share/Daedalic Entertainment GmbH/Barotrauma"
- name: Run tests
continue-on-error: true
run: |
set +e
dotnet test LinuxSolution.sln -clp:"ErrorsOnly;Summary" --logger "trx;LogFileName=$PWD/test-results.trx"
echo "EXITCODE=$?" >> "$GITHUB_ENV"
- name: Upload test results
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: test-results
path: test-results.trx
- name: Set exit code
run: exit "$EXITCODE"

118
.github/workflows/update-docs.yml vendored Normal file
View File

@@ -0,0 +1,118 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Update documentation
on:
workflow_dispatch:
env:
CI_DEPLOY_DIR: luacs-docs/ci-deploy
CI_ARTIFACTS_DIR: luacs-docs/ci-artifacts
DOCS_LUA_ROOT: luacs-docs/lua
DOCS_CS_ROOT: luacs-docs/cs
DOCS_LANDINGPAGE_ROOT: luacs-docs/landing-page
jobs:
update-docs-lua:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: |
6.0.x
- uses: leafo/gh-actions-lua@35bcb06abec04ec87df82e08caa84d545348536e # v10.0.0
with:
luaVersion: "5.2"
- uses: leafo/gh-actions-luarocks@e65774a6386cb4f24e293dca7fc4ff89165b64c5 # v4.3.0
- name: Run install script
working-directory: ${{ env.DOCS_LUA_ROOT }}
run: ./scripts/install.sh
- name: Run docs generator script
working-directory: ${{ env.DOCS_LUA_ROOT }}
run: ./scripts/generate_docs.sh
- name: Run build script
working-directory: ${{ env.DOCS_LUA_ROOT }}
run: ./scripts/build.sh
- name: Create tarball
run: |
mkdir -p "$CI_ARTIFACTS_DIR"
tar -czf "$CI_ARTIFACTS_DIR"/lua.tar.gz -C "$DOCS_LUA_ROOT"/build .
- name: Upload tarball
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: docs-lua
path: ${{ env.CI_ARTIFACTS_DIR }}/lua.tar.gz
update-docs-cs:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install doxygen
run: sudo apt-get update && sudo apt-get install -y doxygen
- name: Run build script
working-directory: ${{ env.DOCS_CS_ROOT }}
run: ./scripts/build.sh
- name: Create tarball
run: |
mkdir -p "$CI_ARTIFACTS_DIR"
tar -czf "$CI_ARTIFACTS_DIR"/cs.tar.gz -C "$DOCS_CS_ROOT"/build .
- name: Upload tarball
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: docs-cs
path: ${{ env.CI_ARTIFACTS_DIR }}/cs.tar.gz
deploy-docs:
runs-on: ubuntu-latest
needs: [update-docs-lua, update-docs-cs]
steps:
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- run: mkdir -p "$CI_ARTIFACTS_DIR" "$CI_DEPLOY_DIR"
- name: "Download build artifacts: lua docs"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: docs-lua
path: ${{ env.CI_ARTIFACTS_DIR }}
- name: "Download build artifacts: cs docs"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: docs-cs
path: ${{ env.CI_ARTIFACTS_DIR }}
- name: Extract lua and cs tarballs
run: |
mkdir -p "$CI_DEPLOY_DIR"/{lua,cs}-docs
tar -xzf "$CI_ARTIFACTS_DIR"/lua.tar.gz -C "$CI_DEPLOY_DIR"/lua-docs
tar -xzf "$CI_ARTIFACTS_DIR"/cs.tar.gz -C "$CI_DEPLOY_DIR"/cs-docs
- name: Copy landing page files
run: cp -r "$DOCS_LANDINGPAGE_ROOT"/. "$CI_DEPLOY_DIR"
- name: Deploy
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e #v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.CI_DEPLOY_DIR }}
keep_files: true

33
.github/workflows/update-moonsharp.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Update MoonSharp
on:
workflow_dispatch:
env:
SUBMODULE_PATH: Libraries/moonsharp
GIT_USER_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GIT_USER_NAME: "github-actions[bot]"
jobs:
update-moonsharp:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- name: Update submodule
run: git submodule update --recursive --remote "$SUBMODULE_PATH"
- name: Create commit
run: |
git config user.name "$GIT_USER_NAME"
git config user.email "$GIT_USER_EMAIL"
git commit -am "Update submodule: $SUBMODULE_PATH"
- name: Push
run: git push

5
.gitignore vendored
View File

@@ -15,9 +15,11 @@ bld/
[Rr]eleaseMac/
[Dd]ebugLinux/
[Rr]eleaseLinux/
LocalMods/
*.o
*/Barotrauma*/doc/
# Misc vs crap
# Misc vs crap
*.v12.suo
*.suo
*.csproj.user
@@ -58,3 +60,4 @@ Deploy/DeployAll/PrivateKey.*
#Rider
*.DotSettings.user
.vscode/settings.json

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "Libraries/moonsharp"]
path = Libraries/moonsharp
url = https://github.com/evilfactory/moonsharp.git
[submodule "luacs-docs/lua/libs/ldoc"]
path = luacs-docs/lua/libs/ldoc
url = https://github.com/evilfactory/LDoc.git

View File

@@ -29,7 +29,7 @@ namespace Barotrauma
}
}
}
else if (SelectedAiTarget?.Entity != null)
else if (SelectedAiTarget?.Entity != null && AttackLimb != null)
{
Vector2 targetPos = SelectedAiTarget.Entity.DrawPosition;
if (State == AIState.Attack)
@@ -37,15 +37,16 @@ namespace Barotrauma
targetPos = attackWorldPos;
}
targetPos.Y = -targetPos.Y;
GUI.DrawLine(spriteBatch, pos, targetPos, GUIStyle.Red * 0.5f, 0, 4);
Vector2 attackLimbPos = AttackLimb.DrawPosition;
attackLimbPos.Y = -attackLimbPos.Y;
GUI.DrawLine(spriteBatch, attackLimbPos, targetPos, GUIStyle.Red * 0.75f, 0, 4);
if (wallTarget != null && !IsCoolDownRunning)
{
Vector2 wallTargetPos = wallTarget.Position;
if (wallTarget.Structure.Submarine != null) { wallTargetPos += wallTarget.Structure.Submarine.DrawPosition; }
wallTargetPos.Y = -wallTargetPos.Y;
GUI.DrawRectangle(spriteBatch, wallTargetPos - new Vector2(10.0f, 10.0f), new Vector2(20.0f, 20.0f), Color.Orange, false);
GUI.DrawLine(spriteBatch, pos, wallTargetPos, Color.Orange * 0.5f, 0, 5);
GUI.DrawLine(spriteBatch, attackLimbPos, wallTargetPos, Color.Orange * 0.75f, 0, 5);
}
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{SelectedAiTarget.Entity}", GUIStyle.Red, Color.Black);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 40.0f, $"{targetValue.FormatZeroDecimal()} (M: {CurrentTargetMemory?.Priority.FormatZeroDecimal()}, P: {CurrentTargetingParams?.Priority.FormatZeroDecimal()})", GUIStyle.Red, Color.Black);

View File

@@ -23,6 +23,8 @@ namespace Barotrauma
//GUI.DrawString(spriteBatch, pos + textOffset, $"AI TARGET: {SelectedAiTarget.Entity.ToString()}", Color.White, Color.Black);
}
Vector2 spacing = new Vector2(0, GUIStyle.Font.MeasureChar('T').Y);
Vector2 stringDrawPos = pos + textOffset;
GUI.DrawString(spriteBatch, stringDrawPos, Character.Name, Color.White, Color.Black);
@@ -33,14 +35,14 @@ namespace Barotrauma
currentOrders.Sort((x, y) => y.ManualPriority.CompareTo(x.ManualPriority));
for (int i = 0; i < currentOrders.Count; i++)
{
stringDrawPos += new Vector2(0, 20);
stringDrawPos += spacing;
var order = currentOrders[i];
GUI.DrawString(spriteBatch, stringDrawPos, $"ORDER {i + 1}: {order.Objective.DebugTag} ({order.Objective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
}
else if (ObjectiveManager.WaitTimer > 0)
{
stringDrawPos += new Vector2(0, 20);
stringDrawPos += spacing;
GUI.DrawString(spriteBatch, stringDrawPos - textOffset, $"Waiting... {ObjectiveManager.WaitTimer.FormatZeroDecimal()}", Color.White, Color.Black);
}
var currentObjective = ObjectiveManager.CurrentObjective;
@@ -49,19 +51,19 @@ namespace Barotrauma
int offset = currentOrder != null ? 20 + ((ObjectiveManager.CurrentOrders.Count - 1) * 20) : 0;
if (currentOrder == null || currentOrder.Priority <= 0)
{
stringDrawPos += new Vector2(0, 20);
stringDrawPos += spacing;
GUI.DrawString(spriteBatch, stringDrawPos, $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
var subObjective = currentObjective.CurrentSubObjective;
if (subObjective != null)
{
stringDrawPos += new Vector2(0, 20);
stringDrawPos += spacing;
GUI.DrawString(spriteBatch, stringDrawPos, $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
var activeObjective = ObjectiveManager.GetActiveObjective();
if (activeObjective != null)
{
stringDrawPos += new Vector2(0, 20);
stringDrawPos += spacing;
GUI.DrawString(spriteBatch, stringDrawPos, $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
if (currentObjective is AIObjectiveCombat
@@ -85,12 +87,12 @@ namespace Barotrauma
}
}
Vector2 objectiveStringDrawPos = stringDrawPos + new Vector2(120, 40);
Vector2 objectiveStringDrawPos = stringDrawPos + new Vector2(120, spacing.Y * 2);
for (int i = 0; i < ObjectiveManager.Objectives.Count; i++)
{
var objective = ObjectiveManager.Objectives[i];
GUI.DrawString(spriteBatch, objectiveStringDrawPos, $"{objective.DebugTag} ({objective.Priority.FormatZeroDecimal()})", Color.White, Color.Black * 0.5f);
objectiveStringDrawPos += new Vector2(0, 18);
objectiveStringDrawPos += spacing * 0.8f;
}
if (steeringManager is IndoorsSteeringManager pathSteering)

View File

@@ -547,7 +547,7 @@ namespace Barotrauma
}
}
public void Draw(SpriteBatch spriteBatch, Camera cam)
public void Draw(SpriteBatch spriteBatch, Camera cam, bool onlyDrawSeveredLimbs)
{
if (simplePhysicsEnabled) { return; }
@@ -573,8 +573,12 @@ namespace Barotrauma
{
foreach (Limb limb in limbs) { limb.ActiveSprite.Depth += depthOffset; }
}
for (int i = 0; i < limbs.Length; i++)
for (int i = 0; i < inversedLimbDrawOrder.Length; i++)
{
if (onlyDrawSeveredLimbs && !inversedLimbDrawOrder[i].IsSevered)
{
continue;
}
inversedLimbDrawOrder[i].Draw(spriteBatch, cam, color);
}
if (!MathUtils.NearlyEqual(depthOffset, 0.0f))

View File

@@ -938,8 +938,8 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch, Camera cam)
{
if (!Enabled || InvisibleTimer > 0.0f) { return; }
AnimController.Draw(spriteBatch, cam);
if (!Enabled) { return; }
AnimController.Draw(spriteBatch, cam, onlyDrawSeveredLimbs: InvisibleTimer > 0.0f);
}
public void DrawHUD(SpriteBatch spriteBatch, Camera cam, bool drawHealth = true)

View File

@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using Barotrauma.Items.Components;
using System.Linq;
namespace Barotrauma;
@@ -106,12 +107,17 @@ public static class InteractionLabelManager
}
RectangleF textRect = GetLabelRect(interactableInRange, cam);
if (labels.None(l => l.Item == interactableInRange))
var existingLabel = labels.FirstOrDefault(l => l.Item == interactableInRange);
if (existingLabel == null)
{
var labelData = new LabelData(interactableInRange, textRect, RichString.Rich(interactableInRange.Prefab.Name), cam);
labels.Add(labelData);
}
//size of the label doesn't match - can happen when we're using a CJK font which we asynchronously render new symbols for
else if (existingLabel.TextRect.Size != textRect.Size)
{
existingLabel.TextRect = textRect;
}
}
PreventInteractionLabelOverlap(centerPos: character.Position);
@@ -127,7 +133,11 @@ public static class InteractionLabelManager
private static RectangleF GetLabelRect(Item item, Camera cam)
{
// create rectangle for overlap prevention
Vector2 itemTextSizeScreen = GUIStyle.SubHeadingFont.MeasureString(RichString.Rich(item.Prefab.Name).SanitizedValue) * LabelScale;
string nameText = RichString.Rich(item.Prefab.Name).SanitizedValue;
var font = GUIStyle.SubHeadingFont.GetFontForStr(nameText)!;
Vector2 itemTextSizeScreen = font.MeasureString(nameText) * LabelScale;
Vector2 interactablePosScreen = cam.WorldToScreen(item.Position);
RectangleF textRect = new RectangleF(interactablePosScreen.X, interactablePosScreen.Y, itemTextSizeScreen.X, itemTextSizeScreen.Y);
// center the rectangle on the item

View File

@@ -340,10 +340,6 @@ namespace Barotrauma
break;
case "randomcolor":
randomColor = subElement.GetAttributeColorArray("colors", null)?.GetRandomUnsynced();
if (randomColor.HasValue)
{
Params.GetSprite().Color = randomColor.Value;
}
break;
case "lightsource":
LightSource = new LightSource(subElement, GetConditionalTarget())
@@ -631,6 +627,8 @@ namespace Barotrauma
SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition);
}
if (character.InvisibleTimer > 0.0f) { return; }
// spawn damage particles
float damageParticleAmount = damage < 1 ? 0 : Math.Min(damage / 5, 1.0f) * damageMultiplier;
if (damageParticleAmount > 0.001f)
@@ -734,7 +732,8 @@ namespace Barotrauma
if (spriteParams == null || Alpha <= 0) { return; }
float burn = spriteParams.IgnoreTint ? 0 : burnOverLayStrength;
float brightness = Math.Max(1.0f - burn, 0.2f);
Color tintedColor = spriteParams.Color;
Color baseColor = randomColor ?? spriteParams.Color;
Color tintedColor = baseColor;
if (!spriteParams.IgnoreTint)
{
tintedColor = tintedColor.Multiply(ragdoll.RagdollParams.Color);
@@ -752,7 +751,7 @@ namespace Barotrauma
}
}
Color color = new Color(tintedColor.Multiply(brightness), tintedColor.A);
Color colorWithoutTint = new Color(spriteParams.Color.Multiply(brightness), spriteParams.Color.A);
Color colorWithoutTint = new Color(baseColor.Multiply(brightness), baseColor.A);
Color blankColor = new Color(brightness, brightness, brightness, 1);
if (deadTimer > 0)
{

View File

@@ -31,7 +31,7 @@ namespace Barotrauma
GUILayoutGroup connLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.12f), labelList.Content.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
new GUITextBlock(new RectTransform(new Vector2(0.4f, 1f), connLayout.RectTransform), text: conn.Connection.DisplayName, font: GUIStyle.SubHeadingFont);
GUITextBox box = GUI.CreateTextBoxWithPlaceholder(new RectTransform(new Vector2(0.6f, 1f), connLayout.RectTransform), text: found ? labelOverride : string.Empty, conn.Connection.DisplayName.Value);
GUITextBox box = GUI.CreateTextBoxWithPlaceholder(new RectTransform(new Vector2(0.6f, 1f), connLayout.RectTransform), text: found ? labelOverride : string.Empty, conn.Connection.DefaultDisplayName.Value);
box.MaxTextLength = MaxConnectionLabelLength;
textBoxes.Add(conn.Name, box);

View File

@@ -16,6 +16,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using Barotrauma.LuaCs.Events;
using static Barotrauma.FabricationRecipe;
namespace Barotrauma
@@ -3543,6 +3544,11 @@ namespace Barotrauma
ContentPackageManager.RegularPackages.Select(p => p.Name).ToArray()
}));
commands.Add(new Command("ShowServerPerf", "Immediately log server performance info", (string[] args) =>
{
// TODO: Not yet :)
}));
#if WINDOWS
commands.Add(new Command("startdedicatedserver", "", (string[] args) =>
{
@@ -3576,6 +3582,14 @@ namespace Barotrauma
}
}));*/
AssignOnClientExecute(
"ShowServerPerf",
(string[] args) =>
{
GameMain.Client?.SendConsoleCommand("ShowServerPerf");
}
);
AssignOnClientExecute(
"giveperm",
(string[] args) =>
@@ -4213,12 +4227,8 @@ namespace Barotrauma
NewMessage("Minimum main path width: " + (Level.Loaded.LevelData?.MinMainPathWidth?.ToString() ?? "unknown"));
}
});
}
private static void ReloadWearables(Character character, int variant = 0)
{
foreach (var limb in character.AnimController.Limbs)

View File

@@ -277,6 +277,14 @@ namespace Barotrauma
int selectedOption = (userdata as int?) ?? 0;
if (actionInstance != null)
{
var option = actionInstance.Options[selectedOption];
if (GameMain.Client == null && option.ForceSay)
{
Character.Controlled.ForceSay(
option.ForceSayText.IsNullOrEmpty() ? TextManager.Get(option.Text).Fallback(option.Text) : TextManager.Get(option.ForceSayText).Fallback(option.ForceSayText),
option.ForceSayInRadio,
option.ForceSayRemoveQuotes);
}
actionInstance.selectedOption = selectedOption;
DisableButtons(optionButtons, btn);
btn.ExternalHighlight = true;
@@ -340,7 +348,8 @@ namespace Barotrauma
if (speaker?.Info != null && drawChathead)
{
// chathead
new GUICustomComponent(new RectTransform(new Vector2(0.15f, 0.8f), content.RectTransform), onDraw: (sb, customComponent) =>
int chatHeadWidth = (int)(content.RectTransform.Rect.Width * 0.15f);
new GUICustomComponent(new RectTransform(new Point(chatHeadWidth, chatHeadWidth), content.RectTransform, isFixedSize: true), onDraw: (sb, customComponent) =>
{
speaker.Info.DrawIcon(sb, customComponent.Rect.Center.ToVector2(), customComponent.Rect.Size.ToVector2());
});
@@ -382,7 +391,7 @@ namespace Barotrauma
}
textContent.RectTransform.MinSize = new Point(0, textContent.Children.Sum(c => c.Rect.Height + textContent.AbsoluteSpacing) + GUI.IntScale(16));
content.RectTransform.MinSize = new Point(0, content.Children.Sum(c => c.Rect.Height));
content.RectTransform.MinSize = textContent.RectTransform.MinSize;
// Recalculate the text size as it is scaled up and no longer matching the text height due to the textContent's minSize increasing
textBlock.CalculateHeightFromText();

View File

@@ -61,17 +61,9 @@ namespace Barotrauma
{
Item.ReadSpawnData(msg);
}
if (character.Submarine != null && character.AIController is EnemyAIController enemyAi)
if (character.AIController is EnemyAIController enemyAi && character.Submarine is Submarine ownSub)
{
enemyAi.UnattackableSubmarines.Add(character.Submarine);
if (Submarine.MainSub != null)
{
enemyAi.UnattackableSubmarines.Add(Submarine.MainSub);
foreach (Submarine sub in Submarine.MainSub.DockedTo)
{
enemyAi.UnattackableSubmarines.Add(sub);
}
}
enemyAi.SetUnattackableSubmarines(ownSub);
}
}
if (characters.Contains(null))

View File

@@ -0,0 +1,8 @@
#nullable enable
namespace Barotrauma;
internal sealed partial class CustomMission : Mission
{
public override bool DisplayAsCompleted => State == SuccessState;
public override bool DisplayAsFailed => State == FailureState;
}

View File

@@ -14,7 +14,7 @@ namespace Barotrauma
private void TryShowRetrievedMessage()
{
if (DetermineCompleted())
if (DetermineCompleted(CampaignMode.TransitionType.None))
{
HandleMessage(ref allRetrievedMessage);
}

View File

@@ -1,5 +1,6 @@
using Barotrauma.Extensions;
using Barotrauma.Items.Components;
using Barotrauma.LuaCs.Events;
using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using System;
@@ -411,6 +412,13 @@ namespace Barotrauma
public void AddMessage(ChatMessage message)
{
if (GameMain.IsSingleplayer)
{
bool? should = null;
LuaCsSetup.Instance.EventService.PublishEvent<IEventChatMessage>(x => should = x.OnChatMessage(message.Text, message.SenderClient, message.Type, message) ?? should);
if (should != null && should.Value) { return; }
}
while (chatBox.Content.CountChildren > 60)
{
chatBox.RemoveChild(chatBox.Content.Children.First());

View File

@@ -1435,8 +1435,15 @@ namespace Barotrauma
Uri baseAddress = new Uri(url);
Uri remoteDirectory = new Uri(baseAddress, ".");
string remoteFileName = Path.GetFileName(baseAddress.LocalPath);
IRestClient client = new RestClient(remoteDirectory);
var response = client.Execute(new RestRequest(remoteFileName, Method.GET));
var client = RestFactory.CreateClient(remoteDirectory.ToString());
var request = RestFactory.CreateRequest(remoteFileName);
var response = client.Execute(request);
if (response.ErrorException != null)
{
DebugConsole.AddWarning($"Connection error: Failed to load remote sprite from {url} " +
$"({response.ErrorException.Message}).");
return null;
}
if (response.ResponseStatus != ResponseStatus.Completed) { return null; }
if (response.StatusCode != HttpStatusCode.OK) { return null; }

View File

@@ -26,7 +26,9 @@ namespace Barotrauma
public OnSelectedHandler OnDropped;
private readonly GUIButton button;
private readonly GUIButton button;
public GUIButton Button => button;
private readonly GUIImage icon;
private readonly GUIListBox listBox;

View File

@@ -36,6 +36,16 @@ namespace Barotrauma
/// If the event launches, the text should already be up to date!
/// </summary>
public event OnTextChangedHandler OnTextChanged;
public OnTextChangedHandler OnTextChangedDelegate
{
set
{
OnTextChanged += (GUITextBox a, string b) =>
{
return value.Invoke(a, b);
};
}
}
public bool CaretEnabled { get; set; }
public Color? CaretColor { get; set; }

View File

@@ -710,19 +710,24 @@ namespace Barotrauma
if (listBox == pendingList || listBox == crewList)
{
nameBlock.RectTransform.Resize(new Point(nameBlock.Rect.Width - nameBlock.Rect.Height, nameBlock.Rect.Height));
nameBlock.Text = ToolBox.LimitString(characterName, nameBlock.Font, nameBlock.Rect.Width);
nameBlock.RectTransform.Resize(new Point((int)(nameBlock.Padding.X + nameBlock.TextSize.X + nameBlock.Padding.Z), nameBlock.Rect.Height));
Point size = new Point((int)(0.7f * nameBlock.Rect.Height));
new GUIImage(new RectTransform(size, nameGroup.RectTransform), "EditIcon") { CanBeFocused = false };
size = new Point(3 * mainGroup.AbsoluteSpacing + icon.Rect.Width + nameAndJobGroup.Rect.Width, mainGroup.Rect.Height);
new GUIButton(new RectTransform(size, frame.RectTransform) { RelativeOffset = new Vector2(0.025f) }, style: null)
//if the character is already in the crew, only check permissions - reputation doesn't matter for renaming an already-hired bot
bool canRename = listBox == crewList ? HasPermissionToHire : CanHire(characterInfo);
if (canRename)
{
Enabled = CanHire(characterInfo),
ToolTip = TextManager.GetWithVariable("campaigncrew.givenicknametooltip", "[mouseprimary]", PlayerInput.PrimaryMouseLabel),
UserData = characterInfo,
OnClicked = CreateRenamingComponent
};
nameBlock.RectTransform.Resize(new Point(nameBlock.Rect.Width - nameBlock.Rect.Height, nameBlock.Rect.Height));
nameBlock.Text = ToolBox.LimitString(characterName, nameBlock.Font, nameBlock.Rect.Width);
nameBlock.RectTransform.Resize(new Point((int)(nameBlock.Padding.X + nameBlock.TextSize.X + nameBlock.Padding.Z), nameBlock.Rect.Height));
Point iconSize = new Point((int)(0.7f * nameBlock.Rect.Height));
new GUIImage(new RectTransform(iconSize, nameGroup.RectTransform), "EditIcon") { CanBeFocused = false };
Point buttonSize = new Point(3 * mainGroup.AbsoluteSpacing + icon.Rect.Width + nameAndJobGroup.Rect.Width + (int)(iconSize.X * 1.5f), mainGroup.Rect.Height);
new GUIButton(new RectTransform(buttonSize, frame.RectTransform) { RelativeOffset = new Vector2(0.025f) }, style: null)
{
ClampMouseRectToParent = false,
ToolTip = TextManager.GetWithVariable("campaigncrew.givenicknametooltip", "[mouseprimary]", PlayerInput.PrimaryMouseLabel),
UserData = characterInfo,
OnClicked = CreateRenamingComponent
};
}
}
//recalculate everything and truncate texts if needed

View File

@@ -18,6 +18,7 @@ using System.Reflection;
using System.Threading;
using Barotrauma.Extensions;
using System.Collections.Immutable;
using Barotrauma.LuaCs.Events;
namespace Barotrauma
{
@@ -294,6 +295,8 @@ namespace Barotrauma
MainThread = Thread.CurrentThread;
Window.FileDropped += OnFileDropped;
LuaCsSetup.Instance.GetType();
}
public static void ExecuteAfterContentFinishedLoading(Action action)
@@ -1289,6 +1292,18 @@ namespace Barotrauma
{
IsExiting = true;
CreatureMetrics.Save();
try
{
if (LuaCsSetup.Instance is not null)
{
LuaCsSetup.Instance.Dispose();
}
}
catch (Exception e)
{
DebugConsole.ThrowError($"Error while disposing of LuaCsForBarotrauma: {e.Message} | {e.StackTrace}");
}
DebugConsole.NewMessage("Exiting...");
Client?.Quit();
SteamManager.ShutDown();

View File

@@ -487,7 +487,21 @@ namespace Barotrauma.Items.Components
return 0.0f;
}
public virtual bool ShouldDrawHUD(Character character)
public bool ShouldDrawHUD(Character character)
{
if (Character.Controlled?.SelectedItem != null)
{
Controller controller = item.GetComponent<Controller>();
if (controller != null && controller.User == Character.Controlled && controller.HideAllItemComponentHUDs)
{
return false;
}
}
return ShouldDrawHUDComponentSpecific(character);
}
protected virtual bool ShouldDrawHUDComponentSpecific(Character character)
{
return true;
}

View File

@@ -552,9 +552,9 @@ namespace Barotrauma.Items.Components
if (flippedY) { origin.Y = contained.Item.Sprite.SourceRect.Height - origin.Y; }
float containedSpriteDepth = ContainedSpriteDepth < 0.0f ? contained.Item.Sprite.Depth : ContainedSpriteDepth;
if (i < containedSpriteDepths.Length)
if (targetSlotIndex < containedSpriteDepths.Length)
{
containedSpriteDepth = containedSpriteDepths[i];
containedSpriteDepth = containedSpriteDepths[targetSlotIndex];
}
containedSpriteDepth = itemDepth + (containedSpriteDepth - (item.Sprite?.Depth ?? item.SpriteDepth)) / 10000.0f;

View File

@@ -52,10 +52,12 @@ namespace Barotrauma.Items.Components
partial void SetLightSourceTransformProjSpecific()
{
Vector2 offset = Vector2.Zero;
if (LightOffset != Vector2.Zero)
Vector2 offset = LightOffset * item.Scale;
if (offset != Vector2.Zero)
{
offset = Vector2.Transform(LightOffset, Matrix.CreateRotationZ(item.FlippedY ? -item.RotationRad - MathHelper.Pi : -item.RotationRad)) * item.Scale;
if (item.FlippedX) { offset.X *= -1; }
if (item.FlippedY) { offset.Y *= -1; }
offset = Vector2.Transform(offset, Matrix.CreateRotationZ(-item.RotationRad));
}
if (ParentBody != null)
@@ -101,7 +103,10 @@ namespace Barotrauma.Items.Components
if (Light?.LightSprite == null) { return; }
if ((item.body == null || item.body.Enabled) && lightBrightness > 0.0f && IsOn && Light.Enabled)
{
Vector2 offset = Vector2.Transform(LightOffset, Matrix.CreateRotationZ(item.FlippedY ? -item.RotationRad - MathHelper.Pi : -item.RotationRad)) * item.Scale;
Vector2 offset = LightOffset * item.Scale;
if (item.FlippedX) { offset.X *= -1; }
if (item.FlippedY) { offset.Y *= -1; }
offset = Vector2.Transform(offset, Matrix.CreateRotationZ(-item.RotationRad));
Vector2 origin = Light.LightSprite.Origin;
if ((Light.LightSpriteEffect & SpriteEffects.FlipHorizontally) == SpriteEffects.FlipHorizontally) { origin.X = Light.LightSprite.SourceRect.Width - origin.X; }
@@ -114,6 +119,7 @@ namespace Barotrauma.Items.Components
{
color = new Color(lightColor, Light.OverrideLightSpriteAlpha.Value);
}
Light.LightSprite.Draw(spriteBatch,
new Vector2(drawPos.X, -drawPos.Y),
color * lightBrightness,
@@ -128,8 +134,16 @@ namespace Barotrauma.Items.Components
{
if (Light?.LightSprite != null && item.Prefab.CanSpriteFlipX)
{
Light.LightSpriteEffect = Light.LightSpriteEffect == SpriteEffects.None ?
SpriteEffects.FlipHorizontally : SpriteEffects.None;
Light.LightSpriteEffect ^= SpriteEffects.FlipHorizontally;
}
SetLightSourceTransformProjSpecific();
}
public override void FlipY(bool relativeToSub)
{
if (Light?.LightSprite != null && item.Prefab.CanSpriteFlipY)
{
Light.LightSpriteEffect ^= SpriteEffects.FlipVertically;
}
SetLightSourceTransformProjSpecific();
}

View File

@@ -8,6 +8,30 @@ namespace Barotrauma.Items.Components
{
private bool isHUDsHidden;
public void UpdateMsg()
{
if (Character.Controlled == null) { return; }
if (!string.IsNullOrEmpty(KickOutCharacterMsg) &&
SelectingKicksCharacterOut &&
User != null && !User.Removed)
{
DisplayMsg = TextManager.ParseInputTypes(TextManager.Get(KickOutCharacterMsg));
}
else if (!string.IsNullOrEmpty(PutOtherCharacterMsg) &&
AllowPuttingInOtherCharacters &&
CanPutSelectedCharacter(Character.Controlled.SelectedCharacter))
{
DisplayMsg = TextManager.ParseInputTypes(TextManager.Get(PutOtherCharacterMsg));
}
else
{
DisplayMsg = TextManager.ParseInputTypes(TextManager.Get(Msg));
}
CharacterHUD.RecreateHudTextsIfControlling(Character.Controlled);
}
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
base.DrawHUD(spriteBatch, character);
@@ -69,21 +93,33 @@ namespace Barotrauma.Items.Components
ushort userID = msg.ReadUInt16();
if (userID == 0)
{
if (user != null)
if (User != null)
{
IsActive = false;
CancelUsing(user);
user = null;
CancelUsing(User);
User = null;
}
}
else
{
Character newUser = Entity.FindEntityByID(userID) as Character;
if (newUser != user)
if (newUser != User)
{
CancelUsing(user);
CancelUsing(User);
}
user = newUser;
User = newUser;
// If the server assigned a user to this controller but the character is not selecting the item
// on the client-side, force the selection to prevent desync. This is required for force attaching,
// since the character placed into the controller may be unconscious, and in that state
// the server no longer syncs the current SelectedItem to clients.
if (ForceUserToStayAttached &&
user != null &&
!user.IsAnySelectedItem(Item))
{
user.SelectedItem = Item;
}
IsActive = true;
}
}

View File

@@ -434,18 +434,13 @@ namespace Barotrauma.Items.Components
foreach (FabricationRecipe fi in fabricationRecipes.Values)
{
RichString recipeTooltip =
fi.RequiresRecipe ?
RichString.Rich(fi.TargetItem.Description + "\n\n" + $"‖color:{XMLExtensions.ToStringHex(GUIStyle.Red)}‖{TextManager.Get("fabricatorrequiresrecipe")}‖color:end‖") :
RichString.Rich(fi.TargetItem.Description);
var frame = new GUIFrame(new RectTransform(new Point(itemList.Content.Rect.Width, (int)(40 * GUI.yScale)), itemList.Content.RectTransform), style: null)
{
UserData = fi,
HoverColor = Color.Gold * 0.2f,
SelectedColor = Color.Gold * 0.5f,
ToolTip = recipeTooltip
};
SetRecipeTooltip(frame, fi);
var container = new GUILayoutGroup(new RectTransform(Vector2.One, frame.RectTransform),
childAnchor: Anchor.CenterLeft, isHorizontal: true) { RelativeSpacing = 0.02f };
@@ -457,7 +452,7 @@ namespace Barotrauma.Items.Components
itemIcon, scaleToFit: true)
{
Color = itemIcon == fi.TargetItem.Sprite ? fi.TargetItem.SpriteColor : fi.TargetItem.InventoryIconColor,
ToolTip = recipeTooltip
CanBeFocused = false
};
}
@@ -466,7 +461,7 @@ namespace Barotrauma.Items.Components
{
Padding = Vector4.Zero,
AutoScaleVertical = true,
ToolTip = recipeTooltip
CanBeFocused = false
};
new GUITextBlock(new RectTransform(new Vector2(0.85f, 1f), frame.RectTransform, Anchor.BottomRight),
@@ -478,6 +473,20 @@ namespace Barotrauma.Items.Components
}
}
private void SetRecipeTooltip(GUIComponent component, FabricationRecipe recipe)
{
if (!recipe.RequiresRecipe)
{
component.ToolTip = RichString.Rich(recipe.TargetItem.Description);
}
else
{
component.ToolTip = AnyOneHasRecipeForItem(Character.Controlled, recipe.TargetItem) ?
RichString.Rich(recipe.TargetItem.Description + "\n\n" + $"‖color:{XMLExtensions.ToStringHex(GUIStyle.Green)}‖{TextManager.Get("unlockedrecipe.true")}‖color:end‖") :
RichString.Rich(recipe.TargetItem.Description + "\n\n" + $"‖color:{XMLExtensions.ToStringHex(GUIStyle.Red)}‖{TextManager.Get("fabricatorrequiresrecipe")}‖color:end‖");
}
}
private void InitInventoryUIs()
{
if (inputInventoryHolder != null)
@@ -927,16 +936,24 @@ namespace Barotrauma.Items.Components
}
}
if (recipe.RequiresRecipe && recipe.HideIfNoRecipe)
if (recipe.RequiresRecipe)
{
if (Character.Controlled != null)
if (recipe.HideIfNoRecipe)
{
if (!AnyOneHasRecipeForItem(Character.Controlled, recipe.TargetItem))
bool anyOneHasRecipe = AnyOneHasRecipeForItem(Character.Controlled, recipe.TargetItem);
if (Character.Controlled != null)
{
child.Visible = false;
continue;
if (!anyOneHasRecipe)
{
child.Visible = false;
continue;
}
}
}
else
{
SetRecipeTooltip(child, recipe);
}
}
child.Visible =
@@ -1147,7 +1164,16 @@ namespace Barotrauma.Items.Components
var lines = description.WrappedText.Split('\n');
if (lines.Count <= 1) { break; }
string newString = string.Join('\n', lines.Take(lines.Count - 1));
description.Text = newString.Substring(0, newString.Length - 4) + "...";
if (newString.Length > 4)
{
description.Text = newString.Substring(0, newString.Length - 4) + "...";
}
else
{
description.Text = newString + "...";
}
description.CalculateHeightFromText();
description.ToolTip = richDescription;
}

View File

@@ -443,6 +443,7 @@ namespace Barotrauma.Items.Components
var wire = targetItem.GetComponent<Wire>();
if (wire != null && wire.Connections.Any(c => c != null)) { return false; }
if (targetItem.Container is { NonInteractable: true }) { return false; }
if (targetItem.Container?.GetComponent<ItemContainer>() is { DrawInventory: false } or { AllowAccess: false }) { return false; }
if (targetItem.HasTag(Tags.TraitorMissionItem)) { return false; }

View File

@@ -575,6 +575,22 @@ namespace Barotrauma.Items.Components
pos /= c.Resources.Count;
MineralClusters.Add((center: pos, resources: c.Resources));
}
if (GameMain.GameSession != null)
{
foreach (var mission in GameMain.GameSession.Missions)
{
if (mission is MineralMission mineralMission)
{
foreach (var minerals in mineralMission.SpawnedResources)
{
MineralClusters.Add((
center: new Vector2(minerals.Average(m => m.WorldPosition.X), minerals.Average(m => m.WorldPosition.Y)),
resources: minerals));
}
}
}
}
}
else
{
@@ -823,18 +839,20 @@ namespace Barotrauma.Items.Components
if (t.Entity is Character c && !c.IsUnconscious && c.Params.HideInSonar) { continue; }
if (t.SoundRange <= 0.0f || float.IsNaN(t.SoundRange) || float.IsInfinity(t.SoundRange)) { continue; }
float sonarSoundRange = t.SoundRange * t.SoundRangeOnSonarMultiplier;
float distSqr = Vector2.DistanceSquared(t.WorldPosition, transducerCenter);
if (distSqr > t.SoundRange * t.SoundRange * 2) { continue; }
if (distSqr > sonarSoundRange * sonarSoundRange * 2) { continue; }
float dist = (float)Math.Sqrt(distSqr);
if (dist > prevPassivePingRadius * Range && dist <= passivePingRadius * Range && Rand.Int(sonarBlips.Count) < 500)
{
Ping(t.WorldPosition, transducerCenter,
t.SoundRange * DisplayScale, 0, DisplayScale, range,
sonarSoundRange * DisplayScale, 0, DisplayScale, range,
passive: true, pingStrength: 0.5f, needsToBeInSector: t);
if (t.IsWithinSector(transducerCenter))
{
sonarBlips.Add(new SonarBlip(t.WorldPosition, fadeTimer: 1.0f, scale: MathHelper.Clamp(t.SoundRange / 2000, 1.0f, 5.0f)));
sonarBlips.Add(new SonarBlip(t.WorldPosition, fadeTimer: 1.0f, scale: MathHelper.Clamp(sonarSoundRange / 2000, 1.0f, 5.0f)));
}
}
}
@@ -977,7 +995,9 @@ namespace Barotrauma.Items.Components
if (aiTarget.InDetectable) { continue; }
if (aiTarget.SonarLabel.IsNullOrEmpty() || aiTarget.SoundRange <= 0.0f) { continue; }
if (Vector2.DistanceSquared(aiTarget.WorldPosition, transducerCenter) < aiTarget.SoundRange * aiTarget.SoundRange)
float sonarSoundRange = aiTarget.SoundRange * aiTarget.SoundRangeOnSonarMultiplier;
if (Vector2.DistanceSquared(aiTarget.WorldPosition, transducerCenter) < sonarSoundRange * sonarSoundRange)
{
DrawMarker(spriteBatch,
aiTarget.SonarLabel.Value,

View File

@@ -58,7 +58,7 @@ namespace Barotrauma.Items.Components
get { return Vector2.Zero; }
}
public override bool ShouldDrawHUD(Character character)
protected override bool ShouldDrawHUDComponentSpecific(Character character)
{
if (item.IsHidden) { return false; }
if (!HasRequiredItems(character, false) || character.SelectedItem != item) { return false; }

View File

@@ -78,7 +78,7 @@ namespace Barotrauma.Items.Components
}
}
public override bool ShouldDrawHUD(Character character)
protected override bool ShouldDrawHUDComponentSpecific(Character character)
=> character == Character.Controlled && (character.SelectedItem == item || character.SelectedSecondaryItem == item);
public override void UpdateHUDComponentSpecific(Character character, float deltaTime, Camera cam)

View File

@@ -97,7 +97,7 @@ namespace Barotrauma.Items.Components
MoveConnectedWires(amount);
}
public override bool ShouldDrawHUD(Character character)
protected override bool ShouldDrawHUDComponentSpecific(Character character)
{
return character == Character.Controlled && character == user && (character.SelectedItem == item || character.SelectedSecondaryItem == item);
}

View File

@@ -287,20 +287,24 @@ namespace Barotrauma.Items.Components
texts.Add(target.CustomInteractHUDText);
textColors.Add(GUIStyle.Green);
}
if (!target.IsIncapacitated && target.IsPet)
if (equipper?.FocusedCharacter == target)
{
texts.Add(CharacterHUD.GetCachedHudText("PlayHint", InputType.Use));
textColors.Add(GUIStyle.Green);
}
if (equipper?.FocusedCharacter == target && target.CanBeHealedBy(equipper, checkFriendlyTeam: false))
{
texts.Add(CharacterHUD.GetCachedHudText("HealHint", InputType.Health));
textColors.Add(GUIStyle.Green);
}
if (target.CanBeDraggedBy(Character.Controlled))
{
texts.Add(CharacterHUD.GetCachedHudText("GrabHint", InputType.Grab));
textColors.Add(GUIStyle.Green);
if (!target.IsIncapacitated && target.IsPet &&
target.AIController is EnemyAIController enemyAI && enemyAI.PetBehavior.CanPlayWith(Character.Controlled))
{
texts.Add(CharacterHUD.GetCachedHudText("PlayHint", InputType.Use));
textColors.Add(GUIStyle.Green);
}
if (target.CanBeHealedBy(equipper, checkFriendlyTeam: false))
{
texts.Add(CharacterHUD.GetCachedHudText("HealHint", InputType.Health));
textColors.Add(GUIStyle.Green);
}
if (target.CanBeDraggedBy(Character.Controlled))
{
texts.Add(CharacterHUD.GetCachedHudText("GrabHint", InputType.Grab));
textColors.Add(GUIStyle.Green);
}
}
if (target.IsUnconscious)

View File

@@ -1597,7 +1597,8 @@ namespace Barotrauma
{
if (DraggingSlot == null || (!DraggingSlot.MouseOn()))
{
Sprite sprite = DraggingItems.First().Prefab.InventoryIcon ?? DraggingItems.First().Sprite;
Item firstDraggingItem = DraggingItems.First();
Sprite sprite = firstDraggingItem.OverrideInventorySprite ?? firstDraggingItem.Prefab.InventoryIcon ?? firstDraggingItem.Sprite;
int iconSize = (int)(64 * GUI.Scale);
float scale = Math.Min(Math.Min(iconSize / sprite.size.X, iconSize / sprite.size.Y), 1.5f);
@@ -1854,7 +1855,7 @@ namespace Barotrauma
if (item != null && drawItem)
{
Sprite sprite = item.Prefab.InventoryIcon ?? item.Sprite;
Sprite sprite = item.OverrideInventorySprite ?? item.Prefab.InventoryIcon ?? item.Sprite;
float scale = Math.Min(Math.Min((rect.Width - 10) / sprite.size.X, (rect.Height - 10) / sprite.size.Y), 2.0f);
Vector2 itemPos = rect.Center.ToVector2();
if (itemPos.Y > GameMain.GraphicsHeight)

View File

@@ -419,7 +419,7 @@ namespace Barotrauma
if (fadeInBrokenSprite != null)
{
float d = Math.Min(depth + (fadeInBrokenSprite.Sprite.Depth - activeSprite.Depth - 0.000001f), 0.999f);
float d = MathHelper.Clamp(depth + (fadeInBrokenSprite.Sprite.Depth - activeSprite.Depth - 0.000001f), 0.0f, 0.999f);
fadeInBrokenSprite.Sprite.DrawTiled(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y + rect.Height / 2)) + fadeInBrokenSprite.Offset.ToVector2() * Scale, size, color: color * fadeInBrokenSpriteAlpha,
textureScale: Vector2.One * Scale,
depth: d);
@@ -435,7 +435,7 @@ namespace Barotrauma
activeSprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, color, origin, RotationRad, Scale, activeSprite.effects, depth);
if (fadeInBrokenSprite != null)
{
float d = Math.Min(depth + (fadeInBrokenSprite.Sprite.Depth - activeSprite.Depth - 0.000001f), 0.999f);
float d = MathHelper.Clamp(depth + (fadeInBrokenSprite.Sprite.Depth - activeSprite.Depth - 0.000001f), 0.0f, 0.999f);
fadeInBrokenSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + fadeInBrokenSprite.Offset.ToVector2() * Scale, color * fadeInBrokenSpriteAlpha, origin, RotationRad, Scale, activeSprite.effects, d);
}
}
@@ -885,7 +885,12 @@ namespace Barotrauma
Spacing = (int)(25 * GUI.Scale)
};
var itemEditor = new SerializableEntityEditor(listBox.Content.RectTransform, this, inGame, showName: true, titleFont: GUIStyle.LargeFont) { UserData = this };
var itemEditor = new SerializableEntityEditor(listBox.Content.RectTransform, this, inGame, showName: true,
titleFont: GUIStyle.LargeFont,
dimOutDefaultValues: false)
{
UserData = this
};
activeEditors.Add(itemEditor);
itemEditor.Children.First().Color = Color.Black * 0.7f;
if (!inGame)
@@ -1045,7 +1050,12 @@ namespace Barotrauma
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), listBox.Content.RectTransform), style: "HorizontalLine");
var componentEditor = new SerializableEntityEditor(listBox.Content.RectTransform, ic, inGame, showName: !inGame, titleFont: GUIStyle.SubHeadingFont) { UserData = ic };
var componentEditor = new SerializableEntityEditor(listBox.Content.RectTransform, ic, inGame, showName: !inGame,
titleFont: GUIStyle.SubHeadingFont,
dimOutDefaultValues: false)
{
UserData = ic
};
componentEditor.Children.First().Color = Color.Black * 0.7f;
activeEditors.Add(componentEditor);
@@ -1064,7 +1074,12 @@ namespace Barotrauma
requiredItems.Add(relatedItem);
}
}
requiredItems.AddRange(ic.DisabledRequiredItems);
//if we have some actual requirements, no need to keep the empty requirement
//as a "placeholder" for the user to add requirements in the sub editor
if (ic.RequiredItems.None())
{
requiredItems.AddRange(ic.DisabledRequiredItems);
}
foreach (RelatedItem relatedItem in requiredItems)
{
@@ -1626,12 +1641,16 @@ namespace Barotrauma
activeComponents.Clear();
activeComponents.AddRange(components);
foreach (MapEntity entity in linkedTo)
Controller controller = GetComponent<Controller>();
if (controller == null || controller.User != Character.Controlled || !controller.HideAllItemComponentHUDs)
{
if (Prefab.IsLinkAllowed(entity.Prefab) && entity is Item i)
foreach (MapEntity entity in linkedTo)
{
if (!i.DisplaySideBySideWhenLinked) { continue; }
activeComponents.AddRange(i.components);
if (Prefab.IsLinkAllowed(entity.Prefab) && entity is Item i)
{
if (!i.DisplaySideBySideWhenLinked) { continue; }
activeComponents.AddRange(i.components);
}
}
}
@@ -1701,7 +1720,9 @@ namespace Barotrauma
foreach (Character otherCharacter in Character.CharacterList)
{
if (otherCharacter != character &&
otherCharacter.SelectedItem == this)
otherCharacter.SelectedItem == this &&
// Prevent the in use message from being shown if a character is, for example, inside the deconstructor
!otherCharacter.IsAttachedToController())
{
ItemInUseWarning.Visible = true;
if (mergedHUDRect.Width > GameMain.GraphicsWidth / 2) { mergedHUDRect.Inflate(-GameMain.GraphicsWidth / 4, 0); }
@@ -1751,6 +1772,11 @@ namespace Barotrauma
}
}
public void ClearActiveHUDs()
{
activeHUDs.Clear();
}
readonly List<ColoredText> texts = new();
public List<ColoredText> GetHUDTexts(Character character, bool recreateHudTexts = true)
{

View File

@@ -166,6 +166,14 @@ namespace Barotrauma
subElement.GetAttributeBool("fadein", false),
subElement.GetAttributePoint("offset", Point.Zero));
if (brokenSprite.FadeIn && brokenSprite.MaxConditionPercentage <= 0.0f)
{
DebugConsole.AddWarning(
$"Potential error in item {Identifier}: a broken sprite that's set to fade in despite the max condition being 0."+
" The sprite cannot fade in if it's set to only appear when the item is fully broken.",
ContentPackage);
}
int spriteIndex = 0;
for (int i = 0; i < brokenSprites.Count && brokenSprites[i].MaxConditionPercentage < brokenSprite.MaxConditionPercentage; i++)
{

View File

@@ -0,0 +1,33 @@
using Barotrauma.LuaCs.Data;
namespace Barotrauma.LuaCs.Data;
public partial interface IConfigInfo : IConfigDisplayInfo { }
public interface IConfigDisplayInfo
{
/// <summary>
/// Localization Token for display name.
/// </summary>
string DisplayName { get; }
/// <summary>
/// Localization Token for description.
/// </summary>
string Description { get; }
/// <summary>
/// The menu category to display under. Used for filtering.
/// </summary>
string DisplayCategory { get; }
/// <summary>
/// Should this config be displayed in end-user menus.
/// </summary>
bool ShowInMenus { get; }
/// <summary>
/// User-friendly on-hover tooltip text or Localization Token.
/// </summary>
string Tooltip { get; }
/// <summary>
/// Icon for display in menus, if available.
/// </summary>
ContentPath ImageIconPath { get; }
}

View File

@@ -0,0 +1,9 @@
using System;
using Microsoft.Xna.Framework;
namespace Barotrauma.LuaCs.Data;
public interface IDisplayable
{
public void AddDisplayComponent(GUILayoutGroup layoutGroup, Vector2 relativeSize, Action<string> onSerializedValue);
}

View File

@@ -0,0 +1,6 @@
namespace Barotrauma.LuaCs.Data;
public partial interface ISettingBase : IDisplayable
{
}

View File

@@ -0,0 +1,11 @@
using System;
namespace Barotrauma.LuaCs.Data;
public interface ISettingControl : ISettingBase
{
KeyOrMouse Value { get; }
bool TrySetValue(KeyOrMouse value);
bool IsDown();
bool IsHit();
}

View File

@@ -0,0 +1,252 @@
using System;
using System.Globalization;
using System.Linq;
using System.Xml.Linq;
using Barotrauma.LuaCs.Data;
using Microsoft.Toolkit.Diagnostics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using OneOf;
namespace Barotrauma.LuaCs.Data;
public sealed class SettingControl : SettingBase, ISettingControl
{
public class Factory : ISettingBase.IFactory<ISettingBase>
{
public ISettingBase CreateInstance(IConfigInfo configInfo, Func<OneOf<string, XElement, object>, bool> valueChangePredicate)
{
Guard.IsNotNull(configInfo, nameof(configInfo));
return new SettingControl(configInfo, valueChangePredicate);
}
}
public SettingControl(IConfigInfo configInfo, Func<OneOf<string, XElement, object>, bool> valueChangePredicate) : base(configInfo)
{
_valueChangePredicate = valueChangePredicate;
TrySetSerializedValue(configInfo.Element);
}
protected override void OnDispose()
{
OnValueChanged = null;
}
private Func<OneOf<string, XElement, object>, bool> _valueChangePredicate;
public override Type GetValueType() => typeof(KeyOrMouse);
public override string GetStringValue() => Value.ToString();
public override string GetDefaultStringValue() => new KeyOrMouse(Keys.NumLock).ToString();
public override bool TrySetSerializedValue(OneOf<string, XElement> value)
{
var newVal = value.Match<KeyOrMouse>(
(string v) => GetKeyOrMouse(v),
(XElement e) => e.GetAttributeKeyOrMouse("Value", null));
if (newVal is null)
{
return false;
}
if (_valueChangePredicate is not null && !_valueChangePredicate.Invoke(newVal))
{
return false;
}
Value = newVal;
OnValueChanged?.Invoke(this);
return true;
KeyOrMouse GetKeyOrMouse(string strValue)
{
strValue ??= string.Empty;
if (Enum.TryParse(strValue, true, out Microsoft.Xna.Framework.Input.Keys key))
{
return key;
}
else if (Enum.TryParse(strValue, out MouseButton mouseButton))
{
return mouseButton;
}
else if (int.TryParse(strValue, NumberStyles.Any, CultureInfo.InvariantCulture, out int mouseButtonInt) &&
Enum.GetValues<MouseButton>().Contains((MouseButton)mouseButtonInt))
{
return (MouseButton)mouseButtonInt;
}
else if (string.Equals(strValue, "LeftMouse", StringComparison.OrdinalIgnoreCase))
{
return !PlayerInput.MouseButtonsSwapped() ? MouseButton.PrimaryMouse : MouseButton.SecondaryMouse;
}
else if (string.Equals(strValue, "RightMouse", StringComparison.OrdinalIgnoreCase))
{
return !PlayerInput.MouseButtonsSwapped() ? MouseButton.SecondaryMouse : MouseButton.PrimaryMouse;
}
return null;
}
}
public override event Action<ISettingBase> OnValueChanged;
public override OneOf<string, XElement> GetSerializableValue() => Value.ToString();
public KeyOrMouse Value { get; private set; } = new KeyOrMouse(Keys.NumLock);
public bool TrySetValue(KeyOrMouse value)
{
Value = value;
OnValueChanged?.Invoke(this);
return true;
}
public bool IsDown()
{
if (this.Value is null)
return false;
switch (this.Value.MouseButton)
{
case MouseButton.None:
return Barotrauma.PlayerInput.KeyDown(this.Value.Key);
case MouseButton.PrimaryMouse:
return Barotrauma.PlayerInput.PrimaryMouseButtonHeld();
case MouseButton.SecondaryMouse:
return Barotrauma.PlayerInput.SecondaryMouseButtonHeld();
case MouseButton.MiddleMouse:
return Barotrauma.PlayerInput.MidButtonHeld();
case MouseButton.MouseButton4:
return Barotrauma.PlayerInput.Mouse4ButtonHeld();
case MouseButton.MouseButton5:
return Barotrauma.PlayerInput.Mouse5ButtonHeld();
case MouseButton.MouseWheelUp:
return Barotrauma.PlayerInput.MouseWheelUpClicked();
case MouseButton.MouseWheelDown:
return Barotrauma.PlayerInput.MouseWheelDownClicked();
}
return false;
}
public bool IsHit()
{
if (this.Value is null)
return false;
switch (this.Value.MouseButton)
{
case MouseButton.None:
return Barotrauma.PlayerInput.KeyHit(this.Value.Key);
case MouseButton.PrimaryMouse:
return Barotrauma.PlayerInput.PrimaryMouseButtonClicked();
case MouseButton.SecondaryMouse:
return Barotrauma.PlayerInput.SecondaryMouseButtonClicked();
case MouseButton.MiddleMouse:
return Barotrauma.PlayerInput.MidButtonClicked();
case MouseButton.MouseButton4:
return Barotrauma.PlayerInput.Mouse4ButtonClicked();
case MouseButton.MouseButton5:
return Barotrauma.PlayerInput.Mouse5ButtonClicked();
case MouseButton.MouseWheelUp:
return Barotrauma.PlayerInput.MouseWheelUpClicked();
case MouseButton.MouseWheelDown:
return Barotrauma.PlayerInput.MouseWheelDownClicked();
}
return false;
}
#if CLIENT
private static GUICustomComponent InputListener;
public override void AddDisplayComponent(GUILayoutGroup layoutGroup, Vector2 relativeSize, Action<string> onSerializedValue)
{
var inputButton = new GUIButton(new RectTransform(relativeSize, layoutGroup.RectTransform), Alignment.Center,
style: "GUITextBoxNoIcon")
{
Text = this.Value.ToString(),
OnClicked = (btn, obj) =>
{
if (InputListener is not null)
{
// Another button is active
return true;
}
CoroutineManager.Invoke(() =>
{
CreateListener(btn);
}, 0f); // delay one frame for button inputs
return true;
}
};
inputButton.OutlineColor = Color.PeachPuff;
inputButton.TextColor = Color.White;
void ClearListener()
{
InputListener?.Parent.RemoveChild(InputListener);
InputListener = null;
}
void CreateListener(GUIButton button)
{
ClearListener();
InputListener = new GUICustomComponent(new RectTransform(Vector2.Zero, layoutGroup.RectTransform),
onUpdate: (deltaTime, component) =>
{
var pressedKeys = PlayerInput.GetKeyboardState.GetPressedKeys();
if (pressedKeys?.Any() ?? false)
{
if (pressedKeys.Contains(Keys.Escape))
{
ClearListener();
return;
}
ApplyValue(pressedKeys.First(), button);
return;
}
if (PlayerInput.PrimaryMouseButtonClicked() &&
(GUI.MouseOn == null || !(GUI.MouseOn is GUIButton) || GUI.MouseOn.IsChildOf(layoutGroup)))
{
ApplyValue(MouseButton.PrimaryMouse, button);
return;
}
else if (PlayerInput.SecondaryMouseButtonClicked())
{
ApplyValue(MouseButton.SecondaryMouse, button);
return;
}
else if (PlayerInput.MidButtonClicked())
{
ApplyValue(MouseButton.MiddleMouse, button);
return;
}
else if (PlayerInput.Mouse4ButtonClicked())
{
ApplyValue(MouseButton.MouseButton4, button);
return;
}
else if (PlayerInput.Mouse5ButtonClicked())
{
ApplyValue(MouseButton.MouseButton5, button);
return;
}
else if (PlayerInput.MouseWheelUpClicked())
{
ApplyValue(MouseButton.MouseWheelUp, button);
return;
}
else if (PlayerInput.MouseWheelDownClicked())
{
ApplyValue(MouseButton.MouseWheelDown, button);
return;
}
});
}
void ApplyValue(KeyOrMouse input, GUIButton button)
{
button.Text = input.ToString();
onSerializedValue?.Invoke(input.ToString());
ClearListener();
}
}
#endif
}

View File

@@ -0,0 +1,17 @@
using System.Collections.Immutable;
namespace Barotrauma.LuaCs.Data;
public interface IStylesResourceInfo : IBaseResourceInfo { }
public record StylesResourceInfo : BaseResourceInfo, IStylesResourceInfo { }
public partial interface IModConfigInfo
{
public ImmutableArray<IStylesResourceInfo> Styles { get; }
}
public partial record ModConfigInfo
{
public ImmutableArray<IStylesResourceInfo> Styles { get; init; }
}

View File

@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using Barotrauma.Extensions;
using Microsoft.Xna.Framework;
#nullable enable
namespace Barotrauma.LuaCs;
/// <summary>
/// A collection of helper GUI functions. Mostly ripped from "Barotrauma/ClientSource/Settings/SettingsMenu.cs"
/// </summary>
public static class GUIUtil
{
public static (GUILayoutGroup Left, GUILayoutGroup Right) CreateSidebars(GUIFrame parent, bool split = false)
{
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(Vector2.One, parent.RectTransform), isHorizontal: true);
GUILayoutGroup left = new GUILayoutGroup(new RectTransform((0.4875f, 1.0f), layout.RectTransform), isHorizontal: false);
var centerFrame = new GUIFrame(new RectTransform((0.025f, 1.0f), layout.RectTransform), style: null);
if (split)
{
new GUICustomComponent(new RectTransform(Vector2.One, centerFrame.RectTransform),
onDraw: (sb, c) =>
{
sb.DrawLine((c.Rect.Center.X, c.Rect.Top),
(c.Rect.Center.X, c.Rect.Bottom),
GUIStyle.TextColorDim,
2f);
});
}
GUILayoutGroup right = new GUILayoutGroup(new RectTransform((0.4875f, 1.0f), layout.RectTransform), isHorizontal: false);
return (left, right);
}
public static (GUILayoutGroup Left, GUILayoutGroup Right) CreateSidebars(GUILayoutGroup parent, bool split = false)
{
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(Vector2.One, parent.RectTransform), isHorizontal: true);
GUILayoutGroup left = new GUILayoutGroup(new RectTransform((0.4875f, 1.0f), layout.RectTransform), isHorizontal: false);
var centerFrame = new GUIFrame(new RectTransform((0.025f, 1.0f), layout.RectTransform), style: null);
if (split)
{
new GUICustomComponent(new RectTransform(Vector2.One, centerFrame.RectTransform),
onDraw: (sb, c) =>
{
sb.DrawLine((c.Rect.Center.X, c.Rect.Top),
(c.Rect.Center.X, c.Rect.Bottom),
GUIStyle.TextColorDim,
2f);
});
}
GUILayoutGroup right = new GUILayoutGroup(new RectTransform((0.4875f, 1.0f), layout.RectTransform), isHorizontal: false);
return (left, right);
}
public static GUILayoutGroup CreateCenterLayout(GUIFrame parent)
=> new GUILayoutGroup(new RectTransform((0.5f, 1.0f), parent.RectTransform, Anchor.TopCenter, Pivot.TopCenter)) { ChildAnchor = Anchor.TopCenter };
public static RectTransform NewItemRectT(GUILayoutGroup parent, Vector2 adjustRatio)
=> new RectTransform((1.0f * adjustRatio.X, 0.06f * adjustRatio.Y), parent.RectTransform, Anchor.CenterLeft);
public static void Spacer(GUILayoutGroup parent, Vector2 adjustRatio)
=> new GUIFrame(new RectTransform((1.0f * adjustRatio.X, 0.03f * adjustRatio.Y), parent.RectTransform, Anchor.CenterLeft), style: null);
public static void ClearChildElements(GUIComponent component, bool clearSelfFromParent = false)
{
component.GetAllChildren().ForEachMod(c =>
{
c.Visible = false;
component.RemoveChild(c);
});
if (clearSelfFromParent && component.Parent is not null)
component.Parent.RemoveChild(component);
}
public static GUITextBlock Label(GUILayoutGroup parent, LocalizedString str, GUIFont font, Vector2 adjustRatio)
=> new GUITextBlock(NewItemRectT(parent, adjustRatio), str, font: font);
public static GUIDropDown DropdownEnum<T>(GUILayoutGroup parent, Func<T, LocalizedString> textFunc, Func<T, LocalizedString>? tooltipFunc, T currentValue,
Action<T> setter, Vector2 adjustRatio) where T : Enum
=> Dropdown(parent, textFunc, tooltipFunc, (T[])Enum.GetValues(typeof(T)), currentValue, setter, adjustRatio);
public static GUIDropDown Dropdown<T>(GUILayoutGroup parent, Func<T, LocalizedString> textFunc, Func<T,
LocalizedString>? tooltipFunc, IReadOnlyList<T> values, T currentValue, Action<T> setter, Vector2 adjustRatio, float listBoxScale = 1)
{
var dropdown = new GUIDropDown(NewItemRectT(parent, adjustRatio), listBoxScale: listBoxScale);
values.ForEach(v => dropdown.AddItem(text: textFunc(v), userData: v, toolTip: tooltipFunc?.Invoke(v) ?? null));
int childIndex = values.IndexOf(currentValue);
dropdown.Select(childIndex);
dropdown.ListBox.ForceLayoutRecalculation();
dropdown.ListBox.ScrollToElement(dropdown.ListBox.Content.GetChild(childIndex));
dropdown.OnSelected = (dd, obj) =>
{
setter((T)obj);
return true;
};
return dropdown;
}
public static (GUIScrollBar, GUITextBlock) Slider(GUILayoutGroup parent, Vector2 range, int steps, Func<float,
string> labelFunc, float currentValue, Action<float> setter, LocalizedString? tooltip, Vector2 adjustRatio)
{
var layout = new GUILayoutGroup(new RectTransform(adjustRatio, parent.RectTransform), isHorizontal: true);
var slider = new GUIScrollBar(new RectTransform((0.72f, 1.0f), layout.RectTransform), style: "GUISlider")
{
Range = range,
BarScrollValue = currentValue,
Step = 1.0f / (float)(steps - 1),
BarSize = 1.0f / steps
};
if (tooltip != null)
{
slider.ToolTip = tooltip;
}
var label = new GUITextBlock(new RectTransform((0.28f, 1.0f), layout.RectTransform),
labelFunc(currentValue), wrap: false, textAlignment: Alignment.Center);
slider.OnMoved = (sb, val) =>
{
label.Text = labelFunc(sb.BarScrollValue);
setter(sb.BarScrollValue);
return true;
};
return (slider, label);
}
public static GUITickBox Tickbox(GUILayoutGroup parent, LocalizedString label, LocalizedString tooltip,
bool currentValue, Action<bool> setter, Vector2 adjustRatio)
{
var tickbox = new GUITickBox(NewItemRectT(parent, adjustRatio), label)
{
Selected = currentValue,
ToolTip = tooltip,
OnSelected = (tb) =>
{
setter(tb.Selected);
return true;
}
};
return tickbox;
}
public static string Percentage(float v) => ToolBox.GetFormattedPercentage(v);
public static int Round(float v) => (int)MathF.Round(v);
}

View File

@@ -0,0 +1,14 @@
using System;
using System.IO;
using System.Linq;
namespace Barotrauma
{
static partial class LuaCsInstaller
{
public static void Uninstall()
{
}
}
}

View File

@@ -0,0 +1,50 @@
using Microsoft.Xna.Framework;
namespace Barotrauma
{
partial class LuaCsLogger
{
private static GUIFrame overlayFrame;
private static GUITextBlock textBlock;
private static double showTimer = 0;
private static void CreateOverlay(string message)
{
overlayFrame = new GUIFrame(new RectTransform(new Vector2(0.4f, 0.03f), null), null, new Color(50, 50, 50, 100))
{
CanBeFocused = false
};
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.8f), overlayFrame.RectTransform, Anchor.CenterLeft), false, Anchor.Center)
{
};
textBlock = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), layout.RectTransform), message);
overlayFrame.RectTransform.MinSize = new Point((int)(textBlock.TextSize.X * 1.2), 0);
layout.Recalculate();
}
public static void AddToGUIUpdateList()
{
if (overlayFrame != null && Timing.TotalTime <= showTimer)
{
overlayFrame.AddToGUIUpdateList();
}
}
public static void ShowErrorOverlay(string message, float time = 5f, float duration = 1.5f)
{
if (Timing.TotalTime <= showTimer)
{
return;
}
CreateOverlay(message);
overlayFrame.Flash(Color.Red, duration, true);
showTimer = Timing.TotalTime + time;
}
}
}

View File

@@ -0,0 +1,184 @@
using Barotrauma.CharacterEditor;
using Barotrauma.Extensions;
using Barotrauma.LuaCs;
using Barotrauma.LuaCs.Data;
using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text;
using static System.Collections.Specialized.BitVector32;
// ReSharper disable ObjectCreationAsStatement
namespace Barotrauma
{
partial class LuaCsSetup
{
public void PromptCSharpMods(Action<bool> onSelection, bool joiningServer)
{
ImmutableArray<ContentPackage> contentPackages = PackageManagementService.GetLoadedUnrestrictedPackages()
.Where(p => p.Name != PackageName)
.ToImmutableArray();
if (_csRunPolicy?.Value is "Enabled")
{
IsCsEnabledForSession = true;
onSelection(true);
return;
}
else if (_csRunPolicy?.Value is "Disabled")
{
IsCsEnabledForSession = false;
onSelection(false);
return;
}
if (contentPackages.None())
{
onSelection(true);
return;
}
GUIMessageBox messageBox = new GUIMessageBox(
TextManager.Get("warning"),
relativeSize: new Vector2(0.3f, 0.55f),
minSize: new Point(400, 500),
text: string.Empty,
buttons: []);
GUILayoutGroup msgBoxLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.75f), messageBox.Content.RectTransform), isHorizontal: false, childAnchor: Anchor.TopCenter)
{
RelativeSpacing = 0.01f,
Stretch = true
};
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), msgBoxLayout.RectTransform), "The following mods contain CSharp code OR Unsandboxed Lua Code",
font: GUIStyle.SubHeadingFont, wrap: true, textAlignment: Alignment.Center);
GUIListBox packageListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.4f), msgBoxLayout.RectTransform))
{
CurrentSelectMode = GUIListBox.SelectMode.None
};
foreach (ContentPackage package in contentPackages)
{
GUIFrame packageFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.15f), packageListBox.Content.RectTransform), style: "ListBoxElement");
GUILayoutGroup packageLayout = new GUILayoutGroup(new RectTransform(Vector2.One, packageFrame.RectTransform), true, Anchor.CenterLeft);
new GUITextBlock(new RectTransform(new Vector2(0.7f, 1f), packageLayout.RectTransform), package.Name);
new GUIButton(new RectTransform(new Vector2(0.3f, 1f), packageLayout.RectTransform, Anchor.CenterRight), "Open Folder", style: "GUIButtonSmall")
{
OnClicked = (GUIButton button, object obj) =>
{
string directory = package.Dir;
if (string.IsNullOrEmpty(directory)) { return false; }
ToolBox.OpenFileWithShell(directory);
return true;
}
};
}
string bodyText =
joiningServer ?
"You are joining a server that includes mods with C# code OR unrestricted Lua code. These mods are not sandboxed and may access your computer without restrictions. If you trust these mods, select 'Enable C# for this session'. Otherwise, select 'Cancel' to run only Lua mods."
: "You have enabled mods that include C# code. These mods are not sandboxed and may access your computer without restrictions. If you trust these mods, select 'Enable C# for this session'. Otherwise, select 'Cancel' to run only Sandboxed Lua mods.";
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0f), msgBoxLayout.RectTransform), bodyText, wrap: true)
{
Wrap = true
};
GUILayoutGroup buttonLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.25f), messageBox.Content.RectTransform, Anchor.BottomCenter), isHorizontal: false, childAnchor: Anchor.TopCenter);
new GUIButton(new RectTransform(new Vector2(0.8f, 0.0f), buttonLayout.RectTransform), "Enable C# for this session")
{
TextBlock = { AutoScaleHorizontal = true },
OnClicked = (btn, userdata) =>
{
IsCsEnabledForSession = true;
onSelection(true);
messageBox.Close();
return true;
}
};
new GUIButton(new RectTransform(new Vector2(0.8f, 0.0f), buttonLayout.RectTransform), "Cancel")
{
OnClicked = (btn, userdata) =>
{
IsCsEnabledForSession = false;
onSelection(false);
messageBox.Close();
return true;
}
};
}
private void SetupServicesProviderClient(IServicesProvider serviceProvider)
{
serviceProvider.RegisterServiceType<IUIStylesService, UIStylesService>(ServiceLifetime.Singleton);
// supplied via factory
//serviceProvider.RegisterServiceType<IUIStylesCollection, UIStylesCollection>(ServiceLifetime.Transient);
serviceProvider.RegisterServiceType<IParserServiceAsync<ResourceParserInfo, IStylesResourceInfo>, ModConfigFileParserService>(ServiceLifetime.Transient);
serviceProvider.RegisterServiceType<IUIStylesCollection.IFactory, UIStylesCollection.Factory>(ServiceLifetime.Transient);
serviceProvider.RegisterServiceType<ISettingsMenuSystem, SettingsMenuSystem>(ServiceLifetime.Singleton);
}
/// <summary>
/// Handles changes in game states tracked by screen changes.
/// </summary>
/// <param name="screen">The new game screen.</param>
public partial void OnScreenSelected(Screen screen)
{
/*Note: This logic needs to be run after the triggering event so that recursion scenarios (ie. resetting the EventService)
do not occur, so we delay it by one game tick.*/
CoroutineManager.Invoke(() =>
{
switch (screen)
{
// menus and navigation states
case MainMenuScreen:
case ModDownloadScreen:
case ServerListScreen:
SetRunState(RunState.Unloaded);
SetRunState(RunState.LoadedNoExec);
break;
// running lobby or editor states
case CampaignEndScreen:
case CharacterEditorScreen:
case EventEditorScreen:
case GameScreen:
case LevelEditorScreen:
case NetLobbyScreen:
case ParticleEditorScreen:
case RoundSummaryScreen:
case SpriteEditorScreen:
case SubEditorScreen:
case TestScreen: // notes: TestScreen is a Linux edge case editor screen and is deprecated.
if (screen is NetLobbyScreen && CurrentRunState != RunState.Running && GameMain.Client?.ClientPeer is not P2POwnerPeer)
{
PromptCSharpMods(selection =>
{
SetRunState(RunState.Running);
}, joiningServer: true);
}
else
{
SetRunState(RunState.Running);
}
break;
default:
Logger.LogError(
$"{nameof(LuaCsSetup)}: Received an unknown screen {screen?.GetType().Name ?? "'null screen'"}. Retarding load state to 'unloaded'.");
SetRunState(RunState.Unloaded);
break;
}
}, delay: 0f); // min is one tick delay.
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Immutable;
using System.Linq;
using Barotrauma.LuaCs.Data;
namespace Barotrauma.LuaCs;
public sealed partial class ConfigService
{
public ImmutableArray<ISettingBase> GetDisplayableConfigs()
{
using var _ = _operationLock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
return _settingsInstances.Values
.Where(s => !s.IsDisposed)
.Where(s => s.GetDisplayInfo().ShowInMenus)
.Where(s => !GameMain.IsMultiplayer || s.GetConfigInfo().NetSync != NetSync.ServerAuthority)
.Where(s => s.GetConfigInfo().EditableStates >= _infoProvider.CurrentRunState)
.ToImmutableArray();
}
}

View File

@@ -0,0 +1,50 @@
using Microsoft.Xna.Framework;
namespace Barotrauma.LuaCs;
public partial class LoggerService : ILoggerService, IClientLoggerService
{
private GUIFrame _overlayFrame;
private GUITextBlock _textBlock;
private double _showTimer = 0;
private void CreateOverlay(string message)
{
_overlayFrame = new GUIFrame(new RectTransform(new Vector2(0.4f, 0.03f), null), null, new Color(50, 50, 50, 100))
{
CanBeFocused = false
};
GUILayoutGroup layout =
new GUILayoutGroup(
new RectTransform(new Vector2(0.8f, 0.8f), _overlayFrame.RectTransform, Anchor.CenterLeft), false,
Anchor.Center);
_textBlock = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), layout.RectTransform), message);
_overlayFrame.RectTransform.MinSize = new Point((int)(_textBlock.TextSize.X * 1.2), 0);
layout.Recalculate();
}
public void AddToGUIUpdateList()
{
if (_overlayFrame != null && Timing.TotalTime <= _showTimer)
{
_overlayFrame.AddToGUIUpdateList();
}
}
public void ShowErrorOverlay(string message, float time = 5f, float duration = 1.5f)
{
if (Timing.TotalTime <= _showTimer)
{
return;
}
CreateOverlay(message);
_overlayFrame.Flash(Color.Red, duration, true);
_showTimer = Timing.TotalTime + time;
}
}

View File

@@ -0,0 +1,44 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Barotrauma.LuaCs.Data;
using FluentResults;
namespace Barotrauma.LuaCs;
public sealed partial class ModConfigFileParserService :
IParserServiceAsync<ResourceParserInfo, IStylesResourceInfo>
{
async Task<Result<IStylesResourceInfo>> IParserServiceAsync<ResourceParserInfo, IStylesResourceInfo>.TryParseResourceAsync(ResourceParserInfo src)
{
using var lck = await _operationsLock.AcquireReaderLock();
IService.CheckDisposed(this);
if (CheckThrowNullRefs(src, "Style") is { IsFailed: true } fail)
return fail;
var runtimeEnv = GetRuntimeEnvironment(src.Element);
var fileResults = await UnsafeGetCheckedFiles(src.Element, src.Owner, ".xml");
if (fileResults.IsFailed)
return FluentResults.Result.Fail(fileResults.Errors);
return new StylesResourceInfo()
{
SupportedPlatforms = runtimeEnv.Platform,
SupportedTargets = Target.Client, // clientside only
LoadPriority = src.Element.GetAttributeInt("LoadPriority", 0),
FilePaths = fileResults.Value,
Optional = src.Element.GetAttributeBool("Optional", false),
InternalName = src.Element.GetAttributeString("Name", string.Empty),
OwnerPackage = src.Owner,
RequiredPackages = src.Required,
IncompatiblePackages = src.Incompatible
};
}
public async Task<ImmutableArray<Result<IStylesResourceInfo>>> TryParseResourcesAsync(IEnumerable<ResourceParserInfo> sources)
{
return await this.TryParseGenericResourcesAsync<IStylesResourceInfo>(sources);
}
}

View File

@@ -0,0 +1,163 @@
using Barotrauma.LuaCs;
using Barotrauma.LuaCs.Events;
using Barotrauma.Networking;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace Barotrauma.LuaCs;
partial class NetworkingService : INetworkingService, IEventServerConnected, IEventServerRawNetMessageReceived
{
private ConcurrentDictionary<ushort, ConcurrentQueue<IReadMessage>> receiveQueue = new();
public void OnServerConnected()
{
ActivateNetVars();
SendSyncMessage();
}
private void ActivateNetVars()
{
if (GameMain.Client == null)
{
return;
}
// re-activate net vars
// todo: unregister net vars on client disconnect, currently handled by unloading the state machine.
foreach (var networkSyncVar in netVars.Keys)
{
networkSyncVar.SetNetworkOwner(this);
}
}
public bool? OnReceivedServerNetMessage(IReadMessage netMessage, ServerPacketHeader serverPacketHeader)
{
if (serverPacketHeader != ServerHeader)
{
return null;
}
ServerToClient luaCsHeader = (ServerToClient)netMessage.ReadByte();
switch (luaCsHeader)
{
case ServerToClient.NetMessageNetId:
HandleNetMessageString(netMessage);
break;
case ServerToClient.NetMessageInternalId:
HandleNetMessageId(netMessage);
break;
case ServerToClient.ReceiveNetIds:
ReadIds(netMessage);
break;
}
return true;
}
private void SendSyncMessage()
{
if (GameMain.Client == null) { return; }
WriteOnlyMessage message = new WriteOnlyMessage();
message.WriteByte((byte)ClientHeader);
message.WriteByte((byte)ClientToServer.RequestSync);
GameMain.Client.ClientPeer.Send(message, DeliveryMethod.Reliable);
}
public IWriteMessage Start(NetId netId)
{
var message = new WriteOnlyMessage();
message.WriteByte((byte)ClientHeader);
if (idToPacket.ContainsKey(netId))
{
message.WriteByte((byte)ClientToServer.NetMessageInternalId);
message.WriteUInt16(idToPacket[netId]);
}
else
{
message.WriteByte((byte)ClientToServer.NetMessageNetId);
NetId.Write(message, netId);
}
return message;
}
public void SendToServer(IWriteMessage netMessage, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable)
{
GameMain.Client.ClientPeer.Send(netMessage, deliveryMethod);
}
public void Send(IWriteMessage netMessage, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable)
=> SendToServer(netMessage, deliveryMethod);
private void RequestId(NetId netId)
{
if (idToPacket.ContainsKey(netId)) { return; }
if (GameMain.Client == null) { return; }
WriteOnlyMessage message = new WriteOnlyMessage();
message.WriteByte((byte)ClientHeader);
message.WriteByte((byte)ClientToServer.RequestSingleNetId);
NetId.Write(message, netId);
SendToServer(message, DeliveryMethod.Reliable);
}
private void HandleNetMessageId(IReadMessage netMessage, Client client = null)
{
ushort id = netMessage.ReadUInt16();
if (packetToId.ContainsKey(id))
{
HandleNetMessage(netMessage, packetToId[id], client);
}
else
{
if (!receiveQueue.ContainsKey(id)) { receiveQueue[id] = new ConcurrentQueue<IReadMessage>(); }
receiveQueue[id].Enqueue(netMessage);
if (GameSettings.CurrentConfig.VerboseLogging)
{
_loggerService.LogMessage($"Received NetMessage with unknown id {id} from server, storing in queue in case we receive the id later.");
}
}
}
private void ReadIds(IReadMessage netMessage)
{
ushort size = netMessage.ReadUInt16();
for (int i = 0; i < size; i++)
{
ushort packetId = netMessage.ReadUInt16();
NetId netId = NetId.Read(netMessage);
packetToId[packetId] = netId;
idToPacket[netId] = packetId;
if (!receiveQueue.ContainsKey(packetId))
{
continue;
}
// We could have received messages before receiving the sync message, so we need to process them now
while (receiveQueue[packetId].TryDequeue(out var queueMessage))
{
if (netReceives.ContainsKey(netId))
{
netReceives[netId](queueMessage);
}
}
}
}
}

View File

@@ -0,0 +1,239 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using Barotrauma.Extensions;
using Barotrauma.LuaCs.Data;
using FluentResults;
using Microsoft.Toolkit.Diagnostics;
namespace Barotrauma.LuaCs;
public class UIStylesCollection : HashlessFile, IUIStylesCollection
{
public class Factory : IUIStylesCollection.IFactory
{
public IEnumerable<IUIStylesCollection> CreateInstance(IStylesResourceInfo info, IStorageService storageService)
{
Guard.IsNotNull(info, nameof(info));
Guard.IsNotNull(info.OwnerPackage, nameof(info.OwnerPackage));
if (info.FilePaths.IsDefaultOrEmpty)
{
return ImmutableArray<IUIStylesCollection>.Empty;
}
var builder = ImmutableArray.CreateBuilder<IUIStylesCollection>();
foreach (var contentPath in info.FilePaths)
{
builder.Add(new UIStylesCollection(contentPath, storageService));
}
return builder.ToImmutable();
}
public void Dispose()
{
//ignore, stateless service
}
public bool IsDisposed => false;
}
private readonly ConcurrentDictionary<string, GUIFont> _fonts = new();
private readonly ConcurrentDictionary<string, GUISprite> _sprites = new();
private readonly ConcurrentDictionary<string, GUISpriteSheet> _spriteSheets = new();
private readonly ConcurrentDictionary<string, GUICursor> _cursors = new();
private readonly ConcurrentDictionary<string, GUIColor> _colors = new();
/// <summary>
/// Only for internal reference.
/// </summary>
private UIStyleFile _fakeFile;
private IStorageService _storageService;
public UIStylesCollection(ContentPath path, IStorageService storageService) : base(path.ContentPackage, path)
{
Guard.IsNotNull(path, nameof(path));
Guard.IsNotNull(path.ContentPackage, nameof(path.ContentPackage));
_storageService = storageService;
_fakeFile = new UIStyleFile(path.ContentPackage, path);
}
public new ContentPath Path => base.Path;
public Result<GUIFont> GetFont(string name)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
if (_fonts.TryGetValue(name, out var asset))
{
return asset;
}
return FluentResults.Result.Fail($"{nameof(GetFont)}: Failed to find the font with the name '{name}'");
}
public Result<GUISprite> GetSprite(string name)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
if (_sprites.TryGetValue(name, out var asset))
{
return asset;
}
return FluentResults.Result.Fail($"{nameof(GetSprite)}: Failed to find the sprite with the name '{name}'");
}
public Result<GUISpriteSheet> GetSpriteSheet(string name)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
if (_spriteSheets.TryGetValue(name, out var asset))
{
return asset;
}
return FluentResults.Result.Fail($"{nameof(GetSpriteSheet)}: Failed to find the spritesheet with the name '{name}'");
}
public Result<GUICursor> GetCursor(string name)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
if (_cursors.TryGetValue(name, out var asset))
{
return asset;
}
return FluentResults.Result.Fail($"{nameof(GetCursor)}: Failed to find the cursor with the name '{name}'");
}
public Result<GUIColor> GetColor(string name)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
if (_colors.TryGetValue(name, out var asset))
{
return asset;
}
return FluentResults.Result.Fail($"{nameof(GetColor)}: Failed to find the color with the name '{name}'");
}
public override void LoadFile()
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
if (_storageService.LoadPackageXml(Path) is not { IsSuccess: true } result)
{
DebugConsole.LogError($"Failed to load xml from {Path.FullPath}.");
ThrowHelper.ThrowArgumentException($"Failed to load xml from {Path.FullPath}.");
return;
}
var root = result.Value.Root?.FromPackage(Path.ContentPackage);
if (root is null)
{
return;
}
var styleElement = root.Name.LocalName.ToLowerInvariant() == "style" ? root : root.GetChildElement("style");
if (styleElement is null)
return;
var childElements = styleElement.GetChildElements("Font");
if (childElements is not null)
AddToList<GUIFont, GUIFontPrefab>(_fonts, childElements, _fakeFile);
childElements = styleElement.GetChildElements("Sprite");
if (childElements is not null)
AddToList<GUISprite, GUISpritePrefab>(_sprites, childElements, _fakeFile);
childElements = styleElement.GetChildElements("Spritesheet");
if (childElements is not null)
AddToList<GUISpriteSheet, GUISpriteSheetPrefab>(_spriteSheets, childElements, _fakeFile);
childElements = styleElement.GetChildElements("Cursor");
if (childElements is not null)
AddToList<GUICursor, GUICursorPrefab>(_cursors, childElements, _fakeFile);
childElements = styleElement.GetChildElements("Color");
if (childElements is not null)
AddToList<GUIColor, GUIColorPrefab>(_colors, childElements, _fakeFile);
void AddToList<T1, T2>(ConcurrentDictionary<string, T1> dict, IEnumerable<ContentXElement> elem, UIStyleFile file) where T1 : GUISelector<T2> where T2 : GUIPrefab
{
foreach (ContentXElement prefabElement in elem)
{
string name = prefabElement.GetAttributeString("name", string.Empty);
if (name != string.Empty)
{
var prefab = (T2)Activator.CreateInstance(typeof(T2), new object[]{ prefabElement, file })!;
if (!dict.ContainsKey(name))
dict[name] = (T1)Activator.CreateInstance(typeof(T1), new object[] { name })!;
dict[name].Prefabs.Add(prefab, false);
}
}
}
}
public override void UnloadFile()
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
_fonts.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_sprites.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_spriteSheets.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_cursors.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_colors.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
}
public override void Sort()
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
_fonts.Values.ForEach(p => p.Prefabs.Sort());
_sprites.Values.ForEach(p => p.Prefabs.Sort());
_spriteSheets.Values.ForEach(p => p.Prefabs.Sort());
_cursors.Values.ForEach(p => p.Prefabs.Sort());
_colors.Values.ForEach(p => p.Prefabs.Sort());
}
#region INTERNAL_DISPOSE
private readonly AsyncReaderWriterLock _lock = new();
public void Dispose()
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
if (!ModUtils.Threading.CheckIfClearAndSetBool(ref _isDisposed))
{
return;
}
_fonts.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_sprites.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_spriteSheets.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_cursors.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_colors.Values.ForEach(p => p.Prefabs.RemoveByFile(_fakeFile));
_fonts.Clear();
_sprites.Clear();
_spriteSheets.Clear();
_cursors.Clear();
_colors.Clear();
}
private int _isDisposed;
public bool IsDisposed
{
get => ModUtils.Threading.GetBool(ref _isDisposed);
private set => ModUtils.Threading.SetBool(ref _isDisposed, value);
}
#endregion
}

View File

@@ -0,0 +1,350 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Immutable;
using System.Linq;
using Barotrauma.LuaCs.Data;
using FluentResults;
using Microsoft.Toolkit.Diagnostics;
namespace Barotrauma.LuaCs;
public class UIStylesService : IUIStylesService
{
#region DISPOSAL
public void Dispose()
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
if (!ModUtils.Threading.CheckIfClearAndSetBool(ref _isDisposed))
{
return;
}
foreach (var collection in _stylesCollections.Values.SelectMany(c => c))
{
try
{
collection.Dispose();
}
catch
{
//ignored
}
}
_stylesCollections.Clear();
_storageService.Dispose();
_stylesCollectionFactory.Dispose();
_storageService = null;
_stylesCollectionFactory = null;
}
private int _isDisposed = 0;
public bool IsDisposed
{
get => ModUtils.Threading.GetBool(ref _isDisposed);
private set => ModUtils.Threading.SetBool(ref _isDisposed, value);
}
public FluentResults.Result Reset()
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
var result = FluentResults.Result.Ok();
foreach (var collection in _stylesCollections.Values.SelectMany(c => c))
{
try
{
collection.Dispose();
}
catch (Exception e)
{
result.WithError(new ExceptionalError(e));
}
}
_stylesCollections.Clear();
return result;
}
private readonly AsyncReaderWriterLock _lock = new();
#endregion
private IStorageService _storageService;
private IUIStylesCollection.IFactory _stylesCollectionFactory;
private ConcurrentDictionary<(ContentPackage Package, string InternalName), ImmutableArray<IUIStylesCollection>>
_stylesCollections = new();
public UIStylesService(IUIStylesCollection.IFactory stylesCollectionFactory, IStorageService storageService)
{
_stylesCollectionFactory = stylesCollectionFactory;
_storageService = storageService;
}
public Result<GUIColor> GetColor(ContentPackage package, string internalName, string assetName)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
Guard.IsNotNull(package, nameof(package));
Guard.IsNotNullOrWhiteSpace(internalName, nameof(internalName));
Guard.IsNotNullOrWhiteSpace(assetName, nameof(assetName));
if (!_stylesCollections.TryGetValue((package, internalName), out var collection)
|| collection.IsDefaultOrEmpty)
{
return FluentResults.Result.Fail(
$"{nameof(UIStylesService)}: No styles loaded for [ContentPackage].[InternalName] of: [{package.Name}].[{internalName}]");
}
var failedResult = new FluentResults.Result();
foreach (var stylesCollection in collection)
{
var res = stylesCollection.GetColor(assetName);
if (res.IsSuccess)
{
return res;
}
failedResult.WithErrors(res.Errors);
}
return failedResult;
}
public Result<GUICursor> GetCursor(ContentPackage package, string internalName, string assetName)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
Guard.IsNotNull(package, nameof(package));
Guard.IsNotNullOrWhiteSpace(internalName, nameof(internalName));
Guard.IsNotNullOrWhiteSpace(assetName, nameof(assetName));
if (!_stylesCollections.TryGetValue((package, internalName), out var collection)
|| collection.IsDefaultOrEmpty)
{
return FluentResults.Result.Fail(
$"{nameof(UIStylesService)}: No styles loaded for [ContentPackage].[InternalName] of: [{package.Name}].[{internalName}]");
}
var failedResult = new FluentResults.Result();
foreach (var stylesCollection in collection)
{
var res = stylesCollection.GetCursor(assetName);
if (res.IsSuccess)
{
return res;
}
failedResult.WithErrors(res.Errors);
}
return failedResult;
}
public Result<GUIFont> GetFont(ContentPackage package, string internalName, string assetName)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
Guard.IsNotNull(package, nameof(package));
Guard.IsNotNullOrWhiteSpace(internalName, nameof(internalName));
Guard.IsNotNullOrWhiteSpace(assetName, nameof(assetName));
if (!_stylesCollections.TryGetValue((package, internalName), out var collection)
|| collection.IsDefaultOrEmpty)
{
return FluentResults.Result.Fail(
$"{nameof(UIStylesService)}: No styles loaded for [ContentPackage].[InternalName] of: [{package.Name}].[{internalName}]");
}
var failedResult = new FluentResults.Result();
foreach (var stylesCollection in collection)
{
var res = stylesCollection.GetFont(assetName);
if (res.IsSuccess)
{
return res;
}
failedResult.WithErrors(res.Errors);
}
return failedResult;
}
public Result<GUISprite> GetSprite(ContentPackage package, string internalName, string assetName)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
Guard.IsNotNull(package, nameof(package));
Guard.IsNotNullOrWhiteSpace(internalName, nameof(internalName));
Guard.IsNotNullOrWhiteSpace(assetName, nameof(assetName));
if (!_stylesCollections.TryGetValue((package, internalName), out var collection)
|| collection.IsDefaultOrEmpty)
{
return FluentResults.Result.Fail(
$"{nameof(UIStylesService)}: No styles loaded for [ContentPackage].[InternalName] of: [{package.Name}].[{internalName}]");
}
var failedResult = new FluentResults.Result();
foreach (var stylesCollection in collection)
{
var res = stylesCollection.GetSprite(assetName);
if (res.IsSuccess)
{
return res;
}
failedResult.WithErrors(res.Errors);
}
return failedResult;
}
public Result<GUISpriteSheet> GetSpriteSheet(ContentPackage package, string internalName, string assetName)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
Guard.IsNotNull(package, nameof(package));
Guard.IsNotNullOrWhiteSpace(internalName, nameof(internalName));
Guard.IsNotNullOrWhiteSpace(assetName, nameof(assetName));
if (!_stylesCollections.TryGetValue((package, internalName), out var collection)
|| collection.IsDefaultOrEmpty)
{
return FluentResults.Result.Fail(
$"{nameof(UIStylesService)}: No styles loaded for [ContentPackage].[InternalName] of: [{package.Name}].[{internalName}]");
}
var failedResult = new FluentResults.Result();
foreach (var stylesCollection in collection)
{
var res = stylesCollection.GetSpriteSheet(assetName);
if (res.IsSuccess)
{
return res;
}
failedResult.WithErrors(res.Errors);
}
return failedResult;
}
public FluentResults.Result LoadAssets(ImmutableArray<IStylesResourceInfo> resources)
{
using var lck = _lock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
if (resources.IsDefaultOrEmpty)
{
ThrowHelper.ThrowArgumentNullException(nameof(resources));
}
var operationSuccess = FluentResults.Result.Ok();
foreach (var resource in resources)
{
var builder = ImmutableArray.CreateBuilder<IUIStylesCollection>();
if (_stylesCollections.TryGetValue((resource.OwnerPackage, resource.InternalName), out var collection))
{
builder.AddRange(collection);
}
try
{
var newCollections = _stylesCollectionFactory.CreateInstance(resource, _storageService).ToImmutableArray();
foreach (var stylesCollection in newCollections)
{
stylesCollection.LoadFile();
}
builder.AddRange(newCollections);
}
catch (Exception e)
{
operationSuccess.WithError(new ExceptionalError(e));
continue;
}
_stylesCollections[(resource.OwnerPackage, resource.InternalName)] = builder.ToImmutable();
}
return operationSuccess;
}
public FluentResults.Result UnloadPackages(ImmutableArray<ContentPackage> packages)
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
var toRemove = _stylesCollections
.Select(c => c.Key)
.Where(c => packages.Contains(c.Package))
.ToImmutableArray();
var result = FluentResults.Result.Ok();
foreach (var key in toRemove)
{
if (_stylesCollections.TryRemove(key, out var collection) && !collection.IsDefaultOrEmpty)
{
foreach (var stylesCollection in collection)
{
try
{
stylesCollection.UnloadFile();
}
catch (Exception e)
{
result.WithError(new ExceptionalError(e));
}
}
}
}
return result;
}
public FluentResults.Result UnloadPackage(ContentPackage package)
{
// Yes, this is very cursed/inefficient. We don't care.
return UnloadPackages(new [] { package }.ToImmutableArray());
}
public FluentResults.Result UnloadAllPackages()
{
using var lck = _lock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
IService.CheckDisposed(this);
var result = FluentResults.Result.Ok();
foreach (var key in _stylesCollections.Keys.ToImmutableArray())
{
if (_stylesCollections.TryRemove(key, out var collection) && !collection.IsDefaultOrEmpty)
{
foreach (var stylesCollection in collection)
{
try
{
stylesCollection.UnloadFile();
}
catch (Exception e)
{
result.WithError(new ExceptionalError(e));
}
}
}
}
return result;
}
}

View File

@@ -0,0 +1,7 @@
namespace Barotrauma.LuaCs;
public interface IClientLoggerService : IReusableService
{
void AddToGUIUpdateList();
void ShowErrorOverlay(string message, float time = 5f, float duration = 1.5f);
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Barotrauma.LuaCs.Data;
using Barotrauma.LuaCs;
using Barotrauma.Networking;
namespace Barotrauma.LuaCs;
public partial interface IConfigService
{
ImmutableArray<ISettingBase> GetDisplayableConfigs();
}

View File

@@ -0,0 +1,6 @@
namespace Barotrauma.LuaCs;
public interface ISettingsMenuSystem : ISystem
{
}

View File

@@ -0,0 +1,75 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Barotrauma.LuaCs.Data;
using FluentResults;
namespace Barotrauma.LuaCs;
public interface IUIStylesCollection : IService
{
public interface IFactory : IService
{
/// <summary>
/// Returns a new <see cref="IUIStylesCollection"/> for-each <see cref="ContentPath"/> in the given
/// <see cref="IStylesResourceInfo.FilePaths"/> or empty is none.
/// </summary>
/// <param name="info"></param>
/// <param name="storageService"></param>
/// <returns></returns>
IEnumerable<IUIStylesCollection> CreateInstance(IStylesResourceInfo info, IStorageService storageService);
}
/// <summary>
/// The assigned/target <see cref="ContentPath"/> for this collection.
/// </summary>
public ContentPath Path { get; }
/// <summary>
/// Gets the <see cref="GUIFont"/> with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public Result<GUIFont> GetFont(string name);
/// <summary>
/// Gets the <see cref="GUISprite"/> with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public Result<GUISprite> GetSprite(string name);
/// <summary>
/// Gets the <see cref="GUISpriteSheet"/> with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public Result<GUISpriteSheet> GetSpriteSheet(string name);
/// <summary>
/// Gets the <see cref="GUICursor"/> with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public Result<GUICursor> GetCursor(string name);
/// <summary>
/// Gets the <see cref="GUIColor"/> with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public Result<GUIColor> GetColor(string name);
#region BAROTRAUMA.UISTYLEFILE
/// <summary>
/// Definition of <see cref="HashlessFile.LoadFile"/>
/// </summary>
internal void LoadFile();
/// <summary>
/// Definition of <see cref="HashlessFile.UnloadFile"/>
/// </summary>
internal void UnloadFile();
/// <summary>
/// Definition of <see cref="HashlessFile.Sort"/>
/// </summary>
internal void Sort();
#endregion
}

View File

@@ -0,0 +1,57 @@
using System.Collections.Immutable;
using Barotrauma.LuaCs.Data;
using FluentResults;
namespace Barotrauma.LuaCs;
public interface IUIStylesService : IReusableService
{
/// <summary>
/// Gets the first loaded <see cref="GUIColor"/>.
/// </summary>
/// <param name="package">The target <see cref="ContentPackage"/></param>
/// <param name="internalName">The targets <see cref="IDataInfo.InternalName"/> as specified in the ModConfig.xml.</param>
/// <param name="assetName">The asset's name as specified in the styles XML file.</param>
/// <returns>A <see cref="FluentResults.Result"/> indicating success, and the target if succeeded.</returns>
public Result<GUIColor> GetColor(ContentPackage package, string internalName, string assetName);
/// <summary>
/// Gets the loaded <see cref="GUICursor"/>.
/// </summary>
/// <param name="package">The target <see cref="ContentPackage"/></param>
/// <param name="internalName">The targets <see cref="IDataInfo.InternalName"/> as specified in the ModConfig.xml.</param>
/// <param name="assetName">The asset's name as specified in the styles XML file.</param>
/// <returns>A <see cref="FluentResults.Result"/> indicating success, and the target if succeeded.</returns>
public Result<GUICursor> GetCursor(ContentPackage package, string internalName, string assetName);
/// <summary>
/// Gets the loaded <see cref="GUIFont"/>.
/// </summary>
/// <param name="package">The target <see cref="ContentPackage"/></param>
/// <param name="internalName">The targets <see cref="IDataInfo.InternalName"/> as specified in the ModConfig.xml.</param>
/// <param name="assetName">The asset's name as specified in the styles XML file.</param>
/// <returns>A <see cref="FluentResults.Result"/> indicating success, and the target if succeeded.</returns>
public Result<GUIFont> GetFont(ContentPackage package, string internalName, string assetName);
/// <summary>
/// Gets the loaded <see cref="GUISprite"/>.
/// </summary>
/// <param name="package">The target <see cref="ContentPackage"/></param>
/// <param name="internalName">The targets <see cref="IDataInfo.InternalName"/> as specified in the ModConfig.xml.</param>
/// <param name="assetName">The asset's name as specified in the styles XML file.</param>
/// <returns>A <see cref="FluentResults.Result"/> indicating success, and the target if succeeded.</returns>
public Result<GUISprite> GetSprite(ContentPackage package, string internalName, string assetName);
/// <summary>
/// Gets the loaded <see cref="GUISpriteSheet"/>.
/// </summary>
/// <param name="package">The target <see cref="ContentPackage"/></param>
/// <param name="internalName">The targets <see cref="IDataInfo.InternalName"/> as specified in the ModConfig.xml.</param>
/// <param name="assetName">The asset's name as specified in the styles XML file.</param>
/// <returns>A <see cref="FluentResults.Result"/> indicating success, and the target if succeeded.</returns>
public Result<GUISpriteSheet> GetSpriteSheet(ContentPackage package, string internalName, string assetName);
public FluentResults.Result LoadAssets(ImmutableArray<IStylesResourceInfo> resources);
public FluentResults.Result UnloadPackages(ImmutableArray<ContentPackage> packages);
public FluentResults.Result UnloadPackage(ContentPackage package);
public FluentResults.Result UnloadAllPackages();
}

View File

@@ -0,0 +1,22 @@
namespace Barotrauma.LuaCs;
internal sealed class ModsControlsSettingsMenu : ModsSettingsMenuBase
{
public ModsControlsSettingsMenu(GUIFrame contentFrame,
IPackageManagementService packageManagementService,
IConfigService configService,
SettingsMenu settingsMenuInstance) : base(contentFrame, packageManagementService, configService, settingsMenuInstance)
{
}
protected override void DisposeInternal()
{
// TODO: Finish this later.
}
public override void ApplyInstalledModChanges()
{
// TODO: Finish this later.
}
}

View File

@@ -0,0 +1,458 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.Xna.Framework;
using System.Linq;
using System.Numerics;
using Barotrauma.LuaCs.Data;
using Vector2 = Microsoft.Xna.Framework.Vector2;
using Vector4 = Microsoft.Xna.Framework.Vector4;
// ReSharper disable ObjectCreationAsStatement
namespace Barotrauma.LuaCs;
internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase
{
private ImmutableArray<ISettingBase> _settingsInstancesGameplay;
// menu vars
private GUILayoutGroup _modCategoryDisplayGroup, _settingsDisplayGroup;
private string _selectedSearchQuery = string.Empty;
private ContentPackage _selectedContentPackage;
private string _selectedCategory = string.Empty;
private ImmutableArray<ISettingBase> _currentlyDisplayedSettings;
private ILoggerService _loggerService;
private bool _promptOpen = false;
// Note: "static" instead of "const" for Hot Reload and to allow changing at runtime.
// ReSharper disable FieldCanBeMadeReadOnly.Local
// --- UI controls ---
private static float MenuTitleHeight = 0.06f; // (ContentDisplayAreaHeightContainer + MenuTitleHeight) < 1f
private static float ContentDisplayAreaHeightContainer = 0.93f;
private static float ContentDisplayAreaHeightInnerCategories = 0.99f;
private static float ContentDisplayAreaHeightInnerSettings = 0.97f;
private static float ContentLeftRightSplitPosition = 0.3f;
// Search Bar
private static float SearchBarLayoutHeight = 0.06f;
private static float SearchBarLabelWidth = 0.1f;
private static float SearchBarLabelBoxSpacing = 0.05f;
private static float SearchBarTextBoxWidth = 1f - SearchBarLabelWidth - SearchBarLabelBoxSpacing;
// Categories, Packages Display Area
private static float CategoriesDisplayListHeight = 0.945f;
private static float CategoryButtonHeightRelative = 0.122f;
private static float PackageSelectionButtonHeight = 0.07f;
private static Color CategoryButtonHoverSelectColor = new Color(50, 50, 50, 255);
private static Color CategoryButtonTextColor = Color.PeachPuff;
private static Color CategoryButtonTextColorSelected = Color.White;
private static Color CategoryButtonColorPressed = Color.TransparentBlack;
// Settings Display Area
private static float SettingLabelWidth = 0.6f;
private static float SettingControlWidth = 0.4f;
private static float SettingHeight = 0.05625f/ContentDisplayAreaHeightContainer/ContentDisplayAreaHeightInnerSettings;
private static Color SettingEntryLabelTextColor = Color.PeachPuff;
private static string SettingGUIFrameStyle = "";
private static Color? SettingGUIFrameColor = null;
// settings reset
private static Vector2 SettingsResetButtonTopSpacer = new Vector2(0f, 0.02f);
private static Vector2 SettingsResetButtonDimensions = new Vector2(0.3f, 0.05f);
private static string SettingsResetButtonStyle = "GUIButtonSmall";
private static Color SettingsResetButtonColor = Color.DarkOliveGreen;
private static Color SettingsResetButtonHoverColor = Color.Olive;
private static Color SettingsResetButtonTextColor = Color.PeachPuff;
private static Color SettingsResetButtonTextColorSelected = Color.White;
private static Vector2 ResetConfirmationPromptDimensions = new Vector2(0.15f, 0.2f);
// ReSharper restore FieldCanBeMadeReadOnly.Local
private const string SettingsResetButtonText = "LuaCsForBarotrauma.SettingsMenu.ResetVisibleSettings";
private const string SettingsResetPromptTitle = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Title";
private const string SettingsResetPromptContents = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Message";
private const string SettingsResetPromptYesText = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Yes";
private const string SettingsResetPromptNoText = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.No";
private event Action OnApplyInstalledModsChanges;
public ModsGameplaySettingsMenu(GUIFrame contentFrame,
IPackageManagementService packageManagementService,
IConfigService configService,
ILoggerService loggerService,
SettingsMenu settingsMenuInstance) : base(contentFrame, packageManagementService, configService, settingsMenuInstance)
{
_settingsInstancesGameplay = configService.GetDisplayableConfigs()
.ToImmutableArray();
_loggerService = loggerService;
var mainLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 1f), contentFrame.RectTransform, Anchor.Center), false, Anchor.TopLeft);
// page title
var menuTitleLayoutGroup = new GUILayoutGroup(
new RectTransform(new Vector2(1f, MenuTitleHeight), mainLayoutGroup.RectTransform, Anchor.TopLeft), true, Anchor.TopLeft);
GUIUtil.Label(menuTitleLayoutGroup,
GetLocalizedString("LuaCsForBarotrauma.SettingsMenu.ModGameplayButton", "Mod Gameplay Settings"),
GUIStyle.LargeFont, new Vector2(1f, 1f));
// page contents
var contentAreaLayoutGroup = new GUILayoutGroup(
new RectTransform(new Vector2(1f, 0.94f), mainLayoutGroup.RectTransform, Anchor.BottomLeft), false,
Anchor.TopLeft);
var searchBarLayoutGroup = new GUILayoutGroup(
new RectTransform(new Vector2(1f, SearchBarLayoutHeight), contentAreaLayoutGroup.RectTransform, Anchor.TopCenter), true, Anchor.CenterLeft);
GUIUtil.Label(searchBarLayoutGroup, "Search: ", GUIStyle.SubHeadingFont, new Vector2(SearchBarLabelWidth, 1f));
var searchBar = new GUITextBox(
new RectTransform(new Vector2(SearchBarTextBoxWidth, 0.1f), searchBarLayoutGroup.RectTransform, Anchor.TopLeft),
createClearButton: true)
{
OnTextChangedDelegate = (btn, txt) =>
{
GenerateDisplayFromFilter(txt);
return true;
}
};
// main display area
var settingsContentAreaGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, ContentDisplayAreaHeightContainer), contentAreaLayoutGroup.RectTransform, Anchor.BottomCenter));
GUIUtil.Spacer(settingsContentAreaGroup, Vector2.One);
(_modCategoryDisplayGroup, _settingsDisplayGroup) = GUIUtil.CreateSidebars(settingsContentAreaGroup, true);
_modCategoryDisplayGroup.RectTransform.RelativeSize = new Vector2(ContentLeftRightSplitPosition, ContentDisplayAreaHeightInnerCategories);
_settingsDisplayGroup.RectTransform.RelativeSize = new Vector2(1f-ContentLeftRightSplitPosition, ContentDisplayAreaHeightInnerSettings);
// default category
_selectedCategory = "All";
OnApplyInstalledModsChanges = () =>
{
_settingsInstancesGameplay = configService.GetDisplayableConfigs()
.ToImmutableArray();
if (_selectedContentPackage is not null && !GetTargetPackagesList().Contains(_selectedContentPackage))
{
_selectedContentPackage = null;
_selectedCategory = string.Empty;
}
GenerateCategoryListDisplay(_modCategoryDisplayGroup, GetTargetPackagesList(), GetDisplayCategoriesList());
GenerateSettingsListDisplay(_settingsDisplayGroup, GetDisplaySettingsList());
};
GenerateCategoryListDisplay(_modCategoryDisplayGroup, GetTargetPackagesList(), GetDisplayCategoriesList());
GenerateSettingsListDisplay(_settingsDisplayGroup, GetDisplaySettingsList());
void GenerateDisplayFromFilter(string text)
{
_selectedSearchQuery = text;
GenerateCategoryListDisplay(_modCategoryDisplayGroup, GetTargetPackagesList(), GetDisplayCategoriesList());
GenerateSettingsListDisplay(_settingsDisplayGroup, GetDisplaySettingsList());
}
string GetLocalizedString(string identifier, string defaultValue)
{
var lstr = TextManager.Get(identifier);
return lstr.IsNullOrWhiteSpace() ? defaultValue : lstr.Value;
}
// Filters by selected package and query text
ImmutableArray<string> GetDisplayCategoriesList()
{
return GetFilteredSettingsList()
.Select(s => GetLocalizedString(s.GetDisplayInfo().DisplayCategory, "General"))
.Concat(new []{ "All" })
.Distinct()
.OrderBy(s => s)
.ToImmutableArray();
}
// Filters by query text
ImmutableArray<ContentPackage> GetTargetPackagesList()
{
return _settingsInstancesGameplay
.Where(s => SettingMatchesQuery(s, _selectedSearchQuery))
.Select(s => s.OwnerPackage)
.Concat(new[] { ContentPackageManager.VanillaCorePackage })
.Distinct()
.OrderByDescending(p => p == ContentPackageManager.VanillaCorePackage ? 0 : 1)
.ThenBy(p => p.Name)
.ToImmutableArray();
}
// Filters by selected package, query text, and selected category.
ImmutableArray<ISettingBase> GetDisplaySettingsList()
{
return GetFilteredSettingsList()
.Where(s => _selectedCategory.IsNullOrWhiteSpace()
|| _selectedCategory == "All"
|| GetLocalizedString(s.GetDisplayInfo().DisplayCategory, "General") == _selectedCategory)
.OrderBy(s => GetLocalizedString(s.GetDisplayInfo().DisplayName, s.InternalName))
.ToImmutableArray();
}
// Filters by selected package and by query text.
ImmutableArray<ISettingBase> GetFilteredSettingsList()
{
return _settingsInstancesGameplay
.Where(s => SettingMatchesQuery(s, _selectedSearchQuery))
.Where(s => _selectedContentPackage is null
|| _selectedContentPackage == ContentPackageManager.VanillaCorePackage // vanilla is treated as all packages
|| s.OwnerPackage == _selectedContentPackage)
.OrderBy(s => GetLocalizedString(s.GetDisplayInfo().DisplayName, s.InternalName))
.ToImmutableArray();
}
bool SettingMatchesQuery(ISettingBase setting, string queryText)
{
if (queryText.IsNullOrWhiteSpace())
{
return true;
}
queryText = queryText.ToLowerInvariant().Trim();
if (setting.InternalName.ToLowerInvariant().Trim().Contains(queryText) || setting.OwnerPackage.Name.ToLowerInvariant().Trim().Contains(queryText))
{
return true;
}
var displayInfo = setting.GetDisplayInfo();
return TextManager.Get(displayInfo.DisplayName).Value.ToLowerInvariant().Trim().Contains(queryText)
|| TextManager.Get(displayInfo.DisplayCategory).Value.ToLowerInvariant().Trim().Contains(queryText)
|| TextManager.Get(displayInfo.Description).Value.ToLowerInvariant().Trim().Contains(queryText)
|| TextManager.Get(displayInfo.Tooltip).Value.ToLowerInvariant().Trim().Contains(queryText);
}
string GetPackageName(ContentPackage package)
{
return package is null || package == ContentPackageManager.VanillaCorePackage ? "All" : package.Name;
}
ContentPackage GetCurrentSelectedPackage(ImmutableArray<ContentPackage> packages)
{
if (_selectedContentPackage is null)
{
return ContentPackageManager.VanillaCorePackage;
}
if (packages.Contains(_selectedContentPackage))
{
return _selectedContentPackage;
}
if (packages.Length > 0)
{
_selectedContentPackage = packages[0];
return packages[0];
}
return null;
}
void GenerateCategoryListDisplay(GUILayoutGroup layoutGroup, ImmutableArray<ContentPackage> packagesList,
ImmutableArray<string> categories)
{
layoutGroup.ClearChildren();
var packageSelectionList = GUIUtil.Dropdown<ContentPackage>(layoutGroup, cp => GetPackageName(cp), null,
packagesList, GetCurrentSelectedPackage(packagesList), cp =>
{
_selectedContentPackage = cp;
_selectedCategory = string.Empty;
GenerateCategoryListDisplay(_modCategoryDisplayGroup, GetTargetPackagesList(), GetDisplayCategoriesList());
GenerateSettingsListDisplay(_settingsDisplayGroup, GetDisplaySettingsList());
}, new Vector2(1f, PackageSelectionButtonHeight));
var containerBox = new GUIListBox(new RectTransform(new Vector2(1f, CategoriesDisplayListHeight), layoutGroup.RectTransform));
float sizeY = MathF.Max(categories.Length * CategoryButtonHeightRelative, 1f);
var displayedCategoriesFrame = new GUIFrame(new RectTransform(new Vector2(1f, sizeY), containerBox.Content.RectTransform), style: null, color: Color.Black)
{
CanBeFocused = false
};
var displayCategoriesLayout = new GUILayoutGroup(new RectTransform(Vector2.One, displayedCategoriesFrame.RectTransform));
foreach (var category in categories)
{
var btn = new GUIButton(new RectTransform(new Vector2(1f, CategoryButtonHeightRelative), displayCategoriesLayout.RectTransform),
text: category, color: Color.TransparentBlack)
{
CanBeFocused = true,
CanBeSelected = true,
TextColor = CategoryButtonTextColor,
HoverColor = CategoryButtonHoverSelectColor,
HoverTextColor = CategoryButtonTextColorSelected,
PressedColor = CategoryButtonColorPressed,
SelectedColor = CategoryButtonHoverSelectColor,
SelectedTextColor = CategoryButtonHoverSelectColor,
OnClicked = (btn, obj) =>
{
_selectedCategory = category;
GenerateSettingsListDisplay(_settingsDisplayGroup, GetDisplaySettingsList());
return true;
}
};
}
}
void GenerateSettingsListDisplay(GUILayoutGroup layoutGroup, ImmutableArray<ISettingBase> settings)
{
layoutGroup.ClearChildren();
_currentlyDisplayedSettings = settings;
var containerBox = new GUIListBox(new RectTransform(new Vector2(1f, 1f-SettingsResetButtonDimensions.Y), layoutGroup.RectTransform));
foreach (var setting in settings)
{
var entry = AddSettingToDisplay(
setting,
containerBox.Content.RectTransform,
settingHeight: SettingHeight,
labelSize: new Vector2(SettingLabelWidth, 1f),
controlSize: new Vector2(SettingControlWidth, 1f));
}
var spacer = new GUIFrame(new RectTransform(SettingsResetButtonTopSpacer, layoutGroup.RectTransform),
style: null, color: Color.TransparentBlack);
var resetSettingsButton = new GUIButton(
new RectTransform(SettingsResetButtonDimensions, layoutGroup.RectTransform),
GetLocalizedString(SettingsResetButtonText, "Reset Visible Settings"),
style: SettingsResetButtonStyle)
{
CanBeSelected = true,
CanBeFocused = true,
Color = SettingsResetButtonColor,
HoverColor = SettingsResetButtonHoverColor,
SelectedColor = SettingsResetButtonHoverColor,
SelectedTextColor = SettingsResetButtonTextColorSelected,
TextColor = SettingsResetButtonTextColor,
OnClicked = (btn, obj) =>
{
DisplayResetConfirmationPrompt(settings);
return true;
}
};
}
(GUIFrame entryFrame, GUILayoutGroup entryLayoutGroup)
AddSettingToDisplay(ISettingBase setting, RectTransform parent, float settingHeight, Vector2 labelSize, Vector2 controlSize)
{
GUIFrame entryFrame = new GUIFrame(new RectTransform(new Vector2(1f, settingHeight), parent),
style: SettingGUIFrameStyle, color: SettingGUIFrameColor)
{
Color = Color.DarkGray
};
GUILayoutGroup entryLayoutGroup = new GUILayoutGroup(new RectTransform(Vector2.One, entryFrame.RectTransform), isHorizontal: true);
// padding
new GUIFrame(new RectTransform(new Vector2(0.02f, 1f), entryLayoutGroup.RectTransform),
color: Color.TransparentBlack);
// setting label
new GUITextBlock(new RectTransform(labelSize - new Vector2(0.05f, 0f), entryLayoutGroup.RectTransform),
GetLocalizedString(setting.GetDisplayInfo().DisplayName, setting.GetDisplayInfo().DisplayName),
textColor: SettingEntryLabelTextColor,
font: GUIStyle.SmallFont,
textAlignment: Alignment.Left)
{
ToolTip = GetLocalizedString(setting.GetDisplayInfo().Tooltip, string.Empty)
};
setting.AddDisplayComponent(entryLayoutGroup, controlSize, newValue =>
{
NewValuesCache[setting] = newValue;
});
return (entryFrame, entryLayoutGroup);
}
void DisplayResetConfirmationPrompt(ImmutableArray<ISettingBase> settings)
{
if (_promptOpen)
{
return;
}
_promptOpen = true;
var msgBox = new GUIMessageBox(GetLocalizedString(SettingsResetPromptTitle, "Reset Visible Settings"),
GetLocalizedString(SettingsResetPromptContents,
"Are you sure you want to reset the values for currently displayed settings?"),
new LocalizedString[]
{
GetLocalizedString(SettingsResetPromptYesText, "Yes"),
GetLocalizedString(SettingsResetPromptNoText, "No")
}, ResetConfirmationPromptDimensions);
msgBox.Buttons[0].OnClicked = (btn, obj) =>
{
ResetValuesForDisplayedSettings(settings);
btn.Visible = false;
_promptOpen = false;
msgBox.Close();
return true;
};
msgBox.Buttons[1].OnClicked = (btn, obj) =>
{
btn.Visible = false;
_promptOpen = false;
msgBox.Close();
return true;
};
}
void ResetValuesForDisplayedSettings(ImmutableArray<ISettingBase> settings)
{
if (settings.IsDefaultOrEmpty)
{
return;
}
NewValuesCache.Clear();
foreach (var setting in settings)
{
var str = setting.GetDefaultStringValue();
NewValuesCache[setting] = str;
loggerService.LogDebug($"Resetting value for {setting.InternalName} to '{str}'");
}
ApplyInstalledModChanges();
}
}
protected override void DisposeInternal()
{
NewValuesCache.Clear();
_modCategoryDisplayGroup?.Parent.RemoveChild(_modCategoryDisplayGroup);
_settingsDisplayGroup?.Parent.RemoveChild(_settingsDisplayGroup);
_modCategoryDisplayGroup = null;
_settingsDisplayGroup = null;
}
public override void ApplyInstalledModChanges()
{
foreach (var kvp in NewValuesCache)
{
if (kvp.Key.IsDisposed)
{
continue;
}
var success = kvp.Key.TrySetSerializedValue(kvp.Value);
if (success)
{
ConfigService.SaveConfigValue(kvp.Key);
_loggerService.LogDebug($"Applied save value for {kvp.Key.InternalName} of {kvp.Value.ToString()}");
}
}
NewValuesCache.Clear();
OnApplyInstalledModsChanges?.Invoke();
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Concurrent;
using System.Xml.Linq;
using Barotrauma.Extensions;
using Barotrauma.LuaCs.Data;
using Microsoft.Xna.Framework;
using OneOf;
namespace Barotrauma.LuaCs;
internal abstract class ModsSettingsMenuBase : IDisposable
{
public GUIFrame ContentFrame { get; private set; }
protected IPackageManagementService PackageManagementService { get; private set; }
protected IConfigService ConfigService { get; private set; }
protected SettingsMenu SettingsMenuInstance { get; private set; }
protected readonly ConcurrentDictionary<ISettingBase, OneOf<string, XElement>> NewValuesCache = new();
protected ModsSettingsMenuBase(GUIFrame contentFrame,
IPackageManagementService packageManagementService,
IConfigService configService, SettingsMenu settingsMenuInstance)
{
ContentFrame = contentFrame;
PackageManagementService = packageManagementService;
ConfigService = configService;
SettingsMenuInstance = settingsMenuInstance;
}
protected abstract void DisposeInternal();
public abstract void ApplyInstalledModChanges();
public void Dispose()
{
DisposeInternal();
ContentFrame?.Parent.RemoveChild(ContentFrame);
SettingsMenuInstance = null;
ContentFrame = null;
PackageManagementService = null;
ConfigService = null;
NewValuesCache.Clear();
}
}

View File

@@ -0,0 +1,125 @@
using System;
using System.Linq;
using Barotrauma.Extensions;
using HarmonyLib;
using Microsoft.Xna.Framework;
namespace Barotrauma.LuaCs;
public class SettingsMenuSystem : ISettingsMenuSystem
{
private ModsControlsSettingsMenu _controlsMenuInstance;
private ModsGameplaySettingsMenu _gameplayMenuInstance;
private GUIFrame _gameplayContentFrame;
private GUIFrame _controlsContentFrame;
private SettingsMenu _settingsMenuInstance;
private readonly Harmony _harmony;
private readonly IPackageManagementService _packageManagementService;
private readonly IConfigService _configService;
private readonly ILoggerService _loggerService;
private static SettingsMenuSystem SystemInstance;
public SettingsMenuSystem(IPackageManagementService packageManagementService, IConfigService configService, ILoggerService loggerService)
{
_packageManagementService = packageManagementService;
_configService = configService;
_loggerService = loggerService;
SystemInstance = this;
_harmony = Harmony.CreateAndPatchAll(typeof(SettingsMenuSystem));
}
[HarmonyPatch(typeof(SettingsMenu), "CreateModsTab"), HarmonyPostfix]
private static void SettingsMenu_CreateModsTab_Post(SettingsMenu __instance)
{
SystemInstance._settingsMenuInstance = __instance;
SystemInstance.CreateSettingsMenu(__instance);
}
private void CreateSettingsMenu(SettingsMenu __instance)
{
DisposeMenuFrames();
var tabCount = Enum.GetValues<SettingsMenu.Tab>().Length;
var tabGameplayIndex = (SettingsMenu.Tab)tabCount;
var tabControlsIndex = (SettingsMenu.Tab)tabCount+1;
_gameplayContentFrame = CreateNewContentTab(tabGameplayIndex, __instance,
GUIStyle.ComponentStyles.ContainsKey("SettingsMenuTab.LuaCsSettings") ? "SettingsMenuTab.LuaCsSettings" : "SettingsMenuTab.Mods",
"LuaCsForBarotrauma.SettingsMenu.ModGameplayButton");
/*_controlsContentFrame = CreateNewContentTab(tabControlsIndex, __instance,
"SettingsMenuTab.Controls", "LuaCsForBarotrauma.SettingsMenu.ModControlsButton");
*/
_gameplayMenuInstance = new ModsGameplaySettingsMenu(_gameplayContentFrame, _packageManagementService, _configService, _loggerService, __instance);
//_controlsMenuInstance = new ModsControlsSettingsMenu(_controlsContentFrame, _packageManagementService, _configService, __instance);
}
private GUIFrame CreateNewContentTab(SettingsMenu.Tab tab, SettingsMenu settingsMenuInstance, string settingsMenuTabName, string settingMenuHoverTextIdent)
{
if (settingsMenuInstance.tabContents.TryGetValue(tab, out (GUIButton Button, GUIFrame Content) tabContent))
{
return tabContent.Content;
}
var contentFr = new GUIFrame(new RectTransform(Vector2.One * 0.95f, settingsMenuInstance.contentFrame.RectTransform, Anchor.Center, Pivot.Center), style: null);
var button = new GUIButton(new RectTransform(Vector2.One, settingsMenuInstance.tabber.RectTransform,
Anchor.TopLeft, Pivot.TopLeft, scaleBasis: ScaleBasis.Smallest), "", style: settingsMenuTabName)
{
ToolTip = TextManager.Get(settingMenuHoverTextIdent),
OnClicked = (b, _) =>
{
settingsMenuInstance.SelectTab(tab);
return false;
}
};
button.RectTransform.MaxSize = RectTransform.MaxPoint;
button.Children.ForEach(c => c.RectTransform.MaxSize = RectTransform.MaxPoint);
settingsMenuInstance.tabContents.Add(tab, (button, contentFr));
return contentFr;
}
[HarmonyPatch(typeof(SettingsMenu), nameof(SettingsMenu.ApplyInstalledModChanges)), HarmonyPostfix]
private static void SettingsMenu_ApplyInstalledModChanges_Post()
{
SystemInstance._gameplayMenuInstance?.ApplyInstalledModChanges();
SystemInstance._controlsMenuInstance?.ApplyInstalledModChanges();
}
private void DisposeMenuFrames()
{
_controlsMenuInstance?.Dispose();
_gameplayMenuInstance?.Dispose();
_controlsMenuInstance = null;
_gameplayMenuInstance = null;
}
#region DISPOSAL
public void Dispose()
{
if (!ModUtils.Threading.CheckIfClearAndSetBool(ref _isDisposed))
{
return;
}
DisposeMenuFrames();
GC.SuppressFinalize(this);
}
private int _isDisposed = 0;
public bool IsDisposed
{
get => ModUtils.Threading.GetBool(ref _isDisposed);
private set => ModUtils.Threading.SetBool(ref _isDisposed, value);
}
public FluentResults.Result Reset()
{
throw new NotImplementedException();
}
#endregion
}

View File

@@ -16,15 +16,17 @@ namespace Barotrauma
{
public readonly UInt32 DecalId;
public readonly int SpriteIndex;
public Vector2 NormalizedPos;
public readonly Vector2 NormalizedPos;
public readonly float Scale;
public readonly float DecalAlpha;
public RemoteDecal(UInt32 decalId, int spriteIndex, Vector2 normalizedPos, float scale)
public RemoteDecal(UInt32 decalId, int spriteIndex, Vector2 normalizedPos, float scale, float decalAlpha)
{
DecalId = decalId;
SpriteIndex = spriteIndex;
NormalizedPos = normalizedPos;
Scale = scale;
DecalAlpha = decalAlpha;
}
}
@@ -696,7 +698,7 @@ namespace Barotrauma
var decal = decalEventData.Decal;
int decalIndex = decals.IndexOf(decal);
msg.WriteByte((byte)(decalIndex < 0 ? 255 : decalIndex));
msg.WriteRangedSingle(decal.BaseAlpha, 0.0f, 1.0f, 8);
msg.WriteRangedSingle(decal.BaseAlpha, 0f, 1f, 8);
break;
default:
throw new Exception($"Malformed hull event: did not expect {eventData.GetType().Name}");
@@ -752,7 +754,9 @@ namespace Barotrauma
float normalizedXPos = msg.ReadRangedSingle(0.0f, 1.0f, 8);
float normalizedYPos = msg.ReadRangedSingle(0.0f, 1.0f, 8);
float decalScale = msg.ReadRangedSingle(0.0f, 2.0f, 12);
remoteDecals.Add(new RemoteDecal(decalId, spriteIndex, new Vector2(normalizedXPos, normalizedYPos), decalScale));
float decalAlpha = msg.ReadRangedSingle(0f, 1f, 8);
remoteDecals.Add(new RemoteDecal(decalId, spriteIndex, new Vector2(normalizedXPos, normalizedYPos), decalScale, decalAlpha));
}
break;
case EventType.BallastFlora:
@@ -804,7 +808,8 @@ namespace Barotrauma
decalPosX += Submarine.Position.X;
decalPosY += Submarine.Position.Y;
}
AddDecal(remoteDecal.DecalId, new Vector2(decalPosX, decalPosY), remoteDecal.Scale, isNetworkEvent: true, spriteIndex: remoteDecal.SpriteIndex);
Decal decal = AddDecal(remoteDecal.DecalId, new Vector2(decalPosX, decalPosY), remoteDecal.Scale, isNetworkEvent: true, spriteIndex: remoteDecal.SpriteIndex);
decal.BaseAlpha = remoteDecal.DecalAlpha;
}
remoteDecals.Clear();
}

View File

@@ -296,13 +296,9 @@ namespace Barotrauma.Lights
light.Priority = lightPriority(range, light);
int i = 0;
while (i < activeLights.Count && light.Priority < activeLights[i].Priority)
{
i++;
}
activeLights.Insert(i, light);
activeLights.Add(light);
}
activeLights.Sort(static (a, b) => b.Priority.CompareTo(a.Priority));
ActiveLightCount = activeLights.Count;
float lightPriority(float range, LightSource light)
@@ -332,7 +328,7 @@ namespace Barotrauma.Lights
activeLights.Remove(activeShadowCastingLights[i]);
}
}
activeLights.Sort((l1, l2) => l1.LastRecalculationTime.CompareTo(l2.LastRecalculationTime));
activeLights.Sort(static (l1, l2) => l1.LastRecalculationTime.CompareTo(l2.LastRecalculationTime));
//draw light sprites attached to characters
//render into a separate rendertarget using alpha blending (instead of on top of everything else with alpha blending)

View File

@@ -50,8 +50,14 @@ namespace Barotrauma.Lights
[Serialize("0, 0", IsPropertySaveable.Yes), Editable(ValueStep = 1, DecimalCount = 1, MinValueFloat = -1000f, MaxValueFloat = 1000f)]
public Vector2 Offset { get; set; }
public float RotationRad { get; private set; }
[Serialize(0f, IsPropertySaveable.Yes), Editable(MinValueFloat = -360, MaxValueFloat = 360, ValueStep = 1, DecimalCount = 0)]
public float Rotation { get; set; }
public float Rotation
{
get => MathHelper.ToDegrees(RotationRad);
set => RotationRad = MathHelper.ToRadians(value);
}
[Serialize(false, IsPropertySaveable.Yes, "Directional lights only shine in \"one direction\", meaning no shadows are cast behind them."+
" Note that this does not affect how the light texture is drawn: if you want something like a conical spotlight, you should use an appropriate texture for that.")]
@@ -314,6 +320,10 @@ namespace Barotrauma.Lights
private float prevCalculatedRotation;
private float rotation;
/// <summary>
/// Current rotation in radians. Note that LightSourceParams.RotationRad also affects the final rotation of the light.
/// </summary>
public float Rotation
{
get { return rotation; }
@@ -322,7 +332,7 @@ namespace Barotrauma.Lights
if (Math.Abs(value - rotation) < 0.001f) { return; }
rotation = value;
dir = new Vector2(MathF.Cos(rotation), -MathF.Sin(rotation));
RefreshDirection();
if (Math.Abs(rotation - prevCalculatedRotation) < RotationRecalculationThreshold && vertices != null)
{
@@ -486,6 +496,9 @@ namespace Barotrauma.Lights
break;
}
}
//make sure the rotation defined in the parameters is taken into account
RefreshDirection();
NeedsRecalculation = true;
}
public LightSource(LightSourceParams lightSourceParams)
@@ -497,6 +510,9 @@ namespace Barotrauma.Lights
{
DeformableLightSprite = new DeformableSprite(lightSourceParams.DeformableLightSpriteElement, invert: true);
}
//make sure the rotation defined in the parameters is taken into account
RefreshDirection();
NeedsRecalculation = true;
}
public LightSource(Vector2 position, float range, Color color, Submarine submarine, bool addLight=true)
@@ -511,6 +527,14 @@ namespace Barotrauma.Lights
if (addLight) { GameMain.LightManager.AddLight(this); }
}
/// <summary>
/// Refresh the direction vector of the light (which is used for calculating shadows) based on the rotation and <see cref="LightSourceParams.RotationRad"/>
/// </summary>
private void RefreshDirection()
{
dir = new Vector2(MathF.Cos(rotation - LightSourceParams.RotationRad), -MathF.Sin(rotation - LightSourceParams.RotationRad));
}
public void Update(float time)
{
float brightness = 1.0f;
@@ -773,9 +797,6 @@ namespace Barotrauma.Lights
float boundsExtended = TextureRange;
if (OverrideLightTexture != null)
{
float cosAngle = (float)Math.Cos(rotation);
float sinAngle = -(float)Math.Sin(rotation);
var overrideTextureDims = new Vector2(OverrideLightTexture.SourceRect.Width, OverrideLightTexture.SourceRect.Height);
Vector2 origin = OverrideLightTextureOrigin;
@@ -790,8 +811,11 @@ namespace Barotrauma.Lights
origin *= TextureRange;
drawOffset.X = -origin.X * cosAngle - origin.Y * sinAngle;
drawOffset.Y = origin.X * sinAngle + origin.Y * cosAngle;
//rotate the origin based on the direction
float cos = dir.X;
float sin = dir.Y;
drawOffset.X = -origin.X * cos - origin.Y * sin;
drawOffset.Y = origin.X * sin + origin.Y * cos;
}
//add a square-shaped boundary to make sure we've got something to construct the triangles from
@@ -1536,7 +1560,6 @@ namespace Barotrauma.Lights
Vector2 offset = ParentSub == null ? Vector2.Zero : ParentSub.DrawPosition;
lightEffect.World =
Matrix.CreateTranslation(-new Vector3(position, 0.0f)) *
Matrix.CreateRotationZ(MathHelper.ToRadians(LightSourceParams.Rotation)) *
Matrix.CreateTranslation(new Vector3(position + offset + translateVertices, 0.0f)) *
transform;

View File

@@ -193,7 +193,12 @@ namespace Barotrauma
{
CanTakeKeyBoardFocus = false
};
var editor = new SerializableEntityEditor(listBox.Content.RectTransform, this, inGame, showName: true, titleFont: GUIStyle.LargeFont) { UserData = this };
var editor = new SerializableEntityEditor(listBox.Content.RectTransform, this, inGame, showName: true,
titleFont: GUIStyle.LargeFont,
dimOutDefaultValues: false)
{
UserData = this
};
if (editor.Fields.TryGetValue(nameof(Scale).ToIdentifier(), out GUIComponent[] scaleFields) &&
scaleFields.FirstOrDefault() is GUINumberInput scaleInput)

View File

@@ -1,6 +1,7 @@
using Barotrauma.Extensions;
using Barotrauma.IO;
using Barotrauma.Items.Components;
using Barotrauma.LuaCs.Events;
using Barotrauma.Steam;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
@@ -284,7 +285,7 @@ namespace Barotrauma.Networking
otherClients = new List<Client>();
ServerSettings = new ServerSettings(this, serverName, 0, 0, 0, false, false);
ServerSettings = new ServerSettings(this, serverName, 0, 0, 0, false, false, System.Net.IPAddress.Any);
Voting = new Voting();
serverEndpoints = endpoints;
@@ -3002,6 +3003,10 @@ namespace Barotrauma.Networking
public override void AddChatMessage(ChatMessage message)
{
bool? should = null;
LuaCsSetup.Instance.EventService.PublishEvent<IEventChatMessage>(x => should = x.OnChatMessage(message.Text, message.SenderClient, message.Type, message) ?? should);
if (should != null && should.Value) { return; }
if (string.IsNullOrEmpty(message.Text)) { return; }
if (message.SenderCharacter is { IsDead: false } sender)
{

View File

@@ -30,6 +30,13 @@ namespace Barotrauma.Networking
{
DualStack = GameSettings.CurrentConfig.UseDualModeSockets
};
if (NetConfig.UseLenientHandshake)
{
// More lenient timeouts for local testing, so the server would start even without perfect conditions
netPeerConfiguration.ConnectionTimeout = 60.0f;
netPeerConfiguration.ResendHandshakeInterval = 5.0f;
netPeerConfiguration.MaximumHandshakeAttempts = 20;
}
if (endpoint.NetEndpoint.Address.AddressFamily == AddressFamily.InterNetworkV6)
{
netPeerConfiguration.LocalAddress = System.Net.IPAddress.IPv6Any;

View File

@@ -222,7 +222,7 @@ namespace Barotrauma
}
}
public static class PlayerInput
public class PlayerInput
{
static MouseState mouseState, oldMouseState;
static MouseState latestMouseState; //the absolute latest state, do NOT use for player interaction

View File

@@ -95,6 +95,7 @@ namespace Barotrauma
}
GameMain.GameSession?.AddToGUIUpdateList();
Character.AddAllToGUIUpdateList();
base.AddToGUIUpdateList();
}
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
@@ -351,7 +352,7 @@ namespace Barotrauma
{
Level.Loaded.DrawBack(graphics, spriteBatch, cam);
}
else if (GameMain.GameSession.GameMode is TestGameMode testMode)
else if (GameMain.GameSession?.GameMode is TestGameMode testMode)
{
graphics.Clear(testMode.BackgroundParams.BackgroundColor);

View File

@@ -49,6 +49,9 @@ namespace Barotrauma
private GUITextBox serverNameBox, passwordBox, maxPlayersBox;
private GUITickBox isPublicBox, wrongPasswordBanBox, karmaBox;
private GUIDropDown languageDropdown, serverExecutableDropdown;
#if DEBUG
private GUITickBox lenientHandshakeBox;
#endif
private readonly GUIButton joinServerButton, hostServerButton;
private readonly GUIFrame modsButtonContainer;
@@ -531,6 +534,7 @@ namespace Barotrauma
}
};
#endif
var minButtonSize = new Point(120, 20);
var maxButtonSize = new Point(480, 80);
@@ -1024,7 +1028,7 @@ namespace Barotrauma
else
{
StartServer();
}
}
}
private IEnumerable<CoroutineStatus> WaitForSubmarineHashCalculations(GUIMessageBox messageBox)
@@ -1075,7 +1079,7 @@ namespace Barotrauma
"-public", isPublicBox.Selected.ToString(),
"-playstyle", ((PlayStyle)playstyleBanner.UserData).ToString(),
"-banafterwrongpassword", wrongPasswordBanBox.Selected.ToString(),
"-karmaenabled", (!karmaBox.Selected).ToString(),
"-karmaenabled", (karmaBox.Selected).ToString(),
"-maxplayers", maxPlayersBox.Text,
"-language", languageDropdown.SelectedData.ToString()
};
@@ -1114,6 +1118,13 @@ namespace Barotrauma
int ownerKey = Math.Max(CryptoRandom.Instance.Next(), 1);
arguments.Add("-ownerkey");
arguments.Add(ownerKey.ToString());
#if DEBUG
if (lenientHandshakeBox.Selected)
{
arguments.Add("-lenienthandshake");
NetConfig.UseLenientHandshake = true;
}
#endif
var processInfo = new ProcessStartInfo
{
@@ -1368,7 +1379,7 @@ namespace Barotrauma
}
int maxPlayers = Math.Clamp(maxPlayersElement, min: 1, max: NetConfig.MaxPlayers);
var karmaEnabled = serverSettings.GetAttributeBool("karmaenabled", true);
var karmaEnabled = serverSettings.GetAttributeBool("karmaenabled", false);
var selectedPlayStyle = serverSettings.GetAttributeEnum("playstyle", PlayStyle.Casual);
Vector2 textLabelSize = new Vector2(1.0f, 0.05f);
@@ -1579,10 +1590,18 @@ namespace Barotrauma
karmaBox = new GUITickBox(new RectTransform(new Vector2(0.5f, 1.0f), tickboxAreaLower.RectTransform), TextManager.Get("HostServerKarmaSetting"))
{
Selected = !karmaEnabled,
Selected = karmaEnabled,
ToolTip = TextManager.Get("hostserverkarmasettingtooltip")
};
#if DEBUG
lenientHandshakeBox = new GUITickBox(new RectTransform(new Vector2(0.5f, 1.0f), tickboxAreaLower.RectTransform), "DEBUG: Lenient server startup timeouts")
{
Selected = true,
ToolTip = "Start with more lenient Lidgren handshake timeouts. The server is more likely to start even when running multiple instances on the same machine under heavy load."
};
#endif
tickboxAreaLower.RectTransform.IsFixedSize = true;
//spacing
@@ -1671,8 +1690,8 @@ namespace Barotrauma
if (string.IsNullOrEmpty(remoteContentUrl)) { return; }
try
{
var client = new RestClient(remoteContentUrl);
var request = new RestRequest("MenuContent.xml", Method.GET);
var client = RestFactory.CreateClient(remoteContentUrl);
var request = RestFactory.CreateRequest("MenuContent.xml");
TaskPool.Add("RequestMainMenuRemoteContent", client.ExecuteAsync(request),
RemoteContentReceived);
}
@@ -1693,12 +1712,17 @@ namespace Barotrauma
try
{
if (!t.TryGetResult(out IRestResponse remoteContentResponse)) { throw new Exception("Task did not return a valid result"); }
if (remoteContentResponse.ErrorException != null)
{
DebugConsole.AddWarning($"Connection error: Failed to fetch remote main menu content " +
$"({remoteContentResponse.ErrorException.Message}).");
return;
}
if (remoteContentResponse.StatusCode != HttpStatusCode.OK)
{
DebugConsole.AddWarning(
"Failed to receive remote main menu content. " +
"There may be an issue with your internet connection, or the master server might be temporarily unavailable " +
$"(error code: {remoteContentResponse.StatusCode})");
$"The master server might be temporarily unavailable (HTTP error: {remoteContentResponse.StatusCode})");
return;
}
string xml = remoteContentResponse.Content;

View File

@@ -5,6 +5,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Barotrauma.Extensions;
using Barotrauma.IO;
using Barotrauma.LuaCs.Events;
using Barotrauma.Networking;
using Barotrauma.Steam;
using Microsoft.Xna.Framework;
@@ -365,7 +366,7 @@ namespace Barotrauma
ContentPackageManager.EnabledPackages.BackUp();
ContentPackageManager.EnabledPackages.SetCore(corePackage);
ContentPackageManager.EnabledPackages.SetRegular(regularPackages);
//see if any of the packages we enabled contain subs that we were missing previously, and update their paths
foreach (var serverSub in GameMain.Client.ServerSubmarines)
{
@@ -398,7 +399,7 @@ namespace Barotrauma
string dir = path.RemoveFromEnd(ModReceiver.Extension, StringComparison.OrdinalIgnoreCase);
SaveUtil.DecompressToDirectory(path, dir);
var result = ContentPackage.TryLoad(Path.Combine(dir, ContentPackage.FileListFileName));
var result = ContentPackage.TryLoad(Path.Combine(dir, ContentPackage.FileListFileName).CleanUpPathCrossPlatform());
if (!result.TryUnwrapSuccess(out var newPackage))
{

View File

@@ -12,6 +12,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using Barotrauma.LuaCs.Events;
using Barotrauma.Sounds;
namespace Barotrauma
@@ -733,6 +734,8 @@ namespace Barotrauma
AutoHideScrollBar = false,
OnSelected = (component, userdata) =>
{
//if we're clicking on a checkbox (toggle visibility) on the list, don't select the entry on the list
if (GUI.MouseOn is GUITickBox) { return false; }
//toggling selection is not how listboxes normally work, need to do that manually here
SoundPlayer.PlayUISound(GUISoundType.Select);
if (layerList.SelectedData == userdata)
@@ -3253,6 +3256,20 @@ namespace Barotrauma
= new GUITextBox(new RectTransform((1.0f, 0.15f), saveInPackageLayout.RectTransform),
createClearButton: true);
packToSaveInFilter.OnTextChanged += (GUITextBox textBox, string text) =>
{
foreach (GUIComponent child in packageToSaveInList.Content.Children)
{
child.Visible =
// Get the pkgText from below
!(child.GetChild<GUILayoutGroup>()?.GetChild<GUITextBlock>() is GUITextBlock textBlock &&
!textBlock.Text.Contains(packToSaveInFilter.Text, StringComparison.OrdinalIgnoreCase));
}
return true;
};
GUILayoutGroup addItemToPackageToSaveList(LocalizedString itemText, ContentPackage p)
{
var listItem = new GUIFrame(new RectTransform((1.0f, 0.15f), packageToSaveInList.Content.RectTransform),
@@ -3273,28 +3290,26 @@ namespace Barotrauma
return retVal;
}
ContentPackage ownerPkg = null;
#if DEBUG
//this is a debug-only option so I won't bother submitting it for localization
var modifyVanillaListItem = addItemToPackageToSaveList("Modify Vanilla content package", ContentPackageManager.VanillaCorePackage);
var modifyVanillaListIcon = modifyVanillaListItem.GetChild<GUIFrame>();
GUIStyle.Apply(modifyVanillaListIcon, "WorkshopMenu.EditButton");
if (MainSub?.Info != null && IsVanillaSub(MainSub.Info))
{
ownerPkg = ContentPackageManager.VanillaCorePackage;
}
#endif
var newPackageListItem = addItemToPackageToSaveList(TextManager.Get("CreateNewLocalPackage"), null);
var newPackageListIcon = newPackageListItem.GetChild<GUIFrame>();
var newPackageListText = newPackageListItem.GetChild<GUITextBlock>();
GUIStyle.Apply(newPackageListIcon, "NewContentPackageIcon");
new GUICustomComponent(new RectTransform(Vector2.Zero, saveInPackageLayout.RectTransform),
onUpdate: (f, component) =>
{
foreach (GUIComponent contentChild in packageToSaveInList.Content.Children)
{
contentChild.Visible &= !(contentChild.GetChild<GUILayoutGroup>()?.GetChild<GUITextBlock>() is GUITextBlock tb &&
!tb.Text.Contains(packToSaveInFilter.Text, StringComparison.OrdinalIgnoreCase));
}
});
ContentPackage ownerPkg = null;
if (MainSub?.Info != null) { ownerPkg = GetLocalPackageThatOwnsSub(MainSub.Info); }
if (ownerPkg == null && MainSub?.Info != null) { ownerPkg = GetLocalPackageThatOwnsSub(MainSub.Info); }
foreach (var p in ContentPackageManager.LocalPackages)
{
var packageListItem = addItemToPackageToSaveList(p.Name, p);
@@ -3849,6 +3864,10 @@ namespace Barotrauma
return true;
};
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), deleteButtonHolder.RectTransform), TextManager.Get("DragAndDropSubmarineTip").Fallback(LocalizedString.EmptyString), textAlignment: Alignment.Center, font: GUIStyle.Font)
{
Wrap = true
};
if (AutoSaveInfo?.Root != null)
{
@@ -4486,6 +4505,7 @@ namespace Barotrauma
public void ReconstructLayers()
{
Dictionary<string, LayerData> previousLayers = Layers.ToDictionary();
ClearLayers();
foreach (MapEntity entity in MapEntity.MapEntityList)
{
@@ -4494,6 +4514,13 @@ namespace Barotrauma
Layers.TryAdd(entity.Layer, new LayerData(!entity.IsLayerHidden));
}
}
foreach ((string layerName, LayerData data) in previousLayers)
{
if (Layers.ContainsKey(layerName))
{
Layers[layerName] = data;
}
}
UpdateLayerPanel();
}

View File

@@ -26,6 +26,8 @@ namespace Barotrauma
public static DateTime NextCommandPush;
public static Tuple<SerializableProperty, PropertyCommand> CommandBuffer;
private bool dimOutDefaultValues;
private bool isReadonly;
public bool Readonly
{
@@ -316,16 +318,17 @@ namespace Barotrauma
}
}
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, bool inGame, bool showName, string style = "", int elementHeight = 24, GUIFont titleFont = null)
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, bool inGame, bool showName, string style = "", int elementHeight = 24, GUIFont titleFont = null, bool dimOutDefaultValues = true)
: this(parent, entity, inGame ?
SerializableProperty.GetProperties<InGameEditable>(entity).Union(SerializableProperty.GetProperties<ConditionallyEditable>(entity).Where(p => p.GetAttribute<ConditionallyEditable>()?.IsEditable(entity) ?? false))
: SerializableProperty.GetProperties<Editable>(entity).Where(p => p.GetAttribute<ConditionallyEditable>()?.IsEditable(entity) ?? true), showName, style, elementHeight, titleFont)
: SerializableProperty.GetProperties<Editable>(entity).Where(p => p.GetAttribute<ConditionallyEditable>()?.IsEditable(entity) ?? true), showName, style, elementHeight, titleFont, dimOutDefaultValues)
{
}
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, IEnumerable<SerializableProperty> properties, bool showName, string style = "", int elementHeight = 24, GUIFont titleFont = null)
public SerializableEntityEditor(RectTransform parent, ISerializableEntity entity, IEnumerable<SerializableProperty> properties, bool showName, string style = "", int elementHeight = 24, GUIFont titleFont = null, bool dimOutDefaultValues = true)
: base(style, new RectTransform(Vector2.One, parent))
{
this.dimOutDefaultValues = dimOutDefaultValues;
elementHeight = (int)(elementHeight * GUI.Scale);
var tickBoxStyle = GUIStyle.GetComponentStyle("GUITickBox");
var textBoxStyle = GUIStyle.GetComponentStyle("GUITextBox");
@@ -523,9 +526,67 @@ namespace Barotrauma
{
propertyField = CreateStringField(entity, property, value.ToString(), displayName, toolTip);
}
if (propertyField != null && dimOutDefaultValues)
{
UpdateTextColors(property, entity, propertyField);
}
return propertyField;
}
private void UpdateTextColors(SerializableProperty property, object parentObject, GUIComponent parentElement)
{
if (!dimOutDefaultValues) { return; }
bool isSetToDefaultValue = false;
object currentValue = property.GetValue(parentObject);
foreach (var attribute in property.Attributes.OfType<Serialize>())
{
if (XMLExtensions.DefaultValueEquals(attribute.DefaultValue, currentValue) ||
//treat null and empty strings as identical, because there's no way to differentiate between those in the editor
(currentValue == null && attribute.DefaultValue is string defaultValueStr && defaultValueStr.IsNullOrEmpty()))
{
isSetToDefaultValue = true;
break;
}
}
foreach (var component in parentElement.GetAllChildren())
{
UpdateTextColors(component, isSetToDefaultValue);
}
}
private void UpdateTextColors(GUIComponent component, bool isSetToDefaultValue)
{
if (!dimOutDefaultValues) { return; }
if (component is GUINumberInput numberInput)
{
SetTextColor(numberInput.TextBox.TextBlock);
}
else if (component is GUIDropDown dropDown)
{
SetTextColor(dropDown.Button.TextBlock);
}
else if (component is GUITextBox textBox)
{
SetTextColor(textBox.TextBlock);
}
else if (component is GUITextBlock textBlock)
{
SetTextColor(textBlock);
}
else if (component is GUITickBox tickBox)
{
SetTextColor(tickBox.TextBlock);
}
void SetTextColor(GUITextBlock textBlock)
{
textBlock.TextColor = new Color(textBlock.TextColor, alpha: isSetToDefaultValue ? 0.5f : 1.0f);
}
}
public GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, LocalizedString displayName, LocalizedString toolTip)
{
var editableAttribute = property.GetAttribute<Editable>();
@@ -564,6 +625,7 @@ namespace Barotrauma
tickBox.Selected = propertyValue;
tickBox.Flash(Color.Red);
}
UpdateTextColors(property, entity, tickBox);
return true;
}
};
@@ -611,6 +673,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
};
refresh += () =>
{
@@ -654,6 +717,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
};
HandleSetterValueTampering(numberInput, () => property.GetFloatValue(entity));
@@ -711,6 +775,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
return true;
};
refresh += () =>
@@ -829,6 +894,7 @@ namespace Barotrauma
TrySendNetworkUpdate(entity, property);
textBox.Text = StripPrefabTags(property.GetValue(entity).ToString());
textBox.Flash(GUIStyle.Green, flashDuration: 1f);
UpdateTextColors(property, entity, frame);
}
//restore the entities that were selected before applying
MapEntity.SelectedList.Clear();
@@ -973,6 +1039,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
};
fields[i] = numberInput;
}
@@ -1046,6 +1113,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
};
HandleSetterValueTampering(numberInput, () =>
{
@@ -1126,6 +1194,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
};
fields[i] = numberInput;
}
@@ -1206,6 +1275,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
};
fields[i] = numberInput;
}
@@ -1299,6 +1369,7 @@ namespace Barotrauma
TrySendNetworkUpdate(entity, property);
colorBox.Color = colorBox.HoverColor = colorBox.PressedColor = colorBox.SelectedTextColor = newVal;
}
UpdateTextColors(property, entity, frame);
};
colorBox.Color = colorBox.HoverColor = colorBox.PressedColor = colorBox.SelectedTextColor = (Color)property.GetValue(entity);
fields[i] = numberInput;
@@ -1373,6 +1444,7 @@ namespace Barotrauma
{
TrySendNetworkUpdate(entity, property);
}
UpdateTextColors(property, entity, frame);
};
fields[i] = numberInput;
}
@@ -1437,6 +1509,7 @@ namespace Barotrauma
TrySendNetworkUpdate(entity, property);
textBox.Flash(color: GUIStyle.Green, flashDuration: 1f);
}
UpdateTextColors(property, entity, frame);
}
else
{

View File

@@ -33,10 +33,10 @@ namespace Barotrauma
private GameSettings.Config unsavedConfig;
private readonly GUIFrame mainFrame;
public readonly GUIFrame mainFrame;
private readonly GUILayoutGroup tabber;
private readonly GUIFrame contentFrame;
public readonly GUILayoutGroup tabber;
public readonly GUIFrame contentFrame;
private readonly GUILayoutGroup bottom;
public readonly WorkshopMenu WorkshopMenu;
@@ -103,7 +103,7 @@ namespace Barotrauma
newContent.Visible = true;
}
private readonly Dictionary<Tab, (GUIButton Button, GUIFrame Content)> tabContents;
public readonly Dictionary<Tab, (GUIButton Button, GUIFrame Content)> tabContents;
public void SelectTab(Tab tab)
{
@@ -149,7 +149,7 @@ namespace Barotrauma
return content;
}
private static (GUILayoutGroup Left, GUILayoutGroup Right) CreateSidebars(GUIFrame parent, bool split = false)
public static (GUILayoutGroup Left, GUILayoutGroup Right) CreateSidebars(GUIFrame parent, bool split = false)
{
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(Vector2.One, parent.RectTransform), isHorizontal: true);
GUILayoutGroup left = new GUILayoutGroup(new RectTransform((0.4875f, 1.0f), layout.RectTransform), isHorizontal: false);
@@ -166,29 +166,29 @@ namespace Barotrauma
return (left, right);
}
private static GUILayoutGroup CreateCenterLayout(GUIFrame parent)
public static GUILayoutGroup CreateCenterLayout(GUIFrame parent)
{
return new GUILayoutGroup(new RectTransform((0.5f, 1.0f), parent.RectTransform, Anchor.TopCenter, Pivot.TopCenter)) { ChildAnchor = Anchor.TopCenter };
}
private static RectTransform NewItemRectT(GUILayoutGroup parent)
public static RectTransform NewItemRectT(GUILayoutGroup parent)
=> new RectTransform((1.0f, 0.06f), parent.RectTransform, Anchor.CenterLeft);
private static void Spacer(GUILayoutGroup parent)
public static void Spacer(GUILayoutGroup parent, float height = 0.03f)
{
new GUIFrame(new RectTransform((1.0f, 0.03f), parent.RectTransform, Anchor.CenterLeft), style: null);
new GUIFrame(new RectTransform((1.0f, height), parent.RectTransform, Anchor.CenterLeft), style: null);
}
private static GUITextBlock Label(GUILayoutGroup parent, LocalizedString str, GUIFont font)
public static GUITextBlock Label(GUILayoutGroup parent, LocalizedString str, GUIFont font)
{
return new GUITextBlock(NewItemRectT(parent), str, font: font);
}
private static void DropdownEnum<T>(GUILayoutGroup parent, Func<T, LocalizedString> textFunc, Func<T, LocalizedString>? tooltipFunc, T currentValue,
public static void DropdownEnum<T>(GUILayoutGroup parent, Func<T, LocalizedString> textFunc, Func<T, LocalizedString>? tooltipFunc, T currentValue,
Action<T> setter) where T : Enum
=> Dropdown(parent, textFunc, tooltipFunc, (T[])Enum.GetValues(typeof(T)), currentValue, setter);
private static GUIDropDown Dropdown<T>(GUILayoutGroup parent, Func<T, LocalizedString> textFunc, Func<T, LocalizedString>? tooltipFunc, IReadOnlyList<T> values, T currentValue, Action<T> setter)
public static GUIDropDown Dropdown<T>(GUILayoutGroup parent, Func<T, LocalizedString> textFunc, Func<T, LocalizedString>? tooltipFunc, IReadOnlyList<T> values, T currentValue, Action<T> setter)
{
var dropdown = new GUIDropDown(NewItemRectT(parent), elementCount: values.Count);
values.ForEach(v => dropdown.AddItem(text: textFunc(v), userData: v, toolTip: tooltipFunc?.Invoke(v) ?? null));
@@ -204,7 +204,7 @@ namespace Barotrauma
return dropdown;
}
private static (GUIScrollBar slider, GUITextBlock label) Slider(GUILayoutGroup parent, Vector2 range, int steps, Func<float, string> labelFunc, float currentValue, Action<float> setter, LocalizedString? tooltip = null)
public static (GUIScrollBar slider, GUITextBlock label) Slider(GUILayoutGroup parent, Vector2 range, int steps, Func<float, string> labelFunc, float currentValue, Action<float> setter, LocalizedString? tooltip = null)
{
var layout = new GUILayoutGroup(NewItemRectT(parent), isHorizontal: true);
var slider = new GUIScrollBar(new RectTransform((0.72f, 1.0f), layout.RectTransform), style: "GUISlider")
@@ -229,7 +229,7 @@ namespace Barotrauma
return (slider, label);
}
private static GUITickBox Tickbox(GUILayoutGroup parent, LocalizedString label, LocalizedString tooltip, bool currentValue, Action<bool> setter)
public static GUITickBox Tickbox(GUILayoutGroup parent, LocalizedString label, LocalizedString tooltip, bool currentValue, Action<bool> setter)
{
return new GUITickBox(NewItemRectT(parent), label)
{
@@ -243,9 +243,9 @@ namespace Barotrauma
};
}
private string Percentage(float v) => ToolBox.GetFormattedPercentage(v);
public string Percentage(float v) => ToolBox.GetFormattedPercentage(v);
private static int Round(float v) => MathUtils.RoundToInt(v);
public static int Round(float v) => MathUtils.RoundToInt(v);
private void CreateGraphicsTab()
{
@@ -507,6 +507,47 @@ namespace Barotrauma
return true;
}
};
#if OSX
Spacer(voiceChat, 0.003f);
// On macOS, microphone permission can apparently sometimes end up in a broken state when the app binary changes (eg. after a Steam update).
// The device seems to be there, but won't receive anything, even if the mic permission is fine.
// This button lets the user reset it and reboot the game, so the mic permission check will be retriggered on next run.
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), voiceChat.RectTransform),
text: TextManager.Get("MacResetMicPermissions"),
style: "GUIButtonSmall")
{
ToolTip = TextManager.Get("MacResetMicPermissionsToolTip"),
OnClicked = (btn, obj) =>
{
var confirmBox = new GUIMessageBox(
TextManager.Get("MacResetMicPermissions"),
TextManager.Get("MacResetMicPermissionsConfirm"),
[TextManager.Get("OK"), TextManager.Get("Cancel")]);
confirmBox.Buttons[0].OnClicked = (_, _) =>
{
try
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
{
FileName = "tccutil",
Arguments = "reset Microphone com.FakeFish.Barotrauma",
UseShellExecute = false
});
}
catch (Exception e)
{
DebugConsole.NewMessage($"Failed to reset microphone permission: {e.Message}", Color.Orange);
}
GameMain.Instance.Exit();
confirmBox.Close();
return true;
};
confirmBox.Buttons[1].OnClicked = confirmBox.Close;
return true;
}
};
#endif
Spacer(voiceChat);
Label(voiceChat, TextManager.Get("VCInputMode"), GUIStyle.SubHeadingFont);
@@ -965,4 +1006,4 @@ namespace Barotrauma
GUI.SettingsMenuOpen = false;
}
}
}
}

View File

@@ -387,13 +387,11 @@ These will hide all servers that have a discord.gg link in their name or descrip
try
{
var client = new RestClient($"{remoteContentUrl}spamfilter")
{
CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore)
};
var client = RestFactory.CreateClient($"{remoteContentUrl}spamfilter");
client.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
client.AddDefaultHeader("Cache-Control", "no-cache");
client.AddDefaultHeader("Pragma", "no-cache");
var request = new RestRequest("serve_spamlist.php", Method.GET);
var request = RestFactory.CreateRequest("serve_spamlist.php");
TaskPool.Add("RequestGlobalSpamFilter", client.ExecuteAsync(request), RemoteContentReceived);
}
catch (Exception e)
@@ -410,12 +408,18 @@ These will hide all servers that have a discord.gg link in their name or descrip
try
{
if (!t.TryGetResult(out IRestResponse? remoteContentResponse)) { throw new Exception("Task did not return a valid result"); }
if (remoteContentResponse.ErrorException != null)
{
DebugConsole.AddWarning(
"Connection error: Failed to receive global spam filter " +
$"({remoteContentResponse.ErrorException.Message}).");
return;
}
if (remoteContentResponse.StatusCode != HttpStatusCode.OK)
{
DebugConsole.AddWarning(
"Failed to receive global spam filter." +
"There may be an issue with your internet connection, or the master server might be temporarily unavailable " +
$"(error code: {remoteContentResponse.StatusCode})");
"Failed to receive global spam filter. " +
$"The master server might be temporarily unavailable, HTTP status: {remoteContentResponse.StatusCode}");
return;
}
string data = remoteContentResponse.Content;

View File

@@ -18,18 +18,36 @@ namespace Barotrauma.Steam
{
public const int MaxThumbnailSize = 1024 * 1024;
/// <summary>
/// Tags the players can choose for their workshop items. These must match the ones defined in the Steamworks backend. They're case insensitive, but must otherwise match exactly for the tag filtering to work correctly.
/// The localized names for these are fetched from the loca files with the identifier "workshop.contenttag.{tag.RemoveWhitespace()}".
/// </summary>
public static readonly ImmutableArray<Identifier> Tags = new []
{
"submarine",
"item",
"monster",
"art",
"mission",
"outpost",
"beacon station",
"wreck",
"ruin",
"weapons",
"medical",
"equipment",
"art",
"event set",
"total conversion",
"game mode",
"gameplay mechanics",
"environment",
"item assembly",
"language",
"qol",
"client-side",
"server-side",
"outdated",
"library"
}.ToIdentifiers().ToImmutableArray();
public class ItemThumbnail : IDisposable
@@ -113,10 +131,14 @@ namespace Barotrauma.Steam
string? thumbnailUrl = item.PreviewImageUrl;
if (thumbnailUrl.IsNullOrWhiteSpace()) { return null; }
var client = new RestClient(thumbnailUrl);
var request = new RestRequest(".", Method.GET);
var client = RestFactory.CreateClient(thumbnailUrl);
var request = RestFactory.CreateRequest(".");
IRestResponse response = await client.ExecuteAsync(request, cancellationToken);
if (response is { StatusCode: System.Net.HttpStatusCode.OK, ResponseStatus: ResponseStatus.Completed })
if (response.ErrorException != null)
{
DebugConsole.NewMessage($"Connection error: Failed to load workshop item thumbnail for {item.Id} ({response.ErrorException.Message}).");
}
else if (response is { StatusCode: System.Net.HttpStatusCode.OK, ResponseStatus: ResponseStatus.Completed })
{
using var dataStream = new System.IO.MemoryStream();
await dataStream.WriteAsync(response.RawBytes, cancellationToken);

View File

@@ -535,9 +535,9 @@ namespace Barotrauma.Steam
= new GUIListBox(rectT, style: null, isHorizontal: false)
{
UseGridLayout = true,
ScrollBarEnabled = false,
ScrollBarEnabled = true,
ScrollBarVisible = false,
HideChildrenOutsideFrame = false,
HideChildrenOutsideFrame = true,
Spacing = GUI.IntScale(4)
};
tagsList.Content.ClampMouseRectToParent = false;

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.11.5.0</Version>
<Version>1.12.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
@@ -14,6 +14,7 @@
<Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -211,4 +212,9 @@
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
</Project>
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
<Import Project="../BarotraumaShared/LuatraumaBuild.props" />
</Project>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.11.5.0</Version>
<Version>1.12.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
@@ -14,6 +14,8 @@
<Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -215,4 +217,10 @@
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
</Project>
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
<Import Project="../BarotraumaShared/LuatraumaBuild.props" />
</Project>

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.11.5.0</Version>
<Version>1.12.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
@@ -15,6 +15,7 @@
<InvariantGlobalization>true</InvariantGlobalization>
<ApplicationManifest>app.manifest</ApplicationManifest>
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -243,4 +244,9 @@
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
</Project>
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
<Import Project="../BarotraumaShared/LuatraumaBuild.props" />
</Project>

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=clientsource/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -1,160 +1,169 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.11.5.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
<Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE;SERVER;LINUX</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>TRACE;DEBUG;SERVER;LINUX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;SERVER;LINUX</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
<DefineConstants>TRACE;SERVER;LINUX</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>TRACE;SERVER;LINUX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
<DefineConstants>TRACE;SERVER;LINUX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save;..\BarotraumaShared\ModLists\*.xml;..\BarotraumaShared\LocalMods\[DebugOnlyTest]*\**" />
<Content Remove="..\BarotraumaShared\**\*.cs" />
<Content Remove="..\BarotraumaShared\**\*.props" />
<Compile Include="..\BarotraumaShared\**\*.cs" />
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
<Content Include="DedicatedServer.exe" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'!='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="106.13.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\BarotraumaCore\BarotraumaCore.csproj" />
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\EosInterface\EosInterface.csproj" />
</ItemGroup>
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
<PropertyGroup>
<!-- temp file for the git version (lives in "obj" folder)-->
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
</PropertyGroup>
<!-- write the hash to the temp file.-->
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD &gt; $(VerFile)" ContinueOnError="true">
<Output TaskParameter="exitcode" ItemName="exitcodes" />
</Exec>
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict &gt; $(BranchFile)" ContinueOnError="true" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(VerFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(BranchFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<!-- read the version into the GitVersion itemGroup-->
<ReadLinesFromFile File="$(VerFile)">
<Output TaskParameter="Lines" ItemName="GitVersion" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildHash>@(GitVersion)</BuildHash>
</PropertyGroup>
<!-- read the branch into the GitBranch itemGroup-->
<ReadLinesFromFile File="$(BranchFile)">
<Output TaskParameter="Lines" ItemName="GitBranch" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildBranch>@(GitBranch)</BuildBranch>
</PropertyGroup>
</Target>
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
<PropertyGroup>
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
</PropertyGroup>
<!-- includes the CustomAssemblyInfo for compilation into your project -->
<ItemGroup>
<Compile Include="$(CustomAssemblyInfoFile)" />
</ItemGroup>
<!-- defines the AssemblyMetadata attribute that will be written -->
<ItemGroup>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitRevision</_Parameter1>
<_Parameter2>$(BuildHash)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitBranch</_Parameter1>
<_Parameter2>$(BuildBranch)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>ProjectDir</_Parameter1>
<_Parameter2>$(ProjectDir)</_Parameter2>
</AssemblyAttributes>
</ItemGroup>
<!-- writes the attribute to the customAssemblyInfo file -->
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
</Target>
<PropertyGroup>
<ManualDeployRuntime>linux-x64</ManualDeployRuntime>
<ProjectFileNamePlatformSuffix>Linux</ProjectFileNamePlatformSuffix>
</PropertyGroup>
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.12.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
<Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization>
<LangVersion>latest</LangVersion>
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE;SERVER;LINUX</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>TRACE;DEBUG;SERVER;LINUX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;SERVER;LINUX</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
<DefineConstants>TRACE;SERVER;LINUX</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>TRACE;SERVER;LINUX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
<DefineConstants>TRACE;SERVER;LINUX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save;..\BarotraumaShared\ModLists\*.xml;..\BarotraumaShared\LocalMods\[DebugOnlyTest]*\**" />
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save;..\BarotraumaShared\ModLists\*.xml" />
<Content Remove="..\BarotraumaShared\**\*.cs" />
<Content Remove="..\BarotraumaShared\**\*.props" />
<Compile Include="..\BarotraumaShared\**\*.cs" />
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
<Content Include="DedicatedServer.exe" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'!='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="106.13.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\BarotraumaCore\BarotraumaCore.csproj" />
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\EosInterface\EosInterface.csproj" />
</ItemGroup>
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
<PropertyGroup>
<!-- temp file for the git version (lives in "obj" folder)-->
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
</PropertyGroup>
<!-- write the hash to the temp file.-->
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD &gt; $(VerFile)" ContinueOnError="true">
<Output TaskParameter="exitcode" ItemName="exitcodes" />
</Exec>
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict &gt; $(BranchFile)" ContinueOnError="true" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(VerFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(BranchFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<!-- read the version into the GitVersion itemGroup-->
<ReadLinesFromFile File="$(VerFile)">
<Output TaskParameter="Lines" ItemName="GitVersion" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildHash>@(GitVersion)</BuildHash>
</PropertyGroup>
<!-- read the branch into the GitBranch itemGroup-->
<ReadLinesFromFile File="$(BranchFile)">
<Output TaskParameter="Lines" ItemName="GitBranch" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildBranch>@(GitBranch)</BuildBranch>
</PropertyGroup>
</Target>
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
<PropertyGroup>
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
</PropertyGroup>
<!-- includes the CustomAssemblyInfo for compilation into your project -->
<ItemGroup>
<Compile Include="$(CustomAssemblyInfoFile)" />
</ItemGroup>
<!-- defines the AssemblyMetadata attribute that will be written -->
<ItemGroup>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitRevision</_Parameter1>
<_Parameter2>$(BuildHash)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitBranch</_Parameter1>
<_Parameter2>$(BuildBranch)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>ProjectDir</_Parameter1>
<_Parameter2>$(ProjectDir)</_Parameter2>
</AssemblyAttributes>
</ItemGroup>
<!-- writes the attribute to the customAssemblyInfo file -->
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
</Target>
<PropertyGroup>
<ManualDeployRuntime>linux-x64</ManualDeployRuntime>
<ProjectFileNamePlatformSuffix>Linux</ProjectFileNamePlatformSuffix>
</PropertyGroup>
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
<Import Project="../BarotraumaShared/LuatraumaBuild.props" />
</Project>

View File

@@ -1,165 +1,172 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.11.5.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
<Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;SERVER;OSX;DEBUG;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\DebugMac</OutputPath>
<ConsolePause>true</ConsolePause>
<CheckForOverflowUnderflow></CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>TRACE;DEBUG;SERVER;OSX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;SERVER;OSX;RELEASE;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<DebugType></DebugType>
<OutputPath>..\bin\ReleaseMac</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
<DefineConstants>TRACE;SERVER;OSX;RELEASE;NETCOREAPP;NETCOREAPP3_0;UNSTABLE</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<DebugType />
<OutputPath>..\bin\ReleaseMac</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>TRACE;SERVER;OSX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
<DefineConstants>TRACE;SERVER;OSX;X64;UNSTABLE</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save;..\BarotraumaShared\ModLists\*.xml;..\BarotraumaShared\LocalMods\[DebugOnlyTest]*\**" />
<Content Remove="..\BarotraumaShared\**\*.cs" />
<Content Remove="..\BarotraumaShared\**\*.props" />
<Compile Include="..\BarotraumaShared\**\*.cs" />
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
<Content Remove="DedicatedServer.exe" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'!='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="106.13.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\BarotraumaCore\BarotraumaCore.csproj" />
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\EosInterface\EosInterface.csproj" />
</ItemGroup>
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
<PropertyGroup>
<!-- temp file for the git version (lives in "obj" folder)-->
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
</PropertyGroup>
<!-- write the hash to the temp file.-->
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD &gt; $(VerFile)" ContinueOnError="true">
<Output TaskParameter="exitcode" ItemName="exitcodes" />
</Exec>
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict &gt; $(BranchFile)" ContinueOnError="true" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(VerFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(BranchFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<!-- read the version into the GitVersion itemGroup-->
<ReadLinesFromFile File="$(VerFile)">
<Output TaskParameter="Lines" ItemName="GitVersion" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildHash>@(GitVersion)</BuildHash>
</PropertyGroup>
<!-- read the branch into the GitBranch itemGroup-->
<ReadLinesFromFile File="$(BranchFile)">
<Output TaskParameter="Lines" ItemName="GitBranch" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildBranch>@(GitBranch)</BuildBranch>
</PropertyGroup>
</Target>
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
<PropertyGroup>
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
</PropertyGroup>
<!-- includes the CustomAssemblyInfo for compilation into your project -->
<ItemGroup>
<Compile Include="$(CustomAssemblyInfoFile)" />
</ItemGroup>
<!-- defines the AssemblyMetadata attribute that will be written -->
<ItemGroup>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitRevision</_Parameter1>
<_Parameter2>$(BuildHash)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitBranch</_Parameter1>
<_Parameter2>$(BuildBranch)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>ProjectDir</_Parameter1>
<_Parameter2>$(ProjectDir)</_Parameter2>
</AssemblyAttributes>
</ItemGroup>
<!-- writes the attribute to the customAssemblyInfo file -->
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
</Target>
<PropertyGroup>
<ManualDeployRuntime>osx-x64</ManualDeployRuntime>
<ProjectFileNamePlatformSuffix>MacOS</ProjectFileNamePlatformSuffix>
</PropertyGroup>
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.12.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
<Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;SERVER;OSX;DEBUG;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\DebugMac</OutputPath>
<ConsolePause>true</ConsolePause>
<CheckForOverflowUnderflow></CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>TRACE;DEBUG;SERVER;OSX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;SERVER;OSX;RELEASE;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<DebugType></DebugType>
<OutputPath>..\bin\ReleaseMac</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
<DefineConstants>TRACE;SERVER;OSX;RELEASE;NETCOREAPP;NETCOREAPP3_0;UNSTABLE</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<DebugType />
<OutputPath>..\bin\ReleaseMac</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>TRACE;SERVER;OSX;X64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
<DefineConstants>TRACE;SERVER;OSX;X64;UNSTABLE</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save;..\BarotraumaShared\ModLists\*.xml" />
<Content Remove="..\BarotraumaShared\**\*.cs" />
<Content Remove="..\BarotraumaShared\**\*.props" />
<Compile Include="..\BarotraumaShared\**\*.cs" />
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
<Content Remove="DedicatedServer.exe" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'!='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="106.13.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\BarotraumaCore\BarotraumaCore.csproj" />
<ProjectReference Include="..\..\Libraries\BarotraumaLibs\EosInterface\EosInterface.csproj" />
</ItemGroup>
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
<PropertyGroup>
<!-- temp file for the git version (lives in "obj" folder)-->
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
</PropertyGroup>
<!-- write the hash to the temp file.-->
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD &gt; $(VerFile)" ContinueOnError="true">
<Output TaskParameter="exitcode" ItemName="exitcodes" />
</Exec>
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict &gt; $(BranchFile)" ContinueOnError="true" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(VerFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<Exec Command="echo GIT_UNAVAILABLE &gt; $(BranchFile)" Condition="'%(exitcodes.identity)'&gt;0" />
<!-- read the version into the GitVersion itemGroup-->
<ReadLinesFromFile File="$(VerFile)">
<Output TaskParameter="Lines" ItemName="GitVersion" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildHash>@(GitVersion)</BuildHash>
</PropertyGroup>
<!-- read the branch into the GitBranch itemGroup-->
<ReadLinesFromFile File="$(BranchFile)">
<Output TaskParameter="Lines" ItemName="GitBranch" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup>
<BuildBranch>@(GitBranch)</BuildBranch>
</PropertyGroup>
</Target>
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
<PropertyGroup>
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
</PropertyGroup>
<!-- includes the CustomAssemblyInfo for compilation into your project -->
<ItemGroup>
<Compile Include="$(CustomAssemblyInfoFile)" />
</ItemGroup>
<!-- defines the AssemblyMetadata attribute that will be written -->
<ItemGroup>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitRevision</_Parameter1>
<_Parameter2>$(BuildHash)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitBranch</_Parameter1>
<_Parameter2>$(BuildBranch)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>ProjectDir</_Parameter1>
<_Parameter2>$(ProjectDir)</_Parameter2>
</AssemblyAttributes>
</ItemGroup>
<!-- writes the attribute to the customAssemblyInfo file -->
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
</Target>
<PropertyGroup>
<ManualDeployRuntime>osx-x64</ManualDeployRuntime>
<ProjectFileNamePlatformSuffix>MacOS</ProjectFileNamePlatformSuffix>
</PropertyGroup>
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
<Import Project="../BarotraumaShared/LuatraumaBuild.props" />
</Project>

View File

@@ -65,7 +65,10 @@ namespace Barotrauma
var owner = GameMain.Server.ConnectedClients.Find(c => c.Character == this);
if (owner != null)
{
GameMain.Server.SendDirectChatMessage(TextManager.FormatServerMessage("KilledByTraitorNotification"), owner, ChatMessageType.ServerMessageBoxInGame);
if (!LuaCsSetup.Instance.Game.overrideTraitors)
{
GameMain.Server.SendDirectChatMessage(TextManager.FormatServerMessage("KilledByTraitorNotification"), owner, ChatMessageType.ServerMessageBoxInGame);
}
}
}
foreach (Client client in GameMain.Server.ConnectedClients)

View File

@@ -5,10 +5,12 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using Barotrauma.Steam;
using Barotrauma.Extensions;
using Barotrauma.LuaCs.Events;
namespace Barotrauma
{
@@ -313,7 +315,7 @@ namespace Barotrauma
return client;
}
private static void AssignOnClientRequestExecute(string names, Action<Client, Vector2, string[]> onClientRequestExecute)
public static void AssignOnClientRequestExecute(string names, Action<Client, Vector2, string[]> onClientRequestExecute)
{
var matchingCommand = commands.Find(c => c.Names.Intersect(names.Split('|').ToIdentifiers()).Any());
if (matchingCommand == null)
@@ -733,7 +735,7 @@ namespace Barotrauma
revokedCommands.Add(matchingCommand);
}
}
}
}
client.SetPermissions(client.Permissions, client.PermittedConsoleCommands.Except(revokedCommands).ToList());
GameMain.Server.UpdateClientPermissions(client);
@@ -898,9 +900,9 @@ namespace Barotrauma
{
if (GameMain.Server?.KarmaManager == null) { return; }
GameMain.Server.KarmaManager.TestMode = !GameMain.Server.KarmaManager.TestMode;
NewMessage(GameMain.Server.KarmaManager.TestMode ?
NewMessage(GameMain.Server.KarmaManager.TestMode ?
$"Karma test mode enabled by {client.Name}." :
$"Karma test mode disabled by {client.Name}.",
$"Karma test mode disabled by {client.Name}.",
Color.LightGreen);
GameMain.Server.SendDirectChatMessage(
GameMain.Server.KarmaManager.TestMode ? "Karma test mode enabled." : "Karma test mode disabled.",
@@ -1250,7 +1252,7 @@ namespace Barotrauma
(Client client, Vector2 cursorPos, string[] args) =>
{
string text = string.Join(" ", args);
text = client.Name+": " + text;
text = client.Name + ": " + text;
if (GameMain.Server.OwnerConnection != null &&
client.Connection == GameMain.Server.OwnerConnection)
{
@@ -2733,6 +2735,19 @@ namespace Barotrauma
}
);
commands.Add(new Command("ShowServerPerf", "Immediately log server performance info in ServerMessage", (string[] args) =>
{
GameServer.Log(PerformanceMonitor.PM.ToString(), ServerLog.MessageType.ServerMessage);
}));
AssignOnClientRequestExecute(
"ShowServerPerf",
(senderClient, cursorWorldPos, args) =>
{
GameMain.Server.SendConsoleMessage(PerformanceMonitor.PM.ToString(), senderClient);
}
);
#if DEBUG
commands.Add(new Command("spamevents", "A debug command that creates a ton of entity events.", (string[] args) =>
{

View File

@@ -79,6 +79,15 @@ namespace Barotrauma
convAction.SelectedOption = selectedOption;
if (convAction.Options.Any() && !convAction.GetEndingOptions().Contains(selectedOption))
{
var option = convAction.Options[selectedOption];
if (option.ForceSay && sender.Character != null)
{
sender.Character.ForceSay(
option.ForceSayText.IsNullOrEmpty() ? TextManager.Get(option.Text).Fallback(option.Text) : TextManager.Get(option.ForceSayText).Fallback(option.ForceSayText),
option.ForceSayInRadio,
option.ForceSayRemoveQuotes);
}
foreach (Client c in convAction.TargetClients)
{
if (c == sender) { continue; }

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