beyond-all-reason / beyond-all-reason/RecoilEngine
Mark ConfigureLayout as deprecated and migrate basecontent LuaUI to GotChatMsg
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
See https://github.com/beyond-all-reason/RecoilEngine/blob/8036710bcfc849471aee57f958ed7629bd28d413/rts/Lua/LuaHandle.cpp#L629
`ConfigureLayout` is supposed to be deprecated, since `GotChatMsg` contemplates its use cases and more (all envs instead of only `LuaUI` and also passes `playerId`.
This task entails:
- Mark in the documentation `Callins:ConfigureLayout` as `@deprecated` with `@see Callins:GotChatMsg`
- Add global dispatch to widget handler for `GotChatMsg`, similar to https://github.com/beyond-all-reason/RecoilEngine/blob/b081fd2/cont/LuaUI/main.lua#L96-L98
- Remove handling for `ConfigureLayout` and migrate logic to `GotChatMsg` (special case where `playerId == myPlayerId` should be especially noted)
- At the end of the special handling for `playerId == myPlayerId` call `ConfigureLayout` as an artificial callin to keep compatibility until it gets removed
Test that the migration was successful by, testing on a game using basecontent or code from basecontent:
- Typing `/foo` makes the game receive a textaction registered with action handler, e.g. `widgetHandler.AddAction('foo', function() Spring.Echo("got foo!") end, nil, 't')`
- Using the old configurelayout actions also works, e.g. `/togglewidget `
- Widgets receive `TextAction` same as before
- Widgets that relied on `TextCommand` still receive it same as before
- Messages from other players don't trigger all above (these are special cases where playerId == myPlayerId) (might be difficult to test, not required, just should handle it). They should still trigger `GotChatMsg(msg, playerId)` as a widget callin
Contributor guide
Research direction
Start with rts/Lua/LuaHandle.cpp around the ConfigureLayout handling and cont/LuaUI/main.lua around the existing GotChatMsg dispatch. Trace the related Callins documentation and basecontent widget handlers, then exercise the listed chat, text-action, TextAction, TextCommand, and other-player cases in a game. Done means ConfigureLayout is documented as deprecated, migration behavior is preserved, and GotChatMsg reaches widgets as specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, lua
- Domain
- documentation, game-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100