mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-05 22:43:46 +00:00
major cleanup of modules/atmospherics folder and all related files, still many missing -cleanup of procs name -cleanup of vars name -documentation of some of the procs -minor changes to some for() logic (no in game changes just early continue or as anything checks) No in game changes, only code and docs
86 lines
2.6 KiB
Plaintext
86 lines
2.6 KiB
Plaintext
/datum/round_event_control/alien_infestation
|
|
name = "Alien Infestation"
|
|
typepath = /datum/round_event/ghost_role/alien_infestation
|
|
weight = 5
|
|
|
|
min_players = 10
|
|
|
|
dynamic_should_hijack = TRUE
|
|
|
|
/datum/round_event_control/alien_infestation/canSpawnEvent()
|
|
. = ..()
|
|
if(!.)
|
|
return .
|
|
|
|
for(var/mob/living/carbon/alien/A in GLOB.player_list)
|
|
if(A.stat != DEAD)
|
|
return FALSE
|
|
|
|
/datum/round_event/ghost_role/alien_infestation
|
|
announceWhen = 400
|
|
|
|
minimum_required = 1
|
|
role_name = "alien larva"
|
|
|
|
// 50% chance of being incremented by one
|
|
var/spawncount = 1
|
|
fakeable = TRUE
|
|
|
|
|
|
/datum/round_event/ghost_role/alien_infestation/setup()
|
|
announceWhen = rand(announceWhen, announceWhen + 50)
|
|
if(prob(50))
|
|
spawncount++
|
|
|
|
/datum/round_event/ghost_role/alien_infestation/announce(fake)
|
|
var/living_aliens = FALSE
|
|
for(var/mob/living/carbon/alien/A in GLOB.player_list)
|
|
if(A.stat != DEAD)
|
|
living_aliens = TRUE
|
|
|
|
if(living_aliens || fake)
|
|
priority_announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", ANNOUNCER_ALIENS)
|
|
|
|
|
|
/datum/round_event/ghost_role/alien_infestation/spawn_role()
|
|
var/list/vents = list()
|
|
for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines)
|
|
if(QDELETED(temp_vent))
|
|
continue
|
|
if(is_station_level(temp_vent.loc.z) && !temp_vent.welded)
|
|
var/datum/pipeline/temp_vent_parent = temp_vent.parents[1]
|
|
if(!temp_vent_parent)
|
|
continue//no parent vent
|
|
//Stops Aliens getting stuck in small networks.
|
|
//See: Security, Virology
|
|
if(temp_vent_parent.other_atmos_machines.len > 20)
|
|
vents += temp_vent
|
|
|
|
if(!vents.len)
|
|
message_admins("An event attempted to spawn an alien but no suitable vents were found. Shutting down.")
|
|
return MAP_ERROR
|
|
|
|
var/list/candidates = get_candidates(ROLE_ALIEN, ROLE_ALIEN)
|
|
|
|
if(!candidates.len)
|
|
return NOT_ENOUGH_PLAYERS
|
|
|
|
while(spawncount > 0 && vents.len && candidates.len)
|
|
var/obj/vent = pick_n_take(vents)
|
|
var/client/candidate_client = pick_n_take(candidates)
|
|
var/datum/mind/candidate_mind = candidate_client.mob.mind
|
|
if(!candidate_mind)
|
|
continue
|
|
var/mob/living/carbon/alien/larva/new_xeno = new(vent.loc)
|
|
candidate_mind.transfer_to(new_xeno)
|
|
candidate_mind.set_assigned_role(SSjob.GetJobType(/datum/job/xenomorph))
|
|
candidate_mind.special_role = ROLE_ALIEN
|
|
new_xeno.move_into_vent(vent)
|
|
|
|
spawncount--
|
|
message_admins("[ADMIN_LOOKUPFLW(new_xeno)] has been made into an alien by an event.")
|
|
log_game("[key_name(new_xeno)] was spawned as an alien by an event.")
|
|
spawned_mobs += new_xeno
|
|
|
|
return SUCCESSFUL_SPAWN
|