beyond-all-reason / beyond-all-reason/RecoilEngine

[FR] Lua funcs for chat buffer

Open
#829 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

How about this?

`Spring.GetUserWriting()` -> string input, number meaning
`Spring.GetUserRawWriting()` -> string raw_input, number meaning

Meaning would be one of (cast from char to int, lua can use `string.byte`):
* 'a' if ally chat ("a: foo")
* 's' if spectator chat ("s: foo")
* 'c' if command ("/foo")
* 'e' if everyone chat ("foo")
* nil if not writing

For example if the chat textbox currently has "a: blabla" then:
* `Spring.GetUserWriting()` returns "blabla", 'a'
* `Spring.GetUserRawWriting()` returns "a: blabla", 'a'

Rationale: often you would want to strip the magic prefix anyway, which is better to do in C++, which is why the version that strips away the prefix. The "meaning" should be cheap to get and is also usually good to know. Technically anything other than the raw input is redundant so I wouldn't bemoan their lack too much, but it's good if people aren't forced to reimplement the other two in Lua.

Contributor guide

Open the contributing guide

Research direction

Start by locating the chat buffer implementation and the Lua binding entry points for the proposed Spring.GetUserWriting() and Spring.GetUserRawWriting() functions; the issue names no files or tests. Done means both functions distinguish ally, spectator, command, and everyone chat, return the specified stripped or raw text, return the meaning code, and return nil when the user is not writing.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
api, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.