diff --git a/code/modules/power/lights.dm b/code/modules/power/lights.dm index 45ab146314e..7ec61ee123d 100644 --- a/code/modules/power/lights.dm +++ b/code/modules/power/lights.dm @@ -38,23 +38,14 @@ /obj/machinery/light_construct/Initialize(mapload, ndir, building) . = ..() - switch(dir) - if(NORTH) - pixel_x = 0 - pixel_y = 20 - if(SOUTH) - pixel_x = 0 - pixel_y = 0 - if(EAST) - pixel_x = 8 - pixel_y = 4 - if(WEST) - pixel_x = -8 - pixel_y = 4 + offset_by_dir() update_icon(UPDATE_ICON_STATE) /obj/machinery/light_construct/setDir(newdir) . = ..() + offset_by_dir() + +/obj/machinery/light_construct/proc/offset_by_dir() switch(dir) if(NORTH) pixel_x = 0 @@ -216,6 +207,9 @@ sheets_refunded = 3 construct_type = /obj/machinery/light/floor/built +/obj/machinery/light_construct/floor/offset_by_dir() + return + /obj/machinery/light_construct/clockwork/small name = "small brass light fixture frame" desc = "A small brass light fixture under construction." @@ -234,6 +228,9 @@ sheets_refunded = 3 construct_type = /obj/machinery/light/clockwork/floor/built +/obj/machinery/light_construct/clockwork/floor/offset_by_dir() + return + #undef LIGHT_CONSTRUCT_EMPTY_FRAME #undef LIGHT_CONSTRUCT_WIRED #undef LIGHT_CONSTRUCT_COMPLETED @@ -407,19 +404,7 @@ if(A && !A.requires_power) on = TRUE - switch(dir) - if(NORTH) - pixel_x = 0 - pixel_y = 20 - if(SOUTH) - pixel_x = 0 - pixel_y = 0 - if(EAST) - pixel_x = 8 - pixel_y = 4 - if(WEST) - pixel_x = -8 - pixel_y = 4 + offset_by_dir() switch(base_state) if("tube") @@ -441,6 +426,27 @@ if(A.area_nightlight_color) nightshift_light_color = A.area_nightlight_color +/obj/machinery/light/proc/offset_by_dir() + switch(dir) + if(NORTH) + pixel_x = 0 + pixel_y = 20 + if(SOUTH) + pixel_x = 0 + pixel_y = 0 + if(EAST) + pixel_x = 8 + pixel_y = 4 + if(WEST) + pixel_x = -8 + pixel_y = 4 + +/obj/machinery/light/floor/offset_by_dir() + return + +/obj/machinery/light/clockwork/floor/offset_by_dir() + return + /obj/machinery/light/proc/on_security_level_change_planned(datum/source, previous_level_number, new_level_number) SIGNAL_HANDLER @@ -1034,19 +1040,7 @@ /obj/machinery/light/setDir(newdir) . = ..() - switch(dir) - if(NORTH) - pixel_x = 0 - pixel_y = 20 - if(SOUTH) - pixel_x = 0 - pixel_y = 0 - if(EAST) - pixel_x = 8 - pixel_y = 4 - if(WEST) - pixel_x = -8 - pixel_y = 4 + offset_by_dir() /obj/item/light/proc/on_atom_entered(datum/source, atom/movable/entered) var/mob/living/living_entered = entered