Daedalus Dock - Modules - TypesVar Details - Proc Details

mafia_controller

The mafia controller handles the mafia minigame in progress. It is first created when the first ghost signs up to play.

Vars

all_rolesall roles in the game, dead or alive. check their game status if you only want living or dead.
current_maptemplate picked when the game starts. used for the name and desc reading
current_setup_textReadable list of roles in current game, sent to the tgui panel for roles list > list("Psychologist x1", "Clown x2")
custom_setupfor debugging and testing a full game, or adminbuse. If this is not empty, it will use this as a setup. clears when game is over
day_phase_periodtalk with others about the last night
debugused for debugging in testing (doesn't put people out of the game, some other shit i forgot, who knows just don't set this in live) honestly kinda deprecated
first_day_phase_periodfirst day has no voting, and thus is shorter
judgement_abstain_votesand these (judgement_innocent_votes, judgement_abstain_votes and judgement_guilty_votes) are the judgement phase votes, aka people sorting themselves into guilty and innocent, and "eh, i don't really care" lists. whichever has more inno or guilty wins!
judgement_lynch_periodguilty or innocent, we want a bit of time for players to process the outcome of the vote
judgement_phase_perioddefend yourself! don't get lynched! sometimes skipped if nobody votes.
landmarksspawn points for players, each one has a house
map_deletermap generation tool that deletes the current map after the game finishes
next_phase_timercurrent timer for phase
night_phase_periodmafia talk at night and pick someone to kill, some town roles use their actions, etc etc.
on_trialcurrent role on trial for the judgement phase, will die if guilty is greater than innocent
phasewhat part of the game you're playing in. day phases, night phases, judgement phases, etc.
player_outfitstarting outfit for all mafia players. it's just a grey jumpsuit.
player_role_lookupexists to speed up role retrieval, it's a dict. player_role_lookup[player ckey] will give you the role they play
spectatorslist of observers that should get game updates.
speed_upif enabled, the game has fallen under half pop and is sped up
town_center_landmarktown center for when people get put on trial
turnhow long the game has gone on for, changes with every sunrise. day one, night one, day two, etc.
victory_lap_periodlike the lynch period, players need to see what the other players in the game's roles were
votesgroup voting on one person, like putting people to trial or choosing who to kill as mafia
voting_phase_periodvote someone to get put on trial

Procs

add_setup_roleHelper proc that adds a random role of a type to a setup. if it doesn't exist in the setup, it adds the path to the list and otherwise bumps the path in the list up one. unique roles can only get added once.
award_rolePHASE ONE: TALLY UP ALL NUMBERS OF PEOPLE STILL ALIVE PHASE TWO: SEND STATS TO SOLO ANTAGS, SEE IF THEY WON OR TEAMS CANNOT WIN Lets the game award roles with all their checks and sanity, prevents achievements given out for debug games
basic_setupCalled when enough players have signed up to fill a setup. DOESN'T NECESSARILY MEAN THE GAME WILL START.
check_signupsFilters inactive player into a different list until they reconnect, and removes players who are no longer ghosts.
check_trialPlayers have voted someone up, and now the person must defend themselves while the town votes innocent or guilty.
check_victoryChecks to see if a faction (or solo antagonist) has won.
create_bodiesCalled when the game is setting up, AFTER map is loaded but BEFORE the phase timers start. Creates and places each role's body and gives the correct player key
display_votesAdds mutable appearances to people who get publicly voted on (so not night votes) showing how many people are picking them Arguments:
end_gameCleans up the game, resetting variables back to the beginning and removing the map with the generator.
generate_random_setupReturns a semirandom setup with 12 roles. balance not guaranteed!
get_random_voterReturns a random person who voted for whatever vote (day vote, night kill vote) Arguments:
get_vote_countReturns how many people voted for the role, in whatever vote (day vote, night kill vote) Arguments:
get_vote_winnerReturns whichever role got the most votes, in whatever vote (day vote, night kill vote) returns null if no votes Arguments:
lockdownAfter the voting and judgement phases, the game goes to night shutting the windows and beginning night with a proc.
lynchPlayers have voted innocent or guilty on the person on trial, and that person is now killed or returned home.
prepare_gameTriggers at beginning of the game when there is a confirmed list of valid, ready players. Creates a 100% ready game that has NOT started (no players in bodies) Followed by start game
reset_votesClears out the votes of a certain type (day votes, mafia kill votes) while leaving others untouched
resolve_nightThe end of the night, and a series of signals for the order of events on a night.
send_homeTeenie helper proc to move players back to their home. Used in the above, but also used in the debug button "send all players home" Arguments:
start_dayHow every day starts.
start_gameThe game by this point is now all set up, and so we can put people in their bodies and start the first phase.
start_nightThe actual start of night for players. Mostly info is given at the start of the night as the end of the night is when votes and actions are submitted and tried.
start_the_endThe end of the game is in two procs, because we want a bit of time for players to see eachothers roles. Because of how check_victory works, the game is halted in other places by this point.
start_voting_phasePlayers have finished the discussion period, and now must put up someone to the chopping block.
toggle_night_curtainsShuts poddoors attached to mafia. Arguments:
try_autostartCalled when someone signs up, and sees if there are enough people in the signup list to begin.
vote_forProc that goes off when players vote for something with their mafia panel.

Var Details

all_roles

all roles in the game, dead or alive. check their game status if you only want living or dead.

current_map

template picked when the game starts. used for the name and desc reading

current_setup_text

Readable list of roles in current game, sent to the tgui panel for roles list > list("Psychologist x1", "Clown x2")

custom_setup

for debugging and testing a full game, or adminbuse. If this is not empty, it will use this as a setup. clears when game is over

