Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Перевод голосовалок и панели #704

Merged
merged 5 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions code/modules/vote/vote_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

/datum/vote
/// Person who started the vote
var/initiator = "the server"
var/initiator = "серверу"
BR54FF marked this conversation as resolved.
Show resolved Hide resolved
/// world.time the vote started at
var/started_time
/// The question being asked
var/question
/// Vote type text, for showing in UIs and stuff
var/vote_type_text = "unset"
var/vote_type_text = "что-то особенное"
/// Do we want to show the vote counts as it goes
var/show_counts = FALSE
/// Vote result type. This determines how a winner is picked
Expand All @@ -23,7 +23,7 @@

/datum/vote/New(_initiator, _question, list/_choices, _is_custom = FALSE)
if(SSvote.active_vote)
CRASH("Attempted to start another vote with one already in progress!")
CRASH("Попытка начать голосование во время того, как идёт другое!")

if(_initiator)
initiator = _initiator
Expand All @@ -39,15 +39,15 @@
generate_choices()

/datum/vote/proc/start()
var/text = "[capitalize(vote_type_text)] vote started by [initiator]."
var/text = "Голосование за [capitalize(vote_type_text)] начато благодаря [initiator]."
if(is_custom)
vote_type_text = "custom"
text += "\n[question]"
if(usr)
log_admin("[capitalize(vote_type_text)] ([question]) vote started by [key_name(usr)].")
log_admin("[capitalize(vote_type_text)] ([question]) голосование начато благодаря [key_name(usr)].")

else if(usr)
log_admin("[capitalize(vote_type_text)] vote started by [key_name(usr)].")
log_admin("Голосование за [capitalize(vote_type_text)] начато благодаря [key_name(usr)].")

log_vote(text)
started_time = world.time
Expand All @@ -62,7 +62,7 @@
switch(vote_result_type)
if(VOTE_RESULT_TYPE_MAJORITY)
if(!length(voted))
to_chat(world, "<span class='interface'>No votes were cast. Do you all hate democracy?!</span>") // shame them
to_chat(world, "<span class='interface'>Нет ни одного голоса. Вы все ненавидите демократию?!</span>") // shame them
return null

var/list/results = list()
Expand Down Expand Up @@ -100,26 +100,26 @@

if(length(winning_options) > 1)
var/random_dictator = pick(winning_options)
to_chat(world, "<span class='interface'><b>Its a tie between [english_list(winning_options)]. Picking <code>[random_dictator]</code> at random.</b></span>") // shame them
to_chat(world, "<span class='interface'><b>Ничья между [english_list(winning_options)]. Случайный выбор: <code>[random_dictator]</code>.</b></span>") // shame them
return random_dictator

// If we got here there must only be one thing in the list
var/res = winning_options[1]

if(res in choices)
to_chat(world, "<span class='interface'><b><code>[res]</code> won the vote.</b></span>")
to_chat(world, "<span class='interface'><b><code>[res]</code> выигрывает голосование.</b></span>")
return res

to_chat(world, "<span class='interface'>The winner of the vote ([sanitize(res)]) isnt a valid choice? What the heck?</span>")
stack_trace("Vote of type [type] concluded with an invalid answer. Answer was [sanitize(res)], choices were [json_encode(choices)]")
to_chat(world, "<span class='interface'>Победитель голосования ([sanitize(res)]) не является допустимым выбором? Какого чёрта?</span>")
stack_trace("Голосование типа [type] завершилось недопустимым ответом. Ответом был [sanitize(res)], вариантами были: [json_encode(choices)]")
return null



