New Event: Shuttle Catastrophe (#53003)

The shuttle runs into some kind of horrible event, and is no longer servicable. The station is given a new one!
This commit is contained in:
tralezab
2020-08-18 17:42:06 -07:00
committed by GitHub
parent 750a298fc6
commit 46ec19aa81
5 changed files with 48 additions and 3 deletions

View File

@@ -31,6 +31,11 @@
#define EARLY_LAUNCHED 2
#define ENDGAME_TRANSIT 3
//positive value = cannot puchase
#define SHUTTLEPURCHASE_PURCHASABLE 0 //station can buy a shuttle
#define SHUTTLEPURCHASE_PURCHASED 1 //station has already bought a shuttle, so cannot
#define SHUTTLEPURCHASE_FORCED 2 //station was given a new shuttle through events or other shenanigans
// Ripples, effects that signal a shuttle's arrival
#define SHUTTLE_RIPPLE_TIME 100

View File

@@ -47,7 +47,7 @@ SUBSYSTEM_DEF(shuttle)
var/datum/round_event/shuttle_loan/shuttle_loan
var/shuttle_purchased = FALSE //If the station has purchased a replacement escape shuttle this round
var/shuttle_purchased = SHUTTLEPURCHASE_PURCHASABLE //If the station has purchased a replacement escape shuttle this round
var/list/shuttle_purchase_requirements_met = list() //For keeping track of ingame events that would unlock new shuttles, such as defeating a boss or discovering a secret item
var/lockdown = FALSE //disallow transit after nuke goes off

View File

@@ -159,8 +159,10 @@
if(SSshuttle.emergency.mode != SHUTTLE_RECALL && SSshuttle.emergency.mode != SHUTTLE_IDLE)
to_chat(usr, "<span class='alert'>It's a bit late to buy a new shuttle, don't you think?</span>")
return
if(SSshuttle.shuttle_purchased)
if(SSshuttle.shuttle_purchased == SHUTTLEPURCHASE_PURCHASED)
to_chat(usr, "<span class='alert'>A replacement shuttle has already been purchased.</span>")
else if(SSshuttle.shuttle_purchased == SHUTTLEPURCHASE_FORCED)
to_chat(usr, "<span class='alert'>Due to unforseen circumstances, shuttle purchasing is no longer available.</span>")
else if(!S.prerequisites_met())
to_chat(usr, "<span class='alert'>You have not met the requirements for purchasing this shuttle.</span>")
else
@@ -169,7 +171,7 @@
if(D)
points_to_check = D.account_balance
if(points_to_check >= S.credit_cost)
SSshuttle.shuttle_purchased = TRUE
SSshuttle.shuttle_purchased = SHUTTLEPURCHASE_PURCHASED
SSshuttle.unload_preview()
SSshuttle.load_template(S)
SSshuttle.existing_shuttle = SSshuttle.emergency

View File

@@ -0,0 +1,37 @@
/datum/round_event_control/shuttle_catastrophe
name = "Shuttle Catastrophe"
typepath = /datum/round_event/shuttle_catastrophe
weight = 10
max_occurrences = 1
/datum/round_event_control/shuttle_catastrophe/canSpawnEvent(players, gamemode)
if(SSshuttle.emergency.name == "Build your own shuttle kit")
return FALSE //don't undo manual player engineering, it also would unload people and ghost them, there's just a lot of problems
return ..()
/datum/round_event/shuttle_catastrophe
var/datum/map_template/shuttle/new_shuttle
/datum/round_event/shuttle_catastrophe/announce(fake)
var/cause = pick("was attacked by [syndicate_name()] Operatives", "mysteriously teleported away", "had its refuelling crew mutiny",
"was found with its engines stolen", "\[REDACTED\]", "flew into the sunset, and melted", "learned something from a very wise cow, and left on its own",
"had cloning devices on it", "had its shuttle inspector put the shuttle in reverse instead of park, causing the shuttle to crash into the hangar")
priority_announce("Your emergency shuttle [cause]. Your replacement shuttle will be the [new_shuttle.name] until further notice.", "CentCom Spacecraft Engineering")
/datum/round_event/shuttle_catastrophe/setup()
var/list/valid_shuttle_templates = list()
for(var/shuttle_id in SSmapping.shuttle_templates)
var/datum/map_template/shuttle/template = SSmapping.shuttle_templates[shuttle_id]
if(template.can_be_bought && template.credit_cost < INFINITY) //if we could get it from the communications console, it's cool for us to get it here
valid_shuttle_templates += template
new_shuttle = pick(valid_shuttle_templates)
/datum/round_event/shuttle_catastrophe/start()
SSshuttle.shuttle_purchased = SHUTTLEPURCHASE_FORCED
SSshuttle.unload_preview()
SSshuttle.load_template(new_shuttle)
SSshuttle.existing_shuttle = SSshuttle.emergency
SSshuttle.action_load(new_shuttle)
log_shuttle("Shuttle Catastrophe set a new shuttle, [new_shuttle.name].")

View File

@@ -1874,6 +1874,7 @@
#include "code\modules\events\processor_overload.dm"
#include "code\modules\events\radiation_storm.dm"
#include "code\modules\events\sentience.dm"
#include "code\modules\events\shuttle_catastrophe.dm"
#include "code\modules\events\shuttle_loan.dm"
#include "code\modules\events\space_dragon.dm"
#include "code\modules\events\spacevine.dm"