Gets rid of another 400 sleep in init problems (#17265)

* Shadekin phase_in moved to timers

* Capture crystal to timers

* async

* PROC_REF
This commit is contained in:
Cameron Lennox
2025-03-04 09:41:53 -05:00
committed by GitHub
parent 8e4aadc657
commit a4a49b203f
3 changed files with 60 additions and 58 deletions
@@ -494,18 +494,14 @@
playsound(src, 'sound/effects/capture-crystal-negative.ogg', 75, 1, -1)
else if(!active) //The ball isn't set up, let's try to set it up.
if(isliving(target)) //We're hitting a mob, let's try to capture it.
sleep(10)
activate(thrower, target)
addtimer(CALLBACK(src, PROC_REF(activate), thrower, target), 10, TIMER_DELETE_ME)
return
sleep(10)
activate(thrower, src)
addtimer(CALLBACK(src, PROC_REF(activate), thrower, src), 10, TIMER_DELETE_ME)
else if(!bound_mob) //We hit something else, and we don't have a mob, so we can't really do anything!
to_chat(thrower, span_notice("\The [src] clicks unpleasantly..."))
playsound(src, 'sound/effects/capture-crystal-negative.ogg', 75, 1, -1)
else if(bound_mob in contents) //We have our mob! Let's try to let it out.
sleep(10)
unleash(thrower, src)
update_icon()
addtimer(CALLBACK(src, PROC_REF(unleash), thrower, src), 10, TIMER_DELETE_ME)
else //Our mob isn't here, we can't do anything.
to_chat(thrower, span_notice("\The [src] clicks unpleasantly..."))
playsound(src, 'sound/effects/capture-crystal-negative.ogg', 75, 1, -1)
@@ -133,35 +133,38 @@
phaseanim.adjust_scale(src.size_multiplier, src.size_multiplier)
phaseanim.dir = dir
alpha = 0
custom_emote(1,"phases in!")
sleep(5) //The duration of the TP animation
canmove = original_canmove
alpha = initial(alpha)
remove_modifiers_of_type(/datum/modifier/shadekin_phase_vision)
INVOKE_ASYNC(src, PROC_REF(custom_emote),1,"phases in!")
//Potential phase-in vore
if(can_be_drop_pred) //Toggleable in vore panel
var/list/potentials = living_mobs(0)
if(potentials.len)
var/mob/living/target = pick(potentials)
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
target.forceMove(vore_selected)
to_chat(target,span_vwarning("\The [src] phases in around you, [vore_selected.vore_verb]ing you into their [vore_selected.name]!"))
addtimer(CALLBACK(src, PROC_REF(shadekin_complete_phase_in), original_canmove), 5, TIMER_DELETE_ME)
ability_flags &= ~AB_PHASE_SHIFTING
//Affect nearby lights
var/destroy_lights = 0
/mob/living/carbon/human/proc/shadekin_complete_phase_in(var/original_canmove)
canmove = original_canmove
alpha = initial(alpha)
remove_modifiers_of_type(/datum/modifier/shadekin_phase_vision)
for(var/obj/machinery/light/L in machines)
if(L.z != z || get_dist(src,L) > 10)
continue
//Potential phase-in vore
if(can_be_drop_pred) //Toggleable in vore panel
var/list/potentials = living_mobs(0)
if(potentials.len)
var/mob/living/target = pick(potentials)
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
target.forceMove(vore_selected)
to_chat(target,span_vwarning("\The [src] phases in around you, [vore_selected.vore_verb]ing you into their [vore_selected.name]!"))
if(prob(destroy_lights))
spawn(rand(5,25))
L.broken()
else
L.flicker(10)
ability_flags &= ~AB_PHASE_SHIFTING
//Affect nearby lights
var/destroy_lights = 0
for(var/obj/machinery/light/L in machines)
if(L.z != z || get_dist(src,L) > 10)
continue
if(prob(destroy_lights))
addtimer(CALLBACK(L, TYPE_PROC_REF(/obj/machinery/light, broken)), rand(5,25), TIMER_DELETE_ME)
else
L.flicker(10)
/mob/living/carbon/human/proc/phase_out(var/turf/T)
if(!(ability_flags & AB_PHASE_SHIFTED))
@@ -56,38 +56,41 @@
//Cosmetics mostly
flick("tp_in",src)
custom_emote(1,"phases in!")
sleep(5) //The duration of the TP animation
canmove = original_canmove
INVOKE_ASYNC(src, PROC_REF(custom_emote),1,"phases in!")
//Potential phase-in vore
if(can_be_drop_pred) //Toggleable in vore panel
var/list/potentials = living_mobs(0)
if(potentials.len)
var/mob/living/target = pick(potentials)
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
target.forceMove(vore_selected)
to_chat(target,span_vwarning("\The [src] phases in around you, [vore_selected.vore_verb]ing you into their [vore_selected.name]!"))
addtimer(CALLBACK(src, PROC_REF(shadekin_complete_phase_in), original_canmove), 5, TIMER_DELETE_ME)
// Do this after the potential vore, so we get the belly
update_icon()
//Affect nearby lights
var/destroy_lights = 0
if(eye_state == RED_EYES)
destroy_lights = 80
if(eye_state == PURPLE_EYES)
destroy_lights = 25
/mob/living/simple_mob/shadekin/proc/shadekin_complete_phase_in(var/original_canmove)
canmove = original_canmove
for(var/obj/machinery/light/L in machines)
if(L.z != z || get_dist(src,L) > 10)
continue
//Potential phase-in vore
if(can_be_drop_pred) //Toggleable in vore panel
var/list/potentials = living_mobs(0)
if(potentials.len)
var/mob/living/target = pick(potentials)
if(istype(target) && target.devourable && target.can_be_drop_prey && vore_selected)
target.forceMove(vore_selected)
to_chat(target,span_vwarning("\The [src] phases in around you, [vore_selected.vore_verb]ing you into their [vore_selected.name]!"))
if(prob(destroy_lights))
spawn(rand(5,25))
L.broken()
else
L.flicker(10)
// Do this after the potential vore, so we get the belly
update_icon()
//Affect nearby lights
var/destroy_lights = 0
if(eye_state == RED_EYES)
destroy_lights = 80
if(eye_state == PURPLE_EYES)
destroy_lights = 25
for(var/obj/machinery/light/L in machines)
if(L.z != z || get_dist(src,L) > 10)
continue
if(prob(destroy_lights))
addtimer(CALLBACK(L, TYPE_PROC_REF(/obj/machinery/light, broken)), rand(5,25), TIMER_DELETE_ME)
else
L.flicker(10)
/mob/living/simple_mob/shadekin/proc/phase_out(var/turf/T)
if(!(ability_flags & AB_PHASE_SHIFTED))