Skip to content

Resolve SteamIDs of Chat and Kill messages + some event loop changes#157

Merged
Bash-09 merged 4 commits intomainfrom
Bash/MessageChanges
Jun 22, 2024
Merged

Resolve SteamIDs of Chat and Kill messages + some event loop changes#157
Bash-09 merged 4 commits intomainfrom
Bash/MessageChanges

Conversation

@Bash-09
Copy link
Copy Markdown
Contributor

@Bash-09 Bash-09 commented Jun 12, 2024

  • Renamed some event loop types (StateUpdater -> Message, HandlerStruct -> MessageHandler)
  • Removed default implementation of Message, now all types that are used as messages must implement it explicitly (couldn't find a nice way to work around this :c )
  • Added a preprocessing step to messages, allowing them to initialise themselves using the current state before being handled
  • Chat and Kill messages now resolve the user/victim/killer SteamIDs in preprocessing

Comment on lines +82 to +86
#[serde(serialize_with = "serialize_maybe_steamid_as_string")]
pub killer_steamid: Option<SteamID>,
pub victim_name: String,
pub victim_steamid: Option<String>,
#[serde(serialize_with = "serialize_maybe_steamid_as_string")]
pub victim_steamid: Option<SteamID>,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lili7h Can you please check that this doesn't mess up the format you've got for the chat and kill SSE broadcasts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sse-sub-py3.11) PS F:\projects\mac\http-sse-event-viewer> python .\sse_sub\main.py
{"type":"ChatMessage","uuid":"8319d9f9-8502-47fc-8182-610cba47d174","time":"2024-06-20T11:51:37.442910500Z","event":{"player_name":"werewolf paws","steamid":"76561198071482715","message":"test"}}
{"type":"PlayerKill","uuid":"18ebb893-5d7f-4246-9c1f-297d3771c99a","time":"2024-06-20T11:51:59.143187700Z","event":{"killer_name":"The Administrator","killer_steamid":null,"victim_name":"SMELLY UNFORTUNATE","victim_steamid":null,"weapon":"tf_projectile_rocket","crit":false}}
{"type":"PlayerKill","uuid":"0f60b07b-d917-4f0c-b5f6-e2b706741641","time":"2024-06-20T11:52:00.073279900Z","event":{"killer_name":"werewolf paws","killer_steamid":"76561198071482715","victim_name":"A Professional With Standards","victim_steamid":null,"weapon":"pistol_scout","crit":false}}
{"type":"PlayerKill","uuid":"a8e7b4a6-1c14-42bc-8cd2-933f44623353","time":"2024-06-20T11:52:02.491183600Z","event":{"killer_name":"WITCH","killer_steamid":null,"victim_name":"Glorified Toaster with Legs","victim_steamid":null,"weapon":"tf_projectile_rocket","crit":true}}
{"type":"PlayerKill","uuid":"a6c63858-1f73-4292-bfa7-a254d57213e3","time":"2024-06-20T11:52:05.870727300Z","event":{"killer_name":"WITCH","killer_steamid":null,"victim_name":"Poopy Joe","victim_steamid":null,"weapon":"tf_projectile_rocket","crit":false}}
{"type":"PlayerKill","uuid":"8a6c1ba2-de4a-4643-966d-bae6b10f8cc8","time":"2024-06-20T11:52:05.870824800Z","event":{"killer_name":"The Administrator","killer_steamid":null,"victim_name":"WITCH","victim_steamid":null,"weapon":"world","crit":false}}
{"type":"PlayerKill","uuid":"2e305521-37d2-44e0-a60e-58fc46d47898","time":"2024-06-20T11:52:06.427960700Z","event":{"killer_name":"Ribs Grow Back","killer_steamid":null,"victim_name":"Archimedes!","victim_steamid":null,"weapon":"minigun","crit":false}}
{"type":"PlayerKill","uuid":"3b71ba0c-c7d3-4ced-8848-ec592bc47d2f","time":"2024-06-20T11:52:07.171984100Z","event":{"killer_name":"Kill Me","killer_steamid":null,"victim_name":"Chucklenuts","victim_steamid":null,"weapon":"pistol_scout","crit":false}}
{"type":"PlayerKill","uuid":"12e6aadc-0d5f-4e17-ba9f-7b82011c822b","time":"2024-06-20T11:52:13.960914600Z","event":{"killer_name":"Ribs Grow Back","killer_steamid":null,"victim_name":"The Administrator","victim_steamid":null,"weapon":"minigun","crit":false}}
{"type":"PlayerKill","uuid":"ef22439e-b8c7-424d-be3c-15a9a5f04e11","time":"2024-06-20T11:52:15.603965200Z","event":{"killer_name":"It's Filthy in There!","killer_steamid":null,"victim_name":"Ribs Grow Back","victim_steamid":null,"weapon":"tf_projectile_pipe","crit":false}}
{"type":"PlayerKill","uuid":"b9a2f4b2-cd0e-4882-959e-fe969cd5f340","time":"2024-06-20T11:52:18.642002600Z","event":{"killer_name":"werewolf paws","killer_steamid":"76561198071482715","victim_name":"Kill Me","victim_steamid":null,"weapon":"force_a_nature","crit":false}}
{"type":"PlayerKill","uuid":"06d844be-1689-47c9-9b42-aad26af5cbf8","time":"2024-06-20T11:52:22.765010700Z","event":{"killer_name":"werewolf paws","killer_steamid":"76561198071482715","victim_name":"CryBaby","victim_steamid":null,"weapon":"pistol_scout","crit":false}}
{"type":"PlayerKill","uuid":"849befcb-1931-4d42-aa73-0cd757b264a3","time":"2024-06-20T11:52:22.888971400Z","event":{"killer_name":"Mentlegen","killer_steamid":null,"victim_name":"It's Filthy in There!","victim_steamid":null,"weapon":"world","crit":false}}
{"type":"PlayerKill","uuid":"b9958b63-046f-4cc4-9060-5708a44d5bd4","time":"2024-06-20T11:52:33.863051700Z","event":{"killer_name":"SMELLY UNFORTUNATE","killer_steamid":null,"victim_name":"A Professional With Standards","victim_steamid":null,"weapon":"obj_sentrygun","crit":false}}
{"type":"PlayerKill","uuid":"1cd817a3-5e05-42a2-936e-944555cd520b","time":"2024-06-20T11:52:35.598970400Z","event":{"killer_name":"Mentlegen","killer_steamid":null,"victim_name":"Glorified Toaster with Legs","victim_steamid":null,"weapon":"tf_projectile_rocket","crit":false}}
{"type":"PlayerKill","uuid":"b7fd7829-afe2-4127-be61-727eae76ab21","time":"2024-06-20T11:52:36.590947400Z","event":{"killer_name":"werewolf paws","killer_steamid":"76561198071482715","victim_name":"Archimedes!","victim_steamid":null,"weapon":"nonnonviolent_protest","crit":false}}
{"type":"PlayerKill","uuid":"7591d7e2-342a-4355-b2a5-298fffbf7267","time":"2024-06-20T11:52:37.645047600Z","event":{"killer_name":"Poopy Joe","killer_steamid":null,"victim_name":"werewolf paws","victim_steamid":"76561198071482715","weapon":"syringegun_medic","crit":false}}

Looks good to me, noting that testing with bots kinda sucks because they dont have steam IDs, but mine got in there just fine!

Copy link
Copy Markdown
Contributor

@lili7h lili7h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to not be impacting SSE behaviour in any way. LGTM 👍

@Bash-09 Bash-09 force-pushed the Bash/MessageChanges branch from 2fb5f5b to 8caaf0c Compare June 22, 2024 04:47
@Bash-09 Bash-09 merged commit ed335e3 into main Jun 22, 2024
@Bash-09 Bash-09 deleted the Bash/MessageChanges branch June 22, 2024 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants