Files
CHOMPStation2/code/game/objects/effects/zone_divider.dm
Leshana 10b0323d6f Use can_atmos_pass to reduce proc-calls in c_airblock()
- Add additional can_atmos_pass value ATMOS_PASS_PROC which indicates custom behavior requiring calling the CanZASPass proc.
  - The benefit being for the other three values we DON'T need to call CanZASPass at all!  We already know the behavior without the overhead of a proc call.
  - Obviously any atom with can_atmos_pass = ATMOS_PASS_PROC cannot now call ..() in CanZASPass() since the default behavior would be to (recursively) call CanZASPass()
  - This required re-numbering the constants, so I also fixed all code that assumed particular values for the constants.
- Switched all types which overrode CanZASPass with custom logic to be can_atmos_pass = ATMOS_PASS_PROC
- Changed /turf/c_airblock() to skip calling /atom/movable/c_airblock() for the three can_atmos_pass values that don't require calling the proc.
2020-04-30 14:50:57 -04:00

21 lines
802 B
Plaintext

// This artificially splits a ZAS zone, useful if you wish to prevent massive super-zones which can cause lag.
/obj/effect/zone_divider
name = "zone divider"
icon = 'icons/mob/screen1.dmi'
icon_state = "x3"
invisibility = 101 //nope, can't see this
anchored = 1
density = 0
opacity = 0
can_atmos_pass = ATMOS_PASS_PROC
/obj/effect/zone_divider/CanZASPass(turf/T, is_zone)
// Special case to prevent us from being part of a zone during the first air master tick.
// We must merge ourselves into a zone on next tick. This will cause a bit of lag on
// startup, but it can't really be helped you know?
if(air_master && air_master.current_cycle == 0)
spawn(1)
air_master.mark_for_update(get_turf(src))
return FALSE
return is_zone ? FALSE : TRUE // Anything except zones can pass