feat: 更新 IntoHole 的球体、滑槽和环境资产
- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考 - 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档 - 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹 - 同步 Blender 源资产、Godot 加载、工坊和试玩预览
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
extends SceneTree
|
||||
|
||||
const Library = preload("res://runtime/asset_library.gd")
|
||||
const Maps = preload("res://playtest/tutorial/scripts/maps.gd")
|
||||
var results: Array = []
|
||||
var failures := 0
|
||||
|
||||
func _initialize() -> void:call_deferred("run")
|
||||
|
||||
func check(name: String, passed: bool, detail: Dictionary = {}) -> void:
|
||||
results.append({"name":name,"passed":passed,"detail":detail})
|
||||
if not passed:failures += 1
|
||||
print(("PASS " if passed else "FAIL ") + name)
|
||||
|
||||
func run() -> void:
|
||||
var lib = Library.new()
|
||||
var arena := Node3D.new();root.add_child(arena)
|
||||
var trials: Array = []
|
||||
var offsets := [Vector2.ZERO,Vector2(.12,0),Vector2(.26,0),Vector2(.36,0),
|
||||
Vector2(-.36,0),Vector2(0,.36),Vector2(0,-.36),Vector2(.24,.24),Vector2(-.24,-.24)]
|
||||
for kind in lib.ball_type_ids():
|
||||
for offset in offsets:
|
||||
var at := Vector3(trials.size()*3,2,0)
|
||||
arena.add_child(lib.create_piece("goal_hole",at))
|
||||
var ball = lib.create_ball(kind);ball.freeze=true;arena.add_child(ball)
|
||||
ball.position=at+Vector3(offset.x,1.2,offset.y)
|
||||
trials.append({"name":"drop_%s_%s"%[kind,offset],"ball":ball,"at":at,
|
||||
"previous":ball.position,"entered":false,"contacts":0,"probe":"drop"})
|
||||
for normal in [Vector3.RIGHT,Vector3.LEFT,Vector3.FORWARD,Vector3.BACK]:
|
||||
var at := Vector3(trials.size()*3,2,0)
|
||||
arena.add_child(lib.create_piece("goal_hole",at))
|
||||
var ball = lib.create_ball();ball.freeze=true;arena.add_child(ball)
|
||||
ball.gravity_scale=0
|
||||
ball.position=at-Vector3.UP*.5+normal*1.25+normal.cross(Vector3.UP)*.4
|
||||
trials.append({"name":"solid_cube_side_%s"%normal,"ball":ball,"at":at,
|
||||
"normal":normal,"probe":"side","minDistance":1.25,"contacts":0})
|
||||
for i in range(3):await physics_frame
|
||||
for trial in trials:
|
||||
trial.ball.freeze=false
|
||||
if trial.probe=="side":trial.ball.linear_velocity=-trial.normal*3
|
||||
for frame in range(1200):
|
||||
await physics_frame
|
||||
for trial in trials:
|
||||
var ball = trial.ball
|
||||
if ball.contact_count>0:trial.contacts+=1
|
||||
if trial.probe=="drop":
|
||||
if trial.entered:continue
|
||||
if lib.crossed_goal(trial.previous,ball.position,trial.at,ball.radius):
|
||||
trial.entered=true;ball.freeze=true
|
||||
trial.previous=ball.position
|
||||
else:
|
||||
trial.minDistance=minf(trial.minDistance,(ball.position-trial.at).dot(trial.normal))
|
||||
for trial in trials:
|
||||
var passed: bool=trial.entered if trial.probe=="drop" else trial.minDistance>.77 and trial.contacts>0
|
||||
check(trial.name,passed,{"contactFrames":trial.contacts,"end":str(trial.ball.position-trial.at)})
|
||||
root.remove_child(arena);arena.queue_free();await process_frame
|
||||
# The larger, solid corners must not obstruct any existing tutorial approach.
|
||||
var app=load("res://playtest/tutorial/scenes/tutorial.tscn").instantiate();root.add_child(app)
|
||||
for index in range(5):
|
||||
app.started=false;app.unlocked=4;app.open_lesson(index)
|
||||
for r in Maps.solution(app.lesson):
|
||||
app.records.append({"id":r.id,"kind":r.kind,"position":app.lib.vector(r.position),"quarter":int(r.quarter)})
|
||||
app.rebuild();app.reset_simulation()
|
||||
for i in range(3):await physics_frame
|
||||
app.toggle_run()
|
||||
for frame in range(3600):
|
||||
await physics_frame
|
||||
if app.solved or app.attempt_done or app.failed:break
|
||||
check("tutorial_%d_enters_once"%[index+1],app.solved and app.events.size()==1 and app.lost.is_empty(),
|
||||
{"time":app.elapsed,"events":app.events.duplicate(true)})
|
||||
var file=FileAccess.open("res://playtest/artifacts/styled/goal_block/physics.json",FileAccess.WRITE)
|
||||
file.store_string(JSON.stringify({"passed":results.size()-failures,"failed":failures,"checks":results}," "));file.close()
|
||||
quit(1 if failures else 0)
|
||||
Reference in New Issue
Block a user