removes a bunch of unneeded spawns

spawns have a high overhead.

I only went for easy targets, almost every spawn could be removed with a few subsystems in place to handle delays or cooldowns
This commit is contained in:
MrStonedOne
2016-01-02 18:23:02 -08:00
parent cfc6bb6208
commit b50e8d2a63
47 changed files with 448 additions and 468 deletions

View File

@@ -292,10 +292,13 @@
/atom/movable/var/pressure_resistance = 5 /atom/movable/var/pressure_resistance = 5
/atom/movable/proc/experience_pressure_difference(pressure_difference, direction) /atom/movable/proc/experience_pressure_difference(pressure_difference, direction)
set waitfor = 0
. = 0
if(!anchored && !pulledby) if(!anchored && !pulledby)
. = 1
if(pressure_difference > pressure_resistance) if(pressure_difference > pressure_resistance)
spawn step(src, direction) step(src, direction)
return 1

View File

@@ -26,10 +26,13 @@ var/datum/subsystem/timer/SStimer
if (!event.thingToCall || qdeleted(event.thingToCall)) if (!event.thingToCall || qdeleted(event.thingToCall))
qdel(event) qdel(event)
if (event.timeToRun <= world.time) if (event.timeToRun <= world.time)
spawn(-1) runevent(event)
call(event.thingToCall, event.procToCall)(arglist(event.argList))
qdel(event) qdel(event)
/datum/subsystem/timer/proc/runevent(datum/timedevent/event)
set waitfor = 0
call(event.thingToCall, event.procToCall)(arglist(event.argList))
/datum/timedevent /datum/timedevent
var/thingToCall var/thingToCall
var/procToCall var/procToCall

View File

@@ -135,32 +135,32 @@
if(work_sound) if(work_sound)
playsound(src, work_sound, 50, 1) playsound(src, work_sound, 50, 1)
icon_state = icon_creating 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("<span class='notice'>[src] [end_create_message]</span>")
icon_state = icon_recharging
sleep(cooldownTime)
if(stat != BROKEN)
icon_state = icon_on icon_state = icon_on
metal -= metal_cost else
glass -= glass_cost icon_state = icon_off
if(metal < 0) droneMadeRecently = 0
metal = 0 if(recharge_sound)
if(glass < 0) playsound(src, recharge_sound, 50, 1)
glass = 0 if(recharge_message)
if(power_used) visible_message("<span class='notice'>[src] [recharge_message]</span>")
use_power(power_used)
new dispense_type(loc)
if(create_sound)
playsound(src, create_sound, 50, 1)
if(end_create_message)
visible_message("<span class='notice'>[src] [end_create_message]</span>")
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("<span class='notice'>[src] [recharge_message]</span>")
/obj/machinery/droneDispenser/attackby(obj/item/O, mob/living/user) /obj/machinery/droneDispenser/attackby(obj/item/O, mob/living/user)
if(istype(O, /obj/item/stack)) if(istype(O, /obj/item/stack))

View File

@@ -504,8 +504,7 @@
if(!tryToShootAt(targets)) if(!tryToShootAt(targets))
if(!always_up) 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) /obj/machinery/porta_turret/proc/tryToShootAt(list/atom/movable/targets)

View File

@@ -44,9 +44,12 @@
/obj/machinery/status_display/New() /obj/machinery/status_display/New()
..() ..()
spawn(5) // must wait for map loading to finish if(SSradio)
if(SSradio) SSradio.add_object(src, frequency)
SSradio.add_object(src, frequency)
/obj/machinery/status_display/initialize()
if(SSradio)
SSradio.add_object(src, frequency)
/obj/machinery/status_display/Destroy() /obj/machinery/status_display/Destroy()
if(SSradio) if(SSradio)

View File

@@ -114,9 +114,8 @@
wires.Interact(user) wires.Interact(user)
if(!open_panel) if(!open_panel)
if(!active) if(!active)
spawn() settings(user)
settings(user) return
return
else if(anchored) else if(anchored)
user << "<span class='warning'>The bomb is bolted to the floor!</span>" user << "<span class='warning'>The bomb is bolted to the floor!</span>"
return return

View File

@@ -88,18 +88,18 @@
/obj/effect/decal/cleanable/blood/gibs/proc/streak(list/directions) /obj/effect/decal/cleanable/blood/gibs/proc/streak(list/directions)
spawn (0) set waitfor = 0
var/direction = pick(directions) var/direction = pick(directions)
for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++)
sleep(3) sleep(3)
if (i > 0) if (i > 0)
var/obj/effect/decal/cleanable/blood/b = new /obj/effect/decal/cleanable/blood/splatter(src.loc) var/obj/effect/decal/cleanable/blood/b = new /obj/effect/decal/cleanable/blood/splatter(src.loc)
for(var/datum/disease/D in src.viruses) for(var/datum/disease/D in src.viruses)
var/datum/disease/ND = D.Copy(1) var/datum/disease/ND = D.Copy(1)
b.viruses += ND b.viruses += ND
ND.holder = b ND.holder = b
if (step_to(src, get_step(src, direction), 0)) if (step_to(src, get_step(src, direction), 0))
break break
/obj/effect/decal/cleanable/blood/drip /obj/effect/decal/cleanable/blood/drip
name = "drips of blood" name = "drips of blood"

View File

@@ -14,19 +14,19 @@
bloodiness = MAX_SHOE_BLOODINESS bloodiness = MAX_SHOE_BLOODINESS
/obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions) /obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions)
spawn (0) set waitfor = 0
var/direction = pick(directions) var/direction = pick(directions)
for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++)
sleep(3) sleep(3)
if (i > 0) if (i > 0)
if (prob(40)) if (prob(40))
new /obj/effect/decal/cleanable/oil/streak(src.loc) new /obj/effect/decal/cleanable/oil/streak(src.loc)
else if (prob(10)) else if (prob(10))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(3, 1, src) s.set_up(3, 1, src)
s.start() s.start()
if (step_to(src, get_step(src, direction), 0)) if (step_to(src, get_step(src, direction), 0))
break break
/obj/effect/decal/cleanable/robot_debris/ex_act() /obj/effect/decal/cleanable/robot_debris/ex_act()
return return

