1237 Commits

Author SHA1 Message Date
NotAlwaysTrue d4af393199 Modified create pre-release workflow 2025-12-23 09:02:48 +08:00
NotAlwaysTrue bbe4e95c17 Modified create pre-release workflow 2025-12-23 08:58:47 +08:00
NotAlwaysTrue 7fc21189c5 OBT-ReleaseVer 2025-12-23 08:36:40 +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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/b88cd0aad2c36a63e42c71f81cb1958fed95ac87...3c16e895bb662b4d7e284f032cbe8835a57773cc)

---
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](https://github.com/actions/upload-artifact/compare/0b2256b8c012f0828dc542b3febcab082c67f72b...834a144ee995460fba8ed112a2fc961b36a5ec5a)

---
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](https://github.com/actions/checkout/compare/a5ac7e51b41094c92402da3b24376905380afc29...692973e3d937129bcbf40652eb9f2f61becf3332)

---
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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/40e45e738b3cad2729f599d8afc6ed02184e1dbd...b88cd0aad2c36a63e42c71f81cb1958fed95ac87)

---
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](https://github.com/actions/upload-artifact/compare/65462800fd760344b1a7b4382951275a0abb4808...0b2256b8c012f0828dc542b3febcab082c67f72b)

---
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](https://github.com/actions/download-artifact/compare/65a9edc5881444af0b9093a5e628f2fe47ea3b2e...fa0a91b85d4f404e444e00e005971372dc801d16)

---
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](https://github.com/actions/setup-dotnet/compare/4d6c8fcf3c8f7a60068d26b594648e99df24cee3...6bd8b7f7774af54e05809fcc5431931b3eb1ddee)

---
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](https://github.com/actions/checkout/compare/9bb56186c3b09b4f86b1c65136769dd318469633...a5ac7e51b41094c92402da3b24376905380afc29)

---
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](https://github.com/dorny/test-reporter/compare/c40d89d5e987cd80f3a32b3c233556e22bdca958...31a54ee7ebcacc03a09ea97a7e5465a47b84aea5)

---
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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/19ebcb0babbd282ae1822a0b9c28f3f1f25cea45...40e45e738b3cad2729f599d8afc6ed02184e1dbd)

---
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](https://github.com/actions/download-artifact/compare/8caf195ad4b1dee92908e23f56eeb0696f1dd42d...65a9edc5881444af0b9093a5e628f2fe47ea3b2e)

---
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](https://github.com/actions/upload-artifact/compare/1746f4ab65b179e0ea60a494b83293b640dd5bba...65462800fd760344b1a7b4382951275a0abb4808)

---
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](https://github.com/actions/download-artifact/compare/c850b930e6ba138125429b7e5c93fc707a7f8427...8caf195ad4b1dee92908e23f56eeb0696f1dd42d)

---
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](https://github.com/actions/upload-artifact/compare/5d5d22a31266ced268874388b861e4b58bb5c2f3...1746f4ab65b179e0ea60a494b83293b640dd5bba)

---
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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/ba37328d4ea95eaf8b3bd6c6cef308f709a5f2ec...19ebcb0babbd282ae1822a0b9c28f3f1f25cea45)

---
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](https://github.com/peaceiris/actions-gh-pages/compare/373f7f263a76c20808c831209c920827a82a2847...4f9cc6602d3f66b9c108549d475ec49e8ef4d45e)

---
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](https://github.com/dorny/test-reporter/compare/eaa763f6ffc21c7a37837f56cd5f9737f27fc6c8...c40d89d5e987cd80f3a32b3c233556e22bdca958)

---
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](https://github.com/actions/checkout/compare/b4ffde65f46336ab88eb53be808477a3936bae11...9bb56186c3b09b4f86b1c65136769dd318469633)

---
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](https://github.com/actions/download-artifact/compare/6b208ae046db98c579e8a3aa621ab581ff575935...c850b930e6ba138125429b7e5c93fc707a7f8427)

---
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](https://github.com/actions/upload-artifact/compare/26f96dfa697d77e81fd5907df203aa23a56210a8...5d5d22a31266ced268874388b861e4b58bb5c2f3)

---
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](https://github.com/actions/download-artifact/compare/f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110...6b208ae046db98c579e8a3aa621ab581ff575935)

---
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](https://github.com/actions/upload-artifact/compare/c7d193f32edcb7bfad88892161225aeda64e9392...26f96dfa697d77e81fd5907df203aa23a56210a8)

---
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](https://github.com/dorny/test-reporter/compare/afe6793191b75b608954023a46831a3fe10048d4...eaa763f6ffc21c7a37837f56cd5f9737f27fc6c8)

---
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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/b1b635d24259e8a047a6ce7d6501ea432aa7a830...ba37328d4ea95eaf8b3bd6c6cef308f709a5f2ec)

---
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](https://github.com/actions/upload-artifact/compare/a8a3f3ad30e3422c9c7b888a15615d19a852ae32...c7d193f32edcb7bfad88892161225aeda64e9392)

---
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](https://github.com/actions/download-artifact/compare/9bc31d5ccc31df68ecc42ccf4149144866c47d8a...f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110)

---
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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/b35f285b9bb7e80de0967367cee66d3b6d50ceca...b1b635d24259e8a047a6ce7d6501ea432aa7a830)

---
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](https://github.com/actions/github-script/compare/d7906e4ad0b1822421a7e6a35d5ca353c962f410...60a0d83039c74a4aee543508d2ffcb1c3799cdea)

---
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](https://github.com/actions/setup-dotnet/compare/3447fd6a9f9e57506b15f895c5b76d3b197dc7c2...4d6c8fcf3c8f7a60068d26b594648e99df24cee3)

---
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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/f32435541e24cd6a4700a7f52bb2ec59e80603b1...b35f285b9bb7e80de0967367cee66d3b6d50ceca)

---
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](https://github.com/actions/checkout/compare/8ade135a41bc03ea155e62e844d188df1ea18608...b4ffde65f46336ab88eb53be808477a3936bae11)

---
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](https://github.com/actions/upload-artifact/compare/0b7f8abb1508181956e8e162db84b466c27e18ce...a8a3f3ad30e3422c9c7b888a15615d19a852ae32)

---
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](https://github.com/actions/checkout/compare/c85c95e3d7251135ab7dc9ce3241c5835cc595a9...8ade135a41bc03ea155e62e844d188df1ea18608)

---
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](https://github.com/dorny/test-reporter/compare/c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226...afe6793191b75b608954023a46831a3fe10048d4)

---
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](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/compare/555a30da2656b4a7cf47b107800bef097723363e...f32435541e24cd6a4700a7f52bb2ec59e80603b1)

