The Shuttle Loan event can now roll multiple times per round (#70819)

## About The Pull Request

The Shuttle Loan event can now roll multiple times (up to 3) per round.
When a loan is offered, the event cannot roll again until the current
offer is accepted. If an admin forces the event, the current loan offer
will be replaced by the new one. A specific type of loan offer will not
appear more than once per round under normal circumstances.

## Why It's Good For The Game

I think the Shuttle Loan event is really neat. It's presents Cargo with
the option to take on risk and reap the rewards, with some opportunities
for things to go very very wrong. There are twice as many loan offers as
there were when this event was introduced nine years ago, with more
potentially on the way (wink wink nudge nudge). I don't think it should
be constrained to just one per round any longer.

## Changelog

🆑
balance: The Shuttle Loan event no longer only rolls once per round.
/🆑
This commit is contained in:
Rhials
2022-11-04 03:51:53 -04:00
committed by GitHub
parent aead1310af
commit 7a671b657f
+41 -3
View File
@@ -7,14 +7,40 @@
#define ITS_HIP_TO 7
#define MY_GOD_JC 8
/datum/round_event_control/shuttle_loan
name = "Shuttle Loan"
typepath = /datum/round_event/shuttle_loan
max_occurrences = 1
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 offers that the crew can recieve.
var/list/shuttle_loan_offers = list(
ANTIDOTE_NEEDED,
DEPARTMENT_RESUPPLY,
HIJACK_SYNDIE,
ITS_HIP_TO,
MY_GOD_JC,
PIZZA_DELIVERY,
RUSKY_PARTY,
SPIDER_GIFT,
)
///The types of loan events already run (and to be excluded if the event triggers).
var/list/run_events = list()
/datum/round_event_control/shuttle_loan/can_spawn_event(players_amt)
. = ..()
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_control/shuttle_loan/admin_setup()
if(!check_rights(R_FUN))
return ADMIN_CANCEL_EVENT
for(var/datum/round_event/shuttle_loan/loan_event in SSevents.running)
loan_event.kill() //Force out the old event for a new one to take its place
/datum/round_event/shuttle_loan
announce_when = 1
@@ -26,7 +52,19 @@
var/loan_type //for logging
/datum/round_event/shuttle_loan/setup()
dispatch_type = pick(HIJACK_SYNDIE, RUSKY_PARTY, SPIDER_GIFT, DEPARTMENT_RESUPPLY, ANTIDOTE_NEEDED, PIZZA_DELIVERY, ITS_HIP_TO, MY_GOD_JC)
for(var/datum/round_event_control/shuttle_loan/loan_event_control in SSevents.control) //We can't call control, because it hasn't been set yet
var/list/loan_list = list()
loan_list += loan_event_control.shuttle_loan_offers
var/list/run_events = loan_event_control.run_events //Ask the round_event_control which loans have already been offered
loan_list -= run_events //Remove the already offered loans from the candidate list
if(!length(loan_list)) //If we somehow run out of loans, they all become available again
loan_list += loan_event_control.shuttle_loan_offers
run_events.Cut()
dispatch_type = pick(loan_list) //Pick a loan to offer, and add it to the blacklist
loan_event_control.run_events += dispatch_type
/datum/round_event/shuttle_loan/announce(fake)
SSshuttle.shuttle_loan = src