View File

@@ -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) /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 src = null //so we don't abort once src is deleted
epicenter = get_turf(epicenter) epicenter = get_turf(epicenter)
@@ -30,126 +31,125 @@
flash_range = min (MAX_EX_FLASH_RANGE, flash_range) flash_range = min (MAX_EX_FLASH_RANGE, flash_range)
flame_range = min (MAX_EX_FLAME_RANGE, flame_range) flame_range = min (MAX_EX_FLAME_RANGE, flame_range)
spawn(0) var/start = world.timeofday
var/start = world.timeofday if(!epicenter) return
if(!epicenter) return
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range) var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range)
var/list/cached_exp_block = list() var/list/cached_exp_block = list()
if(adminlog) 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])") 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])") 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. // 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! // Stereo users will also hear the direction of the explosion!
// Calculate far explosion sound range. Only allow the sound effect for heavy/devastating explosions. // Calculate far explosion sound range. Only allow the sound effect for heavy/devastating explosions.
// 3/7/14 will calculate to 80 + 35 // 3/7/14 will calculate to 80 + 35
var/far_dist = 0 var/far_dist = 0
far_dist += heavy_impact_range * 5 far_dist += heavy_impact_range * 5
far_dist += devastation_range * 20 far_dist += devastation_range * 20
if(!silent) if(!silent)
var/frequency = get_rand_frequency() var/frequency = get_rand_frequency()
for(var/mob/M in player_list) for(var/mob/M in player_list)
// Double check for client // Double check for client
if(M && M.client) if(M && M.client)
var/turf/M_turf = get_turf(M) var/turf/M_turf = get_turf(M)
if(M_turf && M_turf.z == epicenter.z) if(M_turf && M_turf.z == epicenter.z)
var/dist = get_dist(M_turf, epicenter) var/dist = get_dist(M_turf, epicenter)
// If inside the blast radius + world.view - 2 // If inside the blast radius + world.view - 2
if(dist <= round(max_range + world.view - 2, 1)) 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 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. // 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) else if(dist <= far_dist)
var/far_volume = Clamp(far_dist, 30, 50) // Volume is based on explosion size and 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 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) M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1, frequency, falloff = 5)
//postpone processing for a bit //postpone processing for a bit
var/postponeCycles = max(round(devastation_range/8),1) var/postponeCycles = max(round(devastation_range/8),1)
SSlighting.postpone(postponeCycles) SSlighting.postpone(postponeCycles)
SSmachine.postpone(postponeCycles) SSmachine.postpone(postponeCycles)
if(heavy_impact_range > 1) if(heavy_impact_range > 1)
var/datum/effect_system/explosion/E = new/datum/effect_system/explosion() var/datum/effect_system/explosion/E = new/datum/effect_system/explosion()
E.set_up(epicenter) E.set_up(epicenter)
E.start() E.start()
var/x0 = epicenter.x var/x0 = epicenter.x
var/y0 = epicenter.y var/y0 = epicenter.y
var/z0 = epicenter.z 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) if(config.reactionary_explosions)
for(var/turf/T in affected_turfs) // we cache the explosion block rating of every turf in the explosion area var/turf/Trajectory = T
cached_exp_block[T] = 0 while(Trajectory != epicenter)
if(T.density && T.explosion_block) Trajectory = get_step_towards(Trajectory, epicenter)
cached_exp_block[T] += T.explosion_block dist += cached_exp_block[Trajectory]
for(var/obj/machinery/door/D in T) var/flame_dist = 0
if(D.density && D.explosion_block) var/throw_dist = dist
cached_exp_block[T] += D.explosion_block
for(var/obj/structure/window/W in T) if(dist < flame_range)
if(W.reinf && W.fulltile) flame_dist = 1
cached_exp_block[T] += W.explosion_block
for(var/obj/effect/blob/B in T) if(dist < devastation_range) dist = 1
cached_exp_block[T] += B.explosion_block 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) //--- THROW ITEMS AROUND ---
var/turf/Trajectory = T
while(Trajectory != epicenter)
Trajectory = get_step_towards(Trajectory, epicenter)
dist += cached_exp_block[Trajectory]
var/flame_dist = 0 var/throw_dir = get_dir(epicenter,T)
var/throw_dist = dist for(var/obj/item/I in T)
if(I && !I.anchored)
if(dist < flame_range) var/throw_range = rand(throw_dist, max_range)
flame_dist = 1 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)
if(dist < devastation_range) dist = 1 I.throw_at_fast(throw_at, throw_range, 2)//Throw it at 2 speed, this is purely visual anyway.
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/took = (world.timeofday-start)/10 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 //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." 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 return 1

View File

@@ -20,8 +20,7 @@
/obj/item/device/radio/intercom/attack_ai(mob/user) /obj/item/device/radio/intercom/attack_ai(mob/user)
src.add_fingerprint(user) src.add_fingerprint(user)
spawn (0) attack_self(user)
attack_self(user)
/obj/item/device/radio/intercom/attack_paw(mob/user) /obj/item/device/radio/intercom/attack_paw(mob/user)
return src.attack_hand(user) return src.attack_hand(user)
@@ -29,8 +28,7 @@
/obj/item/device/radio/intercom/attack_hand(mob/user) /obj/item/device/radio/intercom/attack_hand(mob/user)
src.add_fingerprint(user) src.add_fingerprint(user)
spawn (0) attack_self(user)
attack_self(user)
/obj/item/device/radio/intercom/receive_range(freq, level) /obj/item/device/radio/intercom/receive_range(freq, level)
if (!on) if (!on)

View File

@@ -40,16 +40,15 @@ effective or pretty fucking useless.
add_logs(user, null, "knocked down people in the area", src) add_logs(user, null, "knocked down people in the area", src)
for(var/mob/living/carbon/human/M in ultra_range(10, user, 1)) 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)) M.Weaken(rand(10,20))
if(prob(25)) if(prob(25))
M.Stun(rand(5,10)) M.Stun(rand(5,10))
M << "<span class='userdanger'>You feel a tremendous, paralyzing wave flood your mind.</span>" M << "<span class='userdanger'>You feel a tremendous, paralyzing wave flood your mind.</span>"
else else
M << "<span class='userdanger'>You feel a sudden, electric jolt travel through your head.</span>" M << "<span class='userdanger'>You feel a sudden, electric jolt travel through your head.</span>"
playsound(src.loc, 'sound/misc/interference.ogg', 50, 1) playsound(src.loc, 'sound/misc/interference.ogg', 50, 1)
user << "<span class='notice'>You trigger [src].</span>" user << "<span class='notice'>You trigger [src].</span>"

View File

@@ -422,7 +422,7 @@
if(istype(target, /obj/effect/decal/cleanable)) if(istype(target, /obj/effect/decal/cleanable))
target = target.loc target = target.loc
if(is_type_in_list(target,validSurfaces)) if(is_type_in_list(target,validSurfaces))
var/temp = "rune" var/temp = "rune"
if(letters.Find(drawtype)) if(letters.Find(drawtype))
temp = "letter" temp = "letter"
@@ -1106,13 +1106,13 @@
if (cooldown < world.time) if (cooldown < world.time)
cooldown = world.time + 1800 //3 minutes cooldown = world.time + 1800 //3 minutes
user.visible_message("<span class='warning'>[user] presses a button on [src].</span>", "<span class='notice'>You activate [src], it plays a loud noise!</span>", "<span class='italics'>You hear the click of a button.</span>") user.visible_message("<span class='warning'>[user] presses a button on [src].</span>", "<span class='notice'>You activate [src], it plays a loud noise!</span>", "<span class='italics'>You hear the click of a button.</span>")
spawn(5) //gia said so sleep(5)
icon_state = "nuketoy" icon_state = "nuketoy"
playsound(src, 'sound/machines/Alarm.ogg', 100, 0, surround = 0) playsound(src, 'sound/machines/Alarm.ogg', 100, 0, surround = 0)
sleep(135) sleep(135)
icon_state = "nuketoycool" icon_state = "nuketoycool"
sleep(cooldown - world.time) sleep(cooldown - world.time)
icon_state = "nuketoyidle" icon_state = "nuketoyidle"
else else
var/timeleft = (cooldown - world.time) var/timeleft = (cooldown - world.time)
user << "<span class='alert'>Nothing happens, and '</span>[round(timeleft/10)]<span class='alert'>' appears on a small display.</span>" user << "<span class='alert'>Nothing happens, and '</span>[round(timeleft/10)]<span class='alert'>' appears on a small display.</span>"

View File

@@ -23,8 +23,7 @@
user << "<span class='notice'>You'll need to get closer to see any more.</span>" user << "<span class='notice'>You'll need to get closer to see any more.</span>"
return return
for(var/obj/item/I in loadedItems) for(var/obj/item/I in loadedItems)
spawn(0) user << "<span class='info'>\icon [I] It has \the [I] loaded.</span>"
user << "<span class='info'>\icon [I] It has \the [I] loaded.</span>"
if(tank) if(tank)
user << "<span class='notice'>\icon [tank] It has \the [tank] mounted onto it.</span>" user << "<span class='notice'>\icon [tank] It has \the [tank] mounted onto it.</span>"

View File

@@ -93,13 +93,12 @@
"<span class='userdanger'>You feel a powerful shock course through your body sending you flying!</span>", \ "<span class='userdanger'>You feel a powerful shock course through your body sending you flying!</span>", \
"<span class='italics'>You hear a heavy electrical crack!</span>") "<span class='italics'>You hear a heavy electrical crack!</span>")
var/atom/throw_target = get_edge_target_turf(target, get_dir(src, get_step_away(target, src))) 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 return
/obj/item/weapon/twohanded/mjollnir/attack(mob/M, mob/user) /obj/item/weapon/twohanded/mjollnir/attack(mob/M, mob/user)
..() ..()
spawn(0)
if(wielded) if(wielded)
//if(charged == 5) //if(charged == 5)
//charged = 0 //charged = 0

View File

@@ -128,13 +128,12 @@
return return
for(var/obj/structure/transit_tube_pod/pod in loc) for(var/obj/structure/transit_tube_pod/pod in loc)
if(!pod.moving && turn(pod.dir, (reverse_launch ? 180 : 0)) in directions()) if(!pod.moving && turn(pod.dir, (reverse_launch ? 180 : 0)) in directions())
spawn(0) pod_moving = 1
pod_moving = 1 close_animation()
close_animation() sleep(CLOSE_DURATION + 2)
sleep(CLOSE_DURATION + 2) if(icon_state == "closed" && pod)
if(icon_state == "closed" && pod) pod.follow_tube(reverse_launch)
pod.follow_tube(reverse_launch) pod_moving = 0
pod_moving = 0
return 1 return 1
return 0 return 0

View File

@@ -61,62 +61,63 @@
else return ..() else return ..()
/obj/structure/transit_tube_pod/proc/follow_tube(reverse_launch) /obj/structure/transit_tube_pod/proc/follow_tube(reverse_launch)
set waitfor = 0
if(moving) if(moving)
return return
moving = 1 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) var/obj/structure/transit_tube/current_tube = null
dir = turn(dir, 180) // Back it up var/next_dir
var/next_loc
var/last_delay = 0
var/exit_delay
for(var/obj/structure/transit_tube/tube in loc) if(reverse_launch)
if(tube.has_exit(dir)) 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 current_tube = tube
break break
while(current_tube) if(current_tube == null)
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)
dir = next_dir dir = next_dir
loc = next_loc // When moving from one tube to another, skip collision and such. Move(get_step(loc, dir), dir) // Allow collisions when leaving the tubes.
density = current_tube.density break
if(current_tube && current_tube.should_stop_pod(src, next_dir)) last_delay = current_tube.enter_delay(src, next_dir)
current_tube.pod_stopped(src, dir) sleep(last_delay)
break dir = next_dir
loc = next_loc // When moving from one tube to another, skip collision and such.
density = current_tube.density
density = 1 if(current_tube && current_tube.should_stop_pod(src, next_dir))
moving = 0 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 // Should I return a copy here? If the caller edits or del()s the returned

View File

@@ -93,14 +93,11 @@
for(var/datum/d in objs) for(var/datum/d in objs)
for(var/v in call_list) for(var/v in call_list)
// To stop any procs which sleep from executing slowly. SDQL_callproc(d, v, args_list)
if(d)
if(hascall(d, v))
spawn() call(d, v)(arglist(args_list)) // Spawn in case the function sleeps.
if("delete") if("delete")
for(var/datum/d in objs) for(var/datum/d in objs)
del d qdel(d)
if("select") if("select")
var/text = "" 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) /proc/SDQL_parse(list/query_list)
var/datum/SDQL_parser/parser = new() var/datum/SDQL_parser/parser = new()

View File

@@ -28,72 +28,73 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
/client/proc/callproc() /client/proc/callproc()
set category = "Debug" set category = "Debug"
set name = "Advanced ProcCall" set name = "Advanced ProcCall"
set waitfor = 0
if(!check_rights(R_DEBUG)) return if(!check_rights(R_DEBUG)) return
spawn(0) var/target = null
var/target = null var/targetselected = 0
var/targetselected = 0 var/returnval = null
var/returnval = null var/class = null
var/class = null
switch(alert("Proc owned by something?",,"Yes","No")) switch(alert("Proc owned by something?",,"Yes","No"))
if("Yes") if("Yes")
targetselected = 1 targetselected = 1
if(src.holder && src.holder.marked_datum) 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])") 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])") if(class == "Marked datum ([holder.marked_datum.type])")
class = "Marked datum" 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 else
class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client") return
switch(class) if("No")
if("Obj") target = null
target = input("Enter target:","Target",usr) as obj in world targetselected = 0
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
var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null
if(!procname) return if(!procname) return
if(targetselected && !hascall(target,procname)) if(targetselected && !hascall(target,procname))
usr << "<font color='red'>Error: callproc(): target has no such call [procname].</font>" usr << "<font color='red'>Error: callproc(): target has no such call [procname].</font>"
return return
var/list/lst = get_callproc_args() var/list/lst = get_callproc_args()
if(!lst) if(!lst)
return
if(targetselected)
if(!target)
usr << "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>"
return 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) usr << "<font color='blue'>[procname] returned: [returnval ? returnval : "null"]</font>"
if(!target) feedback_add_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
usr << "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>"
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 << "<font color='blue'>[procname] returned: [returnval ? returnval : "null"]</font>"
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) /client/proc/callproc_datum(A as null|area|mob|obj|turf)
set category = "Debug" set category = "Debug"
set name = "Atom ProcCall" set name = "Atom ProcCall"
set waitfor = 0
if(!check_rights(R_DEBUG)) if(!check_rights(R_DEBUG))
return return
@@ -113,12 +114,13 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return return
log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") 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"].") 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 << "<span class='notice'>[procname] returned: [returnval ? returnval : "null"]</span>"
feedback_add_details("admin_verb","DPC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! 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 << "<span class='notice'>[procname] returned: [returnval ? returnval : "null"]</span>"
/client/proc/get_callproc_args() /client/proc/get_callproc_args()
var/argnum = input("Number of arguments","Number:",0) as num|null var/argnum = input("Number of arguments","Number:",0) as num|null
if(!argnum && (argnum!=0)) return 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)) if(istype(M, /mob/living/carbon/human))
log_admin("[key_name(src)] has robotized [M.key].") log_admin("[key_name(src)] has robotized [M.key].")
var/mob/living/carbon/human/H = M var/mob/living/carbon/human/H = M
spawn(10) spawn(0)
H.Robotize() H.Robotize()
else 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)) if(istype(M, /mob/living/carbon/human))
log_admin("[key_name(src)] has blobized [M.key].") log_admin("[key_name(src)] has blobized [M.key].")
var/mob/living/carbon/human/H = M var/mob/living/carbon/human/H = M
spawn(10) spawn(0)
H.Blobize() H.Blobize()
else else
@@ -247,7 +249,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return return
log_admin("[key_name(src)] has animalized [M.key].") log_admin("[key_name(src)] has animalized [M.key].")
spawn(10) spawn(0)
M.Animalize() M.Animalize()
@@ -287,7 +289,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return return
if(ishuman(M)) if(ishuman(M))
log_admin("[key_name(src)] has alienized [M.key].") log_admin("[key_name(src)] has alienized [M.key].")
spawn(10) spawn(0)
M:Alienize() M:Alienize()
feedback_add_details("admin_verb","MKAL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! 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.") 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 return
if(ishuman(M)) if(ishuman(M))
log_admin("[key_name(src)] has slimeized [M.key].") log_admin("[key_name(src)] has slimeized [M.key].")
spawn(10) spawn(0)
M:slimeize() M:slimeize()
feedback_add_details("admin_verb","MKMET") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! 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.") log_admin("[key_name(usr)] made [key_name(M)] into a slime.")

View File

@@ -76,7 +76,6 @@
if (M.id == src.id) if (M.id == src.id)
spawn( 0 ) spawn( 0 )
M.open() M.open()
return
sleep(10) sleep(10)
@@ -90,7 +89,6 @@
if (M.id == src.id) if (M.id == src.id)
spawn( 0 ) spawn( 0 )
M.close() M.close()
return
sleep(10) sleep(10)
cooldown = 0 cooldown = 0

View File

@@ -56,7 +56,6 @@
cooldown = 2 cooldown = 2
spawn(10) spawn(10)
process_cooldown() process_cooldown()
return
/obj/item/device/assembly/prox_sensor/process() /obj/item/device/assembly/prox_sensor/process()
@@ -71,15 +70,13 @@
/obj/item/device/assembly/prox_sensor/dropped() /obj/item/device/assembly/prox_sensor/dropped()
spawn(0) spawn(0)
sense() sense()
return
return
/obj/item/device/assembly/prox_sensor/toggle_scan() /obj/item/device/assembly/prox_sensor/toggle_scan()
if(!secured) return 0 if(!secured) return 0
scanning = !scanning scanning = !scanning
update_icon() update_icon()
return
/obj/item/device/assembly/prox_sensor/update_icon() /obj/item/device/assembly/prox_sensor/update_icon()

View File

@@ -17,7 +17,7 @@
..() ..()
spawn(40) spawn(40)
set_frequency(frequency) set_frequency(frequency)
return
/obj/item/device/assembly/signaler/Destroy() /obj/item/device/assembly/signaler/Destroy()
if(SSradio) if(SSradio)

View File

@@ -334,6 +334,6 @@ var/next_external_rsc = 0
'html/browser/scannernew.css', 'html/browser/scannernew.css',
'html/browser/playeroptions.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 //Precache the client with all other assets slowly, so as to not block other browse() calls
getFilesSlow(src, SSasset.cache, register_asset = FALSE) getFilesSlow(src, SSasset.cache, register_asset = FALSE)

View File

@@ -18,7 +18,7 @@
if(turfs.len) //Pick a turf to spawn at if we can if(turfs.len) //Pick a turf to spawn at if we can
var/turf/simulated/T = pick(turfs) 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 /datum/spacevine_mutation

View File

@@ -1,4 +1,5 @@
/mob/living/carbon/proc/dream() /mob/living/carbon/proc/dream()
set waitfor = 0
dreaming = 1 dreaming = 1
var/list/dreams = list( var/list/dreams = list(
"an ID card","a bottle","a familiar face","a crewmember","a toolbox","a security officer","the captain", "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", "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" "riches","space","a crash","happiness","pride","a fall","water","flames","ice","melons","flying"
) )
spawn(0) for(var/i = rand(1,4),i > 0, i--)
for(var/i = rand(1,4),i > 0, i--) var/dream_image = pick(dreams)
var/dream_image = pick(dreams) dreams -= dream_image
dreams -= dream_image src << "<span class='notice'><i>... [dream_image] ...</i></span>"
src << "<span class='notice'><i>... [dream_image] ...</i></span>" sleep(rand(40,70))
sleep(rand(40,70)) if(paralysis <= 0)
if(paralysis <= 0) dreaming = 0
dreaming = 0 return 0
return 0 dreaming = 0
dreaming = 0 return 1
return 1
/mob/living/carbon/proc/handle_dreams() /mob/living/carbon/proc/handle_dreams()
if(prob(5) && !dreaming) dream() if(prob(5) && !dreaming) dream()

View File

@@ -377,7 +377,7 @@
harvest = 0 harvest = 0
weedlevel = 0 // Reset weedlevel = 0 // Reset
spawn(5) // Wait a while sleep(5) // Wait a while
update_icon() update_icon()
visible_message("<span class='warning'>[oldPlantName] suddenly mutated into [myseed.plantname]!</span>") visible_message("<span class='warning'>[oldPlantName] suddenly mutated into [myseed.plantname]!</span>")
@@ -397,7 +397,7 @@
harvest = 0 harvest = 0
weedlevel = 0 // Reset weedlevel = 0 // Reset
spawn(5) // Wait a while sleep(5) // Wait a while
update_icon() update_icon()
visible_message("<span class='warning'>The mutated weeds in [src] spawned a [myseed.plantname]!</span>") visible_message("<span class='warning'>The mutated weeds in [src] spawned a [myseed.plantname]!</span>")
else else
@@ -798,8 +798,7 @@
user << "<span class='notice'>You reconnect \the [src]'s hoses.</span>" user << "<span class='notice'>You reconnect \the [src]'s hoses.</span>"
for(var/obj/machinery/hydroponics/h in range(1,src)) for(var/obj/machinery/hydroponics/h in range(1,src))
spawn() h.update_icon()
h.update_icon()
return return

View File

@@ -284,16 +284,14 @@ var/global/list/rockTurfEdgeCache
countdown(notify_admins) countdown(notify_admins)
/turf/simulated/mineral/gibtonite/proc/countdown(notify_admins = 0) /turf/simulated/mineral/gibtonite/proc/countdown(notify_admins = 0)
spawn(0) set waitfor = 0
while(stage == 1 && det_time > 0 && mineralAmt >= 1) while(stage == 1 && det_time > 0 && mineralAmt >= 1)
det_time-- det_time--
sleep(5) sleep(5)
if(stage == 1 && det_time <= 0 && mineralAmt >= 1) if(stage == 1 && det_time <= 0 && mineralAmt >= 1)
var/turf/bombturf = get_turf(src) var/turf/bombturf = get_turf(src)
mineralAmt = 0 mineralAmt = 0
explosion(bombturf,1,3,5, adminlog = notify_admins) explosion(bombturf,1,3,5, adminlog = notify_admins)
if(stage == 0 || stage == 2)
return
/turf/simulated/mineral/gibtonite/proc/defuse() /turf/simulated/mineral/gibtonite/proc/defuse()
if(stage == 1) if(stage == 1)

View File

@@ -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)) if(!istype(usr, /mob/dead/observer))
usr << "Not when you're not dead!" usr << "Not when you're not dead!"
return return
usr.verbs -= /mob/dead/observer/proc/dead_tele
spawn(30)
usr.verbs += /mob/dead/observer/proc/dead_tele
var/A var/A
A = input("Area to jump to", "BOOYEA", A) as null|anything in sortedAreas A = input("Area to jump to", "BOOYEA", A) as null|anything in sortedAreas
var/area/thearea = A var/area/thearea = A

View File

@@ -324,8 +324,8 @@
//proc functions //proc functions
for(var/Proc in functions) for(var/Proc in functions)
if(!isnotfunc()) if(!isnotfunc())
spawn(1) callfunction(Proc)
call(src,Proc)(src)
//target interaction stays hardcoded //target interaction stays hardcoded
@@ -411,6 +411,9 @@
tryWalk(TARGET) tryWalk(TARGET)
LAST_TARGET = 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) /mob/living/carbon/human/interactive/proc/tryWalk(turf/TARGET)
if(!isnotfunc()) if(!isnotfunc())
if(!walk2derpless(TARGET)) if(!walk2derpless(TARGET))

