Files
Bubberstation/code/modules/events/shuttle_loan/shuttle_loan_event.dm
+37 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

122 lines
4.9 KiB
Plaintext

/// Gives the choice to "loan" the shuttle to central command, giving a big delay on its return to the station in exchange for money and loot/threats in the cargo hold. Only one can be available at a time.
/datum/round_event_control/shuttle_loan
name = "Shuttle Loan"
typepath = /datum/round_event/shuttle_loan
max_occurrences = 3
earliest_start = 7 MINUTES
category = EVENT_CATEGORY_BUREAUCRATIC
description = "If cargo accepts the offer, fills the shuttle with loot and/or enemies."
///The types of loan events already run (and to be excluded if the event triggers).
admin_setup = list(/datum/event_admin_setup/listed_options/shuttle_loan)
///A list of normally unavailable (or already run) situations datums
var/list/unavailable_situations = list(/datum/shuttle_loan_situation/mail_strike)
/datum/round_event_control/shuttle_loan/can_spawn_event(players_amt, allow_magic = FALSE)
. = ..()
for(var/datum/round_event/running_event in SSevents.running)
if(istype(running_event, /datum/round_event/shuttle_loan)) //Make sure two of these don't happen at once.
return FALSE
/datum/round_event/shuttle_loan
announce_when = 1
end_when = 500
/// what type of shuttle loan situation the station faces.
var/datum/shuttle_loan_situation/situation
/// Whether the station has let Centcom commandeer the shuttle yet.
var/dispatched = FALSE
/// How long for the shuttle to come back to the station?
var/delay_time = 5 MINUTES
/datum/round_event/shuttle_loan/setup()
var/datum/round_event_control/shuttle_loan/loan_control = control
//by this point if situation is admin picked, it is a type, not an instance.
if(!situation)
var/list/valid_situations = subtypesof(/datum/shuttle_loan_situation) - loan_control.unavailable_situations
if(!valid_situations.len)
//If we somehow run out of loans (fking campbell), they all become available again
loan_control.unavailable_situations.Cut()
valid_situations = subtypesof(/datum/shuttle_loan_situation)
situation = pick(valid_situations)
loan_control.unavailable_situations.Add(situation)
situation = new situation()
/datum/round_event/shuttle_loan/announce(fake)
if(fake)
var/datum/shuttle_loan_situation/fake_situation = pick(subtypesof(/datum/shuttle_loan_situation))
situation = new fake_situation
else
SSshuttle.shuttle_loan = src
priority_announce("Cargo: [situation.announcement_text]", situation.sender)
if(fake)
qdel(situation)
///Triggered when accepting the shuttle loan. Gives payment and delays shuttle. Ensures the event won't be deleted from event controller until after the cargo arrives at the station.
/datum/round_event/shuttle_loan/proc/loan_shuttle()
priority_announce(situation.thanks_msg, "Cargo shuttle commandeered by [command_name()].")
dispatched = TRUE
var/datum/bank_account/dep_account = SSeconomy.get_dep_account(ACCOUNT_CAR)
dep_account?.adjust_money(situation.bonus_points)
end_when = activeFor + 1
SSshuttle.supply.mode = SHUTTLE_CALL
SSshuttle.supply.destination = SSshuttle.getDock("cargo_home")
SSshuttle.supply.setTimer(delay_time)
SSshuttle.centcom_message += situation.shuttle_transit_text
log_game("Shuttle loan event firing with type '[situation.logging_desc]'.")
/datum/round_event/shuttle_loan/tick()
if(dispatched)
if(SSshuttle.supply.mode != SHUTTLE_IDLE)
end_when = activeFor
else
end_when = activeFor + 1
/datum/round_event/shuttle_loan/end()
if(!SSshuttle.shuttle_loan)
return
if(!SSshuttle.shuttle_loan.dispatched) //Haven't dispatched in time? Too bad. Clean it up and move on without spawning anything.
SSshuttle.shuttle_loan = null
return
SSshuttle.shuttle_loan = null
//get empty turfs
var/list/empty_shuttle_turfs = list()
var/list/blocked_shutte_turfs = list()
var/list/area/shuttle/shuttle_areas = SSshuttle.supply.shuttle_areas
for(var/area/shuttle/shuttle_area as anything in shuttle_areas)
for(var/turf/open/floor/shuttle_turf in shuttle_area.get_turfs_from_all_zlevels())
if(shuttle_turf.is_blocked_turf())
blocked_shutte_turfs += shuttle_turf
continue
empty_shuttle_turfs += shuttle_turf
if(!empty_shuttle_turfs.len)
return
//let the situation spawn its items
var/list/spawn_list = list()
situation.spawn_items(spawn_list, empty_shuttle_turfs, blocked_shutte_turfs)
var/false_positive = 0
while(spawn_list.len && empty_shuttle_turfs.len)
var/turf/spawn_turf = pick_n_take(empty_shuttle_turfs)
if(spawn_turf.contents.len && false_positive < 5)
false_positive++
continue
var/spawn_type = pick_n_take(spawn_list)
new spawn_type(spawn_turf)
/datum/event_admin_setup/listed_options/shuttle_loan
input_text = "Select a loan offer?"
/datum/event_admin_setup/listed_options/shuttle_loan/get_list()
var/datum/round_event_control/shuttle_loan/loan_event = event_control
var/list/valid_situations = subtypesof(/datum/shuttle_loan_situation) - loan_event.unavailable_situations
return valid_situations
/datum/event_admin_setup/listed_options/shuttle_loan/apply_to_event(datum/round_event/shuttle_loan/event)
event.situation = chosen