/datum/vote/proc/announce(start_text)
to_chat(world, {"<font color='purple'><b>[start_text]</b>
<a href='?src=[SSvote.UID()];vote=open'>Click here or type <code>Vote</code> to place your vote.</a>
You have [GLOB.configuration.vote.vote_time / 10] seconds to vote.</font>"})
<a href='?src=[SSvote.UID()];vote=open'>Нажмите здесь или введите <code>Vote</code>, чтобы оставить голос.</a>
У вас [GLOB.configuration.vote.vote_time / 10] секунд на выбор.</font>"})
SEND_SOUND(world, sound('sound/ambience/alarm4.ogg'))


Expand Down Expand Up @@ -152,7 +152,7 @@
/datum/vote/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "VotePanel", "VotePanel", 400, 500, master_ui, state)
ui = new(user, src, ui_key, "VotePanel", "Панель голосования", 400, 500, master_ui, state)
ui.open()

/datum/vote/ui_data(mob/user)
Expand Down Expand Up @@ -195,5 +195,5 @@
if(params["target"] in choices)
voted[usr.ckey] = params["target"]
else
message_admins("<span class='boldannounce'>\[EXPLOIT]</span> User [key_name_admin(usr)] spoofed a vote in the vote panel!")
message_admins("<span class='boldannounce'>\[EXPLOIT]</span> Пользователь [key_name_admin(usr)] подделал голосование в панели!")

18 changes: 9 additions & 9 deletions code/modules/vote/vote_presets.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// Crew transfer vote
/datum/vote/crew_transfer
question = "End the shift"
choices = list("Initiate Crew Transfer", "Continue The Round")
vote_type_text = "crew transfer"
question = "Окончание смены"
choices = list("Инициировать эвакуацию", "Продолжить раунд")
vote_type_text = "эвакуацию"

/datum/vote/crew_transfer/New()
if(SSticker.current_state < GAME_STATE_PLAYING)
CRASH("Attempted to call a shuttle vote before the game starts!")
CRASH("Попытка вызвать голосование за шаттл до начала!")
..()

/datum/vote/crew_transfer/handle_result(result)
if(result == "Initiate Crew Transfer")
if(result == "Инициировать эвакуацию")
init_shift_change(null, TRUE)

// Map vote
/datum/vote/map
question = "Map Vote"
vote_type_text = "map"
question = "Голосование за карту"
vote_type_text = "карту"

/datum/vote/map/generate_choices()
for(var/x in subtypesof(/datum/map))
Expand All @@ -35,7 +35,7 @@
/datum/vote/map/announce()
..()
for(var/mob/M in GLOB.player_list)
M.throw_alert("Map Vote", /obj/screen/alert/notify_mapvote, timeout_override = GLOB.configuration.vote.vote_time)
M.throw_alert("Голосование за карту", /obj/screen/alert/notify_mapvote, timeout_override = GLOB.configuration.vote.vote_time)

/datum/vote/map/handle_result(result)
// Find target map.
Expand All @@ -48,5 +48,5 @@
// Set top voted map
if(result == "[initial(M.fluff_name)] ([initial(M.technical_name)])")
top_voted_map = M
to_chat(world, "<span class='interface'>Map for next round: [initial(top_voted_map.fluff_name)] ([initial(top_voted_map.technical_name)])</span>")
to_chat(world, "<span class='interface'>Карта следующего раунда: [initial(top_voted_map.fluff_name)] ([initial(top_voted_map.technical_name)])</span>")
SSmapping.next_map = new top_voted_map
18 changes: 9 additions & 9 deletions code/modules/vote/vote_verb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
if(SSvote.active_vote)
SSvote.active_vote.ui_interact(usr)
else
to_chat(usr, "There is no active vote")
to_chat(usr, "Нет активных голосований")

/client/proc/start_vote()
set category = "Admin"
set name = "Start Vote"
set desc = "Start a vote on the server"
set name = "Начать голосование"
set desc = "Начать голосование на сервере"

if(!check_rights(R_ADMIN))
return

if(SSvote.active_vote)
to_chat(usr, "A vote is already in progress")
to_chat(usr, "Голосование уже в процессе")
return

// Ask admins which type of vote they want to start
Expand All @@ -28,7 +28,7 @@
for(var/vtype in vote_types)
votemap["[vtype]"] = vtype

var/choice = input(usr, "Select a vote type", "Vote") as null|anything in vote_types
var/choice = input(usr, "Выбрать тип голосования", "Голосование") as null|anything in vote_types

if(choice == null)
return
Expand All @@ -40,19 +40,19 @@
return

// Its custom, lets ask
var/question = html_encode(input(usr, "What is the vote for?") as text|null)
var/question = html_encode(input(usr, "За что голосуем?") as text|null)
if(!question)
return

var/list/choices = list()
for(var/i in 1 to 10)
var/option = capitalize(html_encode(input(usr, "Please enter an option or hit cancel to finish") as text|null))
var/option = capitalize(html_encode(input(usr, "Впишите опцию или нажмите отмену для завершения") as text|null))
if(!option || !usr.client)
break
choices |= option

var/c2 = alert(usr, "Show counts while vote is happening?", "Counts", "Yes", "No")
var/c3 = input(usr, "Select a result calculation type", "Vote", VOTE_RESULT_TYPE_MAJORITY) as anything in list(VOTE_RESULT_TYPE_MAJORITY)
var/c2 = alert(usr, "Показать подсчеты во время голосования?", "Голоса", "Да", "Нет")
var/c3 = input(usr, "Выберите тип расчета результата", "Голосование", VOTE_RESULT_TYPE_MAJORITY) as anything in list(VOTE_RESULT_TYPE_MAJORITY)

var/datum/vote/V = new /datum/vote(usr.ckey, question, choices, TRUE)
V.show_counts = (c2 == "Yes")
Expand Down