Skip to content

Commit

Permalink
datumizes spec sets
Browse files Browse the repository at this point in the history
  • Loading branch information
Zonespace27 committed Aug 12, 2024
1 parent 2bd28fb commit fb486ce
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 135 deletions.
14 changes: 11 additions & 3 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,15 @@
/// If the mob is able to use the vulture rifle or spotting scope
#define TRAIT_VULTURE_USER "t_vulture_user"
/// If the mob is currently loading a tutorial
#define TRAIT_IN_TUTORIAL "t_IN_TUTORIAL"
#define TRAIT_IN_TUTORIAL "t_in_tutorial"
/// If the mob is cloaked in any form
#define TRAIT_CLOAKED "t_cloaked"
/// If the mob claimed a specialist set from a vendor
#define TRAIT_SPEC_VENDOR "t_spec_vendor"
/// If the mob claimed a specialist set from a kit
#define TRAIT_SPEC_KIT "t_spec_kit"
/// What spec set the mob has claimed, if any
#define TRAIT_SPEC(spec_type) "t_spec_[spec_type]"

// -- ability traits --
/// Xenos with this trait cannot have plasma transfered to them
Expand Down Expand Up @@ -311,6 +317,8 @@ GLOBAL_LIST_INIT(mob_traits, list(
TRAIT_ABILITY_BURROWED,
TRAIT_VULTURE_USER,
TRAIT_IN_TUTORIAL,
TRAIT_SPEC_KIT,
TRAIT_SPEC_VENDOR,
))

