mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
Finishes carnmc's shuttle rotation feature.
Under carn shuttles, When shuttles dock at a docking port that is not the same direction as them, they rotate their bounding box, and they do magic i don't understand to rotate where the turfs get placed. But it doesn't rotate the items or smoothwall or handle pixel_xy or any of that. This fixes that. Shuttle rotation will call /atom/proc/shuttleRotate(degrees) Default behavior handles most cases, and overrides handle edge cases. Shuttle walls don't smooth wall or obey directions, so I just rotate their icon using matrix transform, its dirty but it works. See: https://tgstation13.org/msoshit/powrightinthekisser.png or https://tgstation13.org/msoshit/fuckingshuttles.png
This commit is contained in:
@@ -22,7 +22,8 @@
|
||||
/obj/docking_port/Destroy()
|
||||
return QDEL_HINT_LETMELIVE
|
||||
|
||||
|
||||
/obj/docking_port/shuttleRotate()
|
||||
return //we don't rotate with shuttles via this code.
|
||||
//returns a list(x0,y0, x1,y1) where points 0 and 1 are bounding corners of the projected rectangle
|
||||
/obj/docking_port/proc/return_coords(_x, _y, _dir)
|
||||
if(!_dir)
|
||||
@@ -267,6 +268,22 @@
|
||||
else
|
||||
WARNING("shuttle \"[id]\" could not enter transit space. S0=[S0 ? S0.id : "null"] S1=[S1 ? S1.id : "null"]")
|
||||
|
||||
//default shuttleRotate
|
||||
/atom/proc/shuttleRotate(rotation)
|
||||
dir = getDirFromRotation(rotation, dir)
|
||||
|
||||
//we need to rotate the pixel offsets too.
|
||||
if (pixel_x || pixel_y)
|
||||
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))
|
||||
|
||||
|
||||
|
||||
//this is the main proc. It instantly moves our mobile port to stationary port S1
|
||||
//it handles all the generic behaviour, such as sanity checks, closing doors on the shuttle, stunning mobs, etc
|
||||
/obj/docking_port/mobile/proc/dock(obj/docking_port/stationary/S1)
|
||||
@@ -315,6 +332,18 @@
|
||||
if(!T1)
|
||||
continue
|
||||
|
||||
|
||||
//lighting stuff
|
||||
T1.redraw_lighting()
|
||||
SSair.remove_from_active(T1)
|
||||
T1.CalculateAdjacentTurfs()
|
||||
SSair.add_to_active(T1,1)
|
||||
|
||||
T0.redraw_lighting()
|
||||
SSair.remove_from_active(T0)
|
||||
T0.CalculateAdjacentTurfs()
|
||||
SSair.add_to_active(T0,1)
|
||||
|
||||
T0.copyTurf(T1)
|
||||
areaInstance.contents += T1
|
||||
|
||||
@@ -324,54 +353,49 @@
|
||||
Ts1.copy_air_with_tile(T0)
|
||||
|
||||
//move mobile to new location
|
||||
loc = S1.loc
|
||||
dir = S1.dir
|
||||
|
||||
//move all objects
|
||||
for(var/obj/O in T0)
|
||||
if(O.invisibility >= 101)
|
||||
continue
|
||||
if(O == T0.lighting_object)
|
||||
continue
|
||||
O.loc = T1
|
||||
|
||||
//close open doors
|
||||
if(istype(O, /obj/machinery/door))
|
||||
var/obj/machinery/door/Door = O
|
||||
spawn(-1)
|
||||
if(Door)
|
||||
Door.close()
|
||||
|
||||
for(var/mob/M in T0)
|
||||
if(!M.move_on_shuttle)
|
||||
continue
|
||||
M.loc = T1
|
||||
for(var/atom/movable/AM in T0)
|
||||
if (dir != S1.dir)
|
||||
AM.shuttleRotate(getRotationFromDirs(dir,S1.dir))
|
||||
|
||||
//docking turbulence
|
||||
if(M.client)
|
||||
spawn(0)
|
||||
if(M.buckled)
|
||||
shake_camera(M, 2, 1) // turn it down a bit come on
|
||||
else
|
||||
shake_camera(M, 7, 1)
|
||||
if(istype(M, /mob/living/carbon))
|
||||
if(!M.buckled)
|
||||
M.Weaken(3)
|
||||
if (istype(AM,/obj))
|
||||
var/obj/O = AM
|
||||
if(O.invisibility >= 101)
|
||||
continue
|
||||
if(O == T0.lighting_object)
|
||||
continue
|
||||
O.loc = T1
|
||||
|
||||
//close open doors
|
||||
if(istype(O, /obj/machinery/door))
|
||||
var/obj/machinery/door/Door = O
|
||||
spawn(-1)
|
||||
if(Door)
|
||||
Door.close()
|
||||
else if (istype(AM,/mob))
|
||||
var/mob/M = AM
|
||||
if(!M.move_on_shuttle)
|
||||
continue
|
||||
M.loc = T1
|
||||
|
||||
//docking turbulence
|
||||
if(M.client)
|
||||
spawn(0)
|
||||
if(M.buckled)
|
||||
shake_camera(M, 2, 1) // turn it down a bit come on
|
||||
else
|
||||
shake_camera(M, 7, 1)
|
||||
if(istype(M, /mob/living/carbon))
|
||||
if(!M.buckled)
|
||||
M.Weaken(3)
|
||||
|
||||
T0.ChangeTurf(turf_type)
|
||||
|
||||
//air system updates
|
||||
for(var/turf/T1 in L1)
|
||||
T1.redraw_lighting()
|
||||
SSair.remove_from_active(T1)
|
||||
T1.CalculateAdjacentTurfs()
|
||||
SSair.add_to_active(T1,1)
|
||||
|
||||
for(var/turf/T0 in L0)
|
||||
T0.redraw_lighting()
|
||||
SSair.remove_from_active(T0)
|
||||
T0.CalculateAdjacentTurfs()
|
||||
SSair.add_to_active(T0,1)
|
||||
if (dir != S1.dir)
|
||||
T1.shuttleRotate(getRotationFromDirs(dir,S1.dir))
|
||||
loc = S1.loc
|
||||
dir = S1.dir
|
||||
|
||||
/*
|
||||
if(istype(S1, /obj/docking_port/stationary/transit))
|
||||
@@ -381,6 +405,8 @@
|
||||
T.update_icon()
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/obj/docking_port/mobile/proc/findTransitDock()
|
||||
var/obj/docking_port/stationary/transit/T = SSshuttle.getDock("[id]_transit")
|
||||
if(T && !canDock(T))
|
||||
|
||||
Reference in New Issue
Block a user