汤锅功能实现 3 计时 提示修改

This commit is contained in:
wenhe committed 2026-09-16 11:12:15 +08:00
1 parent df71a62d7c
commit 31bb44a409
10 files changed
+153 -56

No files matched your search

@@ -84,27 +84,27 @@ SWITCH_RULES = [
{"block": OILPOT_1, "item": BREADED_CHICKEN, "target": CHICKEN_0,
"consume": 1, "startTimer": CHICKEN_0,
"needBelow": LIT_STOVE, "belowTip": "§c油锅需要放在点燃的炉灶上",
"tip": "§a放入裹粉鸡块, 等计时(60秒)结束变成 炸鸡块(半熟), 再等(30秒)结束变成 炸鸡块(熟)"},
"tip": "§a放入裹粉鸡块, 开始炸制(共90秒: 先60秒半熟, 再30秒熟); 计时结束变成 炸鸡块(熟)"},
{"block": OILPOT_1, "item": BREADED_PORK, "target": PORK_0,
"consume": 1, "startTimer": PORK_0,
"needBelow": LIT_STOVE, "belowTip": "§c油锅需要放在点燃的炉灶上",
"tip": "§a放入裹粉猪肉, 等计时(60秒)结束变成 炸猪排(半熟), 再等(30秒)结束变成 炸猪排(熟)"},
"tip": "§a放入裹粉猪肉, 开始炸制(共90秒: 先60秒半熟, 再30秒熟); 计时结束变成 炸猪排(熟)"},
{"block": OILPOT_1, "item": BREADED_FRIES, "target": FRIES_0,
"consume": 3, "startTimer": FRIES_0,
"needBelow": LIT_STOVE, "belowTip": "§c油锅需要放在点燃的炉灶上",
"tip": "§a放入裹粉薯条x3, 等计时(60秒)结束变成 炸薯条(半熟), 再等(30秒)结束变成 炸薯条(熟)"},
"tip": "§a放入裹粉薯条x3, 开始炸制(共90秒: 先60秒半熟, 再30秒熟); 计时结束变成 炸薯条(熟)"},
{"block": OILPOT_1, "item": BREADED_FISH, "target": FISH_0,
"consume": 1, "startTimer": FISH_0,
"needBelow": LIT_STOVE, "belowTip": "§c油锅需要放在点燃的炉灶上",
"tip": "§a放入裹粉鱼, 等计时(60秒)结束变成 炸鱼块(半熟), 再等(30秒)结束变成 炸鱼块(熟)"},
"tip": "§a放入裹粉鱼, 开始炸制(共90秒: 先60秒半熟, 再30秒熟); 计时结束变成 炸鱼块(熟)"},
{"block": OILPOT_1, "item": BREADED_TEMPURA, "target": TEMPURA_1,
"consume": 4, "startTimer": TEMPURA_1,
"needBelow": LIT_STOVE, "belowTip": "§c油锅需要放在点燃的炉灶上",
"tip": "§a放入裹粉天妇罗x4, 等计时(60秒)结束变成 炸天妇罗(熟)"},
"tip": "§a放入裹粉天妇罗x4, 开始炸制(共60秒); 计时结束变成 炸天妇罗(熟)"},
{"block": OILPOT_1, "item": DUMPLINGS, "target": DUMPLING_1,
"consume": 3, "startTimer": DUMPLING_1,
"needBelow": LIT_STOVE, "belowTip": "§c油锅需要放在点燃的炉灶上",
"tip": "§a放入生饺子x3, 等计时(60秒)结束变成 炸饺子(熟)"},
"tip": "§a放入生饺子x3, 开始炸制(共60秒); 计时结束变成 炸饺子(熟)"},
# ---- 三、出锅(熟炸物 + 盘子 -> 掉落盘装成品) ----
{"block": CHICKEN_2, "item": PLATE, "action": "take_out",
@@ -58,15 +58,48 @@ class YouguoService(BlueFoxServerSystem):
self.featureBlocks.add(r["block"])
# ---- 空手右键"炸物计时源方块"(炸物生/半熟): 放在点燃炉灶上 -> 开始计时 ----
# 提示包含"总共多少秒": 从当前级沿计时链累加(生60秒+熟30秒 / 单级60秒)
self._timerBySrc = {r["source"]: r for r in TIMER_RULES}
self._timerTotal = {} # source -> (总秒数, 每级秒数列表)
for src, r in self._timerBySrc.items():
total, stages, cur, seen = 0, [], src, set()
while cur in self._timerBySrc and cur not in seen:
seen.add(cur)
curR = self._timerBySrc[cur]
sec = curR.get("time", 60)
total += sec
stages.append(sec)
nxt = curR.get("target")
if nxt not in self._timerBySrc:
break
cur = nxt
self._timerTotal[src] = (total, stages)
# 终点方块 -> 成品名(从出锅规则 tip 的"取出 XX"提取, 用于计时提示)
self._finalNames = {}
for r in SWITCH_RULES:
if r.get("action") == "take_out":
tip = (r.get("tip") or "").replace("§a", "").replace("§e", "").replace("§c", "")
if "取出" in tip:
nm = tip.split("取出", 1)[1].split(",", 1)[0].strip()
if nm:
self._finalNames[r["block"]] = nm
self.timerSources = set()
self.startTimerTips = {}
for r in TIMER_RULES:
src = r["source"]
for src, r in self._timerBySrc.items():
self.timerSources.add(src)
self.featureBlocks.add(src)
if src not in self.startTimerTips:
sec = r.get("time", 60)
self.startTimerTips[src] = "§a开始炸制…等计时(%d秒)结束变成 下一形态" % sec
total, stages = self._timerTotal[src]
if len(stages) == 1:
stage = ""
else:
stage = "(%d级: %s)" % (len(stages), "→".join("%d秒" % s for s in stages))
tip = "§a开始炸制…共需计时%d秒%s" % (total, stage)
end = self._oilTerminalName(src)
if end:
tip += "; 计时结束变成 %s" % end
self.startTimerTips[src] = tip
# ---- 右键冷却表 ----
self.cooldown = {}
@@ -130,6 +163,14 @@ class YouguoService(BlueFoxServerSystem):
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§c油锅需要放在点燃的炉灶上才能开始计时")
def _oilTerminalName(self, src):
"""沿计时链走到终点方块, 返回成品名(未取到则返回空串)"""
cur, seen = src, set()
while cur in self._timerBySrc and cur not in seen:
seen.add(cur)
cur = self._timerBySrc[cur]["target"]
return self._finalNames.get(cur, "")
# ============================================================================
# 二、通用转换执行
# ============================================================================