重构玩家交互事件系统,尝试支持可通过网络传递的自定义事件

This commit is contained in:
MrZ_26
2024-08-10 12:55:58 +08:00
parent 78f3c31db1
commit 4d1caa7fe0
2 changed files with 57 additions and 59 deletions

View File

@@ -570,6 +570,16 @@ function applyCustomGame()-- Apply CUSTOMENV, BAG, MISSION
GAME.modeEnv.mission=nil
end
end
local defaultAttackRule={
extraEvent={
{'attack',4},
},
extraEventHandler={
attack=function(P,P2,...)
P:beAttacked(P2,...)
end,
},
}
function loadGame(mode,ifQuickPlay,ifNet)-- Load a mode and go to game scene
freshDate()
if legalGameTime() then
@@ -577,6 +587,7 @@ function loadGame(mode,ifQuickPlay,ifNet)-- Load a mode and go to game scene
MODES[mode]=require('parts.modes.'..mode)
MODES[mode].name=mode
end
TABLE.complete(defaultAttackRule,MODES[mode])
if MODES[mode].score then
STAT.lastPlay=mode
end