Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: Add Directional APC's sprites, reduces lines of code by adding and using Updatepaths.txt file. #6686

Merged
merged 24 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 83 additions & 24 deletions code/modules/power/apc.dm
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,10 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(


//NOTE: STUFF STOLEN FROM AIRLOCK.DM thx
/obj/structure/machinery/power/apc/weak
cell_type = /obj/item/cell

/obj/structure/machinery/power/apc/high
cell_type = /obj/item/cell/high

/obj/structure/machinery/power/apc/super
cell_type = /obj/item/cell/super

/obj/structure/machinery/power/apc/hyper
cell_type = /obj/item/cell/hyper

/obj/structure/machinery/power/apc
name = "area power controller"
desc = "A control terminal for the area electrical systems."
icon = 'icons/obj/structures/machinery/power.dmi'
icon = 'icons/obj/structures/machinery/apc.dmi'
icon_state = "apc_mapicon"
anchored = TRUE
use_power = USE_POWER_NONE
Expand All @@ -98,7 +86,6 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
var/locked = 1
var/coverlocked = 1
var/aidisabled = 0
var/tdir = null
var/obj/structure/machinery/power/terminal/terminal = null
var/lastused_light = 0
var/lastused_equip = 0
Expand Down Expand Up @@ -137,13 +124,23 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
/obj/structure/machinery/power/apc/Initialize(mapload, ndir, building=0)
. = ..()

//Offset 24 pixels in direction of dir
//Offset apc depending on the dir
//This allows the APC to be embedded in a wall, yet still inside an area

if(building)
setDir(ndir)

set_pixel_location()
switch(dir)
if(NORTH)
pixel_y = 32
if(SOUTH)
pixel_y = -26
if(EAST)
pixel_x = 30
pixel_y = 6
if(WEST)
pixel_x = -30
pixel_y = 6

if(building == 0)
init()
Expand All @@ -161,13 +158,6 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
if(!start_charge && is_ground_level(z) && prob(10))
set_broken()

/obj/structure/machinery/power/apc/set_pixel_location()
tdir = dir //To fix Vars bug
setDir(SOUTH)

pixel_x = (tdir & 3) ? 0 : (tdir == 4 ? 24 : -24)
pixel_y = (tdir & 3) ? (tdir == 1 ? 24 : -24) : 0

/obj/structure/machinery/power/apc/Destroy()
if(terminal)
terminal.master = null
Expand Down Expand Up @@ -344,7 +334,7 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
//Create a terminal object at the same position as original turf loc
//Wires will attach to this
terminal = new/obj/structure/machinery/power/terminal(src.loc)
terminal.setDir(tdir)
terminal.setDir(dir)
terminal.master = src

/obj/structure/machinery/power/apc/proc/init()
Expand Down Expand Up @@ -1367,11 +1357,80 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
/obj/structure/machinery/power/apc/almayer
cell_type = /obj/item/cell/high

/obj/structure/machinery/power/apc/almayer/directional/north
pixel_y = 32
dir = 1

/obj/structure/machinery/power/apc/almayer/directional/south
pixel_y = -26
dir = 2

/obj/structure/machinery/power/apc/almayer/directional/east
pixel_x = 30
dir = 4

/obj/structure/machinery/power/apc/almayer/directional/west
pixel_x = -30
dir = 8

/obj/structure/machinery/power/apc/almayer/hardened
name = "hardened area power controller"
desc = "A control terminal for the area electrical systems. This one is hardened against sudden power fluctuations caused by electrical grid damage."
crash_break_probability = 0

/obj/structure/machinery/power/apc/almayer/hardened/directional/north
pixel_y = 32
dir = 1

/obj/structure/machinery/power/apc/almayer/hardened/directional/south
pixel_y = -26
dir = 2

/obj/structure/machinery/power/apc/almayer/hardened/directional/east
pixel_x = 30
dir = 4

/obj/structure/machinery/power/apc/almayer/hardened/directional/west
pixel_x = -30
dir = 8

//------ Directional APCs ------//
/obj/structure/machinery/power/apc/directional/no_power
start_charge = 0

/obj/structure/machinery/power/apc/directional/no_power/north
pixel_y = 32
dir = 1

/obj/structure/machinery/power/apc/directional/no_power/south
pixel_y = -26
dir = 2

/obj/structure/machinery/power/apc/directional/no_power/east
pixel_x = 30
dir = 4

/obj/structure/machinery/power/apc/directional/no_power/west
pixel_x = -30
dir = 8

// Powered APCs with directions
/obj/structure/machinery/power/apc/directional/power/north
pixel_y = 32
dir = 1

/obj/structure/machinery/power/apc/directional/power/south
pixel_y = -26
dir = 2

/obj/structure/machinery/power/apc/directional/power/east
pixel_x = 30
dir = 4

/obj/structure/machinery/power/apc/directional/power/west
pixel_x = -30
dir = 8

#undef APC_UPDATE_ICON_COOLDOWN

// apc that start at zero charge.
Expand Down
Binary file added icons/obj/structures/machinery/apc.dmi
Binary file not shown.
Binary file modified icons/obj/structures/machinery/power.dmi
Binary file not shown.
Loading
Loading