First work on dialogic, resized guild, and started implementing portraits.

This commit is contained in:
2025-08-14 10:26:24 -04:00
parent 95a7db036b
commit 3aeb3d44e6
959 changed files with 47688 additions and 46 deletions

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.9645 2.62927L12.8459 5.22444C12.6271 5.04546 12.3835 4.89134 12.1151 4.76208C11.8565 4.62287 11.5881 4.55327 11.3097 4.55327C11.0909 4.55327 10.8821 4.59802 10.6832 4.68751C10.4943 4.77699 10.3203 4.89631 10.1612 5.04546C10.0021 5.19461 9.86293 5.36364 9.74361 5.55256C9.6243 5.73154 9.52486 5.91052 9.44532 6.08949L9.14702 6.93964C9.35583 7.37714 9.55966 7.79475 9.75853 8.19248C9.92756 8.53055 10.1016 8.87359 10.2805 9.2216C10.4595 9.55966 10.6087 9.82813 10.728 10.027C10.9169 10.3153 11.1058 10.6136 11.2948 10.9219C11.4837 11.2202 11.6925 11.4936 11.9212 11.7422C12.0206 11.8516 12.1399 11.9261 12.2791 11.9659C12.4283 11.9957 12.5625 12.0107 12.6818 12.0107C12.8707 12.0107 13.0497 11.9858 13.2188 11.9361C13.3878 11.8864 13.5469 11.8217 13.696 11.7422L14.0689 12.2195C13.9297 12.4382 13.7607 12.657 13.5618 12.8757C13.3629 13.0945 13.1442 13.2933 12.9055 13.4723C12.6769 13.6513 12.4283 13.7955 12.1598 13.9048C11.9013 14.0242 11.6378 14.0838 11.3693 14.0838C11.1307 14.0838 10.9169 14.044 10.728 13.9645C10.549 13.8949 10.3849 13.8004 10.2358 13.6811C10.0867 13.5519 9.94745 13.4027 9.81819 13.2337C9.68893 13.0646 9.55469 12.8906 9.41549 12.7117C9.30611 12.5426 9.1868 12.3388 9.05753 12.1001C8.93822 11.8516 8.81393 11.598 8.68466 11.3395C8.5554 11.081 8.42614 10.8324 8.29688 10.5938C8.16762 10.3452 8.04333 10.1364 7.92401 9.96734C7.8743 10.1364 7.82955 10.3054 7.78978 10.4744C7.75001 10.6136 7.70526 10.7578 7.65555 10.907C7.60583 11.0561 7.56109 11.1705 7.52131 11.25C7.37216 11.5682 7.18324 11.8963 6.95455 12.2344C6.72586 12.5724 6.46236 12.8807 6.16407 13.1591C5.87572 13.4276 5.55753 13.6513 5.20952 13.8303C4.86151 13.9993 4.49361 14.0838 4.10583 14.0838C3.75782 14.0838 3.41975 14.0142 3.09162 13.875C2.7635 13.7457 2.46023 13.5717 2.18182 13.353L3.12145 10.8771C3.43964 11.076 3.78765 11.255 4.16549 11.4141C4.54333 11.5632 4.92117 11.6378 5.29901 11.6378C5.41833 11.6378 5.54262 11.6278 5.67188 11.608C5.80114 11.5781 5.92543 11.5384 6.04475 11.4886C6.17401 11.429 6.28836 11.3594 6.38779 11.2798C6.48722 11.1903 6.5618 11.0859 6.61151 10.9666C6.68111 10.8374 6.75569 10.6683 6.83523 10.4595C6.91478 10.2507 6.99432 10.0419 7.07387 9.8331C7.16336 9.59447 7.25285 9.34091 7.34234 9.07245L4.53836 4.5831C4.4091 4.43395 4.25001 4.31464 4.06109 4.22515C3.88211 4.12572 3.69319 4.076 3.49432 4.076C3.32529 4.076 3.1662 4.1108 3.01705 4.1804C2.8679 4.24006 2.72373 4.32458 2.58452 4.43395L2.18182 3.91194C2.32103 3.70313 2.48509 3.4993 2.67401 3.30043C2.87287 3.09162 3.08665 2.90768 3.31535 2.74859C3.54404 2.57955 3.78765 2.44532 4.04617 2.34589C4.30469 2.23651 4.56819 2.18182 4.83665 2.18182C5.16478 2.18182 5.46805 2.26634 5.74645 2.43537C6.02486 2.59447 6.28339 2.79333 6.52202 3.03197C6.76066 3.2706 6.97941 3.52912 7.17827 3.80753C7.37714 4.08594 7.55611 4.34447 7.7152 4.5831C7.79475 4.69248 7.87927 4.83168 7.96876 5.00072C8.06819 5.15981 8.16265 5.3189 8.25214 5.47799C8.36151 5.65697 8.46591 5.85086 8.56535 6.05966C8.66478 5.82103 8.76918 5.58239 8.87856 5.34376C8.96805 5.14489 9.05753 4.94106 9.14702 4.73225C9.24645 4.5135 9.33594 4.32458 9.41549 4.16549C9.56464 3.88708 9.73367 3.62856 9.92259 3.38992C10.1115 3.15128 10.3203 2.94248 10.549 2.7635C10.7876 2.58452 11.0462 2.44532 11.3246 2.34589C11.603 2.23651 11.9063 2.18182 12.2344 2.18182C12.5426 2.18182 12.8409 2.2216 13.1293 2.30114C13.4176 2.38069 13.696 2.49006 13.9645 2.62927Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dlwtdexd63bxi"
path="res://.godot/imported/definition.svg-dbaabe55d84e4ad95047a50fc6c13843.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Modules/History/definition.svg"
dest_files=["res://.godot/imported/definition.svg-dbaabe55d84e4ad95047a50fc6c13843.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true

View File

@@ -0,0 +1,76 @@
@tool
class_name DialogicHistoryEvent
extends DialogicEvent
## Event that allows clearing, pausing and resuming of history functionality.
enum Actions {CLEAR, PAUSE, RESUME}
### Settings
## The type of action: Clear, Pause or Resume
var action := Actions.PAUSE
################################################################################
## EXECUTION
################################################################################
func _execute() -> void:
match action:
Actions.CLEAR:
dialogic.History.simple_history_content = []
Actions.PAUSE:
dialogic.History.simple_history_enabled = false
Actions.RESUME:
dialogic.History.simple_history_enabled = true
finish()
################################################################################
## INITIALIZE
################################################################################
func _init() -> void:
event_name = "History"
set_default_color('Color9')
event_category = "Other"
event_sorting_index = 20
################################################################################
## SAVING/LOADING
################################################################################
func get_shortcode() -> String:
return "history"
func get_shortcode_parameters() -> Dictionary:
return {
#param_name : property_info
"action" : {"property": "action", "default": Actions.PAUSE,
"suggestions": func(): return {"Clear":{'value':0, 'text_alt':['clear']}, "Pause":{'value':1, 'text_alt':['pause']}, "Resume":{'value':2, 'text_alt':['resume', 'start']}}},
}
################################################################################
## EDITOR REPRESENTATION
################################################################################
func build_event_editor() -> void:
add_header_edit('action', ValueType.FIXED_OPTIONS, {
'options': [
{
'label': 'Pause History',
'value': Actions.PAUSE,
},
{
'label': 'Resume History',
'value': Actions.RESUME,
},
{
'label': 'Clear History',
'value': Actions.CLEAR,
},
]
})

View File

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

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="63.999996" height="63.999996" viewBox="0 0 16.933332 16.933332" version="1.1" id="svg5" inkscape:export-filename="history-icon.svg" inkscape:export-xdpi="96" inkscape:export-ydpi="96" sodipodi:docname="icon.svg" inkscape:version="1.2.2 (732a01da63, 2022-12-09)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview id="namedview7" pagecolor="#464646" bordercolor="#000000" borderopacity="0.25" inkscape:showpageshadow="2" inkscape:pageopacity="0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="false" showguides="true" inkscape:zoom="2.2483786" inkscape:cx="-22.46063" inkscape:cy="23.127778" inkscape:window-width="1920" inkscape:window-height="1017" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg5" />
<defs id="defs2" />
<path style="stroke-width:2.07079;stroke-dasharray:none;stroke:#ffffff;fill:none;stroke-linecap:round;stroke-linejoin:round" d="m 58.321651,12.698536 -0.558962,3.485814 4.876563,-1.469574" id="path289" sodipodi:nodetypes="ccc" transform="matrix(0.74514681,0,0,0.74514681,-39.120302,2.2986328)" />
<path style="stroke-width:2.07079;stroke-dasharray:none;stroke:#ffffff;fill:none;stroke-linecap:round;stroke-linejoin:round" d="m 55.996236,7.7807585 1.228349,1.9317129 1.167703,-1.9718383 z" id="path953" sodipodi:nodetypes="cccc" transform="matrix(0.74514681,0,0,0.74514681,-39.120302,2.2986328)" />
<path style="stroke-width:2.07079;stroke-dasharray:none;stroke:#ffffff;fill:none;stroke-linecap:round;stroke-linejoin:round" d="m 63.824761,5.993924 0.29361,2.1554114 3.593444,1.1319403" id="path2562" inkscape:transform-center-x="-1.1566618" inkscape:transform-center-y="-0.95424579" sodipodi:nodetypes="ccc" transform="matrix(0.74514681,0,0,0.74514681,-39.120302,2.2986328)" />
<path id="path11412" style="stroke-width:2.07079;stroke-dasharray:none;stroke:#ffffff;fill:none;stroke-linecap:round;stroke-linejoin:round" d="m 57.198151,7.6362197 c 0,-4.012519 3.25279,-7.26530838 7.265309,-7.26530838 4.012519,0 7.265308,3.25278938 7.265308,7.26530838 0,4.0125193 -3.252789,7.2653093 -7.265308,7.2653093 -0.578673,0 -1.141544,-0.06765 -1.681136,-0.195481" sodipodi:nodetypes="csssc" transform="matrix(0.74514681,0,0,0.74514681,-39.120302,2.2986328)" />
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://1n5bqdv34pmy"
path="res://.godot/imported/icon.svg-82841efe3f86e947d4f66fd24dc8f52c.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Modules/History/icon.svg"
dest_files=["res://.godot/imported/icon.svg-82841efe3f86e947d4f66fd24dc8f52c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true

View File

@@ -0,0 +1,13 @@
@tool
extends DialogicIndexer
func _get_events() -> Array:
return [this_folder.path_join('event_history.gd')]
func _get_subsystems() -> Array:
return [{'name':'History', 'script':this_folder.path_join('subsystem_history.gd')}]
func _get_settings_pages() -> Array:
return [this_folder.path_join('settings_history.tscn')]

View File

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

View File

@@ -0,0 +1,29 @@
@tool
extends DialogicSettingsPage
func _get_priority() -> int:
return -10
func _ready() -> void:
%SimpleHistoryEnabled.toggled.connect(setting_toggled.bind('dialogic/history/simple_history_enabled'))
%SimpleHistorySave.toggled.connect(setting_toggled.bind('dialogic/history/simple_history_save'))
%FullHistoryEnabled.toggled.connect(setting_toggled.bind('dialogic/history/full_history_enabled'))
%FullHistorySave.toggled.connect(setting_toggled.bind('dialogic/history/full_history_save'))
%AlreadyReadHistoryEnabled.toggled.connect(setting_toggled.bind('dialogic/history/visited_event_history_enabled'))
%SaveOnAutoSaveToggle.toggled.connect(setting_toggled.bind('dialogic/history/save_on_autosave'))
%SaveOnSaveToggle.toggled.connect(setting_toggled.bind('dialogic/history/save_on_save'))
func _refresh() -> void:
%SimpleHistoryEnabled.button_pressed = ProjectSettings.get_setting('dialogic/history/simple_history_enabled', false)
%SimpleHistorySave.button_pressed = ProjectSettings.get_setting('dialogic/history/simple_history_save', false)
%FullHistoryEnabled.button_pressed = ProjectSettings.get_setting('dialogic/history/full_history_enabled', false)
%FullHistorySave.button_pressed = ProjectSettings.get_setting('dialogic/history/full_history_save', false)
%AlreadyReadHistoryEnabled.button_pressed = ProjectSettings.get_setting('dialogic/history/visited_event_history_enabled', false)
func setting_toggled(button_pressed: bool, setting: String) -> void:
ProjectSettings.set_setting(setting, button_pressed)
ProjectSettings.save()

View File

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

View File

@@ -0,0 +1,176 @@
[gd_scene load_steps=5 format=3 uid="uid://b5yq6xh412ilm"]
[ext_resource type="Script" path="res://addons/dialogic/Modules/History/settings_history.gd" id="1_hbhst"]
[ext_resource type="PackedScene" uid="uid://dbpkta2tjsqim" path="res://addons/dialogic/Editor/Common/hint_tooltip_icon.tscn" id="2_wefye"]
[sub_resource type="Image" id="Image_3clns"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_irr0a"]
image = SubResource("Image_3clns")
[node name="History" type="PanelContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_type_variation = &"DialogicPanelA"
script = ExtResource("1_hbhst")
[node name="HistoryOptions" type="VBoxContainer" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="Title3" type="Label" parent="HistoryOptions"]
layout_mode = 2
theme_type_variation = &"DialogicSettingsSection"
text = "Simple History"
[node name="HBoxContainer" type="HBoxContainer" parent="HistoryOptions"]
layout_mode = 2
[node name="Label" type="Label" parent="HistoryOptions/HBoxContainer"]
layout_mode = 2
text = "Enabled"
[node name="HintTooltip" parent="HistoryOptions/HBoxContainer" instance=ExtResource("2_wefye")]
layout_mode = 2
tooltip_text = "When enabled, some events (Text, Join, Leave, Choice) will store a log.
Also, the default layout will feature the log panel option."
texture = SubResource("ImageTexture_irr0a")
hint_text = "When enabled, some events (Text, Join, Leave, Choice) will store a log.
Also, the default layout will feature the log panel option."
[node name="SimpleHistoryEnabled" type="CheckBox" parent="HistoryOptions/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer2" type="HBoxContainer" parent="HistoryOptions"]
layout_mode = 2
[node name="Label" type="Label" parent="HistoryOptions/HBoxContainer2"]
layout_mode = 2
text = "Save and Load"
[node name="HintTooltip" parent="HistoryOptions/HBoxContainer2" instance=ExtResource("2_wefye")]
layout_mode = 2
tooltip_text = "When enabled, the simple history is included in the savegame."
texture = SubResource("ImageTexture_irr0a")
hint_text = "When enabled, the simple history is included in the savegame. Also, it is reset on Dialogic.clear(FULL_CLEAR)."
[node name="SimpleHistorySave" type="CheckBox" parent="HistoryOptions/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
[node name="Title" type="Label" parent="HistoryOptions"]
layout_mode = 2
theme_type_variation = &"DialogicSettingsSection"
text = "Full History"
[node name="HBoxContainer5" type="HBoxContainer" parent="HistoryOptions"]
layout_mode = 2
[node name="Label" type="Label" parent="HistoryOptions/HBoxContainer5"]
layout_mode = 2
text = "Enabled"
[node name="HintTooltip" parent="HistoryOptions/HBoxContainer5" instance=ExtResource("2_wefye")]
layout_mode = 2
tooltip_text = "When enabled, stores a copy of each event."
texture = SubResource("ImageTexture_irr0a")
hint_text = "When enabled, stores a copy of each event."
[node name="FullHistoryEnabled" type="CheckBox" parent="HistoryOptions/HBoxContainer5"]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer6" type="HBoxContainer" parent="HistoryOptions"]
layout_mode = 2
[node name="Label" type="Label" parent="HistoryOptions/HBoxContainer6"]
layout_mode = 2
text = "Save and Load"
[node name="HintTooltip" parent="HistoryOptions/HBoxContainer6" instance=ExtResource("2_wefye")]
layout_mode = 2
tooltip_text = "When enabled, the full history is included in the savegame."
texture = SubResource("ImageTexture_irr0a")
hint_text = "When enabled, the full history is included in the savegame. Also, it is reset on Dialogic.clear(FULL_CLEAR)."
[node name="FullHistorySave" type="CheckBox" parent="HistoryOptions/HBoxContainer6"]
unique_name_in_owner = true
layout_mode = 2
[node name="Title2" type="Label" parent="HistoryOptions"]
layout_mode = 2
theme_type_variation = &"DialogicSettingsSection"
text = "Seen Events History"
[node name="HBoxContainer4" type="HBoxContainer" parent="HistoryOptions"]
layout_mode = 2
[node name="EnabledLabel" type="Label" parent="HistoryOptions/HBoxContainer4"]
layout_mode = 2
text = "Enabled"
[node name="HintTooltip" parent="HistoryOptions/HBoxContainer4" instance=ExtResource("2_wefye")]
layout_mode = 2
tooltip_text = "Remembers whether events were already met in the timeline.
When enabled the signals \"Dialogic.History.visited_event\" and \"Dialogic.History.unvisited_event\" are emitted.
"
texture = SubResource("ImageTexture_irr0a")
hint_text = "Remembers whether events were already met in the timeline.
When enabled the signals \"Dialogic.History.visited_event\" and \"Dialogic.History.unvisited_event\" are emitted.
"
[node name="AlreadyReadHistoryEnabled" type="CheckBox" parent="HistoryOptions/HBoxContainer4"]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainerSaveOnAutoSave" type="HBoxContainer" parent="HistoryOptions"]
layout_mode = 2
[node name="EnabledLabel" type="Label" parent="HistoryOptions/HBoxContainerSaveOnAutoSave"]
layout_mode = 2
text = "Save on Auto-Save signal"
[node name="HintTooltip" parent="HistoryOptions/HBoxContainerSaveOnAutoSave" instance=ExtResource("2_wefye")]
layout_mode = 2
tooltip_text = "Stores the already-visited history in a global save file when an Auto-Save occurs.
The Auto-Save is part of the Save settings."
texture = SubResource("ImageTexture_irr0a")
hint_text = "Stores the already-visited history in a global save file when an Auto-Save occurs.
The Auto-Save is part of the Save settings."
[node name="SaveOnAutoSaveToggle" type="CheckBox" parent="HistoryOptions/HBoxContainerSaveOnAutoSave"]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainerSaveOnSave" type="HBoxContainer" parent="HistoryOptions"]
layout_mode = 2
[node name="EnabledLabel" type="Label" parent="HistoryOptions/HBoxContainerSaveOnSave"]
layout_mode = 2
text = "Save on Save signal"
[node name="HintTooltip" parent="HistoryOptions/HBoxContainerSaveOnSave" instance=ExtResource("2_wefye")]
layout_mode = 2
tooltip_text = "Stores the already-visited history in a global save file when a normal Save occurs.
This can be done via the Dialogic.Save.save method.
This setting ignores Auto-Saves."
texture = SubResource("ImageTexture_irr0a")
hint_text = "Stores the already-visited history in a global save file when a normal Save occurs.
This can be done via the Dialogic.Save.save method.
This setting ignores Auto-Saves."
[node name="SaveOnSaveToggle" type="CheckBox" parent="HistoryOptions/HBoxContainerSaveOnSave"]
unique_name_in_owner = true
layout_mode = 2

View File

@@ -0,0 +1,305 @@
extends DialogicSubsystem
## Subsystem that manages history storing.
signal open_requested
signal close_requested
## Simple history that stores limited information
## Used for the history display
var simple_history_enabled := false
var simple_history_save := false
var simple_history_content : Array[Dictionary] = []
signal simple_history_changed
## Whether to keep a history of every Dialogic event encountered.
var full_event_history_enabled := false
var full_event_history_save := false
## The full history of all Dialogic events encountered.
## Requires [member full_event_history_enabled] to be true.
var full_event_history_content: Array[DialogicEvent] = []
## Emitted if a new event has been inserted into the full event history.
signal full_event_history_changed
## Read text history
## Stores which text events and choices have already been visited
var visited_event_history_enabled := false
## A history of visited Dialogic events.
var visited_event_history_content := {}
## Whether the last event has been encountered for the first time.
var _visited_last_event := false
## Emitted if an encountered timeline event has been inserted into the visited
## event history.
##
## This will trigger only once per unique event instance.
signal visited_event
## Emitted if an encountered timeline event has not been visited before.
signal unvisited_event
## Used to store [member visited_event_history_content] in the global info file.
## You can change this to a custom name if you want to use a different key
## in the global save info file.
var visited_event_save_key := "visited_event_history_content"
## Whether to automatically save the already-visited history on auto-save.
var save_visited_history_on_autosave := false:
set(value):
save_visited_history_on_autosave = value
_update_saved_connection(value)
## Whether to automatically save the already-visited history on manual save.
var save_visited_history_on_save := false:
set(value):
save_visited_history_on_save = value
_update_saved_connection(value)
## Starts and stops the connection to the [subsystem Save] subsystem's [signal saved] signal.
func _update_saved_connection(to_connect: bool) -> void:
if to_connect:
if not DialogicUtil.autoload().Save.saved.is_connected(_on_save):
DialogicUtil.autoload().Save.saved.connect(_on_save)
else:
if DialogicUtil.autoload().Save.saved.is_connected(_on_save):
DialogicUtil.autoload().Save.saved.disconnect(_on_save)
#region INITIALIZE
####################################################################################################
func _ready() -> void:
dialogic.event_handled.connect(store_full_event)
dialogic.event_handled.connect(_check_seen)
simple_history_enabled = ProjectSettings.get_setting('dialogic/history/simple_history_enabled', simple_history_enabled)
simple_history_save = ProjectSettings.get_setting('dialogic/history/simple_history_save', simple_history_save)
full_event_history_enabled = ProjectSettings.get_setting('dialogic/history/full_history_enabled', full_event_history_enabled)
full_event_history_save = ProjectSettings.get_setting('dialogic/history/full_history_save', full_event_history_save)
visited_event_history_enabled = ProjectSettings.get_setting('dialogic/history/visited_event_history_enabled', visited_event_history_enabled)
func _on_save(info: Dictionary) -> void:
var is_autosave: bool = info["is_autosave"]
var save_on_autosave := save_visited_history_on_autosave and is_autosave
var save_on_save := save_visited_history_on_save and not is_autosave
if save_on_save or save_on_autosave:
save_visited_history()
func post_install() -> void:
save_visited_history_on_autosave = ProjectSettings.get_setting('dialogic/history/save_on_autosave', save_visited_history_on_autosave)
save_visited_history_on_save = ProjectSettings.get_setting('dialogic/history/save_on_save', save_visited_history_on_save)
func clear_game_state(clear_flag := DialogicGameHandler.ClearFlags.FULL_CLEAR) -> void:
if clear_flag == DialogicGameHandler.ClearFlags.FULL_CLEAR:
if simple_history_save:
simple_history_content = []
dialogic.current_state_info.erase("history_simple")
if full_event_history_save:
full_event_history_content = []
dialogic.current_state_info.erase("history_full")
func load_game_state(load_flag := LoadFlags.FULL_LOAD) -> void:
if load_flag == LoadFlags.FULL_LOAD:
if simple_history_save and dialogic.current_state_info.has("history_simple"):
simple_history_content.assign(dialogic.current_state_info["history_simple"])
if full_event_history_save and dialogic.current_state_info.has("history_full"):
full_event_history_content = []
for event_text in dialogic.current_state_info["history_full"]:
var event: DialogicEvent
for i in DialogicResourceUtil.get_event_cache():
if i.is_valid_event(event_text):
event = i.duplicate()
break
event.from_text(event_text)
full_event_history_content.append(event)
func save_game_state() -> void:
if simple_history_save:
dialogic.current_state_info["history_simple"] = Array(simple_history_content)
else:
dialogic.current_state_info.erase("history_simple")
if full_event_history_save:
dialogic.current_state_info["history_full"] = []
for event in full_event_history_content:
dialogic.current_state_info["history_full"].append(event.to_text())
else:
dialogic.current_state_info.erase("history_full")
func open_history() -> void:
open_requested.emit()
func close_history() -> void:
close_requested.emit()
#endregion
#region SIMPLE HISTORY
####################################################################################################
func store_simple_history_entry(text:String, event_type:String, extra_info := {}) -> void:
if !simple_history_enabled: return
extra_info['text'] = text
extra_info['event_type'] = event_type
simple_history_content.append(extra_info)
simple_history_changed.emit()
func get_simple_history() -> Array:
return simple_history_content
#endregion
#region FULL EVENT HISTORY
####################################################################################################
## Called on each event.
func store_full_event(event: DialogicEvent) -> void:
if !full_event_history_enabled: return
full_event_history_content.append(event)
full_event_history_changed.emit()
#region ALREADY READ HISTORY
####################################################################################################
## Takes the current timeline event and creates a unique key for it.
## Uses the timeline resource path as well.
func _current_event_key() -> String:
var resource_path := dialogic.current_timeline.resource_path
var event_index := dialogic.current_event_idx
var event_key := _get_event_key(event_index, resource_path)
return event_key
## Composes an event key from the event index and the timeline path.
## If either of these variables are in an invalid state, the resulting
## key may be wrong.
## There are no safety checks in place.
func _get_event_key(event_index: int, timeline_path: String) -> String:
var event_idx := str(event_index)
var event_key := timeline_path + event_idx
return event_key
## Called if an event is marked as visited.
func mark_event_as_visited(event_index := dialogic.current_event_idx, timeline := dialogic.current_timeline) -> void:
if !visited_event_history_enabled:
return
var event_key := _get_event_key(event_index, timeline.resource_path)
visited_event_history_content[event_key] = event_index
## Called on each event, but we filter for Text events.
func _check_seen(event: DialogicEvent) -> void:
if !visited_event_history_enabled:
return
# At this point, we only care about Text events.
# There may be a more elegant way of filtering events.
# Especially since custom events require this event name.
if event.event_name != "Text":
return
var event_key := _current_event_key()
if event_key in visited_event_history_content:
visited_event.emit()
_visited_last_event = true
else:
unvisited_event.emit()
_visited_last_event = false
## Whether the last event has been visited for the first time or not.
## This will return `true` exactly once for each unique timeline event instance.
func has_last_event_been_visited() -> bool:
return _visited_last_event
## If called with with no arguments, the method will return whether
## the last encountered event was visited before.
##
## Otherwise, if [param event_index] and [param timeline] are passed,
## the method will check if the event from that given timeline has been
## visited yet.
##
## If no [param timeline] is passed, the current timeline will be used.
## If there is no current timeline, `false` will be returned.
##
## If no [param event_index] is passed, the current event index will be used.
func has_event_been_visited(event_index := dialogic.current_event_idx, timeline := dialogic.current_timeline) -> bool:
if timeline == null:
return false
var event_key := _get_event_key(event_index, timeline.resource_path)
var visited := event_key in visited_event_history_content
return visited
## Saves all seen events to the global info file.
## This can be useful when the player saves the game.
## In visual novels, callings this at the end of a route can be useful, as the
## player may not save the game.
##
## Be aware, this won't add any events but completely overwrite the already saved ones.
##
## Relies on the [subsystem Save] subsystem.
func save_visited_history() -> void:
DialogicUtil.autoload().Save.set_global_info(visited_event_save_key, visited_event_history_content)
## Loads the seen events from the global info save file.
## Calling this when a game gets loaded may be useful.
##
## Relies on the [subsystem Save] subsystem.
func load_visited_history() -> void:
visited_event_history_content = get_saved_visited_history()
## Returns the saved already-visited history from the global info save file.
## If none exist in the global info file, returns an empty dictionary.
##
## Relies on the [subsystem Save] subsystem.
func get_saved_visited_history() -> Dictionary:
return DialogicUtil.autoload().Save.get_global_info(visited_event_save_key, {})
## Resets the already-visited history in the global info save file.
## If [param reset_property] is true, it will also reset the already-visited
## history in the Dialogic Autoload.
##
## Relies on the [subsystem Save] subsystem.
func reset_visited_history(reset_property := true) -> void:
DialogicUtil.autoload().Save.set_global_info(visited_event_save_key, {})
if reset_property:
visited_event_history_content = {}
#endregion

View File

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