/*
Expand Down Expand Up @@ -350,9 +358,9 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_CANNOT_EAT" = TRAIT_CANNOT_EAT,
"TRAIT_VULTURE_USER" = TRAIT_VULTURE_USER,
"TRAIT_CLOAKED" = TRAIT_CLOAKED,
"TRAIT_SPEC_KIT" = TRAIT_SPEC_KIT,
"TRAIT_SPEC_VENDOR" = TRAIT_SPEC_VENDOR,
),
// /mob/living/carbon/human = list(
// ),
/mob/living/carbon/xenomorph = list(
"TRAIT_ABILITY_NO_PLASMA_TRANSFER" = TRAIT_ABILITY_NO_PLASMA_TRANSFER,
"TRAIT_ABILITY_OVIPOSITOR" = TRAIT_ABILITY_OVIPOSITOR,
Expand Down
22 changes: 2 additions & 20 deletions code/_globalvars/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -485,26 +485,8 @@ GLOBAL_REFERENCE_LIST_INDEXED(all_skills, /datum/skill, skill_name)
// Timelock
GLOBAL_LIST_EMPTY(timelocks)


//the global list of specialist kits that haven't been claimed yet.
GLOBAL_LIST_INIT(available_specialist_sets, list(
"Scout Set",
"Sniper Set",
"Anti-materiel Sniper Set",
"Demolitionist Set",
"Heavy Grenadier Set",
"Pyro Set"
))

//Similar thing, but used in /obj/item/spec_kit
GLOBAL_LIST_INIT(available_specialist_kit_boxes, list(
"Pyro" = 2,
"Grenadier" = 2,
"Sniper" = 2,
"Scout" = 2,
"Demo" = 2,
"Anti-materiel Sniper" = 2,
))
GLOBAL_LIST_EMPTY_TYPED(specialist_set_name_dict, /datum/specialist_set)
GLOBAL_LIST_INIT_TYPED(specialist_set_datums, /datum/specialist_set, setup_specialist_sets())

/proc/init_global_referenced_datums()
init_keybindings()
Expand Down
4 changes: 4 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,7 @@

if(user.client.check_whitelist_status(flags_whitelist))
return TRUE

/// Called when the job owner enters deep cryogenic storage
/datum/job/proc/on_cryo(mob/living/carbon/human/cryoing)
return
5 changes: 5 additions & 0 deletions code/game/jobs/job/marine/squad/specialist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
total_positions_so_far = positions
return positions

/datum/job/marine/specialist/on_cryo(mob/living/carbon/human/cryoing)
var/specialist_set = get_specialist_set(cryoing)
if(isnull(specialist_set))
return
GLOB.specialist_set_datums[specialist_set].refund_set(cryoing)

/datum/job/marine/specialist/whiskey
title = JOB_WO_SQUAD_SPECIALIST
Expand Down
20 changes: 1 addition & 19 deletions code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -324,28 +324,10 @@ GLOBAL_LIST_INIT(frozen_items, list(SQUAD_MARINE_1 = list(), SQUAD_MARINE_2 = li
var/datum/job/job = GET_MAPPED_ROLE(occupant.job)
if(ishuman(occupant))
var/mob/living/carbon/human/H = occupant
job.on_cryo(H)
if(H.assigned_squad)
var/datum/squad/S = H.assigned_squad
S.forget_marine_in_squad(H)
if(istype(job, /datum/job/marine/specialist))
//we make the set this specialist took if any available again
if(H.skills)
var/set_name
switch(H.skills.get_skill_level(SKILL_SPEC_WEAPONS))
if(SKILL_SPEC_ROCKET)
set_name = "Demolitionist Set"
if(SKILL_SPEC_GRENADIER)
set_name = "Heavy Grenadier Set"
if(SKILL_SPEC_PYRO)
set_name = "Pyro Set"
if(SKILL_SPEC_SCOUT)
set_name = "Scout Set"
if(SKILL_SPEC_SNIPER)
set_name = "Sniper Set"
GLOB.available_specialist_sets += "Anti-materiel Sniper Set"

if(set_name && !GLOB.available_specialist_sets.Find(set_name))
GLOB.available_specialist_sets += set_name

//Cryoing someone out removes someone from the Marines, blocking further larva spawns until accounted for
SSticker.mode.latejoin_update(job, -1)
Expand Down
40 changes: 10 additions & 30 deletions code/game/machinery/vending/cm_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -565,48 +565,28 @@ GLOBAL_LIST_EMPTY(vending_products)
to_chat(user, SPAN_WARNING("Only specialists can take specialist sets."))
vend_fail()
return FALSE

else if(!user.skills || user.skills.get_skill_level(SKILL_SPEC_WEAPONS) != SKILL_SPEC_TRAINED)
to_chat(user, SPAN_WARNING("You already have a specialization."))
vend_fail()
return FALSE

var/p_name = itemspec[1]
if(!GLOB.available_specialist_sets.Find(p_name))
if(!(p_name in GLOB.specialist_set_name_dict))
return

if(GLOB.specialist_set_name_dict[p_name].get_available_vendor_num() <= 0)
to_chat(user, SPAN_WARNING("That set is already taken."))
vend_fail()
return FALSE

var/obj/item/card/id/ID = human_user.wear_id
if(!istype(ID) || !ID.check_biometrics(user))
to_chat(user, SPAN_WARNING("You must be wearing your [SPAN_INFO("dog tags")] to select a specialization!"))
return FALSE
var/specialist_assignment
switch(p_name)
if("Scout Set")
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_SCOUT)
specialist_assignment = "Scout"
if("Sniper Set")
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_SNIPER)
specialist_assignment = "Sniper"
GLOB.available_specialist_sets -= "Anti-materiel Sniper Set"
if("Anti-materiel Sniper Set")
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_SNIPER)
specialist_assignment = "Heavy Sniper"
GLOB.available_specialist_sets -= "Sniper Set"
if("Demolitionist Set")
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_ROCKET)
specialist_assignment = "Demo"
if("Heavy Grenadier Set")
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_GRENADIER)
specialist_assignment = "Grenadier"
if("Pyro Set")
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_PYRO)
specialist_assignment = "Pyro"
else
to_chat(user, SPAN_WARNING("<b>Something bad occurred with [src], tell a Dev.</b>"))
vend_fail()
return FALSE
ID.set_assignment((human_user.assigned_squad ? (human_user.assigned_squad.name + " ") : "") + JOB_SQUAD_SPECIALIST + " ([specialist_assignment])")
GLOB.data_core.manifest_modify(user.real_name, WEAKREF(user), ID.assignment)
GLOB.available_specialist_sets -= p_name

GLOB.specialist_set_name_dict[p_name].redeem_set(human_user)

else if(vendor_role.Find(JOB_SYNTH))
if(user.job != JOB_SYNTH)
to_chat(user, SPAN_WARNING("Only USCM Synthetics may vend experimental tool tokens."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GLOBAL_LIST_INIT(cm_vending_gear_spec, list(
list("Pyro Set", 0, /obj/item/storage/box/spec/pyro, MARINE_CAN_BUY_ESSENTIALS, VENDOR_ITEM_REGULAR),
list("Scout Set", 0, /obj/item/storage/box/spec/scout, MARINE_CAN_BUY_ESSENTIALS, VENDOR_ITEM_REGULAR),
list("Sniper Set", 0, /obj/item/storage/box/spec/sniper, MARINE_CAN_BUY_ESSENTIALS, VENDOR_ITEM_RECOMMENDED),
list("Anti-materiel Sniper Set", 0, /obj/item/storage/box/spec/sniper/anti_materiel, MARINE_CAN_BUY_ESSENTIALS, VENDOR_ITEM_RECOMMENDED),
list("Anti-Materiel Sniper Set", 0, /obj/item/storage/box/spec/sniper/anti_materiel, MARINE_CAN_BUY_ESSENTIALS, VENDOR_ITEM_RECOMMENDED),

list("EXTRA SCOUT AMMUNITION", 0, null, null, null),
list("A19 High Velocity Impact Magazine (10x24mm)", 40, /obj/item/ammo_magazine/rifle/m4ra/custom/impact, null, VENDOR_ITEM_REGULAR),
Expand Down
19 changes: 1 addition & 18 deletions code/modules/admin/player_panel/actions/physical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,9 @@
var/datum/job/job = GET_MAPPED_ROLE(target.job)
if(ishuman(target))
var/mob/living/carbon/human/H = target
job.on_cryo(H)
if(H.assigned_squad)
var/datum/squad/S = H.assigned_squad
if(H.job == JOB_SQUAD_SPECIALIST)
//we make the set this specialist took if any available again
if(H.skills)
var/set_name
switch(H.skills.get_skill_level(SKILL_SPEC_WEAPONS))
if(SKILL_SPEC_ROCKET)
set_name = "Demolitionist Set"
if(SKILL_SPEC_GRENADIER)
set_name = "Heavy Grenadier Set"
if(SKILL_SPEC_PYRO)
set_name = "Pyro Set"
if(SKILL_SPEC_SCOUT)
set_name = "Scout Set"
if(SKILL_SPEC_SNIPER)
set_name = "Sniper Set"

if(set_name && !GLOB.available_specialist_sets.Find(set_name))
GLOB.available_specialist_sets += set_name
S.forget_marine_in_squad(H)
message_admins("[key_name_admin(user)] sent [key_name_admin(target)] ([H.job]) to cryogenics.")

Expand Down
55 changes: 11 additions & 44 deletions code/modules/cm_marines/equipment/kit_boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,59 +248,26 @@
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)
var/list/available_specialist_kits = list()
for(var/path in GLOB.specialist_set_datums)
var/datum/specialist_set/specset = GLOB.specialist_set_datums[path]
if(specset.get_available_kit_num() >= 1)
available_specialist_kits += specset.get_name()

var/selection = tgui_input_list(user, "Pick your specialist equipment type.", "Specialist Kit Selection", available_specialist_kits)
if(!selection || QDELETED(src))
return FALSE
if(!skillcheckexplicit(user, SKILL_SPEC_WEAPONS, SKILL_SPEC_TRAINED) && !skillcheckexplicit(user, SKILL_SPEC_WEAPONS, SKILL_SPEC_ALL))
to_chat(user, SPAN_WARNING("You already unwrapped your [name], give this one to someone else!"))
return
if(!GLOB.available_specialist_kit_boxes[selection] || GLOB.available_specialist_kit_boxes[selection] <= 0)
return FALSE
if(!GLOB.specialist_set_name_dict[selection] || (GLOB.specialist_set_name_dict[selection].get_available_kit_num() <= 0))
to_chat(user, SPAN_WARNING("No more kits of this type may be chosen!"))
return FALSE
var/obj/item/card/id/ID = user.wear_id
if(!istype(ID) || ID.registered_ref != WEAKREF(user))
to_chat(user, SPAN_WARNING("You must be wearing your [SPAN_INFO("ID card")] or [SPAN_INFO("dog tags")] to select a specialization!"))
return
var/turf/T = get_turf(loc)
var/obj/item/storage/box/spec/spec_box
var/specialist_assignment
switch(selection)
if("Pyro")
spec_box = new /obj/item/storage/box/spec/pyro(T)
specialist_assignment = "Pyro"
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_PYRO)
if("Grenadier")
spec_box = new /obj/item/storage/box/spec/heavy_grenadier(T)
specialist_assignment = "Grenadier"
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_GRENADIER)
if("Sniper")
spec_box = new /obj/item/storage/box/spec/sniper(T)
specialist_assignment = "Sniper"
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_SNIPER)
if("Anti-materiel Sniper")
spec_box = new /obj/item/storage/box/spec/sniper/anti_materiel(T)
specialist_assignment = "Heavy Sniper"
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_SNIPER)
if("Scout")
spec_box = new /obj/item/storage/box/spec/scout(T)
specialist_assignment = "Scout"
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_SCOUT)
//this is to be able to use C4s that are coming with the kit
if(!skillcheck(user, SKILL_ENGINEER, SKILL_ENGINEER_TRAINED))
user.skills.set_skill(SKILL_ENGINEER, SKILL_ENGINEER_TRAINED)
if("Demo")
spec_box = new /obj/item/storage/box/spec/demolitionist(T)
specialist_assignment = "Demo"
user.skills.set_skill(SKILL_SPEC_WEAPONS, SKILL_SPEC_ROCKET)
//this is to be able to use C4s that are coming with the kit
if(!skillcheck(user, SKILL_ENGINEER, SKILL_ENGINEER_TRAINED))
user.skills.set_skill(SKILL_ENGINEER, SKILL_ENGINEER_TRAINED)
if(specialist_assignment)
user.put_in_hands(spec_box)
ID.set_assignment((user.assigned_squad && squad_assignment_update ? (user.assigned_squad.name + " ") : "") + ID.assignment + " ([specialist_assignment])")
GLOB.data_core.manifest_modify(user.real_name, WEAKREF(user), ID.assignment)
return TRUE
return FALSE
return FALSE
return GLOB.specialist_set_name_dict[selection].redeem_set(user, TRUE)


//******************************************PFC Kits****************************************************************/
Expand Down
Loading

0 comments on commit fb486ce

Please sign in to comment.