Some event stuff
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://dx6fv8n4jl5ku"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://dx6fv8n4jl5ku"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/Entities/Rosa.tscn" id="1_7b7hx"]
|
||||
[ext_resource type="Script" uid="uid://c37crdel0m5mw" path="res://scripts/Map/Map.gd" id="1_ru75d"]
|
||||
@@ -13,6 +13,7 @@
|
||||
[ext_resource type="Script" uid="uid://b41umpbgqfuc2" path="res://scripts/Event/Item/EventGetItem.gd" id="10_avybc"]
|
||||
[ext_resource type="Script" uid="uid://0ygswaohp7kj" path="res://scripts/Event/EventFlagModify.gd" id="12_ncdgy"]
|
||||
[ext_resource type="Script" uid="uid://ccujhcc446mvh" path="res://scripts/Event/Condition/EventIfFlag.gd" id="13_60ixl"]
|
||||
[ext_resource type="Script" uid="uid://baywtxo4wy5i4" path="res://scripts/Event/Trigger/EventQuestObjectiveComplete.gd" id="14_i48p6"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"]
|
||||
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
|
||||
@@ -141,7 +142,10 @@ event = 1
|
||||
eventFlag = 1
|
||||
metadata/_custom_type_script = "uid://0ygswaohp7kj"
|
||||
|
||||
[node name="TextTest" type="Node" parent="Events"]
|
||||
[node name="EventGroup" type="Node" parent="Events"]
|
||||
script = ExtResource("14_i48p6")
|
||||
|
||||
[node name="TextTest" type="Node" parent="Events/EventGroup"]
|
||||
script = ExtResource("6_gxq5o")
|
||||
text = "testestest
|
||||
"
|
||||
|
@@ -8,6 +8,8 @@ var ended:bool = false;
|
||||
var interactor:EntityInteractor = null
|
||||
var interactee:EntityInteractable = null
|
||||
|
||||
signal eventEnded()
|
||||
|
||||
# Godot Methods
|
||||
func _process(delta: float) -> void:
|
||||
if !started || ended:
|
||||
@@ -37,6 +39,7 @@ func isDone() -> bool:
|
||||
func end() -> void:
|
||||
assert(ended == false)
|
||||
ended = true
|
||||
self.eventEnded.emit()
|
||||
if self.inEventSystemTree:
|
||||
EVENT.removeEvent(self)
|
||||
|
||||
|
@@ -15,8 +15,6 @@ var conversationEvent:EventConversation = null
|
||||
var textboxEvent:EventTextbox = null
|
||||
|
||||
func start() -> void:
|
||||
getInventory().addItem(itemType, quantity)
|
||||
|
||||
# Should show text?
|
||||
if !showText:
|
||||
super.start()
|
||||
@@ -50,10 +48,18 @@ func start() -> void:
|
||||
textboxEvent.count = quantity
|
||||
conversationEvent.addChildEvent(textboxEvent)
|
||||
|
||||
conversationEvent.eventEnded.connect(func():
|
||||
# Reward the item
|
||||
rewardItem()
|
||||
)
|
||||
|
||||
# Begin processing
|
||||
super.start()
|
||||
startChild(conversationEvent)
|
||||
|
||||
func rewardItem():
|
||||
getInventory().addItem(itemType, quantity)
|
||||
|
||||
func isDone() -> bool:
|
||||
if !super.isDone():
|
||||
return false
|
||||
|
17
scripts/Event/Trigger/EventAutoStart.gd
Normal file
17
scripts/Event/Trigger/EventAutoStart.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
class_name EventAutoStart extends "res://scripts/Event/Flow/EventGroup.gd"
|
||||
|
||||
@export var restartWhenEnded: bool = false
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
|
||||
if self.ended:
|
||||
if !self.restartWhenEnded:
|
||||
return
|
||||
|
||||
self.reset()
|
||||
|
||||
if self.started && !self.ended:
|
||||
return
|
||||
|
||||
self.start()
|
1
scripts/Event/Trigger/EventAutoStart.gd.uid
Normal file
1
scripts/Event/Trigger/EventAutoStart.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ckeqruxf6boav
|
31
scripts/Event/Trigger/EventQuestObjectiveComplete.gd
Normal file
31
scripts/Event/Trigger/EventQuestObjectiveComplete.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
class_name EventQuestObjectiveComplete extends "res://scripts/Event/Flow/EventGroup.gd"
|
||||
|
||||
@export var triggerIfObjectiveUncompletedThenComplatedAgain: bool = false
|
||||
@export var quest:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
||||
@export var objectiveIndex:int = 0
|
||||
|
||||
var hasTriggered:bool = false
|
||||
|
||||
func _enter_tree() -> void:
|
||||
QUEST.questUpdated.connect(onQuestUpdated)
|
||||
pass
|
||||
|
||||
func _exit_tree() -> void:
|
||||
QUEST.questUpdated.disconnect(onQuestUpdated)
|
||||
pass
|
||||
|
||||
func onQuestUpdated(quest:Quest) -> void:
|
||||
if self.ended:
|
||||
if !self.triggerIfObjectiveUncompletedThenComplatedAgain:
|
||||
return
|
||||
self.reset()
|
||||
|
||||
if !quest.isStarted():
|
||||
return
|
||||
|
||||
if !quest.objectives[objectiveIndex].isCompleted():
|
||||
return
|
||||
|
||||
print("onObjectiveCompleted: %s" % quest.questKey)
|
||||
self.start()
|
||||
pass
|
1
scripts/Event/Trigger/EventQuestObjectiveComplete.gd.uid
Normal file
1
scripts/Event/Trigger/EventQuestObjectiveComplete.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://baywtxo4wy5i4
|
Reference in New Issue
Block a user