Skip to content

Commit

Permalink
Nearsighted quirk lets you pick the look of the glasses you spawn with (
Browse files Browse the repository at this point in the history
tgstation#62145)

expansion: Nearsighter quirk now lets you pick the look of your prescription glasses from the character preference menu
imageadd: Added thin prescription glasses
  • Loading branch information
Mickyan authored Oct 19, 2021
1 parent f25edd0 commit 37c6f90
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 1 deletion.
4 changes: 4 additions & 0 deletions code/_globalvars/lists/quirks.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
///Lists related to quirk selection

///Types of glasses that can be selected at character selection with the Nearsighted quirk
GLOBAL_LIST_INIT(nearsighted_glasses, list("Regular","Thin","Circle","Hipster"))
14 changes: 13 additions & 1 deletion code/datums/quirks/negative.dm
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,21 @@
lose_text = "<span class='notice'>You start seeing faraway things normally again.</span>"
medical_record_text = "Patient requires prescription glasses in order to counteract nearsightedness."
hardcore_value = 5
var/glasses

/datum/quirk/item_quirk/nearsighted/add_unique()
give_item_to_holder(/obj/item/clothing/glasses/regular, list(LOCATION_EYES = ITEM_SLOT_EYES, LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
glasses = glasses || quirk_holder.client?.prefs?.read_preference(/datum/preference/choiced/glasses)
switch(glasses)
if ("Thin")
glasses = /obj/item/clothing/glasses/regular/thin
if ("Circle")
glasses = /obj/item/clothing/glasses/regular/circle
if ("Hipster")
glasses = /obj/item/clothing/glasses/regular/hipster
else
glasses = /obj/item/clothing/glasses/regular

give_item_to_holder(glasses, list(LOCATION_EYES = ITEM_SLOT_EYES, LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))

/datum/quirk/item_quirk/nearsighted/add()
quirk_holder.become_nearsighted(QUIRK_TRAIT)
Expand Down
16 changes: 16 additions & 0 deletions code/modules/client/preferences/glasses.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/datum/preference/choiced/glasses
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
savefile_key = "glasses"
savefile_identifier = PREFERENCE_CHARACTER

/datum/preference/choiced/glasses/init_possible_values()
return GLOB.nearsighted_glasses

/datum/preference/choiced/glasses/is_accessible(datum/preferences/preferences)
if (!..(preferences))
return FALSE

return "Nearsighted" in preferences.all_quirks

/datum/preference/choiced/glasses/apply_to_human(mob/living/carbon/human/target, value)
return
5 changes: 5 additions & 0 deletions code/modules/clothing/glasses/_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@
. = ..()
vision_correction = TRUE

/obj/item/clothing/glasses/regular/thin
name = "thin prescription glasses"
desc = "More expensive, more fragile and much less practical, but oh so fashionable."
icon_state = "glasses_thin"

/obj/item/clothing/glasses/regular/jamjar
name = "jamjar glasses"
desc = "Also known as Virginity Protectors."
Expand Down
Binary file modified icons/mob/clothing/eyes.dmi
Binary file not shown.
Binary file modified icons/obj/clothing/glasses.dmi
Binary file not shown.
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
#include "code\_globalvars\lists\names.dm"
#include "code\_globalvars\lists\objects.dm"
#include "code\_globalvars\lists\poll_ignore.dm"
#include "code\_globalvars\lists\quirks.dm"
#include "code\_globalvars\lists\typecache.dm"
#include "code\_globalvars\lists\wiremod.dm"
#include "code\_globalvars\lists\xenobiology.dm"
Expand Down Expand Up @@ -2150,6 +2151,7 @@
#include "code\modules\client\preferences\fps.dm"
#include "code\modules\client\preferences\gender.dm"
#include "code\modules\client\preferences\ghost.dm"
#include "code\modules\client\preferences\glasses.dm"
#include "code\modules\client\preferences\hotkeys.dm"
#include "code\modules\client\preferences\item_outlines.dm"
#include "code\modules\client\preferences\jobless_role.dm"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { FeatureChoiced, FeatureDropdownInput } from "../base";

export const glasses: FeatureChoiced = {
name: "Glasses",
component: FeatureDropdownInput,
};

0 comments on commit 37c6f90

Please sign in to comment.