diff --git a/parts/gameFuncs.lua b/parts/gameFuncs.lua index 65f94511..adc2591e 100644 --- a/parts/gameFuncs.lua +++ b/parts/gameFuncs.lua @@ -608,50 +608,244 @@ function trySave() end end do-- function freshPlayerPosition(sudden) - local posLists={ - -- 1~5 - { - {340,75,1}, - {965,390,.5}, - {965,30,.5}, - {20,390,.5}, - {20,30,.5}, + local posLists=setmetatable({ + alive={ + [1]={main={340,75,1}}, + [3]={main={340,75,1}, + {25,210,.5}, + {955,210,.5}, + }, + [4]={main={340,75,1}, + {25,210,.5}, + {970,90,.45},{970,410,.45}, + }, + [5]={main={340,75,1}, + {40,90,.45},{40,410,.45}, + {970,90,.45},{970,410,.45}, + }, + [6]={main={340,75,1}, + {40,90,.45},{40,410,.45}, + {1010,80,.305},{1010,290,.305},{1010,500,.305}, + }, + [7]={main={340,75,1}, + {100,80,.305},{100,290,.305},{100,500,.305}, + {1010,80,.305},{1010,290,.305},{1010,500,.305}, + }, + [10]={main={340,75,1}, + {100,80,.305},{100,290,.305},{100,500,.305}, + {935,90,.275},{935,300,.275},{935,510,.275}, + {1105,90,.275},{1105,300,.275},{1105,510,.275}, + }, + [13]={main={340,75,1}, + {10,90,.275},{10,300,.275},{10,510,.275}, + {180,90,.275},{180,300,.275},{180,510,.275}, + {935,90,.275},{935,300,.275},{935,510,.275}, + {1105,90,.275},{1105,300,.275},{1105,510,.275}, + }, + [14]={main={340,75,1}, + {10,90,.275},{10,300,.275},{10,510,.275}, + {180,90,.275},{180,300,.275},{180,510,.275}, + {935,90,.275},{935,300,.275},{935,510,.275}, + {1120,80,.225},{1120,240,.225},{1120,400,.225},{1120,560,.225}, + }, + [15]={main={340,75,1}, + {10,90,.275},{10,300,.275},{10,510,.275}, + {180,90,.275},{180,300,.275},{180,510,.275}, + {960,80,.225},{960,240,.225},{960,400,.225},{960,560,.225}, + {1120,80,.225},{1120,240,.225},{1120,400,.225},{1120,560,.225}, + }, + [16]={main={340,75,1}, + {10,90,.275},{10,300,.275},{10,510,.275}, + {190,80,.225},{190,240,.225},{190,400,.225},{190,560,.225}, + {960,80,.225},{960,240,.225},{960,400,.225},{960,560,.225}, + {1120,80,.225},{1120,240,.225},{1120,400,.225},{1120,560,.225}, + }, + [17]={main={340,75,1}, + {30,80,.225},{30,240,.225},{30,400,.225},{30,560,.225}, + {190,80,.225},{190,240,.225},{190,400,.225},{190,560,.225}, + {960,80,.225},{960,240,.225},{960,400,.225},{960,560,.225}, + {1120,80,.225},{1120,240,.225},{1120,400,.225},{1120,560,.225}, + }, + [24]={main={340,75,1}, + {30,80,.225},{30,240,.225},{30,400,.225},{30,560,.225}, + {190,80,.225},{190,240,.225},{190,400,.225},{190,560,.225}, + {940,80,.175},{940,205,.175},{940,330,.175},{940,455,.175},{940,580,.175}, + {1050,80,.175},{1050,205,.175},{1050,330,.175},{1050,455,.175},{1050,580,.175}, + {1160,80,.175},{1160,205,.175},{1160,330,.175},{1160,455,.175},{1160,580,.175}, + }, + [31]={main={340,75,1}, + {10,80,.175},{10,205,.175},{10,330,.175},{10,455,.175},{10,580,.175}, + {120,80,.175},{120,205,.175},{120,330,.175},{120,455,.175},{120,580,.175}, + {230,80,.175},{230,205,.175},{230,330,.175},{230,455,.175},{230,580,.175}, + {940,80,.175},{940,205,.175},{940,330,.175},{940,455,.175},{940,580,.175}, + {1050,80,.175},{1050,205,.175},{1050,330,.175},{1050,455,.175},{1050,580,.175}, + {1160,80,.175},{1160,205,.175},{1160,330,.175},{1160,455,.175},{1160,580,.175}, + }, + [33]=(function() + local l={main={340,75,1}} + for y=-1.5,1.5 do for x=0,3 do + table.insert(l,{265-85*x,310+160*y,.125}) + table.insert(l,{940+85*x,310+160*y,.125}) + end end + return l + end)(), + [51]=(function() + local l={main={340,75,1}} + for y=-2.5,2.5 do for x=0,4 do + table.insert(l,{275-65*x,385+125*y,.1}) + table.insert(l,{945+65*x,385+125*y,.1}) + end end + return l + end)(), + [99]=(function() + local l={main={340,75,1}} + for y=-3,3 do for x=0,6 do + table.insert(l,{290-47*x,340+92*y,.075}) + table.insert(l,{940+47*x,340+92*y,.075}) + end end + return l + end)(), + [MATH.inf]=(function() + local l={main={340,75,1}} + for y=-3,3 do for x=0,6 do + table.insert(l,{290-47*x,340+92*y,.075}) + table.insert(l,{940+47*x,340+92*y,.075}) + end end + return l + end)(), }, - -- 6~17 - (function() - local L={{340,75,1}} - for i=1,4 do ins(L,{15,-160+180*i,.25}) end - for i=1,4 do ins(L,{180,-160+180*i,.25}) end - for i=1,4 do ins(L,{950,-160+180*i,.25}) end - for i=1,4 do ins(L,{1120,-160+180*i,.25}) end - return L - end)(), - -- 18~31 - (function() - local L={{340,75,1}} - for i=1,5 do ins(L,{10, -100+135*i,.18}) end - for i=1,5 do ins(L,{120, -100+135*i,.18}) end - for i=1,5 do ins(L,{230, -100+135*i,.18}) end - for i=1,5 do ins(L,{940, -100+135*i,.18}) end - for i=1,5 do ins(L,{1050,-100+135*i,.18}) end - for i=1,5 do ins(L,{1160,-100+135*i,.18}) end - return L - end)(), - -- 32~49 - (function() - local L={{340,75,1}} - for i=1,4 do for j=1,6 do ins(L,{78*i-54,115*j-98,.09}) end end - for i=9,12 do for j=1,6 do ins(L,{78*i+267,115*j-98,.09}) end end - return L - end)(), - -- 50~99 - (function() - local L={{340,75,1}} - for i=1,7 do for j=1,7 do ins(L,{46*i-36,97*j-72,.068}) end end - for i=15,21 do for j=1,7 do ins(L,{46*i+264,97*j-72,.068}) end end - return L - end)(), - } + dead={ + [1]={{340,75,1}}, + [2]={ + {50,130,.925},{670,130,.925}, + }, + [3]={ + {25,160,.675},{440,160,.675},{855,160,.675}, + }, + [4]={ + {13,200,.525},{328,200,.525},{643,200,.525},{948,200,.525}, + }, + [5]={ + {8,230,.425},{260,230,.425},{512,230,.425},{764,230,.425},{1016,230,.425}, + }, + [10]={ + {8,110,.425},{260,110,.425},{512,110,.425},{764,110,.425},{1016,110,.425}, + {8,410,.425},{260,410,.425},{512,410,.425},{764,410,.425},{1016,410,.425}, + }, + [12]={ + {10,120,.35},{220,120,.35},{430,120,.35},{640,120,.35},{850,120,.35},{1060,120,.35}, + {10,400,.35},{220,400,.35},{430,400,.35},{640,400,.35},{850,400,.35},{1060,400,.35}, + }, + [18]={ + {10,90,.305},{220,90,.305},{430,90,.305},{640,90,.305},{850,90,.305},{1060,90,.305}, + {10,300,.305},{220,300,.305},{430,300,.305},{640,300,.305},{850,300,.305},{1060,300,.305}, + {10,510,.305},{220,510,.305},{430,510,.305},{640,510,.305},{850,510,.305},{1060,510,.305}, + }, + [21]={ + {10,90,.295},{190,90,.295},{370,90,.295},{550,90,.295},{730,90,.295},{910,90,.295},{1090,90,.295}, + {10,300,.295},{190,300,.295},{370,300,.295},{550,300,.295},{730,300,.295},{910,300,.295},{1090,300,.295}, + {10,510,.295},{190,510,.295},{370,510,.295},{550,510,.295},{730,510,.295},{910,510,.295},{1090,510,.295}, + }, + [24]={ + {20,100,.25},{175,100,.25},{330,100,.25},{485,100,.25},{640,100,.25},{795,100,.25},{950,100,.25},{1105,100,.25}, + {20,300,.25},{175,300,.25},{330,300,.25},{485,300,.25},{640,300,.25},{795,300,.25},{950,300,.25},{1105,300,.25}, + {20,500,.25},{175,500,.25},{330,500,.25},{485,500,.25},{640,500,.25},{795,500,.25},{950,500,.25},{1105,500,.25}, + }, + [27]={ + {10,100,.225},{150,100,.225},{290,100,.225},{430,100,.225},{570,100,.225},{710,100,.225},{850,100,.225},{990,100,.225},{1130,100,.225}, + {10,300,.225},{150,300,.225},{290,300,.225},{430,300,.225},{570,300,.225},{710,300,.225},{850,300,.225},{990,300,.225},{1130,300,.225}, + {10,500,.225},{150,500,.225},{290,500,.225},{430,500,.225},{570,500,.225},{710,500,.225},{850,500,.225},{990,500,.225},{1130,500,.225}, + }, + [36]={ + {10,90,.225},{150,90,.225},{290,90,.225},{430,90,.225},{570,90,.225},{710,90,.225},{850,90,.225},{990,90,.225},{1130,90,.225}, + {10,245,.225},{150,245,.225},{290,245,.225},{430,245,.225},{570,245,.225},{710,245,.225},{850,245,.225},{990,245,.225},{1130,245,.225}, + {10,400,.225},{150,400,.225},{290,400,.225},{430,400,.225},{570,400,.225},{710,400,.225},{850,400,.225},{990,400,.225},{1130,400,.225}, + {10,555,.225},{150,555,.225},{290,555,.225},{430,555,.225},{570,555,.225},{710,555,.225},{850,555,.225},{990,555,.225},{1130,555,.225}, + }, + [39]=(function() + local l={} + for y=0,2 do for x=0,12 do + table.insert(l,{13+97*x,110+190*y,.15}) + end end + return l + end)(), + [42]=(function() + local l={} + for y=0,2 do for x=0,13 do + table.insert(l,{15+90*x,120+190*y,.135}) + end end + return l + end)(), + [45]=(function() + local l={} + for y=0,2 do for x=0,14 do + table.insert(l,{8+85*x,120+190*y,.125}) + end end + return l + end)(), + [60]=(function() + local l={} + for y=0,3 do for x=0,14 do + table.insert(l,{8+85*x,85+155*y,.125}) + end end + return l + end)(), + [64]=(function() + local l={} + for y=0,3 do for x=0,15 do + table.insert(l,{13+79*x,85+155*y,.115}) + end end + return l + end)(), + [68]=(function() + local l={} + for y=0,3 do for x=0,16 do + table.insert(l,{6+75*x,85+155*y,.115}) + end end + return l + end)(), + [72]=(function() + local l={} + for y=0,3 do for x=0,17 do + table.insert(l,{15+70*x,95+155*y,.1}) + end end + return l + end)(), + [90]=(function() + local l={} + for y=0,4 do for x=0,17 do + table.insert(l,{15+70*x,82+127*y,.1}) + end end + return l + end)(), + [95]=(function() + local l={} + for y=0,4 do for x=0,18 do + table.insert(l,{15+66*x,82+127*y,.1}) + end end + return l + end)(), + [100]=(function() + local l={} + for y=0,4 do for x=0,19 do + table.insert(l,{12+63*x,82+127*y,.1}) + end end + return l + end)(), + [MATH.inf]={}, + }, + }, { + __call=function(self,alive,count) + local lastTested=MATH.inf + for k in next,self[alive and 'alive' or 'dead'] do + if k=count then + lastTested=k + end + end + return self[alive and 'alive' or 'dead'][lastTested] + end, + }) + function freshPlayerPosition(mode)-- Set initial position for every player, mode: 'normal'|'quick'|'update' assert(mode=='normal' or mode=='quick' or mode=='update',"Wrong freshPlyPos mode") local L=PLY_ALIVE @@ -661,16 +855,39 @@ do-- function freshPlayerPosition(sudden) end end - local posList - if #L<=5 then posList=posLists[1] - elseif #L<=17 then posList=posLists[2] - elseif #L<=31 then posList=posLists[3] - elseif #L<=49 then posList=posLists[4] - elseif #L<=99 then posList=posLists[5] - else error("TOO MANY PLAYERS!") + local alive=PLAYERS[1].alive + -- local alive=false + + if mode=='update' then + if alive then + if #L<=31 then + for i=2,#L do + L[i].miniMode=false + L[i].draw=require"parts.player.draw".norm + end + end + else + if #L<=36 then + for i=2,#L do + L[i].miniMode=false + L[i].draw=require"parts.player.draw".norm + end + end + end end + + local posList=posLists(alive,#L) local method=mode=='normal' and 'setPosition' or 'movePosition' - for i=1,#L do L[i][method](L[i],unpack(posList[i])) end + + if alive then + for i=1,#L do + L[i][method](L[i],unpack(posList[i==1 and 'main' or i-1])) + end + else + for i=1,#L do + L[i][method](L[i],unpack(posList[i])) + end + end end end do-- function dumpBasicConfig() diff --git a/parts/player/player.lua b/parts/player/player.lua index 6ce024fe..33655320 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -2654,6 +2654,7 @@ local function update_dead(P,dt) _updateMisc(P,dt) end function Player:_die() + do local p=TABLE.find(PLY_ALIVE,self) if p then rem(PLY_ALIVE,p) end end self.alive=false self.timing=false self.control=false @@ -2818,7 +2819,6 @@ function Player:lose(force) end self:_die() self.result='lose' - do local p=TABLE.find(PLY_ALIVE,self) if p then rem(PLY_ALIVE,p) end end if self.gameEnv.layout=='royale' then self:changeAtk() self.modeData.place=#PLY_ALIVE+1 @@ -2896,6 +2896,9 @@ function Player:lose(force) end ::BREAK_notFinished:: end + local _,height=love.window.getMode() + self:movePosition(self.x,height+100) + freshPlayerPosition('update') end --------------------------<\Event>--------------------------