ID:261926
 
The below code snippet is supposed to carry out the following actions when you go to drop the block you are carrying: Check the tile in front of you for anything that is dense. If it finds either one, it will then move to the tile above and look for the same things. But this time, if either is found, it does nothing. And on either one, if nothing is found, you set the block down in that place.
[EDIT]
Well, I completely revised my code... And once again, it doesn't work. Only this time, if I leave the first FOR LOOP where it's at, it does nothing at all, no message, no lifting, nothing. If I put the first FOR LOOP as the second loop, it gives me the message, but that's no good either because that means it failed, and it always fails the same way -- check 1 = 0, check 2 = 1, check 3 = 0. And finally, if I use the first FOR LOOP as the last, it will lift any block up no matter it's position.

#define BUG(x) src<<x

mob
proc
Pickup()
var/turf
T = get_step(src,NORTH)
Tu = get_step(src,src.dir)
A = get_step(Tu,NORTH)
var/obj/block/B
var
chk=0; chk2=0; chk3=0
if(T.density) return
if(A.density) return
for(var/obj/block/C in Tu) //Is there a block in front of him. FOR loop 1
if(C)
chk=1; B=C; break
for(B in T) //Is the tile above blocked?
if(!B)
chk2=1; break
for(var/obj/block/D in A) //Is there a block above the block in front of him?
if(!D)
chk3=1; break
if(!B) return
if(chk && chk2 && chk3 == 0)
BUG("Error. Check 1: [chk]; Check 2: [chk2]; Check 3: [chk3]"); return
else
src.ac = 1
B.Pickup(T,src)

[/EDIT]
Well, one problem with this shows right off the bat: You're using T.loc and NT.loc as if you expect both values to be turfs. But since T and NT are turfs, their loc vars will be an area. You should just be using T and NT, not T.loc and NT.loc.

Lummox JR
In response to Lummox JR
I've had it like this before, and all it did/does now is set the block behind the player rather than do nothing. So what now?