Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

donation alerts #6206

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion code/game/machinery/computer/camera_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,50 @@

/obj/structure/machinery/computer/cameras/wooden_tv/broadcast
name = "Television Set"
desc = "An old TV hooked up to a video cassette recorder, you can even use it to time shift WOW."
desc = "An old TV hooked up to a video cassette recorder, which has been modified to function as... money slot?"
network = list(CAMERA_NET_CORRESPONDENT)
stay_connected = TRUE
circuit = /obj/item/circuitboard/computer/cameras/tv
var/obj/item/device/camera/broadcasting/broadcastingcamera = null

/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/attackby(obj/item/I, mob/user)
if(!broadcastingcamera)
return

if(istype(I, /obj/item/spacecash))
var/obj/item/spacecash/spacecash = I
if(spacecash.counterfeit)
return


if(!broadcastingcamera.donationsaccount)
to_chat(user, SPAN_WARNING("Streamer is not accepting donations at this time."))
return

var/message = "Thanks for your donation!"
if(spacecash.worth >= 10)
message = tgui_input_text(user, "What would you like to message the streamer? (48 Characters MAX)", "Message", max_length = 48)

var/nickname = tgui_input_text(user, "What would you like your displayed name to be? (20 Characters MAX)", "Name", max_length = 20)

broadcastingcamera.donationsaccount.money += spacecash.worth
if(ishuman(broadcastingcamera.loc))
var/mob/living/carbon/human/streamer = broadcastingcamera.loc
streamer.play_screen_text("<span class='langchat' style=font-size:16pt;text-align:center valign='top'><u>You've received a new donation of [spacecash.worth]$ from [nickname]!</u></span><br>" + message, /atom/movable/screen/text/screen_text/command_order, pick("#FF0000", "#008000", "#C71585", "#0000FF"))
broadcastingcamera.latestmessage = "[nickname], [spacecash.worth]$, \"[message]\""
playsound(broadcastingcamera, 'sound/machines/ping.ogg', 25)

var/datum/transaction/T = new()
T.target_name = broadcastingcamera.donationsaccount.owner_name
T.purpose = "Donation"
T.amount = spacecash:worth
T.date = GLOB.current_date_string
T.time = worldtime2text()
broadcastingcamera.donationsaccount.transaction_log.Add(T)
qdel(spacecash)

..()

/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/Destroy()
broadcastingcamera = null
return ..()
Expand Down
16 changes: 16 additions & 0 deletions code/modules/paperwork/photography.dm
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,22 @@
w_class = SIZE_HUGE
flags_equip_slot = NO_FLAGS //cannot be equiped
var/obj/structure/machinery/camera/correspondent/linked_cam
var/datum/money_account/donationsaccount
var/latestmessage

/obj/item/device/camera/broadcasting/get_examine_text(mob/user)
. = ..()
. += "Linked account: [donationsaccount ? "[donationsaccount.account_number]" : "None, swipe your ID-card to link it"]."
if(latestmessage)
. += "Latest donation: [latestmessage]"

/obj/item/device/camera/broadcasting/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/card/id))
var/obj/item/card/id/id = I
if(!id.associated_account_number)
return
donationsaccount = get_account(id.associated_account_number)
to_chat(user, SPAN_NOTICE("Account linked for donations!"))

/obj/item/device/camera/broadcasting/Initialize(mapload, ...)
. = ..()
Expand Down
Loading