port of https://github.com/tgstation/tgstation/pull/55762, credit to ArcaneMusic.
This commit is contained in:
@@ -104,6 +104,32 @@
|
||||
playsound(loc, 'sound/machines/synth_yes.ogg', 30 , TRUE)
|
||||
sending = FALSE
|
||||
|
||||
///Here is where cargo bounties are added to the player's bank accounts, then adjusted and scaled into a civilian bounty.
|
||||
/obj/machinery/computer/piratepad_control/civilian/proc/add_bounties()
|
||||
if(!inserted_scan_id || !inserted_scan_id.registered_account)
|
||||
return
|
||||
var/datum/bank_account/pot_acc = inserted_scan_id.registered_account
|
||||
if(pot_acc.civilian_bounty && ((world.time) < pot_acc.bounty_timer + 5 MINUTES))
|
||||
var/curr_time = round(((pot_acc.bounty_timer + (5 MINUTES))-world.time)/ (1 MINUTES), 0.01)
|
||||
to_chat(usr, "<span class='warning'>Internal ID network spools coiling, try again in [curr_time] minutes!</span>")
|
||||
return FALSE
|
||||
if(!pot_acc.account_job)
|
||||
to_chat(usr, "<span class='warning'>The console smartly rejects your ID card, as it lacks a job assignment!</span>")
|
||||
return FALSE
|
||||
var/list/datum/bounty/crumbs = list(random_bounty(pot_acc.account_job.bounty_types), // We want to offer 2 bounties from their appropriate job catagories
|
||||
random_bounty(pot_acc.account_job.bounty_types), // and 1 guarenteed assistant bounty if the other 2 suck.
|
||||
random_bounty(CIV_JOB_BASIC))
|
||||
pot_acc.bounty_timer = world.time
|
||||
pot_acc.bounties = crumbs
|
||||
|
||||
/obj/machinery/computer/piratepad_control/civilian/proc/pick_bounty(choice)
|
||||
if(inserted_scan_id?.registered_account)
|
||||
playsound(loc, 'sound/machines/synth_no.ogg', 40 , TRUE)
|
||||
return
|
||||
inserted_scan_id.registered_account.civilian_bounty = inserted_scan_id.registered_account.bounties[choice]
|
||||
inserted_scan_id.registered_account.bounties = null
|
||||
return inserted_scan_id.registered_account.civilian_bounty
|
||||
|
||||
/obj/machinery/computer/piratepad_control/civilian/AltClick(mob/user)
|
||||
. = ..()
|
||||
id_eject(user, inserted_scan_id)
|
||||
@@ -122,9 +148,20 @@
|
||||
data["status_report"] = status_report
|
||||
data["id_inserted"] = inserted_scan_id
|
||||
if(inserted_scan_id && inserted_scan_id.registered_account)
|
||||
data["id_bounty_info"] = inserted_scan_id.registered_account.bounty_text()
|
||||
data["id_bounty_num"] = inserted_scan_id.registered_account.bounty_num()
|
||||
data["id_bounty_value"] = inserted_scan_id.registered_account.bounty_value()
|
||||
if(inserted_scan_id.registered_account.civilian_bounty)
|
||||
data["id_bounty_info"] = inserted_scan_id.registered_account.civilian_bounty.description
|
||||
data["id_bounty_num"] = inserted_scan_id.registered_account.bounty_num()
|
||||
data["id_bounty_value"] = inserted_scan_id.registered_account.civilian_bounty.reward
|
||||
if(inserted_scan_id.registered_account.bounties)
|
||||
data["picking"] = TRUE
|
||||
data["id_bounty_names"] = list(inserted_scan_id.registered_account.bounties[1].name,
|
||||
inserted_scan_id.registered_account.bounties[2].name,
|
||||
inserted_scan_id.registered_account.bounties[3].name)
|
||||
data["id_bounty_values"] = list(inserted_scan_id.registered_account.bounties[1].reward,
|
||||
inserted_scan_id.registered_account.bounties[2].reward,
|
||||
inserted_scan_id.registered_account.bounties[3].reward)
|
||||
else
|
||||
data["picking"] = FALSE
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/piratepad_control/civilian/ui_act(action, params)
|
||||
@@ -141,19 +178,13 @@
|
||||
start_sending()
|
||||
if("stop")
|
||||
stop_sending()
|
||||
if("pick")
|
||||
pick_bounty(params["value"])
|
||||
if("bounty")
|
||||
if(!inserted_scan_id || !inserted_scan_id.registered_account)
|
||||
return
|
||||
var/datum/bank_account/pot_acc = inserted_scan_id.registered_account
|
||||
if(pot_acc.civilian_bounty && ((world.time) < pot_acc.bounty_timer + 5 MINUTES))
|
||||
var/curr_time = round(((pot_acc.bounty_timer + (5 MINUTES))-world.time)/ (1 MINUTES), 0.01)
|
||||
to_chat(usr, "<span class='warning'>You already have an incomplete civilian bounty, try again in [curr_time] minutes to replace it!</span>")
|
||||
return FALSE
|
||||
var/datum/bounty/crumbs = random_bounty(pot_acc.account_job.bounty_types)
|
||||
COOLDOWN_START(pot_acc, bounty_timer, 5 MINUTES)
|
||||
pot_acc.civilian_bounty = crumbs
|
||||
add_bounties()
|
||||
if("eject")
|
||||
id_eject(usr, inserted_scan_id)
|
||||
inserted_scan_id = null
|
||||
. = TRUE
|
||||
|
||||
///Self explanitory, holds the ID card inthe console for bounty payout and manipulation.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
var/being_dumped = FALSE //pink levels are rising
|
||||
var/withdrawDelay = 0
|
||||
var/datum/bounty/civilian_bounty
|
||||
var/list/datum/bounty/bounties
|
||||
COOLDOWN_DECLARE(bounty_timer)
|
||||
|
||||
/datum/bank_account/New(newname, job)
|
||||
|
||||
@@ -264,12 +264,12 @@
|
||||
I.buffer = src
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/piratepad/screwdriver_act_secondary(mob/living/user, obj/item/screwdriver/screw)
|
||||
/obj/machinery/piratepad/screwdriver_act(mob/living/user, obj/item/screwdriver/screw)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return default_deconstruction_screwdriver(user, "lpad-idle-open", "lpad-idle-off", screw)
|
||||
|
||||
/obj/machinery/piratepad/crowbar_act_secondary(mob/living/user, obj/item/tool)
|
||||
/obj/machinery/piratepad/crowbar_act(mob/living/user, obj/item/tool)
|
||||
. = ..()
|
||||
default_deconstruction_crowbar(tool)
|
||||
return TRUE
|
||||
@@ -285,6 +285,8 @@
|
||||
var/datum/export_report/total_report
|
||||
var/sending_timer
|
||||
var/cargo_hold_id
|
||||
///Reference to the specific pad that the control computer is linked up to.
|
||||
var/datum/weakref/pad_ref
|
||||
|
||||
/obj/machinery/computer/piratepad_control/Initialize(mapload)
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user