fancy gateway

This commit is contained in:
SandPoot
2021-05-02 18:57:04 -03:00
parent 0c803e0232
commit 8f3a44f44a
4 changed files with 51 additions and 13 deletions
+49 -13
View File
@@ -4,10 +4,10 @@ GLOBAL_DATUM(the_gateway, /obj/machinery/gateway/centerstation)
GLOBAL_LIST_EMPTY(gateway_destinations)
/**
* Corresponds to single entry in gateway control.
*
* Will NOT be added automatically to GLOB.gateway_destinations list.
*/
* Corresponds to single entry in gateway control.
*
* Will NOT be added automatically to GLOB.gateway_destinations list.
*/
/datum/gateway_destination
var/name = "Unknown Destination"
var/wait = 0 /// How long after roundstart this destination becomes active
@@ -85,7 +85,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
. = "Exit gateway unpowered."
/datum/gateway_destination/gateway/get_target_turf()
return get_step(target_gateway.portal,SOUTH)
return get_step(target_gateway, SOUTH)
/datum/gateway_destination/gateway/post_transfer(atom/movable/AM)
. = ..()
@@ -144,7 +144,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
name = "gateway"
desc = "A mysterious gateway built by unknown hands, it allows for faster than light travel to far-flung locations."
icon = 'icons/obj/machines/gateway.dmi'
icon_state = "off"
icon_state = "portal_frame"
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
// 3x2 offset by one row
@@ -171,10 +171,14 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
var/datum/gateway_destination/target
/// bumper object, the thing that starts actual teleport
var/obj/effect/gateway_portal_bumper/portal
/// Visual object for handling the viscontents
var/obj/effect/gateway_portal_effect/portal_visuals
/obj/machinery/gateway/Initialize()
generate_destination()
update_icon()
portal_visuals = new
vis_contents += portal_visuals
return ..()
/obj/machinery/gateway/proc/generate_destination()
@@ -191,6 +195,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
if(use_power == ACTIVE_POWER_USE)
use_power = IDLE_POWER_USE
update_icon()
portal_visuals.reset_visuals()
/obj/machinery/gateway/process()
if((stat & (NOPOWER)) && use_power)
@@ -198,12 +203,6 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
deactivate()
return
/obj/machinery/gateway/update_icon_state()
if(target)
icon_state = "on"
else
icon_state = "off"
/obj/machinery/gateway/safe_throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = MOVE_FORCE_STRONG, gentle = FALSE)
return
@@ -216,6 +215,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
return
target = D
target.activate(destination)
portal_visuals.setup_visuals(target)
generate_bumper()
use_power = ACTIVE_POWER_USE
update_icon()
@@ -307,7 +307,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
try_to_connect(D)
return TRUE
if("deactivate")
if(G && G.target)
if(G?.target)
G.deactivate()
return TRUE
@@ -324,3 +324,39 @@ GLOBAL_LIST_EMPTY(gateway_destinations)
/obj/item/paper/fluff/gateway
info = "Congratulations,<br><br>Your station has been selected to carry out the Gateway Project.<br><br>The equipment will be shipped to you at the start of the next quarter.<br> You are to prepare a secure location to house the equipment as outlined in the attached documents.<br><br>--Nanotrasen Bluespace Research"
name = "Confidential Correspondence, Pg 1"
/obj/effect/gateway_portal_effect
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
vis_flags = VIS_INHERIT_ID
layer = GATEWAY_UNDERLAY_LAYER //Slightly lower than gateway itself
var/alpha_icon = 'icons/obj/machines/gateway.dmi'
var/alpha_icon_state = "portal_mask"
var/datum/gateway_destination/our_destination
/obj/effect/gateway_portal_effect/proc/setup_visuals(datum/gateway_destination/D)
our_destination = D
update_portal_filters()
/obj/effect/gateway_portal_effect/proc/reset_visuals()
our_destination = null
update_portal_filters()
/obj/effect/gateway_portal_effect/proc/update_portal_filters()
clear_filters()
vis_contents = null
if(!our_destination)
return
add_filter("portal_alpha", 1, list("type" = "alpha", "icon" = icon(alpha_icon, alpha_icon_state), "x" = 32, "y" = 32))
add_filter("portal_blur", 1, list("type" = "blur", "size" = 0.5))
add_filter("portal_ripple", 1, list("type" = "ripple", "size" = 2, "radius" = 1, "falloff" = 1, "y" = 7))
animate(get_filter("portal_ripple"), time = 1.3 SECONDS, loop = -1, easing = LINEAR_EASING, radius = 32)
var/turf/center_turf = our_destination.get_target_turf()
vis_contents += block(locate(center_turf.x - 1, center_turf.y - 1, center_turf.z), locate(center_turf.x + 1, center_turf.y + 1, center_turf.z))
+1
View File
@@ -10,6 +10,7 @@
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
layer = LIGHTING_LAYER
invisibility = INVISIBILITY_LIGHTING
vis_flags = VIS_HIDE
var/needs_update = FALSE
var/turf/myturf