View File

@@ -364,22 +364,21 @@ var/const/GALOSHES_DONT_HELP = 4
adjustBruteLoss(10) adjustBruteLoss(10)
/mob/living/carbon/proc/spin(spintime, speed) /mob/living/carbon/proc/spin(spintime, speed)
spawn() set waitfor = 0
var/D = dir var/D = dir
while(spintime >= speed) while(spintime >= speed)
sleep(speed) sleep(speed)
switch(D) switch(D)
if(NORTH) if(NORTH)
D = EAST D = EAST
if(SOUTH) if(SOUTH)
D = WEST D = WEST
if(EAST) if(EAST)
D = SOUTH D = SOUTH
if(WEST) if(WEST)
D = NORTH D = NORTH
dir = D dir = D
spintime -= speed spintime -= speed
return
/mob/living/carbon/resist_buckle() /mob/living/carbon/resist_buckle()
if(restrained()) if(restrained())

View File

@@ -1215,7 +1215,7 @@
H.adjustOxyLoss(8) H.adjustOxyLoss(8)
H.throw_alert("too_much_co2", /obj/screen/alert/too_much_co2) 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. 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 else
H.co2overloadtime = 0 H.co2overloadtime = 0
@@ -1279,7 +1279,7 @@
H.sleeping = max(H.sleeping+2, 10) 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 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)) if(prob(20))
spawn(0) H.emote(pick("giggle", "laugh")) H.emote(pick("giggle", "laugh"))
handle_breath_temperature(breath, H) handle_breath_temperature(breath, H)
@@ -1294,8 +1294,7 @@
if(!(NOBREATH in specflags) || (H.health <= config.health_threshold_crit)) if(!(NOBREATH in specflags) || (H.health <= config.health_threshold_crit))
if(prob(20)) if(prob(20))
spawn(0) H.emote("gasp")
H.emote("gasp")
if(breath_pp > 0) if(breath_pp > 0)
var/ratio = safe_breath_min/breath_pp 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! H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!

View File

@@ -48,7 +48,7 @@
if(losebreath > 0) if(losebreath > 0)
losebreath-- losebreath--
if(prob(10)) if(prob(10))
spawn emote("gasp") emote("gasp")
if(istype(loc, /obj/)) if(istype(loc, /obj/))
var/obj/loc_as_obj = loc var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src,0) loc_as_obj.handle_internal_lifeform(src,0)
@@ -113,8 +113,7 @@
//OXYGEN //OXYGEN
if(O2_partialpressure < safe_oxy_min) //Not enough oxygen if(O2_partialpressure < safe_oxy_min) //Not enough oxygen
if(prob(20)) if(prob(20))
spawn(0) emote("gasp")
emote("gasp")
if(O2_partialpressure > 0) if(O2_partialpressure > 0)
var/ratio = safe_oxy_min/O2_partialpressure var/ratio = safe_oxy_min/O2_partialpressure
adjustOxyLoss(min(5*ratio, 3)) adjustOxyLoss(min(5*ratio, 3))
@@ -144,7 +143,7 @@
if(world.time - co2overloadtime > 300) if(world.time - co2overloadtime > 300)
adjustOxyLoss(8) adjustOxyLoss(8)
if(prob(20)) if(prob(20))
spawn(0) emote("cough") emote("cough")
else else
co2overloadtime = 0 co2overloadtime = 0
@@ -168,7 +167,7 @@
sleeping = max(sleeping+2, 10) sleeping = max(sleeping+2, 10)
else if(SA_partialpressure > 0.01) else if(SA_partialpressure > 0.01)
if(prob(20)) if(prob(20))
spawn(0) emote(pick("giggle","laugh")) emote(pick("giggle","laugh"))
//BREATH TEMPERATURE //BREATH TEMPERATURE
handle_breath_temperature(breath) handle_breath_temperature(breath)
@@ -264,21 +263,21 @@
/mob/living/carbon/handle_stomach() /mob/living/carbon/handle_stomach()
spawn(0) set waitfor = 0
for(var/mob/living/M in stomach_contents) for(var/mob/living/M in stomach_contents)
if(M.loc != src) 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) stomach_contents.Remove(M)
qdel(M)
continue continue
if(istype(M, /mob/living/carbon) && stat != 2) if(SSmob.times_fired%3==1)
if(M.stat == 2) if(!(M.status_flags & GODMODE))
M.death(1) M.adjustBruteLoss(5)
stomach_contents.Remove(M) nutrition += 10
qdel(M)
continue
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) //This updates the health and status of the mob (conscious, unconscious, dead)
/mob/living/carbon/handle_regular_status_updates() /mob/living/carbon/handle_regular_status_updates()
@@ -320,8 +319,7 @@
adjustStaminaLoss(-10) adjustStaminaLoss(-10)
sleeping = max(sleeping-1, 0) sleeping = max(sleeping-1, 0)
if( prob(10) && health && !hal_crit ) if( prob(10) && health && !hal_crit )
spawn(0) emote("snore")
emote("snore")
else else
clear_alert("asleep") clear_alert("asleep")

View File

@@ -139,9 +139,7 @@
/mob/living/carbon/monkey/handle_random_events() /mob/living/carbon/monkey/handle_random_events()
if (prob(1) && prob(2)) if (prob(1) && prob(2))
spawn(0) emote("scratch")
emote("scratch")
return
/mob/living/carbon/monkey/has_smoke_protection() /mob/living/carbon/monkey/has_smoke_protection()
if(wear_mask) if(wear_mask)

View File

