Skip to content

Commit

Permalink
add: Abductors moderate event (ss220-space#4852)
Browse files Browse the repository at this point in the history
abd
  • Loading branch information
LiquidPotroh authored and PiroMage committed Aug 5, 2024
1 parent ba8d11b commit 9b52b47
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 44 deletions.
90 changes: 46 additions & 44 deletions code/modules/events/abductor.dm
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions code/modules/events/event_container.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down

0 comments on commit 9b52b47

Please sign in to comment.