ceshi 1
This commit is contained in:
1 parent
9eb9edbb8a
commit
b768ff1555
10 files changed
+618
-15
No files matched your search
+27
@@ -219,6 +219,33 @@ class YouguoService(BlueFoxServerSystem):
|
||||
# 二、通用转换执行
|
||||
# ============================================================================
|
||||
|
||||
def handleTakeoutRequest(self, playerId, blockName, itemName, dim, pos):
|
||||
"""客户端显式触发的出锅请求(消闪方案, 同汤锅).
|
||||
客户端已把 (盘子, 熟炸物) 的放置预览拦掉(见 ClientFeatureDispatcher),
|
||||
本方法在服务端补齐出锅逻辑: 校验落点仍是该成品 + 精确定位 take_out 规则
|
||||
-> 复用 handleSwitch(含 needBelow 门控), 交给它执行出锅"""
|
||||
# 守卫1: 防空手
|
||||
if not itemName or itemName in ("minecraft:air",):
|
||||
return
|
||||
try:
|
||||
b = comp.CreateBlockInfo(LevelId).GetBlockNew(pos, dim)
|
||||
cur = b.get("name") if b else None
|
||||
except Exception:
|
||||
cur = None
|
||||
# 守卫2: 落点已不是该成品 -> 跳过, 防双份
|
||||
if cur != blockName:
|
||||
print "[TakeoutRequest-SKIP-ALREADY]", "want:", blockName, "cur:", cur, "pos:", pos
|
||||
return
|
||||
recipe = self.recipes.get((blockName, itemName))
|
||||
if not recipe or recipe.get("action") != "take_out":
|
||||
return
|
||||
# 守卫3: 冷却, 防连点双发
|
||||
if not self.checkCooldown((dim, pos[0], pos[1], pos[2]), 0.4):
|
||||
return
|
||||
itemDict = self.getCarriedItem(playerId)
|
||||
self.handleSwitch(recipe, playerId, pos, dim, itemDict)
|
||||
print "[TakeoutRequest-DONE]", "player:", playerId, "item:", itemName, "block:", blockName
|
||||
|
||||
def handleSwitch(self, recipe, playerId, pos, dim, itemDict):
|
||||
# 需要下方方块(放料: 油锅下须是点燃的炉灶才计时炸制): 不满足则提示并拦截
|
||||
needBelow = recipe.get("needBelow")
|
||||
|
||||
Reference in new issue
Block a user