mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-10 22:55:22 +01:00
Adds verb to change eye color at will (if mechanical)
Adds a verb used by humanoid mobs that have mechanical eyes, which allows them to pick a new color, and have it applied instantly. Adds some helper functions, specifically hex2rgb(), to convert hexadecimal colors to a list of numbers for r, g, and b.
This commit is contained in:
@@ -104,6 +104,7 @@
|
||||
icon = 'icons/obj/robot_component.dmi'
|
||||
icon_state = "camera"
|
||||
dead_icon = "camera_broken"
|
||||
verbs |= /obj/item/organ/internal/eyes/proc/change_eye_color
|
||||
|
||||
/obj/item/organ/internal/eyes/robot
|
||||
name = "optical sensor"
|
||||
@@ -112,6 +113,26 @@
|
||||
..()
|
||||
robotize()
|
||||
|
||||
/obj/item/organ/internal/eyes/proc/change_eye_color()
|
||||
set name = "Change Eye Color"
|
||||
set desc = "Changes your robotic eye color instantly."
|
||||
set category = "IC"
|
||||
set src in usr
|
||||
|
||||
var/current_color = rgb(eye_colour[1],eye_colour[2],eye_colour[3])
|
||||
var/new_color = input("Pick a new color for your eyes.","Eye Color", current_color) as null|color
|
||||
if(new_color && owner)
|
||||
// input() supplies us with a hex color, which we can't use, so we convert it to rbg values.
|
||||
var/list/new_color_rgb_list = hex2rgb(new_color)
|
||||
// First, update mob vars.
|
||||
owner.r_eyes = new_color_rgb_list[1]
|
||||
owner.g_eyes = new_color_rgb_list[2]
|
||||
owner.b_eyes = new_color_rgb_list[3]
|
||||
// Now sync the organ's eye_colour list.
|
||||
update_colour()
|
||||
// Finally, update the eye icon on the mob.
|
||||
owner.update_eyes()
|
||||
|
||||
/obj/item/organ/internal/eyes/replaced(var/mob/living/carbon/human/target)
|
||||
|
||||
// Apply our eye colour to the target.
|
||||
|
||||
Reference in New Issue
Block a user