ID:150101
 
I'm trying to make it so that when you trash the objects, it only trashes one object each time you use the command. Right now, any objects within 1 tile of the user is trashed (except for this one spot which really confuses me).

Here's the defected code which used to be a bit cleaner before i tried fixing it.
obj/objects
proc
Trash()
if(usr.movement)
var/tmp/trashed = 0
while(!trashed)
if(src.loc == src.norm_loc)
src.loc = usr.loc
src.icon_state = "trashed"
usr.score += 1
usr.cash += 2
var/mob/mom/M = new()
M.Whats_Sound()
trashed = 1
else
usr << "Object is already trashed."
return
trashed = 0
else return
I don't know...what errors are you getting? It may be that you need to have return under else. can you help me?
I'm guessing that this code actually isn't causing that particular problem. Where are you calling this proc from? Try posting the mob/verb that calls this proc.

flick()

In response to Flick
Client
Center()
for(var/obj/objects/object in view(1))
if(object.icon_state == "normal")
object.Trash()
else return 0
..()
In response to Evilkevkev
Evilkevkev wrote:
Client
> Center()
> for(var/obj/objects/object in view(1))
> if(object.icon_state == "normal")
> object.Trash()
> else return 0
> ..()


Well, thats part of the problem..

view(1) is the turf you are in, and the 8 turfs directly around you. So you are telling it to trash all objects in those nine turfs. If you use view(0), that would trash all objects in the current turf, which still might not be what you are looking for. It might make more sense to make Trash() an object verb rather than using the Center() proc, though I don't know how you are using it exactly.