mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Largely ported from the work done at Baystation in https://github.com/Baystation12/Baystation12/pull/17460 and later commits. - Shuttles no longer require a separate area for each location they jump to. Instead destinations are indicated by landmark objects, which are not necessarily exclusive to that shuttle. This means that more than one shuttle could use the same docking port (not at the same time of course). - Enhanced shuttle control computers to use nanoui if they didn't. - Organizes shuttle datum code a bit better so there is less re-inventing the wheel in subtypes. - Allows the possibility of shuttles (or destinations) that start on late-loaded maps. - Deprecate the "extra" shuttle areas that are no longer needed and update shuttle areas in unit tests This all required a bit of infrastructure improvements. - ChangeArea proc, for changing the area of a turf. - Fixed lighting overlays actually being able to be destroyed. - Added a few utility macros and procs. - Added "turf translation" procs which are like move_contents_to but more flexible.
79 lines
2.3 KiB
Plaintext
79 lines
2.3 KiB
Plaintext
//
|
|
// Crashable shuttle. Boom etc.
|
|
//
|
|
|
|
/datum/shuttle
|
|
var/list/crash_locations = null
|
|
var/crash_message = "Oops. The shuttle blew up." // Announcement made when shuttle crashes
|
|
|
|
/datum/shuttle/New()
|
|
if(crash_locations)
|
|
var/crash_location_ids = crash_locations
|
|
crash_locations = list()
|
|
for(var/location_tag in crash_location_ids)
|
|
var/obj/effect/shuttle_landmark/L = SSshuttles.get_landmark(location_tag)
|
|
if(L)
|
|
crash_locations += L
|
|
..()
|
|
|
|
// Return 0 to let the jump continue, 1 to abort the jump.
|
|
// Default implementation checks if the shuttle should crash and if so crashes it.
|
|
/datum/shuttle/proc/process_longjump(var/obj/effect/shuttle_landmark/intended_destination)
|
|
if(should_crash(intended_destination))
|
|
do_crash(intended_destination)
|
|
return 1
|
|
|
|
// Decide if this is the time we crash. Return true for yes
|
|
/datum/shuttle/proc/should_crash(var/obj/effect/shuttle_landmark/intended_destination)
|
|
return FALSE
|
|
|
|
// Actually crash the shuttle
|
|
/datum/shuttle/proc/do_crash(var/obj/effect/shuttle_landmark/intended_destination)
|
|
// Choose the target
|
|
var/obj/effect/shuttle_landmark/target = pick(crash_locations)
|
|
ASSERT(istype(target))
|
|
|
|
// Blow up the target area?
|
|
//command_announcement.Announce(departure_message,(announcer ? announcer : "[using_map.boss_name]"))
|
|
|
|
//What people are we dealing with here
|
|
var/list/victims = list()
|
|
for(var/area/A in shuttle_area)
|
|
for(var/mob/living/L in A)
|
|
victims += L
|
|
spawn(0)
|
|
shake_camera(L,2 SECONDS,4)
|
|
|
|
//SHAKA SHAKA SHAKA
|
|
sleep(2 SECONDS)
|
|
|
|
// Move the shuttle
|
|
if (!attempt_move(target))
|
|
return // Lucky!
|
|
|
|
// Hide people
|
|
for(var/living in victims)
|
|
var/mob/living/L = living
|
|
victims[L] = get_turf(L)
|
|
L.Sleeping(rand(10,20))
|
|
L.Life()
|
|
L.loc = null
|
|
|
|
// Blow up the shuttle
|
|
var/list/shuttle_turfs = list()
|
|
for(var/area/A in shuttle_area)
|
|
shuttle_turfs += get_area_turfs(A)
|
|
var/turf/epicenter = pick(shuttle_turfs)
|
|
var/boomsize = shuttle_turfs.len / 10 // Bigger shuttle = bigger boom
|
|
explosion(epicenter, 0, boomsize, boomsize*2, boomsize*3)
|
|
moving_status = SHUTTLE_CRASHED
|
|
command_announcement.Announce("[crash_message]", "Shuttle Alert")
|
|
|
|
// Put people back
|
|
for(var/living in victims)
|
|
var/mob/living/L = living
|
|
L.loc = victims[L]
|
|
L.adjustBruteLoss(5)
|
|
L.adjustBruteLoss(10)
|
|
L.adjustBruteLoss(15)
|