mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 09:08:30 +01:00
Merge pull request #12642 from tkdrg/FUCKpaprikaNIGGER
Improves starlight performance
This commit is contained in:
@@ -431,3 +431,10 @@
|
||||
new_character.key = G_found.key
|
||||
|
||||
return new_character
|
||||
|
||||
//supposedly the fastest way to do this according to https://gist.github.com/Giacom/be635398926bb463b42a
|
||||
#define RANGE_TURFS(RADIUS, CENTER) \
|
||||
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) \
|
||||
)
|
||||
|
||||
@@ -15,19 +15,16 @@
|
||||
/turf/space/New()
|
||||
if(!istype(src, /turf/space/transit))
|
||||
icon_state = "[((x + y) ^ ~(x * y) + z) % 25]"
|
||||
if(config)
|
||||
if(config.starlight)
|
||||
update_starlight()
|
||||
|
||||
/turf/space/Destroy()
|
||||
return QDEL_HINT_LETMELIVE
|
||||
|
||||
/turf/space/proc/update_starlight()
|
||||
if(config)
|
||||
if(config.starlight)
|
||||
for(var/turf/T in orange(src,1))
|
||||
if(istype(T,/turf/simulated))
|
||||
SetLuminosity(3)
|
||||
return
|
||||
for(var/turf/simulated/T in RANGE_TURFS(1,src)) //RANGE_TURFS is in code\__HELPERS\game.dm
|
||||
SetLuminosity(3)
|
||||
return
|
||||
SetLuminosity(0)
|
||||
|
||||
/turf/space/attack_paw(mob/user)
|
||||
|
||||
@@ -267,10 +267,9 @@
|
||||
lighting_object = locate() in src
|
||||
init_lighting()
|
||||
|
||||
for(var/turf/space/S in orange(1,src))
|
||||
for(var/turf/space/S in RANGE_TURFS(1,src)) //RANGE_TURFS is in code\__HELPERS\game.dm
|
||||
S.update_starlight()
|
||||
|
||||
|
||||
/turf/proc/update_lumcount(amount)
|
||||
lighting_lumcount += amount
|
||||
if(!lighting_changed)
|
||||
|
||||
Reference in New Issue
Block a user