ID:271125
 
Is it possible to do
usr.contents.Swap(usr.contents.Find(A),usr.contents.Find(src))
in MouseDrop() or would I need to make a non built in list like usr.stuff ?
Xx Dark Wizard xX wrote:
Is it possible to do
usr.contents.Swap(usr.contents.Find(A),usr.contents.Find(src))
in MouseDrop() or would I need to make a non built in list like usr.stuff ?

It has to be a user-defined list; a built-in list won't let you swap.

Lummox JR
In response to Lummox JR (#1)
Ok thanks. Now I need to change all the set src in usr :(
In response to Xx Dark Wizard xX (#2)
Mind you, you can still use Swap() on contents if you transfer it to a user-defined list first:

var/list/C = contents.Copy()
C.Swap(index1, index2)
contents = C


The only exception here is that if your contents for any reason contain both mobs and objs, objs will always be listed before mobs. (The contents list is technically two linked lists that get stuck together by Copy(), so if you tried to swap a mon and an obj you'd end up with the obj appearing right before the mob.)

Lummox JR