ID:144777
 
Code:
proc
IsoView(mob/centre,dist=world.view)
var/mob/temp=new
temp.see_invisible=50
temp.loc=centre.loc
temp.sight=centre.sight
spawn(1) del temp
return view(dist,temp)


Problem description:
Centre.sight is SEE_OBJS. Definitely. I've checked. Looping through the output of the IsoView proc, however, it does not seem to acknowledge temp.sight. Walls between me and a /obj prevent it from being included in the list.

Before you ask, yes, there's a reason I have to do it like this rather then just using centre.view. Any thoughts on why this is happening? Is mob.sight bugged? Does it only work for clients? Is it purely a visual effect rather then actually causing things to appear in view? Have I made a stupid mistake?

This is the code I'm using to check it:

Sight()
src << "sight: [sight]"
if(sight&BLIND) src << "BLIND is on"
if(sight&SEE_INFRA) src << "SEE_INFRA is on"
if(sight&SEE_SELF) src << "SEE_SELF is on"
if(sight&SEE_MOBS) src << "SEE_MOBS is on"
if(sight&SEE_OBJS) src << "SEE_OBJS is on"
if(sight&SEE_TURFS) src << "SEE_TURFS is on"
for(var/atom/a in IsoView(src)) src << a


Top of the output:
sight: 8
SEE_OBJS is on


var/mob/temp=new


Perhaps I misunderstood the problem, but doesn't temp need a physical location on the map before you can worry about any of its view-related methods?
In response to Malver
temp.loc=centre.loc


I probably should do that in the new, but eh.

This isn't a massive game-breaking problem, but it's quite annoying.
In response to Jp
Jp wrote:
temp.loc=centre.loc

I probably should do that in the new, but eh.

Whoops, didn't even see that. My err.
Jp wrote:
        spawn(1) del temp
return view(dist,temp)


Isn't that a bit silly? I mean, wouldn't it be better written as such:
        . = view(dist,temp)
del(temp)


[Edit]
I decided there were some other silly things, so I'll rewrite the whole proc. :)
proc
IsoView(mob/centre,dist=world.view)
var/mob/temp = new(centre.loc)
// I'm assuming that the first argument in New() is still the location
temp.see_invisible = 50
// Sure you don't want to use centre.see_invisible?
temp.sight = centre.sight
. = view(dist,temp)
del(temp)


Also, is there really any reason you can't just do the view of centre, modifying the see_invisible temporarily if needed, rather than having to create a new mob entirely? :\
[/Edit]

Hiead