mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 08:36:00 +01:00
Fixes borg flashlight color picker not working (#53996)
This commit is contained in:
@@ -346,6 +346,38 @@
|
||||
enabled = 0
|
||||
update_icon()
|
||||
|
||||
/**
|
||||
* Toggles the computer's flashlight, if it has one.
|
||||
*
|
||||
* Called from ui_act(), does as the name implies.
|
||||
* It is seperated from ui_act() to be overwritten as needed.
|
||||
*/
|
||||
/obj/item/modular_computer/proc/toggle_flashlight()
|
||||
if(!has_light)
|
||||
return FALSE
|
||||
set_light_on(!light_on)
|
||||
if(light_on)
|
||||
set_light(comp_light_luminosity, 1, comp_light_color)
|
||||
else
|
||||
set_light(0)
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Sets the computer's light color, if it has a light.
|
||||
*
|
||||
* Called from ui_act(), this proc takes a color string and applies it.
|
||||
* It is seperated from ui_act() to be overwritten as needed.
|
||||
* Arguments:
|
||||
** color is the string that holds the color value that we should use. Proc auto-fails if this is null.
|
||||
*/
|
||||
/obj/item/modular_computer/proc/set_flashlight_color(color)
|
||||
if(!has_light || !color)
|
||||
return FALSE
|
||||
comp_light_color = color
|
||||
set_light_color(color)
|
||||
update_light()
|
||||
return TRUE
|
||||
|
||||
/obj/item/modular_computer/screwdriver_act(mob/user, obj/item/tool)
|
||||
if(!all_components.len)
|
||||
to_chat(user, "<span class='warning'>This device doesn't have any components installed.</span>")
|
||||
|
||||
@@ -167,12 +167,7 @@
|
||||
return 1
|
||||
|
||||
if("PC_toggle_light")
|
||||
set_light_on(!light_on)
|
||||
if(light_on)
|
||||
set_light(comp_light_luminosity, 1, comp_light_color)
|
||||
else
|
||||
set_light(0)
|
||||
return TRUE
|
||||
return toggle_flashlight()
|
||||
|
||||
if("PC_light_color")
|
||||
var/mob/user = usr
|
||||
@@ -184,10 +179,7 @@
|
||||
if(color_hex2num(new_color) < 200) //Colors too dark are rejected
|
||||
to_chat(user, "<span class='warning'>That color is too dark! Choose a lighter one.</span>")
|
||||
new_color = null
|
||||
comp_light_color = new_color
|
||||
set_light_color(new_color)
|
||||
update_light()
|
||||
return TRUE
|
||||
return set_flashlight_color(new_color)
|
||||
|
||||
if("PC_Eject_Disk")
|
||||
var/param = params["name"]
|
||||
|
||||
@@ -114,35 +114,20 @@
|
||||
.["light_on"] = borgo?.lamp_enabled
|
||||
.["comp_light_color"] = borgo?.lamp_color
|
||||
|
||||
//Overrides the ui_act to make the flashlight controls link to the borg instead
|
||||
/obj/item/modular_computer/tablet/integrated/ui_act(action, params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
//Makes the flashlight button affect the borg rather than the tablet
|
||||
/obj/item/modular_computer/tablet/integrated/toggle_flashlight()
|
||||
if(!borgo || QDELETED(borgo))
|
||||
return FALSE
|
||||
borgo.toggle_headlamp()
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("PC_toggle_light")
|
||||
if(!borgo)
|
||||
return FALSE
|
||||
borgo.toggle_headlamp()
|
||||
return TRUE
|
||||
|
||||
if("PC_light_color")
|
||||
if(!borgo)
|
||||
return FALSE
|
||||
var/mob/user = usr
|
||||
var/new_color
|
||||
while(!new_color)
|
||||
new_color = input(user, "Choose a new color for [src]'s flashlight.", "Light Color",light_color) as color|null
|
||||
if(!new_color || QDELETED(borgo))
|
||||
return
|
||||
if(color_hex2num(new_color) < 200) //Colors too dark are rejected
|
||||
to_chat(user, "<span class='warning'>That color is too dark! Choose a lighter one.</span>")
|
||||
new_color = null
|
||||
borgo.lamp_color = new_color
|
||||
borgo.toggle_headlamp(FALSE, TRUE)
|
||||
return TRUE
|
||||
return ..()
|
||||
//Makes the flashlight color setting affect the borg rather than the tablet
|
||||
/obj/item/modular_computer/tablet/integrated/set_flashlight_color(color)
|
||||
if(!borgo || QDELETED(borgo) || !color)
|
||||
return FALSE
|
||||
borgo.lamp_color = color
|
||||
borgo.toggle_headlamp(FALSE, TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/modular_computer/tablet/integrated/syndicate
|
||||
icon_state = "tablet-silicon-syndicate"
|
||||
|
||||
Reference in New Issue
Block a user