[MIRROR] Shuttle Insurance! (#3505)

* Shuttle Insurance! (#57025)

Co-authored-by: spessbro <51048066+spessbro@ users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>

* Shuttle Insurance!

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: spessbro <51048066+spessbro@ users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-02-19 13:07:47 +00:00
committed by GitHub
co-authored by spessbro Mothblocks tralezab
parent ac743ea7d0
commit efd745021e
5 changed files with 69 additions and 3 deletions
+2 -2
View File
@@ -51,8 +51,8 @@
if(PIRATES_ROGUES)
ship_template = /datum/map_template/shuttle/pirate/default
threat.title = "Sector protection offer"
threat.content = "Greetings from the [ship_name]. Your sector needs protection, how about you pay us [payoff] credits, or else you may be left wide open to an attack."
threat.possible_answers = list("We'll pay.","That sounds like a scam.")
threat.content = "Hey, pal, this is the [ship_name]. Can't help but notice you're rocking a wild and crazy shuttle there with NO INSURANCE! Crazy. What if something happened to it, huh?! We've done a quick evaluation on your rates in this sector and we're offering [payoff] to cover for your shuttle in case of any disaster."
threat.possible_answers = list("Purchase Insurance.","Reject Offer.")
if(PIRATES_SILVERSCALES)
ship_template = /datum/map_template/shuttle/pirate/silverscale
threat.title = "Tribute to high society"
+14 -1
View File
@@ -21,10 +21,19 @@
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")
var/message = "Your emergency shuttle [cause]. "
priority_announce("Your emergency shuttle [cause]. Your replacement shuttle will be the [new_shuttle.name] until further notice.", "CentCom Spacecraft Engineering")
if(SSshuttle.shuttle_insurance)
message += "Luckily, your shuttle insurance has covered the costs of repair!"
if(SSeconomy.get_dep_account(ACCOUNT_CAR))
message += "You have been awarded a bonus from [command_name()] for smart spending."
else
message += "Your replacement shuttle will be the [new_shuttle.name] until further notice."
priority_announce(message, "[command_name()] Spacecraft Engineering")
/datum/round_event/shuttle_catastrophe/setup()
if(SSshuttle.shuttle_insurance)
return
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]
@@ -33,6 +42,10 @@
new_shuttle = pick(valid_shuttle_templates)
/datum/round_event/shuttle_catastrophe/start()
if(SSshuttle.shuttle_insurance)
var/datum/bank_account/station_balance = SSeconomy.get_dep_account(ACCOUNT_CAR)
station_balance?.adjust_money(8000)
return
SSshuttle.shuttle_purchased = SHUTTLEPURCHASE_FORCED
SSshuttle.unload_preview()
SSshuttle.existing_shuttle = SSshuttle.emergency
+50
View File
@@ -0,0 +1,50 @@
/datum/round_event_control/shuttle_insurance
name = "Shuttle Insurance"
typepath = /datum/round_event/shuttle_insurance
weight = 200 //you're basically bound to get it
max_occurrences = 1
/datum/round_event_control/shuttle_insurance/canSpawnEvent(players, gamemode)
if(!SSeconomy.get_dep_account(ACCOUNT_CAR))
return FALSE //They can't pay?
if(SSshuttle.shuttle_purchased != SHUTTLEPURCHASE_FORCED)
return FALSE //don't do it if there's nothing to insure
if(EMERGENCY_AT_LEAST_DOCKED)
return FALSE //catastrophes won't trigger so no point
return ..()
/datum/round_event/shuttle_insurance
var/ship_name = "\"In the Unlikely Event\""
var/datum/comm_message/insurance_message
var/insurance_evaluation = 0
/datum/round_event/shuttle_insurance/announce(fake)
priority_announce("Incoming subspace communication. Secure channel opened at all communication consoles.", "Incoming Message", SSstation.announcer.get_rand_report_sound())
/datum/round_event/shuttle_insurance/setup()
ship_name = pick(strings(PIRATE_NAMES_FILE, "rogue_names"))
for(var/shuttle_id in SSmapping.shuttle_templates)
var/datum/map_template/shuttle/template = SSmapping.shuttle_templates[shuttle_id]
if(template.name == SSshuttle.emergency.name) //found you slackin
insurance_evaluation = template.credit_cost/2
break
if(!insurance_evaluation)
insurance_evaluation = 5000 //gee i dunno
/datum/round_event/shuttle_insurance/start()
insurance_message = new("Shuttle Insurance", "Hey, pal, this is the [ship_name]. Can't help but notice you're rocking a wild and crazy shuttle there with NO INSURANCE! Crazy. What if something happened to it, huh?! We've done a quick evaluation on your rates in this sector and we're offering [insurance_evaluation] to cover for your shuttle in case of any disaster.", list("Purchase Insurance.","Reject Offer."))
insurance_message.answer_callback = CALLBACK(src,.proc/answered)
SScommunications.send_message(insurance_message, unique = TRUE)
/datum/round_event/shuttle_insurance/proc/answered()
if(EMERGENCY_AT_LEAST_DOCKED)
priority_announce("You are definitely too late to purchase insurance, my friends. Our agents don't work on site.",sender_override = ship_name)
if(insurance_message && insurance_message.answered == 1)
var/datum/bank_account/station_balance = SSeconomy.get_dep_account(ACCOUNT_CAR)
if(!station_balance?.adjust_money(-insurance_evaluation))
priority_announce("You didn't send us enough money for shuttle insurance. This, in the space layman's terms, is considered scamming. We're keeping your money, scammers!",sender_override = ship_name)
return
priority_announce("Thank you for purchasing shuttle insurance!",sender_override = ship_name)
SSshuttle.shuttle_insurance = TRUE