diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm index 2ad06711b10c..c98ba7d0f14f 100644 --- a/code/LINDA/LINDA_turf_tile.dm +++ b/code/LINDA/LINDA_turf_tile.dm @@ -292,10 +292,13 @@ /atom/movable/var/pressure_resistance = 5 /atom/movable/proc/experience_pressure_difference(pressure_difference, direction) + set waitfor = 0 + . = 0 if(!anchored && !pulledby) + . = 1 if(pressure_difference > pressure_resistance) - spawn step(src, direction) - return 1 + step(src, direction) + diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index 15c92b07b889..461169cf4b43 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -26,10 +26,13 @@ var/datum/subsystem/timer/SStimer if (!event.thingToCall || qdeleted(event.thingToCall)) qdel(event) if (event.timeToRun <= world.time) - spawn(-1) - call(event.thingToCall, event.procToCall)(arglist(event.argList)) + runevent(event) qdel(event) +/datum/subsystem/timer/proc/runevent(datum/timedevent/event) + set waitfor = 0 + call(event.thingToCall, event.procToCall)(arglist(event.argList)) + /datum/timedevent var/thingToCall var/procToCall diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm index 1917c75065f7..73cd662d4fa6 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -135,32 +135,32 @@ if(work_sound) playsound(src, work_sound, 50, 1) icon_state = icon_creating - spawn(30) + sleep 30 + icon_state = icon_on + metal -= metal_cost + glass -= glass_cost + if(metal < 0) + metal = 0 + if(glass < 0) + glass = 0 + if(power_used) + use_power(power_used) + new dispense_type(loc) + if(create_sound) + playsound(src, create_sound, 50, 1) + if(end_create_message) + visible_message("[src] [end_create_message]") + icon_state = icon_recharging + sleep(cooldownTime) + if(stat != BROKEN) icon_state = icon_on - metal -= metal_cost - glass -= glass_cost - if(metal < 0) - metal = 0 - if(glass < 0) - glass = 0 - if(power_used) - use_power(power_used) - new dispense_type(loc) - if(create_sound) - playsound(src, create_sound, 50, 1) - if(end_create_message) - visible_message("[src] [end_create_message]") - icon_state = icon_recharging - spawn(cooldownTime) - if(stat != BROKEN) - icon_state = icon_on - else - icon_state = icon_off - droneMadeRecently = 0 - if(recharge_sound) - playsound(src, recharge_sound, 50, 1) - if(recharge_message) - visible_message("[src] [recharge_message]") + else + icon_state = icon_off + droneMadeRecently = 0 + if(recharge_sound) + playsound(src, recharge_sound, 50, 1) + if(recharge_message) + visible_message("[src] [recharge_message]") /obj/machinery/droneDispenser/attackby(obj/item/O, mob/living/user) if(istype(O, /obj/item/stack)) diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 62162225baf2..d2cdf0153f18 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -504,8 +504,7 @@ if(!tryToShootAt(targets)) if(!always_up) - spawn() - popDown() // no valid targets, close the cover + popDown() // no valid targets, close the cover /obj/machinery/porta_turret/proc/tryToShootAt(list/atom/movable/targets) diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 77fd97024875..3da70a1c3e21 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -44,9 +44,12 @@ /obj/machinery/status_display/New() ..() - spawn(5) // must wait for map loading to finish - if(SSradio) - SSradio.add_object(src, frequency) + if(SSradio) + SSradio.add_object(src, frequency) + +/obj/machinery/status_display/initialize() + if(SSradio) + SSradio.add_object(src, frequency) /obj/machinery/status_display/Destroy() if(SSradio) diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 6f6950527abe..883013d04f07 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -114,9 +114,8 @@ wires.Interact(user) if(!open_panel) if(!active) - spawn() - settings(user) - return + settings(user) + return else if(anchored) user << "The bomb is bolted to the floor!" return diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm index 30d74ba6970d..c9a660d61a95 100644 --- a/code/game/objects/effects/decals/Cleanable/humans.dm +++ b/code/game/objects/effects/decals/Cleanable/humans.dm @@ -88,18 +88,18 @@ /obj/effect/decal/cleanable/blood/gibs/proc/streak(list/directions) - spawn (0) - var/direction = pick(directions) - for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) - sleep(3) - if (i > 0) - var/obj/effect/decal/cleanable/blood/b = new /obj/effect/decal/cleanable/blood/splatter(src.loc) - for(var/datum/disease/D in src.viruses) - var/datum/disease/ND = D.Copy(1) - b.viruses += ND - ND.holder = b - if (step_to(src, get_step(src, direction), 0)) - break + set waitfor = 0 + var/direction = pick(directions) + for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) + sleep(3) + if (i > 0) + var/obj/effect/decal/cleanable/blood/b = new /obj/effect/decal/cleanable/blood/splatter(src.loc) + for(var/datum/disease/D in src.viruses) + var/datum/disease/ND = D.Copy(1) + b.viruses += ND + ND.holder = b + if (step_to(src, get_step(src, direction), 0)) + break /obj/effect/decal/cleanable/blood/drip name = "drips of blood" diff --git a/code/game/objects/effects/decals/Cleanable/robots.dm b/code/game/objects/effects/decals/Cleanable/robots.dm index becacd4d2eaa..8e3533d713f4 100644 --- a/code/game/objects/effects/decals/Cleanable/robots.dm +++ b/code/game/objects/effects/decals/Cleanable/robots.dm @@ -14,19 +14,19 @@ bloodiness = MAX_SHOE_BLOODINESS /obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions) - spawn (0) - var/direction = pick(directions) - for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) - sleep(3) - if (i > 0) - if (prob(40)) - new /obj/effect/decal/cleanable/oil/streak(src.loc) - else if (prob(10)) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(3, 1, src) - s.start() - if (step_to(src, get_step(src, direction), 0)) - break + set waitfor = 0 + var/direction = pick(directions) + for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) + sleep(3) + if (i > 0) + if (prob(40)) + new /obj/effect/decal/cleanable/oil/streak(src.loc) + else if (prob(10)) + var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread + s.set_up(3, 1, src) + s.start() + if (step_to(src, get_step(src, direction), 0)) + break /obj/effect/decal/cleanable/robot_debris/ex_act() return diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index 6efa75f3e214..19ab1774ae56 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -14,6 +14,7 @@ /proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, ignorecap = 0, flame_range = 0 ,silent = 0) + set waitfor = 0 src = null //so we don't abort once src is deleted epicenter = get_turf(epicenter) @@ -30,126 +31,125 @@ flash_range = min (MAX_EX_FLASH_RANGE, flash_range) flame_range = min (MAX_EX_FLAME_RANGE, flame_range) - spawn(0) - var/start = world.timeofday - if(!epicenter) return + var/start = world.timeofday + if(!epicenter) return - var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range) - var/list/cached_exp_block = list() + var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range) + var/list/cached_exp_block = list() - if(adminlog) - message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z])") - log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z])") + if(adminlog) + message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z])") + log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z])") - // Play sounds; we want sounds to be different depending on distance so we will manually do it ourselves. - // Stereo users will also hear the direction of the explosion! + // Play sounds; we want sounds to be different depending on distance so we will manually do it ourselves. + // Stereo users will also hear the direction of the explosion! - // Calculate far explosion sound range. Only allow the sound effect for heavy/devastating explosions. - // 3/7/14 will calculate to 80 + 35 + // Calculate far explosion sound range. Only allow the sound effect for heavy/devastating explosions. + // 3/7/14 will calculate to 80 + 35 - var/far_dist = 0 - far_dist += heavy_impact_range * 5 - far_dist += devastation_range * 20 + var/far_dist = 0 + far_dist += heavy_impact_range * 5 + far_dist += devastation_range * 20 - if(!silent) - var/frequency = get_rand_frequency() - for(var/mob/M in player_list) - // Double check for client - if(M && M.client) - var/turf/M_turf = get_turf(M) - if(M_turf && M_turf.z == epicenter.z) - var/dist = get_dist(M_turf, epicenter) - // If inside the blast radius + world.view - 2 - if(dist <= round(max_range + world.view - 2, 1)) - M.playsound_local(epicenter, get_sfx("explosion"), 100, 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound - // You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station. - else if(dist <= far_dist) - var/far_volume = Clamp(far_dist, 30, 50) // Volume is based on explosion size and dist - far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion - M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1, frequency, falloff = 5) + if(!silent) + var/frequency = get_rand_frequency() + for(var/mob/M in player_list) + // Double check for client + if(M && M.client) + var/turf/M_turf = get_turf(M) + if(M_turf && M_turf.z == epicenter.z) + var/dist = get_dist(M_turf, epicenter) + // If inside the blast radius + world.view - 2 + if(dist <= round(max_range + world.view - 2, 1)) + M.playsound_local(epicenter, get_sfx("explosion"), 100, 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound + // You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station. + else if(dist <= far_dist) + var/far_volume = Clamp(far_dist, 30, 50) // Volume is based on explosion size and dist + far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion + M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1, frequency, falloff = 5) - //postpone processing for a bit - var/postponeCycles = max(round(devastation_range/8),1) - SSlighting.postpone(postponeCycles) - SSmachine.postpone(postponeCycles) + //postpone processing for a bit + var/postponeCycles = max(round(devastation_range/8),1) + SSlighting.postpone(postponeCycles) + SSmachine.postpone(postponeCycles) - if(heavy_impact_range > 1) - var/datum/effect_system/explosion/E = new/datum/effect_system/explosion() - E.set_up(epicenter) - E.start() + if(heavy_impact_range > 1) + var/datum/effect_system/explosion/E = new/datum/effect_system/explosion() + E.set_up(epicenter) + E.start() - var/x0 = epicenter.x - var/y0 = epicenter.y - var/z0 = epicenter.z + var/x0 = epicenter.x + var/y0 = epicenter.y + var/z0 = epicenter.z - var/list/affected_turfs = trange(max_range, epicenter) + var/list/affected_turfs = trange(max_range, epicenter) + + if(config.reactionary_explosions) + for(var/turf/T in affected_turfs) // we cache the explosion block rating of every turf in the explosion area + cached_exp_block[T] = 0 + if(T.density && T.explosion_block) + cached_exp_block[T] += T.explosion_block + + for(var/obj/machinery/door/D in T) + if(D.density && D.explosion_block) + cached_exp_block[T] += D.explosion_block + + for(var/obj/structure/window/W in T) + if(W.reinf && W.fulltile) + cached_exp_block[T] += W.explosion_block + + for(var/obj/effect/blob/B in T) + cached_exp_block[T] += B.explosion_block + + for(var/turf/T in affected_turfs) + + var/dist = cheap_hypotenuse(T.x, T.y, x0, y0) if(config.reactionary_explosions) - for(var/turf/T in affected_turfs) // we cache the explosion block rating of every turf in the explosion area - cached_exp_block[T] = 0 - if(T.density && T.explosion_block) - cached_exp_block[T] += T.explosion_block + var/turf/Trajectory = T + while(Trajectory != epicenter) + Trajectory = get_step_towards(Trajectory, epicenter) + dist += cached_exp_block[Trajectory] - for(var/obj/machinery/door/D in T) - if(D.density && D.explosion_block) - cached_exp_block[T] += D.explosion_block + var/flame_dist = 0 + var/throw_dist = dist - for(var/obj/structure/window/W in T) - if(W.reinf && W.fulltile) - cached_exp_block[T] += W.explosion_block + if(dist < flame_range) + flame_dist = 1 - for(var/obj/effect/blob/B in T) - cached_exp_block[T] += B.explosion_block + if(dist < devastation_range) dist = 1 + else if(dist < heavy_impact_range) dist = 2 + else if(dist < light_impact_range) dist = 3 + else dist = 0 - for(var/turf/T in affected_turfs) + //------- TURF FIRES ------- - var/dist = cheap_hypotenuse(T.x, T.y, x0, y0) + if(T) + if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density) + PoolOrNew(/obj/effect/hotspot, T) //Mostly for ambience! + if(dist > 0) + T.ex_act(dist) - if(config.reactionary_explosions) - var/turf/Trajectory = T - while(Trajectory != epicenter) - Trajectory = get_step_towards(Trajectory, epicenter) - dist += cached_exp_block[Trajectory] + //--- THROW ITEMS AROUND --- - var/flame_dist = 0 - var/throw_dist = dist - - if(dist < flame_range) - flame_dist = 1 - - if(dist < devastation_range) dist = 1 - else if(dist < heavy_impact_range) dist = 2 - else if(dist < light_impact_range) dist = 3 - else dist = 0 - - //------- TURF FIRES ------- - - if(T) - if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density) - PoolOrNew(/obj/effect/hotspot, T) //Mostly for ambience! - if(dist > 0) - T.ex_act(dist) - - //--- THROW ITEMS AROUND --- - - var/throw_dir = get_dir(epicenter,T) - for(var/obj/item/I in T) - if(I && !I.anchored) - var/throw_range = rand(throw_dist, max_range) - var/turf/throw_at = get_ranged_target_turf(I, throw_dir, throw_range) - I.throw_speed = 4 //Temporarily change their throw_speed for embedding purposes (Reset when it finishes throwing, regardless of hitting anything) - I.throw_at_fast(throw_at, throw_range, 2)//Throw it at 2 speed, this is purely visual anyway. + var/throw_dir = get_dir(epicenter,T) + for(var/obj/item/I in T) + if(I && !I.anchored) + var/throw_range = rand(throw_dist, max_range) + var/turf/throw_at = get_ranged_target_turf(I, throw_dir, throw_range) + I.throw_speed = 4 //Temporarily change their throw_speed for embedding purposes (Reset when it finishes throwing, regardless of hitting anything) + I.throw_at_fast(throw_at, throw_range, 2)//Throw it at 2 speed, this is purely visual anyway. - var/took = (world.timeofday-start)/10 - //You need to press the DebugGame verb to see these now....they were getting annoying and we've collected a fair bit of data. Just -test- changes to explosion code using this please so we can compare - if(Debug2) world.log << "## DEBUG: Explosion([x0],[y0],[z0])(d[devastation_range],h[heavy_impact_range],l[light_impact_range]): Took [took] seconds." + var/took = (world.timeofday-start)/10 + //You need to press the DebugGame verb to see these now....they were getting annoying and we've collected a fair bit of data. Just -test- changes to explosion code using this please so we can compare + if(Debug2) world.log << "## DEBUG: Explosion([x0],[y0],[z0])(d[devastation_range],h[heavy_impact_range],l[light_impact_range]): Took [took] seconds." + + //Machines which report explosions. + for(var/array in doppler_arrays) + var/obj/machinery/doppler_array/A = array + A.sense_explosion(epicenter,devastation_range,heavy_impact_range,light_impact_range,took,orig_dev_range,orig_heavy_range,orig_light_range) - //Machines which report explosions. - for(var/array in doppler_arrays) - var/obj/machinery/doppler_array/A = array - A.sense_explosion(epicenter,devastation_range,heavy_impact_range,light_impact_range,took,orig_dev_range,orig_heavy_range,orig_light_range) - return 1 diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 55c4ae393360..076c43856585 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -20,8 +20,7 @@ /obj/item/device/radio/intercom/attack_ai(mob/user) src.add_fingerprint(user) - spawn (0) - attack_self(user) + attack_self(user) /obj/item/device/radio/intercom/attack_paw(mob/user) return src.attack_hand(user) @@ -29,8 +28,7 @@ /obj/item/device/radio/intercom/attack_hand(mob/user) src.add_fingerprint(user) - spawn (0) - attack_self(user) + attack_self(user) /obj/item/device/radio/intercom/receive_range(freq, level) if (!on) diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index f217989a655f..af8237a5e700 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -40,16 +40,15 @@ effective or pretty fucking useless. add_logs(user, null, "knocked down people in the area", src) for(var/mob/living/carbon/human/M in ultra_range(10, user, 1)) - spawn() - if(prob(50)) + if(prob(50)) - M.Weaken(rand(10,20)) - if(prob(25)) - M.Stun(rand(5,10)) - M << "You feel a tremendous, paralyzing wave flood your mind." + M.Weaken(rand(10,20)) + if(prob(25)) + M.Stun(rand(5,10)) + M << "You feel a tremendous, paralyzing wave flood your mind." - else - M << "You feel a sudden, electric jolt travel through your head." + else + M << "You feel a sudden, electric jolt travel through your head." playsound(src.loc, 'sound/misc/interference.ogg', 50, 1) user << "You trigger [src]." diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 309bea1a0de2..7fce1577be47 100755 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -422,7 +422,7 @@ if(istype(target, /obj/effect/decal/cleanable)) target = target.loc if(is_type_in_list(target,validSurfaces)) - + var/temp = "rune" if(letters.Find(drawtype)) temp = "letter" @@ -1106,13 +1106,13 @@ if (cooldown < world.time) cooldown = world.time + 1800 //3 minutes user.visible_message("[user] presses a button on [src].", "You activate [src], it plays a loud noise!", "You hear the click of a button.") - spawn(5) //gia said so - icon_state = "nuketoy" - playsound(src, 'sound/machines/Alarm.ogg', 100, 0, surround = 0) - sleep(135) - icon_state = "nuketoycool" - sleep(cooldown - world.time) - icon_state = "nuketoyidle" + sleep(5) + icon_state = "nuketoy" + playsound(src, 'sound/machines/Alarm.ogg', 100, 0, surround = 0) + sleep(135) + icon_state = "nuketoycool" + sleep(cooldown - world.time) + icon_state = "nuketoyidle" else var/timeleft = (cooldown - world.time) user << "Nothing happens, and '[round(timeleft/10)]' appears on a small display." diff --git a/code/game/objects/items/weapons/pneumaticCannon.dm b/code/game/objects/items/weapons/pneumaticCannon.dm index 5d73339b1646..7c4e0dcce55b 100644 --- a/code/game/objects/items/weapons/pneumaticCannon.dm +++ b/code/game/objects/items/weapons/pneumaticCannon.dm @@ -23,8 +23,7 @@ user << "You'll need to get closer to see any more." return for(var/obj/item/I in loadedItems) - spawn(0) - user << "\icon [I] It has \the [I] loaded." + user << "\icon [I] It has \the [I] loaded." if(tank) user << "\icon [tank] It has \the [tank] mounted onto it." diff --git a/code/game/objects/items/weapons/singularityhammer.dm b/code/game/objects/items/weapons/singularityhammer.dm index e8a99f1a4417..e4781e32d2bc 100644 --- a/code/game/objects/items/weapons/singularityhammer.dm +++ b/code/game/objects/items/weapons/singularityhammer.dm @@ -93,13 +93,12 @@ "You feel a powerful shock course through your body sending you flying!", \ "You hear a heavy electrical crack!") var/atom/throw_target = get_edge_target_turf(target, get_dir(src, get_step_away(target, src))) - target.throw_at(throw_target, 200, 4) + target.throw_at_fast(throw_target, 200, 4) return /obj/item/weapon/twohanded/mjollnir/attack(mob/M, mob/user) ..() - spawn(0) if(wielded) //if(charged == 5) //charged = 0 diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index aaa115bbd1b6..475383d8b2b4 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -128,13 +128,12 @@ return for(var/obj/structure/transit_tube_pod/pod in loc) if(!pod.moving && turn(pod.dir, (reverse_launch ? 180 : 0)) in directions()) - spawn(0) - pod_moving = 1 - close_animation() - sleep(CLOSE_DURATION + 2) - if(icon_state == "closed" && pod) - pod.follow_tube(reverse_launch) - pod_moving = 0 + pod_moving = 1 + close_animation() + sleep(CLOSE_DURATION + 2) + if(icon_state == "closed" && pod) + pod.follow_tube(reverse_launch) + pod_moving = 0 return 1 return 0 diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index a4bd81856e71..0370ec49f9dd 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -61,62 +61,63 @@ else return ..() /obj/structure/transit_tube_pod/proc/follow_tube(reverse_launch) + set waitfor = 0 if(moving) return moving = 1 - spawn() - var/obj/structure/transit_tube/current_tube = null - var/next_dir - var/next_loc - var/last_delay = 0 - var/exit_delay - if(reverse_launch) - dir = turn(dir, 180) // Back it up + var/obj/structure/transit_tube/current_tube = null + var/next_dir + var/next_loc + var/last_delay = 0 + var/exit_delay - for(var/obj/structure/transit_tube/tube in loc) - if(tube.has_exit(dir)) + if(reverse_launch) + dir = turn(dir, 180) // Back it up + + for(var/obj/structure/transit_tube/tube in loc) + if(tube.has_exit(dir)) + current_tube = tube + break + + while(current_tube) + next_dir = current_tube.get_exit(dir) + + if(!next_dir) + break + + exit_delay = current_tube.exit_delay(src, dir) + last_delay += exit_delay + + sleep(exit_delay) + + next_loc = get_step(loc, next_dir) + + current_tube = null + for(var/obj/structure/transit_tube/tube in next_loc) + if(tube.has_entrance(next_dir)) current_tube = tube break - while(current_tube) - next_dir = current_tube.get_exit(dir) - - if(!next_dir) - break - - exit_delay = current_tube.exit_delay(src, dir) - last_delay += exit_delay - - sleep(exit_delay) - - next_loc = get_step(loc, next_dir) - - current_tube = null - for(var/obj/structure/transit_tube/tube in next_loc) - if(tube.has_entrance(next_dir)) - current_tube = tube - break - - if(current_tube == null) - dir = next_dir - Move(get_step(loc, dir), dir) // Allow collisions when leaving the tubes. - break - - last_delay = current_tube.enter_delay(src, next_dir) - sleep(last_delay) + if(current_tube == null) dir = next_dir - loc = next_loc // When moving from one tube to another, skip collision and such. - density = current_tube.density + Move(get_step(loc, dir), dir) // Allow collisions when leaving the tubes. + break - if(current_tube && current_tube.should_stop_pod(src, next_dir)) - current_tube.pod_stopped(src, dir) - break + last_delay = current_tube.enter_delay(src, next_dir) + sleep(last_delay) + dir = next_dir + loc = next_loc // When moving from one tube to another, skip collision and such. + density = current_tube.density - density = 1 - moving = 0 + if(current_tube && current_tube.should_stop_pod(src, next_dir)) + current_tube.pod_stopped(src, dir) + break + + density = 1 + moving = 0 // Should I return a copy here? If the caller edits or del()s the returned diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2.dm b/code/modules/admin/verbs/SDQL2/SDQL_2.dm index 991ebb368867..7b0bef9e5b92 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_2.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_2.dm @@ -93,14 +93,11 @@ for(var/datum/d in objs) for(var/v in call_list) - // To stop any procs which sleep from executing slowly. - if(d) - if(hascall(d, v)) - spawn() call(d, v)(arglist(args_list)) // Spawn in case the function sleeps. + SDQL_callproc(d, v, args_list) if("delete") for(var/datum/d in objs) - del d + qdel(d) if("select") var/text = "" @@ -147,6 +144,10 @@ +/proc/SDQL_callproc(thing, procname, args_list) + set waitfor = 0 + if(hascall(thing, procname)) + call(thing, procname)(arglist(args_list)) // Spawn in case the function sleeps. /proc/SDQL_parse(list/query_list) var/datum/SDQL_parser/parser = new() diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 93d8d3a830fe..c7adcf4693ee 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -28,72 +28,73 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that /client/proc/callproc() set category = "Debug" set name = "Advanced ProcCall" + set waitfor = 0 if(!check_rights(R_DEBUG)) return - spawn(0) - var/target = null - var/targetselected = 0 - var/returnval = null - var/class = null + var/target = null + var/targetselected = 0 + var/returnval = null + var/class = null - switch(alert("Proc owned by something?",,"Yes","No")) - if("Yes") - targetselected = 1 - if(src.holder && src.holder.marked_datum) - class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client","Marked datum ([holder.marked_datum.type])") - if(class == "Marked datum ([holder.marked_datum.type])") - class = "Marked datum" + switch(alert("Proc owned by something?",,"Yes","No")) + if("Yes") + targetselected = 1 + if(src.holder && src.holder.marked_datum) + class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client","Marked datum ([holder.marked_datum.type])") + if(class == "Marked datum ([holder.marked_datum.type])") + class = "Marked datum" + else + class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client") + switch(class) + if("Obj") + target = input("Enter target:","Target",usr) as obj in world + if("Mob") + target = input("Enter target:","Target",usr) as mob in world + if("Area or Turf") + target = input("Enter target:","Target",usr.loc) as area|turf in world + if("Client") + var/list/keys = list() + for(var/client/C) + keys += C + target = input("Please, select a player!", "Selection", null, null) as null|anything in keys + if("Marked datum") + target = holder.marked_datum else - class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client") - switch(class) - if("Obj") - target = input("Enter target:","Target",usr) as obj in world - if("Mob") - target = input("Enter target:","Target",usr) as mob in world - if("Area or Turf") - target = input("Enter target:","Target",usr.loc) as area|turf in world - if("Client") - var/list/keys = list() - for(var/client/C) - keys += C - target = input("Please, select a player!", "Selection", null, null) as null|anything in keys - if("Marked datum") - target = holder.marked_datum - else - return - if("No") - target = null - targetselected = 0 + return + if("No") + target = null + targetselected = 0 - var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null - if(!procname) return - if(targetselected && !hascall(target,procname)) - usr << "Error: callproc(): target has no such call [procname]." - return - var/list/lst = get_callproc_args() - if(!lst) + var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null + if(!procname) return + if(targetselected && !hascall(target,procname)) + usr << "Error: callproc(): target has no such call [procname]." + return + var/list/lst = get_callproc_args() + if(!lst) + return + + if(targetselected) + if(!target) + usr << "Error: callproc(): owner of proc no longer exists." return + log_admin("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") + message_admins("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") + returnval = call(target,procname)(arglist(lst)) // Pass the lst as an argument list to the proc + else + //this currently has no hascall protection. wasn't able to get it working. + log_admin("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") + message_admins("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") + returnval = call(procname)(arglist(lst)) // Pass the lst as an argument list to the proc - if(targetselected) - if(!target) - usr << "Error: callproc(): owner of proc no longer exists." - return - log_admin("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") - message_admins("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") - returnval = call(target,procname)(arglist(lst)) // Pass the lst as an argument list to the proc - else - //this currently has no hascall protection. wasn't able to get it working. - log_admin("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") - message_admins("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") - returnval = call(procname)(arglist(lst)) // Pass the lst as an argument list to the proc - - usr << "[procname] returned: [returnval ? returnval : "null"]" - feedback_add_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + usr << "[procname] returned: [returnval ? returnval : "null"]" + feedback_add_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/callproc_datum(A as null|area|mob|obj|turf) set category = "Debug" set name = "Atom ProcCall" + set waitfor = 0 if(!check_rights(R_DEBUG)) return @@ -113,12 +114,13 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that return log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") message_admins("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") - spawn() - var/returnval = call(A,procname)(arglist(lst)) // Pass the lst as an argument list to the proc - usr << "[procname] returned: [returnval ? returnval : "null"]" - feedback_add_details("admin_verb","DPC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + var/returnval = call(A,procname)(arglist(lst)) // Pass the lst as an argument list to the proc + usr << "[procname] returned: [returnval ? returnval : "null"]" + + + /client/proc/get_callproc_args() var/argnum = input("Number of arguments","Number:",0) as num|null if(!argnum && (argnum!=0)) return @@ -207,7 +209,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that if(istype(M, /mob/living/carbon/human)) log_admin("[key_name(src)] has robotized [M.key].") var/mob/living/carbon/human/H = M - spawn(10) + spawn(0) H.Robotize() else @@ -223,7 +225,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that if(istype(M, /mob/living/carbon/human)) log_admin("[key_name(src)] has blobized [M.key].") var/mob/living/carbon/human/H = M - spawn(10) + spawn(0) H.Blobize() else @@ -247,7 +249,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that return log_admin("[key_name(src)] has animalized [M.key].") - spawn(10) + spawn(0) M.Animalize() @@ -287,7 +289,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that return if(ishuman(M)) log_admin("[key_name(src)] has alienized [M.key].") - spawn(10) + spawn(0) M:Alienize() feedback_add_details("admin_verb","MKAL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] made [key_name(M)] into an alien.") @@ -304,7 +306,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that return if(ishuman(M)) log_admin("[key_name(src)] has slimeized [M.key].") - spawn(10) + spawn(0) M:slimeize() feedback_add_details("admin_verb","MKMET") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] made [key_name(M)] into a slime.") diff --git a/code/modules/assembly/doorcontrol.dm b/code/modules/assembly/doorcontrol.dm index 9e654648c2d5..805acc631b16 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -76,7 +76,6 @@ if (M.id == src.id) spawn( 0 ) M.open() - return sleep(10) @@ -90,7 +89,6 @@ if (M.id == src.id) spawn( 0 ) M.close() - return sleep(10) cooldown = 0 diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index 53990197caa6..bb355b97e675 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -56,7 +56,6 @@ cooldown = 2 spawn(10) process_cooldown() - return /obj/item/device/assembly/prox_sensor/process() @@ -71,15 +70,13 @@ /obj/item/device/assembly/prox_sensor/dropped() spawn(0) sense() - return - return /obj/item/device/assembly/prox_sensor/toggle_scan() if(!secured) return 0 scanning = !scanning update_icon() - return + /obj/item/device/assembly/prox_sensor/update_icon() diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index 463abc6c5e46..ff0396423bcd 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -17,7 +17,7 @@ ..() spawn(40) set_frequency(frequency) - return + /obj/item/device/assembly/signaler/Destroy() if(SSradio) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 73b99c574adb..61d711703842 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -334,6 +334,6 @@ var/next_external_rsc = 0 'html/browser/scannernew.css', 'html/browser/playeroptions.css', ) - spawn (10) + spawn (10) //removing this spawn causes all clients to not get verbs. //Precache the client with all other assets slowly, so as to not block other browse() calls getFilesSlow(src, SSasset.cache, register_asset = FALSE) diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index ba20754944b9..58555943e649 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -18,7 +18,7 @@ if(turfs.len) //Pick a turf to spawn at if we can var/turf/simulated/T = pick(turfs) - spawn(0) new/obj/effect/spacevine_controller(T) //spawn a controller at turf + new/obj/effect/spacevine_controller(T) //spawn a controller at turf /datum/spacevine_mutation diff --git a/code/modules/flufftext/Dreaming.dm b/code/modules/flufftext/Dreaming.dm index eb933f8ce7a9..08fb9940f8d1 100644 --- a/code/modules/flufftext/Dreaming.dm +++ b/code/modules/flufftext/Dreaming.dm @@ -1,4 +1,5 @@ /mob/living/carbon/proc/dream() + set waitfor = 0 dreaming = 1 var/list/dreams = list( "an ID card","a bottle","a familiar face","a crewmember","a toolbox","a security officer","the captain", @@ -8,17 +9,16 @@ "a blue light","an abandoned laboratory","Nanotrasen","The Syndicate","blood","healing","power","respect", "riches","space","a crash","happiness","pride","a fall","water","flames","ice","melons","flying" ) - spawn(0) - for(var/i = rand(1,4),i > 0, i--) - var/dream_image = pick(dreams) - dreams -= dream_image - src << "... [dream_image] ..." - sleep(rand(40,70)) - if(paralysis <= 0) - dreaming = 0 - return 0 - dreaming = 0 - return 1 + for(var/i = rand(1,4),i > 0, i--) + var/dream_image = pick(dreams) + dreams -= dream_image + src << "... [dream_image] ..." + sleep(rand(40,70)) + if(paralysis <= 0) + dreaming = 0 + return 0 + dreaming = 0 + return 1 /mob/living/carbon/proc/handle_dreams() if(prob(5) && !dreaming) dream() diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 13c40680a509..cd6ed978b57b 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -377,7 +377,7 @@ harvest = 0 weedlevel = 0 // Reset - spawn(5) // Wait a while + sleep(5) // Wait a while update_icon() visible_message("[oldPlantName] suddenly mutated into [myseed.plantname]!") @@ -397,7 +397,7 @@ harvest = 0 weedlevel = 0 // Reset - spawn(5) // Wait a while + sleep(5) // Wait a while update_icon() visible_message("The mutated weeds in [src] spawned a [myseed.plantname]!") else @@ -798,8 +798,7 @@ user << "You reconnect \the [src]'s hoses." for(var/obj/machinery/hydroponics/h in range(1,src)) - spawn() - h.update_icon() + h.update_icon() return diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index ad4f5ca3d08d..fd7fd1255aae 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -284,16 +284,14 @@ var/global/list/rockTurfEdgeCache countdown(notify_admins) /turf/simulated/mineral/gibtonite/proc/countdown(notify_admins = 0) - spawn(0) - while(stage == 1 && det_time > 0 && mineralAmt >= 1) - det_time-- - sleep(5) - if(stage == 1 && det_time <= 0 && mineralAmt >= 1) - var/turf/bombturf = get_turf(src) - mineralAmt = 0 - explosion(bombturf,1,3,5, adminlog = notify_admins) - if(stage == 0 || stage == 2) - return + set waitfor = 0 + while(stage == 1 && det_time > 0 && mineralAmt >= 1) + det_time-- + sleep(5) + if(stage == 1 && det_time <= 0 && mineralAmt >= 1) + var/turf/bombturf = get_turf(src) + mineralAmt = 0 + explosion(bombturf,1,3,5, adminlog = notify_admins) /turf/simulated/mineral/gibtonite/proc/defuse() if(stage == 1) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 1d3e6ed3a720..e918518c5bcd 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -182,9 +182,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(!istype(usr, /mob/dead/observer)) usr << "Not when you're not dead!" return - usr.verbs -= /mob/dead/observer/proc/dead_tele - spawn(30) - usr.verbs += /mob/dead/observer/proc/dead_tele var/A A = input("Area to jump to", "BOOYEA", A) as null|anything in sortedAreas var/area/thearea = A diff --git a/code/modules/mob/interactive.dm b/code/modules/mob/interactive.dm index 1bbb0e3ee550..44ecafca878d 100644 --- a/code/modules/mob/interactive.dm +++ b/code/modules/mob/interactive.dm @@ -324,8 +324,8 @@ //proc functions for(var/Proc in functions) if(!isnotfunc()) - spawn(1) - call(src,Proc)(src) + callfunction(Proc) + //target interaction stays hardcoded @@ -411,6 +411,9 @@ tryWalk(TARGET) LAST_TARGET = TARGET +/mob/living/carbon/human/interactive/proc/callfunction(Proc) + set waitfor = 0 + call(src,Proc)(src) /mob/living/carbon/human/interactive/proc/tryWalk(turf/TARGET) if(!isnotfunc()) if(!walk2derpless(TARGET)) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 361845912138..c7d8d2876973 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -364,22 +364,21 @@ var/const/GALOSHES_DONT_HELP = 4 adjustBruteLoss(10) /mob/living/carbon/proc/spin(spintime, speed) - spawn() - var/D = dir - while(spintime >= speed) - sleep(speed) - switch(D) - if(NORTH) - D = EAST - if(SOUTH) - D = WEST - if(EAST) - D = SOUTH - if(WEST) - D = NORTH - dir = D - spintime -= speed - return + set waitfor = 0 + var/D = dir + while(spintime >= speed) + sleep(speed) + switch(D) + if(NORTH) + D = EAST + if(SOUTH) + D = WEST + if(EAST) + D = SOUTH + if(WEST) + D = NORTH + dir = D + spintime -= speed /mob/living/carbon/resist_buckle() if(restrained()) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index bd834169e4e9..38207258210f 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1215,7 +1215,7 @@ H.adjustOxyLoss(8) H.throw_alert("too_much_co2", /obj/screen/alert/too_much_co2) if(prob(20)) // Lets give them some chance to know somethings not right though I guess. - spawn(0) H.emote("cough") + H.emote("cough") else H.co2overloadtime = 0 @@ -1279,7 +1279,7 @@ H.sleeping = max(H.sleeping+2, 10) else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning if(prob(20)) - spawn(0) H.emote(pick("giggle", "laugh")) + H.emote(pick("giggle", "laugh")) handle_breath_temperature(breath, H) @@ -1294,8 +1294,7 @@ if(!(NOBREATH in specflags) || (H.health <= config.health_threshold_crit)) if(prob(20)) - spawn(0) - H.emote("gasp") + H.emote("gasp") if(breath_pp > 0) var/ratio = safe_breath_min/breath_pp H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all! diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index cf61c41cdab3..b1797c1a63d5 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -48,7 +48,7 @@ if(losebreath > 0) losebreath-- if(prob(10)) - spawn emote("gasp") + emote("gasp") if(istype(loc, /obj/)) var/obj/loc_as_obj = loc loc_as_obj.handle_internal_lifeform(src,0) @@ -113,8 +113,7 @@ //OXYGEN if(O2_partialpressure < safe_oxy_min) //Not enough oxygen if(prob(20)) - spawn(0) - emote("gasp") + emote("gasp") if(O2_partialpressure > 0) var/ratio = safe_oxy_min/O2_partialpressure adjustOxyLoss(min(5*ratio, 3)) @@ -144,7 +143,7 @@ if(world.time - co2overloadtime > 300) adjustOxyLoss(8) if(prob(20)) - spawn(0) emote("cough") + emote("cough") else co2overloadtime = 0 @@ -168,7 +167,7 @@ sleeping = max(sleeping+2, 10) else if(SA_partialpressure > 0.01) if(prob(20)) - spawn(0) emote(pick("giggle","laugh")) + emote(pick("giggle","laugh")) //BREATH TEMPERATURE handle_breath_temperature(breath) @@ -264,21 +263,21 @@ /mob/living/carbon/handle_stomach() - spawn(0) - for(var/mob/living/M in stomach_contents) - if(M.loc != src) + set waitfor = 0 + for(var/mob/living/M in stomach_contents) + if(M.loc != src) + stomach_contents.Remove(M) + continue + if(istype(M, /mob/living/carbon) && stat != 2) + if(M.stat == 2) + M.death(1) stomach_contents.Remove(M) + qdel(M) continue - if(istype(M, /mob/living/carbon) && stat != 2) - if(M.stat == 2) - M.death(1) - stomach_contents.Remove(M) - qdel(M) - continue - if(SSmob.times_fired%3==1) - if(!(M.status_flags & GODMODE)) - M.adjustBruteLoss(5) - nutrition += 10 + if(SSmob.times_fired%3==1) + if(!(M.status_flags & GODMODE)) + M.adjustBruteLoss(5) + nutrition += 10 //This updates the health and status of the mob (conscious, unconscious, dead) /mob/living/carbon/handle_regular_status_updates() @@ -320,8 +319,7 @@ adjustStaminaLoss(-10) sleeping = max(sleeping-1, 0) if( prob(10) && health && !hal_crit ) - spawn(0) - emote("snore") + emote("snore") else clear_alert("asleep") diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index db7a3cf58d7d..43ab71591249 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -139,9 +139,7 @@ /mob/living/carbon/monkey/handle_random_events() if (prob(1) && prob(2)) - spawn(0) - emote("scratch") - return + emote("scratch") /mob/living/carbon/monkey/has_smoke_protection() if(wear_mask) diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 85216f02e9a2..ce5d5123f024 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -96,10 +96,8 @@ damage = rand(10, 15) if ( (paralysis < 5) && (health > 0) ) Paralyse(rand(10, 15)) - spawn( 0 ) - visible_message("[M] has knocked out [name]!", \ + visible_message("[M] has knocked out [name]!", \ "[M] has knocked out [name]!") - return adjustBruteLoss(damage) add_logs(M, src, "attacked") updatehealth() diff --git a/code/modules/mob/living/silicon/ai/death.dm b/code/modules/mob/living/silicon/ai/death.dm index af6786025bcf..9268598c985a 100644 --- a/code/modules/mob/living/silicon/ai/death.dm +++ b/code/modules/mob/living/silicon/ai/death.dm @@ -41,7 +41,6 @@ for(var/obj/machinery/ai_status_display/O in world) //change status if(src.key) - spawn( 0 ) O.mode = 2 if (istype(loc, /obj/item/device/aicard)) loc.icon_state = "aicard-404" diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 9e5386a65d94..bf77108174de 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -153,7 +153,7 @@ dat += "Critical Patient Alerts: [declare_crit ? "Yes" : "No"]
" dat += "Patrol Station: [auto_patrol ? "Yes" : "No"]
" dat += "Stationary Mode: [stationary_mode ? "Yes" : "No"]
" - + return dat /mob/living/simple_animal/bot/medbot/Topic(href, href_list) @@ -229,8 +229,7 @@ declare_crit = 0 if(user) user << "You short out [src]'s reagent synthesis circuits." - spawn(0) - audible_message("[src] buzzes oddly!") + audible_message("[src] buzzes oddly!") flick("medibot_spark", src) if(user) oldpatient = user diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index c7328140dd90..7bf00a90da56 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -116,13 +116,11 @@ //second, spin a sticky spiderweb on this tile var/obj/effect/spider/stickyweb/W = locate() in get_turf(src) if(!W) - spawn() - Web() + Web() else //third, lay an egg cluster there if(fed) - spawn() - LayEggs() + LayEggs() else //fourthly, cocoon any nearby items so those pesky pinkskins can't use them for(var/obj/O in can_see) @@ -140,8 +138,7 @@ else if(busy == MOVING_TO_TARGET && cocoon_target) if(get_dist(src, cocoon_target) <= 1) - spawn() - Wrap() + Wrap() else busy = 0 diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 76d5f7d8cd82..cfc637d3173b 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -275,13 +275,12 @@ else return L.loc = locate(locx,locy,mobloc.z) - spawn(0) - var/limit = 2//For only two trailing shadows. - for(var/turf/T in getline(mobloc, L.loc)) - spawn(0) - anim(T,L,'icons/mob/mob.dmi',,"shadow",,L.dir) - limit-- - if(limit<=0) break + var/limit = 2//For only two trailing shadows. + for(var/turf/T in getline(mobloc, L.loc)) + spawn(0) + anim(T,L,'icons/mob/mob.dmi',,"shadow",,L.dir) + limit-- + if(limit<=0) break else spawn(0) anim(mobloc,mob,'icons/mob/mob.dmi',,"shadow",,L.dir) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index a3c1db86c333..34f3a6de8eb1 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -365,18 +365,18 @@ return A.master.lightswitch && A.master.power_light /obj/machinery/light/proc/flicker(var/amount = rand(10, 20)) + set waitfor = 0 if(flickering) return flickering = 1 - spawn(0) - if(on && status == LIGHT_OK) - for(var/i = 0; i < amount; i++) - if(status != LIGHT_OK) break - on = !on - update(0) - sleep(rand(5, 15)) - on = (status == LIGHT_OK) + if(on && status == LIGHT_OK) + for(var/i = 0; i < amount; i++) + if(status != LIGHT_OK) break + on = !on update(0) - flickering = 0 + sleep(rand(5, 15)) + on = (status == LIGHT_OK) + update(0) + flickering = 0 // ai attack - make lights flicker, because why not @@ -539,13 +539,13 @@ // explode the light /obj/machinery/light/proc/explode() + set waitfor = 0 var/turf/T = get_turf(src.loc) - spawn(0) - broken() // break it first to give a warning - sleep(2) - explosion(T, 0, 0, 2, 2) - sleep(1) - qdel(src) + broken() // break it first to give a warning + sleep(2) + explosion(T, 0, 0, 2, 2) + sleep(1) + qdel(src) // the light item // can be tube or bulb subtypes diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index e1e2018779ec..d3d88edfbaf2 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -80,8 +80,7 @@ var/list/blacklisted_tesla_types = list(/obj/machinery/atmospherics, var/orbitsize = (I.Width()+I.Height())*pick(0.5,0.6,0.7) orbitsize -= (orbitsize/world.icon_size)*(world.icon_size*0.25) - spawn(1) - EB.orbit(src,orbitsize, pick(FALSE,TRUE), rand(10,25), pick(3,4,5,6,36)) + EB.orbit(src,orbitsize, pick(FALSE,TRUE), rand(10,25), pick(3,4,5,6,36)) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 51e0a7822be1..6d6a36df5846 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -105,8 +105,7 @@ /obj/item/weapon/gun/proc/shoot_live_shot(mob/living/user as mob|obj, pointblank = 0, mob/pbtarget = null, message = 1) if(recoil) - spawn() - shake_camera(user, recoil + 1, recoil) + shake_camera(user, recoil + 1, recoil) if(suppressed) playsound(user, fire_sound, 10, 1) diff --git a/code/modules/projectiles/guns/grenade_launcher.dm b/code/modules/projectiles/guns/grenade_launcher.dm index 2c38f1b8c857..3c4657947d6b 100644 --- a/code/modules/projectiles/guns/grenade_launcher.dm +++ b/code/modules/projectiles/guns/grenade_launcher.dm @@ -41,7 +41,7 @@ return if(grenades.len) - spawn(0) fire_grenade(target,user) + fire_grenade(target,user) else usr << "The grenade launcher is empty." @@ -51,7 +51,7 @@ var/obj/item/weapon/grenade/chem_grenade/F = grenades[1] //Now with less copypasta! grenades -= F F.loc = user.loc - F.throw_at(target, 30, 2,user) + F.throw_at_fast(target, 30, 2,user) message_admins("[key_name_admin(user)] fired a grenade ([F.name]) from a grenade launcher ([src.name]).") log_game("[key_name(user)] fired a grenade ([F.name]) from a grenade launcher ([src.name]).") F.active = 1 diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 7cf1c1ba5b26..c3a3cedada1c 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -122,18 +122,18 @@ /obj/item/projectile/proc/fire() - spawn(1) - while(loc) - if(!paused) - if((!( current ) || loc == current)) - current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z) - step_towards(src, current) - if(original && (original.layer>=2.75) || ismob(original)) - if(loc == get_turf(original)) - if(!(original in permutated)) - Bump(original, 1) - Range() - sleep(1) + set waitfor = 0 + while(loc) + if(!paused) + if((!( current ) || loc == current)) + current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z) + step_towards(src, current) + if(original && (original.layer>=2.75) || ismob(original)) + if(loc == get_turf(original)) + if(!(original in permutated)) + Bump(original, 1) + Range() + sleep(1) /obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it. diff --git a/code/modules/reagents/chemistry/reagents/blob_reagents.dm b/code/modules/reagents/chemistry/reagents/blob_reagents.dm index 4704c01e2510..ebb389a94825 100644 --- a/code/modules/reagents/chemistry/reagents/blob_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/blob_reagents.dm @@ -334,15 +334,15 @@ if(!X.anchored) var/distance = get_dist(X, pull) var/moving_power = max(range_power - distance, 1) - spawn(0) - if(moving_power > 2) //if the vortex is powerful and we're close, we get thrown - if(setting_type) - var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, pull))) - var/throw_range = 5 - distance - X.throw_at(throw_target, throw_range, 1) - else - X.throw_at(pull, distance, 1) + if(moving_power > 2) //if the vortex is powerful and we're close, we get thrown + if(setting_type) + var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, pull))) + var/throw_range = 5 - distance + X.throw_at_fast(throw_target, throw_range, 1) else + X.throw_at_fast(pull, distance, 1) + else + spawn(0) if(setting_type) for(var/i in 0 to moving_power-1) sleep(2) diff --git a/code/modules/reagents/chemistry/recipes.dm b/code/modules/reagents/chemistry/recipes.dm index 366ca9e74030..c03e3cf066f3 100644 --- a/code/modules/reagents/chemistry/recipes.dm +++ b/code/modules/reagents/chemistry/recipes.dm @@ -70,14 +70,14 @@ var/list/chemical_mob_spawn_nicecritters = list() // and possible friendly mobs if(!X.anchored) var/distance = get_dist(X, T) var/moving_power = max(range - distance, 1) - spawn(0) //so everything moves at the same time. - if(moving_power > 2) //if the vortex is powerful and we're close, we get thrown - if(setting_type) - var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, T))) - X.throw_at(throw_target, moving_power, 1) - else - X.throw_at(T, moving_power, 1) + if(moving_power > 2) //if the vortex is powerful and we're close, we get thrown + if(setting_type) + var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, T))) + X.throw_at_fast(throw_target, moving_power, 1) else + X.throw_at_fast(T, moving_power, 1) + else + spawn(0) //so everything moves at the same time. if(setting_type) for(var/i = 0, i < moving_power, i++) sleep(2) diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index eb72b18724f6..524348b117cb 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -104,15 +104,15 @@ use_power(100) affecting = loc.contents - src // moved items will be all in loc - spawn(1) // slight delay to prevent infinite propagation due to map order //TODO: please no spawn() in process(). It's a very bad idea - var/items_moved = 0 - for(var/atom/movable/A in affecting) - if(!A.anchored) - if(A.loc == src.loc) // prevents the object from being affected if it's not currently here. - step(A,movedir) - items_moved++ - if(items_moved >= 10) - break + sleep(1) // slight delay to prevent infinite propagation due to map order + var/items_moved = 0 + for(var/atom/movable/A in affecting) + if(!A.anchored) + if(A.loc == src.loc) // prevents the object from being affected if it's not currently here. + step(A,movedir) + items_moved++ + if(items_moved >= 10) + break // attack with item, place item on conveyor /obj/machinery/conveyor/attackby(obj/item/I, mob/user, params) diff --git a/code/modules/recycling/disposal-structures.dm b/code/modules/recycling/disposal-structures.dm index 24e12478be0c..d818c88567c6 100644 --- a/code/modules/recycling/disposal-structures.dm +++ b/code/modules/recycling/disposal-structures.dm @@ -62,13 +62,13 @@ loc = D.trunk active = 1 dir = DOWN - spawn(1) - move() // spawn off the movement process + move() return // movement process, persists while holder is moving through pipes /obj/structure/disposalholder/proc/move() + set waitfor = 0 var/obj/structure/disposalpipe/last while(active) var/obj/structure/disposalpipe/curr = loc diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 8c3330b90452..e3185534e1cc 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -385,11 +385,10 @@ //docking turbulence if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 2, 1) // turn it down a bit come on - else - shake_camera(M, 7, 1) + if(M.buckled) + shake_camera(M, 2, 1) // turn it down a bit come on + else + shake_camera(M, 7, 1) if(istype(M, /mob/living/carbon)) if(!M.buckled) M.Weaken(3)