This commit is contained in:
2025-05-20 08:24:38 -05:00
parent 6b2fa2b381
commit 36762682b8
8 changed files with 150 additions and 21 deletions

View File

@@ -12,7 +12,7 @@
[ext_resource type="PackedScene" uid="uid://bkj630bhmnvsi" path="res://scenes/Entities/Sign.tscn" id="9_xfqoe"] [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://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://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"] [ext_resource type="Script" uid="uid://ccujhcc446mvh" path="res://scripts/Event/Flow/EventIfFlag.gd" id="13_60ixl"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"]
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1) sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
@@ -79,38 +79,50 @@ omni_range = 281.646
[node name="TestConversation" type="Node" parent="Events"] [node name="TestConversation" type="Node" parent="Events"]
script = ExtResource("5_cg1ph") script = ExtResource("5_cg1ph")
[node name="EventFlagModify" type="Node" parent="Events/TestConversation"] [node name="EventIfEvent2" type="Node" parent="Events/TestConversation"]
script = ExtResource("12_ncdgy") script = ExtResource("13_60ixl")
action = 4
event = 1 event = 1
eventFlag = 1539 eventFlag = 1
metadata/_custom_type_script = "uid://0ygswaohp7kj" metadata/_custom_type_script = "uid://ccujhcc446mvh"
[node name="Text 0" type="Node" parent="Events/TestConversation"] [node name="Text 0" type="Node" parent="Events/TestConversation/EventIfEvent2"]
script = ExtResource("6_gxq5o")
text = "Go find those ingredients!"
[node name="EventIfEvent" type="Node" parent="Events/TestConversation"]
script = ExtResource("13_60ixl")
event = 1
type = 2
eventFlag = 1
metadata/_custom_type_script = "uid://ccujhcc446mvh"
[node name="Text 0" type="Node" parent="Events/TestConversation/EventIfEvent"]
script = ExtResource("6_gxq5o") script = ExtResource("6_gxq5o")
text = "I am giving you a quest to gather some ingredients." text = "I am giving you a quest to gather some ingredients."
[node name="EventGoTo" type="Node" parent="Events/TestConversation" node_paths=PackedStringArray("event")] [node name="Quest" type="Node" parent="Events/TestConversation/EventIfEvent"]
script = ExtResource("13_60ixl")
event = NodePath("../../TextTest")
[node name="Quest" type="Node" parent="Events/TestConversation"]
script = ExtResource("7_brp0k") script = ExtResource("7_brp0k")
metadata/_custom_type_script = "uid://c4d7nithqnx5y" metadata/_custom_type_script = "uid://c4d7nithqnx5y"
[node name="Text 1" type="Node" parent="Events/TestConversation"] [node name="Text 1" type="Node" parent="Events/TestConversation/EventIfEvent"]
script = ExtResource("6_gxq5o") script = ExtResource("6_gxq5o")
text = "Thanks for closing the quest menu" text = "Thanks for closing the quest menu"
[node name="Get Item" type="Node" parent="Events/TestConversation"] [node name="Get Item" type="Node" parent="Events/TestConversation/EventIfEvent"]
script = ExtResource("10_avybc") script = ExtResource("10_avybc")
getType = 1 getType = 1
metadata/_custom_type_script = "uid://b41umpbgqfuc2" metadata/_custom_type_script = "uid://b41umpbgqfuc2"
[node name="Text 2" type="Node" parent="Events/TestConversation"] [node name="Text 2" type="Node" parent="Events/TestConversation/EventIfEvent"]
script = ExtResource("6_gxq5o") script = ExtResource("6_gxq5o")
text = "Thanks for taking that potion." text = "Thanks for taking that potion."
[node name="EventFlagModify" type="Node" parent="Events/TestConversation/EventIfEvent"]
script = ExtResource("12_ncdgy")
event = 1
eventFlag = 1
metadata/_custom_type_script = "uid://0ygswaohp7kj"
[node name="TextTest" type="Node" parent="Events"] [node name="TextTest" type="Node" parent="Events"]
script = ExtResource("6_gxq5o") script = ExtResource("6_gxq5o")
text = "testestest text = "testestest

View File

@@ -1,7 +1,40 @@
class_name EventFlagOn extends "res://scripts/Event/Event.gd" class_name EventFlagOn extends "res://scripts/Event/Event.gd"
@export var event:EventSystem.SpecialEvent; @export var event:EventSystem.SpecialEvent;
@export_flags("1:1", "2:2", "3:4", "4:8", "5:16", "6:32", "7:64", "8:128", "9:256", "10:512", "11:1024", "12:2048", "13:4096", "14:8192", "15:16384", "16:32768") @export_flags(
"1:1",
"2:2",
"3:4",
"4:8",
"5:16",
"6:32",
"7:64",
"8:128",
"9:256",
"10:512",
"11:1024",
"12:2048",
"13:4096",
"14:8192",
"15:16384",
"16:32768",
"17:65536",
"18:131072",
"19:262144",
"20:524288",
"21:1048576",
"22:2097152",
"23:4194304",
"24:8388608",
"25:16777216",
"26:33554432",
"27:67108864",
"28:134217728",
"29:268435456",
"30:536870912",
"31:1073741824",
"32:2147483648"
)
var eventFlag:int = 0; var eventFlag:int = 0;
func start() -> void: func start() -> void:

View File

@@ -8,21 +8,28 @@ enum ProcessType {
@export var processType:ProcessType = ProcessType.SEQUENTIAL; @export var processType:ProcessType = ProcessType.SEQUENTIAL;
var childIndex:int = 0 var childIndex:int = 0
var eventGroupStarted:bool = false
func shouldAutoStart() -> bool:
return true
func start() -> void: func start() -> void:
super.start() super.start()
# If sequential, start first child if shouldAutoStart():
startEventGroup()
func startEventGroup() -> void:
eventGroupStarted = true
# This is called by the parent event to start the group
if processType == ProcessType.SEQUENTIAL: if processType == ProcessType.SEQUENTIAL:
childIndex = -1 childIndex = -1
nextChild() nextChild()
# If parallel, start all children
elif processType == ProcessType.PARALLEL: elif processType == ProcessType.PARALLEL:
for child in childEvents: for child in childEvents:
startChild(child) startChild(child)
func update(delta:float) -> void: func update(delta:float) -> void:
super.update(delta) super.update(delta)
@@ -42,6 +49,9 @@ func nextChild() -> void:
func isDone() -> bool: func isDone() -> bool:
if !super.isDone(): if !super.isDone():
return false return false
if started && !eventGroupStarted:
return true
# If sequential, check if we've reached the end of the children # If sequential, check if we've reached the end of the children
if processType == ProcessType.SEQUENTIAL: if processType == ProcessType.SEQUENTIAL:
@@ -66,6 +76,7 @@ func end() -> void:
func reset() -> void: func reset() -> void:
childIndex = -1 childIndex = -1
eventGroupStarted = false
for child in childEvents: for child in childEvents:
child.reset() child.reset()
# Send to the parent to reset the extra events # Send to the parent to reset the extra events

View File

@@ -0,0 +1,13 @@
class_name EventIf extends "res://scripts/Event/Flow/EventGroup.gd"
func ifCondition() -> bool:
return false
func shouldAutoStart() -> bool:
return false
func start() -> void:
super.start()
if ifCondition():
startEventGroup()

View File

@@ -0,0 +1 @@
uid://bn2nw17cf11wp

View File

@@ -0,0 +1,58 @@
class_name EventIfEvent extends "res://scripts/Event/Flow/EventIf.gd"
enum Type {
ANY_OF_FLAGS_ON,
ALL_OF_FLAGS_ON,
ANY_OF_FLAGS_OFF,
ALL_OF_FLAGS_OFF,
}
@export var event:EventSystem.SpecialEvent;
@export var type:Type = Type.ANY_OF_FLAGS_ON;
@export_flags(
"1:1",
"2:2",
"3:4",
"4:8",
"5:16",
"6:32",
"7:64",
"8:128",
"9:256",
"10:512",
"11:1024",
"12:2048",
"13:4096",
"14:8192",
"15:16384",
"16:32768",
"17:65536",
"18:131072",
"19:262144",
"20:524288",
"21:1048576",
"22:2097152",
"23:4194304",
"24:8388608",
"25:16777216",
"26:33554432",
"27:67108864",
"28:134217728",
"29:268435456",
"30:536870912",
"31:1073741824",
"32:2147483648"
)
var eventFlag:int = 0;
func ifCondition() -> bool:
match type:
Type.ANY_OF_FLAGS_ON:
return EVENT.eventIsAnyOfFlagsOn(event, eventFlag)
Type.ALL_OF_FLAGS_ON:
return EVENT.eventAreFlagsOn(event, eventFlag)
Type.ANY_OF_FLAGS_OFF:
return EVENT.eventIsAnyOfFlagsOff(event, eventFlag)
Type.ALL_OF_FLAGS_OFF:
return EVENT.eventAreFlagsOff(event, eventFlag)
return false

View File

@@ -0,0 +1 @@
uid://ccujhcc446mvh

View File

@@ -13,7 +13,7 @@ func _ready() -> void:
for i in range(0, EventSystem.EVENT_FLAG_COUNT): for i in range(0, EventSystem.EVENT_FLAG_COUNT):
var checkbox:CheckBox = CheckBox.new() var checkbox:CheckBox = CheckBox.new()
checkbox.text = "Flag %s" % str(i) checkbox.text = "Flag %s" % str(i+1)
grid.add_child(checkbox) grid.add_child(checkbox)
checkboxes.append(checkbox) checkboxes.append(checkbox)
checkbox.pressed.connect(_on_CheckboxPressed) checkbox.pressed.connect(_on_CheckboxPressed)