---
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](https://github.com/notpeelz/action-gh-create-release/compare/a12edfc71daf5daa7922b931c28e2bf88d3b2ced...c1bebd17c8a128e8db4165a68be4dc4e3f106ff1)

---
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](https://github.com/actions/checkout/compare/8e5e7e5ab8b370d6c329ec480221332ada57f0ab...c85c95e3d7251135ab7dc9ce3241c5835cc595a9)

---
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](https://github.com/actions/setup-dotnet/compare/aa983c550dfda0d1722b6ac6aed55724ffacc6d3...3447fd6a9f9e57506b15f895c5b76d3b197dc7c2)

---
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](https://github.com/notpeelz/action-gh-create-release/compare/35fc26709d3cf4b5ebde1981f8f9d32012e1ba55...a12edfc71daf5daa7922b931c28e2bf88d3b2ced)

---
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](https://github.com/notpeelz/action-gh-create-release/compare/a3caaff31cdf1022430c5a95689330ed83de62f2...35fc26709d3cf4b5ebde1981f8f9d32012e1ba55)

---
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](https://github.com/actions/setup-dotnet/compare/607fce577a46308457984d59e4954e075820f10a...aa983c550dfda0d1722b6ac6aed55724ffacc6d3)

---
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
291 changed files with 31286 additions and 992 deletions
+37 -2
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
+101 -5
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
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
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
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 != 'OBT-Release' }}
run: |
echo "::error::this workflow can only be run on the \"OBT-Release\" 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/OBT-Release",
});
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: true
uses: ./.github/workflows/publish-release.yml
with:
target: ${{ needs.check-if-release-needed.outputs.latest-commit-sha }}
tag: nightly
prerelease: true
+21
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
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
@@ -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
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 }}
@@ -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 }}
+214
View File
@@ -0,0 +1,214 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish release
on:
workflow_dispatch:
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:client:Windows/Client
windows:server:Windows/Server
linux:client:Linux/Client
linux:server:Linux/Server
mac:client:Mac/Client/Barotrauma.app/Contents/MacOS
mac:server:Mac/Server
ARCHIVE_BASE_NAME: luacsforbarotrauma
# 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
Microsoft.CodeAnalysis.CSharp.Scripting.dll
Microsoft.CodeAnalysis.CSharp.dll
Microsoft.CodeAnalysis.dll
Microsoft.CodeAnalysis.Scripting.dll
System.Collections.Immutable.dll
System.Reflection.Metadata.dll
System.Runtime.CompilerServices.Unsafe.dll
mscordaccore_amd64_amd64_*
Lua
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
+27
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
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
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
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
+2
View File
@@ -16,6 +16,7 @@ bld/
[Dd]ebugLinux/
[Rr]eleaseLinux/
*.o
*/Barotrauma*/doc/
# Misc vs crap
*.v12.suo
@@ -58,3 +59,4 @@ Deploy/DeployAll/PrivateKey.*
#Rider
*.DotSettings.user
.vscode/settings.json
+6
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
@@ -222,6 +222,8 @@ namespace Barotrauma
private static bool IsCommandPermitted(Identifier command, GameClient client)
{
if (GameMain.LuaCs.Game.IsCustomCommandPermitted(command)) { return true; }
switch (command.Value.ToLowerInvariant())
{
case "kick":
@@ -657,6 +659,14 @@ namespace Barotrauma
return;
}
bool luaCsEnabled = true;
if (args.Length > 3)
{
bool.TryParse(args[3], out luaCsEnabled);
}
if (luaCsEnabled) { GameMain.LuaCs.Initialize(); }
GameMain.MainMenuScreen.QuickStart(fixedSeed: false, subName, difficulty, levelGenerationParams);
}, getValidArgs: () => new[] { SubmarineInfo.SavedSubmarines.Select(s => s.Name).Distinct().OrderBy(s => s).ToArray() }));
@@ -4214,7 +4224,46 @@ namespace Barotrauma
}
});
commands.Add(new Command("cl_lua", $"cl_lua: Runs a string on the client.", (string[] args) =>
{
if (GameMain.Client != null && !GameMain.Client.HasPermission(ClientPermissions.ConsoleCommands))
{
ThrowError("Command not permitted.");
return;
}
if (GameMain.LuaCs.Lua == null)
{
ThrowError("LuaCs not initialized, use the console command cl_reloadluacs to force initialization.");
return;
}
try
{
GameMain.LuaCs.Lua.DoString(string.Join(" ", args));
}
catch(Exception ex)
{
LuaCsLogger.HandleException(ex, LuaCsMessageOrigin.LuaMod);
}
}));
commands.Add(new Command("cl_reloadlua|cl_reloadcs|cl_reloadluacs", "Re-initializes the LuaCs environment.", (string[] args) =>
{
GameMain.LuaCs.Initialize();
}));
commands.Add(new Command("cl_toggleluadebug", "Toggles the MoonSharp Debug Server.", (string[] args) =>
{
int port = 41912;
if (args.Length > 0)
{
int.TryParse(args[0], out port);
}
GameMain.LuaCs.ToggleDebugger(port);
}));
}
@@ -411,6 +411,12 @@ namespace Barotrauma
public void AddMessage(ChatMessage message)
{
if (GameMain.IsSingleplayer)
{
var should = GameMain.LuaCs.Hook.Call<bool?>("chatMessage", message.Text, message.SenderClient, message.Type, message);
if (should != null && should.Value) { return; }
}
while (chatBox.Content.CountChildren > 60)
{
chatBox.RemoveChild(chatBox.Content.Children.First());
@@ -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; }
@@ -23,6 +23,7 @@ namespace Barotrauma
{
class GameMain : Game
{
public static LuaCsSetup LuaCs;
public static bool ShowFPS;
public static bool ShowPerf;
public static bool DebugDraw;
@@ -243,6 +244,8 @@ namespace Barotrauma
throw new Exception("Content folder not found. If you are trying to compile the game from the source code and own a legal copy of the game, you can copy the Content folder from the game's files to BarotraumaShared/Content.");
}
LuaCs = new LuaCsSetup();
GameSettings.Init();
CreatureMetrics.Init();
@@ -633,6 +636,9 @@ namespace Barotrauma
HasLoaded = true;
log("LOADING COROUTINE FINISHED");
#if CLIENT
LuaCsInstaller.CheckUpdate();
#endif
contentLoaded = true;
while (postContentLoadActions.TryDequeue(out Action action))
@@ -980,6 +986,8 @@ namespace Barotrauma
Screen.Selected.AddToGUIUpdateList();
LuaCsLogger.AddToGUIUpdateList();
Client?.AddToGUIUpdateList();
SubmarinePreview.AddToGUIUpdateList();
@@ -1046,6 +1054,8 @@ namespace Barotrauma
SoundManager?.Update();
GameMain.LuaCs.Update();
Timing.Accumulator -= Timing.Step;
updateCount++;
@@ -1227,6 +1237,8 @@ namespace Barotrauma
GUIMessageBox.CloseAll();
MainMenuScreen.Select();
GameSession = null;
GameMain.LuaCs.Stop();
}
public void ShowBugReporter()
@@ -179,6 +179,8 @@ namespace Barotrauma.Tutorials
public void Start()
{
GameMain.LuaCs.CheckInitialize();
GameMain.Instance.ShowLoading(Loading());
ObjectiveManager.ResetObjectives();
@@ -0,0 +1,122 @@
using System;
using System.IO;
using System.Linq;
namespace Barotrauma
{
static partial class LuaCsInstaller
{
public static void Uninstall()
{
if (!File.Exists("Temp/Original/Barotrauma.dll"))
{
new GUIMessageBox("Error", "Error: Temp/Original/Barotrauma.dll not found, Github version? Use Steam validate files instead.");
return;
}
var msg = new GUIMessageBox("Confirm", "Are you sure you want to remove Client-Side LuaCs?", new LocalizedString[2] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
msg.Buttons[0].OnClicked = (GUIButton button, object obj) =>
{
msg.Close();
string[] filesToRemove = new string[]
{
"Barotrauma.dll", "Barotrauma.deps.json", "Barotrauma.pdb", "BarotraumaCore.dll", "BarotraumaCore.pdb",
"System.Reflection.Metadata.dll", "System.Collections.Immutable.dll",
"System.Runtime.CompilerServices.Unsafe.dll"
};
try
{
CreateMissingDirectory();
foreach (string file in filesToRemove)
{
File.Move(file, "Temp/ToDelete/" + file, true);
File.Move("Temp/Original/" + file, file, true);
}
}
catch (Exception e)
{
new GUIMessageBox("Error", $"{e} {e.InnerException} \nTry verifying files instead.");
return false;
}
new GUIMessageBox("Restart", "Restart your game to apply the changes. If the mod continues to stay active after the restart, try verifying games instead.");
return true;
};
msg.Buttons[1].OnClicked = (GUIButton button, object obj) =>
{
msg.Close();
return true;
};
}
public static void CheckUpdate()
{
if (!File.Exists(LuaCsSetup.VersionFile)) { return; }
ContentPackage luaPackage = LuaCsSetup.GetPackage(LuaCsSetup.LuaForBarotraumaId);
if (luaPackage == null) { return; }
string luaCsPath = Path.GetDirectoryName(luaPackage.Path);
string clientVersion = File.ReadAllText(LuaCsSetup.VersionFile);
string workshopVersion = luaPackage.ModVersion;
if (clientVersion == workshopVersion || File.Exists("debugsomething")) { return; }
var msg = new GUIMessageBox($"LuaCs Update", $"Your LuaCs client version is different from the version found in the LuaCsForBarotrauma workshop files. Do you want to update?\n\n Client Version: {clientVersion}\n Workshop Version: {workshopVersion}",
new LocalizedString[2] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
msg.Buttons[0].OnClicked = (GUIButton button, object obj) =>
{
string[] filesToUpdate = trackingFiles.Concat(Directory.EnumerateFiles(luaCsPath, "*.dll", SearchOption.AllDirectories)
.Where(s => s.Contains("mscordaccore_amd64_amd64")).Select(s => Path.GetFileName(s))).ToArray();
try
{
CreateMissingDirectory();
foreach (string file in filesToUpdate)
{
try
{
File.Move(file, "Temp/Old/" + file, true);
File.Copy(Path.Combine(luaCsPath, "Binary", file), file, true);
}
catch (Exception e)
{
DebugConsole.ThrowError($"Failed to update file {e}");
}
}
File.WriteAllText(LuaCsSetup.VersionFile, workshopVersion);
}
catch (Exception e)
{
new GUIMessageBox("Failed", $"Failed to update, error: {e}");
msg.Close();
return true;
}
new GUIMessageBox("Restart", $"LuaCs updated! Restart your game to apply the changes.");
msg.Close();
return true;
};
msg.Buttons[1].OnClicked = (GUIButton button, object obj) =>
{
msg.Close();
return true;
};
}
}
}
@@ -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;
}
}
}
@@ -0,0 +1,143 @@
using Barotrauma.Networking;
using System.Collections.Generic;
namespace Barotrauma
{
partial class LuaCsNetworking
{
private Dictionary<ushort, Queue<IReadMessage>> receiveQueue = new Dictionary<ushort, Queue<IReadMessage>>();
public void SendSyncMessage()
{
if (GameMain.Client == null) { return; }
WriteOnlyMessage message = new WriteOnlyMessage();
message.WriteByte((byte)ClientPacketHeader.LUA_NET_MESSAGE);
message.WriteByte((byte)LuaCsClientToServer.RequestAllIds);
GameMain.Client.ClientPeer.Send(message, DeliveryMethod.Reliable);
}
public void NetMessageReceived(IReadMessage netMessage, ServerPacketHeader header, Client client = null)
{
if (header != ServerPacketHeader.LUA_NET_MESSAGE)
{
GameMain.LuaCs.Hook.Call("netMessageReceived", netMessage, header, client);
return;
}
LuaCsServerToClient luaCsHeader = (LuaCsServerToClient)netMessage.ReadByte();
switch (luaCsHeader)
{
case LuaCsServerToClient.NetMessageString:
HandleNetMessageString(netMessage);
break;
case LuaCsServerToClient.NetMessageId:
HandleNetMessageId(netMessage);
break;
case LuaCsServerToClient.ReceiveIds:
ReadIds(netMessage);
break;
}
}
public IWriteMessage Start(string netMessageName)
{
var message = new WriteOnlyMessage();
message.WriteByte((byte)ClientPacketHeader.LUA_NET_MESSAGE);
if (stringToId.ContainsKey(netMessageName))
{
message.WriteByte((byte)LuaCsClientToServer.NetMessageId);
message.WriteUInt16(stringToId[netMessageName]);
}
else
{
message.WriteByte((byte)LuaCsClientToServer.NetMessageString);
message.WriteString(netMessageName);
}
return message;
}
public void Receive(string netMessageName, LuaCsAction callback)
{
RequestId(netMessageName);
netReceives[netMessageName] = callback;
}
public void RequestId(string netMessageName)
{
if (stringToId.ContainsKey(netMessageName)) { return; }
if (GameMain.Client == null) { return; }
WriteOnlyMessage message = new WriteOnlyMessage();
message.WriteByte((byte)ClientPacketHeader.LUA_NET_MESSAGE);
message.WriteByte((byte)LuaCsClientToServer.RequestSingleId);
message.WriteString(netMessageName);
Send(message, DeliveryMethod.Reliable);
}
public void Send(IWriteMessage netMessage, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable)
{
GameMain.Client.ClientPeer.Send(netMessage, deliveryMethod);
}
private void HandleNetMessageId(IReadMessage netMessage, Client client = null)
{
ushort id = netMessage.ReadUInt16();
if (idToString.ContainsKey(id))
{
string name = idToString[id];
HandleNetMessage(netMessage, name, client);
}
else
{
if (!receiveQueue.ContainsKey(id)) { receiveQueue[id] = new Queue<IReadMessage>(); }
receiveQueue[id].Enqueue(netMessage);
if (GameSettings.CurrentConfig.VerboseLogging)
{
LuaCsLogger.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 id = netMessage.ReadUInt16();
string name = netMessage.ReadString();
idToString[id] = name;
stringToId[name] = id;
if (!receiveQueue.ContainsKey(id))
{
continue;
}
while (receiveQueue[id].TryDequeue(out var queueMessage))
{
if (netReceives.ContainsKey(name))
{
netReceives[name](queueMessage, null);
}
}
}
}
}
}
@@ -0,0 +1,115 @@
using Microsoft.Xna.Framework;
namespace Barotrauma
{
static class LuaCsSettingsMenu
{
private static GUIFrame frame;
public static void Open(RectTransform rectTransform)
{
Close();
frame = new GUIFrame(new RectTransform(new Vector2(0.4f, 0.6f), rectTransform, Anchor.Center));
GUIListBox list = new GUIListBox(new RectTransform(new Vector2(0.95f, 0.95f), frame.RectTransform, Anchor.Center), false);
new GUITextBlock(new RectTransform(new Vector2(1f, 0.1f), list.Content.RectTransform), "LuaCs Settings", textAlignment: Alignment.Center);
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Enable CSharp Scripting")
{
Selected = GameMain.LuaCs.Config.EnableCsScripting,
ToolTip = "This enables CSharp Scripting for mods to use, WARNING: CSharp is NOT sandboxed, be careful with what mods you download.",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.EnableCsScripting = tick.Selected;
GameMain.LuaCs.WriteSettings();
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Treat Forced Mods As Normal")
{
Selected = GameMain.LuaCs.Config.TreatForcedModsAsNormal,
ToolTip = "This makes mods that were setup to run even when disabled to only run when enabled.",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.TreatForcedModsAsNormal = tick.Selected;
GameMain.LuaCs.WriteSettings();
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Prefer To Use Workshop Lua Setup")
{
Selected = GameMain.LuaCs.Config.PreferToUseWorkshopLuaSetup,
ToolTip = "This makes Lua look first for the Lua/LuaSetup.lua located in the Workshop package instead of the one located locally.",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.PreferToUseWorkshopLuaSetup = tick.Selected;
GameMain.LuaCs.WriteSettings();
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Disable Error GUI Overlay")
{
Selected = GameMain.LuaCs.Config.DisableErrorGUIOverlay,
ToolTip = "",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.DisableErrorGUIOverlay = tick.Selected;
GameMain.LuaCs.WriteSettings();
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Hide usernames In Error Logs")
{
Selected = GameMain.LuaCs.Config.HideUserNames,
ToolTip = "Hides the operating system username when displaying error logs (eg your username on windows).",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.HideUserNames = tick.Selected;
GameMain.LuaCs.WriteSettings();
return true;
}
};
new GUIButton(new RectTransform(new Vector2(1f, 0.1f), list.Content.RectTransform), $"Remove Client-Side LuaCs", style: "GUIButtonSmall")
{
ToolTip = "Remove Client-Side LuaCs.",
OnClicked = (tb, userdata) =>
{
LuaCsInstaller.Uninstall();
return true;
}
};
new GUIButton(new RectTransform(new Vector2(0.8f, 0.01f), frame.RectTransform, Anchor.BottomCenter)
{
RelativeOffset = new Vector2(0f, 0.05f)
}, "Close")
{
OnClicked = (GUIButton button, object obj) =>
{
Close();
return true;
}
};
}
public static void Close()
{
frame?.Parent.RemoveChild(frame);
frame = null;
}
}
}
@@ -0,0 +1,75 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace Barotrauma
{
partial class LuaCsSetup
{
public void AddToGUIUpdateList()
{
if (!GameMain.LuaCs.Config.DisableErrorGUIOverlay)
{
LuaCsLogger.AddToGUIUpdateList();
}
}
public void CheckInitialize()
{
List<ContentPackage> csharpMods = new List<ContentPackage>();
foreach (ContentPackage cp in ContentPackageManager.EnabledPackages.All)
{
if (Directory.Exists(cp.Dir + "/CSharp") || Directory.Exists(cp.Dir + "/bin"))
{
csharpMods.Add(cp);
}
}
if (csharpMods.Count == 0 || ShouldRunCs)
{
Initialize();
return;
}
StringBuilder sb = new StringBuilder();
foreach (ContentPackage cp in csharpMods)
{
if (cp.UgcId.TryUnwrap(out ContentPackageId id))
{
sb.AppendLine($"- {cp.Name} ({id})");
}
else
{
sb.AppendLine($"- {cp.Name} (Not On Workshop)");
}
}
if (GameMain.Client == null || GameMain.Client.IsServerOwner)
{
new GUIMessageBox("", $"You have CSharp mods enabled but don't have the CSharp Scripting enabled, those mods might not work, go to the Main Menu, click on LuaCs Settings and check Enable CSharp Scripting.\n\n{sb}");
Initialize();
return;
}
GUIMessageBox msg = new GUIMessageBox(
"Confirm",
$"This server has the following CSharp mods installed: \n{sb}\nDo you wish to run them? Cs mods are not sandboxed so make sure you trust these mods.",
new LocalizedString[2] { "Run", "Don't Run" });
msg.Buttons[0].OnClicked = (GUIButton button, object obj) =>
{
Initialize(true);
msg.Close();
return true;
};
msg.Buttons[1].OnClicked = (GUIButton button, object obj) =>
{
Initialize();
msg.Close();
return true;
};
}
}
}
@@ -284,7 +284,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;
@@ -603,6 +603,8 @@ namespace Barotrauma.Networking
{
ServerPacketHeader header = (ServerPacketHeader)inc.ReadByte();
GameMain.LuaCs.Networking.NetMessageReceived(inc, header);
if (roundInitStatus == RoundInitStatus.WaitingForStartGameFinalize
&& header is not (
ServerPacketHeader.STARTGAMEFINALIZE
@@ -2903,6 +2905,8 @@ namespace Barotrauma.Networking
public void Quit()
{
GameMain.LuaCs.Stop();
ClientPeer?.Close(PeerDisconnectPacket.WithReason(DisconnectReason.Disconnected));
GUIMessageBox.MessageBoxes.RemoveAll(c => c?.UserData is RoundSummary);
@@ -3002,6 +3006,9 @@ namespace Barotrauma.Networking
public override void AddChatMessage(ChatMessage message)
{
var should = GameMain.LuaCs.Hook.Call<bool?>("chatMessage", message.Text, message.SenderClient, message.Type, message);
if (should != null && should.Value) { return; }
if (string.IsNullOrEmpty(message.Text)) { return; }
if (message.SenderCharacter is { IsDead: false } sender)
{
@@ -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
@@ -495,6 +495,8 @@ namespace Barotrauma
allowInput = true;
}
GameMain.LuaCs.Hook.Call("keyUpdate", deltaTime);
oldMouseState = mouseState;
mouseState = latestMouseState;
UpdateVariable();
@@ -95,6 +95,7 @@ namespace Barotrauma
}
GameMain.GameSession?.AddToGUIUpdateList();
Character.AddAllToGUIUpdateList();
base.AddToGUIUpdateList();
}
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
@@ -531,6 +531,24 @@ namespace Barotrauma
}
};
#endif
new GUIButton(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopLeft) { AbsoluteOffset = new Point(40, 50) },
$"Open LuaCs Settings", style: "MainMenuGUIButton", color: GUIStyle.Red)
{
IgnoreLayoutGroups = true,
OnClicked = (tb, userdata) =>
{
LuaCsSettingsMenu.Open(Frame.RectTransform);
return true;
}
};
string version = File.Exists(LuaCsSetup.VersionFile) ? File.ReadAllText(LuaCsSetup.VersionFile) : "Github";
new GUITextBlock(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopLeft) { AbsoluteOffset = new Point(10, 10) }, $"Using LuaCsForBarotrauma revision {AssemblyInfo.GitRevision} version {version}", Color.Red)
{
IgnoreLayoutGroups = false
};
var minButtonSize = new Point(120, 20);
var maxButtonSize = new Point(480, 80);
@@ -685,6 +703,8 @@ namespace Barotrauma
#region Selection
public override void Select()
{
GameMain.LuaCs.Stop();
ResetModUpdateButton();
if (WorkshopItemsToUpdate.Any())
@@ -1294,6 +1314,8 @@ namespace Barotrauma
return;
}
GameMain.LuaCs.CheckInitialize();
selectedSub = new SubmarineInfo(Path.Combine(SaveUtil.TempPath, selectedSub.Name + ".sub"));
GameMain.GameSession = new GameSession(selectedSub, Option.None, CampaignDataPath.CreateRegular(savePath), GameModePreset.SinglePlayerCampaign, settings, mapSeed);
@@ -1309,6 +1331,8 @@ namespace Barotrauma
{
if (string.IsNullOrWhiteSpace(path)) return;
GameMain.LuaCs.CheckInitialize();
try
{
CampaignDataPath dataPath =
@@ -118,6 +118,7 @@ namespace Barotrauma
ContentPackageManager.EnabledPackages.SetRegular(regularPackages);
}
GameMain.NetLobbyScreen.Select();
GameMain.LuaCs.CheckInitialize();
return;
}
@@ -378,6 +379,7 @@ namespace Barotrauma
}
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, GameMain.Client.ServerSubmarines);
GameMain.NetLobbyScreen.Select();
GameMain.LuaCs.CheckInitialize();
}
}
else if (GameMain.Client.FileReceiver.ActiveTransfers.None())
@@ -1531,6 +1531,8 @@ namespace Barotrauma
public override void Select()
{
Select(enableAutoSave: true);
GameMain.LuaCs.CheckInitialize();
}
public void Select(bool enableAutoSave = true)
@@ -211,4 +211,9 @@
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
</Project>
@@ -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>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -215,4 +216,9 @@
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
</Project>
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
@@ -243,4 +243,9 @@
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
</Project>
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@@ -55,7 +55,7 @@
</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" />
@@ -157,4 +157,8 @@
</PropertyGroup>
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
</Project>
+5 -1
View File
@@ -59,7 +59,7 @@
</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" />
@@ -162,4 +162,8 @@
</PropertyGroup>
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
</Project>
@@ -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 (!GameMain.LuaCs.Game.overrideTraitors)
{
GameMain.Server.SendDirectChatMessage(TextManager.FormatServerMessage("KilledByTraitorNotification"), owner, ChatMessageType.ServerMessageBoxInGame);
}
}
}
foreach (Client client in GameMain.Server.ConnectedClients)
@@ -320,7 +320,11 @@ namespace Barotrauma
if (TalentTree.IsViableTalentForCharacter(this, prefab.Identifier, talentSelection))
{
GiveTalent(prefab.Identifier);
bool? should = GameMain.LuaCs.Hook.Call<bool?>("character.updateTalent", this, prefab, c);
if (should == null)
{
GiveTalent(prefab.Identifier);
}
talentSelection.Add(prefab.Identifier);
}
}
@@ -811,7 +815,7 @@ namespace Barotrauma
var tempBuffer = new ReadWriteMessage();
WriteStatus(tempBuffer, forceAfflictionData: true);
if (msgLengthBeforeStatus + tempBuffer.LengthBytes >= 255 && restrictMessageSize)
if (msgLengthBeforeStatus + tempBuffer.LengthBytes >= 255 && restrictMessageSize && GameMain.LuaCs.Networking.RestrictMessageSize)
{
msg.WriteBoolean(false);
if (msgLengthBeforeStatus < 255)
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using Barotrauma.Steam;
@@ -313,7 +314,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)
@@ -1250,7 +1251,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)
{
@@ -1286,6 +1287,41 @@ namespace Barotrauma
GameMain.NetLobbyScreen.LevelSeed = string.Join(" ", args);
}));
commands.Add(new Command("lua", "lua: Runs a string.", (string[] args) =>
{
try
{
GameMain.LuaCs.Lua.DoString(string.Join(" ", args));
}
catch (Exception ex)
{
LuaCsLogger.HandleException(ex, LuaCsMessageOrigin.LuaMod);
}
}));
commands.Add(new Command("reloadlua|reloadcs|reloadluacs", "Re-initializes the LuaCs environment.", (string[] args) =>
{
GameMain.LuaCs.Initialize();
}));
commands.Add(new Command("toggleluadebug", "Toggles the MoonSharp Debug Server.", (string[] args) =>
{
int port = 41912;
if (args.Length > 0)
{
int.TryParse(args[0], out port);
}
GameMain.LuaCs.ToggleDebugger(port);
}));
#if DEBUG
commands.Add(new Command("install_cl_lua|install_cl|install_cl_cs|install_cl_luacs", "Installs Client-Side LuaCs into your client.", (string[] args) =>
{
LuaCsInstaller.Install();
}));
#endif
commands.Add(new Command("randomizeseed", "randomizeseed: Toggles level seed randomization on/off.", (string[] args) =>
{
GameMain.Server.ServerSettings.RandomizeSeed = !GameMain.Server.ServerSettings.RandomizeSeed;
@@ -2733,6 +2769,12 @@ namespace Barotrauma
}
);
commands.Add(new Command("ShowServerPerf", "Immediately log server performance info in ServerMessage", (string[] args) =>
{
GameServer.Log(PerformenceMonitor.PM.ToString(), ServerLog.MessageType.ServerMessage);
NewMessage(PerformenceMonitor.PM.ToString(), Color.Green);
}));
#if DEBUG
commands.Add(new Command("spamevents", "A debug command that creates a ton of entity events.", (string[] args) =>
{
@@ -10,7 +10,10 @@ using System.Linq;
using System.Reflection;
using System.Threading;
using System.Xml.Linq;
using MoonSharp.Interpreter;
using System.Net;
using Barotrauma.Extensions;
using System.Threading.Tasks;
namespace Barotrauma
{
@@ -32,6 +35,8 @@ namespace Barotrauma
set { world = value; }
}
public static LuaCsSetup LuaCs;
public static GameServer Server;
public static NetworkMember NetworkMember
{
@@ -126,6 +131,8 @@ namespace Barotrauma
NetLobbyScreen = new NetLobbyScreen();
CheckContentPackage();
LuaCs = new LuaCsSetup();
}
@@ -152,6 +159,7 @@ namespace Barotrauma
int maxPlayers = 10;
Option<int> ownerKey = Option.None;
Option<P2PEndpoint> ownerEndpoint = Option.None;
IPAddress listenIp = IPAddress.Any;
XDocument doc = XMLExtensions.TryLoadXml(ServerSettings.SettingsFile);
if (doc?.Root == null)
@@ -187,6 +195,12 @@ namespace Barotrauma
name = CommandLineArgs[i + 1];
i++;
break;
case "-ip":
if (IPAddress.TryParse(CommandLineArgs[i + 1], out IPAddress address))
listenIp = address;
else
DebugConsole.ThrowError($"Invalid Ip Address '{CommandLineArgs[i + 1]}'.");
break;
case "-port":
int.TryParse(CommandLineArgs[i + 1], out port);
i++;
@@ -235,6 +249,7 @@ namespace Barotrauma
Server = new GameServer(
name,
listenIp,
port,
queryPort,
publiclyVisible,
@@ -313,8 +328,10 @@ namespace Barotrauma
}
Stopwatch performanceCounterTimer = Stopwatch.StartNew();
stopwatch = Stopwatch.StartNew();
PerformenceMonitor PM = new PerformenceMonitor();
long prevTicks = stopwatch.ElapsedTicks;
while (ShouldRun)
{
@@ -334,6 +351,8 @@ namespace Barotrauma
prevTicks = currTicks;
while (Timing.Accumulator >= Timing.Step)
{
performanceCounterTimer.Start();
Timing.TotalTime += Timing.Step;
Timing.TotalTimeUnpaused += Timing.Step;
DebugConsole.Update();
@@ -348,8 +367,17 @@ namespace Barotrauma
TaskPool.Update();
CoroutineManager.Update(paused: false, (float)Timing.Step);
GameMain.LuaCs.Update();
performanceCounterTimer.Stop();
if (GameMain.LuaCs.PerformanceCounter.EnablePerformanceCounter)
{
GameMain.LuaCs.PerformanceCounter.UpdateElapsedTime = (double)performanceCounterTimer.ElapsedTicks / Stopwatch.Frequency;
}
performanceCounterTimer.Reset();
Timing.Accumulator -= Timing.Step;
updateCount++;
PM.Update();
}
#if !DEBUG
@@ -397,6 +425,9 @@ namespace Barotrauma
updateCount = 0;
}
}
PerformenceMonitor.PM.Dispose();
stopwatch.Stop();
CloseServer();
@@ -428,6 +459,7 @@ namespace Barotrauma
public void Exit()
{
ShouldRun = false;
GameMain.LuaCs.Stop();
}
}
}
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Barotrauma.Networking
{
partial class Client
{
public void SetClientCharacter(Character character)
{
GameMain.Server.SetClientCharacter(this, character);
}
public void Kick(string reason = "")
{
GameMain.Server.KickClient(this.Connection, reason);
}
public void Ban(string reason = "", float seconds = -1)
{
if (seconds == -1)
{
GameMain.Server.BanClient(this, reason, null);
}
else
{
GameMain.Server.BanClient(this, reason, TimeSpan.FromSeconds(seconds));
}
}
public static void UnbanPlayer(string playerName)
{
GameMain.Server.UnbanPlayer(playerName);
}
public static void BanPlayer(string player, string reason, bool range = false, float seconds = -1)
{
if (seconds == -1)
{
GameMain.Server.BanPlayer(player, reason, null);
}
else
{
GameMain.Server.BanPlayer(player, reason, TimeSpan.FromSeconds(seconds));
}
}
public bool CheckPermission(ClientPermissions permissions)
{
return this.Permissions.HasFlag(permissions);
}
}
}
namespace Barotrauma
{
using Microsoft.Xna.Framework;
using System.Reflection;
partial class Item
{
public object CreateServerEventString(string component)
{
var comp = GetComponentString(component);
if (comp == null)
return null;
MethodInfo method = typeof(Item).GetMethod(nameof(Item.CreateServerEvent), new Type[]{ Type.MakeGenericMethodParameter(0) });
MethodInfo generic = method.MakeGenericMethod(comp.GetType());
return generic.Invoke(this, new object[]{ comp });
}
public object CreateServerEventString(string component, object[] extraData)
{
var comp = GetComponentString(component);
if (comp == null)
return null;
MethodInfo method = typeof(Item).GetMethod(nameof(Item.CreateServerEvent), new Type[]{ Type.MakeGenericMethodParameter(0), typeof(object[]) });
MethodInfo generic = method.MakeGenericMethod(comp.GetType());
return generic.Invoke(this, new object[]{comp, extraData });
}
}
}
namespace Barotrauma.Items.Components
{
using Barotrauma.Networking;
partial struct Signal
{
public static Signal Create(string value, int stepsTaken = 0, Character sender = null, Item source = null, float power = 0.0f, float strength = 1.0f)
{
return new Signal(value, stepsTaken, sender, source, power, strength);
}
}
partial class Quality
{
public void SetValue(StatType statType, float value)
{
statValues[statType] = value;
}
}
}
@@ -0,0 +1,70 @@
using Barotrauma.Networking;
using System;
using System.IO;
using System.Linq;
namespace Barotrauma
{
static partial class LuaCsInstaller
{
public static void Install()
{
ContentPackage luaPackage = LuaCsSetup.GetPackage(LuaCsSetup.LuaForBarotraumaId);
if (luaPackage == null)
{
GameMain.Server.SendChatMessage("Couldn't find the LuaCs For Barotrauma package.", ChatMessageType.ServerMessageBox);
return;
}
try
{
string path = Path.GetDirectoryName(luaPackage.Path);
string[] filesToCopy = trackingFiles.Concat(Directory.EnumerateFiles(path, "*.dll", SearchOption.AllDirectories)
.Where(s => s.Contains("mscordaccore_amd64_amd64")).Select(s => Path.GetFileName(s))).ToArray();
CreateMissingDirectory();
File.Move("Barotrauma.dll", "Temp/Original/Barotrauma.dll", true);
File.Move("Barotrauma.deps.json", "Temp/Original/Barotrauma.deps.json", true);
File.Move("Barotrauma.pdb", "Temp/Original/Barotrauma.pdb", true);
File.Move("BarotraumaCore.dll", "Temp/Original/BarotraumaCore.dll", true);
File.Move("BarotraumaCore.pdb", "Temp/Original/BarotraumaCore.pdb", true);
File.Move("System.Reflection.Metadata.dll", "Temp/Original/System.Reflection.Metadata.dll", true);
File.Move("System.Collections.Immutable.dll", "Temp/Original/System.Collections.Immutable.dll", true);
File.Move("System.Runtime.CompilerServices.Unsafe.dll", "Temp/Original/System.Runtime.CompilerServices.Unsafe.dll", true);
foreach (string file in filesToCopy)
{
if (File.Exists(file))
{
File.Move(file, "Temp/ToDelete/" + file, true);
}
File.Copy(Path.Combine(path, "Binary", file), file, true);
}
File.WriteAllText(LuaCsSetup.VersionFile, luaPackage.ModVersion);
#if WINDOWS
File.WriteAllText("LuaCsDedicatedServer.bat", "\"%LocalAppData%/Daedalic Entertainment GmbH/Barotrauma/WorkshopMods/Installed/2559634234/Binary/DedicatedServer.exe\"");
#endif
}
catch (UnauthorizedAccessException e)
{
LuaCsLogger.LogError($"Unauthorized file access exception. This usually means you already have LuaCs installed. ${e}", LuaCsMessageOrigin.LuaCs);
return;
}
catch (Exception e)
{
LuaCsLogger.HandleException(e, LuaCsMessageOrigin.LuaCs);
return;
}
GameMain.Server.SendChatMessage("Client-Side LuaCs installed, restart your game to apply changes.", ChatMessageType.ServerMessageBox);
}
}
}
@@ -0,0 +1,194 @@
using Barotrauma.Networking;
using System.Collections.Generic;
using System.Linq;
namespace Barotrauma
{
partial class LuaCsNetworking
{
private const int MaxRegisterPerClient = 1000;
private Dictionary<string, int> clientRegisterCount = new Dictionary<string, int>();
private ushort currentId = 0;
public void NetMessageReceived(IReadMessage netMessage, ClientPacketHeader header, Client client = null)
{
if (header != ClientPacketHeader.LUA_NET_MESSAGE)
{
GameMain.LuaCs.Hook.Call("netMessageReceived", netMessage, header, client);
return;
}
LuaCsClientToServer luaCsHeader = (LuaCsClientToServer)netMessage.ReadByte();
switch (luaCsHeader)
{
case LuaCsClientToServer.NetMessageString:
HandleNetMessageString(netMessage, client);
break;
case LuaCsClientToServer.NetMessageId:
HandleNetMessageId(netMessage, client);
break;
case LuaCsClientToServer.RequestAllIds:
WriteAllIds(client);
break;
case LuaCsClientToServer.RequestSingleId:
RequestIdSingle(netMessage, client);
break;
}
}
private void HandleNetMessageId(IReadMessage netMessage, Client client = null)
{
ushort id = netMessage.ReadUInt16();
if (idToString.ContainsKey(id))
{
string name = idToString[id];
HandleNetMessage(netMessage, name, client);
}
else
{
if (GameSettings.CurrentConfig.VerboseLogging)
{
LuaCsLogger.LogError($"Received NetMessage for unknown id {id} from {GameServer.ClientLogName(client)}.");
}
}
}
public IWriteMessage Start(string netMessageName)
{
var message = new WriteOnlyMessage();
message.WriteByte((byte)ServerPacketHeader.LUA_NET_MESSAGE);
if (stringToId.ContainsKey(netMessageName))
{
message.WriteByte((byte)LuaCsServerToClient.NetMessageId);
message.WriteUInt16(stringToId[netMessageName]);
}
else
{
message.WriteByte((byte)LuaCsServerToClient.NetMessageString);
message.WriteString(netMessageName);
}
return message;
}
public void Receive(string netMessageName, LuaCsAction callback)
{
RegisterId(netMessageName);
netReceives[netMessageName] = callback;
}
public ushort RegisterId(string name)
{
if (stringToId.ContainsKey(name))
{
return stringToId[name];
}
if (currentId >= ushort.MaxValue)
{
LuaCsLogger.LogError($"Tried to register more than {ushort.MaxValue} network ids!");
return 0;
}
currentId++;
idToString[currentId] = name;
stringToId[name] = currentId;
WriteIdToAll(currentId, name);
return currentId;
}
private void RequestIdSingle(IReadMessage netMessage, Client client)
{
string name = netMessage.ReadString();
if (!stringToId.ContainsKey(name) && client.AccountId.TryUnwrap(out AccountId id))
{
if (!clientRegisterCount.ContainsKey(id.StringRepresentation))
{
clientRegisterCount[id.StringRepresentation] = 0;
}
clientRegisterCount[id.StringRepresentation]++;
if (clientRegisterCount[id.StringRepresentation] > MaxRegisterPerClient)
{
LuaCsLogger.Log($"{GameServer.ClientLogName(client)} Tried to register more than {MaxRegisterPerClient} Ids!");
return;
}
}
RegisterId(name);
}
private void WriteIdToAll(ushort id, string name)
{
WriteOnlyMessage message = new WriteOnlyMessage();
message.WriteByte((byte)ServerPacketHeader.LUA_NET_MESSAGE);
message.WriteByte((byte)LuaCsServerToClient.ReceiveIds);
message.WriteUInt16(1);
message.WriteUInt16(id);
message.WriteString(name);
Send(message, null, DeliveryMethod.Reliable);
}
private void WriteAllIds(Client client)
{
WriteOnlyMessage message = new WriteOnlyMessage();
message.WriteByte((byte)ServerPacketHeader.LUA_NET_MESSAGE);
message.WriteByte((byte)LuaCsServerToClient.ReceiveIds);
message.WriteUInt16((ushort)idToString.Count());
foreach ((ushort id, string name) in idToString)
{
message.WriteUInt16(id);
message.WriteString(name);
}
Send(message, client.Connection, DeliveryMethod.Reliable);
}
public void ClientWriteLobby(Client client) => GameMain.Server.ClientWriteLobby(client);
public void Send(IWriteMessage netMessage, NetworkConnection connection = null, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable)
{
if (connection == null)
{
foreach (NetworkConnection conn in Client.ClientList.Select(c => c.Connection))
{
GameMain.Server.ServerPeer.Send(netMessage, conn, deliveryMethod);
}
}
else
{
GameMain.Server.ServerPeer.Send(netMessage, connection, deliveryMethod);
}
}
public void UpdateClientPermissions(Client client)
{
GameMain.Server.UpdateClientPermissions(client);
}
public int FileSenderMaxPacketsPerUpdate
{
get { return FileSender.FileTransferOut.MaxPacketsPerUpdate; }
set { FileSender.FileTransferOut.MaxPacketsPerUpdate = value; }
}
}
}
@@ -1,5 +1,6 @@
using System;
using System.Text;
using MoonSharp.Interpreter;
namespace Barotrauma.Networking
{
@@ -85,6 +86,13 @@ namespace Barotrauma.Networking
HandleSpamFilter(c, txt, out bool flaggedAsSpam, similarityMultiplier);
if (flaggedAsSpam) { return; }
var should = GameMain.LuaCs.Hook.Call<bool?>("chatMessage", txt, c, type);
if (should != null && should.Value)
{
return;
}
if (type == ChatMessageType.Order)
{
if (c.Character == null || c.Character.SpeechImpediment >= 100.0f || c.Character.IsDead) { return; }
@@ -127,6 +135,8 @@ namespace Barotrauma.Networking
{
GameMain.Server.SendChatMessage(txt, senderClient: c, chatMode: chatMode, type: type == ChatMessageType.Team ? type : null);
}
}
/// <summary>
@@ -197,7 +207,7 @@ namespace Barotrauma.Networking
int length = 1 + //(byte)ServerNetObject.CHAT_MESSAGE
2 + //(UInt16)NetStateID
1 + //(byte)Type
Encoding.UTF8.GetBytes(Text).Length + 2;
(Text == null ? 0 : Encoding.UTF8.GetBytes(Text).Length) + 2;
if (SenderClient != null)
{
@@ -52,7 +52,7 @@ namespace Barotrauma.Networking
}
}
public const int MaxPacketsPerUpdate = 10;
public static int MaxPacketsPerUpdate = 10;
public float PacketsPerUpdate { get; set; } = 1.0f;
public byte[] Data { get; }
@@ -11,6 +11,8 @@ using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using MoonSharp.Interpreter;
using System.Net;
using Barotrauma.PerkBehaviors;
namespace Barotrauma.Networking
@@ -168,6 +170,7 @@ namespace Barotrauma.Networking
public GameServer(
string name,
IPAddress listenIp,
int port,
int queryPort,
bool isPublic,
@@ -184,7 +187,7 @@ namespace Barotrauma.Networking
LastClientListUpdateID = 0;
ServerSettings = new ServerSettings(this, name, port, queryPort, maxPlayers, isPublic, attemptUPnP);
ServerSettings = new ServerSettings(this, name, port, queryPort, maxPlayers, isPublic, attemptUPnP, listenIp);
KarmaManager.SelectPreset(ServerSettings.KarmaPreset);
ServerSettings.SetPassword(password);
ServerSettings.SaveSettings();
@@ -242,6 +245,7 @@ namespace Barotrauma.Networking
VoipServer = new VoipServer(serverPeer);
GameMain.LuaCs.Initialize();
Log("Server started", ServerLog.MessageType.ServerMessage);
GameMain.NetLobbyScreen.Select();
@@ -335,6 +339,8 @@ namespace Barotrauma.Networking
SendConsoleMessage("Granted all permissions to " + newClient.Name + ".", newClient);
}
GameMain.LuaCs.Hook.Call("client.connected", newClient);
SendChatMessage($"ServerMessage.JoinedServer~[client]={ClientLogName(newClient)}", ChatMessageType.Server, changeType: PlayerConnectionChangeType.Joined);
ServerSettings.ServerDetailsChanged = true;
@@ -436,8 +442,11 @@ namespace Barotrauma.Networking
(permadeathMode && (!character.IsDead || character.CauseOfDeath?.Type == CauseOfDeathType.Disconnected)));
if (!character.IsDead)
{
character.KillDisconnectedTimer += deltaTime;
character.SetStun(1.0f);
if (!GameMain.LuaCs.Game.disableDisconnectCharacter)
{
character.KillDisconnectedTimer += deltaTime;
character.SetStun(1.0f);
}
float killTime = permadeathMode ? ServerSettings.DespawnDisconnectedPermadeathTime : ServerSettings.KillDisconnectedTime;
//owner decided to spectate -> kill the character immediately,
@@ -828,6 +837,9 @@ namespace Barotrauma.Networking
using var _ = dosProtection.Start(connectedClient);
ClientPacketHeader header = (ClientPacketHeader)inc.ReadByte();
GameMain.LuaCs.Networking.NetMessageReceived(inc, header, connectedClient);
switch (header)
{
case ClientPacketHeader.PING_RESPONSE:
@@ -1206,18 +1218,25 @@ namespace Barotrauma.Networking
errorLines.Add("");
errorLines.Add("EntitySpawner events:");
foreach (var entityEvent in entityEventManager.UniqueEvents)
try
{
if (entityEvent.Entity is EntitySpawner)
foreach (var entityEvent in entityEventManager.UniqueEvents.ToList())
{
var spawnData = entityEvent.Data as EntitySpawner.SpawnOrRemove;
errorLines.Add(
entityEvent.ID + ": " +
(spawnData is EntitySpawner.RemoveEntity ? "Remove " : "Create ") +
spawnData.Entity.ToString() +
" (" + spawnData.ID + ", " + spawnData.Entity.ID + ")");
if (entityEvent.Entity is EntitySpawner)
{
var spawnData = entityEvent.Data as EntitySpawner.SpawnOrRemove;
errorLines.Add(
entityEvent.ID + ": " +
(spawnData is EntitySpawner.RemoveEntity ? "Remove " : "Create ") +
spawnData.Entity.ToString() +
" (" + spawnData.ID + ", " + spawnData.Entity.ID + ")");
}
}
}
catch
{
errorLines.Add("Failed to write EntitySpawner events.");
}
errorLines.Add("");
errorLines.Add("Last debug messages:");
@@ -2293,6 +2312,7 @@ namespace Barotrauma.Networking
segmentTable.StartNewSegment(ServerNetSegment.ClientList);
outmsg.WriteUInt16(LastClientListUpdateID);
GameMain.LuaCs.Hook.Call("writeClientList", c, outmsg);
outmsg.WriteByte((byte)Team1Count);
outmsg.WriteByte((byte)Team2Count);
@@ -2319,12 +2339,19 @@ namespace Barotrauma.Networking
IsDownloading = FileSender.ActiveTransfers.Any(t => t.Connection == client.Connection)
};
var result = GameMain.LuaCs.Hook.Call<TempClient?>("writeClientList.modifyTempClientData", c, client, tempClientData, outmsg);
if (result != null)
{
tempClientData = result.Value;
}
outmsg.WriteNetSerializableStruct(tempClientData);
outmsg.WritePadBits();
}
}
private void ClientWriteLobby(Client c)
public void ClientWriteLobby(Client c)
{
bool isInitialUpdate = false;
@@ -3170,7 +3197,14 @@ namespace Barotrauma.Networking
}
TraitorManager.Initialize(GameMain.GameSession.EventManager, Level.Loaded);
TraitorManager.Enabled = Rand.Range(0.0f, 1.0f) < ServerSettings.TraitorProbability;
if (GameMain.LuaCs.Game.overrideTraitors)
{
TraitorManager.Enabled = false;
}
else
{
TraitorManager.Enabled = Rand.Range(0.0f, 1.0f) < ServerSettings.TraitorProbability;
}
GameAnalyticsManager.AddDesignEvent("Traitors:" + (TraitorManager == null ? "Disabled" : "Enabled"));
@@ -3192,6 +3226,8 @@ namespace Barotrauma.Networking
roundStartTime = DateTime.Now;
GameMain.LuaCs.Hook.Call("roundStart");
startGameCoroutine = null;
yield return CoroutineStatus.Success;
}
@@ -3364,6 +3400,15 @@ namespace Barotrauma.Networking
GameMain.GameSession.EndRound(endMessage);
}
TraitorManager.TraitorResults? traitorResults = traitorManager?.GetEndResults() ?? null;
var result = GameMain.LuaCs.Hook.Call<List<object>>("roundEnd");
if (result != null)
{
foreach (var data in result)
{
if (data is TraitorManager.TraitorResults traitorResultData) { traitorResults = traitorResultData; }
if (data is string endMessageData) { endMessage = endMessageData; }
}
}
EndRoundTimer = 0.0f;
@@ -3496,6 +3541,14 @@ namespace Barotrauma.Networking
return false;
}
var result = GameMain.LuaCs.Hook.Call<bool?>("tryChangeClientName", c, newName, newJob, newTeam);
if (result != null)
{
LastClientListUpdateID++;
return result.Value;
}
return TryChangeClientName(c, newName, clientRenamingSelf: true);
}
@@ -3692,6 +3745,8 @@ namespace Barotrauma.Networking
{
if (client == null) return;
GameMain.LuaCs.Hook.Call("client.disconnected", client);
if (client.Character != null)
{
client.Character.ClientDisconnected = true;
@@ -3940,13 +3995,21 @@ namespace Barotrauma.Networking
senderName = null;
senderCharacter = null;
}
else if (type == ChatMessageType.Radio)
else if (type == ChatMessageType.Radio && !GameMain.LuaCs.Game.overrideSignalRadio)
{
//send to chat-linked wifi components
Signal s = new Signal(message, sender: senderCharacter, source: senderRadio.Item);
senderRadio.TransmitSignal(s, sentFromChat: true);
}
var hookChatMsg = ChatMessage.Create(senderName, message, (ChatMessageType)type, senderCharacter, senderClient, changeType);
var should = GameMain.LuaCs.Hook.Call<bool?>("modifyChatMessage", hookChatMsg, senderRadio);
if (should != null && should.Value)
return;
//check which clients can receive the message and apply distance effects
foreach (Client client in ConnectedClients)
{
@@ -3983,6 +4046,7 @@ namespace Barotrauma.Networking
break;
}
var chatMsg = ChatMessage.Create(
senderName,
modifiedMessage,
@@ -4616,6 +4680,8 @@ namespace Barotrauma.Networking
$"No suitable jobs available for {c.Name} (karma {c.Karma}). Assigning a random job: {c.AssignedJob.Prefab.Name}.");
}
}
GameMain.LuaCs.Hook.Call("jobsAssigned", unassigned);
}
public void AssignBotJobs(List<CharacterInfo> bots, CharacterTeamType teamID, bool isPvP)
@@ -4746,6 +4812,8 @@ namespace Barotrauma.Networking
{
if (GameMain.Server == null || !GameMain.Server.ServerSettings.SaveServerLogs) { return; }
GameMain.LuaCs?.Hook?.Call("serverLog", line, messageType);
GameMain.Server.ServerSettings.ServerLog.WriteLine(line, messageType);
foreach (Client client in GameMain.Server.ConnectedClients)
@@ -1,8 +1,12 @@
using Barotrauma.Extensions;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using static Barotrauma.EosInterface.Ownership;
namespace Barotrauma.Networking
{
@@ -44,6 +48,8 @@ namespace Barotrauma.Networking
class ServerEntityEventManager : NetEntityEventManager
{
static public ServerEntityEventManager SEM;
private readonly List<ServerEntityEvent> events;
//list of unique events (i.e. !IsDuplicate) created during the round
@@ -102,6 +108,20 @@ namespace Barotrauma.Networking
private readonly GameServer server;
private double lastEventCountHighWarning;
private class PendingCreateEvent
{
public IServerSerializable Entity;
public NetEntityEvent.IData Data;
public PendingCreateEvent(IServerSerializable entity, NetEntityEvent.IData data)
{
Entity = entity;
Data = data;
}
}
private readonly ConcurrentQueue<PendingCreateEvent> pendingCreateQueue;
private readonly Task createEventTask;
public ServerEntityEventManager(GameServer server)
{
@@ -113,51 +133,86 @@ namespace Barotrauma.Networking
uniqueEvents = new List<ServerEntityEvent>();
pendingCreateQueue = new ConcurrentQueue<PendingCreateEvent>();
lastWarningTime = -10.0;
SEM = this;
createEventTask = Task.Run(async () => await CreateEventProcessorLoop());
}
private Task CreateEventProcessorLoop()
{
while (true)
{
ProcessPendingCreateEvents();
}
}
private void ProcessPendingCreateEvents()
{
// Dequeue and process all pending events currently in the queue.
// Use a lock to synchronize modifications to shared lists / ID.
while (pendingCreateQueue.TryDequeue(out PendingCreateEvent pending))
{
// The original CreateEvent logic (mostly unchanged) but executed under a lock
if (pending == null || pending.Entity == null) { continue; }
var entity = pending.Entity;
var extraData = pending.Data;
var newEvent = new ServerEntityEvent(entity, (UInt16)(ID + 1));
if (extraData != null) newEvent.SetData(extraData);
bool inGameClientsPresent = server.ConnectedClients.Count(c => c.InGame) > 0;
//remove old events that have been sent to all clients, they are redundant now
// keep at least one event in the list (lastSentToAll == e.ID) so we can use it to keep track of the latest ID
// and events less than 15 seconds old to give disconnected clients a bit of time to reconnect without getting desynced
if (GameMain.GameSession.RoundDuration > server.ServerSettings.RoundStartSyncDuration)
{
events.RemoveAll(e =>
(NetIdUtils.IdMoreRecent(lastSentToAll, e.ID) || !inGameClientsPresent) &&
e.CreateTime < Timing.TotalTime - server.ServerSettings.EventRemovalTime);
}
bool duplicateFound = false;
for (int i = events.Count - 1; i >= 0; i--)
{
//we already have an identical event that's waiting to be sent
// -> no need to add a new one
if (events[i].IsDuplicate(newEvent) && !events[i].Sent)
{
duplicateFound = true;
break;
}
}
if (duplicateFound) { continue; }
ID++;
events.Add(newEvent);
if (!uniqueEvents.Any(e => e.IsDuplicate(newEvent)))
{
//create a copy of the event and give it a new ID
var uniqueEvent = new ServerEntityEvent(entity, (UInt16)(uniqueEvents.Count + 1));
uniqueEvent.SetData(extraData);
uniqueEvents.Add(uniqueEvent);
}
}
}
public void CreateEvent(IServerSerializable entity, NetEntityEvent.IData extraData = null)
{
if (!ValidateEntity(entity)) { return; }
var newEvent = new ServerEntityEvent(entity, (UInt16)(ID + 1));
if (extraData != null) newEvent.SetData(extraData);
bool inGameClientsPresent = server.ConnectedClients.Count(c => c.InGame) > 0;
//remove old events that have been sent to all clients, they are redundant now
// keep at least one event in the list (lastSentToAll == e.ID) so we can use it to keep track of the latest ID
// and events less than 15 seconds old to give disconnected clients a bit of time to reconnect without getting desynced
if (GameMain.GameSession.RoundDuration > server.ServerSettings.RoundStartSyncDuration)
{
events.RemoveAll(e =>
(NetIdUtils.IdMoreRecent(lastSentToAll, e.ID) || !inGameClientsPresent) &&
e.CreateTime < Timing.TotalTime - server.ServerSettings.EventRemovalTime);
}
for (int i = events.Count - 1; i >= 0; i--)
{
//we already have an identical event that's waiting to be sent
// -> no need to add a new one
if (events[i].IsDuplicate(newEvent) && !events[i].Sent) return;
}
ID++;
events.Add(newEvent);
if (!uniqueEvents.Any(e => e.IsDuplicate(newEvent)))
{
//create a copy of the event and give it a new ID
var uniqueEvent = new ServerEntityEvent(entity, (UInt16)(uniqueEvents.Count + 1));
uniqueEvent.SetData(extraData);
uniqueEvents.Add(uniqueEvent);
}
// enqueue and let background task handle the rest
pendingCreateQueue.Enqueue(new PendingCreateEvent(entity, extraData));
}
public void Update(List<Client> clients)
{
foreach (BufferedEvent bufferedEvent in bufferedEvents)
{
if (bufferedEvent.Character == null || bufferedEvent.Character.IsDead)
@@ -251,15 +306,15 @@ namespace Barotrauma.Networking
NetIdUtils.IdMoreRecent((UInt16)(lastSentToAll + 1), c.LastRecvEntityEventID) &&
(firstEventToResend.CreateTime > c.MidRoundSyncTimeOut || lastSentToAnyoneTime > c.MidRoundSyncTimeOut || Timing.TotalTime > c.MidRoundSyncTimeOut + 10.0));
toKick.ForEach(c =>
{
DebugConsole.NewMessage(c.Name + " was kicked because they were expecting a very old network event (" + (c.LastRecvEntityEventID + 1).ToString() + ")", Color.Red);
GameServer.Log(GameServer.ClientLogName(c) + " was kicked because they were expecting a very old network event ("
+ (c.LastRecvEntityEventID + 1).ToString() +
" (created " + (Timing.TotalTime - firstEventToResend.CreateTime).ToString("0.##") + " s ago, " +
(lastSentToAnyoneTime - firstEventToResend.CreateTime).ToString("0.##") + " s older than last event sent to anyone)" +
" Events queued: " + events.Count + ", last sent to all: " + lastSentToAll, ServerLog.MessageType.Error);
server.DisconnectClient(c, PeerDisconnectPacket.WithReason(DisconnectReason.ExcessiveDesyncOldEvent));
}
{
DebugConsole.NewMessage(c.Name + " was kicked because they were expecting a very old network event (" + (c.LastRecvEntityEventID + 1).ToString() + ")", Color.Red);
GameServer.Log(GameServer.ClientLogName(c) + " was kicked because they were expecting a very old network event ("
+ (c.LastRecvEntityEventID + 1).ToString() +
" (created " + (Timing.TotalTime - firstEventToResend.CreateTime).ToString("0.##") + " s ago, " +
(lastSentToAnyoneTime - firstEventToResend.CreateTime).ToString("0.##") + " s older than last event sent to anyone)" +
" Events queued: " + events.Count + ", last sent to all: " + lastSentToAll, ServerLog.MessageType.Error);
server.DisconnectClient(c, PeerDisconnectPacket.WithReason(DisconnectReason.ExcessiveDesyncOldEvent));
}
);
}
@@ -30,7 +30,8 @@ namespace Barotrauma.Networking
MaximumConnections = NetConfig.MaxPlayers * 2,
EnableUPnP = serverSettings.EnableUPnP,
Port = serverSettings.Port,
DualStack = GameSettings.CurrentConfig.UseDualModeSockets
DualStack = GameSettings.CurrentConfig.UseDualModeSockets,
LocalAddress = serverSettings.ListenIPAddress,
};
netPeerConfiguration.DisableMessageType(
@@ -186,7 +187,16 @@ namespace Barotrauma.Networking
{
if (netServer == null) { return; }
if (connectedClients.Count >= serverSettings.MaxPlayers)
var skipDeny = false;
{
var result = GameMain.LuaCs.Hook.Call<bool?>("lidgren.handleConnection", inc);
if (result != null) {
if (result.Value) skipDeny = true;
else return;
}
}
if (!skipDeny && connectedClients.Count >= serverSettings.MaxPlayers)
{
inc.SenderConnection.Deny(PeerDisconnectPacket.WithReason(DisconnectReason.ServerFull).ToLidgrenStringRepresentation());
return;
@@ -33,7 +33,7 @@ namespace Barotrauma.Networking
contentPackages = contentPackageList.ToImmutableArray();
}
protected sealed class PendingClient
public sealed class PendingClient
{
public string? Name;
public Option<int> OwnerKey;
@@ -257,17 +257,22 @@ namespace Barotrauma.Networking
protected void UpdatePendingClient(PendingClient pendingClient)
{
var skipRemove = false;
var result = GameMain.LuaCs.Hook.Call<bool?>("handlePendingClient", pendingClient);
if (result != null) skipRemove = result.Value;
if (!skipRemove && connectedClients.Count >= serverSettings.MaxPlayers)
{
RemovePendingClient(pendingClient, PeerDisconnectPacket.WithReason(DisconnectReason.ServerFull));
}
if (IsPendingClientBanned(pendingClient, out string? banReason))
{
RemovePendingClient(pendingClient, PeerDisconnectPacket.Banned(banReason));
return;
}
if (connectedClients.Count >= serverSettings.MaxPlayers)
{
RemovePendingClient(pendingClient, PeerDisconnectPacket.WithReason(DisconnectReason.ServerFull));
}
if (pendingClient.InitializationStep == ConnectionInitialization.Success)
{
TConnection newConnection = pendingClient.Connection;
@@ -337,7 +342,7 @@ namespace Barotrauma.Networking
protected virtual void CheckOwnership(PendingClient pendingClient) { }
protected void RemovePendingClient(PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket)
public void RemovePendingClient(PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket)
{
if (pendingClients.Contains(pendingClient))
{
@@ -18,6 +18,9 @@ namespace Barotrauma.Networking
MultiPlayerCampaign campaign = GameMain.GameSession.GameMode as MultiPlayerCampaign;
foreach (Client c in networkMember.ConnectedClients)
{
if (GameMain.LuaCs.Game.overrideRespawnSub)
continue;
if (!c.InGame) { continue; }
if (c.SpectateOnly && (GameMain.Server.ServerSettings.AllowSpectating || GameMain.Server.OwnerConnection == c.Connection)) { continue; }
if (c.Character != null && !c.Character.IsDead) { continue; }
@@ -166,6 +169,10 @@ namespace Barotrauma.Networking
private bool ShouldStartRespawnCountdown(int characterToRespawnCount)
{
if (GameMain.LuaCs.Game.overrideRespawnSub)
{
characterToRespawnCount = 0;
}
return characterToRespawnCount >= GetMinCharactersToRespawn();
}
@@ -180,7 +187,7 @@ namespace Barotrauma.Networking
var teamId = teamSpecificState.TeamID;
var respawnShuttle = GetShuttle(teamId);
if (respawnShuttle != null)
if (respawnShuttle != null && !GameMain.LuaCs.Game.overrideRespawnSub)
{
respawnShuttle.Velocity = Vector2.Zero;
}
@@ -228,12 +235,19 @@ namespace Barotrauma.Networking
}
}
private void DispatchShuttle(TeamSpecificState teamSpecificState)
public void DispatchShuttle(TeamSpecificState teamSpecificState)
{
if (RespawnShuttles.Any())
{
ResetShuttle(teamSpecificState);
teamSpecificState.CurrentState = State.Transporting;
if (GameMain.LuaCs.Game.overrideRespawnSub)
{
teamSpecificState.CurrentState = State.Waiting;
}
else
{
teamSpecificState.CurrentState = State.Transporting;
}
GameMain.Server.CreateEntityEvent(this);
SetShuttleBodyType(teamSpecificState.TeamID, FarseerPhysics.BodyType.Dynamic);
}
@@ -522,6 +522,23 @@ namespace Barotrauma.Networking
DebugConsole.ThrowError("Error in " + ClientPermissionsFile + " - \"" + permissionsStr + "\" is not a valid client permission.");
continue;
}
if (permissions.HasFlag(Networking.ClientPermissions.ConsoleCommands))
{
foreach (XElement commandElement in clientElement.Elements())
{
if (!commandElement.Name.ToString().Equals("command", StringComparison.OrdinalIgnoreCase)) { continue; }
string commandName = commandElement.GetAttributeString("name", "");
DebugConsole.Command command = DebugConsole.FindCommand(commandName);
if (command == null)
{
command = new DebugConsole.Command(commandName, "", (_) => {}, null, true);
}
permittedCommands.Add(command);
}
}
}
else
{
@@ -9,7 +9,7 @@ namespace Barotrauma.Networking
{
private readonly ServerPeer netServer;
private readonly List<VoipQueue> queues;
private readonly Dictionary<VoipQueue,DateTime> lastSendTime;
private readonly Dictionary<VoipQueue, DateTime> lastSendTime;
public VoipServer(ServerPeer server)
{
@@ -96,6 +96,13 @@ namespace Barotrauma.Networking
ChatMessage.CanUseRadio(sender.Character, out WifiComponent senderRadio) &&
(recipientSpectating || ChatMessage.CanUseRadio(recipient.Character, out recipientRadio)))
{
var canUse = GameMain.LuaCs.Hook.Call<bool?>("canUseVoiceRadio", new object[] { sender, recipient });
if (canUse != null)
{
return canUse.Value;
}
if (recipientSpectating)
{
if (recipient.SpectatePos == null) { return true; }
@@ -109,6 +116,8 @@ namespace Barotrauma.Networking
}
}
float range = GameMain.LuaCs.Hook.Call<float?>("changeLocalVoiceRange", sender, recipient) ?? 1.0f;
if (recipientSpectating)
{
if (recipient.SpectatePos == null) { return true; }
@@ -120,7 +129,7 @@ namespace Barotrauma.Networking
//otherwise do a distance check
float garbleAmount = ChatMessage.GetGarbleAmount(recipient.Character, sender.Character, ChatMessage.SpeakRangeVOIP);
distanceFactor = garbleAmount;
return garbleAmount < 1.0f;
return garbleAmount < range;
}
}
@@ -0,0 +1,175 @@
using Barotrauma.Networking;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Barotrauma
{
public class PerformenceMonitor
{
static public PerformenceMonitor PM;
private Stopwatch PMStopwatch = new Stopwatch();
private double tickratetimer = 0;
private double tickrate60stimer = 0;
private static Queue<double> tickrate60s = new Queue<double>(61);
public int ItemCount
{
get{ return Item.ItemList.Count; }
}
public int CharacterCount
{
get { return Character.CharacterList.Count; }
}
public int PhysicsBodyCount
{
get { return PhysicsBody.List.Count; }
}
public double RealTickRate
{
get; set;
}
public long TotalTicks
{
get;set;
}
public int LastSecondTicks
{
get; set;
} = 0;
public float AverageTickRate
{
get
{
return TotalTicks / (float)TotalTimeElapsed * 1000;
}
}
public double AverageTickRate10s
{
get
{
return tickrate60s.Count > 0 ? tickrate60s.Average() : 60;
}
}
public double TotalTimeElapsed
{
get
{
return PMStopwatch.Elapsed.TotalMilliseconds;
}
}
public TimeSpan TimeElapsed
{
get
{
return TimeSpan.FromMilliseconds(TotalTimeElapsed);
}
}
public float MemoryUsage
{
get
{
Process proc = Process.GetCurrentProcess();
float memory = MathF.Round(proc.PrivateMemorySize64 / (1024 * 1024), 2);
proc.Dispose();
return memory;
}
}
public double TickRateLow
{
get; set;
}
public double TickRateHigh
{
get; set;
}
public PerformenceMonitor()
{
PM = this;
RealTickRate = 60;
TotalTicks = 0;
LastSecondTicks = 60;
TickRateLow = 60;
TickRateHigh = 60;
PMStopwatch.Start();
}
public void Update()
{
TotalTicks += 1;
LastSecondTicks += 1;
if (tickrate60s.Count > 60)
{
tickrate60s.Dequeue();
}
if (TotalTimeElapsed - 1000 >= tickratetimer)
{
RealTickRate = LastSecondTicks / (TotalTimeElapsed - tickratetimer) * 1000;
tickrate60s.Enqueue(RealTickRate);
tickratetimer = TotalTimeElapsed;
LastSecondTicks = 0;
}
if (TotalTimeElapsed - 60000 >= tickrate60stimer)
{
GameServer.Log(PM.ToString(), ServerLog.MessageType.ServerMessage);
TickRateLow = 60;
TickRateHigh = 60;
tickrate60stimer = TotalTimeElapsed;
}
if (RealTickRate > TickRateHigh)
{
TickRateHigh = RealTickRate;
}
if (RealTickRate < TickRateLow)
{
TickRateLow = RealTickRate;
}
}
public void Dispose()
{
PMStopwatch.Reset();
PM = null;
}
override public string ToString()
{
return $"Server Performence Info \n" +
$"Item Count: {ItemCount}\n" +
$"Character Count: {CharacterCount}\n" +
$"PhysicsBody Count: {PhysicsBodyCount}\n" +
$"Tick Rate: {RealTickRate}\n" +
$"Min Tick Rate: {TickRateLow}\n" +
$"Max Tick Rate: {TickRateHigh}\n" +
$"Total Ticks: {TotalTicks}\n" +
$"All time Average Tick Rate: {AverageTickRate}\n" +
$"60s Average Tick Rate: {AverageTickRate10s}\n" +
$"Server Run Time: {TimeElapsed}\n" +
$"Memory Usage: {MemoryUsage}\n";
}
}
}
@@ -76,7 +76,11 @@ namespace Barotrauma
}
string executableDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
Directory.SetCurrentDirectory(executableDir);
if (!File.Exists(Path.Combine(executableDir, "workshop.txt")))
{
Directory.SetCurrentDirectory(executableDir);
}
DebugConsoleCore.Init(
newMessage: (s, c) => DebugConsole.NewMessage(s, c),
log: DebugConsole.Log);
@@ -144,9 +144,14 @@ namespace Barotrauma
GameModes = GameModePreset.List.ToArray();
}
private readonly List<SubmarineInfo> subs;
private List<SubmarineInfo> subs;
public IReadOnlyList<SubmarineInfo> GetSubList() => subs;
public void AddSub(SubmarineInfo sub)
{
subs.Add(sub);
}
public string LevelSeed
{
get
@@ -18,7 +18,8 @@ namespace Barotrauma.Steam
{
GamePort = (ushort)server.Port,
QueryPort = isPublic ? (ushort)server.QueryPort : (ushort)0,
Mode = isPublic ? Steamworks.InitServerMode.Authentication : Steamworks.InitServerMode.NoAuthentication
Mode = isPublic ? Steamworks.InitServerMode.Authentication : Steamworks.InitServerMode.NoAuthentication,
IpAddress = server.ServerSettings.ListenIPAddress
};
//options.QueryShareGamePort();
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@@ -61,7 +61,7 @@
</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" />
@@ -164,4 +164,8 @@
</PropertyGroup>
<Import Project="../BarotraumaShared/DeployEosPrivate.props" />
<Import Project="../BarotraumaShared/Luatrauma.props" />
<ItemGroup>
<None Include="../BarotraumaShared/Luatrauma.props" />
</ItemGroup>
</Project>
@@ -1,154 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Items>
<Item name="[DebugOnlyTest]EXPLOSIONTESTSUIT" identifier="EXPLOSIONTESTSUIT" category="Diving,Equipment" tags="diving,deepdiving,human,respawnsuit" scale="0.5" fireproof="true" description="" allowdroppingonswapwith="diving" impactsoundtag="impact_metal_heavy" botpriority="3" cargocontaineridentifier="">
<Deconstruct time="1"/>
<InventoryIcon texture="Content/Items/InventoryIconAtlas2.png" sourcerect="0,832,128,128" origin="0.5,0.5" />
<Sprite name="Respawn Diving Suit Item" texture="Content/Items/Diving/RespawnSuit_Items.png" sourcerect="0,0,157,121" depth="0.55" origin="0.5,0.5" />
<ContainedSprite name="Respawn Diving Suit In Vertical Locker" allowedcontainertags="divingsuitcontainervertical" texture="Content/Items/Diving/RespawnSuit_Items.png" sourcerect="181,0,70,192" depth="0.55" origin="0.5,0.5" />
<ContainedSprite name="Respawn Diving Suit Behind Window" allowedcontainertags="divingsuitcontainerwindow" texture="Content/Items/Containers/containers.png" sourcerect="118,379,77,214" depth="0.55" origin="-0.12,-0.13" />
<ContainedSprite name="Respawn Diving Suit In Horizontal Locker" allowedcontainertags="divingsuitcontainerhorizontal" texture="Content/Items/Diving/RespawnSuit_Items.png" sourcerect="0,193,230,63" depth="0.55" origin="0.6,0.5" />
<Body radius="45" width="34" density="20" />
<Wearable slots="OuterClothes" msg="ItemMsgEquipSelect" displaycontainedstatus="true" canbeselected="false" canbepicked="true" pickkey="Select">
<sprite texture="Content/Items/Jobgear/headgears.png" limb="Head" inheritlimbdepth="true" inheritscale="true" ignorelimbscale="true" scale="0.65" hidelimb="false" alphaclipotherwearables="true" sourcerect="100,409,103,103" origin="0.5,0.5"/>
<sprite texture="RespawnSuit.png" limb="Torso" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightHand" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftHand" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightArm" depthlimb="RightForearm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftArm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightForearm" depthlimb="RightArm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftForearm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="Waist" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightThigh" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftThigh" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightLeg" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftLeg" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftFoot" sound="footstep_armor_heavy" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightFoot" sound="footstep_armor_heavy" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<damagemodifier armorsector="0.0,360.0" afflictionidentifiers="explosiondamage" damagemultiplier="0" damagesound="LimbArmor" deflectprojectiles="true" />
</Wearable>
<Holdable slots="RightHand+LeftHand" controlpose="true" holdpos="0,-50" handle1="-10,-20" handle2="10,-20" holdangle="45" msg="ItemMsgPickUpUse" canbeselected="false" canbepicked="true" pickkey="Use" />
<aitarget maxsightrange="1500" />
</Item>
<Item name="[DebugOnlyTest]C4WithoutPen" identifier="testC40pen" category="Weapon" Tags="smallitem,explosive,demolitionsexpert" maxstacksize="32" maxstacksizecharacterinventory="8" Scale="0.5" cargocontaineridentifier="explosivecrate" impactsoundtag="impact_soft">
<Upgrade gameversion="0.9.3.0" scale="0.5"/>
<PreferredContainer primary="secarmcab" minamount="1" maxamount="2" spawnprobability="0.5" notcampaign="true" notpvp="true"/>
<PreferredContainer secondary="wreckarmcab,abandonedarmcab,piratearmcab" amount="1" spawnprobability="0.05"/>
<PreferredContainer secondary="armcab"/>
<Price baseprice="160">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.4"/>
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="2" sold="false"/>
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25"/>
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="3" />
<Price storeidentifier="merchantmine" sold="false" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="3" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="20">
<RequiredSkill identifier="weapons" level="70" />
<RequiredItem identifier="uex" />
<RequiredItem identifier="plastic" />
</Fabricate>
<InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="768,64,64,64" origin="0.5,0.5" />
<Sprite texture="Content/Items/Weapons/weapons_new.png" depth="0.55" sourcerect="51,478,48,33" origin="0.5,0.5" />
<Body width="45" height="30" density="20" />
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" canbecombined="true" removeoncombined="true" throwforce="3.5" aimpos="35,-10" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnUse" target="This" Condition="-100.0" disabledeltatime="true"/>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="8000" />
<Explosion range="750.0" ballastfloradamage="150" structuredamage="0" itemdamage="1000" force="20" severlimbsprobability="2" debris="true" decal="explosion" decalsize="0.75">
<Affliction identifier="explosiondamage" strength="250" />
</Explosion>
<Remove />
</StatusEffect>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionDebris5.ogg" range="6000" />
</StatusEffect>
</Throwable>
<Quality>
<QualityStat stattype="ExplosionRadius" value="0.1"/>
<QualityStat stattype="ExplosionDamage" value="0.1"/>
</Quality>
</Item>
<Item name="[DebugOnlyTest]C4WithPen" identifier="testC41pen" category="Weapon" Tags="smallitem,explosive,demolitionsexpert" maxstacksize="32" maxstacksizecharacterinventory="8" Scale="0.5" cargocontaineridentifier="explosivecrate" impactsoundtag="impact_soft">
<Upgrade gameversion="0.9.3.0" scale="0.5"/>
<PreferredContainer primary="secarmcab" minamount="1" maxamount="2" spawnprobability="0.5" notcampaign="true" notpvp="true"/>
<PreferredContainer secondary="wreckarmcab,abandonedarmcab,piratearmcab" amount="1" spawnprobability="0.05"/>
<PreferredContainer secondary="armcab"/>
<Price baseprice="160">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.4"/>
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="2" sold="false"/>
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25"/>
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="3" />
<Price storeidentifier="merchantmine" sold="false" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="3" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="20">
<RequiredSkill identifier="weapons" level="70" />
<RequiredItem identifier="uex" />
<RequiredItem identifier="plastic" />
</Fabricate>
<InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="768,64,64,64" origin="0.5,0.5" />
<Sprite texture="Content/Items/Weapons/weapons_new.png" depth="0.55" sourcerect="51,478,48,33" origin="0.5,0.5" />
<Body width="45" height="30" density="20" />
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" canbecombined="true" removeoncombined="true" throwforce="3.5" aimpos="35,-10" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnUse" target="This" Condition="-100.0" disabledeltatime="true"/>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="8000" />
<Explosion range="750.0" ballastfloradamage="150" structuredamage="0" itemdamage="1000" force="20" severlimbsprobability="2" debris="true" decal="explosion" decalsize="0.75" penetration="1">
<Affliction identifier="explosiondamage" strength="250" />
</Explosion>
<Remove />
</StatusEffect>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionDebris5.ogg" range="6000" />
</StatusEffect>
</Throwable>
<Quality>
<QualityStat stattype="ExplosionRadius" value="0.1"/>
<QualityStat stattype="ExplosionDamage" value="0.1"/>
</Quality>
</Item>
<Item name="[DebugOnlyTest]C4With2000range" identifier="testC42000" category="Weapon" Tags="smallitem,explosive,demolitionsexpert" maxstacksize="32" maxstacksizecharacterinventory="8" Scale="0.5" cargocontaineridentifier="explosivecrate" impactsoundtag="impact_soft">
<Upgrade gameversion="0.9.3.0" scale="0.5"/>
<PreferredContainer primary="secarmcab" minamount="1" maxamount="2" spawnprobability="0.5" notcampaign="true" notpvp="true"/>
<PreferredContainer secondary="wreckarmcab,abandonedarmcab,piratearmcab" amount="1" spawnprobability="0.05"/>
<PreferredContainer secondary="armcab"/>
<Price baseprice="160">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.4"/>
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="2" sold="false"/>
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25"/>
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="3" />
<Price storeidentifier="merchantmine" sold="false" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="3" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="20">
<RequiredSkill identifier="weapons" level="70" />
<RequiredItem identifier="uex" />
<RequiredItem identifier="plastic" />
</Fabricate>
<InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="768,64,64,64" origin="0.5,0.5" />
<Sprite texture="Content/Items/Weapons/weapons_new.png" depth="0.55" sourcerect="51,478,48,33" origin="0.5,0.5" />
<Body width="45" height="30" density="20" />
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" canbecombined="true" removeoncombined="true" throwforce="3.5" aimpos="35,-10" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnUse" target="This" Condition="-100.0" disabledeltatime="true"/>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="8000" />
<Explosion range="5000.0" ballastfloradamage="150" structuredamage="1000" itemdamage="1000" force="20" IgnoreCover="true" DistanceFalloff="false" severlimbsprobability="2" debris="true" decal="explosion" decalsize="0.75">
</Explosion>
<Remove />
</StatusEffect>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionDebris5.ogg" range="6000" />
</StatusEffect>
</Throwable>
<Quality>
<QualityStat stattype="ExplosionRadius" value="0.1"/>
<QualityStat stattype="ExplosionDamage" value="0.1"/>
</Quality>
</Item>
</Items>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="Explosion Test" modversion="1.0.1" corepackage="False" gameversion="1.11.5.0">
<Item file="%ModDir%/Items.xml" />
<Submarine file="%ModDir%/TestCamel.sub" />
</contentpackage>
+11
View File
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "MoonSharp Attach",
"type": "moonsharp-debug",
"debugServer": 41912,
"request": "attach"
}
]
}
+40
View File
@@ -0,0 +1,40 @@
{
"Lua.diagnostics.globals": [
"Game",
"Player",
"Random",
"Hook",
"Timer",
"bit32",
"TotalTime",
"DoFile",
"WayPoint",
"SpawnType",
"Level",
"Submarine",
"Vector2",
"PositionType",
"ServerLog_MessageType",
"Character",
"TraitorMessageType",
"ChatMessageType",
"CauseOfDeathType",
"CreateVector2",
"Item",
"ChatMessage",
"AfflictionPrefab",
"Gap",
"File",
"Networking",
"printNoLog",
"Client",
"SERVER",
"setmodulepaths",
"Type",
"BindingFlags",
"UserData",
"LuaUserData",
"CLIENT",
"ContentPackageManager"
]
}
@@ -0,0 +1,97 @@
-- Contains things to be removed later, they exist only for compatibility reasons.
local compatibilityLib = {}
local networking = LuaUserData.RegisterType("Barotrauma.LuaCsNetworking")
LuaUserData.AddMethod(networking, "RequestGetHTTP", Networking.HttpGet)
LuaUserData.AddMethod(networking, "RequestPostHTTP", Networking.HttpPost)
compatibilityLib.CreateVector2 = Vector2.__new
compatibilityLib.CreateVector3 = Vector3.__new
compatibilityLib.CreateVector4 = Vector4.__new
local luaRandom = {}
luaRandom.Range = function (min, max)
return math.random(min, max - 1)
end
luaRandom.RangeFloat = function (min, max)
return math.random() + math.random(min, max)
end
compatibilityLib["Random"] = luaRandom
local luaPlayer = {}
luaPlayer.GetAllCharacters = function ()
return Character.CharacterList
end
luaPlayer.GetAllClients = function ()
return Client.ClientList
end
luaPlayer.SetClientCharacter = function (client, character)
client.SetClientCharacter(character)
end
luaPlayer.SetCharacterTeam = function (character, team)
character.TeamID = team
end
luaPlayer.SetClientTeam = function (client, team)
client.TeamID = team
end
luaPlayer.Kick = function (client, reason)
client.Kick(reason)
end
luaPlayer.Ban = function (client, reason, range, seconds)
client.Ban(reason, range, seconds)
end
luaPlayer.UnbanPlayer = function (player, endpoint)
Client.Unban(player, endpoint)
end
luaPlayer.SetSpectatorPos = function ()
end
luaPlayer.SetRadioRange = function (character, range)
if (character.Inventory == nil) then return end
for item in character.Inventory.AllItems do
if item ~= nil and item.Prefab.Identifier == "headset" then
item.GetComponentString("WifiComponent").Range = range;
end
end
end
luaPlayer.CheckPermission = function (client, permissions)
return client.CheckPermission(permissions)
end
compatibilityLib["Player"] = luaPlayer
Hook.Add("character.created", "compatibility.character.created", function (character)
Hook.Call("characterCreated", character)
end)
Hook.Add("character.death", "compatibility.character.death", function (character, causeOfDeathAffliction)
Hook.Call("characterDeath", character, causeOfDeathAffliction)
end)
Hook.Add("client.connected", "compatibility.client.connected", function (client)
Hook.Call("clientConnected", client)
end)
Hook.Add("client.disconnected", "compatibility.client.disconnected", function (client)
Hook.Call("clientDisconnected", client)
end)
return compatibilityLib
@@ -0,0 +1,68 @@
Hook.Patch("Barotrauma.Item", "TryInteract",
{
"Barotrauma.Character",
"System.Boolean",
"System.Boolean",
"System.Boolean"
},
function(instance, p)
if Hook.Call("item.interact", instance, p["user"], p["ignoreRequiredItems"], p["forceSelectKey"], p["forceUseKey"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "ApplyTreatment",
{
"Barotrauma.Character",
"Barotrauma.Character",
"Barotrauma.Limb"
},
function(instance, p)
if Hook.Call("item.applyTreatment", instance, p["user"], p["character"], p["targetLimb"]) then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Combine",
{
"Barotrauma.Item",
"Barotrauma.Character"
},
function(instance, p)
if Hook.Call("item.combine", instance, p["item"], p["user"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Drop",
function(instance, p)
if Hook.Call("item.drop", instance, p["dropper"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Equip",
{
"Barotrauma.Character"
},
function(instance, p)
if Hook.Call("item.equip", instance, p["character"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Unequip",
{
"Barotrauma.Character"
},
function(instance, p)
if Hook.Call("item.unequip", instance, p["character"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
@@ -0,0 +1,91 @@
local defaultLib = {}
local CreateStatic = LuaSetup.LuaUserData.CreateStatic
local CreateEnum = LuaSetup.LuaUserData.CreateEnumTable
local AddCallMetaTable = LuaSetup.LuaUserData.AddCallMetaTable
local localizedStrings = {
"LocalizedString", "LimitLString", "WrappedLString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString",
}
for key, value in pairs(localizedStrings) do
defaultLib[value] = CreateStatic("Barotrauma." .. value, true)
end
local sounds = {}
sounds.LowpassFilter = CreateStatic("Barotrauma.Sounds.LowpassFilter")
sounds.HighpassFilter = CreateStatic("Barotrauma.Sounds.HighpassFilter")
sounds.BandpassFilter = CreateStatic("Barotrauma.Sounds.BandpassFilter")
sounds.NotchFilter = CreateStatic("Barotrauma.Sounds.NotchFilter")
sounds.LowShelfFilter = CreateStatic("Barotrauma.Sounds.LowShelfFilter")
sounds.HighShelfFilter = CreateStatic("Barotrauma.Sounds.HighShelfFilter")
sounds.PeakFilter = CreateStatic("Barotrauma.Sounds.PeakFilter")
defaultLib["Sounds"] = sounds
defaultLib["SpriteEffects"] = CreateStatic("Microsoft.Xna.Framework.Graphics.SpriteEffects")
defaultLib["SoundPlayer"] = CreateStatic("Barotrauma.SoundPlayer")
defaultLib["SoundPrefab"] = CreateStatic("Barotrauma.SoundPrefab", true)
defaultLib["BackgroundMusic"] = CreateStatic("Barotrauma.BackgroundMusic", true)
defaultLib["GUISound"] = CreateStatic("Barotrauma.GUISound", true)
defaultLib["DamageSound"] = CreateStatic("Barotrauma.DamageSound", true)
defaultLib["WaterRenderer"] = CreateStatic("Barotrauma.WaterRenderer", true)
defaultLib["TextureLoader"] = CreateStatic("Barotrauma.TextureLoader")
defaultLib["Sprite"] = CreateStatic("Barotrauma.Sprite", true)
defaultLib["PlayerInput"] = CreateStatic("Barotrauma.PlayerInput", true)
defaultLib["Keys"] = CreateStatic("Microsoft.Xna.Framework.Input.Keys", true)
defaultLib["GUI"] = {
GUI = CreateStatic("Barotrauma.GUI", true),
Style = CreateStatic("Barotrauma.GUIStyle", true),
Component = CreateStatic("Barotrauma.GUIComponent"),
RectTransform = CreateStatic("Barotrauma.RectTransform", true),
LayoutGroup = CreateStatic("Barotrauma.GUILayoutGroup", true),
Button = CreateStatic("Barotrauma.GUIButton", true),
TextBox = CreateStatic("Barotrauma.GUITextBox", true),
Canvas = CreateStatic("Barotrauma.GUICanvas", true),
Frame = CreateStatic("Barotrauma.GUIFrame", true),
TextBlock = CreateStatic("Barotrauma.GUITextBlock", true),
TickBox = CreateStatic("Barotrauma.GUITickBox", true),
Image = CreateStatic("Barotrauma.GUIImage", true),
ListBox = CreateStatic("Barotrauma.GUIListBox", true),
ScrollBar = CreateStatic("Barotrauma.GUIScrollBar", true),
DropDown = CreateStatic("Barotrauma.GUIDropDown", true),
NumberInput = CreateStatic("Barotrauma.GUINumberInput", true),
MessageBox = CreateStatic("Barotrauma.GUIMessageBox", true),
ColorPicker = CreateStatic("Barotrauma.GUIColorPicker", true),
ProgressBar = CreateStatic("Barotrauma.GUIProgressBar", true),
CustomComponent = CreateStatic("Barotrauma.GUICustomComponent", true),
ScissorComponent = CreateStatic("Barotrauma.GUIScissorComponent", true),
VideoPlayer = CreateStatic("Barotrauma.VideoPlayer", true),
Graph = CreateStatic("Barotrauma.Graph", true),
SerializableEntityEditor = CreateStatic("Barotrauma.SerializableEntityEditor", true),
SlideshowPlayer = CreateStatic("Barotrauma.SlideshowPlayer", true),
CreditsPlayer = CreateStatic("Barotrauma.CreditsPlayer", true),
DragHandle = CreateStatic("Barotrauma.GUIDragHandle", true),
ContextMenu = CreateStatic("Barotrauma.GUIContextMenu", true),
ContextMenuOption = CreateStatic("Barotrauma.ContextMenuOption", true),
Screen = CreateStatic("Barotrauma.Screen"),
Anchor = CreateStatic("Barotrauma.Anchor"),
Alignment = CreateStatic("Barotrauma.Alignment"),
Pivot = CreateStatic("Barotrauma.Pivot"),
SoundType = CreateEnum("Barotrauma.GUISoundType"),
CursorState = CreateEnum("Barotrauma.CursorState"),
GUIStyle = CreateStatic("Barotrauma.GUIStyle", true),
}
setmetatable(defaultLib["GUI"], {
__index = function (table, key)
return defaultLib["GUI"].GUI[key]
end
})
AddCallMetaTable(defaultLib["GUI"].VideoPlayer.VideoSettings)
AddCallMetaTable(defaultLib["GUI"].VideoPlayer.TextSettings)
return defaultLib
@@ -0,0 +1,14 @@
local defaultLib = {}
local CreateStatic = LuaSetup.LuaUserData.CreateStatic
local CreateEnum = LuaSetup.LuaUserData.CreateEnumTable
local localizedStrings = {
"LocalizedString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString",
}
for key, value in pairs(localizedStrings) do
defaultLib[value] = CreateStatic("Barotrauma." .. value, true)
end
return defaultLib
@@ -0,0 +1,195 @@
local defaultLib = {}
local AddCallMetaTable = LuaSetup.LuaUserData.AddCallMetaTable
local CreateStatic = LuaSetup.LuaUserData.CreateStatic
local CreateEnum = LuaSetup.LuaUserData.CreateEnumTable
defaultLib["SByte"] = CreateStatic("Barotrauma.LuaSByte", true)
defaultLib["Byte"] = CreateStatic("Barotrauma.LuaByte", true)
defaultLib["Int16"] = CreateStatic("Barotrauma.LuaInt16", true)
defaultLib["UInt16"] = CreateStatic("Barotrauma.LuaUInt16", true)
defaultLib["Int32"] = CreateStatic("Barotrauma.LuaInt32", true)
defaultLib["UInt32"] = CreateStatic("Barotrauma.LuaUInt32", true)
defaultLib["Int64"] = CreateStatic("Barotrauma.LuaInt64", true)
defaultLib["UInt64"] = CreateStatic("Barotrauma.LuaUInt64", true)
defaultLib["Single"] = CreateStatic("Barotrauma.LuaSingle", true)
defaultLib["Double"] = CreateStatic("Barotrauma.LuaDouble", true)
-- Backward compatibility
defaultLib["Float"] = CreateStatic("Barotrauma.LuaSingle", true)
defaultLib["Short"] = CreateStatic("Barotrauma.LuaInt16", true)
defaultLib["UShort"] = CreateStatic("Barotrauma.LuaUInt16", true)
defaultLib["SpawnType"] = CreateEnum("Barotrauma.SpawnType")
defaultLib["ChatMessageType"] = CreateEnum("Barotrauma.Networking.ChatMessageType")
defaultLib["ServerLog_MessageType"] = CreateEnum("Barotrauma.Networking.ServerLog+MessageType")
defaultLib["ServerLogMessageType"] = CreateEnum("Barotrauma.Networking.ServerLog+MessageType")
defaultLib["PositionType"] = CreateEnum("Barotrauma.Level+PositionType")
defaultLib["InvSlotType"] = CreateEnum("Barotrauma.InvSlotType")
defaultLib["LimbType"] = CreateEnum("Barotrauma.LimbType")
defaultLib["ActionType"] = CreateEnum("Barotrauma.ActionType")
defaultLib["AbilityEffectType"] = CreateEnum("Barotrauma.AbilityEffectType")
defaultLib["StatTypes"] = CreateEnum("Barotrauma.StatTypes")
defaultLib["AbilityFlags"] = CreateEnum("Barotrauma.AbilityFlags")
defaultLib["DeliveryMethod"] = CreateEnum("Barotrauma.Networking.DeliveryMethod")
defaultLib["ClientPacketHeader"] = CreateEnum("Barotrauma.Networking.ClientPacketHeader")
defaultLib["ServerPacketHeader"] = CreateEnum("Barotrauma.Networking.ServerPacketHeader")
defaultLib["RandSync"] = CreateEnum("Barotrauma.Rand+RandSync")
defaultLib["DisconnectReason"] = CreateEnum("Barotrauma.Networking.DisconnectReason")
defaultLib["CombatMode"] = CreateEnum("Barotrauma.AIObjectiveCombat+CombatMode")
defaultLib["CauseOfDeathType"] = CreateEnum("Barotrauma.CauseOfDeathType")
defaultLib["CharacterTeamType"] = CreateEnum("Barotrauma.CharacterTeamType")
defaultLib["ClientPermissions"] = CreateEnum("Barotrauma.Networking.ClientPermissions")
defaultLib["OrderCategory"] = CreateEnum("Barotrauma.OrderCategory")
defaultLib["WearableType"] = CreateEnum("Barotrauma.WearableType")
defaultLib["NumberType"] = CreateEnum("Barotrauma.NumberType")
defaultLib["ChatMode"] = CreateEnum("Barotrauma.ChatMode")
defaultLib["CharacterType"] = CreateEnum("Barotrauma.CharacterType")
defaultLib["VoteType"] = CreateEnum("Barotrauma.Networking.VoteType")
defaultLib["CanEnterSubmarine"] = CreateEnum("Barotrauma.CanEnterSubmarine")
defaultLib["InputType"] = CreateStatic("Barotrauma.InputType")
defaultLib["EventPrefab"] = CreateStatic("Barotrauma.EventPrefab", true)
defaultLib["TraitorEventPrefab"] = CreateStatic("Barotrauma.TraitorEventPrefab", true)
defaultLib["TraitorEvent"] = CreateStatic("Barotrauma.TraitorEvent", true)
defaultLib["EventSet"] = CreateStatic("Barotrauma.EventSet", true)
defaultLib["EventManagerSettings"] = CreateStatic("Barotrauma.EventManagerSettings", true)
defaultLib["NetConfig"] = CreateStatic("Barotrauma.Networking.NetConfig")
defaultLib["NetworkConnection"] = CreateStatic("Barotrauma.Networking.NetworkConnection")
defaultLib["Inventory"] = CreateStatic("Barotrauma.Inventory", true)
defaultLib["CharacterInventory"] = CreateStatic("Barotrauma.CharacterInventory", true)
defaultLib["ItemInventory"] = CreateStatic("Barotrauma.ItemInventory", true)
defaultLib["ContentPackageManager"] = CreateStatic("Barotrauma.ContentPackageManager")
defaultLib["GameSettings"] = CreateStatic("Barotrauma.GameSettings")
defaultLib["RichString"] = CreateStatic("Barotrauma.RichString", true)
defaultLib["Identifier"] = CreateStatic("Barotrauma.Identifier", true)
defaultLib["LanguageIdentifier"] = CreateStatic("Barotrauma.LanguageIdentifier", true)
defaultLib["ContentPackage"] = CreateStatic("Barotrauma.ContentPackage", true)
defaultLib["WayPoint"] = CreateStatic("Barotrauma.WayPoint", true)
defaultLib["Submarine"] = CreateStatic("Barotrauma.Submarine", true)
defaultLib["Client"] = CreateStatic("Barotrauma.Networking.Client", true)
defaultLib["Character"] = CreateStatic("Barotrauma.Character")
defaultLib["CharacterHealth"] = CreateStatic("Barotrauma.CharacterHealth", true)
defaultLib["CharacterPrefab"] = CreateStatic("Barotrauma.CharacterPrefab", true)
defaultLib["CharacterInfo"] = CreateStatic("Barotrauma.CharacterInfo", true)
AddCallMetaTable(defaultLib["CharacterInfo"].HeadPreset)
AddCallMetaTable(defaultLib["CharacterInfo"].HeadInfo)
defaultLib["CharacterInfoPrefab"] = CreateStatic("Barotrauma.CharacterInfoPrefab")
defaultLib["Item"] = CreateStatic("Barotrauma.Item", true)
AddCallMetaTable(defaultLib["Item"].ChangePropertyEventData)
defaultLib["MapEntityPrefab"] = CreateStatic("Barotrauma.MapEntityPrefab")
defaultLib["ItemPrefab"] = CreateStatic("Barotrauma.ItemPrefab", true)
defaultLib["TalentTree"] = CreateStatic("Barotrauma.TalentTree", true)
defaultLib["TalentPrefab"] = CreateStatic("Barotrauma.TalentPrefab", true)
defaultLib["FactionPrefab"] = CreateStatic("Barotrauma.FactionPrefab", true)
defaultLib["MissionPrefab"] = CreateStatic("Barotrauma.MissionPrefab", true)
defaultLib["Mission"] = CreateStatic("Barotrauma.Mission", true)
defaultLib["Level"] = CreateStatic("Barotrauma.Level")
defaultLib["LevelGenerationParams"] = CreateStatic("Barotrauma.LevelGenerationParams", true)
defaultLib["OutpostGenerationParams"] = CreateStatic("Barotrauma.OutpostGenerationParams", true)
defaultLib["RuinGenerationParams"] = CreateStatic("Barotrauma.RuinGeneration.RuinGenerationParams", true)
defaultLib["Job"] = CreateStatic("Barotrauma.Job", true)
defaultLib["JobPrefab"] = CreateStatic("Barotrauma.JobPrefab", true)
defaultLib["JobVariant"] = CreateStatic("Barotrauma.JobVariant", true)
defaultLib["AfflictionPrefab"] = CreateStatic("Barotrauma.AfflictionPrefab", true)
defaultLib["SkillSettings"] = CreateStatic("Barotrauma.SkillSettings", true)
defaultLib["ChatMessage"] = CreateStatic("Barotrauma.Networking.ChatMessage")
defaultLib["Structure"] = CreateStatic("Barotrauma.Structure", true)
defaultLib["Hull"] = CreateStatic("Barotrauma.Hull", true)
defaultLib["Gap"] = CreateStatic("Barotrauma.Gap", true)
defaultLib["Signal"] = CreateStatic("Barotrauma.Items.Components.Signal", true)
defaultLib["SubmarineInfo"] = CreateStatic("Barotrauma.SubmarineInfo", true)
defaultLib["Entity"] = CreateStatic("Barotrauma.Entity", true)
defaultLib["MapEntity"] = CreateStatic("Barotrauma.MapEntity", true)
defaultLib["Physics"] = CreateStatic("Barotrauma.Physics")
defaultLib["FireSource"] = CreateStatic("Barotrauma.FireSource", true)
defaultLib["TextManager"] = CreateStatic("Barotrauma.TextManager")
defaultLib["NetEntityEvent"] = CreateStatic("Barotrauma.Networking.NetEntityEvent")
defaultLib["Screen"] = CreateStatic("Barotrauma.Screen")
defaultLib["AttackResult"] = CreateStatic("Barotrauma.AttackResult", true)
defaultLib["TempClient"] = CreateStatic("Barotrauma.Networking.TempClient", true)
defaultLib["DecalManager"] = CreateStatic("Barotrauma.DecalManager", true)
defaultLib["AutoItemPlacer"] = CreateStatic("Barotrauma.AutoItemPlacer")
defaultLib["PropertyConditional"] = CreateStatic("Barotrauma.PropertyConditional", true)
defaultLib["StatusEffect"] = CreateStatic("Barotrauma.StatusEffect", true)
defaultLib["OutpostGenerator"] = CreateStatic("Barotrauma.OutpostGenerator")
defaultLib["DamageModifier"] = CreateStatic("Barotrauma.DamageModifier", true)
defaultLib["TraitorManager"] = CreateStatic("Barotrauma.TraitorManager", true)
AddCallMetaTable(defaultLib["TraitorManager"].TraitorResults)
defaultLib["Md5Hash"] = CreateStatic("Barotrauma.Md5Hash", true)
defaultLib["ContentXElement"] = CreateStatic("Barotrauma.ContentXElement", true)
defaultLib["ContentPath"] = CreateStatic("Barotrauma.ContentPath", true)
defaultLib["XElement"] = CreateStatic("System.Xml.Linq.XElement", true)
defaultLib["XName"] = CreateStatic("System.Xml.Linq.XName", true)
defaultLib["XAttribute"] = CreateStatic("System.Xml.Linq.XAttribute", true)
defaultLib["XContainer"] = CreateStatic("System.Xml.Linq.XContainer", true)
defaultLib["XDocument"] = CreateStatic("System.Xml.Linq.XDocument", true)
defaultLib["XNode"] = CreateStatic("System.Xml.Linq.XNode", true)
defaultLib["SoundsFile"] = CreateStatic("Barotrauma.SoundsFile", true)
defaultLib["Voting"] = CreateStatic("Barotrauma.Voting")
defaultLib["TimeSpan"] = CreateStatic("System.TimeSpan")
defaultLib["IPAddress"] = CreateStatic("System.Net.IPAddress")
defaultLib["ContentPackageId"] = CreateStatic("Barotrauma.ContentPackageId")
defaultLib["Address"] = CreateStatic("Barotrauma.Networking.Address")
defaultLib["AccountId"] = CreateStatic("Barotrauma.Networking.AccountId")
defaultLib["Endpoint"] = CreateStatic("Barotrauma.Networking.Endpoint")
defaultLib["Explosion"] = CreateStatic("Barotrauma.Explosion", true)
defaultLib["ConvertUnits"] = CreateStatic("FarseerPhysics.ConvertUnits")
defaultLib["ToolBox"] = CreateStatic("Barotrauma.ToolBox")
defaultLib["AIObjective"] = CreateStatic("Barotrauma.AIObjective", true)
defaultLib["AIObjectiveChargeBatteries"] = CreateStatic("Barotrauma.AIObjectiveChargeBatteries", true)
defaultLib["AIObjectiveCleanupItem"] = CreateStatic("Barotrauma.AIObjectiveCleanupItem", true)
defaultLib["AIObjectiveCleanupItems"] = CreateStatic("Barotrauma.AIObjectiveCleanupItems", true)
defaultLib["AIObjectiveCombat"] = CreateStatic("Barotrauma.AIObjectiveCombat", true)
defaultLib["AIObjectiveContainItem"] = CreateStatic("Barotrauma.AIObjectiveContainItem", true)
defaultLib["AIObjectiveDeconstructItem"] = CreateStatic("Barotrauma.AIObjectiveDeconstructItem", true)
defaultLib["AIObjectiveDeconstructItems"] = CreateStatic("Barotrauma.AIObjectiveDeconstructItems", true)
defaultLib["AIObjectiveEscapeHandcuffs"] = CreateStatic("Barotrauma.AIObjectiveEscapeHandcuffs", true)
defaultLib["AIObjectiveExtinguishFire"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFire", true)
defaultLib["AIObjectiveExtinguishFires"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFires", true)
defaultLib["AIObjectiveFightIntruders"] = CreateStatic("Barotrauma.AIObjectiveFightIntruders", true)
defaultLib["AIObjectiveFindDivingGear"] = CreateStatic("Barotrauma.AIObjectiveFindDivingGear", true)
defaultLib["AIObjectiveFindSafety"] = CreateStatic("Barotrauma.AIObjectiveFindSafety", true)
defaultLib["AIObjectiveFixLeak"] = CreateStatic("Barotrauma.AIObjectiveFixLeak", true)
defaultLib["AIObjectiveFixLeaks"] = CreateStatic("Barotrauma.AIObjectiveFixLeaks", true)
defaultLib["AIObjectiveGetItem"] = CreateStatic("Barotrauma.AIObjectiveGetItem", true)
defaultLib["AIObjectiveGoTo"] = CreateStatic("Barotrauma.AIObjectiveGoTo", true)
defaultLib["AIObjectiveIdle"] = CreateStatic("Barotrauma.AIObjectiveIdle", true)
defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true)
defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true)
defaultLib["AIObjectivePumpWater"] = CreateStatic("Barotrauma.AIObjectivePumpWater", true)
defaultLib["AIObjectiveRepairItem"] = CreateStatic("Barotrauma.AIObjectiveRepairItem", true)
defaultLib["AIObjectiveRepairItems"] = CreateStatic("Barotrauma.AIObjectiveRepairItems", true)
defaultLib["AIObjectiveRescue"] = CreateStatic("Barotrauma.AIObjectiveRescue", true)
defaultLib["AIObjectiveRescueAll"] = CreateStatic("Barotrauma.AIObjectiveRescueAll", true)
defaultLib["AIObjectiveReturn"] = CreateStatic("Barotrauma.AIObjectiveReturn", true)
defaultLib["AITarget"] = CreateStatic("Barotrauma.AITarget", true)
defaultLib["Order"] = CreateStatic("Barotrauma.Order", true)
defaultLib["OrderPrefab"] = CreateStatic("Barotrauma.OrderPrefab", true)
defaultLib["OrderTarget"] = CreateStatic("Barotrauma.OrderTarget", true)
local componentsToReference = { "DockingPort", "Door", "GeneticMaterial", "Growable", "Holdable", "LevelResource", "ItemComponent", "ItemLabel", "LightComponent", "Controller", "Deconstructor", "Engine", "Fabricator", "OutpostTerminal", "Pump", "Reactor", "Steering", "PowerContainer", "Projectile", "Repairable", "Rope", "Scanner", "ButtonTerminal", "ConnectionPanel", "CustomInterface", "MemoryComponent", "Terminal", "WifiComponent", "Wire", "TriggerComponent", "ElectricalDischarger", "EntitySpawnerComponent", "ProducedItem", "VineTile", "GrowthSideExtension", "IdCard", "MeleeWeapon", "Pickable", "Propulsion", "RangedWeapon", "RepairTool", "Sprayer", "Throwable", "ItemContainer", "Ladder", "LimbPos", "MiniMap", "OxygenGenerator", "Sonar", "SonarTransducer", "Vent", "NameTag", "Planter", "Powered", "PowerTransfer", "Quality", "RemoteController", "AdderComponent", "AndComponent", "ArithmeticComponent", "ColorComponent", "ConcatComponent", "Connection", "DelayComponent", "DivideComponent", "EqualsComponent", "ExponentiationComponent", "FunctionComponent", "GreaterComponent", "ModuloComponent", "MotionSensor", "MultiplyComponent", "NotComponent", "OrComponent", "OscillatorComponent", "OxygenDetector", "RegExFindComponent", "RelayComponent", "SignalCheckComponent", "SmokeDetector", "StringComponent", "SubtractComponent", "TrigonometricFunctionComponent", "WaterDetector", "XorComponent", "StatusHUD", "Turret", "Wearable", "CustomInterface"
}
defaultLib["Components"] = {}
for key, value in pairs(componentsToReference) do
defaultLib["Components"][value] = CreateStatic("Barotrauma.Items.Components." .. value, true)
end
defaultLib["Vector2"] = CreateStatic("Microsoft.Xna.Framework.Vector2", true)
defaultLib["Vector3"] = CreateStatic("Microsoft.Xna.Framework.Vector3", true)
defaultLib["Vector4"] = CreateStatic("Microsoft.Xna.Framework.Vector4", true)
defaultLib["Color"] = CreateStatic("Microsoft.Xna.Framework.Color", true)
defaultLib["Point"] = CreateStatic("Microsoft.Xna.Framework.Point", true)
defaultLib["Rectangle"] = CreateStatic("Microsoft.Xna.Framework.Rectangle", true)
defaultLib["Matrix"] = CreateStatic("Microsoft.Xna.Framework.Matrix", true)
return defaultLib
@@ -0,0 +1,40 @@
math.lerp = function (a, b, t)
if type(a) ~= "number" then error(string.format("bad argument #1 to 'lerp' (number expected, got %s)", type(a)), 2) end
if type(b) ~= "number" then error(string.format("bad argument #2 to 'lerp' (number expected, got %s)", type(b)), 2) end
if type(t) ~= "number" then error(string.format("bad argument #3 to 'lerp' (number expected, got %s)", type(t)), 2) end
return a * (1 - t) + b * t
end
math.clamp = function (value, min, max)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'clamp' (number expected, got %s)", type(value)), 2) end
if type(min) ~= "number" then error(string.format("bad argument #2 to 'clamp' (number expected, got %s)", type(min)), 2) end
if type(max) ~= "number" then error(string.format("bad argument #3 to 'clamp' (number expected, got %s)", type(max)), 2) end
return math.max(min, math.min(max, value))
end
math.round = function (value, decimals)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'round' (number expected, got %s)", type(value)), 2) end
if type(decimals) ~= "number" then error(string.format("bad argument #2 to 'round' (number expected, got %s)", type(decimals)), 2) end
decimals = decimals or 0
local mult = 10 ^ decimals
return math.floor(value * mult + 0.5) / mult
end
math.sign = function (value)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'sign' (number expected, got %s)", type(value)), 2) end
return value >= 0 and 1 or -1
end
math.remap = function (value, inMin, inMax, outMin, outMax)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'remap' (number expected, got %s)", type(value)), 2) end
if type(inMin) ~= "number" then error(string.format("bad argument #2 to 'remap' (number expected, got %s)", type(inMin)), 2) end
if type(inMax) ~= "number" then error(string.format("bad argument #3 to 'remap' (number expected, got %s)", type(inMax)), 2) end
if type(outMin) ~= "number" then error(string.format("bad argument #4 to 'remap' (number expected, got %s)", type(outMin)), 2) end
if type(outMax) ~= "number" then error(string.format("bad argument #5 to 'remap' (number expected, got %s)", type(outMax)), 2) end
return outMin + (outMax - outMin) * ((value - inMin) / (inMax - inMin))
end
@@ -0,0 +1,26 @@
local descriptor = LuaUserData.RegisterType("Barotrauma.LuaCsSteam")
LuaUserData.AddMethod(descriptor, "GetWorkshopCollection", function (id, callback)
id = tostring(id)
Networking.RequestPostHTTP("https://api.steampowered.com/ISteamRemoteStorage/GetCollectionDetails/v1/", function (result)
local data = json.parse(result)
if data.response.collectiondetails[1].children == nil then
callback()
return
end
local workshopItems = {}
for key, value in pairs(data.response.collectiondetails[1].children) do
table.insert(workshopItems, value.publishedfileid)
end
if callback then
callback(workshopItems)
end
end,
"collectioncount=1&publishedfileids[0]=" .. id,
"application/x-www-form-urlencoded")
end)
@@ -0,0 +1,13 @@
string.startsWith = function(str, start)
if type(str) ~= "string" then error(string.format("bad argument #1 to 'startsWith' (string expected, got %s)", type(str)), 2) end
if type(start) ~= "string" then error(string.format("bad argument #2 to 'startsWith' (string expected, got %s)", type(start)), 2) end
return string.sub(str, 1, string.len(start)) == start
end
string.endsWith = function(str, ending)
if type(str) ~= "string" then error(string.format("bad argument #1 to 'endsWith' (string expected, got %s)", type(str)), 2) end
if type(ending) ~= "string" then error(string.format("bad argument #2 to 'endsWith' (string expected, got %s)", type(ending)), 2) end
return ending == "" or string.sub(str, -string.len(ending)) == ending
end
@@ -0,0 +1,86 @@
Util = {}
local itemDictionary = {}
local itemGroups = {}
local function AddItem(item)
for _, itemGroup in pairs(itemGroups) do
if itemGroup.func(item) then
table.insert(itemGroup.items, item)
end
end
local id = item.Prefab.Identifier.Value
if itemDictionary[id] == nil then
itemDictionary[id] = {}
end
table.insert(itemDictionary[id], item)
end
Hook.Add("item.created", "luaSetup.util.itemDictionary", function (item)
AddItem(item)
end)
Hook.Add("roundEnd", "luaSetup.util.itemDictionary", function (item)
itemDictionary = {}
for _, itemGroup in pairs(itemGroups) do
itemGroup.items = {}
end
end)
for _, item in pairs(Item.ItemList) do
AddItem(item)
end
Util.RegisterItemGroup = function(groupName, func)
if type(groupName) ~= "string" then
error(string.format("bad argument #1 to 'RegisterItemGroup' (string expected, got %s)", type(groupName)), 2)
end
if type(func) ~= "function" then
error(string.format("bad argument #2 to 'RegisterItemGroup' (function expected, got %s)", type(func)), 2)
end
local items = {}
for _, item in pairs(Item.ItemList) do
if func(item) then
table.insert(items, item)
end
end
itemGroups[groupName] = {
func = func,
items = items
}
end
Util.GetItemGroup = function(groupName)
if type(groupName) ~= "string" then
error(string.format("bad argument #1 to 'GetItemGroup' (string expected, got %s)", type(groupName)), 2)
end
if not itemGroups[groupName] then
error("bad argument #1 to 'GetItemGroup' couldn't find the specified groupName", 2)
end
return itemGroups[groupName].items or {}
end
Util.GetItemsById = function(id)
if id == nil then
error(string.format("bad argument #1 to 'GetItemsById' (string expected, got %s)", type(id)), 2)
end
return itemDictionary[id]
end
Util.FindClientCharacter = function(character)
if CLIENT and Game.IsSingleplayer then return nil end
for _, client in pairs(Client.ClientList) do
if client.Character == character then
return client
end
end
end
@@ -0,0 +1,150 @@
local Register = LuaSetup.LuaUserData.RegisterType
local RegisterBarotrauma = LuaSetup.LuaUserData.RegisterTypeBarotrauma
local localizedStrings = {
"LocalizedString", "LimitLString", "WrappedLString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString",
}
for key, value in pairs(localizedStrings) do
RegisterBarotrauma(value)
end
RegisterBarotrauma("EditorScreen")
RegisterBarotrauma("SubEditorScreen")
RegisterBarotrauma("EventEditorScreen")
RegisterBarotrauma("CharacterEditor.CharacterEditorScreen")
RegisterBarotrauma("SpriteEditorScreen")
RegisterBarotrauma("LevelEditorScreen")
RegisterBarotrauma("Networking.ClientPeer")
RegisterBarotrauma("Networking.GameClient")
RegisterBarotrauma("Networking.VoipCapture")
RegisterBarotrauma("Media.Video")
RegisterBarotrauma("SoundsFile")
RegisterBarotrauma("SoundPrefab")
RegisterBarotrauma("PrefabCollection`1")
RegisterBarotrauma("PrefabSelector`1")
RegisterBarotrauma("BackgroundMusic")
RegisterBarotrauma("GUISound")
RegisterBarotrauma("DamageSound")
RegisterBarotrauma("Sounds.SoundManager")
RegisterBarotrauma("Sounds.OggSound")
RegisterBarotrauma("Sounds.VideoSound")
RegisterBarotrauma("Sounds.VoipSound")
RegisterBarotrauma("Sounds.SoundChannel")
RegisterBarotrauma("Sounds.SoundBuffers")
RegisterBarotrauma("RoundSound")
RegisterBarotrauma("CharacterSound")
RegisterBarotrauma("SoundPlayer")
RegisterBarotrauma("Items.Components.ItemSound")
RegisterBarotrauma("Sounds.LowpassFilter")
RegisterBarotrauma("Sounds.HighpassFilter")
RegisterBarotrauma("Sounds.BandpassFilter")
RegisterBarotrauma("Sounds.NotchFilter")
RegisterBarotrauma("Sounds.LowShelfFilter")
RegisterBarotrauma("Sounds.HighShelfFilter")
RegisterBarotrauma("Sounds.PeakFilter")
RegisterBarotrauma("Particles.ParticleManager")
RegisterBarotrauma("Particles.Particle")
RegisterBarotrauma("Particles.ParticleEmitterProperties")
RegisterBarotrauma("Particles.ParticleEmitter")
RegisterBarotrauma("Particles.ParticlePrefab")
RegisterBarotrauma("Lights.LightManager")
RegisterBarotrauma("Lights.LightSource")
RegisterBarotrauma("Lights.LightSourceParams")
RegisterBarotrauma("LevelWallVertexBuffer")
RegisterBarotrauma("LevelRenderer")
RegisterBarotrauma("WaterRenderer")
RegisterBarotrauma("WaterVertexData")
RegisterBarotrauma("ChatBox")
RegisterBarotrauma("GUICanvas")
RegisterBarotrauma("Anchor")
RegisterBarotrauma("Alignment")
RegisterBarotrauma("Pivot")
RegisterBarotrauma("Key")
RegisterBarotrauma("PlayerInput")
RegisterBarotrauma("ScalableFont")
Register("Microsoft.Xna.Framework.Graphics.Effect")
Register("Microsoft.Xna.Framework.Graphics.EffectParameterCollection")
Register("Microsoft.Xna.Framework.Graphics.EffectParameter")
Register("Microsoft.Xna.Framework.Graphics.SpriteBatch")
Register("Microsoft.Xna.Framework.Graphics.Texture2D")
Register("EventInput.KeyboardDispatcher")
Register("EventInput.KeyEventArgs")
Register("Microsoft.Xna.Framework.Input.Keys")
Register("Microsoft.Xna.Framework.Input.KeyboardState")
RegisterBarotrauma("TextureLoader")
RegisterBarotrauma("Sprite")
RegisterBarotrauma("GUI")
RegisterBarotrauma("GUIStyle")
RegisterBarotrauma("GUIComponent")
RegisterBarotrauma("GUILayoutGroup")
RegisterBarotrauma("GUITextBox")
RegisterBarotrauma("GUITextBlock")
RegisterBarotrauma("GUIButton")
RegisterBarotrauma("RectTransform")
RegisterBarotrauma("GUIFrame")
RegisterBarotrauma("GUITickBox")
RegisterBarotrauma("GUIImage")
RegisterBarotrauma("GUIListBox")
RegisterBarotrauma("GUIScrollBar")
RegisterBarotrauma("GUIDropDown")
RegisterBarotrauma("GUINumberInput")
RegisterBarotrauma("GUIMessage")
RegisterBarotrauma("GUIMessageBox")
RegisterBarotrauma("GUIColorPicker")
RegisterBarotrauma("GUIProgressBar")
RegisterBarotrauma("GUICustomComponent")
RegisterBarotrauma("GUIScissorComponent")
RegisterBarotrauma("GUIComponentStyle")
RegisterBarotrauma("GUIFontPrefab")
RegisterBarotrauma("GUIFont")
RegisterBarotrauma("GUISpritePrefab")
RegisterBarotrauma("GUISprite")
RegisterBarotrauma("GUISpriteSheetPrefab")
RegisterBarotrauma("GUISpriteSheet")
RegisterBarotrauma("GUICursorPrefab")
RegisterBarotrauma("GUICursor")
RegisterBarotrauma("GUIRadioButtonGroup")
RegisterBarotrauma("GUIDragHandle")
RegisterBarotrauma("GUIContextMenu")
RegisterBarotrauma("ContextMenuOption")
RegisterBarotrauma("VideoPlayer")
RegisterBarotrauma("CreditsPlayer")
RegisterBarotrauma("SlideshowPlayer")
RegisterBarotrauma("SerializableEntityEditor")
RegisterBarotrauma("CircuitBoxWireRenderer")
RegisterBarotrauma("CircuitBoxLabel")
RegisterBarotrauma("CircuitBoxMouseDragSnapshotHandler")
RegisterBarotrauma("CircuitBoxUI")
RegisterBarotrauma("SettingsMenu")
RegisterBarotrauma("TabMenu")
RegisterBarotrauma("Widget")
RegisterBarotrauma("UpgradeStore")
RegisterBarotrauma("VotingInterface")
RegisterBarotrauma("MedicalClinicUI")
RegisterBarotrauma("LoadingScreen")
RegisterBarotrauma("HUD")
RegisterBarotrauma("HUDLayoutSettings")
RegisterBarotrauma("HUDProgressBar")
RegisterBarotrauma("Graph")
RegisterBarotrauma("HRManagerUI")
RegisterBarotrauma("SubmarineSelection")
RegisterBarotrauma("Store")
RegisterBarotrauma("UISprite")
RegisterBarotrauma("ParamsEditor")
RegisterBarotrauma("Inventory+SlotReference")
RegisterBarotrauma("VisualSlot")
@@ -0,0 +1,20 @@
local Register = LuaSetup.LuaUserData.RegisterType
local RegisterBarotrauma = LuaSetup.LuaUserData.RegisterTypeBarotrauma
local localizedStrings = {
"LocalizedString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString",
}
for key, value in pairs(localizedStrings) do
RegisterBarotrauma(value)
end
Register("Steamworks.SteamServer")
RegisterBarotrauma("Character+TeamChangeEventData")
RegisterBarotrauma("Networking.GameServer")
RegisterBarotrauma("Networking.ServerPeer")
RegisterBarotrauma("Networking.FileSender")
@@ -0,0 +1,479 @@
local Register = LuaSetup.LuaUserData.RegisterType
local RegisterExtension = LuaSetup.LuaUserData.RegisterExtensionType
local RegisterBarotrauma = LuaSetup.LuaUserData.RegisterTypeBarotrauma
Register("System.TimeSpan")
Register("System.Exception")
Register("System.Console")
Register("System.Exception")
RegisterBarotrauma("Success`2")
RegisterBarotrauma("Failure`2")
RegisterBarotrauma("LuaSByte")
RegisterBarotrauma("LuaByte")
RegisterBarotrauma("LuaInt16")
RegisterBarotrauma("LuaUInt16")
RegisterBarotrauma("LuaInt32")
RegisterBarotrauma("LuaUInt32")
RegisterBarotrauma("LuaInt64")
RegisterBarotrauma("LuaUInt64")
RegisterBarotrauma("LuaSingle")
RegisterBarotrauma("LuaDouble")
RegisterBarotrauma("GameMain")
RegisterBarotrauma("Networking.BanList")
RegisterBarotrauma("Networking.BannedPlayer")
RegisterBarotrauma("Range`1")
RegisterBarotrauma("RichString")
RegisterBarotrauma("Identifier")
RegisterBarotrauma("LanguageIdentifier")
RegisterBarotrauma("Job")
RegisterBarotrauma("JobPrefab")
RegisterBarotrauma("JobVariant")
Register("Voronoi2.DoubleVector2")
Register("Voronoi2.Site")
Register("Voronoi2.Edge")
Register("Voronoi2.Halfedge")
Register("Voronoi2.VoronoiCell")
Register("Voronoi2.GraphEdge")
RegisterBarotrauma("WayPoint")
RegisterBarotrauma("Level")
RegisterBarotrauma("LevelData")
RegisterBarotrauma("Level+InterestingPosition")
RegisterBarotrauma("LevelGenerationParams")
RegisterBarotrauma("LevelObjectManager")
RegisterBarotrauma("LevelObject")
RegisterBarotrauma("LevelObjectPrefab")
RegisterBarotrauma("LevelTrigger")
RegisterBarotrauma("CaveGenerationParams")
RegisterBarotrauma("CaveGenerator")
RegisterBarotrauma("OutpostGenerationParams")
RegisterBarotrauma("OutpostGenerator")
RegisterBarotrauma("OutpostModuleInfo")
RegisterBarotrauma("BeaconStationInfo")
RegisterBarotrauma("NPCSet")
RegisterBarotrauma("RuinGeneration.Ruin")
RegisterBarotrauma("RuinGeneration.RuinGenerationParams")
RegisterBarotrauma("LevelWall")
RegisterBarotrauma("DestructibleLevelWall")
RegisterBarotrauma("Biome")
RegisterBarotrauma("Map")
RegisterBarotrauma("Networking.RespawnManager")
RegisterBarotrauma("Networking.RespawnManager+TeamSpecificState")
RegisterBarotrauma("Character")
RegisterBarotrauma("CharacterPrefab")
RegisterBarotrauma("CharacterInfo")
RegisterBarotrauma("CharacterInfoPrefab")
RegisterBarotrauma("CharacterInfo+HeadPreset")
RegisterBarotrauma("CharacterInfo+HeadInfo")
RegisterBarotrauma("CharacterHealth")
RegisterBarotrauma("CharacterHealth+LimbHealth")
RegisterBarotrauma("DamageModifier")
RegisterBarotrauma("CharacterInventory")
RegisterBarotrauma("CharacterParams")
RegisterBarotrauma("CharacterParams+AIParams")
RegisterBarotrauma("CharacterParams+TargetParams")
RegisterBarotrauma("CharacterParams+InventoryParams")
RegisterBarotrauma("CharacterParams+HealthParams")
RegisterBarotrauma("CharacterParams+ParticleParams")
RegisterBarotrauma("CharacterParams+SoundParams")
RegisterBarotrauma("SteeringManager")
RegisterBarotrauma("IndoorsSteeringManager")
RegisterBarotrauma("SteeringPath")
RegisterBarotrauma("CreatureMetrics")
RegisterBarotrauma("Item")
RegisterBarotrauma("DeconstructItem")
RegisterBarotrauma("PurchasedItem")
RegisterBarotrauma("PurchasedItemSwap")
RegisterBarotrauma("PurchasedUpgrade")
RegisterBarotrauma("SoldItem")
RegisterBarotrauma("StartItem")
RegisterBarotrauma("StartItemSet")
RegisterBarotrauma("RelatedItem")
RegisterBarotrauma("UpgradeManager")
RegisterBarotrauma("CargoManager")
RegisterBarotrauma("HireManager")
RegisterBarotrauma("FabricationRecipe")
RegisterBarotrauma("PreferredContainer")
RegisterBarotrauma("SwappableItem")
RegisterBarotrauma("FabricationRecipe+RequiredItemByIdentifier")
RegisterBarotrauma("FabricationRecipe+RequiredItemByTag")
RegisterBarotrauma("Submarine")
RegisterBarotrauma("Networking.AccountInfo")
RegisterBarotrauma("Networking.AccountId")
RegisterBarotrauma("Networking.SteamId")
RegisterBarotrauma("Networking.EpicAccountId")
RegisterBarotrauma("Networking.Address")
RegisterBarotrauma("Networking.UnknownAddress")
RegisterBarotrauma("Networking.P2PAddress")
RegisterBarotrauma("Networking.EosP2PAddress")
RegisterBarotrauma("Networking.SteamP2PAddress")
RegisterBarotrauma("Networking.PipeAddress")
RegisterBarotrauma("Networking.LidgrenAddress")
RegisterBarotrauma("Networking.Endpoint")
RegisterBarotrauma("Networking.SteamP2PEndpoint")
RegisterBarotrauma("Networking.PipeEndpoint")
RegisterBarotrauma("Networking.LidgrenEndpoint")
RegisterBarotrauma("INetSerializableStruct")
RegisterBarotrauma("Networking.Client")
RegisterBarotrauma("Networking.TempClient")
RegisterBarotrauma("Networking.NetworkConnection")
RegisterBarotrauma("Networking.LidgrenConnection")
RegisterBarotrauma("Networking.SteamP2PConnection")
RegisterBarotrauma("Networking.VoipQueue")
RegisterBarotrauma("Networking.ChatMessage")
RegisterBarotrauma("AnimController")
RegisterBarotrauma("HumanoidAnimController")
RegisterBarotrauma("FishAnimController")
RegisterBarotrauma("Limb")
RegisterBarotrauma("Ragdoll")
RegisterBarotrauma("RagdollParams")
RegisterBarotrauma("AfflictionPrefab")
RegisterBarotrauma("Affliction")
RegisterBarotrauma("AttackResult")
RegisterBarotrauma("Attack")
RegisterBarotrauma("Entity")
RegisterBarotrauma("EntityGrid")
RegisterBarotrauma("EntitySpawner")
RegisterBarotrauma("MapEntity")
RegisterBarotrauma("MapEntityPrefab")
RegisterBarotrauma("CauseOfDeath")
RegisterBarotrauma("Hull")
RegisterBarotrauma("WallSection")
RegisterBarotrauma("Structure")
RegisterBarotrauma("Gap")
RegisterBarotrauma("PhysicsBody")
RegisterBarotrauma("AbilityFlags")
RegisterBarotrauma("ItemPrefab")
RegisterBarotrauma("ItemAssemblyPrefab")
RegisterBarotrauma("InputType")
RegisterBarotrauma("FireSource")
RegisterBarotrauma("SerializableProperty")
LuaUserData.MakeFieldAccessible(RegisterBarotrauma("StatusEffect"), "user")
RegisterBarotrauma("DurationListElement")
RegisterBarotrauma("PropertyConditional")
RegisterBarotrauma("DelayedListElement")
RegisterBarotrauma("DelayedEffect")
RegisterBarotrauma("ContentPackageManager")
RegisterBarotrauma("ContentPackageManager+PackageSource")
RegisterBarotrauma("ContentPackageManager+EnabledPackages")
RegisterBarotrauma("ContentPackage")
RegisterBarotrauma("RegularPackage")
RegisterBarotrauma("CorePackage")
RegisterBarotrauma("ContentXElement")
RegisterBarotrauma("ContentPath")
RegisterBarotrauma("ContentPackageId")
RegisterBarotrauma("SteamWorkshopId")
RegisterBarotrauma("Md5Hash")
RegisterBarotrauma("AfflictionsFile")
RegisterBarotrauma("BackgroundCreaturePrefabsFile")
RegisterBarotrauma("BallastFloraFile")
RegisterBarotrauma("BeaconStationFile")
RegisterBarotrauma("CaveGenerationParametersFile")
RegisterBarotrauma("CharacterFile")
RegisterBarotrauma("ContentFile")
RegisterBarotrauma("CorpsesFile")
RegisterBarotrauma("DecalsFile")
RegisterBarotrauma("EnemySubmarineFile")
RegisterBarotrauma("EventManagerSettingsFile")
RegisterBarotrauma("FactionsFile")
RegisterBarotrauma("ItemAssemblyFile")
RegisterBarotrauma("ItemFile")
RegisterBarotrauma("JobsFile")
RegisterBarotrauma("LevelGenerationParametersFile")
RegisterBarotrauma("LevelObjectPrefabsFile")
RegisterBarotrauma("LocationTypesFile")
RegisterBarotrauma("MapGenerationParametersFile")
RegisterBarotrauma("MissionsFile")
RegisterBarotrauma("NPCConversationsFile")
RegisterBarotrauma("NPCPersonalityTraitsFile")
RegisterBarotrauma("NPCSetsFile")
RegisterBarotrauma("OrdersFile")
RegisterBarotrauma("OtherFile")
RegisterBarotrauma("OutpostConfigFile")
RegisterBarotrauma("OutpostFile")
RegisterBarotrauma("OutpostModuleFile")
RegisterBarotrauma("ParticlesFile")
RegisterBarotrauma("RandomEventsFile")
RegisterBarotrauma("RuinConfigFile")
RegisterBarotrauma("ServerExecutableFile")
RegisterBarotrauma("SkillSettingsFile")
RegisterBarotrauma("SoundsFile")
RegisterBarotrauma("StartItemsFile")
RegisterBarotrauma("StructureFile")
RegisterBarotrauma("SubmarineFile")
RegisterBarotrauma("TalentsFile")
RegisterBarotrauma("TalentTreesFile")
RegisterBarotrauma("TextFile")
RegisterBarotrauma("TutorialsFile")
RegisterBarotrauma("UIStyleFile")
RegisterBarotrauma("UpgradeModulesFile")
RegisterBarotrauma("WreckAIConfigFile")
RegisterBarotrauma("WreckFile")
Register("System.Xml.Linq.XElement")
Register("System.Xml.Linq.XName")
Register("System.Xml.Linq.XAttribute")
Register("System.Xml.Linq.XContainer")
Register("System.Xml.Linq.XDocument")
Register("System.Xml.Linq.XNode")
RegisterBarotrauma("SubmarineBody")
RegisterBarotrauma("Explosion")
RegisterBarotrauma("Networking.ServerSettings")
RegisterBarotrauma("Networking.ServerSettings+SavedClientPermission")
RegisterBarotrauma("Inventory")
RegisterBarotrauma("ItemInventory")
RegisterBarotrauma("Inventory+ItemSlot")
RegisterBarotrauma("FireSource")
RegisterBarotrauma("AutoItemPlacer")
RegisterBarotrauma("CircuitBoxConnection")
RegisterBarotrauma("CircuitBoxComponent")
RegisterBarotrauma("CircuitBoxNode")
RegisterBarotrauma("CircuitBoxWire")
RegisterBarotrauma("CircuitBoxInputOutputNode")
RegisterBarotrauma("CircuitBoxSelectable")
RegisterBarotrauma("CircuitBoxSizes")
local componentsToRegister = { "DockingPort", "Door", "GeneticMaterial", "Growable", "Holdable", "LevelResource", "ItemComponent", "ItemLabel", "LightComponent", "Controller", "Deconstructor", "Engine", "Fabricator", "OutpostTerminal", "Pump", "Reactor", "Steering", "PowerContainer", "Projectile", "Repairable", "Rope", "Scanner", "ButtonTerminal", "ConnectionPanel", "CustomInterface", "MemoryComponent", "Terminal", "WifiComponent", "Wire", "TriggerComponent", "ElectricalDischarger", "EntitySpawnerComponent", "ProducedItem", "VineTile", "GrowthSideExtension", "IdCard", "MeleeWeapon", "Pickable", "AbilityItemPickingTime", "Propulsion", "RangedWeapon", "AbilityRangedWeapon", "RepairTool", "Sprayer", "Throwable", "ItemContainer", "AbilityItemContainer", "Ladder", "LimbPos", "AbilityDeconstructedItem", "AbilityItemCreationMultiplier", "AbilityItemDeconstructedInventory", "MiniMap", "OxygenGenerator", "Sonar", "SonarTransducer", "Vent", "NameTag", "Planter", "Powered", "PowerTransfer", "Quality", "RemoteController", "AdderComponent", "AndComponent", "ArithmeticComponent", "ColorComponent", "ConcatComponent", "Connection", "CircuitBox", "DelayComponent", "DivideComponent", "EqualsComponent", "ExponentiationComponent", "FunctionComponent", "GreaterComponent", "ModuloComponent", "MotionSensor", "MultiplyComponent", "NotComponent", "OrComponent", "OscillatorComponent", "OxygenDetector", "RegExFindComponent", "RelayComponent", "SignalCheckComponent", "SmokeDetector", "StringComponent", "SubtractComponent", "TrigonometricFunctionComponent", "WaterDetector", "XorComponent", "StatusHUD", "Turret", "Wearable",
"GridInfo", "PowerSourceGroup"
}
for key, value in pairs(componentsToRegister) do
RegisterBarotrauma("Items.Components." .. value)
end
LuaUserData.MakeFieldAccessible(RegisterBarotrauma("Items.Components.CustomInterface"), "customInterfaceElementList")
RegisterBarotrauma("Items.Components.CustomInterface+CustomInterfaceElement")
RegisterBarotrauma("WearableSprite")
RegisterBarotrauma("AIController")
RegisterBarotrauma("EnemyAIController")
RegisterBarotrauma("HumanAIController")
RegisterBarotrauma("AICharacter")
RegisterBarotrauma("AITarget")
RegisterBarotrauma("AITargetMemory")
RegisterBarotrauma("AIChatMessage")
RegisterBarotrauma("AIObjectiveManager")
RegisterBarotrauma("WreckAI")
RegisterBarotrauma("WreckAIConfig")
RegisterBarotrauma("AIObjectiveChargeBatteries")
RegisterBarotrauma("AIObjective")
RegisterBarotrauma("AIObjectiveCleanupItem")
RegisterBarotrauma("AIObjectiveCleanupItems")
RegisterBarotrauma("AIObjectiveCombat")
RegisterBarotrauma("AIObjectiveContainItem")
RegisterBarotrauma("AIObjectiveDeconstructItem")
RegisterBarotrauma("AIObjectiveDeconstructItems")
RegisterBarotrauma("AIObjectiveEscapeHandcuffs")
RegisterBarotrauma("AIObjectiveExtinguishFire")
RegisterBarotrauma("AIObjectiveExtinguishFires")
RegisterBarotrauma("AIObjectiveFightIntruders")
RegisterBarotrauma("AIObjectiveFindDivingGear")
RegisterBarotrauma("AIObjectiveFindSafety")
RegisterBarotrauma("AIObjectiveFixLeak")
RegisterBarotrauma("AIObjectiveFixLeaks")
RegisterBarotrauma("AIObjectiveGetItem")
RegisterBarotrauma("AIObjectiveGoTo")
RegisterBarotrauma("AIObjectiveIdle")
RegisterBarotrauma("AIObjectiveOperateItem")
RegisterBarotrauma("AIObjectivePumpWater")
RegisterBarotrauma("AIObjectiveRepairItem")
RegisterBarotrauma("AIObjectiveRepairItems")
RegisterBarotrauma("AIObjectiveRescue")
RegisterBarotrauma("AIObjectiveRescueAll")
RegisterBarotrauma("AIObjectiveReturn")
RegisterBarotrauma("Order")
RegisterBarotrauma("OrderPrefab")
RegisterBarotrauma("OrderTarget")
RegisterBarotrauma("TalentPrefab")
RegisterBarotrauma("TalentOption")
RegisterBarotrauma("TalentSubTree")
RegisterBarotrauma("TalentTree")
RegisterBarotrauma("CharacterTalent")
RegisterBarotrauma("Upgrade")
RegisterBarotrauma("UpgradeCategory")
RegisterBarotrauma("UpgradePrefab")
RegisterBarotrauma("UpgradeManager")
RegisterBarotrauma("Screen")
RegisterBarotrauma("GameScreen")
RegisterBarotrauma("GameSession")
RegisterBarotrauma("GameSettings")
RegisterBarotrauma("CrewManager")
RegisterBarotrauma("KarmaManager")
RegisterBarotrauma("GameMode")
RegisterBarotrauma("MissionMode")
RegisterBarotrauma("PvPMode")
RegisterBarotrauma("Mission")
RegisterBarotrauma("AbandonedOutpostMission")
RegisterBarotrauma("EliminateTargetsMission")
RegisterBarotrauma("EndMission")
RegisterBarotrauma("BeaconMission")
RegisterBarotrauma("CargoMission")
RegisterBarotrauma("CombatMission")
RegisterBarotrauma("EscortMission")
RegisterBarotrauma("GoToMission")
RegisterBarotrauma("MineralMission")
RegisterBarotrauma("MonsterMission")
RegisterBarotrauma("NestMission")
RegisterBarotrauma("PirateMission")
RegisterBarotrauma("SalvageMission")
RegisterBarotrauma("ScanMission")
RegisterBarotrauma("MissionPrefab")
RegisterBarotrauma("CampaignMode")
RegisterBarotrauma("CoOpMode")
RegisterBarotrauma("MultiPlayerCampaign")
RegisterBarotrauma("Radiation")
RegisterBarotrauma("CampaignMetadata")
RegisterBarotrauma("Wallet")
RegisterBarotrauma("Faction")
RegisterBarotrauma("FactionPrefab")
RegisterBarotrauma("Reputation")
RegisterBarotrauma("Location")
RegisterBarotrauma("LocationConnection")
RegisterBarotrauma("LocationType")
RegisterBarotrauma("LocationTypeChange")
RegisterBarotrauma("DebugConsole")
RegisterBarotrauma("DebugConsole+Command")
RegisterBarotrauma("TextManager")
RegisterBarotrauma("TextPack")
local descriptor = RegisterBarotrauma("NetLobbyScreen")
if SERVER then
LuaUserData.MakeFieldAccessible(descriptor, "subs")
end
RegisterBarotrauma("EventManager")
RegisterBarotrauma("EventManagerSettings")
RegisterBarotrauma("Event")
RegisterBarotrauma("ArtifactEvent")
RegisterBarotrauma("MonsterEvent")
RegisterBarotrauma("ScriptedEvent")
RegisterBarotrauma("MalfunctionEvent")
RegisterBarotrauma("EventSet")
RegisterBarotrauma("EventPrefab")
RegisterBarotrauma("Networking.NetConfig")
RegisterBarotrauma("Networking.IWriteMessage")
RegisterBarotrauma("Networking.IReadMessage")
RegisterBarotrauma("Networking.NetEntityEvent")
RegisterBarotrauma("Networking.INetSerializable")
Register("Lidgren.Network.NetIncomingMessage")
Register("Lidgren.Network.NetConnection")
Register("System.Net.IPEndPoint")
Register("System.Net.IPAddress")
RegisterBarotrauma("Skill")
RegisterBarotrauma("SkillPrefab")
RegisterBarotrauma("SkillSettings")
RegisterBarotrauma("TraitorManager")
RegisterBarotrauma("TraitorEvent")
RegisterBarotrauma("TraitorEventPrefab")
RegisterBarotrauma("TraitorManager+TraitorResults")
Register("FarseerPhysics.Dynamics.Body")
Register("FarseerPhysics.Dynamics.World")
Register("FarseerPhysics.Dynamics.Fixture")
Register("FarseerPhysics.ConvertUnits")
Register("FarseerPhysics.Collision.AABB")
Register("FarseerPhysics.Collision.ContactFeature")
Register("FarseerPhysics.Collision.ManifoldPoint")
Register("FarseerPhysics.Collision.ContactID")
Register("FarseerPhysics.Collision.Manifold")
Register("FarseerPhysics.Collision.RayCastInput")
Register("FarseerPhysics.Collision.ClipVertex")
Register("FarseerPhysics.Collision.RayCastOutput")
Register("FarseerPhysics.Collision.EPAxis")
Register("FarseerPhysics.Collision.ReferenceFace")
Register("FarseerPhysics.Collision.Collision")
RegisterBarotrauma("Physics")
local toolBox = RegisterBarotrauma("ToolBox")
if CLIENT then
LuaUserData.RemoveMember(toolBox, "OpenFileWithShell")
end
RegisterBarotrauma("Camera")
RegisterBarotrauma("Key")
RegisterBarotrauma("PrefabCollection`1")
RegisterBarotrauma("PrefabSelector`1")
RegisterBarotrauma("Pair`2")
RegisterBarotrauma("Items.Components.Signal")
RegisterBarotrauma("SubmarineInfo")
RegisterBarotrauma("MapCreatures.Behavior.BallastFloraBehavior")
RegisterBarotrauma("MapCreatures.Behavior.BallastFloraBranch")
RegisterBarotrauma("PetBehavior")
RegisterBarotrauma("SwarmBehavior")
RegisterBarotrauma("LatchOntoAI")
RegisterBarotrauma("Decal")
RegisterBarotrauma("DecalPrefab")
RegisterBarotrauma("DecalManager")
RegisterBarotrauma("PriceInfo")
RegisterBarotrauma("Voting")
Register("Microsoft.Xna.Framework.Vector2")
Register("Microsoft.Xna.Framework.Vector3")
Register("Microsoft.Xna.Framework.Vector4")
Register("Microsoft.Xna.Framework.Color")
Register("Microsoft.Xna.Framework.Point")
Register("Microsoft.Xna.Framework.Rectangle")
Register("Microsoft.Xna.Framework.Matrix")
local friend = Register("Steamworks.Friend")
LuaUserData.RemoveMember(friend, "InviteToGame")
LuaUserData.RemoveMember(friend, "SendMessage")
local workshopItem = Register("Steamworks.Ugc.Item")
LuaUserData.RemoveMember(workshopItem, "Subscribe")
LuaUserData.RemoveMember(workshopItem, "DownloadAsync")
LuaUserData.RemoveMember(workshopItem, "Unsubscribe")
LuaUserData.RemoveMember(workshopItem, "AddFavorite")
LuaUserData.RemoveMember(workshopItem, "RemoveFavorite")
LuaUserData.RemoveMember(workshopItem, "Vote")
LuaUserData.RemoveMember(workshopItem, "GetUserVote")
LuaUserData.RemoveMember(workshopItem, "Edit")
RegisterExtension("Barotrauma.MathUtils")
RegisterExtension("Barotrauma.XMLExtensions")
@@ -0,0 +1,50 @@
LuaSetup = {}
local path = table.pack(...)[1]
package.path = {path .. "/?.lua"}
setmodulepaths(package.path)
-- Setup Libraries
require("LuaUserData")
require("DefaultRegister/RegisterShared")
if SERVER then
require("DefaultRegister/RegisterServer")
else
require("DefaultRegister/RegisterClient")
end
local function AddTableToGlobal(tbl)
for k, v in pairs(tbl) do
_G[k] = v
end
end
if SERVER then
AddTableToGlobal(require("DefaultLib/LibServer"))
else
AddTableToGlobal(require("DefaultLib/LibClient"))
end
AddTableToGlobal(require("DefaultLib/LibShared"))
AddTableToGlobal(require("CompatibilityLib"))
require("DefaultHook")
Descriptors = LuaSetup.LuaUserData.Descriptors
LuaUserData = LuaSetup.LuaUserData
require("DefaultLib/Utils/Math")
require("DefaultLib/Utils/String")
require("DefaultLib/Utils/Util")
require("DefaultLib/Utils/SteamApi")
require("PostSetup")
LuaSetup = nil
require("ModLoader")
@@ -0,0 +1,97 @@
local clrLuaUserData = LuaUserData
local luaUserData = {}
luaUserData.Descriptors = {}
LuaSetup.LuaUserData = luaUserData
luaUserData.IsRegistered = clrLuaUserData.IsRegistered
luaUserData.UnregisterType = clrLuaUserData.UnregisterType
luaUserData.RegisterGenericType = clrLuaUserData.RegisterGenericType
luaUserData.RegisterExtensionType = clrLuaUserData.RegisterExtensionType
luaUserData.UnregisterGenericType = clrLuaUserData.UnregisterGenericType
luaUserData.IsTargetType = clrLuaUserData.IsTargetType
luaUserData.TypeOf = clrLuaUserData.TypeOf
luaUserData.GetType = clrLuaUserData.GetType
luaUserData.CreateEnumTable = clrLuaUserData.CreateEnumTable
luaUserData.MakeFieldAccessible = clrLuaUserData.MakeFieldAccessible
luaUserData.MakeMethodAccessible = clrLuaUserData.MakeMethodAccessible
luaUserData.MakePropertyAccessible = clrLuaUserData.MakePropertyAccessible
luaUserData.AddMethod = clrLuaUserData.AddMethod
luaUserData.AddField = clrLuaUserData.AddField
luaUserData.RemoveMember = clrLuaUserData.RemoveMember
luaUserData.CreateUserDataFromDescriptor = clrLuaUserData.CreateUserDataFromDescriptor
luaUserData.CreateUserDataFromType = clrLuaUserData.CreateUserDataFromType
luaUserData.HasMember = clrLuaUserData.HasMember
luaUserData.RegisterType = function(typeName)
local success, result = pcall(clrLuaUserData.RegisterType, typeName)
if not success then
error(result, 2)
end
luaUserData.Descriptors[typeName] = result
return result
end
luaUserData.RegisterTypeBarotrauma = function(typeName)
typeName = "Barotrauma." .. typeName
local success, result = pcall(luaUserData.RegisterType, typeName)
if not success then
error(result, 2)
end
return result
end
luaUserData.AddCallMetaTable = function (userdata)
if userdata == nil then
error("Attempted to add a call metatable to a nil value.", 2)
end
if not LuaUserData.HasMember(userdata, ".ctor") then
error("Attempted to add a call metatable to a userdata that does not have a constructor.", 2)
end
debug.setmetatable(userdata, {
__call = function(obj, ...)
if userdata == nil then
error("userdata was nil.", 2)
end
local success, result = pcall(userdata.__new, ...)
if not success then
error(result, 2)
end
return result
end
})
end
luaUserData.CreateStatic = function(typeName)
if type(typeName) ~= "string" then
error("Expected a string for typeName, got " .. type(typeName) .. ".", 2)
end
local success, result = pcall(clrLuaUserData.CreateStatic, typeName)
if not success then
error(result, 2)
end
if result == nil then
return
end
if LuaUserData.HasMember(result, ".ctor") then
luaUserData.AddCallMetaTable(result)
end
return result
end
@@ -0,0 +1,193 @@
local LUA_MOD_REQUIRE_PATH = "/Lua/?.lua"
local LUA_MOD_AUTORUN_PATH = "/Lua/Autorun"
local LUA_MOD_FORCEDAUTORUN_PATH = "/Lua/ForcedAutorun"
local function EndsWith(str, suffix)
return str:sub(-string.len(suffix)) == suffix
end
local function GetFileName(file)
return file:match("^.+/(.+)$")
end
local function ExecuteProtected(s, folder)
loadfile(s)(folder)
end
local function RunFolder(folder, rootFolder, package)
local search = File.DirSearch(folder)
for i = 1, #search, 1 do
local s = search[i]:gsub("\\", "/")
if EndsWith(s, ".lua") then
local time = os.clock()
local ok, result = pcall(ExecuteProtected, s, rootFolder)
local diff = os.clock() - time
print(string.format(" - %s (Took %.5fms)", GetFileName(s), diff))
if not ok then
printerror(result)
end
end
end
end
local function AssertTypes(expectedTypes, ...)
local args = table.pack(...)
assert(
#args == #expectedTypes,
string.format(
"Assertion failed: incorrect number of args\n\texpected = %s\n\tgot = %s",
#expectedTypes, #args
)
)
for i = 1, #args do
local arg = args[i]
local expectedType = expectedTypes[i]
assert(
type(arg) == expectedType,
string.format(
"Assertion failed: incorrect argument type (arg #%d)\n\texpected = %s\n\tgot = %s",
i, expectedType, type(arg)
)
)
end
end
local function ExecutionQueue()
local executionQueue = {}
executionQueue.Queue = {}
executionQueue.Process = function()
while executionQueue.Queue[1] ~= nil do
local folder, rootFolder, package = table.unpack(table.remove(executionQueue.Queue, 1))
print(string.format("%s %s", package.Name, package.ModVersion))
RunFolder(folder, rootFolder, package)
end
end
executionQueue.Add = function(...)
AssertTypes({ 'string', 'string', 'userdata' }, ...)
table.insert(executionQueue.Queue, table.pack(...))
end
return executionQueue
end
local QueueAutorun = ExecutionQueue()
local QueueForcedAutorun = ExecutionQueue()
local function nocase(s)
s = string.gsub(s, "%a", function(c)
return string.format("[%s%s]", string.lower(c), string.upper(c))
end)
return s
end
local function ProcessPackages(packages, fn)
for pkg in packages do
if pkg then
local pkgPath = pkg.Path
:gsub("\\", "/")
:gsub(nocase("/filelist.xml"), "")
fn(pkg, pkgPath)
end
end
end
ProcessPackages(ContentPackageManager.EnabledPackages.All, function(pkg, pkgPath)
table.insert(package.path, pkgPath .. LUA_MOD_REQUIRE_PATH)
local autorunPath = pkgPath .. LUA_MOD_AUTORUN_PATH
if File.DirectoryExists(autorunPath) then
QueueAutorun.Add(autorunPath, pkgPath, pkg)
end
end)
-- we don't want to execute workshop ForcedAutorun if we have a local Package
local executedLocalPackages = {}
ProcessPackages(ContentPackageManager.EnabledPackages.All, function(pkg, pkgPath)
table.insert(package.path, pkgPath .. LUA_MOD_REQUIRE_PATH)
local forcedAutorunPath = pkgPath .. LUA_MOD_FORCEDAUTORUN_PATH
if File.DirectoryExists(forcedAutorunPath) then
QueueForcedAutorun.Add(forcedAutorunPath, pkgPath, pkg)
executedLocalPackages[pkg.Name] = true
end
end)
if not LuaCsConfig.TreatForcedModsAsNormal then
ProcessPackages(ContentPackageManager.LocalPackages, function(pkg, pkgPath)
if not executedLocalPackages[pkg.Name] then
table.insert(package.path, pkgPath .. LUA_MOD_REQUIRE_PATH)
local forcedAutorunPath = pkgPath .. LUA_MOD_FORCEDAUTORUN_PATH
if File.DirectoryExists(forcedAutorunPath) then
QueueForcedAutorun.Add(forcedAutorunPath, pkgPath, pkg)
executedLocalPackages[pkg.Name] = true
end
end
end)
ProcessPackages(ContentPackageManager.AllPackages, function(pkg, pkgPath)
if not executedLocalPackages[pkg.Name] then
table.insert(package.path, pkgPath .. LUA_MOD_REQUIRE_PATH)
local forcedAutorunPath = pkgPath .. LUA_MOD_FORCEDAUTORUN_PATH
if File.DirectoryExists(forcedAutorunPath) then
QueueForcedAutorun.Add(forcedAutorunPath, pkgPath, pkg)
end
end
end)
end
setmodulepaths(package.path)
setmodulepaths = nil
local allExecuted = {}
for key, value in pairs(QueueAutorun.Queue) do table.insert(allExecuted, value[3]) end
for key, value in pairs(QueueForcedAutorun.Queue) do table.insert(allExecuted, value[3]) end
if SERVER then
Networking.Receive("_luastart", function (message, client)
local num = message.ReadUInt16()
local packages = {}
for i = 1, num, 1 do
table.insert(packages, {
Name = message.ReadString(),
Version = message.ReadString(),
Id = message.ReadUInt64(),
Hash = message.ReadString()
})
end
Hook.Call("client.packages", client, packages)
end)
elseif Game.IsMultiplayer then
local message = Networking.Start("_luastart")
message.WriteUInt16(#allExecuted)
for key, package in pairs(allExecuted) do
local id = package.UgcId
local hash = package.Hash and package.Hash.StringRepresentation or ""
if id == nil then id = 0 end
message.WriteString(package.Name)
message.WriteString(package.ModVersion)
message.WriteUInt64(UInt64(id))
message.WriteString(hash)
end
Networking.Send(message)
end
QueueAutorun.Process()
QueueForcedAutorun.Process()
Hook.Add("stop", "luaSetup.stop", function()
print("Stopping Lua...")
end)
Hook.Call("loaded")
@@ -0,0 +1,75 @@
if CSActive then
return
end
local function IsAllowed(typeName)
if string.startsWith(typeName, "Barotrauma.Lua") or string.startsWith(typeName, "Barotrauma.Cs") or string.startsWith(typeName, "Barotrauma.LuaCs") then
return false
end
if string.startsWith(typeName, "System.Collections") then return true end
if string.startsWith(typeName, "Microsoft.Xna") then return true end
if string.startsWith(typeName, "Barotrauma.IO") then return false end
if string.startsWith(typeName, "Barotrauma.ToolBox") then return false end
if string.startsWith(typeName, "Barotrauma.SaveUtil") then return false end
if string.startsWith(typeName, "Barotrauma.") then return true end
return false
end
local function CanBeReRegistered(typeName)
if string.startsWith(typeName, "Barotrauma.Lua") or string.startsWith(typeName, "Barotrauma.Cs") or string.startsWith(typeName, "Barotrauma.LuaCs") then
return false
end
return true
end
local originalRegisterType = LuaUserData.RegisterType
LuaUserData.RegisterType = function (typeName)
if not (CanBeReRegistered(typeName) and LuaUserData.IsRegistered(typeName)) and not IsAllowed(typeName) then
error("Couldn't register type " .. typeName .. ".", 2)
end
local success, result = pcall(originalRegisterType, typeName)
if not success then
error(result, 2)
end
return result
end
local originalRegisterGenericType = LuaUserData.RegisterType
LuaUserData.RegisterGenericType = function (typeName, ...)
if not (CanBeReRegistered(typeName) and LuaUserData.IsRegistered(typeName)) and not IsAllowed(typeName) then
error("Couldn't register generic type " .. typeName .. ".", 2)
end
local success, result = pcall(originalRegisterGenericType, typeName, ...)
if not success then
error(result, 2)
end
return result
end
local originalCreateStatic = LuaUserData.CreateStatic
LuaUserData.CreateStatic = function (typeName, addCallMethod)
if not (CanBeReRegistered(typeName) and LuaUserData.IsRegistered(typeName)) and not IsAllowed(typeName) then
error("Couldn't create static type " .. typeName .. ".", 2)
end
local success, result = pcall(originalCreateStatic, typeName, addCallMethod)
if not success then
error(result, 2)
end
return result
end
@@ -0,0 +1,20 @@
<Project>
<ItemGroup>
<PackageReference Include="Luatrauma.Internal.AssemblyPublicizer.MSBuild" Version="0.1.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.1.0" />
<PackageReference Include="MonoMod.RuntimeDetour" Version="25.2.3" />
<PackageReference Include="HarmonyX" Version="2.14.0" />
<PackageReference Include="Sigil" Version="5.0.0" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\..\Libraries\moonsharp\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\..\Libraries\moonsharp\MoonSharp.VsCodeDebugger\MoonSharp.VsCodeDebugger.csproj" />
</ItemGroup>
<!--
The `Microsoft.CodeAnalysis.CSharp.Scripting` package includes satellites
assemblies, which end up polluting the build folder.
This suppresses the extra satellite assemblies.
-->
<PropertyGroup>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
</Project>
@@ -96,8 +96,17 @@ namespace Barotrauma
CreateAutonomousObjectives();
}
public void AddObjective(AIObjective objective)
{
AddObjective<AIObjective>(objective);
}
public void AddObjective<T>(T objective) where T : AIObjective
{
var result = GameMain.LuaCs.Hook.Call<bool?>("AI.addObjective", this, objective);
if (result != null && result.Value) return;
if (objective == null)
{
#if DEBUG
@@ -1305,6 +1305,11 @@ namespace Barotrauma
//increase oxygen and clamp it above zero
// -> the character should be revived if there are no major afflictions in addition to lack of oxygen
target.Oxygen = Math.Max(target.Oxygen + 10.0f, 10.0f);
GameMain.LuaCs.Hook.Call("human.CPRSuccess", this);
}
else
{
GameMain.LuaCs.Hook.Call("human.CPRFailed", this);
}
}
}
@@ -11,6 +11,7 @@ using System.Xml.Linq;
using Barotrauma.Extensions;
using LimbParams = Barotrauma.RagdollParams.LimbParams;
using JointParams = Barotrauma.RagdollParams.JointParams;
using MoonSharp.Interpreter;
namespace Barotrauma
{
@@ -856,6 +857,13 @@ namespace Barotrauma
float impactDamage = GetImpactDamage(impact, impactTolerance);
var should = GameMain.LuaCs.Hook.Call<float?>("changeFallDamage", impactDamage, character, impactPos, velocity);
if (should != null)
{
impactDamage = should.Value;
}
character.LastDamageSource = null;
character.AddDamage(impactPos, AfflictionPrefab.ImpactDamage.Instantiate(impactDamage).ToEnumerable(), 0.0f, true);
strongestImpact = Math.Max(strongestImpact, impact - impactTolerance);
@@ -32,6 +32,9 @@ namespace Barotrauma
{
public static readonly List<Character> CharacterList = new List<Character>();
public static int CharacterUpdateInterval = 1;
private static int characterUpdateTick = 1;
public const float MaxHighlightDistance = 150.0f;
public const float MaxDragDistance = 200.0f;
@@ -1429,6 +1432,9 @@ namespace Barotrauma
Spawner.CreateNetworkEvent(new EntitySpawner.SpawnEntity(newCharacter));
}
#endif
GameMain.LuaCs.Hook.Call("character.created", new object[] { newCharacter });
return newCharacter;
}
@@ -1883,6 +1889,7 @@ namespace Barotrauma
}
}
info.Job?.GiveJobItems(this, isPvPMode, spawnPoint);
GameMain.LuaCs.Hook.Call("character.giveJobItems", this, spawnPoint, isPvPMode);
}
public void GiveIdCardTags(WayPoint spawnPoint, bool createNetworkEvent = false)
@@ -3378,8 +3385,21 @@ namespace Barotrauma
}
}
foreach (Character character in CharacterList)
characterUpdateTick++;
if (characterUpdateTick % CharacterUpdateInterval == 0)
{
for (int i = 0; i < CharacterList.Count; i++)
{
if (GameMain.LuaCs.Game.UpdatePriorityCharacters.Contains(CharacterList[i])) continue;
CharacterList[i].Update(deltaTime * CharacterUpdateInterval, cam);
}
}
foreach (Character character in GameMain.LuaCs.Game.UpdatePriorityCharacters)
{
if (character.Removed) { continue; }
Debug.Assert(character is { Removed: false });
character.Update(deltaTime, cam);
}
@@ -4543,12 +4563,12 @@ namespace Barotrauma
}
}
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2? attackImpulse = null, Character attacker = null, float damageMultiplier = 1f, float penetration = 0f)
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2? attackImpulse = null, Character attacker = null, float damageMultiplier = 1f)
{
return AddDamage(worldPosition, afflictions, stun, playSound, attackImpulse ?? Vector2.Zero, out _, attacker, damageMultiplier: damageMultiplier,penetration: penetration);
return AddDamage(worldPosition, afflictions, stun, playSound, attackImpulse ?? Vector2.Zero, out _, attacker, damageMultiplier: damageMultiplier);
}
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2 attackImpulse, out Limb hitLimb, Character attacker = null, float damageMultiplier = 1f, float penetration = 0f)
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2 attackImpulse, out Limb hitLimb, Character attacker = null, float damageMultiplier = 1)
{
hitLimb = null;
@@ -4565,7 +4585,7 @@ namespace Barotrauma
}
}
return DamageLimb(worldPosition, hitLimb, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier,penetration: penetration);
return DamageLimb(worldPosition, hitLimb, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier);
}
public void RecordKill(Character target)
@@ -4589,6 +4609,12 @@ namespace Barotrauma
{
if (Removed) { return new AttackResult(); }
AttackResult? retAttackResult = GameMain.LuaCs.Hook.Call<AttackResult?>("character.damageLimb", this, worldPosition, hitLimb, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier, allowStacking, penetration, shouldImplode);
if (retAttackResult != null)
{
return retAttackResult.Value;
}
SetStun(stun);
if (attacker != null && attacker != this &&
@@ -5103,6 +5129,7 @@ namespace Barotrauma
AchievementManager.OnCharacterKilled(this, CauseOfDeath);
}
GameMain.LuaCs.Hook.Call("character.death", this, causeOfDeathAffliction);
KillProjSpecific(causeOfDeath, causeOfDeathAffliction, log);
if (info != null)
@@ -482,6 +482,7 @@ namespace Barotrauma
{
GrainEffectStrength -= amount;
}
GameMain.LuaCs.Hook.Call("afflictionUpdate", new object[] { this, characterHealth, targetLimb, deltaTime });
}
public void ApplyStatusEffects(ActionType type, float deltaTime, CharacterHealth characterHealth, Limb targetLimb)
@@ -337,12 +337,13 @@ namespace Barotrauma
if (Prefab is AfflictionPrefabHusk huskPrefab)
{
if (huskPrefab.ControlHusk)
if (huskPrefab.ControlHusk || GameMain.LuaCs.Game.enableControlHusk)
{
#if SERVER
if (client != null)
{
GameMain.Server.SetClientCharacter(client, husk);
GameMain.LuaCs.Hook.Call("husk.clientControlHusk", new object[] { client, husk });
}
#else
if (!character.IsRemotelyControlled && character == Character.Controlled)
@@ -7,12 +7,17 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Xml.Linq;
using Barotrauma.Networking;
using Barotrauma.Extensions;
using System.Globalization;
using MoonSharp.Interpreter;
using Barotrauma.Abilities;
namespace Barotrauma
{
partial class CharacterHealth
{
class LimbHealth
public class LimbHealth
{
public Sprite IndicatorSprite;
public Sprite HighlightSprite;
@@ -480,6 +485,7 @@ namespace Barotrauma
{
AddLimbAffliction(limbHealth, limb: null, affliction, allowStacking: allowStacking, recalculateVitality: recalculateVitality);
}
}
else
{
@@ -497,17 +503,19 @@ namespace Barotrauma
/// </summary>
public float GetResistance(AfflictionPrefab afflictionPrefab, LimbType limbType)
{
// This is a % resistance (0 to 1.0)
float resistance = 0.0f;
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
{
var affliction = kvp.Key;
resistance += affliction.GetResistance(afflictionPrefab.Identifier, limbType);
lock (afflictions) {
// This is a % resistance (0 to 1.0)
float resistance = 0.0f;
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
{
var affliction = kvp.Key;
resistance += affliction.GetResistance(afflictionPrefab.Identifier, limbType);
}
// This is a multiplier, ie. 0.0 = 100% resistance and 1.0 = 0% resistance
float abilityResistanceMultiplier = Character.GetAbilityResistance(afflictionPrefab);
// The returned value is calculated to be a % resistance again
return 1 - ((1 - resistance) * abilityResistanceMultiplier);
}
// This is a multiplier, ie. 0.0 = 100% resistance and 1.0 = 0% resistance
float abilityResistanceMultiplier = Character.GetAbilityResistance(afflictionPrefab);
// The returned value is calculated to be a % resistance again
return 1 - ((1 - resistance) * abilityResistanceMultiplier);
}
public float GetStatValue(StatTypes statType)
@@ -649,6 +657,9 @@ namespace Barotrauma
return;
}
var should = GameMain.LuaCs.Hook.Call<bool?>("character.applyDamage", this, attackResult, hitLimb, allowStacking);
if (should != null && should.Value) { return; }
foreach (Affliction newAffliction in attackResult.Afflictions)
{
if (newAffliction.Prefab.LimbSpecific)
@@ -817,6 +828,11 @@ namespace Barotrauma
if (newAffliction.Prefab.TargetSpecies.Any() && newAffliction.Prefab.TargetSpecies.None(s => s == Character.SpeciesName)) { return; }
if (Character.Params.Health.ImmunityIdentifiers.Contains(newAffliction.Identifier)) { return; }
var should = GameMain.LuaCs.Hook.Call<bool?>("character.applyAffliction", this, limbHealth, newAffliction, allowStacking);
if (should != null && should.Value)
return;
Affliction existingAffliction = null;
foreach ((Affliction affliction, LimbHealth value) in afflictions)
{
@@ -282,16 +282,27 @@ namespace Barotrauma
#if SERVER
if (GameMain.Server != null && Entity.Spawner != null && createNetworkEvents)
{
if (GameMain.Server.EntityEventManager.UniqueEvents.Any(ev => ev.Entity == item))
try
{
string errorMsg = $"Error while spawning job items. Item {item.Name} created network events before the spawn event had been created.";
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("Job.InitializeJobItem:EventsBeforeSpawning", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
GameMain.Server.EntityEventManager.UniqueEvents.RemoveAll(ev => ev.Entity == item);
GameMain.Server.EntityEventManager.Events.RemoveAll(ev => ev.Entity == item);
if (GameMain.Server.EntityEventManager.UniqueEvents.ToList().Any(ev => ev.Entity == item))
{
string errorMsg = $"Error while spawning job items. Item {item.Name} created network events before the spawn event had been created.";
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("Job.InitializeJobItem:EventsBeforeSpawning", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
GameMain.Server.EntityEventManager.UniqueEvents.RemoveAll(ev => ev.Entity == item);
GameMain.Server.EntityEventManager.Events.RemoveAll(ev => ev.Entity == item);
}
}
catch
{
#if SERVER
Networking.GameServer.Log("Try making UniqueEvents snapshot failed", Networking.ServerLog.MessageType.Error);
#endif
}
finally
{
Entity.Spawner.CreateNetworkEvent(new EntitySpawner.SpawnEntity(item));
}
Entity.Spawner.CreateNetworkEvent(new EntitySpawner.SpawnEntity(item));
}
#endif
if (itemElement.GetAttributeBool("equip", false))
@@ -170,16 +170,28 @@ namespace Barotrauma
#if SERVER
if (GameMain.Server != null && Entity.Spawner != null)
{
if (GameMain.Server.EntityEventManager.UniqueEvents.Any(ev => ev.Entity == item))
try
{
string errorMsg = $"Error while spawning job items. Item {item.Name} created network events before the spawn event had been created.";
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("Job.InitializeJobItem:EventsBeforeSpawning", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
GameMain.Server.EntityEventManager.UniqueEvents.RemoveAll(ev => ev.Entity == item);
GameMain.Server.EntityEventManager.Events.RemoveAll(ev => ev.Entity == item);
if (GameMain.Server.EntityEventManager.UniqueEvents.ToList().Any(ev => ev.Entity == item))
{
string errorMsg = $"Error while spawning job items. Item {item.Name} created network events before the spawn event had been created.";
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("Job.InitializeJobItem:EventsBeforeSpawning", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
GameMain.Server.EntityEventManager.UniqueEvents.RemoveAll(ev => ev.Entity == item);
GameMain.Server.EntityEventManager.Events.RemoveAll(ev => ev.Entity == item);
}
}
catch
{
#if SERVER
Networking.GameServer.Log("Try making UniqueEvents snapshot failed", Networking.ServerLog.MessageType.Error);
#endif
}
finally
{
Entity.Spawner.CreateNetworkEvent(new EntitySpawner.SpawnEntity(item));
}
Entity.Spawner.CreateNetworkEvent(new EntitySpawner.SpawnEntity(item));
}
#endif
@@ -42,7 +42,7 @@ namespace Barotrauma
? (Core as ContentPackage).ToEnumerable().CollectionConcat(Regular)
: Enumerable.Empty<ContentPackage>();
private static class BackupPackages
public static class BackupPackages
{
public static CorePackage? Core;
public static ImmutableArray<RegularPackage>? Regular;
@@ -39,6 +39,7 @@ namespace Barotrauma
static partial class DebugConsole
{
public partial class Command
{
public readonly ImmutableArray<Identifier> Names;
@@ -164,7 +165,7 @@ namespace Barotrauma
private static WeakReference<Character> previousControlledCharacter; // For SP freecam
private static void AssignOnExecute(string names, Action<string[]> onExecute)
public static void AssignOnExecute(string names, Action<string[]> onExecute)
{
var matchingCommand = commands.Find(c => c.Names.Intersect(names.Split('|').ToIdentifiers()).Any());
if (matchingCommand == null)
@@ -3159,7 +3160,7 @@ namespace Barotrauma
}
}
private static void SpawnItem(string[] args, Vector2 cursorPos, Character controlledCharacter, out string errorMsg)
public static void SpawnItem(string[] args, Vector2 cursorPos, Character controlledCharacter, out string errorMsg)
{
errorMsg = "";
if (args.Length < 1) return;
@@ -759,6 +759,8 @@ namespace Barotrauma
ReadyCheck.ReadyCheckCooldown = DateTime.MinValue;
GUI.PreventPauseMenuToggle = false;
HintManager.OnRoundStarted();
GameMain.LuaCs.Hook.Call("roundStart");
EnableEventLogNotificationIcon(enabled: false);
LogStartRoundStats();
@@ -1045,6 +1047,9 @@ namespace Barotrauma
/// </remarks>
public static ImmutableHashSet<Character> GetSessionCrewCharacters(CharacterType type)
{
var result = GameMain.LuaCs.Hook.Call<Character[]?>("getSessionCrewCharacters", type);
if (result != null) return ImmutableHashSet.Create(result);
if (GameMain.GameSession?.CrewManager is not { } crewManager) { return ImmutableHashSet<Character>.Empty; }
IEnumerable<Character> players;
@@ -1083,6 +1088,9 @@ namespace Barotrauma
{
RoundEnding = true;
#if CLIENT
GameMain.LuaCs.Hook.Call("roundEnd");
#endif
//Clear the grids to allow for garbage collection
Powered.Grids.Clear();
Powered.ChangedConnections.Clear();
@@ -1101,6 +1109,8 @@ namespace Barotrauma
character.CheckTalents(AbilityEffectType.OnRoundEnd);
}
GameMain.LuaCs.Hook.Call("missionsEnded", missions);
#if CLIENT
if (GUI.PauseMenuOpen)
{
@@ -435,6 +435,7 @@ namespace Barotrauma.Items.Components
Structure targetStructure = target.UserData as Structure ?? targetFixture.UserData as Structure;
Item targetItem = target.UserData is Holdable h ? h.Item : target.UserData as Item ?? targetFixture.UserData as Item;
Entity targetEntity = targetCharacter ?? targetStructure ?? targetItem ?? target.UserData as Entity;
GameMain.LuaCs.Hook.Call("meleeWeapon.handleImpact", this, target);
if (Attack != null)
{
@@ -5,6 +5,8 @@ using System.Linq;
using System.Reflection;
using System.Xml.Linq;
using Barotrauma.Extensions;
using Barotrauma;
using MoonSharp.Interpreter;
using Barotrauma.IO;
using Barotrauma.Networking;
#if CLIENT
@@ -332,6 +332,9 @@ namespace Barotrauma.Items.Components
GameAnalyticsManager.AddDesignEvent("ItemDeconstructed:" + (GameMain.GameSession?.GameMode?.Preset.Identifier.Value ?? "none") + ":" + targetItem.Prefab.Identifier);
}
bool? result = GameMain.LuaCs.Hook.Call<bool?>("item.deconstructed", targetItem, this, user, allowRemove);
if (result == true) { return; }
if (targetItem.AllowDeconstruct && allowRemove)
{
//drop all items that are inside the deconstructed item
@@ -350,11 +350,15 @@ namespace Barotrauma.Items.Components
wire.RegisterSignal(signal, source: this);
#endif
SendSignalIntoConnection(signal, recipient);
GameMain.LuaCs.Hook.Call("signalReceived", signal, recipient);
GameMain.LuaCs.Hook.Call("signalReceived." + recipient.item.Prefab.Identifier, signal, recipient);
}
foreach (CircuitBoxConnection connection in CircuitBoxConnections)
{
connection.ReceiveSignal(signal);
GameMain.LuaCs.Hook.Call("signalReceived", signal, connection.Connection);
GameMain.LuaCs.Hook.Call("signalReceived." + connection.Connection.Item.Prefab.Identifier, signal, connection);
}
enumeratingWires = false;
foreach (var removedWire in removedWires)
@@ -1,18 +1,18 @@
namespace Barotrauma.Items.Components
{
public struct Signal
partial struct Signal
{
internal string value;
internal int stepsTaken;
internal Character sender;
internal Item source;
internal float power;
internal float strength;
public string value;
public int stepsTaken;
public Character sender;
public Item source;
public float power;
public float strength;
public readonly double CreationTime;
public double TimeSinceCreated => Timing.TotalTimeUnpaused - CreationTime;
internal Signal(string value, int stepsTaken = 0, Character sender = null,
public Signal(string value, int stepsTaken = 0, Character sender = null,
Item source = null, float power = 0.0f, float strength = 1.0f)
{
this.value = value;
@@ -228,6 +228,10 @@ namespace Barotrauma.Items.Components
public void TransmitSignal(Signal signal, bool sentFromChat)
{
var should = GameMain.LuaCs.Hook.Call<bool?>("wifiSignalTransmitted", this, signal, sentFromChat);
if (should != null && should.Value) { return; }
bool chatMsgSent = false;
var receivers = GetReceiversInRange();

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