Skip to content

Commit

Permalink
working spec tokens???
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Nov 29, 2023
1 parent 3296a8f commit ddc2087
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 33 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/skills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions code/__DEFINES/vendors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 4 additions & 4 deletions code/datums/supply_packs/operations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 39 additions & 2 deletions code/game/machinery/vending/cm_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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."))
Expand Down
10 changes: 5 additions & 5 deletions code/game/machinery/vending/vendor_types/crew/synthetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 25 additions & 6 deletions code/game/objects/items/devices/coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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
9 changes: 0 additions & 9 deletions code/modules/cm_marines/equipment/gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
17 changes: 16 additions & 1 deletion code/modules/cm_marines/equipment/kit_boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand Down
6 changes: 0 additions & 6 deletions code/modules/cm_marines/smartgun_mount.dm
Original file line number Diff line number Diff line change
@@ -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)"
Expand Down

0 comments on commit ddc2087

Please sign in to comment.