Tutorial: Old Tam's hut outline beside the fire, pieces snap into it
This commit is contained in:
@@ -283,14 +283,26 @@ func _fishing() -> void:
|
||||
func _night() -> void:
|
||||
print("5. shelter and night")
|
||||
check(_at("hut"), "now: build a hut")
|
||||
var site: Vector3 = world.build.debug_find_site(fire.global_position + Vector3(6, 0, 6), 3.0)
|
||||
var yaw: float = player.rotation.y
|
||||
var hut: Dictionary = await world.build.debug_build_hut(site, yaw)
|
||||
print(" the outline")
|
||||
var ol: Node3D = G.outline
|
||||
check(ol != null and ol.slots.size() == 20 and ol.refresh() == 20, "Old Tam marks out a hut: a 20-piece outline")
|
||||
check(ol.center().distance_to(fire.global_position) < 9.0 and ol.center().distance_to(fire.global_position) > 3.0,
|
||||
"near the fire, on clear ground (%.0f m away), not on it" % ol.center().distance_to(fire.global_position))
|
||||
G._marker = G.find_marker()
|
||||
check(G.marker_position().distance_to(ol.center()) < 0.05, "the marker points at it")
|
||||
var slot0: Transform3D = ol.slots[0][1]
|
||||
var aim := {"position": slot0.origin + Vector3(0.9, 0, -0.7), "normal": Vector3.UP, "collider": world.terrain.get_node("TerrainBody")}
|
||||
var r: Dictionary = world.build.placement(DB.get_item("wood_floor"), aim, player.rotation.y + 0.4)
|
||||
check(r.ok and r.xf.origin.distance_to(slot0.origin) < 0.01, "a floor aimed near its place in the outline goes right in")
|
||||
var yaw: float = ol.origin.basis.get_euler().y
|
||||
var hut: Dictionary = await world.build.debug_build_hut(ol.center(), yaw)
|
||||
for _i in range(3):
|
||||
await physics_frame
|
||||
check(hut.placed == 20, "a hut (the same snapping a player uses: %d pieces)" % hut.placed)
|
||||
check(not is_instance_valid(ol) or ol.is_queued_for_deletion() or ol.refresh() == 0, "every piece of the outline filled")
|
||||
var b := Basis(Vector3.UP, yaw)
|
||||
var center: Vector3 = hut.pieces[0].global_transform * Vector3(1, 0, 1)
|
||||
check(center.distance_to(ol.center() if is_instance_valid(ol) else center) < 0.05, "(built right on it)")
|
||||
player.global_position = center + b * Vector3(0.6, 0.05, -0.6)
|
||||
sv._shelter_left = 0.0
|
||||
sv.step(0.2)
|
||||
|
||||
Reference in New Issue
Block a user