Skip to content

Commit

Permalink
Re: Add Directional APC's sprites, reduces lines of code by adding an…
Browse files Browse the repository at this point in the history
…d using Updatepaths.txt file. (#6686)

# About the pull request

This PR add directional APC's and Updatepath.txt

standardize APC's by creating 2 separate types, normal and upgraded
variant, replace APC's with cell types: high/super/hyper with upgraded
variant with own HIGH cell type. (10000 capacity)

Edit: Add directional APC sptires made by Blundir.

Fixes: #6792
Fixes: #6312

# Explain why it's good for the game

Reduces lines of codes in mapping, i know there is already code in
apc.dm to make them have pixel_y or pixel_x offset.

Mainly issue is: in map editor they have var edited offsets, with mean
it not only override code that already exist, but also occupy more
space, with new code it should do same in exchange for less lines of
code. (i didnt remove directional code for other stuff like broken APC's
etc.)

Edit: Add directional APC's sprites for better visuals

# Testing Photographs and Procedure
New directional APC's sprites by @Blundir.

![image](https://github.com/user-attachments/assets/aeca90ef-fa07-4907-8b35-6a1eb0a334ea)

Image from Blundir:

![image](https://github.com/user-attachments/assets/5780bcf0-cb33-467e-9617-172ca6427322)



# Changelog
:cl: Venuska1117, Blundir
imageadd: add directional APC's Sprites.
balance: Now there are only 3 APC's types, APC's with call_type
high/super/hyper are replaced with upgraded APC variant containing high
capacity cell, weak variant got replaced with normal APC variant.
fix: Fixes APC's with wrong offsets (strata and Prison)
/:cl:

---------

Co-authored-by: Blundir <[email protected]>
  • Loading branch information
Venuska1117 and Blundir committed Aug 7, 2024
1 parent b51e008 commit 275837d
Show file tree
Hide file tree
Showing 52 changed files with 1,316 additions and 3,757 deletions.
151 changes: 125 additions & 26 deletions code/modules/power/apc.dm
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,13 +1357,122 @@ 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/north
pixel_y = 32
dir = 1

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

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

/obj/structure/machinery/power/apc/almayer/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

#undef APC_UPDATE_ICON_COOLDOWN
/obj/structure/machinery/power/apc/almayer/hardened/north
pixel_y = 32
dir = 1

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

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

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

//------ Directional APCs ------//

/obj/structure/machinery/power/apc/no_power
start_charge = 0

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

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

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

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

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

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

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

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

// Upgraded APC's with directions
/obj/structure/machinery/power/apc/upgraded/power
desc = "A control terminal for the area electrical systems. This one is upgraded with better power cell to sustain higher power usage."
cell_type = /obj/item/cell/high


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

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

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

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

// apc that start at zero charge.
/obj/structure/machinery/power/apc/nocharge

/obj/structure/machinery/power/apc/upgraded/no_power
start_charge = 0

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

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

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

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

#undef APC_UPDATE_ICON_COOLDOWN
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

0 comments on commit 275837d

Please sign in to comment.