Commit Graph

73 Commits

Author SHA1 Message Date
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
8fcf0f7c8c Removed CsScriptRunner since its useless 2023-01-18 22:53:55 -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
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
2b871c8c48 Fix think hook getting called twice on the client 2022-12-15 09:12:03 -03:00
EvilFactory
0853357300 Move think hook to a better place 2022-11-13 15:56:37 -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
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
43810a3509 Use WorkshopId instead and minor cleanup 2022-10-28 12:26:47 -03:00
peelz
8774a33914 Fix possible NRE when stopping while a patched method is running 2022-09-15 19:31:47 -04:00
peelz
13d0510d37 Make lua converters private 2022-08-20 11:32:18 -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
d9dc84425d Make LuaCsSetup easier to integrate into unit tests 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
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
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
e73cd0f398 fix crash if a cs mod errors in the dispose method 2022-07-07 09:52:29 -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
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
64c81146fb added PerformanceCounter 2022-06-19 11:50:51 -03:00
Evil Factory
a2f8d0019f fix threading issues with initialization 2022-06-17 14:29:10 -03:00
Evil Factory
ed1fbdbe5e Potential fix for threading issues and added CSActive var 2022-06-09 16:02:18 -03:00
Evil Factory
7ee81aca24 fix formatting 2022-05-21 12:48:35 -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
74bf5d12ca added Steam.DownloadWorkshopItem and Steam.GetWorkshopItem 2022-05-17 19:15:44 -03:00
Evil Factory
11220bcff2 why are we manually collecting GC in cs 2022-05-07 14:20:16 -03:00
Evil Factory
64f0e2f137 Fixes for PR #80 2022-05-06 13:10:50 -03: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
Jacobin
87550af37d lua.LoadFile -> lua.LoadString 2022-05-05 10:23:17 +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
95a9c618e6 fix naming 2022-05-04 08:45:05 -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
9b9bfa7440 whoops 2022-05-02 19:33:42 -03:00
Evil Factory
79daf2ed32 better error handling 2022-05-02 16:36:55 -03:00
Evil Factory
3f221c0d23 fix nullable errors 2022-04-29 17:58:56 -03:00
Evil Factory
af47136bbd use cs package from backup packages 2022-04-29 14:00:53 -03:00
Oiltanker
e5215fb976 Cs source folder filter 2022-04-28 17:13:13 +03: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
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
5946a4c043 fix package names 2022-04-20 14:20:38 -03:00