寿司 功能实现 3
This commit is contained in:
1 parent
d13a3600f1
commit
8a93a4825c
1 file changed
+20
-6
+20
-6
@@ -15,7 +15,9 @@
|
||||
handleBlockUse ← 入口:分发器转发右键方块事件
|
||||
├─ _handleCut ← 手持菜刀右键卷寿司两次 -> 寿司块(三个)
|
||||
└─ handleSwitch ← 通用转换(基础组/加鱼/卷制/手握/寿司堆/递减)
|
||||
handleItemUseOn ← 入口:手持饭团右键方块表面 -> 放置 手握普通寿司
|
||||
handleItemUseOn ← 入口:
|
||||
1) 手持寿司方块物品右键自家寿司方块 -> 取消默认放置(交给 handleBlockUse)
|
||||
2) 手持饭团右键方块表面 -> 放置 手握普通寿司
|
||||
(通用工具) getCarriedItem / consumeItem / dropItem / replaceBlock /
|
||||
checkCooldown
|
||||
================================================================================
|
||||
@@ -132,6 +134,12 @@ class ShousiService(BlueFoxServerSystem):
|
||||
self.featureBlocks.add(NORI_1)
|
||||
self.featureBlocks.add(NIGIRI_BASE)
|
||||
|
||||
# ---- 寿司方块物品集合(所有 featureBlocks 方块都有物品形态) ----
|
||||
# 手持它们右键"自家寿司方块"时取消默认放置, 统一交给方块右键逻辑,
|
||||
# 否则引擎会先把手持的寿司方块"放置"到旁边, 消耗掉手持物品
|
||||
# (表现为"堆叠没消耗")并在旁边多出一个方块。
|
||||
self.sushiBlockItems = set(self.featureBlocks)
|
||||
|
||||
# ---- 切块计数 {(dim,x,y,z): n} ----
|
||||
self.cutCounter = {}
|
||||
|
||||
@@ -150,8 +158,14 @@ class ShousiService(BlueFoxServerSystem):
|
||||
return self.featureBlocks
|
||||
|
||||
def getItemUseOnRules(self):
|
||||
"""手持饭团右键方块表面路由(放置手握普通寿司)"""
|
||||
return {RICE_BALL: True}
|
||||
"""手持物品右键方块表面路由:
|
||||
- 全部寿司方块物品(卷寿司/手握/寿司堆等): 右键自家寿司方块时取消默认放置
|
||||
- 饭团: 右键任意非寿司方块表面 -> 放置 手握普通寿司"""
|
||||
rules = {}
|
||||
for b in self.sushiBlockItems:
|
||||
rules[b] = True
|
||||
rules[RICE_BALL] = True
|
||||
return rules
|
||||
|
||||
def handleBlockUse(self, args):
|
||||
"""由 FeatureDispatcher 转发的右键方块入口"""
|
||||
@@ -255,9 +269,9 @@ class ShousiService(BlueFoxServerSystem):
|
||||
# 替换方块
|
||||
if recipe.get("target"):
|
||||
self.replaceBlock(pos, dim, recipe["target"], playerId)
|
||||
# 给背包物品(递减取走)
|
||||
if recipe.get("give"):
|
||||
self.giveItem(playerId, recipe["give"])
|
||||
# 递减取走: 以掉落物形式返还卷寿司
|
||||
if recipe.get("drop"):
|
||||
self.dropItem(dim, pos, recipe["drop"])
|
||||
# 提示
|
||||
if recipe.get("tip"):
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, recipe["tip"])
|
||||
|
||||
Reference in new issue
Block a user