diff --git a/parts/kickList.lua b/parts/kickList.lua index 4eabd5b2..e0f1c4d2 100644 --- a/parts/kickList.lua +++ b/parts/kickList.lua @@ -119,7 +119,7 @@ do [31]={{ 0,-1},{ 0, 1},{-1, 0},{ 0,-2},{ 0, 2}}, },--T function(P,d) - if P.human then SFX.fieldPlay("rotate",nil,P)end + if P.type=="human"then SFX.fieldPlay("rotate",nil,P)end if not P.gameEnv.ospin then return end local x,y=P.curX,P.curY if y==P.imgY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then @@ -264,7 +264,7 @@ do [31]={{ 0,-1},{ 1, 0}}, },--W function(P,d) - if P.human then SFX.fieldPlay("rotate",nil,P)end + if P.type=="human"then SFX.fieldPlay("rotate",nil,P)end local iki=XspinList[d] for test=1,#iki do local x,y=P.curX+iki[test][1],P.curY+iki[test][2] diff --git a/parts/player/init.lua b/parts/player/init.lua index a692812f..7af95625 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -163,7 +163,7 @@ local function newEmptyPlayer(id,mini) P.ctrlCount=0--Key press time, for finesse check P.pieceCount=0--Count pieces from next, for drawing bagline - P.human=false + P.type="none" P.sound=false -- P.newNext=nil--Call prepareSequence()to get a function to get new next @@ -322,6 +322,7 @@ local DemoEnv={ } function PLY.newDemoPlayer(id) local P=newEmptyPlayer(id) + P.type="computer" P.sound=true P.demo=true @@ -344,9 +345,7 @@ function PLY.newDemoPlayer(id) end function PLY.newRemotePlayer(id,mini) local P=newEmptyPlayer(id,mini) - P.remote=true - - -- P.updateAction=buildActionFunctionFromActions(P, actions) + P.type="remote" loadGameEnv(P) applyGameEnv(P) @@ -355,6 +354,7 @@ end function PLY.newAIPlayer(id,AIdata,mini) local P=newEmptyPlayer(id,mini) + P.type="computer" loadGameEnv(P) local ENV=P.gameEnv @@ -366,7 +366,7 @@ function PLY.newAIPlayer(id,AIdata,mini) end function PLY.newPlayer(id,mini) local P=newEmptyPlayer(id,mini) - P.human=true + P.type="human" P.sound=true loadGameEnv(P) diff --git a/parts/player/player.lua b/parts/player/player.lua index 159dc1ae..4cd54449 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -116,7 +116,7 @@ function Player.createBeam(P,R,send,color) local r,g,b=unpack(SKIN.libColor[color]) r,g,b=r*2,g*2,b*2 - local a=GAME.modeEnv.royaleMode and not(P.human or R.human)and .2 or 1 + local a=GAME.modeEnv.royaleMode and not(P.type=="human"or R.type=="human")and .2 or 1 SYSFX.newAttack(1-SETTING.atkFX*.1,x1,y1,x2,y2,wid,r,g,b,a*(SETTING.atkFX+2)*.0626) end ---------------------------------------------------- @@ -178,7 +178,7 @@ end function Player.set20G(P,if20g,init)--Only set init=true when initialize CC, do not use it P._20G=if20g P.keyAvailable[7]=not if20g - if P.human then + if P.type=="human"then virtualkey[7].ava=not if20g end if init and if20g and P.AI_mode=="CC"then CC.switch20G(P)end @@ -191,7 +191,7 @@ function Player.setHold(P,count)--Set hold count (false/true as 0/1) end P.gameEnv.holdCount=count P.holdTime=count - if P.human then + if P.type=="human"then virtualkey[8].ava=count>0 end if count==0 then @@ -389,7 +389,7 @@ function Player.changeAtkMode(P,m) end end function Player.changeAtk(P,R) - -- if not P.human then R=PLAYERS[1]end--1vALL mode? + -- if P.type~="human"then R=PLAYERS[1]end--1vALL mode? if P.atking then local K=P.atking.atker for i=1,#K do @@ -1579,7 +1579,7 @@ function Player.win(P,result) P.modeData.event=1 P:changeAtk() end - if P.human then + if P.type=="human"then GAME.result=result or"win" SFX.play("win") VOC.play("win") @@ -1592,7 +1592,7 @@ function Player.win(P,result) else P:showTextF(text.win,0,0,90,"beat",.5,.2) end - if P.human then + if P.type=="human"then gameOver() TASK.new(tick_autoPause) if MARKING then @@ -1673,7 +1673,7 @@ function Player.lose(P,force) end P.lastRecv=A if P.id==1 or A.id==1 then - TASK.new(tick_throwBadge,not A.human,P,max(3,P.badge)*4) + TASK.new(tick_throwBadge,not A.type=="human",P,max(3,P.badge)*4) end end else @@ -1689,7 +1689,7 @@ function Player.lose(P,force) end P.gameEnv.keepVisible=P.gameEnv.visible~="show" P:showTextF(text.gameover,0,0,60,"appear",.26,.9) - if P.human then + if P.type=="human"then GAME.result="gameover" SFX.play("fail") VOC.play("lose") diff --git a/parts/player/update.lua b/parts/player/update.lua index 0bf72a01..53f8a170 100644 --- a/parts/player/update.lua +++ b/parts/player/update.lua @@ -136,7 +136,7 @@ function update.alive(P,dt) end end - if not P.human and P.control and P.waiting==-1 then + if P.type=="computer"and P.control and P.waiting==-1 then local C=P.AI_keys P.AI_delay=P.AI_delay-1 if not C[1]then