mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
[MIRROR] Mafia panel fixes [MDB IGNORE] (#24935)
* Mafia panel fixes (#79573) * Mafia panel fixes --------- Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
co-authored by
John Willard
parent
85a50f5012
commit
dc37aa5825
@@ -900,7 +900,7 @@
|
||||
|
||||
///Gets the total amount of everything in the associative list.
|
||||
/proc/assoc_value_sum(list/input)
|
||||
var/list/keys = list()
|
||||
var/keys = 0
|
||||
for(var/key in input)
|
||||
keys += input[key]
|
||||
return keys
|
||||
|
||||
@@ -196,6 +196,7 @@ GLOBAL_LIST_INIT(mafia_role_by_alignment, setup_mafia_role_by_alignment())
|
||||
for(var/datum/mafia_role/roles as anything in all_roles)
|
||||
var/obj/item/modular_computer/modpc = roles.player_pda
|
||||
if(!modpc)
|
||||
update_static_data(roles.body)
|
||||
continue
|
||||
modpc.update_static_data_for_all_viewers()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/datum/mafia_controller/ui_static_data(atom/user)
|
||||
var/list/data = list()
|
||||
|
||||
if(usr.client?.holder)
|
||||
if(usr?.client?.holder)
|
||||
data["admin_controls"] = TRUE //show admin buttons to start/setup/stop
|
||||
data["is_observer"] = isobserver(user)
|
||||
data["all_roles"] = current_setup_text
|
||||
@@ -59,6 +59,7 @@
|
||||
player_info["possible_actions"] = list()
|
||||
|
||||
if(user_role) //not observer
|
||||
player_info["is_you"] = (role.body.real_name == user_role.body.real_name)
|
||||
for(var/datum/mafia_ability/action as anything in user_role.role_unique_actions)
|
||||
if(action.validate_action_target(src, potential_target = role, silent = TRUE))
|
||||
player_info["possible_actions"] += list(list("name" = action, "ref" = REF(action)))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/datum/mafia_role/obsessed
|
||||
name = "Obsessed"
|
||||
desc = "You're completely lost in your own mind. You win by lynching your obsession before you get killed in this mess. Obsession assigned on the first night!"
|
||||
desc = "Lynch your obsession before you get killed at all costs!"
|
||||
win_condition = "lynch their obsession."
|
||||
revealed_outfit = /datum/outfit/mafia/obsessed
|
||||
team = MAFIA_TEAM_SOLO
|
||||
@@ -15,20 +15,26 @@
|
||||
|
||||
/datum/mafia_role/obsessed/New(datum/mafia_controller/game) //note: obsession is always a townie
|
||||
. = ..()
|
||||
desc = initial(desc) + " Obsessions are assigned on the first night."
|
||||
RegisterSignal(game, COMSIG_MAFIA_SUNDOWN, PROC_REF(find_obsession))
|
||||
|
||||
/datum/mafia_role/obsessed/proc/find_obsession(datum/mafia_controller/game)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/list/all_roles_shuffle = shuffle(game.living_roles)
|
||||
var/list/all_roles_shuffle = shuffle(game.living_roles) - src
|
||||
for(var/datum/mafia_role/possible as anything in all_roles_shuffle)
|
||||
if(possible.team == MAFIA_TEAM_TOWN)
|
||||
obsession = possible
|
||||
break
|
||||
if(!obsession)
|
||||
obsession = pick(all_roles_shuffle) //okay no town just pick anyone here
|
||||
//if you still don't have an obsession you're playing a single player game like i can't help your dumb ass
|
||||
to_chat(body, span_userdanger("Your obsession is [obsession.body.real_name]! Get them lynched to win!"))
|
||||
desc = initial(desc) + " Target: [obsession.body.real_name]"
|
||||
var/obj/item/modular_computer/modpc = player_pda
|
||||
if(modpc)
|
||||
modpc.update_static_data_for_all_viewers()
|
||||
else
|
||||
game.update_static_data(body)
|
||||
send_message_to_player(span_userdanger("Your obsession is [obsession.body.real_name]! Get them lynched to win!"))
|
||||
RegisterSignal(obsession, COMSIG_MAFIA_ON_KILL, PROC_REF(check_victory))
|
||||
UnregisterSignal(game, COMSIG_MAFIA_SUNDOWN)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { classes } from 'common/react';
|
||||
import { BooleanLike, classes } from 'common/react';
|
||||
import { decodeHtmlEntities } from 'common/string';
|
||||
import { multiline } from 'common/string';
|
||||
import { useBackend, useLocalState } from '../backend';
|
||||
@@ -16,6 +16,7 @@ type RoleInfo = {
|
||||
|
||||
type PlayerInfo = {
|
||||
name: string;
|
||||
is_you: BooleanLike;
|
||||
ref: string;
|
||||
alive: string;
|
||||
possible_actions: ActionInfo[];
|
||||
@@ -431,7 +432,8 @@ const MafiaPlayers = (props, context) => {
|
||||
<Flex.Item className="Section__title candystripe" key={player.ref}>
|
||||
<Stack align="center">
|
||||
<Stack.Item grow color={!player.alive && 'red'}>
|
||||
{player.name} {!player.alive && '(DEAD)'}
|
||||
{player.name}
|
||||
{player.is_you && ' (YOU)'} {!player.alive && '(DEAD)'}
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
{player.votes !== undefined &&
|
||||
|
||||
Reference in New Issue
Block a user