diff --git a/code/game/objects/items/implants/implant.dm b/code/game/objects/items/implants/implant.dm index cc2ae3631e..f8e02eaf03 100644 --- a/code/game/objects/items/implants/implant.dm +++ b/code/game/objects/items/implants/implant.dm @@ -40,11 +40,11 @@ //What does the implant do upon injection? //return 1 if the implant injects //return 0 if there is no room for implant / it fails -/obj/item/implant/proc/implant(mob/living/target, mob/user, silent = FALSE) +/obj/item/implant/proc/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE) if(SEND_SIGNAL(src, COMSIG_IMPLANT_IMPLANTING, args) & COMPONENT_STOP_IMPLANTING) return LAZYINITLIST(target.implants) - if(!target.can_be_implanted() || !can_be_implanted_in(target)) + if(!force && (!target.can_be_implanted() || !can_be_implanted_in(target))) return FALSE for(var/X in target.implants) var/obj/item/implant/imp_e = X diff --git a/code/game/objects/items/implants/implant_misc.dm b/code/game/objects/items/implants/implant_misc.dm index 36f82b599c..83e9b21e0b 100644 --- a/code/game/objects/items/implants/implant_misc.dm +++ b/code/game/objects/items/implants/implant_misc.dm @@ -40,17 +40,80 @@ /obj/item/implant/warp name = "warp implant" - desc = "Saves your position somewhere, and then warps you back to it after five seconds." + desc = "Warps you to where you were 10 seconds before when activated." icon_state = "warp" - uses = 15 + uses = -1 + var/total_delay = 10 SECONDS + var/cooldown = 10 SECONDS + var/last_use = 0 + var/list/positions = list() + var/next_prune = 0 + +/obj/item/implant/warp/Destroy() + positions = null + return ..() + +/obj/item/implant/warp/implant(mob/living/target, mob/user, silent, force) + . = ..() + if(.) + update_position() + RegisterSignal(imp_in, COMSIG_MOVABLE_MOVED, .proc/update_position) + +/obj/item/implant/warp/removed(mob/living/source, silent, special) + . = ..() + clear_positions() + +/obj/item/implant/warp/proc/update_position(datum/source) + if(!isatom(imp_in.loc)) + return + positions[num2text(world.time)] = imp_in.loc + if(!((++next_prune) % 10)) + prune() + +/obj/item/implant/warp/proc/clear_positions() + positions = list() + +/obj/item/implant/warp/proc/get_tele_position() + prune() + return positions[positions[1]] + +/obj/item/implant/warp/proc/do_teleport_effects() + var/safety = 100 + var/list/done = list() + var/time + var/turf/target + for(var/i in 1 to positions.len) + if(!--safety) + break + time = positions[i] + target = positions[time] + if(done[target]) + continue + done[target] = TRUE + if(!istype(target)) + continue + new /obj/effect/temp_visual/dir_setting/ninja(target) /obj/item/implant/warp/activate() . = ..() - uses-- - imp_in.do_adrenaline(20, TRUE, 0, 0, TRUE, list(/datum/reagent/fermi/eigenstate = 1.2), "You feel an internal prick as as the bluespace starts ramping up!") - to_chat(imp_in, "You feel an internal prick as as the bluespace starts ramping up!") - if(!uses) - qdel(src) + if(last_use + cooldown > world.time) + to_chat(imp_in, "[src] is still recharging!") + return + last_use = world.time + prune() + do_teleport_effects() //first. + do_teleport(imp_in, get_tele_position(), 0, TRUE, null, null, null, null, null, TELEPORT_CHANNEL_QUANTUM, TRUE) + +/obj/item/implant/warp/proc/prune() + var/minimum_time = world.time - total_delay + var/remove = 0 + for(var/i in 1 to length(positions)) + if(text2num(positions[i]) < minimum_time) + remove++ + else + break + if(remove) + positions.Cut(1, remove + 1) /obj/item/implanter/warp name = "implanter (warp)" diff --git a/code/modules/uplink/uplink_items/uplink_implants.dm b/code/modules/uplink/uplink_items/uplink_implants.dm index bb4e0c7960..4839c96a2d 100644 --- a/code/modules/uplink/uplink_items/uplink_implants.dm +++ b/code/modules/uplink/uplink_items/uplink_implants.dm @@ -31,7 +31,7 @@ /datum/uplink_item/implants/warp name = "Warp Implant" - desc = "An implant injected into the body and later activated at the user's will. It will inject eigenstasium which saves the user's location and teleports them there after five seconds. Lasts only fifteen times." + desc = "An implant injected into the body and later activated at the user's will. Allows the user to teleport to where they were 10 seconds ago. Has a 10 second cooldown." item = /obj/item/storage/box/syndie_kit/imp_warp cost = 6 exclude_modes = list(/datum/game_mode/nuclear, /datum/game_mode/nuclear/clown_ops)