ID:2356032
 
BYOND Version:512.1413
Operating System:Windows 10 Home 64-bit
Web Browser:Firefox 59.0
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
When interacting with HUD elements, it's reading out that the screen_loc is all on the same X axis when in fact it is not.
Numbered Steps to Reproduce Problem:
Compile, Run, click hud, get false readings.
Code Snippet (if applicable) to Reproduce Problem:
HUD
parent_type=/obj/
X
var/hud_type
icon='HUD.dmi'
icon_state="X"
New(client/C,htype, scloc, d)
screen_loc=scloc;
dir=d;
C.screen+=src;
hud_type=htype;
..()
Click()
..()
for(var/HUD/Border/B in usr.client.screen)del(B);
for(var/HUD/H in usr.client.screen)
if(istype(H,hud_type))del(H);
usr.HUDLocked=0;
del(src);
Border
icon='HUD.dmi'
icon_state="border"
New(client/C,scloc, d)
screen_loc=scloc;
dir=d;
C.screen+=src;
..()
Navi
var/tmp/turf/cloc;
var
offX
offY
OX
OY
Center

New(client/C)
..()
var/viewX=round(text2num(copytext(world.view,1,3))/2);
var/viewY=round(text2num(copytext(world.view,4,6))/2);
screen_loc="[viewX/2], [viewY/2]";
C.mob.DebugMsg(screen_loc);
C.screen+=src;
for(var/i;i<20;i++){
if(i==19){
new/HUD/Border(C,"[viewX+i-9],[viewY-10]",NORTHWEST);
new/HUD/Border(C,"[viewX+i-9],[viewY+10]",SOUTHWEST);
new/HUD/Border(C,"[viewX-10],[viewY+i-9]",SOUTHEAST);
new/HUD/Border(C,"[viewX-10],[viewY-10]",NORTHEAST);
}else {
new/HUD/Border(C,"[viewX+i-9],[viewY-10]",NORTH);
if(i==18) new/HUD/X(C,/HUD/Navi, "[viewX+i-9],[viewY+10]",SOUTH);
else new/HUD/Border(C,"[viewX+i-9],[viewY+10]",SOUTH);
new/HUD/Border(C,"[viewX-10],[viewY+i-9]",EAST);
new/HUD/Border(C,"[viewX+10],[viewY+i-9]",WEST);
}
}
for(var/obj/Submarine/S in world){
for(var/turf/T in view(9,S)){
var/HUD/Navi/H=new();
H.icon=T.icon
H.icon_state=T.icon_state
H.screen_loc="[round(viewX+(T.x-S.x))],[round(viewY+(T.y-S.y))]";
for(var/obj/O in T)H.overlays+=O;
C.screen+=H;
//C.mob.DebugMsg(H.screen_loc);
}
}
spawn(world.tick_lag)Update(C);
proc/Update(client/C)
for(var/HUD/Navi/N in usr.client.screen)if(N!=src)del(N);
var/viewX=(text2num(copytext(world.view,1,3))/2);
var/viewY=round(text2num(copytext(world.view,4,6))/2);
for(var/obj/Submarine/S in world){
var/turf/LC=locate(S.x+offX,S.y+offY,S.z);
for(var/turf/T in view(9,LC)){
var/HUD/Navi/H=new();
H.icon=T.icon
H.dir=T.dir
H.offX=T.x-LC.x
H.offY=T.y-LC.y
H.OX=T.x
H.OY=T.y
H.icon_state=T.icon_state
H.screen_loc="[viewX+T.x-LC.x],[viewY+T.y-LC.y]";
H.cloc=T;
for(var/obj/O in T)H.overlays+=O;
C.screen+=H;
//C.mob.DebugMsg(H.screen_loc);
}
}
..()
spawn(world.tick_lag)Update(C);
Click()
cloc=locate(OX,OY,2);
world.log<<"[cloc.x] - [cloc.y] // [screen_loc]"

cloc.icon_state="target"
//for(var/obj/Submarine/S in world)
// spawn()walk_to(S,cloc)


Expected Results:
Should read out as such.
27,16
27,17
27,18
28,16
28,17
28,18
29,16
29,17
29,18
Actual Results:
Reads out like this:
29,19
29,18
29,17
29,16
29,20
29,15
29,14
29,13
29,12
Does the problem occur:
Every time? Or how often? Yes
In other games? ...
In other user accounts? ...
On other computers? ...

When does the problem NOT occur?
When hell freezes over.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
I'm unsure.

Workarounds:
Haven't found any yet.

I'll need a fuller test project to look into this properly. Importantly, things like world.view are missing.

Can you also explain what this code is supposed to be doing? It's much too complex to figure out at a glance, and your expected/actual output doesn't even match up with what the code is apparently supposed to produce.