diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index 5bf804105a0..43931e6bb2a 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -6,7 +6,10 @@ anchored = TRUE var/obj/item/target = null - var/creator = null + /// The UID and `name` of the object that created this portal. For example, a wormhole jaunter. + var/list/creation_obj_data + /// The ckey of the mob which was responsible for the creation of the portal. For example, the mob who used a wormhole jaunter. + var/creation_mob_ckey var/failchance = 5 var/fail_icon = "portal1" @@ -16,26 +19,23 @@ var/ignore_tele_proof_area_setting = FALSE var/one_use = FALSE // Does this portal go away after one teleport? -/obj/effect/portal/New(loc, turf/target, creator = null, lifespan = 300) +/obj/effect/portal/New(loc, turf/_target, obj/creation_object = null, lifespan = 300, mob/creation_mob = null) ..() GLOB.portals += src - src.target = target - src.creator = creator + target = _target + creation_obj_data = list(creation_object.UID(), "[creation_object.name]") // Store the name incase the object is deleted. + creation_mob_ckey = creation_mob?.ckey if(lifespan > 0) - spawn(lifespan) - qdel(src) + QDEL_IN(src, lifespan) /obj/effect/portal/Destroy() GLOB.portals -= src - - if(isobj(creator)) - var/obj/O = creator + var/obj/O = locateUID(creation_obj_data[1]) + if(!QDELETED(O)) O.portal_destroyed(src) - - creator = null target = null return ..() @@ -98,7 +98,13 @@ return FALSE if(ismegafauna(M)) - message_admins("[M] has used a portal at [ADMIN_VERBOSEJMP(src)] made by [key_name_admin(usr)].") + var/creator_string = "" + var/obj_name = creation_obj_data[2] + if(creation_mob_ckey) + creator_string = " created by [key_name_admin(GLOB.directory[creation_mob_ckey])][obj_name ? " using \a [obj_name]" : ""]" + else if(obj_name) + creator_string = " created by \a [obj_name]" + message_admins("[M] has used a portal at [ADMIN_VERBOSEJMP(src)][creator_string].") if(prob(failchance)) icon_state = fail_icon diff --git a/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm b/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm index 615985dbac2..914f65010ba 100644 --- a/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm +++ b/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm @@ -304,7 +304,7 @@ U.message_holder("Extraction signal received, agent. [SSmapping.map_datum.fluff_name]'s bluespace transport jamming systems have been sabotaged. "\ + "We have opened a temporary portal at your flare location - proceed to the target's extraction by inserting them into the portal.", 'sound/effects/confirmdropoff.ogg') // Open a portal - var/obj/effect/portal/redspace/contractor/P = new(get_turf(F), pick(GLOB.syndieprisonwarp), null, 0) + var/obj/effect/portal/redspace/contractor/P = new(get_turf(F), pick(GLOB.syndieprisonwarp), F, 0, M) P.contract = src P.contractor_mind = M.mind P.target_mind = contract.target diff --git a/code/modules/mining/equipment/wormhole_jaunter.dm b/code/modules/mining/equipment/wormhole_jaunter.dm index dc2d9273a95..033cef674e3 100644 --- a/code/modules/mining/equipment/wormhole_jaunter.dm +++ b/code/modules/mining/equipment/wormhole_jaunter.dm @@ -42,7 +42,7 @@ to_chat(user, "[src] found no beacons in the world to anchor a wormhole to.") return var/chosen_beacon = pick(L) - var/obj/effect/portal/jaunt_tunnel/J = new(get_turf(src), get_turf(chosen_beacon), src, 100) + var/obj/effect/portal/jaunt_tunnel/J = new(get_turf(src), get_turf(chosen_beacon), src, 100, user) J.emagged = emagged if(adjacent) try_move_adjacent(J)