feat: 更新 IntoHole 的球体、滑槽和环境资产

- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考
- 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档
- 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹
- 同步 Blender 源资产、Godot 加载、工坊和试玩预览
This commit is contained in:
Yanchen
2026-11-19 16:18:41 +08:00
parent 39ff1fd7b4
commit d1141b04c7
467 changed files with 67228 additions and 44624 deletions
+41 -69
View File
@@ -1,8 +1,8 @@
extends Node3D
const Library = preload("res://playtest/baseline/scripts/asset_library.gd")
const IDS = ["straight", "turn_cw", "turn_ccw", "gentle", "steep", "y_merge"]
const NAMES = ["直行", "顺时针拐弯", "逆时针拐弯", "缓坡 · 0.5 m", "陡坡 · 1 m", "Y 汇流 · 2×2"]
const IDS = preload("res://runtime/chute_types.gd").IDS
const NAMES = ["直行", "90°弯槽", "缓坡 · 0.5 m", "陡坡 · 1 m", "Y 汇流 · 2×2"]
const INK = Color("223c37")
const MUTED = Color("647a70")
const ACCENT = Color("347d68")
@@ -219,7 +219,7 @@ func setup_ui() -> void:
panel.add_child(column)
column.add_child(label_for("试验场景",14,MUTED))
mode_selector = OptionButton.new()
for title in ["01 连续轨道 · 重力起跑","02 单件试跑 · 轨道检验","03 底部通孔 · 交叉检验","04 自由搭建 · 修改布局","05 双铁球 · 汇流入洞"]:mode_selector.add_item(title)
for title in ["01 连续轨道 · 重力起跑","02 单件试跑 · 轨道检验","03 自由搭建 · 修改布局","04 双铁球 · 汇流入洞"]:mode_selector.add_item(title)
mode_selector.custom_minimum_size.y = 34
mode_selector.add_theme_stylebox_override("normal",panel_style(Color("e6eade")))
mode_selector.item_selected.connect(build_preset)
@@ -251,7 +251,7 @@ func setup_ui() -> void:
quota_label = label_for("",12,MUTED)
column.add_child(quota_label)
column.add_child(HSeparator.new())
column.add_child(label_for("单件 / 通孔试验初速度",13,MUTED))
column.add_child(label_for("单件试验初速度",13,MUTED))
speed_slider = HSlider.new()
speed_slider.min_value = 0
speed_slider.max_value = 4
@@ -275,7 +275,7 @@ func setup_ui() -> void:
trail_check.toggled.connect(func(on): trail_enabled=on; trail_view.visible=on; second_trail_view.visible=on)
checks.add_child(trail_check)
branch_button=button_for("切换岔口",func():
if started or mode==4:return
if started or mode==3:return
selected_branch=1-selected_branch
configure_spawn();reset_ball()
)
@@ -301,14 +301,14 @@ func setup_ui() -> void:
refresh_ui()
func choose_kind(kind: String) -> void:
if started or mode==4 or quota(kind)<=0:return
if started or mode==3 or quota(kind)<=0:return
selected_kind=kind
preview_quarter=0
selected_branch=0
if kind=="y_merge" and mode==1:
launch_speed=1.6
speed_slider.set_value_no_signal(launch_speed)
if mode==1 or mode==2: build_preset(mode)
if mode==1: build_preset(mode)
else:update_marker()
refresh_ui()
@@ -318,13 +318,13 @@ func add_record(kind: String, position: Vector3, quarter := 0) -> void:
func build_preset(new_mode: int) -> void:
var previous_mode:=mode
mode=new_mode
get_window().title="IntoHole · 双铁球汇流" if mode==4 else "IntoHole · Physics Playtest"
if mode==4:
get_window().title="IntoHole · 双铁球汇流" if mode==3 else "IntoHole · Physics Playtest"
if mode==3:
selected_kind="y_merge"
launch_speed=0
speed_slider.set_value_no_signal(0)
wind_slider.set_value_no_signal(0)
elif previous_mode==4:
elif previous_mode==3:
launch_speed=1.2
speed_slider.set_value_no_signal(launch_speed)
if quota(selected_kind)<=0:selected_kind="straight"
@@ -338,7 +338,7 @@ func build_preset(new_mode: int) -> void:
selected_index=-1
selected_cell=Vector2i.ZERO
records.clear()
if mode==0 or mode==3:
if mode==0 or mode==2:
add_record("gentle",Vector3(-2,1,0),2)
for x in [-1,0,1]:add_record("straight",Vector3(x,.5,0))
goal_position=Vector3(2.0,.5+float(lib.catalog["straight"].ports[0].surface[1]),0)
@@ -346,23 +346,20 @@ func build_preset(new_mode: int) -> void:
elif mode==1:
add_record(selected_kind,Vector3.ZERO)
goal_active=false
elif mode==2:
add_record(selected_kind,Vector3(0,.8,0))
goal_active=false
else:
for entry in scenarios[mode].layout:add_record(entry.kind,lib.vector(entry.position),int(entry.quarter))
goal_position=lib.vector(scenarios[mode].goal)
goal_active=true
selected_index=0 if mode==1 or mode==2 else find_cell(selected_cell)
selected_index=0 if mode==1 else find_cell(selected_cell)
if selected_index>=0:
placement_height=records[selected_index].position.y
preview_quarter=records[selected_index].quarter
rebuild_world()
configure_spawn()
reset_ball()
camera_target=Vector3(-.1,.8,0) if mode==0 or mode==3 else lib.record_center(records[0])+Vector3(0,.55,0)
camera.size=8.0 if mode==0 or mode==3 else (6.2 if selected_kind=="y_merge" else 4.2)
if mode==4:
camera_target=Vector3(-.1,.8,0) if mode==0 or mode==2 else lib.record_center(records[0])+Vector3(0,.55,0)
camera.size=8.0 if mode==0 or mode==2 else (6.2 if selected_kind=="y_merge" else 4.2)
if mode==3:
camera_target=Vector3(.5,1.1,.5)
camera.size=9.5
update_camera()
@@ -388,23 +385,6 @@ func rebuild_world() -> void:
caption.rotation_degrees.x=-45
caption.modulate=Color("385449")
world.add_child(caption)
if mode==2 and not records.is_empty():
var record: Dictionary = records[0]
var center: Vector3=lib.record_center(record)
var footprint: Vector2i=lib.footprint(record.kind,record.quarter)
var guide: Dictionary=lib.lower_passage_spec(record.kind)
var floor_y: float = float(guide.floor_y)+record.position.y
var floor_node=lib.create_box(Vector3(footprint.x+2.4,.12,footprint.y+2.4),Vector3(center.x,floor_y-.06,center.z),Color("6f9e88"))
world.add_child(floor_node)
var caption := Label3D.new()
caption.text="通过真实孔洞 · 净半径 0.32 m"
caption.font=ui_font
caption.outline_size=0
caption.font_size=28
caption.pixel_size=.005
caption.position=Vector3(center.x,floor_y+.01,center.z+footprint.y*.5+.8)
caption.rotation_degrees.x=-90
world.add_child(caption)
if mode==1 and not records.is_empty() and records[0].kind=="y_merge":
var record: Dictionary=records[0]
var transform:=Transform3D(Basis(Vector3.UP,-int(record.quarter)*PI/2),lib.record_center(record))
@@ -425,22 +405,14 @@ func rebuild_world() -> void:
update_marker()
func configure_spawn() -> void:
if mode==4:return
if mode==3:return
if records.is_empty():return
var record: Dictionary=records[0]
if mode==3 and selected_index>=0 and selected_index<records.size():record=records[selected_index]
if mode==2 and selected_index>=0 and selected_index<records.size():record=records[selected_index]
var kind: String=record.kind
var basis := Basis(Vector3.UP,-int(record.quarter)*PI/2)
var transform := Transform3D(basis,lib.record_center(record))
if mode==2:
var branch := mini(selected_branch,lib.catalog[kind].lowerPaths.size()-1)
var start: Vector3=lib.path_point(kind,0,branch,true)
start.y=float(lib.lower_passage_spec(kind).center_height)
var direction: Vector3=lib.path_tangent(kind,0,branch,true)
spawn_transform=Transform3D.IDENTITY
spawn_transform.origin=transform*(start-direction*.55+Vector3.UP*.025)
launch_velocity=basis*direction*launch_speed
elif kind=="gentle" or kind=="steep":
if kind=="gentle" or kind=="steep":
spawn_transform=Transform3D.IDENTITY
spawn_transform.origin=transform*lib.ball_on_surface(kind,.82)
launch_velocity=Vector3.ZERO
@@ -483,7 +455,7 @@ func reset_ball() -> void:
trail_points.clear()
trail_mesh.clear_surfaces()
trail_timer=0
if mode==4:
if mode==3:
create_merge_balls()
status="准备释放 · 两球同时从静止出发"
refresh_ui()
@@ -498,7 +470,7 @@ func reset_ball() -> void:
refresh_ui()
func toggle_run() -> void:
if mode==4:
if mode==3:
toggle_merge_run()
return
if not is_instance_valid(ball):return
@@ -534,13 +506,13 @@ func refresh_ui() -> void:
detail_label.text="%s · %d° · 占用 %d×%d\n底座高度 %.1f m" % [NAMES[IDS.find(selected_kind)],preview_quarter*90,footprint.x,footprint.y,placement_height]
quota_label.text="当前类型 %d / %d 件 · 选格 (%d, %d)" % [count,quota(selected_kind),selected_cell.x,selected_cell.y]
for i in range(type_buttons.size()):
type_buttons[i].disabled=quota(IDS[i])<=0 or started or mode==4
type_buttons[i].disabled=quota(IDS[i])<=0 or started or mode==3
type_buttons[i].add_theme_stylebox_override("normal",panel_style(Color("c5dbc8") if IDS[i]==selected_kind else Color("e6eade")))
start_button.text="▶ 释放铁球" if not started else ("▶ 继续" if paused else "Ⅱ 暂停")
for control in editing_controls:control.disabled=mode==4 or started
branch_button.disabled=mode==4 or started
speed_slider.editable=mode!=4 and not started
if mode==4:
for control in editing_controls:control.disabled=mode==3 or started
branch_button.disabled=mode==3 or started
speed_slider.editable=mode!=3 and not started
if mode==3:
start_button.text="▶ 同时释放两球" if not started else ("▶ 继续" if paused else "Ⅱ 暂停")
if merge_entered.size()+merge_lost.size()==2:start_button.text="↻ 再试一次"
quota_label.text="预设路线 · 两条支路汇入同一洞口"
@@ -548,8 +520,8 @@ func refresh_ui() -> void:
var conflict:=false
for record in records:
if not bool(lib.catalog[record.kind].declaredBoundsFits):conflict=true
warning_label.text="陡坡试验件高 1.5 m,超出单格;保留原高差与球尺寸供验证。" if conflict else ("通孔净半径 0.32 m;平台仅提供进出口承托。" if mode==2 else "当前铁球半径 0.3 m · 开口净半径 0.32 m")
if mode==4:warning_label.text="两球同时释放 · 初速度为零 · 球间碰撞开启"
warning_label.text="陡坡试验件高 1.5 m,超出单格;保留原高差与球尺寸供验证。" if conflict else "实心底座 · 球半径 0.3 m · 槽半径 0.32 m"
if mode==3:warning_label.text="两球同时释放 · 初速度为零 · 球间碰撞开启"
func quota(kind: String) -> int:
return int(scenarios[mode].quotas.get(kind,0))
@@ -574,9 +546,9 @@ func placement_error(candidate: Dictionary, ignore_index := -1) -> String:
return "" if attached else "新滑槽至少一侧需依附已有方块"
func place_selected() -> void:
if started or mode==4:return
if mode==1 or mode==2:
records[0]={"kind":selected_kind,"position":Vector3(0,.8 if mode==2 else 0,0),"quarter":preview_quarter}
if started or mode==3:return
if mode==1:
records[0]={"kind":selected_kind,"position":Vector3.ZERO,"quarter":preview_quarter}
else:
var count:=0
for record in records:
@@ -593,13 +565,13 @@ func place_selected() -> void:
rebuild_world();reset_ball()
func rotate_selected() -> void:
if started or mode==4:return
if started or mode==3:return
var next_quarter: int=(preview_quarter+1)%4
var idx:=0 if mode==1 or mode==2 else find_cell(selected_cell)
var idx:=0 if mode==1 else find_cell(selected_cell)
if idx>=0:
var candidate: Dictionary=records[idx].duplicate()
candidate.quarter=next_quarter
var issue: String=placement_error(candidate,idx) if mode in [0,3] else ""
var issue: String=placement_error(candidate,idx) if mode in [0,2] else ""
if not issue.is_empty():status=issue;refresh_ui();return
records[idx]=candidate
preview_quarter=next_quarter
@@ -610,15 +582,15 @@ func rotate_selected() -> void:
refresh_ui()
func change_height(amount: float) -> void:
if started or mode==4:return
if started or mode==3:return
var new_height: float=clampf(placement_height+amount,-.5,3.0)
var idx:=0 if mode==1 or mode==2 else find_cell(selected_cell)
var idx:=0 if mode==1 else find_cell(selected_cell)
if idx>=0:
var pos: Vector3=records[idx].position
pos.y=new_height
var candidate: Dictionary=records[idx].duplicate()
candidate.position=pos
var issue: String=placement_error(candidate,idx) if mode in [0,3] else ""
var issue: String=placement_error(candidate,idx) if mode in [0,2] else ""
if not issue.is_empty():status=issue;refresh_ui();return
records[idx]=candidate
placement_height=new_height
@@ -629,7 +601,7 @@ func change_height(amount: float) -> void:
refresh_ui()
func remove_selected() -> void:
if started or mode in [1,2,4]:return
if started or mode in [1,3]:return
var idx:=find_cell(selected_cell)
if idx>=0:
records.remove_at(idx)
@@ -640,7 +612,7 @@ func update_marker() -> void:
if is_instance_valid(cell_marker):cell_marker.queue_free()
cell_marker=Node3D.new()
add_child(cell_marker)
if mode in [1,2,4]:return
if mode in [1,3]:return
var footprint: Vector2i=lib.footprint(selected_kind,preview_quarter)
var center:=Vector3(selected_cell.x+(footprint.x-1)*.5,placement_height+.01,selected_cell.y+(footprint.y-1)*.5)
for axis in range(2):
@@ -664,7 +636,7 @@ func _unhandled_input(event: InputEvent) -> void:
if event.button_index==MOUSE_BUTTON_RIGHT:orbiting=event.pressed
if event.pressed and event.button_index==MOUSE_BUTTON_WHEEL_UP:camera.size=maxf(2.5,camera.size-.5)
if event.pressed and event.button_index==MOUSE_BUTTON_WHEEL_DOWN:camera.size=minf(16,camera.size+.5)
if event.pressed and event.button_index==MOUSE_BUTTON_LEFT and not started and mode in [0,3]:
if event.pressed and event.button_index==MOUSE_BUTTON_LEFT and not started and mode in [0,2]:
var origin:=camera.project_ray_origin(event.position)
var direction:=camera.project_ray_normal(event.position)
var query:=PhysicsRayQueryParameters3D.create(origin,origin+direction*100,1)
@@ -698,7 +670,7 @@ func _unhandled_input(event: InputEvent) -> void:
update_camera()
func _physics_process(delta: float) -> void:
if mode==4:
if mode==3:
process_merge(delta)
return
if not is_instance_valid(ball):return
@@ -713,7 +685,7 @@ func _physics_process(delta: float) -> void:
ball.collision_layer=0
ball.collision_mask=0
refresh_ui()
elif ball.position.y<-.65 and mode!=2 or ball.position.y<-2.0 or ball.position.length()>30:
elif ball.position.y<-.65 or ball.position.length()>30:
status="已离开轨道 · 调整布局后重试"
ball.freeze=true
refresh_ui()