Skip to content

Commit

Permalink
Merge pull request #1163 from Zattarra-Red/GlowIntensity
Browse files Browse the repository at this point in the history
Allow Users To Change Glow Intensity.
  • Loading branch information
MosleyTheMalO committed Jun 7, 2024
2 parents 5995c38 + 6adb16a commit 7976766
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions modular_splurt/code/datums/traits/trait_actions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1473,16 +1473,21 @@
// Thickness of glow outline
var/glow_range

// Alpha of the glow outline
var/glow_intensity

/datum/action/cosglow/update_glow/Grant()
. = ..()

// Define user mob
var/mob/living/carbon/human/action_mob = owner

// Default glow intensity to 48 (in decimal)
glow_intensity = "30"

// Add outline effect
if(glow_color && glow_range)
action_mob.add_filter("rad_fiend_glow", 1, list("type" = "outline", "color" = glow_color+"30", "size" = glow_range))
action_mob.add_filter("rad_fiend_glow", 1, list("type" = "outline", "color" = glow_color + glow_intensity, "size" = glow_range))

/datum/action/cosglow/update_glow/Remove()
. = ..()
Expand Down Expand Up @@ -1515,9 +1520,19 @@
// Input is clamped in the 0-4 range
glow_range = isnull(input_range) ? glow_range : clamp(input_range, 0, 4) //More customisable, so you know when you're looking at someone with Radfiend (doom) or a normal player.

// Ask user for intensity input
var/input_intensity = input(action_mob, "How intense is your glow? Value may range between 0 to 255. 0 disables glow.", "Select Glow Intensity", hex2num(glow_intensity)) as num|null

// Check if intensity input was given and clamp it
// If no input is given, reset to stored intensity
var/intensity_clamped = isnull(input_intensity) ? hex2num(glow_intensity) : clamp(input_intensity, 0, 255)

// Update glow intensity
glow_intensity = num2hex(intensity_clamped)

// Update outline effect
if(glow_range && glow_color)
action_mob.add_filter("rad_fiend_glow", 1, list("type" = "outline", "color" = glow_color+"30", "size" = glow_range))
action_mob.add_filter("rad_fiend_glow", 1, list("type" = "outline", "color" = glow_color + glow_intensity, "size" = glow_range))
else
action_mob.remove_filter("rad_fiend_glow")

Expand Down

0 comments on commit 7976766

Please sign in to comment.