ID:138863
 
Code:

This is where the code starts - Most notably the new() line
        CreateTrackers()
switch(src.Piece)
if("Rook")
var/X = 4
var/D = NORTH
while(0 < X)
var/obj/Tracker/A = new(src.loc)
walk(A,D)
D = turn(D, -90) ; X --


Object Code
obj
Tracker // Trackers - Used to determine where you can move
icon = 'Trackers.dmi'
density = 1

New(turf/T)
..()
src.Move(T)

Bump(A)
if(isturf(A))
src.loc = null

Click()
usr.loc = src.loc
usr.Move(usr.loc)
usr.ClearTrackers()


Turf code, just in case (because it's edited to work with this)

turf
Board
icon = 'Board.dmi'
density = 1

Entered(obj/O)
var/X = O.type
sleep(1) ; new X (src)


Problem description:
Okay, so I'm re-writing LotB from the ground up. This is what I've done so far.

The code sorta works. The issue is, when you click a turf, it treats the turf that you were just on as dense. I don't know if the game is confusing my location or what. If I spam Start() (Which moves me to other locations), more and more turfs get this invisible density.
Bump
In response to Lugia319 (#1)
Have you tried debugging this at all? Try giving all objs/turfs a verb that tells you their density, then you can right click anything that comes up dense to see what it is specifically. You can send a message to world that includes loc/name/action on creating and deleting trackers to find out when/why they might be staying.
In response to Robertbanks2 (#2)
I've mostly been trying to figure out where it is in code. But I can have the bump do that too. I'll get back to you tomorrow.
In response to Robertbanks2 (#2)
My debug code, under /obj/Tracker

        Bump(A)
if(isturf(A))
src.loc = null
world << output("[src] bumped a [A]","Chat")


I started the game, called CreateTrackers() (The procedure that makes the blue dots appear) and this is my result.

Photobucket

There are 4 bump messages, which is good because that's just the object that I have walking hitting the wall. Now for the second image.

Photobucket

You might not have inferred this itself, but "the mob" is being hit for all eternity. The reason itself is because when the object bumps the mob, it isn't deleted. I had originally planned to add an extra clause to the bump for mobs to allow objects to pass through mobs (or just make mobs not dense). In either case, I can't figure out why this is happening right now when there clearly is no mob there.
In response to Lugia319 (#4)
Are you certain there's no mob there? It looks to me like this isn't an issue with your trackers, but with your piece movement leaving behind another mob. Like I said, give a simple output verb to mobs so that you can right click it and get some proper information about it.
In response to Robertbanks2 (#5)
Yeah, you're right. A phantom mob remains. How though? My guess is the click procedure. The tracker is dense and so is the mob.
In response to Lugia319 (#6)
Well, this is where more debugging comes into play. Have it announce when it's being created and what proc called it in New().
In response to Robertbanks2 (#7)
It seems to occur whenever mob.loc = Y is used. Also in here
        Start() // Works so far //
//if(isnull(White) || isnull(Black))
Turn = White // The Turn variable is the White mob
for(var/mob/M in world) // Loop through mobs in world
if(White == M) // If they're white
M.icon_state = "w[M.Piece]"
if(Black == M) // If they're black
M.icon_state = "b[M.Piece]"
if(White == M || Black == M) // If they're white or black
var/list/Turfs = list() // Define Turfs to be an empty list
for(var/turf/T in block(locate(2,2,1),locate(9,9,1))) // Create a list of spawnable turfs
Turfs += T // Add these turfs to the list
var/turf/NT = pick(Turfs) // Define NT to be a random turf in Turfs list
M.Move(NT) // Move the player


I suppose that the mob is still counted as being in the turf's contents? But I tried to use Move() to fix that. But I suppose it makes sense that it doesn't work because the real mob has density and the invisible mob does too... Setting density to zero fixes it, but it feels like a poor solution. Alternatively, it seems that deleting mobs without clients also works. But again, feels like a poor solution.
In response to Lugia319 (#8)
It is a pretty poor solution. I can't really help much with what's shown, but now you know what the issue is so it should be a bit easier to figure out from here.
In response to Robertbanks2 (#9)
Aye, thanks for pointing me in the right direction.