mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 19:17:50 +01:00
Merge pull request #9061 from Anasari/TGRefundPort
Port over Fox's refactored syndicate item refund from TG.
This commit is contained in:
+11
-14
@@ -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
|
||||
|
||||
|
||||
@@ -415,6 +415,9 @@
|
||||
failure_message = "<B>...ERROR. BOOT SEQUENCE ABORTED. AI FAILED TO INTIALIZE. PLEASE CONTACT SUPPORT OR TRY AGAIN LATER.</B>"
|
||||
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
|
||||
|
||||
|
||||
@@ -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 += "<I>Each item costs a number of telecrystals as indicated by the number following its name.</I><br>"
|
||||
|
||||
var/category_items = 1
|
||||
for(var/category in ItemsCategory)
|
||||
for(var/category in uplink_items)
|
||||
if(category_items < 1)
|
||||
dat += "<i>We apologize, as you could not afford anything from this category.</i><br>"
|
||||
dat += "<br>"
|
||||
dat += "<b>[category]</b><br>"
|
||||
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, "<span class='notice'>[I] refunded.</span>")
|
||||
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, "<span class='notice'>Teleporter refunded.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>This teleporter is already used, or is currently being used.</span>")
|
||||
|
||||
// PRESET UPLINKS
|
||||
// A collection of preset uplinks.
|
||||
//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
spawn_antag(C, get_turf(src.loc), "syndieborg")
|
||||
else
|
||||
checking = FALSE
|
||||
to_chat(user, "<span class='notice'>Unable to connect to Syndicate command. Please wait and try again later or use the teleporter on your uplink to get your points refunded.</span>")
|
||||
to_chat(user, "<span class='notice'>Unable to connect to Syndicate command. Please wait and try again later or refund your teleporter through your uplink.</span>")
|
||||
return
|
||||
|
||||
/obj/item/antag_spawner/borg_tele/spawn_antag(client/C, turf/T, type = "")
|
||||
|
||||
Reference in New Issue
Block a user