炒锅翻炒 ok 右键拦截 闪
This commit is contained in:
1 parent
6caaf09632
commit
9eb9edbb8a
6 files changed
+203
-261
No files matched your search
+33
-20
@@ -5,7 +5,7 @@
|
||||
================================================================================
|
||||
处理"炒锅"(xy_chaoguo) 分类下的右键转换:
|
||||
炒锅(空)<->(盖锅)、辣椒锅底、葱花锅底、放料(添油+食材 -> 菜生态)、
|
||||
翻炒(锅铲右键3次, 需下方点燃炉灶)、出锅(熟态+盘子 -> 掉落盘装成品)、
|
||||
翻炒(锅铲右键旋转4次, 需下方点燃炉灶)、出锅(熟态+盘子 -> 掉落盘装成品)、
|
||||
空手出锅(煎葱油饼_熟/煎馍_熟/煎面饼_熟/煎酱香饼)、
|
||||
盖饭双向(手持成品菜右键米饭 <-> 手持米饭右键成品菜, itemUseOn)。
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
本类只负责"空手右键计时源方块"转发启动(FeatureDispatcher.startTimerFor)。
|
||||
|
||||
【门控数据(存方块实体)】
|
||||
rtdd_cf: 翻炒计数(满3次后按规则变方块; 煎酱香饼门控=3)
|
||||
rtdd_cg: 煎蛋门控(计时30秒后由计时服务置1, 之后才允许盘子出锅)
|
||||
rtdd_cf: 翻炒计数(满4次后按规则变方块; 煎酱香饼门控=4)
|
||||
rtdd_cg: 煎蛋门控(计时2秒后由计时服务置1, 之后才允许盘子出锅)
|
||||
================================================================================
|
||||
"""
|
||||
import time
|
||||
@@ -70,7 +70,7 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
self.itemUseOnRecipes[(r["item"], r["surface"])] = r
|
||||
|
||||
# ---- 空手右键"计时源方块"(煎蛋/煎葱油饼_生/煎馍_生/煎面饼_生): ----
|
||||
# 放在点燃炉灶上 -> 开始计时(提示包含总共多少秒与结果)
|
||||
# 放在点燃炉灶上 -> 开始计时(提示只报开始)
|
||||
self.timerSources = set()
|
||||
self.startTimerTips = {} # 空手右键启动计时 -> 提示
|
||||
self.timingTips = {} # 空手右键"已在计时中" -> 提示
|
||||
@@ -78,16 +78,16 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
self.timerSources.add(src)
|
||||
self.featureBlocks.add(src) # 登记右键路由, 空手右键才分发到这里
|
||||
self.startTimerTips = {
|
||||
COOKED_EGG: "§a开始计时: 还需30秒, 计时结束 煎蛋煎熟, 手持盘子出锅",
|
||||
COOKING_SCALLION_PANCAKE_0: "§a开始计时: 还需60秒, 计时结束变成 煎葱油饼_熟, 空手出锅 葱油饼",
|
||||
COOKING_DOUGH_0: "§a开始计时: 还需60秒, 计时结束变成 煎馍_熟, 空手出锅 馍",
|
||||
COOKING_DOUGHT_0: "§a开始计时: 还需60秒, 计时结束变成 煎面饼_熟, 空手出锅 煎饼",
|
||||
COOKED_EGG: "§a开始煎蛋, 计时结束煎熟, 手持盘子出锅",
|
||||
COOKING_SCALLION_PANCAKE_0: "§a开始煎葱油饼, 计时结束变成 煎葱油饼_熟, 空手出锅 葱油饼",
|
||||
COOKING_DOUGH_0: "§a开始煎馍, 计时结束变成 煎馍_熟, 空手出锅 馍",
|
||||
COOKING_DOUGHT_0: "§a开始煎面饼, 计时结束变成 煎面饼_熟, 空手出锅 煎饼",
|
||||
}
|
||||
self.timingTips = {
|
||||
COOKED_EGG: "§e正在计时中: 还需30秒, 计时结束 煎蛋煎熟, 手持盘子出锅",
|
||||
COOKING_SCALLION_PANCAKE_0: "§e正在计时中: 还需60秒, 计时结束变成 煎葱油饼_熟, 空手出锅 葱油饼",
|
||||
COOKING_DOUGH_0: "§e正在计时中: 还需60秒, 计时结束变成 煎馍_熟, 空手出锅 馍",
|
||||
COOKING_DOUGHT_0: "§e正在计时中: 还需60秒, 计时结束变成 煎面饼_熟, 空手出锅 煎饼",
|
||||
COOKED_EGG: "§e正在煎蛋, 计时结束煎熟, 手持盘子出锅",
|
||||
COOKING_SCALLION_PANCAKE_0: "§e正在煎葱油饼, 计时结束变成 煎葱油饼_熟, 空手出锅 葱油饼",
|
||||
COOKING_DOUGH_0: "§e正在煎馍, 计时结束变成 煎馍_熟, 空手出锅 馍",
|
||||
COOKING_DOUGHT_0: "§e正在煎面饼, 计时结束变成 煎面饼_熟, 空手出锅 煎饼",
|
||||
}
|
||||
|
||||
# ---- 右键冷却表 ----
|
||||
@@ -131,8 +131,8 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
self._handleStartTimer(blockName, playerId, pos, dim)
|
||||
return True
|
||||
return False
|
||||
# 翻炒用 1.5 秒冷却(防连点刷计数), 其余 0.4 秒
|
||||
cd = 1.5 if recipe.get("action") == "stir" else 0.4
|
||||
# 翻炒用 0.3 秒冷却(旋转4次需快速连点; 用户要求调短), 其余 0.4 秒
|
||||
cd = 0.3 if recipe.get("action") == "stir" else 0.4
|
||||
if not self.checkCooldown(key, cd):
|
||||
return True
|
||||
self.handleSwitch(recipe, playerId, pos, dim, itemDict)
|
||||
@@ -212,7 +212,7 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
playerId, recipe.get("belowTip", "§c下方方块不符合"))
|
||||
return
|
||||
|
||||
# 出锅门控(煎蛋需煎熟 rtdd_cg=1; 煎酱香饼需翻炒3次 rtdd_cf=3)
|
||||
# 出锅门控(煎蛋需煎熟 rtdd_cg=1; 煎酱香饼需翻炒4次 rtdd_cf=4)
|
||||
needFlag = recipe.get("needFlag")
|
||||
if needFlag:
|
||||
flagKey, flagVal, flagTip = needFlag[0], needFlag[1], needFlag[2]
|
||||
@@ -238,7 +238,7 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
self.dropItem(dim, pos, recipe["dropItem"])
|
||||
self._clearWokData(dim, pos)
|
||||
# 普通替换方块(盖锅/锅底/放料/加料)
|
||||
# 注意: 翻炒(stir)的 target 由 _handleStir 满3次才替换, 这里必须排除,
|
||||
# 注意: 翻炒(stir)的 target 由 _handleStir 满4次才替换, 这里必须排除,
|
||||
# 否则第一次右键翻炒就会立刻把方块换成目标态
|
||||
if recipe.get("target") and action != "take_out" and action != "stir":
|
||||
self.replaceBlock(pos, dim, recipe["target"], playerId)
|
||||
@@ -249,9 +249,11 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, recipe["tip"])
|
||||
|
||||
def _handleStir(self, recipe, playerId, pos, dim):
|
||||
"""翻炒: 锅铲右键计1次(rtdd_cf), 满 times 次后变 target;
|
||||
煎酱香饼无 target, 满3次后门控(空手出锅用)"""
|
||||
times = recipe.get("times", 3)
|
||||
"""翻炒: 锅铲右键一次 -> 方块旋转90度 + 计数+1(rtdd_cf), 满 times 次(转回原位)
|
||||
后变 target(照石磨旋转机制); 煎酱香饼无 target, 满4次后门控(空手出锅用)"""
|
||||
times = recipe.get("times", 4)
|
||||
# 每次右键先旋转方块90度(aux+1 四方向, 照石磨 _rotateMill)
|
||||
self._rotateWok(pos, dim)
|
||||
cf = self._readFlag(dim, pos, "rtdd_cf") + 1
|
||||
if cf >= times:
|
||||
target = recipe.get("target")
|
||||
@@ -259,7 +261,7 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
self.replaceBlock(pos, dim, target, playerId)
|
||||
self._clearWokData(dim, pos) # 新方块重置翻炒计数
|
||||
else:
|
||||
self._writeFlag(dim, pos, "rtdd_cf", times) # 门控: 保持3
|
||||
self._writeFlag(dim, pos, "rtdd_cf", times) # 门控: 保持4
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, recipe.get("tip", "§a翻炒完成"))
|
||||
else:
|
||||
@@ -267,6 +269,17 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§a翻炒中 (%d/%d)" % (cf, times))
|
||||
|
||||
def _rotateWok(self, pos, dim):
|
||||
"""炒锅翻炒旋转: aux+1 四方向循环(照石磨 _rotateMill)"""
|
||||
try:
|
||||
old = comp.CreateBlockInfo(LevelId).GetBlockNew(pos, dim)
|
||||
aux = old.get("aux", 0)
|
||||
comp.CreateBlockInfo(LevelId).SetBlockNew(
|
||||
pos, blockDict={"name": old.get("name", "rtdd:wok"), "aux": (aux + 1) % 4},
|
||||
oldBlockHandling=0, dimensionId=dim)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ============================================================================
|
||||
# 三、方块实体门控数据 读/写(rtdd_cf 翻炒计数 / rtdd_cg 煎蛋门控)
|
||||
# ============================================================================
|
||||
|
||||
+4
-4
@@ -4,10 +4,10 @@
|
||||
炒锅·计时引擎(服务端)
|
||||
================================================================================
|
||||
只处理"炒锅"(xy_chaoguo) 分类下的【计时自动转换】:
|
||||
煎蛋 : 30秒煎熟(方块不变, 门控标记 rtdd_cg=1, 之后才可盘子出锅)
|
||||
煎葱油饼_生 : 60秒 -> 煎葱油饼_熟
|
||||
煎馍_生 : 60秒 -> 煎馍_熟
|
||||
煎面饼_生 : 60秒 -> 煎面饼_熟
|
||||
煎蛋 : 2秒煎熟(方块不变, 门控标记 rtdd_cg=1, 之后才可盘子出锅)
|
||||
煎葱油饼_生 : 2秒 -> 煎葱油饼_熟
|
||||
煎馍_生 : 2秒 -> 煎馍_熟
|
||||
煎面饼_生 : 2秒 -> 煎面饼_熟
|
||||
|
||||
【计时判定(用户指定, 与油锅/汤锅一致)】
|
||||
- 计时方块【正下方】必须是 点燃的炉灶(stove_2) 才开始计时
|
||||
|
||||
Reference in new issue
Block a user