36 lines
1.0 KiB
GDScript
36 lines
1.0 KiB
GDScript
extends StaticBody3D
|
|
## Something to press E on in or by the cliff tunnel (tunnel.gd): the
|
|
## seam's doorway ("in"), the way out at the top ("out"), the mouth of a
|
|
## stretch that needs propping ("prop", stretch k), and the sea cave's
|
|
## mouth ("cave"). On the interactables layer, so you walk through it.
|
|
|
|
var tunnel: Node3D
|
|
var what := ""
|
|
var k := 0
|
|
|
|
func interact_prompt(player: Node) -> String:
|
|
match what:
|
|
"in":
|
|
return "[E] Go down into the tunnel"
|
|
"out":
|
|
return "[E] Climb out onto the clifftop"
|
|
"prop":
|
|
var have: int = player.inventory.count("wood")
|
|
return "Unpropped: [E] Set a timber prop (%d wood, you have %d)" % [tunnel.PROP_WOOD, have]
|
|
"cave":
|
|
return "The sea cave: walk on out to the %s" % Terrain.worldlet_name(tunnel.to)
|
|
return ""
|
|
|
|
func interact(player: Node) -> void:
|
|
match what:
|
|
"in":
|
|
tunnel.go_in(player)
|
|
"out":
|
|
tunnel.go_out(player)
|
|
"prop":
|
|
tunnel.set_prop(player, k)
|
|
"cave":
|
|
tunnel.world.travel(tunnel.to, "sea_cave")
|
|
|
|
const Terrain = preload("res://scripts/world/terrain.gd")
|