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.
Look up in the refence...
overlay
pixel_x
pixel_y