diff --git a/code/datums/uplink_item.dm b/code/datums/uplink_item.dm index 952711f3063..628b6a583f0 100644 --- a/code/datums/uplink_item.dm +++ b/code/datums/uplink_item.dm @@ -1,16 +1,13 @@ -var/list/uplink_items = list() +GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) /proc/get_uplink_items(var/job = null) - // If not already initialized.. + var/list/uplink_items = list() if(!uplink_items.len) - // Fill in the list and order it like this: - // A keyed list, acting as categories, which are lists to the datum. - var/list/last = list() - for(var/item in typesof(/datum/uplink_item)) + for(var/path in GLOB.uplink_items) - var/datum/uplink_item/I = new item() + var/datum/uplink_item/I = new path if(!I.item) continue if(I.gamemodes.len && ticker && !(ticker.mode.type in I.gamemodes)) @@ -55,6 +52,9 @@ var/list/uplink_items = list() var/list/job = null var/surplus = 100 //Chance of being included in the surplus crate (when pick() selects it) var/hijack_only = FALSE //can this item be purchased only during hijackings? + var/refundable = FALSE + var/refund_path = null // Alternative path for refunds, in case the item purchased isn't what is actually refunded (ie: holoparasites). + var/refund_amount // specified refund amount in case there needs to be a TC penalty for refunds. /datum/uplink_item/proc/spawn_item(var/turf/loc, var/obj/item/uplink/U) if(hijack_only) @@ -540,9 +540,11 @@ var/list/uplink_items = list() desc = "A cyborg designed and programmed for systematic extermination of non-Syndicate personnel." reference = "SC" item = /obj/item/antag_spawner/borg_tele + refund_path = /obj/item/antag_spawner/borg_tele cost = 50 gamemodes = list(/datum/game_mode/nuclear) surplus = 0 + refundable = TRUE /datum/uplink_item/dangerous/foamsmg name = "Toy Submachine Gun" @@ -571,19 +573,14 @@ var/list/uplink_items = list() gamemodes = list(/datum/game_mode/nuclear) surplus = 0 - -//for refunding the syndieborg teleporter -/datum/uplink_item/dangerous/syndieborg/spawn_item() - var/obj/item/antag_spawner/borg_tele/T = ..() - if(istype(T)) - T.TC_cost = cost - /datum/uplink_item/dangerous/guardian name = "Holoparasites" desc = "Though capable of near sorcerous feats via use of hardlight holograms and nanomachines, they require an organic host as a home base and source of fuel." item = /obj/item/storage/box/syndie_kit/guardian excludefrom = list(/datum/game_mode/nuclear) cost = 12 + refund_path = /obj/item/guardiancreator/tech/choose + refundable = TRUE // Ammunition diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 68e8c16c5da..ab3af13e98d 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -415,6 +415,9 @@ failure_message = "...ERROR. BOOT SEQUENCE ABORTED. AI FAILED TO INTIALIZE. PLEASE CONTACT SUPPORT OR TRY AGAIN LATER." ling_failure = "The holoparasites recoil in horror. They want nothing to do with a creature like you." +/obj/item/guardiancreator/tech/check_uplink_validity() + return !used + /obj/item/guardiancreator/tech/choose random = FALSE diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index cc3320489f6..1c3124a74cb 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -12,7 +12,7 @@ var/list/world_uplinks = list() var/welcome // Welcoming menu message var/uses // Numbers of crystals var/hidden_crystals = 0 - var/list/ItemsCategory // List of categories with lists of items + var/list/uplink_items // List of categories with lists of items var/list/ItemsReference // List of references with an associated item var/list/nanoui_items // List of items for NanoUI use var/nanoui_menu = 0 // The current menu we are in @@ -32,7 +32,7 @@ var/list/world_uplinks = list() ..() welcome = ticker.mode.uplink_welcome uses = ticker.mode.uplink_uses - ItemsCategory = get_uplink_items() + uplink_items = get_uplink_items() world_uplinks += src @@ -57,14 +57,14 @@ var/list/world_uplinks = list() dat += "Each item costs a number of telecrystals as indicated by the number following its name.
" var/category_items = 1 - for(var/category in ItemsCategory) + for(var/category in uplink_items) if(category_items < 1) dat += "We apologize, as you could not afford anything from this category.
" dat += "
" dat += "[category]
" category_items = 0 - for(var/datum/uplink_item/I in ItemsCategory[category]) + for(var/datum/uplink_item/I in uplink_items[category]) if(I.cost > uses) continue if(I.job && I.job.len) @@ -87,9 +87,9 @@ var/list/world_uplinks = list() var/list/nano = new var/list/reference = new - for(var/category in ItemsCategory) + for(var/category in uplink_items) nano[++nano.len] = list("Category" = category, "items" = list()) - for(var/datum/uplink_item/I in ItemsCategory[category]) + for(var/datum/uplink_item/I in uplink_items[category]) if(I.job && I.job.len) if(!(I.job.Find(job))) continue @@ -117,6 +117,9 @@ var/list/world_uplinks = list() if(..()) return 1 + if(href_list["refund"]) + refund(usr) + if(href_list["buy_item"] == "random") var/datum/uplink_item/UI = chooseRandomItem() href_list["buy_item"] = UI.reference @@ -142,6 +145,22 @@ var/list/world_uplinks = list() return 1 +/obj/item/uplink/proc/refund(mob/user as mob) + var/obj/item/I = user.get_active_hand() + if(I) // Make sure there's actually something in the hand before even bothering to check + for(var/category in uplink_items) + for(var/item in uplink_items[category]) + var/datum/uplink_item/UI = item + var/path = UI.refund_path || UI.item + var/cost = UI.refund_amount || UI.cost + if(I.type == path && UI.refundable && I.check_uplink_validity()) + uses += cost + used_TC -= cost + to_chat(user, "[I] refunded.") + qdel(I) + return + ..() + // HIDDEN UPLINK - Can be stored in anything but the host item has to have a trigger for it. /* How to create an uplink in 3 easy steps! @@ -287,17 +306,6 @@ var/list/world_uplinks = list() return 1 return 0 -//Refund proc for the borg teleporter (later I'll make a general refund proc if there is demand for it) -/obj/item/radio/uplink/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/antag_spawner/borg_tele)) - var/obj/item/antag_spawner/borg_tele/S = W - if(!S.used && !S.checking) - hidden_uplink.uses += S.TC_cost - qdel(S) - to_chat(user, "Teleporter refunded.") - else - to_chat(user, "This teleporter is already used, or is currently being used.") - // PRESET UPLINKS // A collection of preset uplinks. // diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 6c7094fbe9f..29d3f2663bc 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -303,3 +303,6 @@ a { .["Make speed process"] = "?_src_=vars;makespeedy=[UID()]" else .["Make normal process"] = "?_src_=vars;makenormalspeed=[UID()]" + +/obj/proc/check_uplink_validity() + return 1 diff --git a/code/modules/antagonists/_common/antag_spawner.dm b/code/modules/antagonists/_common/antag_spawner.dm index c81f30efc83..ecf8c336118 100644 --- a/code/modules/antagonists/_common/antag_spawner.dm +++ b/code/modules/antagonists/_common/antag_spawner.dm @@ -45,7 +45,7 @@ spawn_antag(C, get_turf(src.loc), "syndieborg") else checking = FALSE - to_chat(user, "Unable to connect to Syndicate command. Please wait and try again later or use the teleporter on your uplink to get your points refunded.") + to_chat(user, "Unable to connect to Syndicate command. Please wait and try again later or refund your teleporter through your uplink.") return /obj/item/antag_spawner/borg_tele/spawn_antag(client/C, turf/T, type = "") diff --git a/nano/templates/uplink.tmpl b/nano/templates/uplink.tmpl index d6dcec8d05f..6177ab016a7 100644 --- a/nano/templates/uplink.tmpl +++ b/nano/templates/uplink.tmpl @@ -1,5 +1,5 @@ - @@ -40,7 +40,7 @@ Used In File(s): \code\game\objects\items\devices\uplinks.dm
{{:helper.link( itemValue.Name, 'gear', {'buy_item' : itemValue.obj_path, 'cost' : itemValue.Cost}, itemValue.Cost > data.crystals ? 'disabled' : null, null)}} - {{:itemValue.Cost}}
- + {{if itemValue.Cost <= data.crystals && data.descriptions}}
{{:itemValue.Description}} @@ -53,7 +53,11 @@ Used In File(s): \code\game\objects\items\devices\uplinks.dm
{{:helper.link('Buy Random (??)' , 'gear', {'buy_item' : 'random'}, data.crystals <= 0 ? 'disabled' : null, null)}}
- + +
+ {{:helper.link('Refund item in active hand' , 'gear', {refund : 1}, null, null)}} +
+ {{else data.menu == 1}}

Information Record List:


@@ -66,7 +70,7 @@ Used In File(s): \code\game\objects\items\devices\uplinks.dm {{:helper.link(value.Name, 'gear', {'menu' : 11, 'id' : value.id}, null, null)}}
{{/for}} - + {{else data.menu == 11}}

Information Record: