[MIRROR] Mafia can be played on your PDA [MDB IGNORE] (#24485)

* Mafia can be played on your PDA (#78576)

## About The Pull Request

Mafia is now friggin playable from the PDA, I also changed other stuff
too

- You can't use abilities on dead people if you're not supposed to (cant
kill the same person over and over)
- Changelings cant kill other Changelings
- Changelings can now only talk to eachother at night, rather than using
:j
- Everyone starts spawned in the center of the map, since people playing
on PDA can't move their characters. This is so everyone can hear PDA
users in person, as I don't want the chat log to be mandatory.

To do this, all messages you are meant to be able to see, is now logged
for you to see in your Mafia panel. This essentially means that people
playing through the PDA get a downgraded version of it, but I don't know
how much larger I want this UI to be.

Playing Mafia through the PDA will not tell you of other players ahead
of time when signing up (as it shows ckeys + pdas), but they can see the
names in-game. Unfortunately this means we'll have to remove your
customization coming with you, to prevent using it to tell who is dead
in round.

Things I am missing
- Program overlays on PDA/Laptop/Computer
- Icon for the app's header while a game is active

I'm not a spriter and can't make either of these

This is the new UI

![image](https://github.com/tgstation/tgstation/assets/53777086/7cf503d9-b2e2-4127-874a-acad6425d649)

I also fixed alert calls for PDAs and stuff

![image](https://github.com/tgstation/tgstation/assets/53777086/e09b2e5e-b9e7-43ae-9273-c168e9c8e642)

and removed the X at the top on computers since they had no battery

![image](https://github.com/tgstation/tgstation/assets/53777086/d3dd8307-805c-4aba-be5e-4c24a0bdcb91)

Looks a little better now hopefully 👍

## Why It's Good For The Game

- The current Arcade app sucks, and is a solo game. This is much more
entertaining and you can talk to others in it, which is swag as fuck.
- There's a larger potential playerbase for the Minigame making it more
likely to be played.
- Sets groundwork for a better version of
https://github.com/tgstation/tgstation/pull/75879
- Adds more suspense and teamwork in the minigame.

## Changelog

🆑 JohnFulpWillard, sprites by CoiledLamb
add: You can now play Mafia on your PDA.
balance: Mafia changelings can now only talk to eachother during the
night.
fix: Mafia abilities can't be repeatedly used on people.
/🆑

* Mafia can be played on your PDA

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-10-21 20:25:33 +02:00
committed by GitHub
parent 9a62cb272b
commit 69ea3c81ad
43 changed files with 711 additions and 409 deletions
@@ -19,11 +19,11 @@
/datum/computer_file/program/ntnet_dos/process_tick(seconds_per_tick)
dos_speed = 0
switch(ntnet_status)
if(1)
if(NTNET_LOW_SIGNAL)
dos_speed = NTNETSPEED_LOWSIGNAL * 10
if(2)
if(NTNET_GOOD_SIGNAL)
dos_speed = NTNETSPEED_HIGHSIGNAL * 10
if(3)
if(NTNET_ETHERNET_SIGNAL)
dos_speed = NTNETSPEED_ETHERNET * 10
if(target && executed)
target.dos_overload += dos_speed
@@ -18,12 +18,9 @@
/// The file under consideration.
var/datum/computer_file/data/ordnance/selected_file
/datum/computer_file/program/scipaper_program/New()
/datum/computer_file/program/scipaper_program/on_install(datum/computer_file/source, obj/item/modular_computer/computer_installing)
. = ..()
paper_to_be = new
/datum/computer_file/program/scipaper_program/on_start(mob/living/user)
. = ..()
if(!CONFIG_GET(flag/no_default_techweb_link) && !linked_techweb)
CONNECT_TO_RND_SERVER_ROUNDSTART(linked_techweb, computer)
@@ -0,0 +1,72 @@
/datum/computer_file/program/mafia
filename = "mafia"
filedesc = "Mafia"
program_icon_state = "mafia"
extended_desc = "A program that allows you to play the infamous Mafia game, straight from your Modular PC."
requires_ntnet = FALSE
size = 6
tgui_id = "NtosMafiaPanel"
program_icon = "user-secret"
alert_able = TRUE
/datum/computer_file/program/mafia/on_install(datum/computer_file/source, obj/item/modular_computer/computer_installing)
. = ..()
RegisterSignal(SSdcs, COMSIG_MAFIA_GAME_START, PROC_REF(on_game_start))
/datum/computer_file/program/mafia/Destroy(force)
var/datum/mafia_controller/game = GLOB.mafia_game
if(!game)
return
UnregisterSignal(game, COMSIG_MAFIA_GAME_END)
var/datum/mafia_role/pda_role = game.player_role_lookup[computer]
if(!pda_role)
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 ..()
/datum/computer_file/program/mafia/ui_static_data(mob/user)
var/list/data = list()
var/datum/mafia_controller/game = GLOB.mafia_game
if(!game)
game = create_mafia_game()
data += game.ui_static_data(computer)
return data
/datum/computer_file/program/mafia/ui_data(mob/user)
var/list/data = list()
var/datum/mafia_controller/game = GLOB.mafia_game
if(!game)
game = create_mafia_game()
data += game.ui_data(computer)
return data
/datum/computer_file/program/mafia/ui_assets(mob/user)
var/list/data = list()
var/datum/mafia_controller/game = GLOB.mafia_game
if(!game)
game = create_mafia_game()
data += game.ui_assets(user)
return data
/datum/computer_file/program/mafia/ui_act(mob/user, params, datum/tgui/ui, datum/ui_state/state)
var/datum/mafia_controller/game = GLOB.mafia_game
if(!game)
game = create_mafia_game()
return game.ui_act(user, params, ui, state)
///Called when a game of Mafia starts, sets the ui header to the proper one.
/datum/computer_file/program/mafia/proc/on_game_start(datum/controller/subsystem/processing/dcs/source, datum/mafia_controller/game)
SIGNAL_HANDLER
RegisterSignal(game, COMSIG_MAFIA_GAME_END, PROC_REF(on_game_end))
ui_header = "mafia.gif"
if(game.player_role_lookup[computer])
alert_pending = TRUE
computer.alert_call(src, "Mafia game started!")
///Called when a game of Mafia ends, deletes its ui header.
/datum/computer_file/program/mafia/proc/on_game_end(datum/mafia_controller/game)
SIGNAL_HANDLER
UnregisterSignal(game, COMSIG_MAFIA_GAME_END)
ui_header = null
update_static_data_for_all_viewers()
@@ -7,19 +7,16 @@
size = 4
requires_ntnet = TRUE
available_on_ntnet = FALSE
ui_header = "downloader_finished.gif"
tgui_id = "NtosNetDownloader"
program_icon = "download"
var/datum/computer_file/program/downloaded_file = null
var/datum/computer_file/program/downloaded_file
var/hacked_download = FALSE
var/download_completion = FALSE //GQ of downloaded data.
var/download_netspeed = 0
var/downloaderror = ""
var/list/main_repo
var/list/antag_repo
var/list/show_categories = list(
var/static/list/show_categories = list(
PROGRAM_CATEGORY_CREW,
PROGRAM_CATEGORY_ENGI,
PROGRAM_CATEGORY_SCI,
@@ -27,10 +24,9 @@
PROGRAM_CATEGORY_MISC,
)
/datum/computer_file/program/ntnetdownload/on_start()
/datum/computer_file/program/ntnetdownload/kill_program(mob/user)
. = ..()
main_repo = SSmodular_computers.available_station_software
antag_repo = SSmodular_computers.available_antag_software
ui_header = null
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(filename)
if(downloaded_file)
@@ -50,10 +46,10 @@
ui_header = "downloader_running.gif"
if(PRG in main_repo)
if(PRG in SSmodular_computers.available_station_software)
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.")
hacked_download = FALSE
else if(PRG in antag_repo)
else if(PRG in SSmodular_computers.available_antag_software)
generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.")
hacked_download = TRUE
else
@@ -68,7 +64,7 @@
generate_network_log("Aborted download of file [hacked_download ? "**ENCRYPTED**" : "[downloaded_file.filename].[downloaded_file.filetype]"].")
downloaded_file = null
download_completion = FALSE
ui_header = "downloader_finished.gif"
ui_header = null
/datum/computer_file/program/ntnetdownload/proc/complete_file_download()
if(!downloaded_file)
@@ -90,11 +86,11 @@
download_netspeed = 0
// Speed defines are found in misc.dm
switch(ntnet_status)
if(1)
if(NTNET_LOW_SIGNAL)
download_netspeed = NTNETSPEED_LOWSIGNAL
if(2)
if(NTNET_GOOD_SIGNAL)
download_netspeed = NTNETSPEED_HIGHSIGNAL
if(3)
if(NTNET_ETHERNET_SIGNAL)
download_netspeed = NTNETSPEED_ETHERNET
download_completion += download_netspeed
@@ -132,7 +128,7 @@
data["disk_used"] = computer.used_capacity
data["emagged"] = (computer.obj_flags & EMAGGED)
var/list/repo = antag_repo | main_repo
var/list/repo = SSmodular_computers.available_antag_software | SSmodular_computers.available_station_software
var/list/program_categories = list()
for(var/datum/computer_file/program/programs as anything in repo)
@@ -147,7 +143,7 @@
"installed" = !!computer.find_file_by_name(programs.filename),
"compatible" = check_compatibility(programs),
"size" = programs.size,
"access" = (computer.obj_flags & EMAGGED) && programs.available_on_syndinet ? TRUE : programs.can_run(user, transfer = TRUE, access = access),
"access" = programs.can_run(user, transfer = TRUE, access = access),
"verifiedsource" = programs.available_on_ntnet,
))
@@ -21,7 +21,7 @@
/// Sequence var for the id cache
var/id_cache_seq = 1
/datum/computer_file/program/science/on_start(mob/living/user)
/datum/computer_file/program/science/on_install(datum/computer_file/source, obj/item/modular_computer/computer_installing)
. = ..()
if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research)
CONNECT_TO_RND_SERVER_ROUNDSTART(stored_research, computer)