diff --git a/code/modules/power/apc/apc.dm b/code/modules/power/apc/apc.dm index b65ce8723db..ef8460035db 100644 --- a/code/modules/power/apc/apc.dm +++ b/code/modules/power/apc/apc.dm @@ -132,29 +132,6 @@ var/global/list/status_overlays_environ var/keep_preset_name = FALSE -/obj/machinery/power/apc/New(turf/loc, direction, building = 0) - if(!armor) - armor = list(MELEE = 20, BULLET = 20, LASER = 10, ENERGY = 100, BOMB = 30, RAD = 100, FIRE = 90, ACID = 50) - ..() - GLOB.apcs += src - - wires = new(src) - - if(building) - // Offset 24 pixels in direction of dir. This allows the APC to be embedded in a wall, yet still inside an area - setDir(direction) // This is only used for pixel offsets, and later terminal placement. APC dir doesn't affect its sprite since it only has one orientation. - set_pixel_offsets_from_dir(24, -24, 24, -24) - - apc_area = get_area(src) - apc_area.apc += src - opened = APC_OPENED - operating = FALSE - name = "[apc_area.name] APC" - stat |= MAINT - constructed = TRUE - update_icon() - addtimer(CALLBACK(src, PROC_REF(update)), 5) - /obj/machinery/power/apc/Destroy() SStgui.close_uis(wires) GLOB.apcs -= src @@ -173,11 +150,13 @@ apc_area.apc -= src return ..() - - -/obj/machinery/power/apc/Initialize(mapload) +/obj/machinery/power/apc/Initialize(mapload, direction, building = FALSE) . = ..() + if(!armor) + armor = list(MELEE = 20, BULLET = 20, LASER = 10, ENERGY = 100, BOMB = 30, RAD = 100, FIRE = 90, ACID = 50) + GLOB.apcs += src + wires = new(src) var/area/A = get_area(src) if(A.powernet && !A.powernet.powernet_apc) @@ -185,16 +164,7 @@ if(!mapload) GLOB.apcs = sortAtom(GLOB.apcs) - return - electronics_state = APC_ELECTRONICS_INSTALLED - // is starting with a power cell installed, create it and set its charge level - if(cell_type) - cell = new /obj/item/stock_parts/cell(src) - cell.maxcharge = cell_type // cell_type is maximum charge (old default was 1000 or 2500 (values one and two respectively) - cell.charge = start_charge * cell.maxcharge / 100 // (convert percentage to actual value) - - //if area isn't specified use current if(keep_preset_name) if(isarea(A)) apc_area = A @@ -204,14 +174,29 @@ name = "\improper [apc_area.name] APC" else name = "\improper [get_area_name(apc_area, TRUE)] APC" + + if(building) + // Offset 24 pixels in direction of dir. This allows the APC to be embedded in a wall, yet still inside an area + setDir(direction) // This is only used for pixel offsets, and later terminal placement. APC dir doesn't affect its sprite since it only has one orientation. + set_pixel_offsets_from_dir(24, -24, 24, -24) + + opened = APC_OPENED + operating = FALSE + stat |= MAINT + constructed = TRUE + else + electronics_state = APC_ELECTRONICS_INSTALLED + // is starting with a power cell installed, create it and set its charge level + if(cell_type) + cell = new /obj/item/stock_parts/cell(src) + cell.maxcharge = cell_type // cell_type is maximum charge (old default was 1000 or 2500 (values one and two respectively) + cell.charge = start_charge * cell.maxcharge / 100 // (convert percentage to actual value) + make_terminal() + set_light(1, LIGHTING_MINIMUM_POWER) + + //if area isn't specified use current apc_area.apc |= src - update_icon() - - make_terminal() - - set_light(1, LIGHTING_MINIMUM_POWER) - addtimer(CALLBACK(src, PROC_REF(update)), 5) /obj/machinery/power/apc/examine(mob/user) diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index c3fd38a69c5..761eb8001d3 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -28,8 +28,8 @@ /obj/item/stock_parts/cell/get_cell() return src -/obj/item/stock_parts/cell/New() - ..() +/obj/item/stock_parts/cell/Initialize(mapload) + . = ..() START_PROCESSING(SSobj, src) charge = !isnull(starting_charge) ? starting_charge : maxcharge if(ratingdesc) diff --git a/code/modules/power/generators/solar.dm b/code/modules/power/generators/solar.dm index dd9b87ec4e8..663a1e15ab5 100644 --- a/code/modules/power/generators/solar.dm +++ b/code/modules/power/generators/solar.dm @@ -140,9 +140,6 @@ unset_control() update_icon(UPDATE_OVERLAYS) -/obj/machinery/power/solar/fake/New(turf/loc, obj/item/solar_assembly/S) - ..(loc, S, 0) - /obj/machinery/power/solar/fake/process() . = PROCESS_KILL return diff --git a/code/modules/power/lights.dm b/code/modules/power/lights.dm index 76709fd5dbe..9ef6334f372 100644 --- a/code/modules/power/lights.dm +++ b/code/modules/power/lights.dm @@ -998,6 +998,7 @@ COMSIG_ATOM_ENTERED = PROC_REF(on_atom_entered) ) AddElement(/datum/element/connect_loc, loc_connections) + update() /obj/item/light/proc/on_atom_entered(datum/source, atom/movable/entered) var/mob/living/living_entered = entered @@ -1064,12 +1065,6 @@ icon_state = "[base_state]-broken" desc = "A broken [name]." - -/obj/item/light/New() - ..() - update() - - // attack bulb/tube with object // if a syringe, can inject plasma to make it explode. Light replacers eat them. /obj/item/light/attackby__legacy__attackchain(obj/item/I, mob/user, params)