Files
Tim 933f4697ce Add No Escape Final Traitor Objective (aka Singularity Shuttle Event) (#86796)
## About The Pull Request
This is a remake of:
 
- #77188 
- #86655

Both were DNM'd due to a lack of difficulty requirements for spawning a
singularity as a shuttle event.

---

**No Escape - Final Traitor Objective:**

- Spawns a special singularity beacon, syndicate inducer, and wrench.
- The beacon must be powered with an inducer and planted on the shuttle
to work.
- The beacon slowly increases the chance of a massive STAGE SIX (11x11)
singularity to appear (1% every 8 seconds)
- The beacon can be turned on at any time, but will only increase the
chance while on the shuttle and if it is in transit
- After 5 seconds the crew gets an announcement that a singularity is
approaching and has an extra minute of transit time due to time dilation
- If the beacon is turned off or destroyed it decreases the probability
by the same rate. (-1% every 8 seconds)
- If the beacon is spaced while active it decreases the probability by
x2 rate. (-2% every 8 seconds)
- If the singularity is spawned while the beacon is disabled or spaced,
there is a chance for it to not directly hit the shuttle (but since it's
so big it will likely brush against the side)

To prevent the singularity from instantly appearing and to give the crew
a chance to react, it starts with a negative probability that takes 15
seconds to reach 0%. Deactivating, destroying, or spacing the beacon
will slowly reverse the chance but it's not an instant guarantee. So the
longer you wait to act, the worse your chances are!

I cleaned up quite a bit of the singularity code while I was working on
this.
CC @Time-Green  @MrMelbert 


## Why It's Good For The Game
There have been several attempts to add a singularity shuttle event that
could be triggered but it was deemed too chaotic or the requirements too
easy so they were restricted to admin-only events. Making it a final
traitor objective, sets a high requirement that must be achieved before
activating it as a doomsday event. It also gives the crew a chance to
intervene and stop the event before disaster strikes.

It's similar to a syndicate bomb ticking down while on the shuttle that
serves to be climatic.

## Changelog
🆑
add: Add no escape final traitor objective that spawns a stage six
(11x11) singularity shuttle event.
/🆑
2024-11-11 00:43:37 -08:00

83 lines
3.6 KiB
Plaintext

///Sensors indicate that a black hole's gravitational field is affecting the region of space we were headed through
/datum/shuttle_event/simple_spawner/black_hole
name = "Black Hole (Oh no!)"
event_probability = 0 // only admin spawnable
spawn_probability_per_process = 10
activation_fraction = 0.35
spawning_flags = SHUTTLE_EVENT_HIT_SHUTTLE
spawning_list = list(/obj/singularity/shuttle_event = 1)
// only spawn it once
remove_from_list_when_spawned = TRUE
self_destruct_when_empty = TRUE
///Kobayashi Maru version
/datum/shuttle_event/simple_spawner/black_hole/adminbus
name = "Black Holes (OH GOD!)"
spawn_probability_per_process = 50
activation_fraction = 0.2
spawning_list = list(/obj/singularity/shuttle_event = 10)
remove_from_list_when_spawned = TRUE
/// No Escape traitor final objective
/datum/shuttle_event/simple_spawner/black_hole/no_escape
name = "Black Hole Massive (is not admin spawnable)"
spawn_probability_per_process = -1.875 // starts in the negative but increases over time
activation_fraction = 0 // no delay
spawning_list = list(/obj/singularity/shuttle_event/no_escape = 1)
remove_from_list_when_spawned = TRUE
/// How much the spawn_probability_per_process increases or decreases over time
/// since spawn_probability starts negative after 15 seconds the prob reaches 0%
/// then every 8 seconds after, the prob increases by ~1%
var/probability_rate_of_change = 0.125
/// The beacon that is drawing the singularity closer to the escape shuttle
var/obj/machinery/power/singularity_beacon/syndicate/no_escape/beacon
/datum/shuttle_event/simple_spawner/black_hole/no_escape/proc/announcement()
priority_announce(
text = "Sensors indicate that a black hole's gravitational field is affecting the region of space we are heading through.",
title = "The Orion Trail",
sound = 'sound/announcer/notice/notice1.ogg',
has_important_message = TRUE,
sender_override = "Emergency Shuttle",
color_override = "red",
)
/datum/shuttle_event/simple_spawner/black_hole/no_escape/activate()
. = ..()
addtimer(CALLBACK(src, PROC_REF(announcement)), 5 SECONDS)
port.setTimer(port.timeLeft(1) + 1 MINUTES) // the singularity causes a time distortion
/datum/shuttle_event/simple_spawner/black_hole/no_escape/event_process()
. = ..()
if(!.)
return
if((SSshuttle.emergency.mode == SHUTTLE_ESCAPE)) // only while shuttle is in transit
if(beacon && beacon.active)
var/area/escape_shuttle_area = get_area(beacon)
if(istype(escape_shuttle_area, /area/shuttle/escape) && SSshuttle.emergency.is_in_shuttle_bounds(beacon))
spawn_probability_per_process += probability_rate_of_change
else // beacon is not on shuttle and likely got jettisoned in space
// since the beacon is still powered and attracting the singularity it results in x2 rate of decrease
spawn_probability_per_process -= (probability_rate_of_change * 2)
else // beacon is unpowered or destroyed
spawn_probability_per_process -= probability_rate_of_change
if(prob(spawn_probability_per_process))
spawn_movable(get_type_to_spawn())
return SHUTTLE_EVENT_CLEAR
/datum/shuttle_event/simple_spawner/black_hole/no_escape/get_spawn_turf()
RETURN_TYPE(/turf)
if(beacon && beacon.active)
var/area/escape_shuttle_area = get_area(beacon)
if(istype(escape_shuttle_area, /area/shuttle/escape) && SSshuttle.emergency.is_in_shuttle_bounds(beacon))
// beacon is active and on shuttle so singularity will directly hit the shuttle
return pick(spawning_turfs_hit)
// otherwise beacon is turned off, destroyed, or spaced so there is a chance to miss
// the singularity is 11x11 so even a miss can have a glancing hit against the shuttle
return pick(spawning_turfs_hit + spawning_turfs_miss)