diff --git a/code/__DEFINES/stat.dm b/code/__DEFINES/stat.dm index 06f91eb168a..b38018c0382 100644 --- a/code/__DEFINES/stat.dm +++ b/code/__DEFINES/stat.dm @@ -52,7 +52,9 @@ #define SHUTTLE_ALREADY_DOCKED "we_are_already_docked" #define SHUTTLE_SOMEONE_ELSE_DOCKED "someone_else_docked" - +// Ripples, effects that signal a shuttle's arrival +#define SHUTTLE_RIPPLE_TIME 100 +#define SHUTTLE_RIPPLE_FADEIN 50 /* Logic diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 5f01cf8e890..116ac637ac5 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -203,6 +203,17 @@ return var/time_left = timeLeft(1) + + // The emergency shuttle doesn't work like others so this + // ripple check is slightly different + if(!ripples.len && (time_left <= SHUTTLE_RIPPLE_TIME) && ((mode == SHUTTLE_CALL) || (mode == SHUTTLE_ESCAPE))) + var/destination + if(mode == SHUTTLE_CALL) + destination = shuttle_master.getDock("emergency_home") + else if(mode == SHUTTLE_ESCAPE) + destination = shuttle_master.getDock("emergency_away") + create_ripples(destination) + switch(mode) if(SHUTTLE_RECALL) if(time_left <= 0) diff --git a/code/modules/shuttle/ripple.dm b/code/modules/shuttle/ripple.dm new file mode 100644 index 00000000000..0c48a9c24bf --- /dev/null +++ b/code/modules/shuttle/ripple.dm @@ -0,0 +1,19 @@ +/obj/effect/overlay/temp/ripple + name = "hyperspace ripple" + desc = "Something is coming through hyperspace, you can see the \ + visual disturbances. It's probably best not to be on top of these \ + when whatever is tunneling comes through." + icon = 'icons/turf/floors/ripple.dmi' + icon_state = "ripple" + anchored = TRUE + density = FALSE + smooth = SMOOTH_TRUE + layer = RIPPLE_LAYER + alpha = 0 + duration = 3 * SHUTTLE_RIPPLE_TIME + mouse_opacity = 1 + +/obj/effect/overlay/temp/ripple/New() + . = ..() + smooth_icon(src) + animate(src, alpha=255, time=SHUTTLE_RIPPLE_TIME) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 6f019350217..d1f41585516 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -22,6 +22,8 @@ // All shuttle templates are timid var/timid = FALSE + var/list/ripples = list() + //these objects are indestructable /obj/docking_port/Destroy(force) if(force) @@ -378,10 +380,44 @@ qdel(src, force=TRUE) +/obj/docking_port/mobile/proc/create_ripples(obj/docking_port/stationary/S1) + var/list/turfs = ripple_area(S1) + for(var/i in turfs) + ripples += new /obj/effect/overlay/temp/ripple(i) + +/obj/docking_port/mobile/proc/remove_ripples() + if(ripples.len) + for(var/i in ripples) + qdel(i) + ripples.Cut() + + +/obj/docking_port/mobile/proc/ripple_area(obj/docking_port/stationary/S1) + 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/list/ripple_turfs = list() + + for(var/i in 1 to L0.len) + var/turf/T0 = L0[i] + if(!T0) + continue + var/turf/T1 = L1[i] + if(!T1) + continue + if(T0.type != T0.baseturf) + ripple_turfs += T1 + + return ripple_turfs + //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, force=FALSE) // Crashing this ship with NO SURVIVORS + if(S1.get_docked() == src) + remove_ripples() + return + if(!force) if(!check_dock(S1)) return -1 @@ -389,6 +425,7 @@ if(canMove()) return -1 + // //rotate transit docking ports, so we don't need zillions of variants // if(istype(S1, /obj/docking_port/stationary/transit)) // S1.dir = turn(NORTH, -travelDir) @@ -423,6 +460,9 @@ for(var/turf/T0 in L0) A0.contents += T0 + // Removes ripples + remove_ripples() + //move or squish anything in the way ship at destination roadkill(L0, L1, S1.dir) @@ -564,7 +604,10 @@ //used by shuttle subsystem to check timers /obj/docking_port/mobile/proc/check() + check_effects() + var/timeLeft = timeLeft(1) + if(timeLeft <= 0) switch(mode) if(SHUTTLE_CALL) @@ -579,6 +622,12 @@ timer = 0 destination = null +/obj/docking_port/mobile/proc/check_effects() + if(!ripples.len) + if((mode == SHUTTLE_CALL) || (mode == SHUTTLE_RECALL)) + var/tl = timeLeft(1) + if(tl <= SHUTTLE_RIPPLE_TIME) + create_ripples(destination) /obj/docking_port/mobile/proc/setTimer(wait) if(timer <= 0) diff --git a/icons/turf/floors/ripple.dmi b/icons/turf/floors/ripple.dmi new file mode 100644 index 00000000000..2830d2c4909 Binary files /dev/null and b/icons/turf/floors/ripple.dmi differ diff --git a/paradise.dme b/paradise.dme index 143543c836a..5d94ed67f86 100644 --- a/paradise.dme +++ b/paradise.dme @@ -2123,6 +2123,7 @@ #include "code\modules\shuttle\assault_pod.dm" #include "code\modules\shuttle\emergency.dm" #include "code\modules\shuttle\on_move.dm" +#include "code\modules\shuttle\ripple.dm" #include "code\modules\shuttle\shuttle.dm" #include "code\modules\shuttle\shuttle_manipulator.dm" #include "code\modules\shuttle\supply.dm"