ID:2615584
 
    resize_map()
var s = winget(src, "_map.map1", "size")
var list/dimensions = dd_text2list(s, "x")
var nx = text2num(dimensions[1]), ny = text2num(dimensions[2])

client.view = "[round((nx / 32)/usr.map_zoom)]x[round((ny / 32)/usr.map_zoom)]"

if(isduel) if(usr.Hand.len) Make_Hand_Cards(,,1)

return


So I just recently added some code to my game so that, when a player resizes their window, the map will automatically adjust itself to fill the window as much as possible without over filling the screen and some zoom-in functionality. Players were requesting it since the game can be a bit hard to see at higher resolutions.

I used to allow players to manually set their map size, but it caused problems with the interface where players could set the value too high and lose their interface controls off the sides of the screen.

The code works fine and does exactly what I wanted it to.

The issue I was running in to was that, since players dont always have their screen to perfectly fit the 32x32 grid, players would end up with a black border around the edge of their map.

I was able to "fix" this by changing the background color of the map in the skin settings to match the background color of the skin itself so it looks fine now.

But now I'm running in to the problem of, in certain areas of the game, where opacity is used to block light, like in interior of buildings, the sections of blocked light are using that same background color.

Here is what the map looks like normally. https://images2.imgbox.com/20/37/nfjdxLA4_o.png

The grey segments around the outer edge of the map were black originally

But it had the unintended side effect of having things like this happening...
https://images2.imgbox.com/ae/82/vSx78BPq_o.png

Is there any way to assign these colors seperately from each other?
A couple of the mob.sight flags will draw the opaque squares. This is always done on plane 0, so you could put everything else on a lower plane and give plane 0 a plane master that applies a color matrix.
In response to Lummox JR
Lummox JR wrote:
A couple of the mob.sight flags will draw the opaque squares. This is always done on plane 0, so you could put everything else on a lower plane and give plane 0 a plane master that applies a color matrix.

Doesn't the sight var just change how players see obj in darkness?

SEE_INFRA letting you see infrared obj even in darkness

SEE_OBJS letting you see all objs regardless if they are lit or not.

How would you use sight to see a black void as opposed to a gray void like I have now?
Using SEE_PIXELS or SEE_BLACKNESS will cause the opacity to render as black tiles. If you want them to be another color besides black you can use the plane master method I mentioned, although it sounds like maybe all you need is the blackness.
In response to Lummox JR
Lummox JR wrote:
Using SEE_PIXELS or SEE_BLACKNESS will cause the opacity to render as black tiles. If you want them to be another color besides black you can use the plane master method I mentioned, although it sounds like maybe all you need is the blackness.

I tried to use those before posting, they didnt seem to actually do anything as far as I can tell.

From the description, it seems like SEE_PIXELS should break the view down to a pixel level instead of the 32x32 tiles by default, but it doesnt seem to do that. Doesn't change anything visually at all from what I can see.

SEE_BLACKNESS says it will render dark tiles as blackness, but it doesnt change anything either. They still show as the background color for the map instead of black.

unless I'm assigning the sight values incorrectly.

mob/testing_GM_verbs/verb

Sight_Test_A()
set category = "Testing"

usr.sight |= SEE_BLACKNESS

return

Sight_Test_B()
set category = "Testing"

usr.sight |= SEE_PIXELS

return


https://i.imgur.com/YeXQi5s.png here's what this room interior looks like with or without the options.

https://i.imgur.com/8eJXrJo.png here's what it looks like from the map's perspective. The lighter color blocks are just blocks with the opacity and density set to 1 to block light and players from leaving the room.

turf

layer = TURF_LAYER

BLOCK
density = 1

block_light
opacity = 1
In response to IceFire2050
IceFire2050 wrote:
From the description, it seems like SEE_PIXELS should break the view down to a pixel level instead of the 32x32 tiles by default

I can't imagine what description you're reading, because the one in the reference doesn't say anything like that:

SEE_PIXELS// if an object is located on an unlit area, but some of its pixels are // in a lit area (via pixel_x,y or smooth movement), can see those pixels

SEE_PIXELS draws everything and then covers hidden turfs with blackness. It is supported in topdown maps only, not in other map formats. It does not mix well with other flags. In practice, SEE_PIXELS acts as if SEE_BLACKNESS, SEE_TURFS, SEE_OBJS, and SEE_MOBS are all turned on. That is, all atoms are drawn even on hidden tiles, and black squares are also drawn to cover them.

The black tiles rendered by SEE_BLACKNESS and SEE_PIXELS are drawn on the default plane 0.
In response to Magicsofa
Magicsofa wrote:
IceFire2050 wrote:
From the description, it seems like SEE_PIXELS should break the view down to a pixel level instead of the 32x32 tiles by default

I can't imagine what description you're reading, because the one in the reference doesn't say anything like that:

SEE_PIXELS// if an object is located on an unlit area, but some of its pixels are // in a lit area (via pixel_x,y or smooth movement), can see those pixels

SEE_PIXELS draws everything and then covers hidden turfs with blackness. It is supported in topdown maps only, not in other map formats. It does not mix well with other flags. In practice, SEE_PIXELS acts as if SEE_BLACKNESS, SEE_TURFS, SEE_OBJS, and SEE_MOBS are all turned on. That is, all atoms are drawn even on hidden tiles, and black squares are also drawn to cover them.

The black tiles rendered by SEE_BLACKNESS and SEE_PIXELS are drawn on the default plane 0.

Regardless, if I was misinterpreting what the flag does, I wasn't using it previously anyways, and it still is not rendering anything as black. The blocks are still showing as the background color set for the map rather than black like I showed in my picture.
The plane master method Lummox mentioned seems to work, although I think he meant that everything else should be on a higher plane?

Anyway, I just set the map background color to something other than black and then used a color matrix to turn everything on plane 0 black. Then, I made the default plane for all atoms 1:

atom
plane = 1

obj/darkness
screen_loc = "1,1"
plane = 0
appearance_flags = PLANE_MASTER | NO_CLIENT_COLOR
color = list(null,null,null,null,"#000f")

mob
Login()
..()
client.screen += new/obj/darkness


(Pretty much ripped the plane master code from the reference by the way, look up appearance_flags)

Login to reply.