]> Untitled Git - wolf-seeking-sheep.git/blob - addons/dialogic/Modules/History/event_history.gd
Updated export config options
[wolf-seeking-sheep.git] / addons / dialogic / Modules / History / event_history.gd
1 @tool
2 class_name DialogicHistoryEvent
3 extends DialogicEvent
4
5 ## Event that allows clearing, pausing and resuming of history functionality.
6
7 enum Actions {CLEAR, PAUSE, RESUME}
8
9 ### Settings
10
11 ## The type of action: Clear, Pause or Resume
12 var action := Actions.PAUSE
13
14
15 ################################################################################
16 ##                                              EXECUTION
17 ################################################################################
18
19 func _execute() -> void:
20         match action:
21                 Actions.CLEAR:
22                         dialogic.History.simple_history_content = []
23                 Actions.PAUSE:
24                         dialogic.History.simple_history_enabled = false
25                 Actions.RESUME:
26                         dialogic.History.simple_history_enabled = true
27
28         finish()
29
30
31 ################################################################################
32 ##                                              INITIALIZE
33 ################################################################################
34
35 func _init() -> void:
36         event_name = "History"
37         set_default_color('Color9')
38         event_category = "Other"
39         event_sorting_index = 20
40
41
42 ################################################################################
43 ##                                              SAVING/LOADING
44 ################################################################################
45
46 func get_shortcode() -> String:
47         return "history"
48
49 func get_shortcode_parameters() -> Dictionary:
50         return {
51                 #param_name             : property_info
52                 "action"                        : {"property": "action", "default": Actions.PAUSE,
53                                                                 "suggestions": func(): return {"Clear":{'value':0, 'text_alt':['clear']}, "Pause":{'value':1, 'text_alt':['pause']}, "Resume":{'value':2, 'text_alt':['resume', 'start']}}},
54         }
55
56 ################################################################################
57 ##                                              EDITOR REPRESENTATION
58 ################################################################################
59
60 func build_event_editor() -> void:
61         add_header_edit('action', ValueType.FIXED_OPTIONS, {
62                 'options': [
63                         {
64                                 'label': 'Pause History',
65                                 'value': Actions.PAUSE,
66                         },
67                         {
68                                 'label': 'Resume History',
69                                 'value': Actions.RESUME,
70                         },
71                         {
72                                 'label': 'Clear History',
73                                 'value': Actions.CLEAR,
74                         },
75                 ]
76                 })