From 31144c484687ce0a1eaf68578cd8697473e8d529 Mon Sep 17 00:00:00 2001 From: Drathek <76988376+Drulikar@users.noreply.github.com> Date: Fri, 7 Jun 2024 03:32:25 -0700 Subject: [PATCH] Fix range usages (#6378) # About the pull request So it turns out some usages of range are wrong https://www.byond.com/docs/ref/#/proc/range with the arguments in the wrong order. This might have some unintended consequences as some code that never worked now works... # Explain why it's good for the game Fixes issues such as ![image](https://github.com/cmss13-devs/cmss13/assets/76988376/8c64f46a-7dc8-4bca-9ddf-d621542f0cb4) # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: fix: Fixed some usages of the proc range such as for delimbing /:cl: --- code/game/turfs/turf.dm | 2 +- code/modules/admin/topic/topic_events.dm | 4 ++-- code/modules/cm_marines/dropship_ammo.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 2 +- .../mob/living/carbon/xenomorph/abilities/general_powers.dm | 2 +- code/modules/organs/limbs.dm | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 3bc1262b748f..8240f40f8e9b 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -519,7 +519,7 @@ var/spread = floor(sqrt(size)*1.5) var/list/turfs = list() - for(var/turf/open/floor/F in range(src,spread)) + for(var/turf/open/floor/F in range(spread, src)) turfs += F switch(A.ceiling) diff --git a/code/modules/admin/topic/topic_events.dm b/code/modules/admin/topic/topic_events.dm index eabd98fd3c28..264b91d982de 100644 --- a/code/modules/admin/topic/topic_events.dm +++ b/code/modules/admin/topic/topic_events.dm @@ -191,7 +191,7 @@ var/turf/spawn_turf if(range_to_spawn_on) - for(spawn_turf in range(initial_turf, range_to_spawn_on)) + for(spawn_turf in range(range_to_spawn_on, initial_turf)) if(!spawn_turf || istype(spawn_turf, /turf/closed)) continue turfs += spawn_turf @@ -317,7 +317,7 @@ var/turf/spawn_turf if(range_to_spawn_on) - for(spawn_turf in range(initial_turf, range_to_spawn_on)) + for(spawn_turf in range(range_to_spawn_on, initial_turf)) if(!spawn_turf || istype(spawn_turf, /turf/closed)) continue turfs += spawn_turf diff --git a/code/modules/cm_marines/dropship_ammo.dm b/code/modules/cm_marines/dropship_ammo.dm index 7a07891faa94..b2c9aa530888 100644 --- a/code/modules/cm_marines/dropship_ammo.dm +++ b/code/modules/cm_marines/dropship_ammo.dm @@ -244,7 +244,7 @@ /obj/structure/ship_ammo/laser_battery/detonate_on(turf/impact, obj/structure/dropship_equipment/weapon/fired_from) set waitfor = 0 var/list/turf_list = list() - for(var/turf/T in range(impact, 3)) //This is its area of effect + for(var/turf/T in range(3, impact)) //This is its area of effect turf_list += T playsound(impact, 'sound/effects/pred_vision.ogg', 20, 1) for(var/i=1 to 16) //This is how many tiles within that area of effect will be randomly ignited diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 1462594a0b46..974312fc42f7 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -110,7 +110,7 @@ var/obj/O = A if(O.unacidable) O.forceMove(get_turf(loc)) - O.throw_atom(pick(range(get_turf(loc), 1)), 1, SPEED_FAST) + O.throw_atom(pick(range(1, get_turf(loc))), 1, SPEED_FAST) . = ..(cause) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm index 05ab5d00a743..4bd70a93684f 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm @@ -708,7 +708,7 @@ /datum/action/xeno_action/activable/place_construction/proc/spacecheck(mob/living/carbon/xenomorph/X, turf/T, datum/construction_template/xenomorph/tem) if(tem.block_range) - for(var/turf/TA in range(T, tem.block_range)) + for(var/turf/TA in range(tem.block_range, T)) if(!X.check_alien_construction(TA, FALSE, TRUE)) to_chat(X, SPAN_WARNING("We need more open space to build here.")) qdel(tem) diff --git a/code/modules/organs/limbs.dm b/code/modules/organs/limbs.dm index 93cfc2d2d7cd..b84df6bf688b 100644 --- a/code/modules/organs/limbs.dm +++ b/code/modules/organs/limbs.dm @@ -1532,5 +1532,5 @@ treat_grafted var tells it to apply to grafted but unsalved wounds, for burn kit owner.visible_message("[owner]'s [owner_helmet] goes flying off from the impact!", SPAN_USERDANGER("Your [owner_helmet] goes flying off from the impact!")) owner.drop_inv_item_on_ground(owner_helmet) - INVOKE_ASYNC(owner_helmet, TYPE_PROC_REF(/atom/movable, throw_atom), pick(range(get_turf(loc), 1)), 1, SPEED_FAST) + INVOKE_ASYNC(owner_helmet, TYPE_PROC_REF(/atom/movable, throw_atom), pick(range(1, get_turf(loc))), 1, SPEED_FAST) playsound(owner, 'sound/effects/helmet_noise.ogg', 100)