Adds custom lighting support to modular computers, and a flashlight to tablets (#28645)

* Adds light support for modular computers/tablets

* Conflicts 1

* Conflicts 3

* praise the conflicts!

* conflicts again!

* initialize!
This commit is contained in:
Ashe Higgs
2017-06-21 16:42:48 -04:00
committed by Jordan Brown
parent 6af7e3466a
commit 4fdd2a37c7
6 changed files with 45 additions and 10 deletions

View File

@@ -43,18 +43,22 @@
var/list/idle_threads // Idle programs on background. They still receive process calls but can't be interacted with.
var/obj/physical = null // Object that represents our computer. It's used for Adjacent() and UI visibility checks.
var/has_light = FALSE //If the computer has a flashlight/LED light/what-have-you installed
var/light_on = FALSE //If that light is enabled
var/comp_light_luminosity = 3 //The brightness of that light
var/comp_light_color //The color of that light
/obj/item/device/modular_computer/New()
/obj/item/device/modular_computer/Initialize()
. = ..()
START_PROCESSING(SSobj, src)
update_icon()
if(!physical)
physical = src
..()
comp_light_color = "#FFFFFF"
all_components = list()
idle_threads = list()
update_icon()
/obj/item/device/modular_computer/Destroy()
kill_program(forced = TRUE)

View File

@@ -50,6 +50,9 @@
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc, "running" = running))
data["has_light"] = has_light
data["light_on"] = light_on
data["comp_light_color"] = comp_light_color
return data
@@ -128,6 +131,27 @@
active_program = P
update_icon()
return 1
if("PC_toggle_light")
light_on = !light_on
if(light_on)
set_light(comp_light_luminosity, 1, comp_light_color)
else
set_light(0)
if("PC_light_color")
var/mob/user = usr
var/new_color
while(!new_color)
new_color = input(user, "Choose a new color for [src]'s flashlight.", "Light Color") as null|color
if(!new_color)
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
comp_light_color = new_color
light_color = new_color
update_light()
else
return

View File

@@ -9,4 +9,6 @@
max_hardware_size = 1
w_class = WEIGHT_CLASS_SMALL
steel_sheet_cost = 1
slot_flags = SLOT_ID | SLOT_BELT
slot_flags = SLOT_ID | SLOT_BELT
has_light = TRUE //LED flashlight!
comp_light_luminosity = 2.3 //Same as the PDA

View File

@@ -240,9 +240,9 @@
#include "code\datums\antagonists\antag_datum.dm"
#include "code\datums\antagonists\datum_clockcult.dm"
#include "code\datums\antagonists\datum_cult.dm"
#include "code\datums\antagonists\devil.dm"
#include "code\datums\antagonists\datum_internal_affairs.dm"
#include "code\datums\antagonists\datum_traitor.dm"
#include "code\datums\antagonists\devil.dm"
#include "code\datums\antagonists\ninja.dm"
#include "code\datums\diseases\_disease.dm"
#include "code\datums\diseases\_MobProcs.dm"

File diff suppressed because one or more lines are too long

View File

@@ -11,4 +11,9 @@
<td><ui-button state='{{running ? null : "disabled"}}' icon='close' action='PC_killprogram' params='{"name": "{{name}}"}'></ui-button>
{{/each}}
</table>
<br><br>
{{#if data.has_light}}
<ui-button action='PC_toggle_light' style='{{data.light_on ? "selected" : null}}'>Toggle Flashlight</ui-button><br>
<ui-button action='PC_light_color'>Change Flashlight Color <span style='border:1px solid #161616; background-color: {{data.comp_light_color}};'>&nbsp;&nbsp;&nbsp;</span></ui-button>
{{/if}}
</ui-display>