Files
Yanchen d1141b04c7 feat: 更新 IntoHole 的球体、滑槽和环境资产
- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考
- 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档
- 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹
- 同步 Blender 源资产、Godot 加载、工坊和试玩预览
2026-11-19 16:18:41 +08:00

28 lines
1.1 KiB
GDScript

extends RefCounted
const ALTERNATE_TEXTURES := [
preload("res://assets/blocks/ice/textures/top_albedo_diagonal.png"),
preload("res://assets/blocks/ice/textures/top_albedo_forked.png"),
]
const TOP_MATERIAL := "Storybook / ice top"
static var overrides: Dictionary[Texture2D, StandardMaterial3D] = {}
static func apply(visual: Node3D, location: Vector3) -> void:
# X/Z grid neighbors differ by one or two steps in the three-pattern cycle.
var pattern := posmod(roundi(location.x) + 2 * roundi(location.z), 3)
if pattern == 0:
return
var texture: Texture2D = ALTERNATE_TEXTURES[pattern - 1]
for node in visual.find_children("*", "MeshInstance3D", true, false):
var mesh_view := node as MeshInstance3D
for index in range(mesh_view.mesh.get_surface_count()):
var source := mesh_view.mesh.surface_get_material(index) as StandardMaterial3D
if source != null and source.resource_name == TOP_MATERIAL:
if not overrides.has(texture):
var material := source.duplicate() as StandardMaterial3D
material.albedo_texture = texture
overrides[texture] = material
mesh_view.set_surface_override_material(index, overrides[texture])
return