Skip to content

Commit

Permalink
Порт ивентера с Paradise, рефактор и починка рандом ивентов (TauCetiS…
Browse files Browse the repository at this point in the history
  • Loading branch information
T6751 authored Jul 30, 2020
1 parent 33ce1e3 commit f20c4a9
Show file tree
Hide file tree
Showing 197 changed files with 5,537 additions and 6,608 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
#define shuttle_time_in_station 1800 // 3 minutes in the station
#define shuttle_time_to_arrive 6000 // 10 minutes to arrive

#define EVENT_LEVEL_MUNDANE 1
#define EVENT_LEVEL_MODERATE 2
#define EVENT_LEVEL_MAJOR 3

//defines
#define RESIZE_DEFAULT_SIZE 1

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// Subsystem init_order, from highest priority to lowest priority
// The numbers just define the ordering, they are meaningless otherwise.

#define SS_INIT_EVENTS 12
#define SS_INIT_FLUIDS 11
#define SS_INIT_JOBS 10
#define SS_INIT_QUIRKS 9
Expand Down
137 changes: 110 additions & 27 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,33 +325,6 @@
return M
return null

/proc/get_larva_candidates()
var/list/candidates = list() //List of candidate KEYS to assume control of the new larva ~Carn
var/afk_time = 0
var/afk_threesold = 3000
while(!candidates.len && afk_time <= afk_threesold)
for(var/mob/dead/observer/G in player_list)
if(!G.client)
continue
if((ROLE_ALIEN in G.client.prefs.be_role) && !jobban_isbanned(G, ROLE_ALIEN))
if(!G.client.is_afk(afk_time)) // the most active players are more likely to become an alien
candidates += G.key
afk_time += 600
return candidates

/proc/get_candidates(be_role_type, afk_bracket=3000) //Get candidates for Blob
if(!be_role_type)
return
var/list/candidates = list()
// Keep looping until we find a non-afk candidate within the time bracket (we limit the bracket to 10 minutes (6000))
while(!candidates.len && afk_bracket < 6000)
for(var/mob/dead/observer/G in player_list)
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
if(!G.client.is_afk(afk_bracket) && (be_role_type in G.client.prefs.be_role)) // TODO: Replace it with something else. Causes runtimes if there are no ghosts(not observers!)
candidates += G.client
afk_bracket += 600 // Add a minute to the bracket, for every attempt
return candidates

/proc/ScreenText(obj/O, maptext="", screen_loc="CENTER-7,CENTER-7", maptext_height=480, maptext_width=480)
if(!isobj(O)) O = new /obj/screen/text()
O.maptext = maptext
Expand Down Expand Up @@ -581,3 +554,113 @@
rstats[i] = environment.vars[stats[i]]
temps[direction] = rstats
return temps


// Procs for grabbing players.

// grab random ghost from candidates after poll_time
/proc/pollGhostCandidates(Question, be_special_type, Ignore_Role, poll_time = 300, check_antaghud = TRUE)
var/list/mob/dead/observer/candidates = list()

for(var/mob/dead/observer/O in observer_list)
if(check_antaghud && O.has_enabled_antagHUD == TRUE && config.antag_hud_restricted)
continue
candidates += O

candidates = pollCandidates(Question, be_special_type, Ignore_Role, poll_time, candidates)

return candidates

/proc/pollCandidates(Question = "Would you like to be a special role?", be_special_type, Ignore_Role, poll_time = 300, list/group = null)
var/list/mob/candidates = list()
var/time_passed = world.time

if(!Ignore_Role)
Ignore_Role = be_special_type

for(var/mob/M in group)
if(!M.client)
continue
if(jobban_isbanned(M, be_special_type) || jobban_isbanned(M, "Syndicate") || !M.client.prefs.be_role.Find(be_special_type) || role_available_in_minutes(be_special_type))
continue
if(Ignore_Role && M.client.prefs.ignore_question.Find(Ignore_Role))
continue
INVOKE_ASYNC(GLOBAL_PROC, .proc/requestCandidate, M, time_passed, candidates, Question, Ignore_Role, poll_time)
sleep(poll_time)

//Check all our candidates, to make sure they didn't log off during the 30 second wait period.
for(var/mob/M in candidates)
if(!M.client)
candidates -= M

listclearnulls(candidates)

return candidates

/proc/requestCandidate(mob/M, time_passed, candidates, Question, Ignore_Role, poll_time)
M.playsound_local(null, 'sound/misc/notice2.ogg', VOL_EFFECTS_MASTER, vary = FALSE, ignore_environment = TRUE)//Alerting them to their consideration
window_flash(M.client)
var/ans = alert(M, Question, "Please answer in [poll_time * 0.1] seconds!", "No", "Yes", "Not This Round")
switch(ans)
if("Yes")
to_chat(M, "<span class='notice'>Choice registered: Yes.</span>")
if((world.time - time_passed) > poll_time)//If more than 30 game seconds passed.
to_chat(M, "<span class='danger'>Sorry, you were too late for the consideration!</span>")
M.playsound_local(null, 'sound/machines/buzz-sigh.ogg', VOL_EFFECTS_MASTER, vary = FALSE, ignore_environment = TRUE)
return
candidates += M
if("No")
to_chat(M, "<span class='danger'>Choice registered: No.</span>")
return
if("Not This Round")
to_chat(M, "<span class='danger'>Choice registered: No.</span>")
to_chat(M, "<span class='notice'>You will no longer receive notifications for the role '[Ignore_Role]' for the rest of the round.</span>")
M.client.prefs.ignore_question += Ignore_Role
return

// first answer "Yes" > transfer
/mob/proc/try_request_n_transfer(mob/M, Question = "Would you like to be a special role?", be_special_type, Ignore_Role, show_warnings = FALSE)
if(key || mind || stat != CONSCIOUS)
return

if(Ignore_Role && M.client.prefs.ignore_question.Find(IGNORE_BORER))
return

if(isobserver(M))
var/mob/dead/observer/O = M
if(O.has_enabled_antagHUD == TRUE && config.antag_hud_restricted)
if(show_warnings)
to_chat(O, "<span class='boldnotice'>Upon using the antagHUD you forfeited the ability to join the round.</span>")
return

if(jobban_isbanned(M, "Syndicate"))
if(show_warnings)
to_chat(M, "<span class='warning'>You are banned from antagonists!</span>")
return

if(jobban_isbanned(M, be_special_type) || role_available_in_minutes(M, be_special_type))
if(show_warnings)
to_chat(M, "<span class='warning'>You are banned from [be_special_type]!</span>")
return

INVOKE_ASYNC(src, .proc/request_n_transfer, M, Question, be_special_type, Ignore_Role, show_warnings)

/mob/proc/request_n_transfer(mob/M, Question = "Would you like to be a special role?", be_special_type, Ignore_Role, show_warnings = FALSE)
var/ans
if(Ignore_Role)
ans = alert(M, Question, "[be_special_type] Request", "No", "Yes", "Not This Round")
else
ans = alert(M, Question, "[be_special_type] Request", "No", "Yes")
if(ans == "No")
return
if(ans == "Not This Round")
M.client.prefs.ignore_question += IGNORE_BORER
return

if(key || mind || stat != CONSCIOUS)
return

transfer_personality(M.client)

/mob/proc/transfer_personality(client/C)
return
5 changes: 4 additions & 1 deletion code/__HELPERS/time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#define MINUTE *600
#define MINUTES *600

#define HOUR *36000
#define HOURS *36000

//Returns the world time in english
/proc/worldtime2text(time = world.time)
return "[round(time / 36000)+12]:[(time / 600 % 60) < 10 ? add_zero(time / 600 % 60, 1) : time / 600 % 60]"
Expand Down Expand Up @@ -104,4 +107,4 @@ var/last_round_duration = 0
return "[day] day[(day != 1)? "s":""][hourT][minuteT][secondT]"

/proc/is_leap_year(year)
return (year && isnum(year) && (((year % 400) == 0) || ((year % 100 != 0) && (year % 4 == 0))))
return (year && isnum(year) && (((year % 400) == 0) || ((year % 100 != 0) && (year % 4 == 0))))
3 changes: 3 additions & 0 deletions code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ var/list/ignore_vision_inside = list(

// Is initiated in setup_religions(). Used to save all info about chaplain's religion.
var/global/datum/religion/chaplain/chaplain_religion

var/global/timezoneOffset = 0 // The difference betwen midnight (of the host computer) and 0 world.ticks.
var/global/gametime_offset = 12 HOURS //Deciseconds to add to world.time for station time.
2 changes: 2 additions & 0 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@
mymob.internals = new /obj/screen()
mymob.internals.icon = ui_style
mymob.internals.icon_state = "internal0"
if(istype(mymob.internal, /obj/item/weapon/tank))
mymob.internals.icon_state = "internal1"
mymob.internals.name = "internal"
mymob.internals.screen_loc = ui_internal

Expand Down
46 changes: 45 additions & 1 deletion code/controllers/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,22 @@ var/list/net_announcer_secret = list()
var/slime_delay = 0
var/animal_delay = 0

// Event settings
var/expected_round_length = 90 MINUTES
// If the first delay has a custom start time
// No custom time
var/list/event_first_run = list(EVENT_LEVEL_MUNDANE = null,
EVENT_LEVEL_MODERATE = null,
EVENT_LEVEL_MAJOR = list("lower" = 80 MINUTES, "upper" = 100 MINUTES))
// The lowest delay until next event
var/list/event_delay_lower = list(EVENT_LEVEL_MUNDANE = 10 MINUTES,
EVENT_LEVEL_MODERATE = 30 MINUTES,
EVENT_LEVEL_MAJOR = 50 MINUTES)
// The upper delay until next event
var/list/event_delay_upper = list(EVENT_LEVEL_MUNDANE = 15 MINUTES,
EVENT_LEVEL_MODERATE = 45 MINUTES,
EVENT_LEVEL_MAJOR = 70 MINUTES)

var/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt
var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
Expand Down Expand Up @@ -591,6 +607,34 @@ var/list/net_announcer_secret = list()

if("max_maint_drones")
config.max_maint_drones = text2num(value)

if("expected_round_length")
config.expected_round_length = text2num(value) MINUTES

if("event_delay_lower")
var/values = text2numlist(value, ";")
config.event_delay_lower[EVENT_LEVEL_MUNDANE] = values[1] MINUTES
config.event_delay_lower[EVENT_LEVEL_MODERATE] = values[2] MINUTES
config.event_delay_lower[EVENT_LEVEL_MAJOR] = values[3] MINUTES

if("event_delay_upper")
var/values = text2numlist(value, ";")
config.event_delay_upper[EVENT_LEVEL_MUNDANE] = values[1] MINUTES
config.event_delay_upper[EVENT_LEVEL_MODERATE] = values[2] MINUTES
config.event_delay_upper[EVENT_LEVEL_MAJOR] = values[3] MINUTES

if("event_custom_start_mundane")
var/values = text2numlist(value, ";")
config.event_first_run[EVENT_LEVEL_MUNDANE] = list("lower" = values[1] MINUTES, "upper" = values[2] MINUTES)

if("event_custom_start_moderate")
var/values = text2numlist(value, ";")
config.event_first_run[EVENT_LEVEL_MODERATE] = list("lower" = values[1] MINUTES, "upper" = values[2] MINUTES)

if("event_custom_start_major")
var/values = text2numlist(value, ";")
config.event_first_run[EVENT_LEVEL_MAJOR] = list("lower" = values[1] MINUTES, "upper" = values[2] MINUTES)

// Bay new things are below
if("use_overmap")
config.use_overmap = 1
Expand Down Expand Up @@ -931,4 +975,4 @@ var/list/net_announcer_secret = list()
net_announcers["ban_receive"] = TRUE
if ("send")
if (value && (lowertext(value) == "true" || lowertext(value) == "on"))
net_announcers["ban_send"] = TRUE
net_announcers["ban_send"] = TRUE
Loading

0 comments on commit f20c4a9

Please sign in to comment.