Mafia now starts without admin intervention (#79348)

## About The Pull Request

Mafia should now start without the need of admin intervention.
I made a unit test that should always have a PDA and a ghost spawning in
a game of Mafia and having it run through basic setup to confirm they
both successfully sign up and the game starts.

I had to change a lot of things in order to get this working, such as
giving unique ckeys to mock clients, fixing harddels in Mafia, and
plenty of minor fixes. This is the first time any of this code is put in
CI, so a lot of uncaught errors are now showing their faces.

Because loading maps mid-round runtimes due to smoothing, I have mafia
their own unit test-only map that doesn't use smoothing.

I also split the mafia ui code into its own file, and moved a single
helper that was sitting around in mafia's file into a helpers file.

I also added some comments to explain why certain things are the way
they are, because I wrote some undocumented code previously and forgot a
few things, leading to self-inflicted wasted time.

## Why It's Good For The Game

^

## Changelog

🆑
fix: Mafia games can now start properly.
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
John Willard
2023-11-04 21:26:24 -04:00
committed by GitHub
parent 07bfd6c655
commit 88bb3afcce
24 changed files with 1446 additions and 701 deletions
@@ -16,11 +16,11 @@
/datum/computer_file/program/mafia/Destroy(force)
var/datum/mafia_controller/game = GLOB.mafia_game
if(!game)
return
return ..()
UnregisterSignal(game, COMSIG_MAFIA_GAME_END)
var/datum/mafia_role/pda_role = game.player_role_lookup[computer]
var/datum/mafia_role/pda_role = game.get_role_player(computer)
if(!pda_role)
return
return ..()
game.send_message(span_notice("[pda_role.body] has deleted the game from their PDA, and therefore has left the game."))
pda_role.kill(game)
return ..()
@@ -60,7 +60,7 @@
SIGNAL_HANDLER
RegisterSignal(game, COMSIG_MAFIA_GAME_END, PROC_REF(on_game_end))
ui_header = "mafia.gif"
if(game.player_role_lookup[computer])
if(game.get_role_player(computer))
alert_pending = TRUE
computer.alert_call(src, "Mafia game started!")