ID:1878509
 
(See the best response by FKI.)
Code:

Fusion
mob
proc
FuseMerge(var/mob/M)
if(get_dist(src,M)==2)
if(src.fly==1)
src.Fly()
if(M.fly==1)
M.Fly()
if(src.PL>M.PL*1.5||src.PL<M.PL*0.5||M.hand==0||src.hand==0)
src.canMove=1
src.blockable=1
src.skillactive=0
src.flyable=1
src.attacking=0
src.stanceable=1
src.mfusing=0
M.mfusing=0
M.canMove=1
M.blockable=1
M.skillactive=0
M.flyable=1
M.east=0
M.west=0
src.east=0
src.west=0
M.attacking=0
M.stanceable=1
src<<"The fusion failed, your power was too unbalanced"
M<<"The fusion failed, your power was too unbalanced"
return
if(src.race<>M.race)
M.canMove=1
M.blockable=1
M.skillactive=0
M.flyable=1
M.east=0
M.west=0
src.east=0
src.west=0
M.attacking=0
M.stanceable=1
src.mfusing=0
M.mfusing=0
src.canMove=1
src.blockable=1
src.skillactive=0
src.flyable=1
src.attacking=0
src.stanceable=1
src<<"The fusion failed, both participants need to be of the same race"
M<<"The fusion failed, both participants need to be of the same race"
return
if(src.android==1||M.android==1)
M.canMove=1
M.blockable=1
M.skillactive=0
M.flyable=1
M.attacking=0
M.stanceable=1
M.east=0
M.west=0
src.east=0
src.west=0
src.canMove=1
src.mfusing=0
M.mfusing=0
src.blockable=1
src.skillactive=0
src.flyable=1
src.attacking=0
src.stanceable=1
src<<"The fusion failed, because only living creatures can fuse, you or your partner are androids"
M<<"The fusion failed, because only living creatures can fuse, you or your partner are androids"
return
show_fball(src)
src.fly=1
show_fball(M)
M.fly=1
src.oldloc=src.loc
M.oldloc=M.loc
var/newloc
var/newdir=get_dir(src,M)
if(newdir==NORTHEAST)
newloc=locate(src.x+1,src.y+1,src.z)
if(newdir==NORTHWEST)
newloc=locate(src.x-1,src.y+1,src.z)
if(newdir==SOUTHEAST)
newloc=locate(src.x+1,src.y-1,src.z)
if(newdir==SOUTHWEST)
newloc=locate(src.x-1,src.y-1,src.z)
if(newdir==EAST)
newloc=locate(src.x+1,src.y,src.z)
if(newdir==WEST)
newloc=locate(src.x-1,src.y,src.z)
if(newdir==NORTH)
newloc=locate(src.x,src.y+1,src.z)
if(newdir==SOUTH)
newloc=locate(src.x,src.y-1,src.z)
var/mob/A=new/mob/Fusion_Body(newloc)
src.fusionhbar()
M.fusionhbar()
spawn(29)
show_fball(A)
src.fusebody=A
A.incontrol=src
A.fusebody=A
M.fusebody=A
src.client:perspective = EYE_PERSPECTIVE
src.client.eye = A
//M.client.focus=null
M.client.perspective=EYE_PERSPECTIVE
M.client.eye = A
A.contents+=M
A.contents+=src

src.mfused=1
//src.fusebody=A
//M.fusebody=A
M.mfused=1
A.mfused=1
A.hairon=1
A.auracolors = pick(src.auracolors,M.auracolors)
A.auraicon+=A.auracolors
A.blastcolor = pick(src.blastcolor,M.blastcolor)
A.blast1+=A.blastcolor
A.blast2+=A.blastcolor
A.blast3='Blast.dmi'
if(src.icon==src.muscleicon||M.icon==M.muscleicon)
A.muscleicon=src.muscleicon
A.icon=src.muscleicon
else
A.icon=pick(src.old_icon,M.old_icon)
A.basehair=pick(src.basehair,M.basehair)
A.hair=pick(src.hair,M.hair)
if(A.basehair==src.basehair)
A.hair=src.basehair
A.sshair=src.sshair
A.ss2hair=src.ss2hair
if(A.basehair==M.basehair)
A.hair=M.basehair
A.sshair=M.sshair
A.ss2hair=M.ss2hair
A.hair+=M.haircolor
A.hair+=src.haircolor
A.overlays+=A.hair
A.canMove=1
A.ingame=1
A.race=src.race
A.class=pick(src.class,M.class)
if(src.saiyan==1)
A.saiyan=1
if(src.tail==1)
A.overlays+='Tail.dmi'
if(src.lsaiyan==1)
A.lsaiyan=1
if(src.tail==1)
A.overlays+='Tail.dmi'
if(src.namekian==1)
A.namekian=1
if(src.majin==1)
A.majin=1
A.MajinRegen()
if(src.kai==1)
A.kai=1
if(src.human==1)
A.human=1
A.class=src.class
A.ReqFind()
A.Level=round((src.Level+M.Level)*1.25,1)
A.BasePL=(src.BasePL+M.BasePL)*3.5
A.PL=A.BasePL
if(A.saiyan==1||A.lsaiyan==1)
if(src.ssable==1||M.ssable==1)
A.ssable=1
if(src.lssable==1||M.lssable==1)
A.lssable=1
if(src.ss2able==1||M.ss2able==1)
A.ss2able=1
if(src.ss3able==1||M.ss3able==1)
A.ss3able=1
if(src.ss4able==1||M.ss4able==1)
A.ss4able=1
if(A.PL>A.ssjreq*10)
A.sstranstime=0
A.sstrans=1
A.Transform()
A.Strength=(src.Strength+M.Strength)*2
A.Defence=(src.Defence+M.Defence)*2
A.EnergyStrength=(src.EnergyStrength+M.EnergyStrength)*2
A.EnergyDefence=(src.EnergyDefence+M.EnergyDefence)*2
A.MaxStamina=(src.MaxStamina+M.MaxStamina)*2
A.MaxHP=(src.MaxHP+M.MaxHP)*2
A.HP=A.MaxHP
A.baramt=min(src.baramt+M.baramt,1183)
A.Stamina=A.MaxStamina
A.critchance=(src.critchance+M.critchance)*0.75
A.crit=src.crit+M.crit
A.redmin=src.redmin+M.redmin
A.red=src.red+M.red
A.addmin=src.addmin+M.addmin
A.add=src.add+M.add
A.eredmin=src.eredmin+M.eredmin
A.ered=src.ered+M.ered
A.eaddmin=src.eaddmin+M.eaddmin
A.eadd=src.eadd+M.eadd
A.hpregen=src.hpregen
A.hpregen=src.hpregen+M.hpregen
A.refill=src.refill
if(A.refill==1||M.refill==1)
A.refill=1
A.Refill()
A.luck=(src.luck+M.luck)*0.75
A.dodge=src.dodge+M.dodge
A.adelay=src.adelay+M.adelay
if(A.adelay>0)
A.adelay/=2
else
A.adelay=0.1
A.chargespeed=(src.chargespeed+M.chargespeed)*0.75
if(M.ragable==1||src.ragable==1)
A.ragable=1
A.rageboost=(src.rageboost+M.rageboost)
A.ragestatboost=(src.ragestatboost+M.ragestatboost)
A.MaxRage=(src.MaxRage+M.MaxRage)*2
A.Rage=(src.Rage+M.Rage)*2
if(src.lastable||M.lastable)
A.lastable=1
A.lastchance=src.lastchance+M.lastchance
A.blockable=1
A.canMove=1
A.flyable=1
A.stanceable=1
A.attacking=0
A.skillactive=0
M.blockable=1
M.flyable=1
M.attacking=0
M.stanceable=1
M.mfusing=0
src.mfusing=0
src.blockable=1
src.skillactive=0
src.flyable=1
src.attacking=0
src.stanceable=1
var/namepart=""
/*A.part1=src.name
A.part2=M.name
var/name1=(length(src.name))/2
var/name2=(length(M.name))/2
for(var/i=0,i<=name1,i++)
namepart+=A.part1[i]
var/start=name2+1
for(var/i=start,i<=name2,i++)
namepart+=A.part2[i]*/

if(namepart)
A.name=namepart
else
A.name=src.fusionname
src.fusedname=A.name
M.fusedname=A.name
A<<"The fusion will come undone in 10 minutes or if one of the two fused players logs out"
M<<"The fusion will come undone in 10 minutes or if one of the two fused players logs out"
A.sparklegen()
spawn(10)
A.sparklegen()
spawn(10)
A.sparklegen()
spawn(10)
A.sparklegen()
show_fball(A)
view(A)<<"[M] and [src] have fused to become one powerul warrior"
view(A)<<"[A.name] has been born!"



Movement Code
mob
on_cross(atom/obstacle, r)
if(obstacle.density==1 && obstacle.unpassable==0)
if(fly)
if(ismob(obstacle))
var/mob/M=obstacle
if(M.fly)
return 0
return 1
else
return 0
if(fly)
if(obstacle.unpassable==0)
return 1
else
return 0
. = ..()

on_uncross(atom/obstacle, r)
if(obstacle.density==1 && obstacle.unpassable==0)
if(fly)
return 1
else
return 0
if(fly)
if(obstacle.unpassable==0)
return 1
else
return 0
. = ..()

Problem description:
Yes, another generic dbz game v_v. My problem is that everything works lickity split, except movement, which doesnt work at all whilst fused. i.e(i use falacy's keyboard library)
Best response
I don't see anything having to do with fusing stopping movement in your snippets. Look for Move() in your code and post that here for a look-over.
Shot in the dark, but you set 'A.canmove=1', but not 'M' or 'src'.

I'm assuming your movement checks 'if(!src.canmove) return', which would cause the movement to end before checking for the controlled mob.
In response to FKI
Move() proc
mob
Move()
if(src.donut==1 && src.skillactive==1)
src.donut=0
src.skillactive=0
src.teleable=1
src.canMove=1
src.icon_state=src.basestate
src.caught=null
for(var/obj/Projectile/GDonut/D in world)
if(D.Owner==src)
if(!D.caught)
return 0
D.caught.canMove=1
D.caught.indonut=0
D.caught.skillactive=0
src.donutted=0
D.caught.teleable=0
src.attacking=1
D.caught.attacking=1
D.caught.icon_state=D.caught.basestate
remove_donut(D.caught)
del D
if(src.beaming==1)
src.Unbeam()

if(charge==1)
src.blasting=0
src.teleable=1
src.skillactive=0
src.canMove=1
src.charge=0
src.icon_state=src.basestate
for(var/obj/Projectile/Charge/C in get_step(src,src.dir))
if(C.Owner==src)
del C
return

if(src.blasts==1)
src.blasting=0
src.skillactive=0
src.teleable=1
src.canMove=1
src.blasts=0
src.icon_state=src.basestate
return

if(src.grabbed==1)
for(var/mob/M in view())
if(M.grabbing==src)
M.grabpwr-=(src.Strength*(src.PL/M.PL))
if(M.grabpwr<=0)
M.grabpwr=0
view()<<"[src] breaks free from [M]'s grip"
M.grabbing=null
src.grabbed=0
M.teleable=1
src.ingame=1
src.teleable=1
src.attacking=0
if(M.absorbing==1)
M<<"[src] escapes your grip"
M.absorbing=0
M.ingame=1
M.icon_state=M.basestate
src.overlays-='EnergyA.dmi'
M.attacking=0
M.AndroidBoostDecl()

return
src.moving=1
if(src.canMove==1 && src.poweringup==0)
if(src.grabbing)
for(var/mob/M in view())
if(M==src.grabbing)
src.GrabProc(M)
src.curx=src.x
src.cury=src.y
src.curz=src.z
..()
var/num=0
for(var/mob/M in view())
if(src.targets==M && src.stance==1)
num++
if(num>0)
src.dir=get_dir(src,src.targets)
src.canMove=0
sleep(src.delay)
src.canMove=1
src.moving=0
else
src.moving=0
return
src.Auras()
src.DyingCheck()
src.StanceMovement()
if(src.fist==1)
src.Dragondmg()
In response to NNAAAAHH
Yes, that was my original approach for the problem, so i made a little workaround but to no avail, tell me if something i did in the keydown procs could be done better or if it's just flat out incorrect.

Key_Down proc()
    key_down(k,client/c)
var/mob/M=src
if(src.fusebody)
M=src.fusebody
if(src.fusebody.incontrol!=src) return
if(k=="north")
if(M.ingame==1)
call(M,".north")()

else if(k=="south")
if(M.ingame==1)
call(M,".south")()

else if(k=="west")
if(M.ingame==1)
call(M,".west")()

else if(k=="east")
if(M.ingame==1)
call(M,".east")()
In response to Cheesy pants
    key_down(k,client/c)
var/mob/M=src
if(src.fusebody)
M=src.fusebody
if(src.fusebody.incontrol!=src) return


I would suggest you test that second if statement and see if it's returning there. If for some reason it is, then you'll know that the issue is the fusion mob's incontrol variable points away from the correct mob, when it should be src. At that point you'd hunt down where the variable is changed through a search.
I just checked it and it appears to be pointing to the correct mob. Also, whilst fused the user in control can use any other macro except movement
In response to Cheesy pants
So that key_down() is never called while in fusion mode?
It is, but should be called by the client within the fusedbody and redirected towards it. I found the true problem at hand , now all that is left is resolving it. The problem is that after implementing the code which checks and redirects the mob on whom to call the proc, I use
..()
which calls the default action, which would be to move the original caller and not the mob whom the focus was redirected to, which then results to movement in the contents by the clients whilst the fused body remains still, any suggestions on how to fix this?
I find it odd that the compiler allows you to have proc names starting with a period.

Can I see the parent proc?
I find it odd that the compiler allows you to have proc names starting with a period.

It denotes a hidden function.
In response to Ter13
Ter13 wrote:
I find it odd that the compiler allows you to have proc names starting with a period.

It denotes a hidden function.

I learn something new every day.

@Cheesy: Any progress on the matter? Curious to know if you might have solved the problem on your own.
                var/newloc
var/newdir=get_dir(src,M)
if(newdir==NORTHEAST)
newloc=locate(src.x+1,src.y+1,src.z)
if(newdir==NORTHWEST)
newloc=locate(src.x-1,src.y+1,src.z)
if(newdir==SOUTHEAST)
newloc=locate(src.x+1,src.y-1,src.z)
if(newdir==SOUTHWEST)
newloc=locate(src.x-1,src.y-1,src.z)
if(newdir==EAST)
newloc=locate(src.x+1,src.y,src.z)
if(newdir==WEST)
newloc=locate(src.x-1,src.y,src.z)
if(newdir==NORTH)
newloc=locate(src.x,src.y+1,src.z)
if(newdir==SOUTH)
newloc=locate(src.x,src.y-1,src.z)

I'm pretty sure you can use a switch proc for that lol, it'd seem more efficient in your case, but aye I'm just saying
In response to Yusuke11
All you need to do is use get_step.
In response to Mar big
That works too x.x
Actually, get_step_towards(). Kills two birds with one stone.
lol gg
I'm new to coding/I suck :|, don't blame me for not know this stuff lol
In response to Yusuke11
Yusuke11 wrote:
lol gg
I'm new to coding/I suck :|, don't blame me for not know this stuff lol

It's all a process of learning. Takes time, but that's why we're all here, innit?
good point :P
btw Ter according to these posts I see recently, it seems your useful,
never really got to know you but keep up the good work *thumbs work*


PS:I used to think you was a nerd, idk, it might be the face icon thing *shrugs*
I used to think you was a nerd

A guy who spends all his spare time rambling about a third-party language that almost nobody in the world uses?

I have no idea how that kind of person could possibly be considered a nerd.
Page: 1 2