From 5320d6af3efd0acd1dfdb74f675e7241fbc12ced Mon Sep 17 00:00:00 2001 From: Lohikar Date: Sat, 4 Mar 2017 18:02:03 -0600 Subject: [PATCH] IPC Lights (#1846) changes: IPCs now emit a weak light based on the color of their screen. The system for making species emit light is modular, and Shells+HKs have been excluded from light emission. --- .../living/carbon/human/species/species.dm | 5 ++ .../species/station/machine_subspecies.dm | 13 +++++ .../carbon/human/species/station/station.dm | 52 +++++++++++++++++++ .../mob/living/carbon/human/update_icons.dm | 10 ++++ html/changelogs/lohikar-ipc-lights.yml | 4 ++ 5 files changed, 84 insertions(+) create mode 100644 html/changelogs/lohikar-ipc-lights.yml diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 8fa5dddad77..7a04d4e972e 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -40,6 +40,8 @@ var/virus_immune var/short_sighted var/bald = 0 + var/light_range + var/light_power // Language/culture vars. var/default_language = "Ceti Basic" // Default language is used when 'say' is used without modifiers. @@ -438,3 +440,6 @@ return 0 H.hud_used.move_intent.update_move_icon(H) return 1 + +/datum/species/proc/get_light_color(hair_style) + return diff --git a/code/modules/mob/living/carbon/human/species/station/machine_subspecies.dm b/code/modules/mob/living/carbon/human/species/station/machine_subspecies.dm index 84431259827..39e460840ed 100644 --- a/code/modules/mob/living/carbon/human/species/station/machine_subspecies.dm +++ b/code/modules/mob/living/carbon/human/species/station/machine_subspecies.dm @@ -17,6 +17,9 @@ icobase = 'icons/mob/human_races/r_human.dmi' deform = 'icons/mob/human_races/robotic.dmi' + light_range = 0 + light_power = 0 + eyes = "eyes_s" show_ssd = "completely quiescent" @@ -48,6 +51,8 @@ "r_foot" = list("path" = /obj/item/organ/external/foot/right/shell) ) +/datum/species/machine/shell/get_light_color(hair_style) + return /datum/species/machine/shell/handle_post_spawn(var/mob/living/carbon/human/H) add_inherent_verbs(H) @@ -128,6 +133,9 @@ sprint_speed_factor = 1.4 +/datum/species/machine/industrial/get_light_color(hair_style) + return LIGHT_COLOR_TUNGSTEN + /datum/species/machine/industrial/handle_sprint_cost(var/mob/living/carbon/human/H, var/cost) if (H.stat == CONSCIOUS) H.bodytemperature += cost*0.9 @@ -156,6 +164,9 @@ icobase = 'icons/mob/human_races/r_terminator.dmi' deform = 'icons/mob/human_races/r_terminator.dmi' + light_range = 0 + light_power = 0 + unarmed_types = list(/datum/unarmed_attack/terminator) rarity_value = 20 @@ -231,6 +242,8 @@ sprint_speed_factor = 1.25 slowdown = 1 +/datum/species/machine/terminator/get_light_color(hair_style) + return /datum/species/machine/terminator/handle_sprint_cost(var/mob/living/carbon/human/H, var/cost) if (H.stat == CONSCIOUS) diff --git a/code/modules/mob/living/carbon/human/species/station/station.dm b/code/modules/mob/living/carbon/human/species/station/station.dm index 2caa05ba8ee..26793c6dfcc 100644 --- a/code/modules/mob/living/carbon/human/species/station/station.dm +++ b/code/modules/mob/living/carbon/human/species/station/station.dm @@ -355,6 +355,9 @@ icobase = 'icons/mob/human_races/r_machine.dmi' deform = 'icons/mob/human_races/r_machine.dmi' + light_range = 2 + light_power = 0.5 + unarmed_types = list(/datum/unarmed_attack/punch) rarity_value = 2 @@ -503,6 +506,55 @@ datum/species/machine/handle_post_spawn(var/mob/living/carbon/human/H) var/DBQuery/update_query = dbcon.NewQuery("UPDATE ss13_ipc_tracking SET tag_status = :status WHERE player_ckey = :ckey AND character_name = :character_name") update_query.Execute(query_details) +/datum/species/machine/get_light_color(hair_style) + // I hate this, but I can't think of a better way that doesn't involve + // rewriting hair. + switch (hair_style) + if ("pink IPC screen") + return LIGHT_COLOR_PINK + + if ("red IPC screen") + return LIGHT_COLOR_RED + + if ("green IPC screen") + return LIGHT_COLOR_GREEN + + if ("blue IPC screen") + return LIGHT_COLOR_BLUE + + if ("breakout IPC screen") + return LIGHT_COLOR_CYAN + + if ("eight IPC screen") + return LIGHT_COLOR_CYAN + + if ("goggles IPC screen") + return LIGHT_COLOR_RED + + if ("heart IPC screen") + return LIGHT_COLOR_PINK + + if ("monoeye IPC screen") + return LIGHT_COLOR_ORANGE + + if ("nature IPC screen") + return LIGHT_COLOR_CYAN + + if ("orange IPC screen") + return LIGHT_COLOR_ORANGE + + if ("purple IPC screen") + return LIGHT_COLOR_PURPLE + + if ("shower IPC screen") + return "#FFFFFF" + + if ("static IPC screen") + return "#FFFFFF" + + if ("yellow IPC screen") + return LIGHT_COLOR_YELLOW + /datum/species/bug name = "Vaurca Worker" short_name = "vau" diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 163cd728143..cd072134433 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -389,6 +389,16 @@ var/global/list/damage_icon_parts = list() face_standing.Blend(hair_s, ICON_OVERLAY) + if (species.light_range) + var/col = species.get_light_color(h_style) + if (!col) + col = "#FFFFFF" + + set_light(species.light_range, species.light_power, col, uv = 0, angle = LIGHT_WIDE) + + else if (species.light_range) + set_light(FALSE) + overlays_standing[HAIR_LAYER] = image(face_standing) if(update_icons) update_icons() diff --git a/html/changelogs/lohikar-ipc-lights.yml b/html/changelogs/lohikar-ipc-lights.yml new file mode 100644 index 00000000000..ddc885a07bf --- /dev/null +++ b/html/changelogs/lohikar-ipc-lights.yml @@ -0,0 +1,4 @@ +author: Lohikar +delete-after: True +changes: + - rscadd: "IPCs (not including shells) now emit a small amount of light, colored according to their type and screen color."