Files
Bubberstation/code/modules/shuttle/shuttle_rotate.dm
Rob Bailey 65e9888fa6 [READY] Smart Cables (#44265)
Cables now autoconnect on cardinal directions. All cable placement has been completely stripped out and replaced with simple single cable per tile logic.
Low effort demo: https://www.youtube.com/watch?v=fXp8s6ORWbA
Yes I am aware that cutting it is not dropping wire, that version was bugged.
Cables no longer need a knot specifically placed to link to power objects. The sprite is automatically changed to represent this.
The only exception to this logic is that on smes units, due to the terminal being next to the output, they will not link there.
On a technical powernet side, this is the same as old cables once actually placed. They still use the existing powernet system, just the placement and connection works differently.

Old cables have been turned into "pipe cleaners" for wire art purposes. they work just like the old ones, just missing all the powernet functionality, and also you can put them on top of the floor.
Why It's Good For The Game

How obnoxious cables were to both map and work with in game has been something that has annoyed me for a really long time now.
This is both easier for new players to learn, and easier for experienced players to work with.
Along with making in game much more intuitive and easier, it makes mapping much easier as well. Mad lad wjohn was able to rip out all the mapping conversion in one day because of how much faster it is to work with.

cl actioninja and wjohn
add: Cables have been completely reworked. Simple per tile connection logic, automatically connects to things above it. Think minecraft redstone.
add: Old cables have been kept as pipe cleaner. They are non-functional in terms of power, but otherwise have the same connection logic. Also can go on top of tiles.
remove: mech cable layer has been removed because it was terrible shitcode nobody used
tweak: (sort of balance) cable stack sized has been reduced to 15.
/cl
2019-06-22 10:24:37 +12:00

104 lines
3.2 KiB
Plaintext

/*
All shuttleRotate procs go here
If ever any of these procs are useful for non-shuttles, rename it to proc/rotate and move it to be a generic atom proc
*/
/************************************Base proc************************************/
/atom/proc/shuttleRotate(rotation, params=ROTATE_DIR|ROTATE_SMOOTH|ROTATE_OFFSET)
if(params & ROTATE_DIR)
//rotate our direction
setDir(angle2dir(rotation+dir2angle(dir)))
//resmooth if need be.
if(smooth && (params & ROTATE_SMOOTH))
queue_smooth(src)
//rotate the pixel offsets too.
if((pixel_x || pixel_y) && (params & ROTATE_OFFSET))
if(rotation < 0)
rotation += 360
for(var/turntimes=rotation/90;turntimes>0;turntimes--)
var/oldPX = pixel_x
var/oldPY = pixel_y
pixel_x = oldPY
pixel_y = (oldPX*(-1))
/************************************Turf rotate procs************************************/
/turf/closed/mineral/shuttleRotate(rotation, params)
params &= ~ROTATE_OFFSET
return ..()
/************************************Mob rotate procs************************************/
//override to avoid rotating pixel_xy on mobs
/mob/shuttleRotate(rotation, params)
params = NONE
. = ..()
if(!buckled)
setDir(angle2dir(rotation+dir2angle(dir)))
/mob/dead/observer/shuttleRotate(rotation, params)
. = ..()
update_icon()
/************************************Structure rotate procs************************************/
//Fixes dpdir on shuttle rotation
/obj/structure/disposalpipe/shuttleRotate(rotation, params)
. = ..()
var/new_dpdir = 0
for(var/D in GLOB.cardinals)
if(dpdir & D)
new_dpdir = new_dpdir | angle2dir(rotation+dir2angle(D))
dpdir = new_dpdir
/obj/structure/table/wood/bar/shuttleRotate(rotation, params)
. = ..()
boot_dir = angle2dir(rotation + dir2angle(boot_dir))
/obj/structure/alien/weeds/shuttleRotate(rotation, params)
params &= ~ROTATE_OFFSET
return ..()
/************************************Machine rotate procs************************************/
/obj/machinery/atmospherics/shuttleRotate(rotation, params)
var/list/real_node_connect = getNodeConnects()
for(var/i in 1 to device_type)
real_node_connect[i] = angle2dir(rotation+dir2angle(real_node_connect[i]))
. = ..()
SetInitDirections()
var/list/supposed_node_connect = getNodeConnects()
var/list/nodes_copy = nodes.Copy()
for(var/i in 1 to device_type)
var/new_pos = supposed_node_connect.Find(real_node_connect[i])
nodes[new_pos] = nodes_copy[i]
//prevents shuttles attempting to rotate this since it messes up sprites
/obj/machinery/gateway/shuttleRotate(rotation, params)
params = NONE
return ..()
//prevents shuttles attempting to rotate this since it messes up sprites
/obj/machinery/gravity_generator/shuttleRotate(rotation, params)
params = NONE
return ..()
/obj/machinery/door/airlock/shuttleRotate(rotation, params)
. = ..()
if(cyclelinkeddir && (params & ROTATE_DIR))
cyclelinkeddir = angle2dir(rotation+dir2angle(cyclelinkeddir))
// If we update the linked airlock here, the partner airlock might
// not be present yet, so don't do that. Just assume we're still
// partnered with the same airlock as before.
/obj/machinery/porta_turret/shuttleRotate(rotation, params)
. = ..()
if(wall_turret_direction && (params & ROTATE_DIR))
wall_turret_direction = turn(wall_turret_direction,rotation)