ID:2903148
 
Hello everyone,

As in the desc, I am looking for an answer to a problem the DM reference doesn't talk about.

Problem description:

The short version

The mob has a SEE_PIXELS flag to its sight var. This allows them to completely bypass opacity checks and TILE_BOUND restriction. One workaround is to put an object ("overdark plane") with plane = 0, which re-establishes opacity checks, but TILE_BOUND still doesn't work.

The long version

I am building a lighting system for ss13 (top-down perspective) with the classic combination of a MASTER_PLANE, large icons build using KEEP_TOGETHER, and a backdrop on the lighting plane.

This works fine. However, I want to have very long-range light sources (9 tiles, for example) in the game, they would be visible even if the player is very far away - the edge of the light would be visible from a 14 tiles distance, for example.

One problem is that the atoms do not render by default unless they are within 9 tiles of the mob. To counteract this, I gave the mob a SEE_PIXEL flag to its sight var. This works fine, however, this comes with a different problem:

https://imgur.com/a/FmFTt9C

The mob can now see through walls as if he add SEE_OBJS as long as there's a light source next to the object. In this picture, the objects within the range of the flare (red square) are visible despite being a wall. However, objects within the blue square are not.

The flare, and all the other objects in this picture besides the lighting overlays, have TILE_BOUND. A manual check shows that the flare is *not* in the view() proc of the mob. It seems that TILE_BOUND is ignored.

One way to fix this is to apply an "overdark" object on the plane = 0. The code for it is like this:

Code:
// OVERDARKNESS PLANEMASTER
// Used to move the BYOND darkness plane from SEE_BLACKNESS to a different plane so it covers things on desired planes above 0
/obj/abstract/screen/plane_master/overdark_planemaster
plane = 0
render_target = "*overdark"

var/obj/abstract/screen/plane_master/overdark_planemaster/overdark_planemaster = new()

/obj/abstract/screen/overdark_target
appearance_flags = 0
plane = ABOVE_LIGHTING_PLANE
mouse_opacity = 0
screen_loc = "CENTER,CENTER"

/mob/proc/create_lighting_planes()
client.screen |= overdark_planemaster
client.screen |= overdark_target


You will see in the next picture that using this does re-establish opacity, but does not bring back the behviour of TILE_BOUND.

https://imgur.com/a/5Qs4tWs

The walls and doors in the red squares are lit by light sources behind them. The players do not see those light sources.

I took care of separating the light object that illuminates regular tiles and the light object that applies an overlay to the walls in two parts, like this:

/atom/movable/light
appearance_flags = KEEP_TOGETHER

/atom/movable/light/wall_overlay
appearance_flags = KEEP_TOGETHER | TILE_BOUND


The wall_overlay object are not within the mob's sight. Despite this, they can see them. I am wondering how these two flags are meant to interact - is it intended for SEE_PIXELS to cancel TILE_BOUND? If so, how could I work around it and restore this behaviour? If not, would it be possible to make a bug report?

Thank you very much for your time.