Files
Bubberstation/code/modules/events/ghost_role/morph_event.dm
SkyratBot abefbb0d64 [MIRROR] Adds two new helper procs for finding a maintenance/space spawn turf [MDB IGNORE] (#20536)
* Adds two new helper procs for finding a maintenance/space spawn turf (#74598)

## About The Pull Request

Adds two new global helper procs, find_maintenance_spawn and
find_space_spawn. These check the list of maintenance/space carp spawn
landmarks, and return the turf of a random one.

The find_maintenance_spawn helper has two arguments, for atmos safety
checks and making sure the spawn is properly shrouded in darkness.

This also includes some tidiness changes to the ghost_role event file,
because the helper was originally just going to be a proc on ghost role
events.

**Stuff moved to find_maintenance_spawn:**

- Spiders
- Nightmares
- Fugitives
- Paradox clones
- Morph

**Stuff moved to find_space_spawn:**

- Space Dragon
- Loneop
- Ninja
- Slaughter Demon
- Revenant backup spawn location

If we ignore all of the autodocing, this should remove about a dozen or
two lines of code.
## Why It's Good For The Game

Reduces an amount of duplicated code. Also makes future implementation a
bit easier and less copy-pastey.
## Changelog
🆑 Rhials
code: Adds two new super-duper helpful helper procs for finding a
maintenance/space spawn location, for all of your
event/midround/whatever needs!
code: Moves all midrounds/ghost_role events that hinged on
maintenance/space carp spawns to the aforementioned helpers.
code: The ghost_role event module file is now autodoced.
/🆑

* Adds two new helper procs for finding a maintenance/space spawn turf

---------

Co-authored-by: Rhials <Datguy33456@gmail.com>
2023-04-14 14:25:16 +01:00

39 lines
1.3 KiB
Plaintext

/datum/round_event_control/morph
name = "Spawn Morph"
typepath = /datum/round_event/ghost_role/morph
weight = 0
max_occurrences = 1
category = EVENT_CATEGORY_ENTITIES
description = "Spawns a hungry shapeshifting blobby creature."
min_wizard_trigger_potency = 4
max_wizard_trigger_potency = 7
/datum/round_event/ghost_role/morph
minimum_required = 1
role_name = "morphling"
/datum/round_event/ghost_role/morph/spawn_role()
var/list/candidates = get_candidates(ROLE_ALIEN, ROLE_ALIEN)
if(!candidates.len)
return NOT_ENOUGH_PLAYERS
var/mob/dead/selected = pick_n_take(candidates)
var/datum/mind/player_mind = new /datum/mind(selected.key)
player_mind.active = TRUE
var/turf/spawn_loc = find_maintenance_spawn(atmos_sensitive = TRUE, require_darkness = FALSE)
if(isnull(spawn_loc))
return MAP_ERROR
var/mob/living/simple_animal/hostile/morph/S = new /mob/living/simple_animal/hostile/morph(spawn_loc)
player_mind.transfer_to(S)
player_mind.set_assigned_role(SSjob.GetJobType(/datum/job/morph))
player_mind.special_role = ROLE_MORPH
player_mind.add_antag_datum(/datum/antagonist/morph)
SEND_SOUND(S, sound('sound/magic/mutate.ogg'))
message_admins("[ADMIN_LOOKUPFLW(S)] has been made into a morph by an event.")
S.log_message("was spawned as a morph by an event.", LOG_GAME)
spawned_mobs += S
return SUCCESSFUL_SPAWN