Skip to content

Commit

Permalink
Fix range usages (#6378)
Browse files Browse the repository at this point in the history
# 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
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
fix: Fixed some usages of the proc range such as for delimbing
/:cl:
  • Loading branch information
Drulikar committed Jun 7, 2024
1 parent d659612 commit 31144c4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/topic/topic_events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cm_marines/dropship_ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/organs/limbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 31144c4

Please sign in to comment.