diff --git a/code/__DEFINES/skills.dm b/code/__DEFINES/skills.dm index 5dabb4545a32..d33e26c1c3f6 100644 --- a/code/__DEFINES/skills.dm +++ b/code/__DEFINES/skills.dm @@ -42,6 +42,8 @@ #define SKILL_SPEC_DEFAULT 0 /// Is trained to use specialist gear, but hasn't picked a kit. #define SKILL_SPEC_TRAINED 1 +/// Is trained to use specialist gear & HAS picked a kit. (Functionally same as SPEC_ROCKET) +#define SKILL_SPEC_KITTED 2 /// Can use RPG #define SKILL_SPEC_ROCKET 2 /// Can use thermal cloaks and custom M4RA rifle diff --git a/code/__DEFINES/vendors.dm b/code/__DEFINES/vendors.dm index 04ee5ffef2b6..c6030e4e97f8 100644 --- a/code/__DEFINES/vendors.dm +++ b/code/__DEFINES/vendors.dm @@ -67,3 +67,10 @@ //Whether or not to load ammo boxes depending on ammo loaded into the vendor //Only relevant in big vendors, like Requisitions or Squad Prep #define VEND_LOAD_AMMO_BOXES (1<<9) + +// Redemption Tokens +#define TOKEN_ENGINEER "Engineer" +#define TOKEN_SPEC "Specialist" +#define TOKEN_SYNTH "Synthetic" +/// Token invalid/unrecognised. +#define TOKEN_VOID "Void" diff --git a/code/datums/supply_packs/operations.dm b/code/datums/supply_packs/operations.dm index 6d5e5d14756c..dcc270cb00a1 100644 --- a/code/datums/supply_packs/operations.dm +++ b/code/datums/supply_packs/operations.dm @@ -112,10 +112,10 @@ /datum/supply_packs/spec_kits name = "Weapons Specialist Kits" contains = list( - /obj/item/spec_kit/asrs, - /obj/item/spec_kit/asrs, - /obj/item/spec_kit/asrs, - /obj/item/spec_kit/asrs, + /obj/item/spec_kit/rifleman, + /obj/item/spec_kit/rifleman, + /obj/item/spec_kit/rifleman, + /obj/item/spec_kit/rifleman, ) cost = 0 containertype = /obj/structure/closet/crate/supply diff --git a/code/game/machinery/vending/cm_vending.dm b/code/game/machinery/vending/cm_vending.dm index 12231f30bc59..f1c8538bb023 100644 --- a/code/game/machinery/vending/cm_vending.dm +++ b/code/game/machinery/vending/cm_vending.dm @@ -440,6 +440,43 @@ GLOBAL_LIST_EMPTY(vending_products) user.set_interaction(src) tgui_interact(user) +/// Handles redeeming coin tokens. +/obj/structure/machinery/cm_vending/attackby(obj/item/attacking_item, mob/user) + if(!istype(attacking_item, /obj/item/coin/marine)) + ..() + if(!can_access_to_vend(user, ignore_hack = TRUE)) + return FALSE + redeem_token(attacking_item, user) + +/obj/structure/machinery/cm_vending/proc/get_token_type(obj/item/coin/marine/token) + if(istype(token, /obj/item/coin/marine/engineer)) + return TOKEN_ENGINEER + if(istype(token, /obj/item/coin/marine/specialist)) + return TOKEN_SPEC + if(istype(token, /obj/item/coin/marine/synth)) + return TOKEN_SYNTH + return TOKEN_VOID + +/obj/structure/machinery/cm_vending/proc/redeem_token(obj/item/token, mob/user) + var/reward_typepath + switch(get_token_type(token)) + if(TOKEN_VOID) + to_chat(user, SPAN_WARNING("ERROR: TOKEN NOT RECOGNISED.")) + return FALSE + if(TOKEN_SPEC) + reward_typepath = /obj/item/spec_kit/rifleman + else + to_chat(user, SPAN_WARNING("ERROR: INCORRECT TOKEN.")) + return FALSE + + if(reward_typepath && user.drop_inv_item_to_loc(token, src)) + to_chat(user, SPAN_NOTICE("You insert \the [token] into \the [src].")) + var/obj/new_item = new reward_typepath(get_turf(src)) + user.put_in_any_hand_if_possible(new_item) + return TRUE + return FALSE + + //------------TGUI PROCS--------------- /obj/structure/machinery/cm_vending/ui_data(mob/user) @@ -743,8 +780,8 @@ GLOBAL_LIST_EMPTY(vending_products) /obj/structure/machinery/cm_vending/proc/get_listed_products(mob/user) return listed_products -/obj/structure/machinery/cm_vending/proc/can_access_to_vend(mob/user, display=TRUE) - if(!hacked) +/obj/structure/machinery/cm_vending/proc/can_access_to_vend(mob/user, display = TRUE, ignore_hack = FALSE) + if(!hacked || ignore_hack) if(!allowed(user)) if(display) to_chat(user, SPAN_WARNING("Access denied.")) diff --git a/code/game/machinery/vending/vendor_types/crew/synthetic.dm b/code/game/machinery/vending/vendor_types/crew/synthetic.dm index b489dbab16a4..9f23c723f249 100644 --- a/code/game/machinery/vending/vendor_types/crew/synthetic.dm +++ b/code/game/machinery/vending/vendor_types/crew/synthetic.dm @@ -335,13 +335,13 @@ GLOBAL_LIST_INIT(cm_vending_clothing_synth_snowflake, list( req_access = list(ACCESS_MARINE_SYNTH) vendor_role = list(JOB_SYNTH) -/obj/structure/machinery/cm_vending/own_points/experimental_tools/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/coin/marine/synth)) - if(user.drop_inv_item_to_loc(W, src)) +/obj/structure/machinery/cm_vending/own_points/experimental_tools/redeem_token(obj/item/token, mob/user) + if(get_token_type(token) == TOKEN_SYNTH) + if(user.drop_inv_item_to_loc(token, src)) available_points = 30 available_points_to_display = available_points - to_chat(user, SPAN_NOTICE("You insert \the [W] into \the [src].")) - return + to_chat(user, SPAN_NOTICE("You insert \the [token] into \the [src].")) + return TRUE return ..() /obj/structure/machinery/cm_vending/own_points/experimental_tools/get_listed_products(mob/user) diff --git a/code/game/objects/items/devices/coins.dm b/code/game/objects/items/devices/coins.dm index 139ea1cbac8c..e5b0ce369aa3 100644 --- a/code/game/objects/items/devices/coins.dm +++ b/code/game/objects/items/devices/coins.dm @@ -67,12 +67,6 @@ icon_state = "coin_platinum" black_market_value = 35 -/obj/item/coin/marine/synth - name = "synthetic experimental tool redemption token" - desc = "Insert this into a synthetic experimental tools vendor in order to access a variety of experimental support tools." - icon_state = "coin_synth" - black_market_value = 0 - /obj/item/coin/chitin name = "chitin coin" desc = "Durable alien chitin pressed into a coin. There are much better uses for chitin..." @@ -121,3 +115,28 @@ comment = "heads" user.visible_message(SPAN_NOTICE("[user] has thrown \the [src]. It lands on [comment]! "), \ SPAN_NOTICE("You throw \the [src]. It lands on [comment]! ")) + + +/obj/item/coin/marine + name = "marine equipment token" + desc = "I wonder what it does?" + icon_state = "coin_copper" + +/obj/item/coin/marine/attackby(obj/item/W as obj, mob/user as mob) //To remove attaching a string functionality + return + +/obj/item/coin/marine/engineer + name = "marine engineer support token" + desc = "Insert this into an engineer vendor in order to access a support weapon." + icon_state = "coin_gold" + +/obj/item/coin/marine/specialist + name = "marine specialist weapon token" + desc = "Insert this into a USCM equipment vendor in order to access a single highly dangerous weapon." + icon_state = "coin_diamond" + +/obj/item/coin/marine/synth + name = "synthetic experimental tool redemption token" + desc = "Insert this into a synthetic experimental tools vendor in order to access a variety of experimental support tools." + icon_state = "coin_synth" + black_market_value = 0 diff --git a/code/modules/cm_marines/equipment/gear.dm b/code/modules/cm_marines/equipment/gear.dm index b3ec6c800c68..00f956fdd4ed 100644 --- a/code/modules/cm_marines/equipment/gear.dm +++ b/code/modules/cm_marines/equipment/gear.dm @@ -149,15 +149,6 @@ return FALSE . = ..() handle_cloaking() - -/obj/item/coin/marine - name = "marine specialist weapon token" - desc = "Insert this into a specialist vendor in order to access a single highly dangerous weapon." - icon_state = "coin_platinum" - -/obj/item/coin/marine/attackby(obj/item/W as obj, mob/user as mob) //To remove attaching a string functionality - return - /obj/structure/broken_apc name = "\improper M577 armored personnel carrier" desc = "A large, armored behemoth capable of ferrying marines around. \nThis one is sitting nonfunctional." diff --git a/code/modules/cm_marines/equipment/kit_boxes.dm b/code/modules/cm_marines/equipment/kit_boxes.dm index 342f9a775718..d99da8f59f2c 100644 --- a/code/modules/cm_marines/equipment/kit_boxes.dm +++ b/code/modules/cm_marines/equipment/kit_boxes.dm @@ -165,9 +165,13 @@ var/squad_assignment_update = TRUE //this one is delivered via ASRS as a reward for DEFCON/techwebs/whatever else we will have -/obj/item/spec_kit/asrs +/obj/item/spec_kit/rifleman + squad_assignment_update = FALSE allowed_roles_list = list(JOB_SQUAD_MARINE, JOB_WO_SQUAD_MARINE) +/obj/item/spec_kit/rifleman/jobless + allowed_roles_list = list() + /obj/item/spec_kit/cryo squad_assignment_update = FALSE @@ -212,6 +216,17 @@ return FALSE return TRUE +/obj/item/spec_kit/rifleman/can_use(mob/living/carbon/human/user) + if(!length(allowed_roles_list)) + return TRUE + + for(var/allowed_role in allowed_roles_list) + if(user.job == allowed_role)//Alternate check to normal kit as this is distributed to people without SKILL_SPEC_TRAINED. + if(skillcheck(user, SKILL_SPEC_WEAPONS, SKILL_SPEC_KITTED) && !skillcheckexplicit(user, SKILL_SPEC_WEAPONS, SKILL_SPEC_ALL)) + to_chat(user, SPAN_WARNING("You already have specialization, give this kit to someone else!")) + return FALSE + return TRUE + /obj/item/spec_kit/proc/select_and_spawn(mob/living/carbon/human/user) var/selection = tgui_input_list(user, "Pick your specialist equipment type.", "Specialist Kit Selection", GLOB.available_specialist_kit_boxes) if(!selection || QDELETED(src)) diff --git a/code/modules/cm_marines/smartgun_mount.dm b/code/modules/cm_marines/smartgun_mount.dm index dd9053810042..a8528fab856c 100644 --- a/code/modules/cm_marines/smartgun_mount.dm +++ b/code/modules/cm_marines/smartgun_mount.dm @@ -1,12 +1,6 @@ ////////////////////////////////////////////////////////////// //Mounted MG, Replacment for the current jury rig code. -//Adds a coin for engi vendors -/obj/item/coin/marine/engineer - name = "marine engineer support token" - desc = "Insert this into an engineer vendor in order to access a support weapon." - icon_state = "coin_platinum" - // First thing we need is the ammo drum for this thing. /obj/item/ammo_magazine/m56d name = "M56D drum magazine (10x28mm Caseless)"