From d2e8a76a1f0d7acd6e97d754ad1a96a8051dd914 Mon Sep 17 00:00:00 2001 From: Eva Date: Fri, 3 Jul 2026 03:38:36 +0700 Subject: [PATCH] renderer: day-state plate selection (#1291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an additive, default-off day/night plate-swap rule to paint_combat_v1.cs's existing plate-resolution block. When a _time_of_day.txt sentinel on the box says "day" and a naming-convention sibling _day_v1.png exists (room = the resolved plate's prefix up to the first underscore), the renderer prefers the day plate. No sentinel, sentinel != "day", or a missing day plate all fall through unchanged to today's night/current behavior. The engine's campaign.time_of_day is not yet surfaced on /combat-surface, so this wires via a box-side sentinel file (mirroring the existing _active_combat.txt / _location_plates.json pattern) rather than a new engine field — the minimal wiring for the generation-is-done, wiring-is-open half of #1291. --- .../unity/scripts/paint_combat_v1.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/extensions/renderers/unity/scripts/paint_combat_v1.cs b/extensions/renderers/unity/scripts/paint_combat_v1.cs index 05192856..6492e274 100644 --- a/extensions/renderers/unity/scripts/paint_combat_v1.cs +++ b/extensions/renderers/unity/scripts/paint_combat_v1.cs @@ -25,6 +25,25 @@ } catch {} if(!string.IsNullOrEmpty(_locPlate)) PLATE=_locPlate; else { var _abs="/home/unity/worldos-unity/Assets/painterly/backdrops/_active_combat.txt"; if(System.IO.File.Exists(_abs)){ var _n=System.IO.File.ReadAllText(_abs).Trim(); if(_n.Length>0) PLATE=_n; } } +// #1291: day-state plate selection. A sentinel (_time_of_day.txt, written by the deploy/driver step — +// NOT the engine directly; today's engine time_of_day is not yet surfaced on /combat-surface) says +// "day"/"night". When it says day AND a naming-convention sibling "_day_v1.png" exists (room = +// the resolved PLATE's prefix up to its first underscore, e.g. tavern_layered_v1.png -> tavern), prefer +// it. ADDITIVE + default-off: no sentinel file, sentinel != "day", or missing day plate all fall through +// to today's PLATE unchanged (night/current behavior stays the default). +try { + var _todF="/home/unity/worldos-unity/Assets/painterly/backdrops/_time_of_day.txt"; + if(System.IO.File.Exists(_todF)){ + var _tod=System.IO.File.ReadAllText(_todF).Trim().ToLowerInvariant(); + if(_tod=="day"){ + var _us=PLATE.IndexOf('_'); + var _room=_us>0?PLATE.Substring(0,_us):PLATE.Replace(".png",""); + var _dayName=_room+"_day_v1.png"; + var _dayPath="Assets/painterly/backdrops/"+_dayName; + if(System.IO.File.Exists("/home/unity/worldos-unity/"+_dayPath)) PLATE=_dayName; + } + } +} catch {} string PLATE_PATH="Assets/painterly/backdrops/"+PLATE; // New backdrop plates default to NPOT=ToNearest, which square-distorts a 1344x768 plate and breaks the // camera-pin aspect. Force NPOT=None so the plate keeps native dims (idempotent — only reimports if needed).