My problem is this: How can I efficiently create and move a "link" correctly? I am using an associative list to manage how many links I have, and the links create right, and actually move decently too. But I still have some issues:
-A Runtime error associated with the code below:
runtime error: bad index
proc name: Add Body (/mob/proc/Add_Body)
source file: Procs.dm,28
usr: Albro1 (/mob/player)
src: Albro1 (/mob/player)
call stack:
Albro1 (/mob/player): Add Body()
Albro1 (/mob/player): Add Link()
-The associative list does not seem to be working correctly, meaning somewhere I have screwed up. Whenever I create one, it should go behind/beside(depending on the direction) the last created link, if there was one. Instead, it always goes behind me.
mob
proc
Add_Body()
var/obj/O = new /obj/body(src.loc)
if(src.trails)
var/obj/N = src.trails["[src.trails.len] link"]
O.dir=N.dir
//movement stuff
src.trails["[src.trails.len+1] link"]=O
else
var/mob/M = src
O.dir=M.dir
//movement stuff
M.trails["1 link"]=O