-
Notifications
You must be signed in to change notification settings - Fork 79
Голосование за тип раунда #5590
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
Open
Kocma-san
wants to merge
27
commits into
Fluffy-Frontier:master
Choose a base branch
from
Kocma-san:vote-things
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
863edc2
v0.5
Kocma-san cb37c7e
Apply suggestions from code review
Iajret e114dab
Update tff_modular/modules/shift_intensity/shift_intensity_vote.dm
Kocma-san 0825e40
Update tff_modular/modules/shift_intensity/shift_intensity_vote.dm
Kocma-san 7bc9eee
Update tff_modular/modules/shift_intensity/shift_intensity_vote.dm
Kocma-san ba6e593
Update tff_modular/modules/shift_intensity/shift_intensity_vote.dm
Kocma-san 537b4b6
verb for admins
Kocma-san db73f42
weh (Теперь все привязано к конфигам)
Kocma-san 5872434
configs (probably bad)
Kocma-san 761b051
Update tff_modular/modules/shift_intensity/shift_intensity_config.dm
Kocma-san 9d5d421
Update shift_intensity.dm
Kocma-san dd44e6f
Merge branch 'vote-things' of https://github.com/Kocma-san/FluffySTG …
Kocma-san da44838
Update dynamic_hard.json
Kocma-san e640daf
Merge remote-tracking branch 'upstream/master' into vote-things
Kocma-san 95a215f
v2
Kocma-san f41a1fa
Merge branch 'master' into vote-things
Kocma-san 10a8680
fixes
Kocma-san 4f7c41d
update
Kocma-san 54fd7fb
Update dynamic.dm
Kocma-san d0dafe3
v2.1
Kocma-san e948bfa
Update statpanel.dm
Kocma-san 838198c
Update code/modules/mob/dead/new_player/login.dm
Kocma-san edb9723
Update code/modules/mob/dead/new_player/login.dm
Kocma-san 58e7336
small addition
Kocma-san e21f67a
Update shift_intensity_vote.dm
Kocma-san 4e4a389
Update shift_intensity.dm
Kocma-san d95b454
Update shift_intensity.dm
Kocma-san File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
| // Названия типов раунда | ||
| /// Обычная зеленая смена, экста | ||
| #define ROUND_LIGHT_SHIFT_STRING "Green Shift" | ||
| /// Обычная смена, 50% между Yellow Star и Red Star | ||
| #define ROUND_MID_SHIFT_STRING "Blue Shift" | ||
| /// Black Star | ||
| #define ROUND_HEAVY_SHIFT_STRING "Red Shift" | ||
| /// Midnight Sun | ||
| #define ROUND_TOTALLY_HELL_SHIFT_STRING "TOTALLY HELL" | ||
|
|
||
| GLOBAL_VAR(shift_intensity_level) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ## Включает систему голосования за тип раунда | ||
| #SHIFT_INTENSITY | ||
|
|
||
| ## Включает возможность начать голосование за тип раунда | ||
| #ALLOW_SHIFT_INTENSITY_VOTE | ||
|
|
||
| ## Время до начала раунда (в децисекундах), в которое запускается голосование за тип раунда | ||
| SHIFT_INTENSITY_VOTE_STARTTIME 2000 | ||
|
|
||
| ## Количество игроков, необходимое для старта голосования за тип раунда | ||
| SHIFT_INTENSITY_VOTE_MINIMUM_PLAYERS 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #define LAST_ATTEMPT_DEADLINE 120 SECONDS | ||
|
|
||
| SUBSYSTEM_DEF(shift_intensity) | ||
| name = "Shift Intensity Vote" | ||
| flags = SS_BACKGROUND | ||
| runlevels = RUNLEVEL_LOBBY | RUNLEVEL_SETUP | ||
| dependencies = list( | ||
| /datum/controller/subsystem/vote, | ||
| ) | ||
|
|
||
| /// Время до начала раунда, после которого подсистема будет пытаться запустить голосование | ||
| var/start_time | ||
| /// Количество игроков, необходимое для старта голосования | ||
| var/minimum_players | ||
|
|
||
| /datum/controller/subsystem/shift_intensity/Initialize() | ||
| start_time = CONFIG_GET(number/shift_intensity_vote_starttime) | ||
| minimum_players = CONFIG_GET(number/shift_intensity_vote_minimum_players) | ||
|
|
||
| if(!CONFIG_GET(flag/shift_intensity)) | ||
| can_fire = FALSE | ||
| return SS_INIT_NO_NEED | ||
|
|
||
| log_game("SSshift_intensity was enabled in config. Vote will start [start_time/10] seconds before the start of the round.") | ||
| message_admins("SSshift_intensity was enabled in config. Vote will start [start_time/10] seconds before the start of the round.") | ||
| return SS_INIT_SUCCESS | ||
|
|
||
| /datum/controller/subsystem/shift_intensity/Recover() | ||
| start_time = SSshift_intensity.start_time | ||
| minimum_players = SSshift_intensity.minimum_players | ||
|
|
||
| /datum/controller/subsystem/shift_intensity/fire() | ||
| if(SSticker.current_state > GAME_STATE_PREGAME) | ||
| can_fire = FALSE | ||
| return | ||
|
|
||
| if(istype(SSvote.current_vote, /datum/vote/shift_intensity)) | ||
| can_fire = FALSE | ||
| return | ||
|
|
||
| if(SSticker.GetTimeLeft() <= start_time) | ||
| if(SSticker.totalPlayers < minimum_players) | ||
| if(SSticker.GetTimeLeft() > LAST_ATTEMPT_DEADLINE) // Будет пытаться начать воут вплоть до 120 секунд доя старта раунда и потом отключится, если все еще не набрались люди | ||
| return | ||
|
|
||
| can_fire = FALSE | ||
| log_game("The vote for shift intensity was cancelled due to insufficient number of players.") | ||
| message_admins("The vote for shift intensity was cancelled due to insufficient number of players.") | ||
| return | ||
|
|
||
| can_fire = FALSE | ||
| SSvote.initiate_vote(/datum/vote/shift_intensity, "server", forced = TRUE) | ||
|
|
||
| #undef LAST_ATTEMPT_DEADLINE |
14 changes: 14 additions & 0 deletions
14
tff_modular/modules/shift_intensity/shift_intensity_config.dm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /// Определяет, работает ли [SSshift_intensity] или нет | ||
| /datum/config_entry/flag/shift_intensity | ||
|
|
||
| /// Определяет, может ли голосование за [SSshift_intensity] быть начато кем-либо или нет | ||
| /datum/config_entry/flag/allow_shift_intensity_vote | ||
|
|
||
| /// Время (в децисекундах) до начала раунда, после которого SSshiftcolorvote будет пытаться запустить голосование | ||
| /datum/config_entry/number/shift_intensity_vote_starttime | ||
| min_val = 50 | ||
| default = 1000 | ||
|
|
||
| /// Количество игроков, необходимое для старта голосования | ||
| /datum/config_entry/number/shift_intensity_vote_minimum_players | ||
| default = 20 |
6 changes: 6 additions & 0 deletions
6
tff_modular/modules/shift_intensity/shift_intensity_toggle.dm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ADMIN_VERB(disable_shift_intensity, R_ADMIN, "Disable Intensity Vote", "Turn Off the Shift Intensity Vote.", ADMIN_CATEGORY_SERVER) | ||
| SSshift_intensity.can_fire = 0; | ||
| if(istype(SSvote.current_vote, /datum/vote/shift_intensity)) | ||
| SSvote.reset() | ||
| log_admin("[key_name(user)] turned off Shift Intensity Vote.") | ||
| message_admins("[key_name_admin(user)] turned off Shift Intensity Vote.") |
61 changes: 61 additions & 0 deletions
61
tff_modular/modules/shift_intensity/shift_intensity_vote.dm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /datum/vote/shift_intensity | ||
| name = "Intensity" | ||
| default_choices = list( | ||
| ROUND_LIGHT_SHIFT_STRING, | ||
| ROUND_MID_SHIFT_STRING, | ||
| ROUND_HEAVY_SHIFT_STRING, | ||
| ) | ||
|
|
||
| /datum/vote/shift_intensity/toggle_votable() | ||
| CONFIG_SET(flag/allow_shift_intensity_vote, !CONFIG_GET(flag/allow_shift_intensity_vote)) | ||
|
|
||
| /datum/vote/shift_intensity/is_config_enabled() | ||
| return CONFIG_GET(flag/shift_intensity) && CONFIG_GET(flag/allow_shift_intensity_vote) | ||
|
|
||
| /datum/vote/shift_intensity/can_be_initiated(forced) | ||
| . = ..() | ||
| if(. != VOTE_AVAILABLE) | ||
| return | ||
|
|
||
| if(!forced && SSticker.current_state != GAME_STATE_PREGAME) | ||
| return "It's too late for that, the round is already starting." | ||
|
|
||
| return VOTE_AVAILABLE | ||
|
|
||
| /datum/vote/shift_intensity/initiate_vote(initiator, duration) | ||
| . = ..() | ||
| // Необходимо продлить время до старта раунда, если до него меньше 90 секунд (60 секунд сам воут + 30 на то, чтобы игроки успели понять тип раунда) | ||
| if(SSticker.GetTimeLeft() < 90 SECONDS) | ||
| SSticker.SetTimeLeft(90 SECONDS) | ||
|
|
||
| /datum/vote/shift_intensity/tiebreaker(list/winners) | ||
| // Если никто не проголосовал - смена будет *обычная* | ||
| if(choices_by_ckey.len == 0) | ||
| return ROUND_LIGHT_SHIFT_STRING | ||
| return ..() | ||
|
|
||
| /datum/vote/shift_intensity/finalize_vote(winning_option) | ||
| if(SSticker.current_state != GAME_STATE_PREGAME) | ||
| message_admins("Shift type vote ended after the round started. No changes to the round type.") | ||
| log_admin("Shift type vote ended after the round started. No changes to the round type.") | ||
| return | ||
|
|
||
| switch(winning_option) | ||
| if(ROUND_LIGHT_SHIFT_STRING) | ||
| SSdynamic.set_tier(/datum/dynamic_tier/greenshift) | ||
| if(ROUND_MID_SHIFT_STRING) | ||
| if(prob(50)) | ||
| SSdynamic.set_tier(/datum/dynamic_tier/low) | ||
| else | ||
| SSdynamic.set_tier(/datum/dynamic_tier/lowmedium) | ||
| if(ROUND_HEAVY_SHIFT_STRING) | ||
| SSdynamic.set_tier(/datum/dynamic_tier/mediumhigh) | ||
| if(ROUND_TOTALLY_HELL_SHIFT_STRING) | ||
| SSdynamic.set_tier(/datum/dynamic_tier/high) | ||
| else | ||
| CRASH("[type] wasn't passed a valid winning choice. (Got: [winning_option || "null"])") | ||
|
|
||
| GLOB.shift_intensity_level = winning_option | ||
|
|
||
| message_admins("Shift type vote ended. The type of round will be: [winning_option].") | ||
| log_admin("Shift type vote ended. The type of round will be: [winning_option].") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.