Files
Bubberstation/code/modules/cargo/bounty_console.dm
Rob Bailey 2029163d33 playsound vary boolean define conversion (#46254)
About The Pull Request

Converts every single usage of playsound's vary parameter to use the boolean define instead of 1 or 0. I'm tired of people copypasting the incorrect usage.
Also changes a couple of places where a list was picked from instead of using get_sfx internal calls

This was done via regex:
(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\)) to match 1
(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\)) to match 0
full sed commands:
/(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\))/\1TRUE\2/ 1 to TRUE
/(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\))/\1FALSE\2/ 0 to FALSE

I'm not very good with regex and these could probably be optimized, but they worked.
Why It's Good For The Game

Code usability
2019-08-30 18:45:20 +12:00

97 lines
2.9 KiB
Plaintext

#define PRINTER_TIMEOUT 10
/obj/machinery/computer/bounty
name = "Nanotrasen bounty console"
desc = "Used to check and claim bounties offered by Nanotrasen"
icon_screen = "bounty"
circuit = /obj/item/circuitboard/computer/bounty
light_color = "#E2853D"//orange
var/printer_ready = 0 //cooldown var
/obj/machinery/computer/bounty/Initialize()
. = ..()
printer_ready = world.time + PRINTER_TIMEOUT
/obj/machinery/computer/bounty/proc/print_paper()
new /obj/item/paper/bounty_printout(loc)
/obj/item/paper/bounty_printout
name = "paper - Bounties"
/obj/item/paper/bounty_printout/Initialize()
. = ..()
info = "<h2>Nanotrasen Cargo Bounties</h2></br>"
update_icon()
for(var/datum/bounty/B in GLOB.bounties_list)
if(B.claimed)
continue
info += {"<h3>[B.name]</h3>
<ul><li>Reward: [B.reward_string()]</li>
<li>Completed: [B.completion_string()]</li></ul>"}
/obj/machinery/computer/bounty/ui_interact(mob/user)
. = ..()
if(!GLOB.bounties_list.len)
setup_bounties()
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR)
var/list/dat = list({"<a href='?src=[REF(src)];refresh=1'>Refresh</a>
<a href='?src=[REF(src)];refresh=1;choice=Print'>Print Paper</a>
<p>Credits: <b>[D.account_balance]</b></p>
<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr><th>Name</th><th>Description</th><th>Reward</th><th>Completion</th><th>Status</th></tr>"})
for(var/datum/bounty/B in GLOB.bounties_list)
if(B.claimed)
dat += "<tr style='background-color:#294675;'>"
else if(B.can_claim())
dat += "<tr style='background-color:#4F7529;'>"
else
dat += "<tr style='background-color:#990000;'>"
if(B.high_priority)
dat += {"<td><b>[B.name]</b></td>
<td><b>High Priority:</b> [B.description]</td>
<td><b>[B.reward_string()]</b></td>"}
else
dat += {"<td>[B.name]</td>
<td>[B.description]</td>
<td>[B.reward_string()]</td>"}
dat += "<td>[B.completion_string()]</td>"
if(B.claimed)
dat += "<td>Claimed</td>"
else if(B.can_claim())
dat += "<td><A href='?src=[REF(src)];refresh=1;choice=Claim;d_rec=[REF(B)]'>Claim</a></td>"
else
dat += "<td>Unclaimed</td>"
dat += "</tr>"
dat += "</table>"
dat = dat.Join()
var/datum/browser/popup = new(user, "bounties", "Nanotrasen Bounties", 700, 600)
popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
/obj/machinery/computer/bounty/Topic(href, href_list)
if(..())
return
switch(href_list["choice"])
if("Print")
if(printer_ready < world.time)
printer_ready = world.time + PRINTER_TIMEOUT
print_paper()
if("Claim")
var/datum/bounty/B = locate(href_list["d_rec"]) in GLOB.bounties_list
if(B)
B.claim()
if(href_list["refresh"])
playsound(src, "terminal_type", 25, FALSE)
updateUsrDialog()