ID:146254
 
Code:
Multi_Tile_Handle
var
mob/base
icon/icon_file
proc
BuildMob(mob/base,icon_file)
if(!base || !icon_file)
return 0
else
for(var/I in icon_states(icon_file))
var/obj/multi_tile/part = new
var/obj/multi_tile/blocker = new
var/pos = findtext(I,",")
var/xoff = text2num(copytext(I,1,pos))
var/yoff = text2num(copytext(I,pos+1))
if(I == "0,0")
part.density = 0
var/icon/newicon = new(icon_file)
part.icon = newicon
part.icon_state = I
part.name = part.icon_state
base.multi += part
part.pixel_y = yoff*32
part.pixel_x = xoff*32
base.overlays += part
blocker.loc = locate(base.x+xoff,base.y+yoff,base.z)
part.blocker = blocker
StartMove(mob/base,dir)
var/ok = 0
for(var/obj/multi_tile/MT in base.multi)
var/pos = findtext(MT.icon_state,",")
var/turf/nloc = get_step(MT.blocker,dir)
if(!nloc) return 0
if(dir == EAST && findtext(MT.icon_state,"1",1,pos) && !findtext(MT.icon_state,"-",1,pos))
if(nloc.Enter(MT))
ok += 1

if(dir == WEST && findtext(MT.icon_state,"-1",1,pos))
if(nloc.Enter(MT))
ok += 1

if(dir == SOUTH && findtext(MT.icon_state,"-1",pos+1))
if(nloc.Enter(MT))
ok += 1

if(dir == NORTH && findtext(MT.icon_state,"1",pos))
if(nloc.Enter(MT))
ok += 1

if(ok >= 3)
return 1
else
return 0

MiddleMove(mob/base,ndir)
for(var/obj/multi_tile/MT in base.multi)
MT.blocker.density = 0
step(MT.blocker,ndir)

EndMove(mob/base)
for(var/obj/multi_tile/MT in base.multi)
MT.blocker.density = 1





obj
multi_tile
density = 1
var
mob/owner
obj/blocker
New(nowner)
src.owner = nowner
..()

mob
icon = 'player.dmi'
icon_state = "test"
var
list/multi = new
list/size = new
verb
test(var/icon/icon_file as text)
var/Multi_Tile_Handle/MTH = new
MTH.BuildMob(src,icon_file)
del MTH


Move(nloc,ndir)
if(src.multi.len >= 1)
var/Multi_Tile_Handle/MTH = new
if(MTH.StartMove(src,ndir))
MTH.MiddleMove(src,ndir)
..()
MTH.EndMove(src)

del MTH
else
..()


Problem description:
Is there a better way to handle multi-tile mobs then this? With this way the best i can do is have a X by X or an X by Y. But I want to have it work for Like a A by B by C by D where its different dimensions on each side, also I dont want it to have to much lag.
Well, if you just need it for a grahpical effect...
Look up in the refence...

overlay
pixel_x
pixel_y
In response to Flame Sage
Also,

animate_movement
(Note that using sync_steps still makes no guarantees, really)

Hiead
In response to Hiead
Hiead wrote:
Also,

animate_movement
(Note that using sync_steps still makes no guarantees, really)

Hiead

If overlays are being used, then sync_steps doesn't matter at all. sync_steps has to do with large mobs made up of many smaller /mob objects.
In response to Jon88
I wasn't adding to the post explicitly, I was just adding to a list of things that might make for good reading on the topic.

Hiead
In response to Hiead
Well i use overlays to allow perfect synced movement on the visual, and then I use invisible objects to allow density for the whole mob. If you looked at the code you could see I already use pixel_x and pixel_y and overlays.
In response to Hiead
Hiead wrote:
Also,

animate_movement
(Note that using sync_steps still makes no guarantees, really)

Hiead

4 entries found for also.
1. In addition; besides.

Pwned. lol
In response to Flame Sage
Flame Sage wrote:
Hiead wrote:
Also,

animate_movement
(Note that using sync_steps still makes no guarantees, really)

Hiead

4 entries found for also.
1. In addition; besides.

Pwned. lol

w00t! FS pwnz Hiead ... wait, no!

Hiead
In response to DoOmBringer
So anyone who has had a chance to look over my code, is this a good way to handle it? or am I missing something?