Baystation12 / Baystation12

Baystation's flavor of Space Station 13
https://baystation.xyz
GNU Affero General Public License v3.0
404 stars 1.61k forks source link

Range parameter errors #27208

Closed NanakoAC closed 4 years ago

NanakoAC commented 4 years ago

In turf_changing.dm, line 79 ish we have this

for(var/turf/space/S in range(W,1)) S.update_starlight()

The inputs for range are in the wrong order. It takes distance first, origin point second. That should read for(var/turf/space/S in range(1, W)) S.update_starlight()

NanakoAC commented 4 years ago

Same problem also exists in code/modules/blob/blob.dm, line 124

`if(!(locate(/obj/effect/blob/core) in range(T, 2)) && prob(secondary_core_growth_chance))`
NanakoAC commented 4 years ago

Same problem in simple_animal/friendly/cat.dm, line 67 var/mob/observer/ghost/spook = locate() in range(src,5)

Nirnael commented 4 years ago

According to the reference for range()

Both arguments are optional and may be passed in any order.

If it isn't causing a bug, it should be working properly.

NanakoAC commented 4 years ago

at the very least, it breaks the standard. All the view/range procs are written to take distance first and it should conform to that. The vast majority of uses in the codebase are written with distance first, this is a handful of niche exceptions call it a minor code cleanup issue, but i still want this sorted. i'm doing it locally anyway, may send my changes upstream code/game/machinery/cryopod.dm, line 226 for(var/obj/effect/overmap/OO in physical_range(O,2))

NanakoAC commented 4 years ago

gamemodes/events.dm, line 73 for(var/obj/machinery/power/apc/apc in range(epicentre,lightsoutRange))

NanakoAC commented 4 years ago

retaliate/exoplanet.dm, 30 for(var/mob/living/simple_animal/S in range(src,1))

NanakoAC commented 4 years ago

gravitygenerator.dm, 41 for(var/area/A in range(src,effectiverange))

NanakoAC commented 4 years ago

modules/mob/living/living.dm, 79 for(var/mob/living/M in range(tmob, 1))

NanakoAC commented 4 years ago

mining/mine_turfs.dm, 312 for(var/mob/living/M in range(src, 200))

NanakoAC commented 4 years ago

datums/movement/mob.dm, 203 for(var/mob/M in range(mob, 1))

NanakoAC commented 4 years ago

modules/overmap/overmap_shuttle.dm, 65 for (var/obj/effect/overmap/S in range(get_turf(waypoint_sector(current_location)), range))

NanakoAC commented 4 years ago

targeted/projectile/projectile.dm, 42 for(var/mob/living/M in range(spell_holder, cast_prox_range))

NanakoAC commented 4 years ago

modules/spells/spell_code.dm, 237 for(var/turf/T in range(holder, 1))

NanakoAC commented 4 years ago

game/turfs/turf_ao.dm, 21 for(var/turf/T in RANGE_TURFS(src, 1))

NanakoAC commented 4 years ago

__defines/turfs.dm, 21 #define RANGE_TURFS(CENTER, RADIUS) block(locate(max(CENTER.x-(RADIUS), 1), max(CENTER.y-(RADIUS),1), CENTER.z), locate(min(CENTER.x+(RADIUS), world.maxx), min(CENTER.y+(RADIUS), world.maxy), CENTER.z))

This is different from the others but this define is breaking the standard too. there's only about four uses of it across the codebase, so its parameters should be swapped to bring it in line

NanakoAC commented 4 years ago

mechs/equipment/utility.dm, 180 atoms = range(target,3)

several more uses in this file

NanakoAC commented 4 years ago

turfs/simulated/walls.dm, 110 for(var/obj/effect/vine/plant in range(src, 1))

NanakoAC commented 4 years ago

objects/structures/window.dm, 522 for(var/obj/structure/window/W in range(src,range))

that's the last of them

afterthought2 commented 4 years ago

This is not a bug. Don't spam further instances, please. Either order is valid.