Skip to content

Commit

Permalink
The Powerlining (#2514)
Browse files Browse the repository at this point in the history
This PR adds power lines that can be walked on to cross gaps. They do not transmit power and are indestructible to avoid cutting off important areas.

Sprites by Conundrum.
  • Loading branch information
hyperioo authored Apr 21, 2024
1 parent 7aea7a6 commit 84433c8
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
Binary file added mojave/icons/structure/powerlines.dmi
Binary file not shown.
116 changes: 116 additions & 0 deletions mojave/structures/powerlines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/obj/structure/ms13/powerlines
name = "overhead power line"
desc = "A suspended power line made of three thick parallel wires."
icon = 'mojave/icons/structure/powerlines.dmi'
icon_state = "platrailings_full"
density = FALSE
anchored = TRUE
armor = list(MELEE = 60, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 80, ACID = 50)
max_integrity = 120
layer = LATTICE_LAYER
plane = FLOOR_PLANE
obj_flags = CAN_BE_HIT | BLOCK_Z_OUT_DOWN | BLOCK_Z_IN_UP
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/number_of_mats = 3
var/build_material = /obj/item/stack/sheet/ms13/scrap_copper

/obj/structure/ms13/powerlines/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
new build_material(get_turf(src), number_of_mats)
qdel(src)

// Power line mounts

/obj/structure/ms13/powerlines/mount/navy
icon_state = "plinemount_navy"

/obj/structure/ms13/powerlines/mount/red
icon_state = "plinemount_red"

/obj/structure/ms13/powerlines/mount/green
icon_state = "plinemount_green"

/obj/structure/ms13/powerlines/mount/blue
icon_state = "plinemount_blue"

// Power line cords

/obj/structure/ms13/powerlines/cord/Initialize(mapload)
. = ..()
// Random chance to have a visually-intact power line
if(prob(40))
icon_state = "plinecord_[pcolor]"
else
/// pdir controls which one of the three wires is damaged
var/pdir = pick(SOUTH, WEST, EAST)
if(dir == WEST || dir == EAST)
icon_state = "plinedam-hor_[pcolor]"
dir = pdir
else
icon_state = "plinedam-vert_[pcolor]"
dir = pdir

/obj/structure/ms13/powerlines/cord
icon_state = ""
var/pcolor

/obj/structure/ms13/powerlines/cord/navy
icon_state = "plinecord_navy"
pcolor = "navy"

/obj/structure/ms13/powerlines/cord/red
icon_state = "plinecord_red"
pcolor = "red"

/obj/structure/ms13/powerlines/cord/green
icon_state = "plinecord_green"
pcolor = "green"

/obj/structure/ms13/powerlines/cord/blue
icon_state = "plinecord_blue"
pcolor = "blue"

// Power line junctions

/obj/structure/ms13/powerlines/junction/Initialize(mapload)

// Adjacent connections will be spawned as overlays
icon_state = "plinejunction"

// Detecting adjacent power lines
for(var/direction in GLOB.cardinals)
var/turf/T = get_step(src, direction)
var/adjacent = locate(/obj/structure/ms13/powerlines) in T
if(adjacent)
jdir |= direction
// Update both icon and overlays
update_icon()

/obj/structure/ms13/powerlines/junction/update_overlays()
. = ..()

// Adding connection to adjacent power lines
for(var/direction in GLOB.cardinals)
if(jdir & direction)
. += image(icon, "plinecord-junction_[pcolor]", dir=REVERSE_DIR(direction))

/obj/structure/ms13/powerlines/junction
icon_state = ""
var/pcolor
var/jdir

/obj/structure/ms13/powerlines/junction/navy
icon_state = "plinejunction_navy"
pcolor = "navy"

/obj/structure/ms13/powerlines/junction/red
icon_state = "plinejunction_red"
pcolor = "red"

/obj/structure/ms13/powerlines/junction/green
icon_state = "plinejunction_green"
pcolor = "green"

/obj/structure/ms13/powerlines/junction/blue
icon_state = "plinejunction_blue"
pcolor = "blue"
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4767,6 +4767,7 @@
#include "mojave\structures\pipes.dm"
#include "mojave\structures\platform_railings.dm"
#include "mojave\structures\plumbing_decorations.dm"
#include "mojave\structures\powerlines.dm"
#include "mojave\structures\rugs.dm"
#include "mojave\structures\ruins.dm"
#include "mojave\structures\shutters.dm"
Expand Down

0 comments on commit 84433c8

Please sign in to comment.