Event Go To
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
[gd_scene load_steps=16 format=3 uid="uid://dx6fv8n4jl5ku"]
 | 
			
		||||
[gd_scene load_steps=17 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"]
 | 
			
		||||
@@ -12,6 +12,7 @@
 | 
			
		||||
[ext_resource type="PackedScene" uid="uid://bkj630bhmnvsi" path="res://scenes/Entities/Sign.tscn" id="9_xfqoe"]
 | 
			
		||||
[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://da7fr2bave0c" path="res://scripts/Event/Flow/EventGoTo.gd" id="13_60ixl"]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"]
 | 
			
		||||
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
 | 
			
		||||
@@ -89,6 +90,10 @@ metadata/_custom_type_script = "uid://0ygswaohp7kj"
 | 
			
		||||
script = ExtResource("6_gxq5o")
 | 
			
		||||
text = "I am giving you a quest to gather some ingredients."
 | 
			
		||||
 | 
			
		||||
[node name="EventGoTo" type="Node" parent="Events/TestConversation" node_paths=PackedStringArray("event")]
 | 
			
		||||
script = ExtResource("13_60ixl")
 | 
			
		||||
event = NodePath("../../TextTest")
 | 
			
		||||
 | 
			
		||||
[node name="Quest" type="Node" parent="Events/TestConversation"]
 | 
			
		||||
script = ExtResource("7_brp0k")
 | 
			
		||||
metadata/_custom_type_script = "uid://c4d7nithqnx5y"
 | 
			
		||||
@@ -106,6 +111,7 @@ metadata/_custom_type_script = "uid://b41umpbgqfuc2"
 | 
			
		||||
script = ExtResource("6_gxq5o")
 | 
			
		||||
text = "Thanks for taking that potion."
 | 
			
		||||
 | 
			
		||||
[node name="EventConversation" type="Node" parent="Events"]
 | 
			
		||||
script = ExtResource("5_cg1ph")
 | 
			
		||||
metadata/_custom_type_script = "uid://tkfc88q8m86f"
 | 
			
		||||
[node name="TextTest" type="Node" parent="Events"]
 | 
			
		||||
script = ExtResource("6_gxq5o")
 | 
			
		||||
text = "testestest
 | 
			
		||||
"
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,9 @@ func end() -> void:
 | 
			
		||||
	assert(ended == false)
 | 
			
		||||
	ended = true
 | 
			
		||||
 | 
			
		||||
func isEndingEvent() -> bool:
 | 
			
		||||
	return false
 | 
			
		||||
 | 
			
		||||
func reset() -> void:
 | 
			
		||||
	started = false
 | 
			
		||||
	ended = false
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,8 @@ class_name EventConversation extends "res://scripts/Event/Flow/EventGroup.gd"
 | 
			
		||||
@export var turnInteractee:bool = true
 | 
			
		||||
@export var turnInteractor:bool = true
 | 
			
		||||
 | 
			
		||||
var endPauseEvent:EventPause = null
 | 
			
		||||
 | 
			
		||||
func start() -> void:
 | 
			
		||||
	# Turn events
 | 
			
		||||
	if interactee && interactor:
 | 
			
		||||
@@ -37,14 +39,20 @@ func start() -> void:
 | 
			
		||||
		addExtraEvent(startPause, 0)
 | 
			
		||||
 | 
			
		||||
		# Create end pause event.
 | 
			
		||||
		var endPause = EventPause.new()
 | 
			
		||||
		endPause.pauseType = endPauseType
 | 
			
		||||
		endPause.entities = entities
 | 
			
		||||
		endPauseEvent = EventPause.new()
 | 
			
		||||
		endPauseEvent.pauseType = endPauseType
 | 
			
		||||
		endPauseEvent.entities = entities
 | 
			
		||||
		if pauseInteractee && interactee.entity:
 | 
			
		||||
			endPause.includeInteractee = pauseInteractee
 | 
			
		||||
			endPauseEvent.includeInteractee = pauseInteractee
 | 
			
		||||
		if pauseInteractor && interactor.entity:
 | 
			
		||||
			endPause.includeInteractor = pauseInteractor
 | 
			
		||||
		addExtraEvent(endPause, -1)
 | 
			
		||||
			endPauseEvent.includeInteractor = pauseInteractor
 | 
			
		||||
		addExtraEvent(endPauseEvent, -1)
 | 
			
		||||
 | 
			
		||||
	# Pass off to event group
 | 
			
		||||
	super.start()
 | 
			
		||||
 | 
			
		||||
func end() -> void:
 | 
			
		||||
	# Manually end pause
 | 
			
		||||
	if endPauseEvent != null && !endPauseEvent.started:
 | 
			
		||||
		endPauseEvent.start()
 | 
			
		||||
	super.end()
 | 
			
		||||
 
 | 
			
		||||
@@ -7,10 +7,11 @@ const PauseSystem = preload("res://scripts/Singleton/Pause.gd")
 | 
			
		||||
@export var includeInteractee:bool = true
 | 
			
		||||
@export var includeInteractor:bool = true
 | 
			
		||||
 | 
			
		||||
func start() -> void:
 | 
			
		||||
func end() -> void:
 | 
			
		||||
	super.end()
 | 
			
		||||
	var ents:Array[Entity] = entities
 | 
			
		||||
	if interactor && includeInteractor && interactor.entity:
 | 
			
		||||
		ents.append(interactor.entity)
 | 
			
		||||
	if interactee && includeInteractee && interactee.entity:
 | 
			
		||||
		ents.append(interactee.entity)
 | 
			
		||||
	PAUSE.pause(pauseType, ents)
 | 
			
		||||
	PAUSE.pause(pauseType, ents)
 | 
			
		||||
							
								
								
									
										35
									
								
								scripts/Event/Flow/EventGoTo.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								scripts/Event/Flow/EventGoTo.gd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
class_name EventGoTo extends "res://scripts/Event/Event.gd"
 | 
			
		||||
 | 
			
		||||
enum Type {
 | 
			
		||||
	GO_TO,
 | 
			
		||||
	GO_TO_AND_WAIT,
 | 
			
		||||
	GO_TO_AND_CONTINUE
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@export var event:Event = null
 | 
			
		||||
@export var type:Type = Type.GO_TO
 | 
			
		||||
 | 
			
		||||
func start() -> void:
 | 
			
		||||
	super.start()
 | 
			
		||||
	if event == null:
 | 
			
		||||
		print("EventGoTo: No event set")
 | 
			
		||||
		return
 | 
			
		||||
 | 
			
		||||
	event.start()
 | 
			
		||||
 | 
			
		||||
func isDone():
 | 
			
		||||
	if !super.isDone():
 | 
			
		||||
		return false
 | 
			
		||||
	
 | 
			
		||||
	if event == null:
 | 
			
		||||
		return true
 | 
			
		||||
 | 
			
		||||
	if type == Type.GO_TO_AND_WAIT:
 | 
			
		||||
		return event.isDone()
 | 
			
		||||
 | 
			
		||||
	return true
 | 
			
		||||
 | 
			
		||||
func isEndingEvent() -> bool:
 | 
			
		||||
	if type == Type.GO_TO:
 | 
			
		||||
		return true
 | 
			
		||||
	return false
 | 
			
		||||
							
								
								
									
										1
									
								
								scripts/Event/Flow/EventGoTo.gd.uid
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								scripts/Event/Flow/EventGoTo.gd.uid
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
uid://da7fr2bave0c
 | 
			
		||||
@@ -76,3 +76,6 @@ func startChild(child:Event) -> void:
 | 
			
		||||
	child.interactee = self.interactee
 | 
			
		||||
	child.interactor = self.interactor
 | 
			
		||||
	child.start()
 | 
			
		||||
 | 
			
		||||
	if child.isEndingEvent():
 | 
			
		||||
		self.end()
 | 
			
		||||
		Reference in New Issue
	
	Block a user