mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
Merge pull request #10699 from MrStonedOne/shuttlerotationstation
Finishes carnmc's shuttle rotation feature.
This commit is contained in:
@@ -379,3 +379,4 @@
|
||||
var/dest_y = src_y + distance*cos(rotation);
|
||||
|
||||
return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y)
|
||||
|
||||
|
||||
@@ -62,4 +62,15 @@
|
||||
T.color = color
|
||||
if(T.dir != dir)
|
||||
T.dir = dir
|
||||
return T
|
||||
T.transform = transform
|
||||
return T
|
||||
|
||||
/turf/simulated/wall/shuttle/copyTurf(turf/T)
|
||||
. = ..()
|
||||
T.transform = transform
|
||||
|
||||
//why don't shuttle walls habe smoothwall? now i gotta do rotation the dirty way
|
||||
/turf/simulated/wall/shuttle/shuttleRotate(rotation)
|
||||
var/matrix/M = transform
|
||||
M.Turn(rotation)
|
||||
transform = M
|
||||
@@ -21,7 +21,9 @@
|
||||
return
|
||||
icon_state = "off"
|
||||
|
||||
|
||||
//prevents shuttles attempting to rotate this since it messes up sprites
|
||||
/obj/machinery/gateway/shuttleRotate()
|
||||
return
|
||||
|
||||
//this is da important part wot makes things go
|
||||
/obj/machinery/gateway/centerstation
|
||||
|
||||
@@ -963,4 +963,8 @@ var/list/slot_equipment_priority = list( \
|
||||
spell.action.background_icon_state = spell.action_background_icon_state
|
||||
if(isliving(src))
|
||||
spell.action.Grant(src)
|
||||
return
|
||||
return
|
||||
|
||||
//override to avoid rotating pixel_xy on mobs
|
||||
/mob/shuttleRotate(rotation)
|
||||
dir = angle2dir(rotation+dir2angle(dir))
|
||||
@@ -36,6 +36,10 @@ var/const/GRAV_NEEDS_WRENCH = 3
|
||||
..()
|
||||
icon_state = "[get_status()]_[sprite_number]"
|
||||
|
||||
//prevents shuttles attempting to rotate this since it messes up sprites
|
||||
/obj/machinery/gravity_generator/shuttleRotate()
|
||||
return
|
||||
|
||||
/obj/machinery/gravity_generator/proc/get_status()
|
||||
return "off"
|
||||
|
||||
|
||||
@@ -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,27 @@
|
||||
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)
|
||||
//rotate our direction
|
||||
dir = angle2dir(rotation+dir2angle(dir))
|
||||
|
||||
//resmooth if need be.
|
||||
if(smooth)
|
||||
smooth_icon(src)
|
||||
|
||||
//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)
|
||||
@@ -296,6 +318,13 @@
|
||||
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
|
||||
var/list/L1 = return_ordered_turfs(S1.x, S1.y, S1.z, S1.dir)
|
||||
|
||||
var/rotation = dir2angle(S1.dir)-dir2angle(dir)
|
||||
if ((rotation % 90) != 0)
|
||||
rotation += (rotation % 90) //diagonal rotations not allowed, round up
|
||||
rotation = SimplifyDegrees(rotation)
|
||||
|
||||
|
||||
|
||||
//remove area surrounding docking port
|
||||
if(areaInstance.contents.len)
|
||||
var/area/A0 = locate("[area_type]")
|
||||
@@ -315,6 +344,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 +365,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 (rotation)
|
||||
AM.shuttleRotate(rotation)
|
||||
|
||||
//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 (rotation)
|
||||
T1.shuttleRotate(rotation)
|
||||
loc = S1.loc
|
||||
dir = S1.dir
|
||||
|
||||
/*
|
||||
if(istype(S1, /obj/docking_port/stationary/transit))
|
||||
@@ -381,6 +417,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