mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +01:00
Replacing more C-style for loops with the faster, traditional ones. (#62908)
This commit is contained in:
@@ -285,7 +285,7 @@
|
||||
if(inherent.len && (LAW_INHERENT in groups))
|
||||
law_amount += inherent.len
|
||||
if(supplied.len && (LAW_SUPPLIED in groups))
|
||||
for(var/index = 1, index <= supplied.len, index++)
|
||||
for(var/index in 1 to supplied.len)
|
||||
var/law = supplied[index]
|
||||
if(length(law) > 0)
|
||||
law_amount++
|
||||
@@ -364,13 +364,13 @@
|
||||
laws += law
|
||||
|
||||
if(ion.len && (LAW_ION in groups))
|
||||
for(var/i = 1, i <= ion.len, i++)
|
||||
for(var/i in 1 to ion.len)
|
||||
ion[i] = pick_n_take(laws)
|
||||
if(hacked.len && (LAW_HACKED in groups))
|
||||
for(var/i = 1, i <= hacked.len, i++)
|
||||
for(var/i in 1 to hacked.len)
|
||||
hacked[i] = pick_n_take(laws)
|
||||
if(inherent.len && (LAW_INHERENT in groups))
|
||||
for(var/i = 1, i <= inherent.len, i++)
|
||||
for(var/i in 1 to inherent.len)
|
||||
inherent[i] = pick_n_take(laws)
|
||||
if(supplied.len && (LAW_SUPPLIED in groups))
|
||||
var/i = 1
|
||||
@@ -389,7 +389,7 @@
|
||||
inherent -= .
|
||||
return
|
||||
var/list/supplied_laws = list()
|
||||
for(var/index = 1, index <= supplied.len, index++)
|
||||
for(var/index in 1 to supplied.len)
|
||||
var/law = supplied[index]
|
||||
if(length(law) > 0)
|
||||
supplied_laws += index //storing the law number instead of the law
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
playsound(user, 'sound/effects/Glasshit.ogg', 140, TRUE)
|
||||
|
||||
if(W.type in list(/obj/structure/window, /obj/structure/window/fulltile, /obj/structure/window/unanchored, /obj/structure/window/fulltile/unanchored)) // boring unreinforced windows
|
||||
for(var/i = 0, i < speed, i++)
|
||||
for(var/i in 1 to speed)
|
||||
var/obj/item/shard/shard = new /obj/item/shard(get_turf(user))
|
||||
shard.embedding = list(embed_chance = 100, ignore_throwspeed_threshold = TRUE, impact_pain_mult=3, pain_chance=5)
|
||||
shard.updateEmbedding()
|
||||
|
||||
@@ -142,18 +142,18 @@ If you make a derivative work from this code, you must include this notification
|
||||
to_chat(A, span_danger("You start spinning around with [D]!"))
|
||||
A.emote("scream")
|
||||
|
||||
for (var/i = 0, i < 20, i++)
|
||||
for (var/i in 1 to 20)
|
||||
var/delay = 5
|
||||
switch (i)
|
||||
if (17 to INFINITY)
|
||||
if (18 to INFINITY)
|
||||
delay = 0.25
|
||||
if (14 to 16)
|
||||
if (15 to 17)
|
||||
delay = 0.5
|
||||
if (9 to 13)
|
||||
if (10 to 14)
|
||||
delay = 1
|
||||
if (5 to 8)
|
||||
if (6 to 9)
|
||||
delay = 2
|
||||
if (0 to 4)
|
||||
if (1 to 5)
|
||||
delay = 3
|
||||
|
||||
if (A && D)
|
||||
@@ -227,7 +227,7 @@ If you make a derivative work from this code, you must include this notification
|
||||
|
||||
FlipAnimation()
|
||||
|
||||
for (var/i = 0, i < 3, i++)
|
||||
for (var/i in 1 to 3)
|
||||
if (A && D)
|
||||
A.pixel_y += 3
|
||||
D.pixel_y += 3
|
||||
@@ -332,7 +332,7 @@ If you make a derivative work from this code, you must include this notification
|
||||
return
|
||||
var/turf/T = get_turf(A)
|
||||
if (T && isturf(T) && D && isturf(D.loc))
|
||||
for (var/i = 0, i < 4, i++)
|
||||
for (var/i in 1 to 4)
|
||||
A.setDir(turn(A.dir, 90))
|
||||
|
||||
A.forceMove(D.loc)
|
||||
|
||||
Reference in New Issue
Block a user