Fixes a runtime which bricked the pad plus fixing sprites. Also ports https://github.com/tgstation/tgstation/pull/55533 credit to cacogen.

This commit is contained in:
shellspeed1
2022-09-20 16:57:49 -07:00
parent e3a3462b85
commit 44536ad7ab
3 changed files with 24 additions and 11 deletions
+15 -5
View File
@@ -1,3 +1,5 @@
#define CIV_BOUNTY_SPLIT 30
///Pad for the Civilian Bounty Control.
/obj/machinery/piratepad/civilian
name = "civilian bounty pad"
@@ -97,7 +99,11 @@
SSeconomy.civ_bounty_tracker++
var/obj/item/bounty_cube/reward = new /obj/item/bounty_cube(drop_location())
reward.bounty_value = curr_bounty.reward
reward.AddComponent(/datum/component/pricetag, inserted_scan_id.registered_account, 10)
reward.bounty_name = curr_bounty.name
reward.bounty_holder = inserted_scan_id.registered_name
reward.name = "\improper [reward.bounty_value] cr [reward.name]"
reward.desc += " The tag indicates it was [reward.bounty_holder]'s reward for completing the <i>[reward.bounty_name]</i> bounty and that it was created at [station_time_timestamp(format = "hh:mm")]."
reward.AddComponent(/datum/component/pricetag, inserted_scan_id.registered_account, CIV_BOUNTY_SPLIT)
pad.visible_message("<span class='notice'>[pad] activates!</span>")
flick(pad.sending_state,pad)
pad.icon_state = pad.idle_state
@@ -151,15 +157,15 @@
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
data["id_bounty_value"] = (inserted_scan_id.registered_account.civilian_bounty.reward) * (CIV_BOUNTY_SPLIT/100)
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)
data["id_bounty_values"] = list(inserted_scan_id.registered_account.bounties[1].reward * (CIV_BOUNTY_SPLIT/100),
inserted_scan_id.registered_account.bounties[2].reward * (CIV_BOUNTY_SPLIT/100),
inserted_scan_id.registered_account.bounties[3].reward * (CIV_BOUNTY_SPLIT/100))
else
data["picking"] = FALSE
return data
@@ -235,6 +241,10 @@
icon_state = "bounty_cube"
///Value of the bounty that this bounty cube sells for.
var/bounty_value = 0
///Who completed the bounty.
var/bounty_holder
///What the bounty was for.
var/bounty_name
///Beacon to launch a new bounty setup when activated.
+9 -6
View File
@@ -251,8 +251,8 @@
/obj/machinery/piratepad
name = "cargo hold pad"
icon = 'icons/obj/telescience.dmi'
icon_state = "lpad-idle-o"
var/idle_state = "lpad-idle-o"
icon_state = "lpad-idle-off"
var/idle_state = "lpad-idle"
var/warmup_state = "lpad-idle"
var/sending_state = "lpad-beam"
var/cargo_hold_id
@@ -296,7 +296,7 @@
. = ..()
if (istype(I) && istype(I.buffer,/obj/machinery/piratepad))
to_chat(user, "<span class='notice'>You link [src] with [I.buffer] in [I] buffer.</span>")
pad = I.buffer
pad_ref = WEAKREF(I.buffer)
return TRUE
/obj/machinery/computer/piratepad_control/LateInitialize()
@@ -304,10 +304,11 @@
if(cargo_hold_id)
for(var/obj/machinery/piratepad/P in GLOB.machines)
if(P.cargo_hold_id == cargo_hold_id)
pad = P
pad_ref = WEAKREF(P)
return
else
pad = locate() in range(4,src)
pad_ref = WEAKREF(pad)
/obj/machinery/computer/piratepad_control/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
@@ -318,7 +319,7 @@
/obj/machinery/computer/piratepad_control/ui_data(mob/user)
var/list/data = list()
data["points"] = points
data["pad"] = pad ? TRUE : FALSE
data["pad"] = pad_ref?.resolve() ? TRUE : FALSE
data["sending"] = sending
data["status_report"] = status_report
return data
@@ -327,7 +328,7 @@
. = ..()
if(.)
return
if(!pad)
if(!pad_ref?.resolve())
return
switch(action)
@@ -348,6 +349,7 @@
status_report = "Predicted value: "
var/value = 0
var/datum/export_report/ex = new
var/obj/machinery/piratepad/pad = pad_ref?.resolve()
for(var/atom/movable/AM in get_turf(pad))
if(AM == pad)
continue
@@ -366,6 +368,7 @@
return
var/datum/export_report/ex = new
var/obj/machinery/piratepad/pad = pad_ref?.resolve()
for(var/atom/movable/AM in get_turf(pad))
if(AM == pad)