day_phase_period

talk with others about the last night

debug

used for debugging in testing (doesn't put people out of the game, some other shit i forgot, who knows just don't set this in live) honestly kinda deprecated

first_day_phase_period

first day has no voting, and thus is shorter

judgement_abstain_votes

and these (judgement_innocent_votes, judgement_abstain_votes and judgement_guilty_votes) are the judgement phase votes, aka people sorting themselves into guilty and innocent, and "eh, i don't really care" lists. whichever has more inno or guilty wins!

judgement_lynch_period

guilty or innocent, we want a bit of time for players to process the outcome of the vote

judgement_phase_period

defend yourself! don't get lynched! sometimes skipped if nobody votes.

landmarks

spawn points for players, each one has a house

map_deleter

map generation tool that deletes the current map after the game finishes

next_phase_timer

current timer for phase

night_phase_period

mafia talk at night and pick someone to kill, some town roles use their actions, etc etc.

on_trial

current role on trial for the judgement phase, will die if guilty is greater than innocent

phase

what part of the game you're playing in. day phases, night phases, judgement phases, etc.

player_outfit

starting outfit for all mafia players. it's just a grey jumpsuit.

player_role_lookup

exists to speed up role retrieval, it's a dict. player_role_lookup[player ckey] will give you the role they play

spectators

list of observers that should get game updates.

speed_up

if enabled, the game has fallen under half pop and is sped up

town_center_landmark

town center for when people get put on trial

turn

how long the game has gone on for, changes with every sunrise. day one, night one, day two, etc.

victory_lap_period

like the lynch period, players need to see what the other players in the game's roles were

votes

group voting on one person, like putting people to trial or choosing who to kill as mafia

voting_phase_period

vote someone to get put on trial

Proc Details

add_setup_role

Helper proc that adds a random role of a type to a setup. if it doesn't exist in the setup, it adds the path to the list and otherwise bumps the path in the list up one. unique roles can only get added once.

award_role

PHASE ONE: TALLY UP ALL NUMBERS OF PEOPLE STILL ALIVE PHASE TWO: SEND STATS TO SOLO ANTAGS, SEE IF THEY WON OR TEAMS CANNOT WIN Lets the game award roles with all their checks and sanity, prevents achievements given out for debug games

Arguments:

basic_setup

Called when enough players have signed up to fill a setup. DOESN'T NECESSARILY MEAN THE GAME WILL START.

Checks for a custom setup, if so gets the required players from that and if not it sets the player requirement to MAFIA_MAX_PLAYER_COUNT and generates one IF basic setup starts a game. Checks if everyone signed up is an observer, and is still connected. If people aren't, they're removed from the list. If there aren't enough players post sanity, it aborts. otherwise, it selects enough people for the game and starts preparing the game for real.

check_signups

Filters inactive player into a different list until they reconnect, and removes players who are no longer ghosts.

If a disconnected player gets a non-ghost mob and reconnects, they will be first put back into mafia_signup then filtered by that.

check_trial

Players have voted someone up, and now the person must defend themselves while the town votes innocent or guilty.

What players do in this phase:

check_victory

Checks to see if a faction (or solo antagonist) has won.

Calculates in this order:

create_bodies

Called when the game is setting up, AFTER map is loaded but BEFORE the phase timers start. Creates and places each role's body and gives the correct player key

Notably:

display_votes

Adds mutable appearances to people who get publicly voted on (so not night votes) showing how many people are picking them Arguments:

end_game

Cleans up the game, resetting variables back to the beginning and removing the map with the generator.

generate_random_setup

Returns a semirandom setup with 12 roles. balance not guaranteed!

please check the variables at the top of the proc to see how much of each role types it picks

get_random_voter

Returns a random person who voted for whatever vote (day vote, night kill vote) Arguments:

get_vote_count

Returns how many people voted for the role, in whatever vote (day vote, night kill vote) Arguments:

get_vote_winner

Returns whichever role got the most votes, in whatever vote (day vote, night kill vote) returns null if no votes Arguments:

lockdown

After the voting and judgement phases, the game goes to night shutting the windows and beginning night with a proc.

lynch

Players have voted innocent or guilty on the person on trial, and that person is now killed or returned home.

What players do in this phase:

prepare_game

Triggers at beginning of the game when there is a confirmed list of valid, ready players. Creates a 100% ready game that has NOT started (no players in bodies) Followed by start game

Does the following:

reset_votes

Clears out the votes of a certain type (day votes, mafia kill votes) while leaving others untouched

resolve_night

The end of the night, and a series of signals for the order of events on a night.

Order of events, and what they mean:

send_home

Teenie helper proc to move players back to their home. Used in the above, but also used in the debug button "send all players home" Arguments:

start_day

How every day starts.

What players do in this phase:

start_game

The game by this point is now all set up, and so we can put people in their bodies and start the first phase.

Does the following:

start_night

The actual start of night for players. Mostly info is given at the start of the night as the end of the night is when votes and actions are submitted and tried.

What players do in this phase:

start_the_end

The end of the game is in two procs, because we want a bit of time for players to see eachothers roles. Because of how check_victory works, the game is halted in other places by this point.

What players do in this phase:

start_voting_phase

Players have finished the discussion period, and now must put up someone to the chopping block.

What players do in this phase:

toggle_night_curtains

Shuts poddoors attached to mafia. Arguments:

try_autostart

Called when someone signs up, and sees if there are enough people in the signup list to begin.

Only checks if everyone is actually valid to start (still connected and an observer) if there are enough players (basic_setup)

vote_for

Proc that goes off when players vote for something with their mafia panel.

If teams, it hides the tally overlay and only sends the vote messages to the team that is voting Arguments: