新增队伍系统,攻击不会打给同队,剩一队时游戏就结束(目前允许0~6,0号为自由队,每个人分别算一队)
添加/group命令来选择队伍
This commit is contained in:
@@ -721,7 +721,7 @@ function draw.norm(P,repMode)
|
||||
|
||||
-- Draw username
|
||||
setFont(30)
|
||||
gc_setColor(.97,.97,.97)
|
||||
gc_setColor(GROUP_COLORS[P.group])
|
||||
GC.mStr(P.username or USERS.getUsername(P.uid),300,-60)
|
||||
|
||||
-- Draw HUD
|
||||
|
||||
@@ -192,7 +192,7 @@ local function _loadGameEnv(P)-- Load gameEnv
|
||||
-- else
|
||||
-- print("default-"..k..":"..tostring(v))
|
||||
end
|
||||
if type(v)~='table' then -- Default setting
|
||||
if type(v)~='table' then -- Default setting
|
||||
ENV[k]=v
|
||||
else
|
||||
ENV[k]=TABLE.copy(v)
|
||||
@@ -219,11 +219,11 @@ local function _loadRemoteEnv(P,confStr)-- Load gameEnv
|
||||
if GAME.modeEnv[k]~=nil then
|
||||
v=GAME.modeEnv[k] -- Mode setting
|
||||
elseif confStr[k]~=nil then
|
||||
v=confStr[k] -- Game setting
|
||||
v=confStr[k] -- Game setting
|
||||
elseif SETTING[k]~=nil then
|
||||
v=SETTING[k] -- Global setting
|
||||
v=SETTING[k] -- Global setting
|
||||
end
|
||||
if type(v)~='table' then-- Default setting
|
||||
if type(v)~='table' then -- Default setting
|
||||
ENV[k]=v
|
||||
else
|
||||
ENV[k]=TABLE.copy(v)
|
||||
@@ -407,14 +407,25 @@ function PLY.newRemotePlayer(id,mini,p)
|
||||
|
||||
P.uid=p.uid
|
||||
P.sid=NET.uid_sid[p.uid]
|
||||
P.group=p.group
|
||||
if not (P.group%1==0 and P.group>=1 and P.group<=6) then P.group=0 end
|
||||
|
||||
_loadRemoteEnv(P,p.config)
|
||||
_applyGameEnv(P)
|
||||
end
|
||||
function PLY.newAIPlayer(id,AIdata,mini)
|
||||
function PLY.newAIPlayer(id,AIdata,mini,p)
|
||||
local P=_newEmptyPlayer(id,mini)
|
||||
P.type='computer'
|
||||
|
||||
local pData={
|
||||
uid=id,
|
||||
group=0,
|
||||
} if p then TABLE.coverR(p,pData) end
|
||||
P.username='BOT'..pData.uid
|
||||
P.sid=NET.uid_sid[pData.uid]
|
||||
P.group=pData.group
|
||||
if not (P.group%1==0 and P.group>=1 and P.group<=6) then P.group=0 end
|
||||
|
||||
_loadGameEnv(P)
|
||||
P.gameEnv.face={0,0,0,0,0,0,0}
|
||||
P.gameEnv.skin={1,7,11,3,14,4,9}
|
||||
@@ -422,13 +433,19 @@ function PLY.newAIPlayer(id,AIdata,mini)
|
||||
AIdata._20G=P._20G
|
||||
P:loadAI(AIdata)
|
||||
end
|
||||
function PLY.newPlayer(id,mini)
|
||||
function PLY.newPlayer(id,mini,p)
|
||||
local P=_newEmptyPlayer(id,mini)
|
||||
P.type='human'
|
||||
P.sound=true
|
||||
|
||||
P.uid=USER.uid
|
||||
P.sid=NET.uid_sid[USER.uid]
|
||||
local pData={
|
||||
uid=USER.uid,
|
||||
group=0,
|
||||
} if p then TABLE.coverR(p,pData) end
|
||||
P.uid=pData.uid
|
||||
P.sid=NET.uid_sid[pData.uid]
|
||||
P.group=pData.group
|
||||
if not (P.group%1==0 and P.group>=1 and P.group<=6) then P.group=0 end
|
||||
|
||||
_loadGameEnv(P)
|
||||
_applyGameEnv(P)
|
||||
|
||||
@@ -2845,15 +2845,33 @@ function Player:lose(force)
|
||||
gameOver()
|
||||
self:newTask(#PLAYERS>1 and task_lose or task_finish)
|
||||
if GAME.net and not NET.spectate then
|
||||
NET.player_finish({foo="-- TODO"})
|
||||
NET.player_finish({foo=""})
|
||||
else
|
||||
TASK.new(task_autoPause)
|
||||
end
|
||||
else
|
||||
self:newTask(task_lose)
|
||||
end
|
||||
if #PLY_ALIVE==1 then
|
||||
PLY_ALIVE[1]:win()
|
||||
|
||||
if #PLY_ALIVE>0 then
|
||||
local cur=PLY_ALIVE[1].group
|
||||
for i=2,#PLY_ALIVE do
|
||||
local g=PLY_ALIVE[i].group
|
||||
if cur==0 then
|
||||
if g==0 then-- Two team 0, not finished
|
||||
goto BREAK_notFinished
|
||||
else-- Remember this may-be-last team
|
||||
cur=g
|
||||
end
|
||||
elseif g==0 or cur~=g then-- Find another team, not finished
|
||||
goto BREAK_notFinished
|
||||
end
|
||||
end
|
||||
-- Only 1 team survived, all winner
|
||||
for i=1,#PLY_ALIVE do
|
||||
PLY_ALIVE[i]:win()
|
||||
end
|
||||
::BREAK_notFinished::
|
||||
end
|
||||
end
|
||||
--------------------------<\Event>--------------------------
|
||||
|
||||
Reference in New Issue
Block a user