Skip to content

Commit

Permalink
Merge pull request #148 from Nerev4r/quirky
Browse files Browse the repository at this point in the history
Some Extremely Fast Quirk Changes
  • Loading branch information
carpotoxin authored Oct 13, 2024
2 parents be5ebc0 + 924ccb4 commit 0cb78f2
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 136 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/~doppler_defines/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#define TRAIT_LEFT_HANDED "left_handed"
/// Trait for people with the cybernetic quirk
#define TRAIT_PERMITTED_CYBERNETIC "permitted_cybernetic"
/// No step on glass
#define TRAIT_HARD_SOLES "hard_soles"

////
// Jobs
Expand Down
4 changes: 4 additions & 0 deletions code/datums/components/caltrop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
return

if (!(flags & CALTROP_BYPASS_SHOES))
// DOPPLER EDIT ADDITION BEGIN - Hardened Soles Quirk
if(HAS_TRAIT(digitigrade_fan, TRAIT_HARD_SOLES))
return
// DOPPLER EDIT ADDITION END
if ((digitigrade_fan.wear_suit?.body_parts_covered | digitigrade_fan.w_uniform?.body_parts_covered | digitigrade_fan.shoes?.body_parts_covered) & FEET)
return

Expand Down
6 changes: 5 additions & 1 deletion code/modules/assembly/mousetrap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@
return FALSE
switch(type)
if("feet")
if(!victim.shoes)
// DOPPLER ADDITION START - Hardened soles
if(HAS_TRAIT(victim, TRAIT_HARD_SOLES))
to_chat(victim, span_notice("[src] snaps onto your foot, then falls off uselessly."))
// DOPPLER ADDITION END
else if(!victim.shoes) // DOPPLER EDIT, old code: if(!victim.shoes)
affecting = victim.get_bodypart(pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
victim.Paralyze(60)
else
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/preferences/middleware/_middleware.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
return FALSE

/// Called when applying preferences to the mob.
/datum/preference_middleware/proc/apply_to_human(mob/living/carbon/human/target, datum/preferences/preferences, visuals_only = FALSE) //NOVA EDIT CHANGE
/datum/preference_middleware/proc/apply_to_human(mob/living/carbon/human/target, datum/preferences/preferences, visuals_only = FALSE) //DOPPLER EDIT CHANGE
SHOULD_NOT_SLEEP(TRUE)
SHOULD_CALL_PARENT(FALSE)
return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/loadout/loadout_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ GLOBAL_LIST_INIT(all_loadout_categories, init_loadout_categories())
if(can_be_named && item_details?[INFO_NAMED] && !visuals_only)
equipped_item.name = trim(item_details[INFO_NAMED], PREVENT_CHARACTER_TRIM_LOSS(MAX_NAME_LEN))
ADD_TRAIT(equipped_item, TRAIT_WAS_RENAMED, "Loadout")
equipped_item.on_loadout_custom_named() // NOVA EDIT ADDITION - Loadout item names
equipped_item.on_loadout_custom_named() // DOPPLER EDIT ADDITION - Loadout item names

// DOPPLER EDIT ADDITION START - Loadout item descriptions
if(can_be_named && item_details?[INFO_DESCRIBED] && !visuals_only)
Expand Down
6 changes: 6 additions & 0 deletions modular_doppler/modular_medical/surgery/_bodyparts.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Digitigrade legs are augmented to have the hardened soles quirk/trait
/obj/item/bodypart/leg/left/digitigrade
bodypart_traits = list(TRAIT_HARD_SOLES)

/obj/item/bodypart/leg/right/digitigrade
bodypart_traits = list(TRAIT_HARD_SOLES)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/datum/quirk/hard_soles
name = "Hardened Soles"
desc = "You're used to walking barefoot, and won't receive the negative effects of doing so."
value = 2
mob_trait = TRAIT_HARD_SOLES
gain_text = span_notice("The ground doesn't feel so rough on your feet anymore.")
lose_text = span_danger("You start feeling the ridges and imperfections on the ground.")
medical_record_text = "Patient's feet are more resilient against traction."
icon = FA_ICON_PERSON_RUNNING
132 changes: 0 additions & 132 deletions modular_doppler/modular_quirks/linguist/linguist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,135 +7,3 @@
lose_text = span_danger("Your grasp of the finer points of Draconic idioms fades away.")
medical_record_text = "Patient demonstrates a high brain plasticity in regards to language learning."
icon = FA_ICON_BOOK_ATLAS

/datum/quirk/night_vision
name = "Night Vision"
desc = "You can see slightly more clearly in full darkness than most people."
icon = FA_ICON_MOON
value = 4
mob_trait = TRAIT_NIGHT_VISION
gain_text = span_notice("The shadows seem a little less dark.")
lose_text = span_danger("Everything seems a little darker.")
medical_record_text = "Patient's eyes show above-average acclimation to darkness."
mail_goodies = list(
/obj/item/flashlight/flashdark,
/obj/item/food/grown/mushroom/glowshroom/shadowshroom,
/obj/item/skillchip/light_remover,
)

/datum/quirk/night_vision/add(client/client_source)
refresh_quirk_holder_eyes()

/datum/quirk/night_vision/remove()
refresh_quirk_holder_eyes()

/datum/quirk/night_vision/proc/refresh_quirk_holder_eyes()
var/mob/living/carbon/human/human_quirk_holder = quirk_holder
var/obj/item/organ/internal/eyes/eyes = human_quirk_holder.get_organ_by_type(/obj/item/organ/internal/eyes)
if(!eyes)
return
// We've either added or removed TRAIT_NIGHT_VISION before calling this proc. Just refresh the eyes.
eyes.refresh()

// This NV quirk variant applies color_offsets night vision to a mob based on its chosen eye color.
// Some eye colors will produce very slightly stronger mechanical night vision effects just by virtue of their RGB values being scaled higher (typically lighter colours).

/datum/quirk/night_vision
desc = "You can see a little better in darkness than most ordinary humanoids. If your eyes are naturally more sensitive to light through other means (such as being photophobic or a mothperson), this effect is significantly stronger."
medical_record_text = "Patient's visual sensory organs demonstrate non-standard performance in low-light conditions."
var/nv_color = null /// Holds the player's selected night vision colour
var/list/nv_color_cutoffs = null /// Contains the color_cutoffs applied to the user's eyes w/ our custom hue (once built)

/datum/quirk/night_vision/add_unique(client/client_source)
. = ..()
nv_color = client_source?.prefs.read_preference(/datum/preference/color/nv_color)
if (isnull(nv_color))
var/mob/living/carbon/human/human_holder = quirk_holder
nv_color = process_chat_color(human_holder.eye_color_left)
nv_color_cutoffs = calculate_color_cutoffs(nv_color)
refresh_quirk_holder_eyes() // make double triple dog sure we apply the overlay

/// Calculate eye organ color_cutoffs used in tinted night vision with a supplied hexcode colour, clamping and scaling appropriately.
/datum/quirk/night_vision/proc/calculate_color_cutoffs(color)
var/mob/living/carbon/human/target = quirk_holder

// if we have more sensitive eyes, increase the power
var/obj/item/organ/internal/eyes/target_eyes = target.get_organ_slot(ORGAN_SLOT_EYES)
if (!istype(target_eyes))
return
var/infravision_multiplier = max(0, (-(target_eyes.flash_protect) * DOPPLER_NIGHT_VISION_SENSITIVITY_MULT)) + 1

var/list/new_rgb_cutoffs = new /list(3)
for(var/i in 1 to 3)
var/base_color = hex2num(copytext(color, (i*2), (i*2)+2)) //convert their supplied hex colour value to RGB
var/adjusted_color = max(((base_color / 255) * (DOPPLER_NIGHT_VISION_POWER_MAX * infravision_multiplier)), (DOPPLER_NIGHT_VISION_POWER_MIN * infravision_multiplier)) //linear convert their eye color into a color_cutoff range, ensuring it is clamped
new_rgb_cutoffs[i] = adjusted_color

return new_rgb_cutoffs

/datum/quirk_constant_data/night_vision
associated_typepath = /datum/quirk/night_vision
customization_options = list(/datum/preference/color/nv_color)

// Client preference for night vision colour
/datum/preference/color/nv_color
savefile_key = "nv_color"
savefile_identifier = PREFERENCE_CHARACTER
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED

/datum/preference/color/nv_color/is_accessible(datum/preferences/preferences)
if (!..(preferences))
return FALSE

return "Night Vision" in preferences.all_quirks

/datum/preference/color/nv_color/apply_to_human(mob/living/carbon/human/target, value)
return

// run the Blessed Runechat Proc since it does most of what we want regarding luminance clamping anyway. could it be better? probably. is it more work? yes, it's a LOT of work.
/datum/preference/color/nv_color/deserialize(input, datum/preferences/preferences)
return process_chat_color(sanitize_hexcolor(input))

/datum/preference/color/nv_color/serialize(input)
return process_chat_color(sanitize_hexcolor(input))

/datum/preference/color/nv_color/create_default_value()
return process_chat_color("#[random_color()]")

/datum/quirk/photophobia
desc = "Bright lights are uncomfortable and upsetting to you for whatever reason. Your eyes are also more sensitive to light in general. This shares a unique interaction with Night Vision."
/// how much of a flash_protect deficit the quirk inflicts
var/severity = 1

/datum/quirk/photophobia/add_unique(client/client_source)
var/sensitivity = client_source?.prefs.read_preference(/datum/preference/choiced/photophobia_severity)
switch (sensitivity)
if ("Hypersensitive")
severity = 2
if ("Sensitive")
severity = 1
var/obj/item/organ/internal/eyes/holder_eyes = quirk_holder.get_organ_slot(ORGAN_SLOT_EYES)
restore_eyes(holder_eyes) // add_unique() happens after add() so we need to jank reset this to ensure sensitivity is properly applied at roundstart
check_eyes(holder_eyes)

/datum/quirk_constant_data/photophobia
associated_typepath = /datum/quirk/photophobia
customization_options = list(/datum/preference/choiced/photophobia_severity)

/datum/preference/choiced/photophobia_severity
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
savefile_key = "photophobia_severity"
savefile_identifier = PREFERENCE_CHARACTER

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

return "Photophobia" in preferences.all_quirks

/datum/preference/choiced/photophobia_severity/init_possible_values()
var/list/values = list("Sensitive", "Hypersensitive")
return values

/datum/preference/choiced/photophobia_severity/apply_to_human(mob/living/carbon/human/target, value)
return
131 changes: 131 additions & 0 deletions modular_doppler/modular_quirks/night_vision/night_vision.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/datum/quirk/night_vision
name = "Night Vision"
desc = "You can see slightly more clearly in full darkness than most people."
icon = FA_ICON_MOON
value = 4
mob_trait = TRAIT_NIGHT_VISION
gain_text = span_notice("The shadows seem a little less dark.")
lose_text = span_danger("Everything seems a little darker.")
medical_record_text = "Patient's eyes show above-average acclimation to darkness."
mail_goodies = list(
/obj/item/flashlight/flashdark,
/obj/item/food/grown/mushroom/glowshroom/shadowshroom,
/obj/item/skillchip/light_remover,
)

/datum/quirk/night_vision/add(client/client_source)
refresh_quirk_holder_eyes()

/datum/quirk/night_vision/remove()
refresh_quirk_holder_eyes()

/datum/quirk/night_vision/proc/refresh_quirk_holder_eyes()
var/mob/living/carbon/human/human_quirk_holder = quirk_holder
var/obj/item/organ/internal/eyes/eyes = human_quirk_holder.get_organ_by_type(/obj/item/organ/internal/eyes)
if(!eyes)
return
// We've either added or removed TRAIT_NIGHT_VISION before calling this proc. Just refresh the eyes.
eyes.refresh()

// This NV quirk variant applies color_offsets night vision to a mob based on its chosen eye color.
// Some eye colors will produce very slightly stronger mechanical night vision effects just by virtue of their RGB values being scaled higher (typically lighter colours).

/datum/quirk/night_vision
desc = "You can see a little better in darkness than most ordinary humanoids. If your eyes are naturally more sensitive to light through other means (such as being photophobic or a mothperson), this effect is significantly stronger."
medical_record_text = "Patient's visual sensory organs demonstrate non-standard performance in low-light conditions."
var/nv_color = null /// Holds the player's selected night vision colour
var/list/nv_color_cutoffs = null /// Contains the color_cutoffs applied to the user's eyes w/ our custom hue (once built)

/datum/quirk/night_vision/add_unique(client/client_source)
. = ..()
nv_color = client_source?.prefs.read_preference(/datum/preference/color/nv_color)
if (isnull(nv_color))
var/mob/living/carbon/human/human_holder = quirk_holder
nv_color = process_chat_color(human_holder.eye_color_left)
nv_color_cutoffs = calculate_color_cutoffs(nv_color)
refresh_quirk_holder_eyes() // make double triple dog sure we apply the overlay

/// Calculate eye organ color_cutoffs used in tinted night vision with a supplied hexcode colour, clamping and scaling appropriately.
/datum/quirk/night_vision/proc/calculate_color_cutoffs(color)
var/mob/living/carbon/human/target = quirk_holder

// if we have more sensitive eyes, increase the power
var/obj/item/organ/internal/eyes/target_eyes = target.get_organ_slot(ORGAN_SLOT_EYES)
if (!istype(target_eyes))
return
var/infravision_multiplier = max(0, (-(target_eyes.flash_protect) * DOPPLER_NIGHT_VISION_SENSITIVITY_MULT)) + 1

var/list/new_rgb_cutoffs = new /list(3)
for(var/i in 1 to 3)
var/base_color = hex2num(copytext(color, (i*2), (i*2)+2)) //convert their supplied hex colour value to RGB
var/adjusted_color = max(((base_color / 255) * (DOPPLER_NIGHT_VISION_POWER_MAX * infravision_multiplier)), (DOPPLER_NIGHT_VISION_POWER_MIN * infravision_multiplier)) //linear convert their eye color into a color_cutoff range, ensuring it is clamped
new_rgb_cutoffs[i] = adjusted_color

return new_rgb_cutoffs

/datum/quirk_constant_data/night_vision
associated_typepath = /datum/quirk/night_vision
customization_options = list(/datum/preference/color/nv_color)

// Client preference for night vision colour
/datum/preference/color/nv_color
savefile_key = "nv_color"
savefile_identifier = PREFERENCE_CHARACTER
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED

/datum/preference/color/nv_color/is_accessible(datum/preferences/preferences)
if (!..(preferences))
return FALSE

return "Night Vision" in preferences.all_quirks

/datum/preference/color/nv_color/apply_to_human(mob/living/carbon/human/target, value)
return

// run the Blessed Runechat Proc since it does most of what we want regarding luminance clamping anyway. could it be better? probably. is it more work? yes, it's a LOT of work.
/datum/preference/color/nv_color/deserialize(input, datum/preferences/preferences)
return process_chat_color(sanitize_hexcolor(input))

/datum/preference/color/nv_color/serialize(input)
return process_chat_color(sanitize_hexcolor(input))

/datum/preference/color/nv_color/create_default_value()
return process_chat_color("#[random_color()]")

/datum/quirk/photophobia
desc = "Bright lights are uncomfortable and upsetting to you for whatever reason. Your eyes are also more sensitive to light in general. This shares a unique interaction with Night Vision."
/// how much of a flash_protect deficit the quirk inflicts
var/severity = 1

/datum/quirk/photophobia/add_unique(client/client_source)
var/sensitivity = client_source?.prefs.read_preference(/datum/preference/choiced/photophobia_severity)
switch (sensitivity)
if ("Hypersensitive")
severity = 2
if ("Sensitive")
severity = 1
var/obj/item/organ/internal/eyes/holder_eyes = quirk_holder.get_organ_slot(ORGAN_SLOT_EYES)
restore_eyes(holder_eyes) // add_unique() happens after add() so we need to jank reset this to ensure sensitivity is properly applied at roundstart
check_eyes(holder_eyes)

/datum/quirk_constant_data/photophobia
associated_typepath = /datum/quirk/photophobia
customization_options = list(/datum/preference/choiced/photophobia_severity)

/datum/preference/choiced/photophobia_severity
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
savefile_key = "photophobia_severity"
savefile_identifier = PREFERENCE_CHARACTER

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

return "Photophobia" in preferences.all_quirks

/datum/preference/choiced/photophobia_severity/init_possible_values()
var/list/values = list("Sensitive", "Hypersensitive")
return values

/datum/preference/choiced/photophobia_severity/apply_to_human(mob/living/carbon/human/target, value)
return
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@
limb_id = "synth_lizard"

/obj/item/bodypart/leg/right/robot/android/synth_lizard
bodypart_traits = list(TRAIT_HARD_SOLES)
bodyshape = BODYSHAPE_HUMANOID | BODYSHAPE_DIGITIGRADE
should_draw_greyscale = TRUE
icon_static = ANDROID_BODYPARTS_DMI
Expand All @@ -823,6 +824,7 @@
limb_id = "synth_lizard"

/obj/item/bodypart/leg/left/robot/android/synth_lizard
bodypart_traits = list(TRAIT_HARD_SOLES)
bodyshape = BODYSHAPE_HUMANOID | BODYSHAPE_DIGITIGRADE
should_draw_greyscale = TRUE
icon_static = ANDROID_BODYPARTS_DMI
Expand Down
3 changes: 3 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6840,6 +6840,7 @@
#include "modular_doppler\modular_medical\reagents\reagents.dm"
#include "modular_doppler\modular_medical\reagents\sprays.dm"
#include "modular_doppler\modular_medical\reagents\synth_blood.dm"
#include "modular_doppler\modular_medical\surgery\_bodyparts.dm"
#include "modular_doppler\modular_medical\surgery\revival.dm"
#include "modular_doppler\modular_medical\surgery\organs\internal\cyberimp.dm"
#include "modular_doppler\modular_medical\wounds\_wounds.dm"
Expand All @@ -6863,8 +6864,10 @@
#include "modular_doppler\modular_mood\code\mood_events\hotspring.dm"
#include "modular_doppler\modular_mood\code\mood_events\race_drink.dm"
#include "modular_doppler\modular_quirks\excitable\excitable.dm"
#include "modular_doppler\modular_quirks\hardened_soles\hardened_soles.dm"
#include "modular_doppler\modular_quirks\left_handed\left_handed.dm"
#include "modular_doppler\modular_quirks\linguist\linguist.dm"
#include "modular_doppler\modular_quirks\night_vision\night_vision.dm"
#include "modular_doppler\modular_quirks\overwrites\musician.dm"
#include "modular_doppler\modular_quirks\paycheck_rations\code\quirk.dm"
#include "modular_doppler\modular_quirks\paycheck_rations\code\rationpacks.dm"
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/PreferencesMenu/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { ServerPreferencesFetcher } from './ServerPreferencesFetcher';
import { useRandomToggleState } from './useRandomToggleState';

const CLOTHING_CELL_SIZE = 48;
const CLOTHING_SIDEBAR_ROWS = 13.4; // NOVA EDIT CHANGE - ORIGINAL: 9
const CLOTHING_SIDEBAR_ROWS = 13.4; // DOPPLER EDIT CHANGE - ORIGINAL: 9

const CLOTHING_SELECTION_CELL_SIZE = 48;
const CLOTHING_SELECTION_WIDTH = 5.4;
Expand Down

0 comments on commit 0cb78f2

Please sign in to comment.