Merge pull request #13405 from silicons/tracer
warp implant is now infinite use and now actually reverts your position to 10 seconds before in time rather than use a snowflake chemical to teleport you 5 seconds later
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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), "<span class='boldnotice'>You feel an internal prick as as the bluespace starts ramping up!</span>")
|
||||
to_chat(imp_in, "<span class='notice'>You feel an internal prick as as the bluespace starts ramping up!</span>")
|
||||
if(!uses)
|
||||
qdel(src)
|
||||
if(last_use + cooldown > world.time)
|
||||
to_chat(imp_in, "<span class=warning'>[src] is still recharging!</span>")
|
||||
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)"
|
||||
|
||||
Reference in New Issue
Block a user