Commit Graph

47 Commits

Author SHA1 Message Date
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
peelz 860449aaed Fix NRE in GUI lua converters 2022-08-17 19:49:08 -04:00
EvilFactory 53b92e3a44 added RespawnManager to Game 2022-08-14 10:54:50 -03: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 4bccc33c4f added Game.ServerSettings for clients and Game.Client/Game.Server 2022-08-10 16:52:54 -03:00
peelz 4f17a88781 Fix incorrect LuaXXX type converter used in overload disambiguation 2022-08-10 05:36:17 -04:00
peelz 4a6e13a0dc Refactor LuaDocs generator 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 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 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 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 7ce7e6e763 Support resolving methods with ref/out parameters 2022-08-09 17:50:00 -04: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
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 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 efd1243754 Minor refactor for LuaUserData.lua 2022-06-14 13:09:52 -03:00
Evil Factory 59d4ec8ad7 Game.LoadGame, Game.SaveGame and Game.LoadCampaign 2022-06-05 14:25:40 -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
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 6ddfc985d3 fix AddCommand arguments being wrong and fixed getValidArgs not doing anything 2022-05-28 15:06:22 -03:00
Evil Factory 05e9978671 Sounds and LightManager 2022-05-22 13:29:55 -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 74bf5d12ca added Steam.DownloadWorkshopItem and Steam.GetWorkshopItem 2022-05-17 19:15:44 -03:00
Evil Factory fd6b833c98 misc doc fixes 2022-05-16 13:53:39 -03:00
Evil Factory e7510cad76 fix Game.RoundStarted and improve error handling 2022-05-07 15:36:47 -03:00
Evil Factory c8ec13fb56 added powered update interval 2022-05-05 13:18:50 -03: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 4b024d525f update docs 2022-05-02 15:51:03 -03:00
Evil Factory 9b5932760c fix compile errors 2022-04-28 12:50:39 -03:00
Jacobin ac920a8da9 Improve LuaRequire 2022-04-24 18:12:53 +10: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
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
zhurengong 1b0c865459 should get the last assembly 2022-04-19 18:51:53 +08: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
Evil Factory f439cabc9a fix patch hooks and rename delegates 2022-04-16 12:44:50 -03:00
zhurengong 67767d5c9d added OnValueEnteredHandler handler 2022-04-16 18:16:31 +08:00
Evil Factory b7395bedea Refactor and fix #56 2022-04-15 19:08:27 -03:00