Streamlines/Fixes Piracy Spawner Checks - They Piss Off When Paid (#74275)

I think at some point this worked, but there were just too many checks
on abstract concepts and it seems that "aborting" the callback wasn't
really working? Anyways everything just felt really awk to me with how
`message_override` was working, so let's store a variable on
`chosen_gang` since we're already reliant on that for all of our
messages and stuff like that, and just slim down the number of weird
checks that we do into just one simple "did we get paid"?

One consequence of this is that refusing to pay won't spawn pirates
instantly, but the time-to-respond was already two minutes so I don't
really see this as a major drawback.
## Why It's Good For The Game

I PAID THEM OFF NOW FUCK OFF
This commit is contained in:
san7890
2023-03-29 06:31:28 +00:00
committed by GitHub
parent e5451da462
commit 4651fba9a5
2 changed files with 17 additions and 12 deletions
+14 -12
View File
@@ -37,24 +37,26 @@
//send message
priority_announce("Incoming subspace communication. Secure channel opened at all communication consoles.", "Incoming Message", SSstation.announcer.get_rand_report_sound())
threat.answer_callback = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pirates_answered), threat, chosen_gang, payoff, world.time)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_pirates), threat, chosen_gang, FALSE), RESPONSE_MAX_TIME)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_pirates), threat, chosen_gang), RESPONSE_MAX_TIME)
SScommunications.send_message(threat, unique = TRUE)
/proc/pirates_answered(datum/comm_message/threat, datum/pirate_gang/chosen_gang, payoff, initial_send_time)
if(world.time > initial_send_time + RESPONSE_MAX_TIME)
priority_announce(chosen_gang.response_too_late ,sender_override = chosen_gang.ship_name)
priority_announce(chosen_gang.response_too_late, sender_override = chosen_gang.ship_name)
return
if(!threat?.answered)
return
if(threat?.answered)
var/datum/bank_account/plundered_account = SSeconomy.get_dep_account(ACCOUNT_CAR)
if(plundered_account)
if(plundered_account.adjust_money(-payoff))
priority_announce(chosen_gang.response_received, sender_override = chosen_gang.ship_name)
else
priority_announce(chosen_gang.response_not_enough, sender_override = chosen_gang.ship_name)
spawn_pirates(threat, chosen_gang, TRUE)
/proc/spawn_pirates(datum/comm_message/threat, datum/pirate_gang/chosen_gang, skip_answer_check)
if(!skip_answer_check && threat?.answered == 1)
var/datum/bank_account/plundered_account = SSeconomy.get_dep_account(ACCOUNT_CAR)
if(plundered_account)
if(plundered_account.adjust_money(-payoff))
chosen_gang.paid_off = TRUE
priority_announce(chosen_gang.response_received, sender_override = chosen_gang.ship_name)
else
priority_announce(chosen_gang.response_not_enough, sender_override = chosen_gang.ship_name)
/proc/spawn_pirates(datum/comm_message/threat, datum/pirate_gang/chosen_gang)
if(chosen_gang.paid_off)
return
var/list/candidates = poll_ghost_candidates("Do you wish to be considered for pirate crew?", ROLE_TRAITOR)
@@ -45,6 +45,9 @@ GLOBAL_LIST_INIT(heavy_pirate_gangs, init_pirate_gangs(is_heavy = TRUE))
///station pays the pirates... but doesn't have enough cash.
var/response_not_enough = "Not enough Bungopoints have been added into my bank account, rebooting world..."
/// Have the pirates been paid off?
var/paid_off = FALSE
/datum/pirate_gang/New()
. = ..()
ship_name = pick(strings(PIRATE_NAMES_FILE, ship_name_pool))