From 525a9f36ff9ca9dabf07515fcd3daa0dbbd87c70 Mon Sep 17 00:00:00 2001 From: GanYiZhong Date: Sat, 3 Oct 2026 01:30:25 +0800 Subject: [PATCH] dan select: extend the parent's DanSelect instead of replacing it The dan boxes moved to PyTaikoGreen's Scripts/dan_select/dan_select.lua, which this skin's dan_select.lua shadowed, so no dan box was drawn. Load the parent's script first and add only the clip-sampled cursor/arrows on top of it. Co-Authored-By: Claude Opus 5.5 --- Scripts/dan_select/dan_select.lua | 37 ++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/Scripts/dan_select/dan_select.lua b/Scripts/dan_select/dan_select.lua index 492fdde..ad285d3 100644 --- a/Scripts/dan_select/dan_select.lua +++ b/Scripts/dan_select/dan_select.lua @@ -1,7 +1,25 @@ -- DAN_SELECT paint surface: selection cursor breathing loop and arrow chips, --- sampled from the cabinet's own clips. -DanSelect = {} -DanSelect.__index = DanSelect +-- sampled from the cabinet's own clips. The dan boxes themselves are drawn by the +-- parent skin's dan_select.lua, which is loaded first and extended here. + +-- the parent skin's copy of this script: the second match on package.path (the first is this file) +local function load_parent(name) + local seen = false + for tmpl in package.path:gmatch("[^;]+") do + local chunk = loadfile((tmpl:gsub("%?", name))) + if chunk then + if seen then return chunk end + seen = true + end + end +end +local parent = load_parent("dan_select/dan_select") +if parent then parent() end +if not DanSelect then + DanSelect = {} + DanSelect.__index = DanSelect +end +local parent_new = DanSelect.new local ok, anim = pcall(require, "anim/sampler") if not ok then anim = { safe = function() @@ -16,11 +34,12 @@ local CUR = anim.safe("anim/dan_cursor") local ARW = anim.safe("anim/dan_arrow") local ARW_OFF = ARW:label("arrow_off") or 61 +-- No real clip data at all -> no draw_cursor: the engine draws the cursor from its +-- inline tables (the boxes are still drawn by the parent's DanSelect). +local HAS_CLIPS = CUR:has("#259@0") or ARW:has("#261@0") + function DanSelect.new() - -- No real clip data at all -> hand the whole draw back to the engine's - -- inline tables (returning nil leaves fn_draw_cursor invalid, C++ side). - if not CUR:has("#259@0") and not ARW:has("#261@0") then return nil end - local self = setmetatable({}, DanSelect) + local self = parent_new and parent_new() or setmetatable({}, DanSelect) self.t_cursor = tex.get_texture("dan_select/box/cursor") self.t_arrow_r = tex.get_texture("dan_select/box/arrow_r") self.t_arrow_l = tex.get_texture("dan_select/box/arrow_l") @@ -29,7 +48,7 @@ end -- pos: selected chip x (the textures' own json positions carry the rest); -- now_ms: engine clock; moved_ms: ms since the last ribbon step (-1 = never). -function DanSelect:draw_cursor(pos, now_ms, moved_ms) +local function draw_cursor(self, pos, now_ms, moved_ms) if self.t_cursor then local f = (now_ms * 0.06) % 60 local a = CUR:get("#259@0", f, "a") or 1 @@ -51,3 +70,5 @@ function DanSelect:draw_cursor(pos, now_ms, moved_ms) end end end + +if HAS_CLIPS then DanSelect.draw_cursor = draw_cursor end -- 2.54.0