Files
Bubberstation/code/modules/mining/equipment/wormhole_jaunter.dm
T
9eec84f84c Fix wormhole jaunter behavior with chasms and EMP (#61055)
Wormhole jaunters will now save the user from a chasm if they fall in and it's on their belt. Wormhole jaunters also are affected by EMP correctly. Before it would only be affected by an EMP if it was in the belt storage area which made no sense.

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>

(Lots of good work here, thank you tim)
2021-09-08 17:13:07 -07:00

116 lines
4.0 KiB
Plaintext

/**********************Jaunter**********************/
/obj/item/wormhole_jaunter
name = "wormhole jaunter"
desc = "A single use device harnessing outdated wormhole technology, Nanotrasen has since turned its eyes to bluespace for more accurate teleportation. The wormholes it creates are unpleasant to travel through, to say the least.\nThanks to modifications provided by the Free Golems, this jaunter can be worn on the belt to provide protection from chasms."
icon = 'icons/obj/mining.dmi'
icon_state = "Jaunter"
inhand_icon_state = "electronic"
worn_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 5
slot_flags = ITEM_SLOT_BELT
/obj/item/wormhole_jaunter/attack_self(mob/user)
user.visible_message(span_notice("[user.name] activates the [src.name]!"))
SSblackbox.record_feedback("tally", "jaunter", 1, "User") // user activated
activate(user, TRUE)
/obj/item/wormhole_jaunter/proc/turf_check(mob/user)
var/turf/device_turf = get_turf(src)
if(!device_turf || is_centcom_level(device_turf.z) || is_reserved_level(device_turf.z))
if(user)
to_chat(user, span_notice("You're having difficulties getting the [src.name] to work."))
return FALSE
return TRUE
/obj/item/wormhole_jaunter/proc/get_destinations()
var/list/destinations = list()
for(var/obj/item/beacon/B in GLOB.teleportbeacons)
var/turf/T = get_turf(B)
if(is_station_level(T.z))
destinations += B
return destinations
/obj/item/wormhole_jaunter/proc/can_jaunter_teleport()
var/list/destinations = get_destinations()
return destinations.len > 0
/obj/item/wormhole_jaunter/proc/activate(mob/user, adjacent, teleport)
if(!turf_check(user))
return FALSE
if(!can_jaunter_teleport())
if(user)
to_chat(user, span_notice("\The [src] found no beacons in the world to anchor a wormhole to."))
else
visible_message(span_notice("\The [src] found no beacons in the world to anchor a wormhole to!"))
return TRUE // used for chasm code
var/list/destinations = get_destinations()
var/chosen_beacon = pick(destinations)
var/obj/effect/portal/jaunt_tunnel/tunnel = new (get_turf(src), 100, null, FALSE, get_turf(chosen_beacon))
if(teleport)
tunnel.teleport(user)
else if(adjacent)
try_move_adjacent(tunnel)
playsound(src,'sound/effects/sparks4.ogg',50,TRUE)
qdel(src)
return FALSE // used for chasm code
/obj/item/wormhole_jaunter/emp_act(power)
. = ..()
if(. & EMP_PROTECT_SELF)
return
var/triggered = FALSE
if(power == 1)
triggered = TRUE
else if(power == 2 && prob(50))
triggered = TRUE
var/mob/M = loc
if(istype(M) && triggered)
M.visible_message(span_warning("Your [src.name] overloads and activates!"))
SSblackbox.record_feedback("tally", "jaunter", 1, "EMP") // EMP accidental activation
activate(M, FALSE, TRUE)
else if(triggered)
visible_message(span_warning("\The [src] overloads and activates!"))
activate()
/obj/item/wormhole_jaunter/proc/chasm_react(mob/user)
var/fall_into_chasm = activate(user, FALSE, TRUE)
if(!fall_into_chasm)
to_chat(user, span_notice("Your [src.name] activates, saving you from the chasm!"))
SSblackbox.record_feedback("tally", "jaunter", 1, "Chasm") // chasm automatic activation
return fall_into_chasm
//jaunter tunnel
/obj/effect/portal/jaunt_tunnel
name = "jaunt tunnel"
icon = 'icons/effects/effects.dmi'
icon_state = "bhole3"
desc = "A stable hole in the universe made by a wormhole jaunter. Turbulent doesn't even begin to describe how rough passage through one of these is, but at least it will always get you somewhere near a beacon."
mech_sized = TRUE //save your ripley
innate_accuracy_penalty = 6
/obj/effect/portal/jaunt_tunnel/teleport(atom/movable/M)
. = ..()
if(.)
// KERPLUNK
playsound(M,'sound/weapons/resonator_blast.ogg',50,TRUE)
if(iscarbon(M))
var/mob/living/carbon/L = M
L.Paralyze(60)
if(ishuman(L))
shake_camera(L, 20, 1)
addtimer(CALLBACK(L, /mob/living/carbon.proc/vomit), 20)