From b4bac5d681ff794a89ea9eb44da5c93be6bdf669 Mon Sep 17 00:00:00 2001 From: DGamerL <108773801+DGamerL@users.noreply.github.com> Date: Sat, 29 Jun 2024 20:06:48 +0200 Subject: [PATCH] Holoparasites are now discountable (#25943) * Discount the parasite! * Fix testing values * More testing values gone * Carp scroll not discountable again --- code/datums/uplink_items/uplink_general.dm | 8 ++-- code/datums/uplink_items/uplink_traitor.dm | 10 ++++- .../gamemodes/miniantags/guardian/guardian.dm | 17 +++++++++ code/game/objects/items/devices/uplinks.dm | 37 ++++++++++++------- 4 files changed, 53 insertions(+), 19 deletions(-) diff --git a/code/datums/uplink_items/uplink_general.dm b/code/datums/uplink_items/uplink_general.dm index 68d4ef1c05e..34dd1e34dd0 100644 --- a/code/datums/uplink_items/uplink_general.dm +++ b/code/datums/uplink_items/uplink_general.dm @@ -30,13 +30,11 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) var/datum/uplink_item/A = new I.type var/discount = 0.5 A.limited_stock = 1 - I.refundable = FALSE - A.refundable = FALSE if(A.cost >= 100) discount *= 0.5 // If the item costs 100TC or more, it's only 25% off. - A.cost = max(round(A.cost * (1-discount)),1) + A.cost = max(round(A.cost * (1 - discount)), 1) A.category = "Discounted Gear" - A.name += " ([round(((initial(A.cost)-A.cost)/initial(A.cost))*100)]% off!)" + A.name += " ([round(((initial(A.cost) - A.cost) / initial(A.cost)) * 100)]% off!)" A.job = null // If you get a job specific item selected, actually lets you buy it in the discount section A.species = null //same as above for species speific items A.reference = "DIS[newreference]" @@ -106,6 +104,8 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) if(item && !uses_special_spawn) return new item(loc) + if(limited_stock) + limited_stock -= 1 // In case we are handling discount items differently return UPLINK_SPECIAL_SPAWNING /datum/uplink_item/proc/description() diff --git a/code/datums/uplink_items/uplink_traitor.dm b/code/datums/uplink_items/uplink_traitor.dm index 55f955aa3f5..8fd1bbd7101 100644 --- a/code/datums/uplink_items/uplink_traitor.dm +++ b/code/datums/uplink_items/uplink_traitor.dm @@ -424,13 +424,19 @@ reference = "HPA" 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. \ The holoparasites are unable to incoporate themselves to changeling and vampire agents." - item = /obj/item/storage/box/syndie_kit/guardian + item = /obj/item/storage/box/syndie_kit/guardian/uplink excludefrom = list(UPLINK_TYPE_NUCLEAR, UPLINK_TYPE_SST) cost = 60 refund_path = /obj/item/guardiancreator/tech/choose refundable = TRUE surplus = 0 // This being refundable makes this a big no no in my mind. - can_discount = FALSE + uses_special_spawn = TRUE + +/datum/uplink_item/dangerous/guardian/spawn_item(turf/loc, obj/item/uplink/U) + if(..() != UPLINK_SPECIAL_SPAWNING) + return FALSE + + new /obj/item/storage/box/syndie_kit/guardian/uplink(loc, cost) /datum/uplink_item/stealthy_weapons/martialarts name = "Martial Arts Scroll" diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 35bd921e8a2..74178fef983 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -412,6 +412,10 @@ "Lilac" = "#C7A0F6", "Orchid" = "#F62CF5") name_list = list("Gallium", "Indium", "Thallium", "Bismuth", "Aluminium", "Mercury", "Iron", "Silver", "Zinc", "Titanium", "Chromium", "Nickel", "Platinum", "Tellurium", "Palladium", "Rhodium", "Cobalt", "Osmium", "Tungsten", "Iridium") + /// How much do we refund this for? + var/refund_cost = 0 + /// Is this discounted? + var/is_discounted = FALSE /obj/item/guardiancreator/tech/create_theme(mob/living/simple_animal/hostile/guardian/G, mob/living/user, picked_name, color) G.name = "[picked_name] [color]" @@ -500,3 +504,16 @@ /obj/item/storage/box/syndie_kit/guardian/populate_contents() new /obj/item/guardiancreator/tech/choose(src) new /obj/item/paper/guardian(src) + +/obj/item/storage/box/syndie_kit/guardian/uplink + var/holopara_cost = 60 + +/obj/item/storage/box/syndie_kit/guardian/uplink/Initialize(mapload, new_cost) + . = ..() + var/obj/item/guardiancreator/tech/choose/holopara = new(src) + if(holopara_cost != new_cost) + holopara.is_discounted = TRUE + holopara.refund_cost = new_cost + +/obj/item/storage/box/syndie_kit/guardian/uplink/populate_contents() + new /obj/item/paper/guardian(src) diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index 7cdd7ebbdf2..15cc43d49da 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -129,20 +129,31 @@ GLOBAL_LIST_EMPTY(world_uplinks) /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 - // If we are here, we didnt refund + if(!I) // Make sure there's actually something in the hand before even bothering to check to_chat(user, "[I] is not refundable.") + return + + 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(ispath(I.type, path) && UI.refundable && I.check_uplink_validity()) + var/refund_amount = cost + if(istype(I, /obj/item/guardiancreator/tech)) + var/obj/item/guardiancreator/tech/holopara = I + if(holopara.is_discounted && cost != holopara.refund_cost) // This has to be done because the normal holopara uplink datum precedes the discounted uplink datum + continue + refund_amount = holopara.refund_cost + uses += refund_amount + used_TC -= refund_amount + to_chat(user, "[I] refunded.") + qdel(I) + return + + // If we are here, we didnt refund + to_chat(user, "[I] is not refundable.") // 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!