diff --git a/aurorastation.dme b/aurorastation.dme index a1856d22737..b25ad6cf997 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -909,6 +909,7 @@ #include "code\game\machinery\rechargestation.dm" #include "code\game\machinery\requests_console.dm" #include "code\game\machinery\ringer.dm" +#include "code\game\machinery\rotating_alarm.dm" #include "code\game\machinery\seed_extractor.dm" #include "code\game\machinery\Sleeper.dm" #include "code\game\machinery\spaceheater.dm" diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index 59e9d394c67..ec6eb02639f 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -142,7 +142,7 @@ #define LIGHTING_LAYER 1 #define EFFECTS_ABOVE_LIGHTING_PLANE 5 - #define EYEGLOW_LAYER 1 + #define EYE_GLOW_LAYER 1 #define BEAM_PROJECTILE_LAYER 2 #define SUPERMATTER_WALL_LAYER 3 #define LIGHTNING_LAYER 4 @@ -191,8 +191,6 @@ #define DEFAULT_RENDERER_APPEARANCE_FLAGS (PLANE_MASTER | NO_CLIENT_COLOR) -/atom/appearance_flags = DEFAULT_APPEARANCE_FLAGS -/atom/movable/appearance_flags = DEFAULT_APPEARANCE_FLAGS | TILE_BOUND // Most AMs are not visibly bigger than a tile. /image/appearance_flags = DEFAULT_APPEARANCE_FLAGS /mutable_appearance/appearance_flags = DEFAULT_APPEARANCE_FLAGS // Inherits /image but re docs, subject to change diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index 55c2b092fe1..deaf2fdadc2 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -12,6 +12,8 @@ var/update_icon_on_init = FALSE // Default to 'no'. layer = TURF_LAYER + appearance_flags = DEFAULT_APPEARANCE_FLAGS + var/level = 2 var/atom_flags = 0 var/init_flags = 0 diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index a593d364af7..e392d9b7230 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -2,6 +2,7 @@ layer = OBJ_LAYER glide_size = 6 animate_movement = SLIDE_STEPS + appearance_flags = DEFAULT_APPEARANCE_FLAGS | TILE_BOUND var/last_move = null var/anchored = 0 diff --git a/code/game/machinery/rotating_alarm.dm b/code/game/machinery/rotating_alarm.dm new file mode 100644 index 00000000000..9d0149ffa19 --- /dev/null +++ b/code/game/machinery/rotating_alarm.dm @@ -0,0 +1,120 @@ +/obj/spinning_light + var/spin_rate = 1 SECOND + var/_size = 48 + var/_factor = 0.5 + var/_density = 4 + var/_offset = 30 + var/_color = COLOR_ORANGE + alpha = 200 + plane = EFFECTS_ABOVE_LIGHTING_PLANE + layer = EYE_GLOW_LAYER + mouse_opacity = 0 + + +/obj/spinning_light/Initialize(mapload, size = 48, color = COLOR_ORANGE, density = 4, factor = 0.5, offset = 30, spin_rate = 1 SECOND) + . = ..() + src._size = size + src._color = color + src._density = density + src._factor = factor + src._offset = offset + src.spin_rate = spin_rate + + set_color(_color) + + //Rays start rotated which made synchronizing the scaling a bit difficult, so let's move it 45 degrees + var matrix/m = new + var/matrix/test = new + test.Turn(-45) + var/matrix/squished = new + squished.Scale(1, 0.5) + animate(src, transform = test * m.Turn(90), spin_rate / 4, loop = -1) + animate(transform = test * m.Turn(90), spin_rate / 4, loop = -1) + animate(transform = test * m.Turn(90), spin_rate / 4, loop = -1) + animate(transform = test * matrix(), spin_rate / 4, loop = -1) + + +/obj/spinning_light/proc/set_color(_color) + filters = filter(type="rays", size = _size, color = _color, factor = _factor, density = _density, flags = FILTER_OVERLAY, offset = _offset) + + +/obj/machinery/rotating_alarm + name = "industrial alarm" + desc = "An industrial rotating alarm light." + icon = 'icons/obj/structure/rotating_alarm.dmi' + icon_state = "alarm" + idle_power_usage = 0 + active_power_usage = 0 + anchored = TRUE + + var/on = FALSE + var/construct_type = /obj/machinery/light_construct + + var/obj/spinning_light/spin_effect = null + + var/alarm_light_color = COLOR_ORANGE + /// This is an angle to rotate the colour of alarm and its light. Default is orange, so, a 45 degree angle clockwise will make it green + var/angle = 0 + + var/static/list/spinning_lights_cache = list() + + +/obj/machinery/rotating_alarm/Initialize() + . = ..() + + //Setup colour + var/list/color_matrix = color_rotation(angle) + + color = color_matrix + + set_color(alarm_light_color) + + set_dir(dir) //Set dir again so offsets update correctly + +/obj/machinery/rotating_alarm/Destroy() + QDEL_NULL(spin_effect) + QDEL_LIST_ASSOC_VAL(spinning_lights_cache) + + . = ..() + + +/obj/machinery/rotating_alarm/set_dir(ndir) //Due to effect, offsets cannot be part of sprite, so need to set it for each dir + . = ..() + if(dir == NORTH) + pixel_y = -13 + if(dir == SOUTH) + pixel_y = 28 + if(dir == WEST) + pixel_x = 20 + if(dir == EAST) + pixel_x = -20 + + +/obj/machinery/rotating_alarm/proc/set_color(color) + if(on) + vis_contents -= spin_effect + + if(isnull(spinning_lights_cache["[color]"])) + spinning_lights_cache["[color]"] = new /obj/spinning_light() + spin_effect = spinning_lights_cache["[color]"] + spin_effect.set_color(color) + + alarm_light_color = color + var/HSV = RGBtoHSV(alarm_light_color) + var/RGB = HSVtoRGB(RotateHue(HSV, angle)) + alarm_light_color = RGB + + if(on) + vis_contents += spin_effect + + +/obj/machinery/rotating_alarm/proc/set_on() + vis_contents += spin_effect + set_light(2, 0.5, alarm_light_color) + on = TRUE + + +/obj/machinery/rotating_alarm/proc/set_off() + vis_contents -= spin_effect + set_light(0) + on = FALSE diff --git a/code/modules/heavy_vehicle/components/frame.dm b/code/modules/heavy_vehicle/components/frame.dm index da43cb0f67f..0f415e69209 100644 --- a/code/modules/heavy_vehicle/components/frame.dm +++ b/code/modules/heavy_vehicle/components/frame.dm @@ -97,7 +97,7 @@ density = FALSE if(head) AddOverlays(get_mech_image("[head.icon_state]", head.on_mech_icon, head.color, MECH_HEAD_LAYER)) - AddOverlays(get_mech_image("[head.icon_state]_eyes", head.on_mech_icon, null, EYEGLOW_LAYER)) + AddOverlays(get_mech_image("[head.icon_state]_eyes", head.on_mech_icon, null, EYE_GLOW_LAYER)) if(arms) AddOverlays(get_mech_image(arms.icon_state, arms.on_mech_icon, arms.color, MECH_ARM_LAYER)) if(legs) diff --git a/code/modules/heavy_vehicle/mech_icon.dm b/code/modules/heavy_vehicle/mech_icon.dm index 275f9806363..cff272a0425 100644 --- a/code/modules/heavy_vehicle/mech_icon.dm +++ b/code/modules/heavy_vehicle/mech_icon.dm @@ -30,7 +30,7 @@ GLOBAL_LIST_EMPTY(mecha_icon_cache) new_overlays += get_mech_image("[body.icon_state]_overlay[hatch_closed ? "" : "_open"]", body.on_mech_icon, body.color, MECH_COCKPIT_LAYER) if(head) new_overlays += get_mech_image("[head.icon_state]", head.on_mech_icon, head.color, MECH_HEAD_LAYER) - new_overlays += get_mech_image("[head.icon_state]_eyes", head.on_mech_icon, null, EYEGLOW_LAYER) + new_overlays += get_mech_image("[head.icon_state]_eyes", head.on_mech_icon, null, EYE_GLOW_LAYER) if(arms) new_overlays += get_mech_image(arms.icon_state, arms.on_mech_icon, arms.color, MECH_ARM_LAYER) if(legs) diff --git a/html/changelogs/fluffyghost-rotatingalarmlights.yml b/html/changelogs/fluffyghost-rotatingalarmlights.yml new file mode 100644 index 00000000000..85ecc9ea988 --- /dev/null +++ b/html/changelogs/fluffyghost-rotatingalarmlights.yml @@ -0,0 +1,59 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added rotating alarm lights, ported (with modifications) from Baystation 12." + - code_imp: "Cleaned up some code around visual flags and renamed one layer to align with bay's name." diff --git a/icons/obj/structure/rotating_alarm.dmi b/icons/obj/structure/rotating_alarm.dmi new file mode 100644 index 00000000000..a0e610de8da Binary files /dev/null and b/icons/obj/structure/rotating_alarm.dmi differ