From c512c14fb7f7da583bba35f506aa752be53ed4f0 Mon Sep 17 00:00:00 2001 From: nemvar <47324920+nemvar@users.noreply.github.com> Date: Thu, 21 Nov 2019 17:01:06 +0100 Subject: [PATCH] Portals no longer use hascall. (#47889) * Portals no longer use hascall. * noop * comment removals --- code/game/mecha/equipment/tools/other_tools.dm | 2 +- code/game/objects/effects/portals.dm | 18 +++++++----------- code/game/objects/items/teleportation.dm | 4 +++- code/modules/events/wormholes.dm | 2 +- .../modules/projectiles/guns/energy/special.dm | 3 ++- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm index b0e07ed5a7c..0fa690f621a 100644 --- a/code/game/mecha/equipment/tools/other_tools.dm +++ b/code/game/mecha/equipment/tools/other_tools.dm @@ -56,7 +56,7 @@ var/turf/target_turf = pick(L) if(!target_turf) return - var/list/obj/effect/portal/created = create_portal_pair(get_turf(src), target_turf, src, 300, 1, /obj/effect/portal/anom) + var/list/obj/effect/portal/created = create_portal_pair(get_turf(src), target_turf, 300, 1, /obj/effect/portal/anom) var/turf/T = get_turf(target) message_admins("[ADMIN_LOOKUPFLW(chassis.occupant)] used a Wormhole Generator in [ADMIN_VERBOSEJMP(T)]") log_game("[key_name(chassis.occupant)] used a Wormhole Generator in [AREACOORD(T)]") diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index 0a25bb3c854..18b96e46bf5 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -1,10 +1,10 @@ -/proc/create_portal_pair(turf/source, turf/destination, _creator = null, _lifespan = 300, accuracy = 0, newtype = /obj/effect/portal, atmos_link_override) +/proc/create_portal_pair(turf/source, turf/destination, _lifespan = 300, accuracy = 0, newtype = /obj/effect/portal, atmos_link_override) if(!istype(source) || !istype(destination)) return var/turf/actual_destination = get_teleport_turf(destination, accuracy) - var/obj/effect/portal/P1 = new newtype(source, _creator, _lifespan, null, FALSE, null, atmos_link_override) - var/obj/effect/portal/P2 = new newtype(actual_destination, _creator, _lifespan, P1, TRUE, null, atmos_link_override) + var/obj/effect/portal/P1 = new newtype(source, _lifespan, null, FALSE, null, atmos_link_override) + var/obj/effect/portal/P2 = new newtype(actual_destination, _lifespan, P1, TRUE, null, atmos_link_override) if(!istype(P1)||!istype(P2)) return P1.link_portal(P2) @@ -21,7 +21,6 @@ var/obj/effect/portal/linked var/hardlinked = TRUE //Requires a linked portal at all times. Destroy if there's no linked portal, if there is destroy it when this one is deleted. var/teleport_channel = TELEPORT_CHANNEL_BLUESPACE - var/creator var/turf/hard_target //For when a portal needs a hard target and isn't to be linked. var/atmos_link = FALSE //Link source/destination atmos. var/turf/open/atmos_source //Atmos link source @@ -71,7 +70,7 @@ if(Adjacent(user)) user.forceMove(get_turf(src)) -/obj/effect/portal/Initialize(mapload, _creator, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override, atmos_link_override) +/obj/effect/portal/Initialize(mapload, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override, atmos_link_override) . = ..() GLOB.portals += src if(!istype(_linked) && automatic_link) @@ -83,7 +82,6 @@ atmos_link = atmos_link_override link_portal(_linked) hardlinked = automatic_link - creator = _creator if(isturf(hard_target_override)) hard_target = hard_target_override @@ -134,10 +132,7 @@ LAZYREMOVE(atmos_destination.atmos_adjacent_turfs, atmos_source) atmos_destination = null -/obj/effect/portal/Destroy() //Calls on_portal_destroy(destroyed portal, location of destroyed portal) on creator if creator has such call. - if(creator && hascall(creator, "on_portal_destroy")) - call(creator, "on_portal_destroy")(src, src.loc) - creator = null +/obj/effect/portal/Destroy() GLOB.portals -= src unlink_atmos() if(hardlinked && !QDELETED(linked)) @@ -193,7 +188,7 @@ var/id // var edit or set id in map editor hardlinked = FALSE // dont qdel my portal nerd -/obj/effect/portal/permanent/Initialize(mapload, _creator, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override, atmos_link_override) +/obj/effect/portal/permanent/Initialize(mapload, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override, atmos_link_override) . = ..() set_linked() @@ -241,3 +236,4 @@ /obj/effect/portal/permanent/one_way/destroy keep = FALSE + diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index 7025bc03fec..9242f52270c 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -198,9 +198,11 @@ to_chat(user, "\The [src] is malfunctioning.") return user.show_message("Locked In.", MSG_AUDIBLE) - var/list/obj/effect/portal/created = create_portal_pair(current_location, get_teleport_turf(get_turf(T)), src, 300, 1, null, atmos_link_override) + var/list/obj/effect/portal/created = create_portal_pair(current_location, get_teleport_turf(get_turf(T)), 300, 1, null, atmos_link_override) if(!(LAZYLEN(created) == 2)) return + RegisterSignal(created[1], COMSIG_PARENT_QDELETING, .proc/on_portal_destroy) //Gosh darn it kevinz. + RegisterSignal(created[2], COMSIG_PARENT_QDELETING, .proc/on_portal_destroy) try_move_adjacent(created[1]) active_portal_pairs[created[1]] = created[2] var/obj/effect/portal/c1 = created[1] diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm index 3e5321f7b3f..ce114d8b91a 100644 --- a/code/modules/events/wormholes.dm +++ b/code/modules/events/wormholes.dm @@ -28,7 +28,7 @@ GLOBAL_LIST_EMPTY(all_wormholes) // So we can pick wormholes to teleport to for(var/i = 1, i <= number_of_wormholes, i++) var/turf/T = pick(pick_turfs) - wormholes += new /obj/effect/portal/wormhole(T, null, 0, null, FALSE) + wormholes += new /obj/effect/portal/wormhole(T, 0, null, FALSE) /datum/round_event/wormholes/announce(fake) priority_announce("Space-time anomalies detected on the station. There is no additional data.", "Anomaly Alert", 'sound/ai/spanomalies.ogg') diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 27a16f9026b..8d630cff35c 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -273,7 +273,8 @@ p_blue.link_portal(p_orange) /obj/item/gun/energy/wormhole_projector/proc/create_portal(obj/projectile/beam/wormhole/W, turf/target) - var/obj/effect/portal/P = new /obj/effect/portal(target, src, 300, null, FALSE, null, atmos_link) + var/obj/effect/portal/P = new /obj/effect/portal(target, 300, null, FALSE, null, atmos_link) + RegisterSignal(P, COMSIG_PARENT_QDELETING, .proc/on_portal_destroy) if(istype(W, /obj/projectile/beam/wormhole/orange)) qdel(p_orange) p_orange = P