@@ -96,10 +96,8 @@
damage = rand(10, 15) damage = rand(10, 15)
if ( (paralysis < 5) && (health > 0) ) if ( (paralysis < 5) && (health > 0) )
Paralyse(rand(10, 15)) Paralyse(rand(10, 15))
spawn( 0 ) visible_message("<span class='danger'>[M] has knocked out [name]!</span>", \
visible_message("<span class='danger'>[M] has knocked out [name]!</span>", \
"<span class='userdanger'>[M] has knocked out [name]!</span>") "<span class='userdanger'>[M] has knocked out [name]!</span>")
return
adjustBruteLoss(damage) adjustBruteLoss(damage)
add_logs(M, src, "attacked") add_logs(M, src, "attacked")
updatehealth() updatehealth()

View File

@@ -41,7 +41,6 @@
for(var/obj/machinery/ai_status_display/O in world) //change status for(var/obj/machinery/ai_status_display/O in world) //change status
if(src.key) if(src.key)
spawn( 0 )
O.mode = 2 O.mode = 2
if (istype(loc, /obj/item/device/aicard)) if (istype(loc, /obj/item/device/aicard))
loc.icon_state = "aicard-404" loc.icon_state = "aicard-404"

View File

@@ -153,7 +153,7 @@
dat += "Critical Patient Alerts: <a href='?src=\ref[src];critalerts=1'>[declare_crit ? "Yes" : "No"]</a><br>" dat += "Critical Patient Alerts: <a href='?src=\ref[src];critalerts=1'>[declare_crit ? "Yes" : "No"]</a><br>"
dat += "Patrol Station: <a href='?src=\ref[src];operation=patrol'>[auto_patrol ? "Yes" : "No"]</a><br>" dat += "Patrol Station: <a href='?src=\ref[src];operation=patrol'>[auto_patrol ? "Yes" : "No"]</a><br>"
dat += "Stationary Mode: <a href='?src=\ref[src];stationary=1'>[stationary_mode ? "Yes" : "No"]</a><br>" dat += "Stationary Mode: <a href='?src=\ref[src];stationary=1'>[stationary_mode ? "Yes" : "No"]</a><br>"
return dat return dat
/mob/living/simple_animal/bot/medbot/Topic(href, href_list) /mob/living/simple_animal/bot/medbot/Topic(href, href_list)
@@ -229,8 +229,7 @@
declare_crit = 0 declare_crit = 0
if(user) if(user)
user << "<span class='notice'>You short out [src]'s reagent synthesis circuits.</span>" user << "<span class='notice'>You short out [src]'s reagent synthesis circuits.</span>"
spawn(0) audible_message("<span class='danger'>[src] buzzes oddly!</span>")
audible_message("<span class='danger'>[src] buzzes oddly!</span>")
flick("medibot_spark", src) flick("medibot_spark", src)
if(user) if(user)
oldpatient = user oldpatient = user

View File

@@ -116,13 +116,11 @@
//second, spin a sticky spiderweb on this tile //second, spin a sticky spiderweb on this tile
var/obj/effect/spider/stickyweb/W = locate() in get_turf(src) var/obj/effect/spider/stickyweb/W = locate() in get_turf(src)
if(!W) if(!W)
spawn() Web()
Web()
else else
//third, lay an egg cluster there //third, lay an egg cluster there
if(fed) if(fed)
spawn() LayEggs()
LayEggs()
else else
//fourthly, cocoon any nearby items so those pesky pinkskins can't use them //fourthly, cocoon any nearby items so those pesky pinkskins can't use them
for(var/obj/O in can_see) for(var/obj/O in can_see)
@@ -140,8 +138,7 @@
else if(busy == MOVING_TO_TARGET && cocoon_target) else if(busy == MOVING_TO_TARGET && cocoon_target)
if(get_dist(src, cocoon_target) <= 1) if(get_dist(src, cocoon_target) <= 1)
spawn() Wrap()
Wrap()
else else
busy = 0 busy = 0

View File

@@ -275,13 +275,12 @@
else else
return return
L.loc = locate(locx,locy,mobloc.z) L.loc = locate(locx,locy,mobloc.z)
spawn(0) var/limit = 2//For only two trailing shadows.
var/limit = 2//For only two trailing shadows. for(var/turf/T in getline(mobloc, L.loc))
for(var/turf/T in getline(mobloc, L.loc)) spawn(0)
spawn(0) anim(T,L,'icons/mob/mob.dmi',,"shadow",,L.dir)
anim(T,L,'icons/mob/mob.dmi',,"shadow",,L.dir) limit--
limit-- if(limit<=0) break
if(limit<=0) break
else else
spawn(0) spawn(0)
anim(mobloc,mob,'icons/mob/mob.dmi',,"shadow",,L.dir) anim(mobloc,mob,'icons/mob/mob.dmi',,"shadow",,L.dir)

View File

@@ -365,18 +365,18 @@
return A.master.lightswitch && A.master.power_light return A.master.lightswitch && A.master.power_light
/obj/machinery/light/proc/flicker(var/amount = rand(10, 20)) /obj/machinery/light/proc/flicker(var/amount = rand(10, 20))
set waitfor = 0
if(flickering) return if(flickering) return
flickering = 1 flickering = 1
spawn(0) if(on && status == LIGHT_OK)
if(on && status == LIGHT_OK) for(var/i = 0; i < amount; i++)
for(var/i = 0; i < amount; i++) if(status != LIGHT_OK) break
if(status != LIGHT_OK) break on = !on
on = !on
update(0)
sleep(rand(5, 15))
on = (status == LIGHT_OK)
update(0) update(0)
flickering = 0 sleep(rand(5, 15))
on = (status == LIGHT_OK)
update(0)
flickering = 0
// ai attack - make lights flicker, because why not // ai attack - make lights flicker, because why not
@@ -539,13 +539,13 @@
// explode the light // explode the light
/obj/machinery/light/proc/explode() /obj/machinery/light/proc/explode()
set waitfor = 0
var/turf/T = get_turf(src.loc) var/turf/T = get_turf(src.loc)
spawn(0) broken() // break it first to give a warning
broken() // break it first to give a warning sleep(2)
sleep(2) explosion(T, 0, 0, 2, 2)
explosion(T, 0, 0, 2, 2) sleep(1)
sleep(1) qdel(src)
qdel(src)
// the light item // the light item
// can be tube or bulb subtypes // can be tube or bulb subtypes

