diff --git a/code/datums/uplink_item.dm b/code/datums/uplink_item.dm index 750f7bfd70c..61e69b6d7d9 100644 --- a/code/datums/uplink_item.dm +++ b/code/datums/uplink_item.dm @@ -55,6 +55,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) @@ -97,6 +100,7 @@ var/list/uplink_items = list() if(I) if(ishuman(user)) var/mob/living/carbon/human/A = user + log_game("[key_name(user)] purchased [I.name]") A.put_in_any_hand_if_possible(I) if(istype(I,/obj/item/storage/box/) && I.contents.len>0) @@ -527,6 +531,7 @@ var/list/uplink_items = list() cost = 50 gamemodes = list(/datum/game_mode/nuclear) surplus = 0 + refundable = TRUE /datum/uplink_item/dangerous/foamsmg name = "Toy Submachine Gun" @@ -555,19 +560,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 f76830910b1..de015cfa099 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 2d40c1e683c..3e11d63b7af 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -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,30 @@ 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/item in subtypesof(/datum/uplink_item)) + var/datum/uplink_item/UI = item + var/path = null + if(initial(UI.refund_path)) + path = initial(UI.refund_path) + else + path = initial(UI.item) + var/cost = 0 + if(initial(UI.refund_amount)) + cost = initial(UI.refund_amount) + else + cost = initial(UI.cost) + var/refundable = initial(UI.refundable) + if(I.type == path && 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 +314,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 fe9e8444378..49e043b4159 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -282,3 +282,6 @@ a { /obj/vv_get_dropdown() . = ..() .["Delete all of type"] = "?_src_=vars;delall=[UID()]" + +/obj/proc/check_uplink_validity() + return 1 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: