TinyAdventure/quests/builder_missing_tool_quest.gd

33 lines
819 B
GDScript
Raw Permalink Normal View History

class_name QuestBuilderMissingTool
2024-11-01 18:07:23 +01:00
extends QuestBase
2024-07-12 14:32:33 +02:00
@export var is_hammer_found:bool = false
@export var is_hammer_delivered:bool = false
2024-07-15 22:20:49 +02:00
@export var is_bridge_built:bool = false
2024-07-20 09:49:49 +02:00
2024-07-15 22:20:49 +02:00
@onready var bridge = %Bridge
@onready var merchant: NonPlayerCharacter = %Merchant
2024-07-15 22:20:49 +02:00
var _bridge_transform:Transform3D = Transform3D.IDENTITY
func _ready():
2024-11-01 18:07:23 +01:00
super._ready()
2024-07-15 22:20:49 +02:00
_bridge_transform = bridge.global_transform
bridge.global_transform = Transform3D.IDENTITY.translated(Vector3.UP * -1000)
2024-07-20 09:49:49 +02:00
func _process(_delta):
if is_hammer_delivered:
is_bridge_built = true
bridge.global_transform = _bridge_transform
if is_completed:
return
var hammer_item:ItemResource = load("res://data/items/hammer.tres")
if _player.inventory.has_all([hammer_item]):
is_hammer_found = true
2024-07-20 09:49:49 +02:00
if is_bridge_built:
is_completed = true