View File

@@ -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) var/orbitsize = (I.Width()+I.Height())*pick(0.5,0.6,0.7)
orbitsize -= (orbitsize/world.icon_size)*(world.icon_size*0.25) 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))

View File

@@ -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) /obj/item/weapon/gun/proc/shoot_live_shot(mob/living/user as mob|obj, pointblank = 0, mob/pbtarget = null, message = 1)
if(recoil) if(recoil)
spawn() shake_camera(user, recoil + 1, recoil)
shake_camera(user, recoil + 1, recoil)
if(suppressed) if(suppressed)
playsound(user, fire_sound, 10, 1) playsound(user, fire_sound, 10, 1)

View File

@@ -41,7 +41,7 @@
return return
if(grenades.len) if(grenades.len)
spawn(0) fire_grenade(target,user) fire_grenade(target,user)
else else
usr << "<span class='danger'>The grenade launcher is empty.</span>" usr << "<span class='danger'>The grenade launcher is empty.</span>"
@@ -51,7 +51,7 @@
var/obj/item/weapon/grenade/chem_grenade/F = grenades[1] //Now with less copypasta! var/obj/item/weapon/grenade/chem_grenade/F = grenades[1] //Now with less copypasta!
grenades -= F grenades -= F
F.loc = user.loc 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]).") 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]).") log_game("[key_name(user)] fired a grenade ([F.name]) from a grenade launcher ([src.name]).")
F.active = 1 F.active = 1

View File

@@ -122,18 +122,18 @@
/obj/item/projectile/proc/fire() /obj/item/projectile/proc/fire()
spawn(1) set waitfor = 0
while(loc) while(loc)
if(!paused) if(!paused)
if((!( current ) || loc == current)) if((!( current ) || loc == current))
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z) current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
step_towards(src, current) step_towards(src, current)
if(original && (original.layer>=2.75) || ismob(original)) if(original && (original.layer>=2.75) || ismob(original))
if(loc == get_turf(original)) if(loc == get_turf(original))
if(!(original in permutated)) if(!(original in permutated))
Bump(original, 1) Bump(original, 1)
Range() Range()
sleep(1) sleep(1)
/obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it. /obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it.

View File

@@ -334,15 +334,15 @@
if(!X.anchored) if(!X.anchored)
var/distance = get_dist(X, pull) var/distance = get_dist(X, pull)
var/moving_power = max(range_power - distance, 1) 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(moving_power > 2) //if the vortex is powerful and we're close, we get thrown if(setting_type)
if(setting_type) var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, pull)))
var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, pull))) var/throw_range = 5 - distance
var/throw_range = 5 - distance X.throw_at_fast(throw_target, throw_range, 1)
X.throw_at(throw_target, throw_range, 1)
else
X.throw_at(pull, distance, 1)
else else
X.throw_at_fast(pull, distance, 1)
else
spawn(0)
if(setting_type) if(setting_type)
for(var/i in 0 to moving_power-1) for(var/i in 0 to moving_power-1)
sleep(2) sleep(2)

View File

@@ -70,14 +70,14 @@ var/list/chemical_mob_spawn_nicecritters = list() // and possible friendly mobs
if(!X.anchored) if(!X.anchored)
var/distance = get_dist(X, T) var/distance = get_dist(X, T)
var/moving_power = max(range - distance, 1) 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(moving_power > 2) //if the vortex is powerful and we're close, we get thrown if(setting_type)
if(setting_type) var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, T)))
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)
X.throw_at(throw_target, moving_power, 1)
else
X.throw_at(T, moving_power, 1)
else else
X.throw_at_fast(T, moving_power, 1)
else
spawn(0) //so everything moves at the same time.
if(setting_type) if(setting_type)
for(var/i = 0, i < moving_power, i++) for(var/i = 0, i < moving_power, i++)
sleep(2) sleep(2)

View File

@@ -104,15 +104,15 @@
use_power(100) use_power(100)
affecting = loc.contents - src // moved items will be all in loc 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 sleep(1) // slight delay to prevent infinite propagation due to map order
var/items_moved = 0 var/items_moved = 0
for(var/atom/movable/A in affecting) for(var/atom/movable/A in affecting)
if(!A.anchored) if(!A.anchored)
if(A.loc == src.loc) // prevents the object from being affected if it's not currently here. if(A.loc == src.loc) // prevents the object from being affected if it's not currently here.
step(A,movedir) step(A,movedir)
items_moved++ items_moved++
if(items_moved >= 10) if(items_moved >= 10)
break break
// attack with item, place item on conveyor // attack with item, place item on conveyor
/obj/machinery/conveyor/attackby(obj/item/I, mob/user, params) /obj/machinery/conveyor/attackby(obj/item/I, mob/user, params)

View File

@@ -62,13 +62,13 @@
loc = D.trunk loc = D.trunk
active = 1 active = 1
dir = DOWN dir = DOWN
spawn(1) move()
move() // spawn off the movement process
return return
// movement process, persists while holder is moving through pipes // movement process, persists while holder is moving through pipes
/obj/structure/disposalholder/proc/move() /obj/structure/disposalholder/proc/move()
set waitfor = 0
var/obj/structure/disposalpipe/last var/obj/structure/disposalpipe/last
while(active) while(active)
var/obj/structure/disposalpipe/curr = loc var/obj/structure/disposalpipe/curr = loc

View File

@@ -385,11 +385,10 @@
//docking turbulence //docking turbulence
if(M.client) if(M.client)
spawn(0) if(M.buckled)
if(M.buckled) shake_camera(M, 2, 1) // turn it down a bit come on
shake_camera(M, 2, 1) // turn it down a bit come on else
else shake_camera(M, 7, 1)
shake_camera(M, 7, 1)
if(istype(M, /mob/living/carbon)) if(istype(M, /mob/living/carbon))
if(!M.buckled) if(!M.buckled)
M.Weaken(3) M.Weaken(3)