Add support for the `ModeratorEvent` sim callback
Closed this issue · 0 comments
Garanas commented
Description
The goal is to introduce a new sim callback with the sole responsibility to inform the moderators. At the moment we (ab)use the GiveResourcesToPlayer
callback which is also (ab)used by chat messages. Therefore we'll effectively extend the functionality of the following file/class:
- faf-commons-data/src/main/java/com/faforever/commons/replay/ReplayDataParser.java
Checklist
- Create a new class called
ModeratorEvent
, similar to ChatMessage except that there's no receiver field. - Create a new private field
ModeratorEvents
in the ReplayDataParser class. This will be an array list of typeModeratorEvent
, just like the chat messages are. - In the function
parseTicks
we want to extend the caseCMDST_LUA_SIM_CALLBACK
to also check for theModeratorEvent
sim callback. The format of the sim callback is as follows:
---@class ModeratorEvent
---@field From number
---@field Message string
And as an example:
{ From: 1, Message: 'killed 50 units' }
These should be parsed and pushed into the previously mentioned private field ModeratorEvents
. An (untested) example can be found in: #102
Notes
It may be interesting to also store the active command source in the ModeratorEvent
class. If the player in question is not meddling with the callbacks, it should represent the same value as the From
field in the callback.