右键 改3
This commit is contained in:
1 parent
45d328b339
commit
0dc9bec3bc
4 files changed
+24
-46
No files matched your search
+7
-19
@@ -9,9 +9,11 @@
|
||||
客户端先 cancel/ret, 再由服务端精确处理转换。
|
||||
|
||||
【监听事件】(全模组客户端唯一拦截点)
|
||||
1. ClientBlockUseEvent 右键功能方块 -> cancel=True
|
||||
2. ClientItemUseOnEvent 手持白名单物品右键方块表面 -> ret=True
|
||||
3. ClientItemTryUseEvent 手持直接吃物品(饭团/水煮蛋/豆腐) -> cancel=True
|
||||
1. ClientItemUseOnEvent 手持白名单物品右键方块表面 -> ret=True
|
||||
2. ClientItemTryUseEvent 手持直接吃物品(饭团/水煮蛋/豆腐) -> cancel=True
|
||||
【注意】不拦 ClientBlockUseEvent(右键功能方块本体): 那会误拦"对炉灶放置
|
||||
蒸笼/对空锅放置盘子"等合理放置。右键方块本体的转换由服务端 OnBlockUse
|
||||
精确路由处理, 不在客户端提前 cancel。
|
||||
|
||||
【白名单来源】
|
||||
共享数据 InterceptData.py (客户端/服务端同一份, 见其注释)
|
||||
@@ -24,7 +26,7 @@ clientComp = clientApi.GetEngineCompFactory()
|
||||
|
||||
from ...BlueFoxTools.SpecialFunciton.BlueFoxSystem import BlueFoxClientSystem
|
||||
from .InterceptData import (ITEM_USE_ON_CANCEL, ITEM_USE_ON_CANCEL_BY_ITEM,
|
||||
BLOCK_USE_CANCEL, SUSHI_BLOCKS, COATING_ITEMS)
|
||||
SUSHI_BLOCKS, COATING_ITEMS)
|
||||
|
||||
|
||||
class ClientFeatureDispatcher(BlueFoxClientSystem):
|
||||
@@ -33,9 +35,6 @@ class ClientFeatureDispatcher(BlueFoxClientSystem):
|
||||
def __init__(self, namespace, systemName):
|
||||
BlueFoxClientSystem.__init__(self, namespace, systemName)
|
||||
print "===== ClientFeatureDispatcher init ====="
|
||||
self.ListenForEvent(clientApi.GetEngineNamespace(),
|
||||
clientApi.GetEngineSystemName(),
|
||||
"ClientBlockUseEvent", self, self.OnBlockUse)
|
||||
self.ListenForEvent(clientApi.GetEngineNamespace(),
|
||||
clientApi.GetEngineSystemName(),
|
||||
"ClientItemUseOnEvent", self, self.OnItemUseOn)
|
||||
@@ -45,9 +44,6 @@ class ClientFeatureDispatcher(BlueFoxClientSystem):
|
||||
|
||||
def Destroy(self):
|
||||
print "===== ClientFeatureDispatcher Destroy ====="
|
||||
self.UnListenForEvent(clientApi.GetEngineNamespace(),
|
||||
clientApi.GetEngineSystemName(),
|
||||
"ClientBlockUseEvent", self, self.OnBlockUse)
|
||||
self.UnListenForEvent(clientApi.GetEngineNamespace(),
|
||||
clientApi.GetEngineSystemName(),
|
||||
"ClientItemUseOnEvent", self, self.OnItemUseOn)
|
||||
@@ -56,15 +52,7 @@ class ClientFeatureDispatcher(BlueFoxClientSystem):
|
||||
"ClientItemTryUseEvent", self, self.OnItemTryUse)
|
||||
|
||||
# ============================================================================
|
||||
# 入口1: 右键功能方块 -> 提前 cancel 默认交互
|
||||
# ============================================================================
|
||||
def OnBlockUse(self, args):
|
||||
blockName = args.get("blockName")
|
||||
if blockName in BLOCK_USE_CANCEL:
|
||||
args["cancel"] = True
|
||||
|
||||
# ============================================================================
|
||||
# 入口2: 手持物品右键方块表面 -> 白名单组合才 ret
|
||||
# 入口1: 手持物品右键方块表面 -> 白名单组合才 ret (取消默认放置/吃)
|
||||
# ============================================================================
|
||||
def OnItemUseOn(self, args):
|
||||
blockName = args.get("blockName")
|
||||
|
||||
Reference in new issue
Block a user