From 9b52b47c3ba89ae25fb1faeddc376c9a137e9f92 Mon Sep 17 00:00:00 2001 From: LiquidPotroh <100733800+LiquidPotroh@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:42:58 +0300 Subject: [PATCH] add: Abductors moderate event (#4852) abd --- code/modules/events/abductor.dm | 90 +++++++++++++------------- code/modules/events/event_container.dm | 1 + 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/code/modules/events/abductor.dm b/code/modules/events/abductor.dm index aa98b58a8e5..4013f804ee7 100644 --- a/code/modules/events/abductor.dm +++ b/code/modules/events/abductor.dm @@ -1,5 +1,6 @@ /datum/event/abductor var/for_players = 30 //Количество людей для спавна доп. команды + var/datum/game_mode/abduction/game_mode_ref /datum/event/abductor/start() //spawn abductor team @@ -9,51 +10,52 @@ spawn(300) makeAbductorTeam() +/datum/event/abductor/proc/get_teams_num() + return min(round(num_station_players() / for_players) + 1, game_mode_ref.max_teams) + /datum/event/abductor/proc/makeAbductorTeam() var/list/mob/dead/observer/candidates = SSghost_spawns.poll_candidates("Вы хотите занять роль Абдуктора?", ROLE_ABDUCTOR, TRUE) - if(length(candidates) >= 2) - var/datum/game_mode/abduction/temp - if(SSticker.mode.config_tag == "abduction") - temp = SSticker.mode - else - temp = new - - var/num_teams = min(round(num_station_players() / for_players) + 1, temp.max_teams) - for(var/i in 1 to num_teams) - //Oh god why we can't have static functions - if (length(candidates) < 2) - break - - var/number = SSticker.mode.abductor_teams + 1 - - var/agent_mind = pick(candidates) - candidates.Remove(agent_mind) - var/scientist_mind = pick(candidates) - candidates.Remove(scientist_mind) - - var/mob/living/carbon/human/agent = makeBody(agent_mind) - var/mob/living/carbon/human/scientist = makeBody(scientist_mind) - - agent_mind = agent.mind - scientist_mind = scientist.mind - - temp.scientists.len = number - temp.agents.len = number - temp.abductors.len = 2 * number - temp.team_objectives.len = number - temp.team_names.len = number - temp.scientists[number] = scientist_mind - temp.agents[number] = agent_mind - temp.abductors |= list(agent_mind,scientist_mind) - temp.make_abductor_team(number,preset_scientist=scientist_mind,preset_agent=agent_mind) - temp.post_setup_team(number) - - SSticker.mode.abductor_teams++ - - if(SSticker.mode.config_tag != "abduction") - SSticker.mode.abductors |= temp.abductors - processing = 1 //So it will get gc'd - return 1 + if(length(candidates) < 2) + return FALSE + + if(SSticker.mode.config_tag == "abduction") + game_mode_ref = SSticker.mode else - return 0 + game_mode_ref = new + + var/num_teams = get_teams_num() + for(var/i in 1 to num_teams) + if(length(candidates) < 2) + break + + var/number = SSticker.mode.abductor_teams + 1 + var/agent_mind = pick_n_take(candidates) + var/scientist_mind = pick_n_take(candidates) + + var/mob/living/carbon/human/agent = makeBody(agent_mind) + var/mob/living/carbon/human/scientist = makeBody(scientist_mind) + + agent_mind = agent.mind + scientist_mind = scientist.mind + + game_mode_ref.scientists.len = number + game_mode_ref.agents.len = number + game_mode_ref.abductors.len = 2 * number + game_mode_ref.team_objectives.len = number + game_mode_ref.team_names.len = number + game_mode_ref.scientists[number] = scientist_mind + game_mode_ref.agents[number] = agent_mind + game_mode_ref.abductors |= list(agent_mind,scientist_mind) + game_mode_ref.make_abductor_team(number,preset_scientist=scientist_mind,preset_agent=agent_mind) + game_mode_ref.post_setup_team(number) + + SSticker.mode.abductor_teams++ + + if(SSticker.mode.config_tag != "abduction") + SSticker.mode.abductors |= game_mode_ref.abductors + processing = 1 + return TRUE + +/datum/event/abductor/one_crew/get_teams_num() + return 1 diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index dd2c02702ed..94b696a0dc5 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -223,6 +223,7 @@ GLOBAL_LIST_EMPTY(event_last_fired) new /datum/event_meta(EVENT_LEVEL_MODERATE, "Ревенант", /datum/event/revenant, 150), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Спавн свармеров", /datum/event/spawn_swarmer, 0, is_one_shot = TRUE), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Спавн морфа", /datum/event/spawn_morph, 40, list(ASSIGNMENT_SECURITY = 10), is_one_shot = TRUE), + new /datum/event_meta(EVENT_LEVEL_MODERATE, "Визит абдукторов", /datum/event/abductor/one_crew, 40, list(ASSIGNMENT_SECURITY = 3), TRUE), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Pulse Demon Infiltration", /datum/event/spawn_pulsedemon, 0), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Вспышка болезни", /datum/event/disease_outbreak, 0, list(ASSIGNMENT_MEDICAL = 150), TRUE), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Хедкрабы", /datum/event/headcrabs, 0, list(ASSIGNMENT_SECURITY = 20)),