Skip to content

Commit

Permalink
Update to version 0.0.38
Browse files Browse the repository at this point in the history
Disabled IFID reset option. (I had intended to disable this before the previous version, but forgot.)
Changed how spool list is saved, such that order of spools is saved while maintaining ability to merge json files together.
Changed overview table to alternate between two different colors each row.
Added edit button to playscreen so that an encounter reached during playtesting can be loaded more quickly and easily.
Deleted antagonist-selection menu from encounter editor scene. (It had been invisible, but now I've simply removed it completely.)
Implemented greatly improved interface for drag-and-drop lists that have built in context menus. The lists for options, reactions, and effects now all use this interface. Different context menus are shown depending on whether the author right-clicked on an item or in the empty space of the list.
Set compiler to remove console.log calls from interpreter when exporting storyworld in release mode. Exporting in debug mode will leave them in.
Changed interpreter to use customized popup dialog in place of window confirm calls. Also fixed some bugs involving saving and loading games. First, characters were not being saved and reloaded properly, and second, saving a game when "the end" screen had been reached, then reloading, was loading the most recent encounter instead of the end. Both issues should now be solved.
Removed saved game journal entry feature in interpreter.
Removed some unused code from interpreter.
The editor had a bug that caused a storyworld's modified_time to be updated upon loading it from a project file. Loading numerical values, such as earliest and latest turns, into spinboxes activates the "value_changed" signal. This can be fixed fully upon porting SweepWeave to Godot 4, as Godot 4 has new functions that one can call to set range interface values without triggering their value_changed signals, but in the meantime the interface elements for changing an encounter's earliest and latest turns have simply been deleted. I'm not sure if the bug can still occur under some circumstances, but I can worry about porting SweepWeave to Godot 4 another time.
Added new option to help menu to let authors check for updates to SweepWeave.
Updated gui theming for popup windows.
Popup windows will now be centered upon popup.
Changed default relationship model to use depth 1 properties for pTraits.
Reorganized files.
  • Loading branch information
FrobozzWaxwing committed Mar 27, 2023
1 parent 44e050d commit 999df4f
Show file tree
Hide file tree
Showing 69 changed files with 1,456 additions and 1,235 deletions.
4 changes: 2 additions & 2 deletions godot/AuthoredPropertyCreationScreen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func _on_AddButton_pressed():
$PropertyCreationWindow/VBC/BNumberEditPanel.current_authored_property = draft_of_new_authored_property
$PropertyCreationWindow/VBC/BNumberEditPanel.creating_new_property = true
$PropertyCreationWindow/VBC/BNumberEditPanel.refresh()
$PropertyCreationWindow.popup()
$PropertyCreationWindow.popup_centered()

func _on_PropertyCreationWindow_confirmed():
var property = $PropertyCreationWindow/VBC/BNumberEditPanel.current_authored_property
Expand Down Expand Up @@ -102,7 +102,7 @@ func _on_DeleteButton_pressed():
# new_label = Label.new()
# new_label.text = "If you want to delete these properties, please select another property to replace them with in those scripts that currently use them."
# $ConfirmPropertyDeletionWindow/VBC.add_child(new_label)
$ConfirmPropertyDeletionWindow.popup()
$ConfirmPropertyDeletionWindow.popup_centered()

func _on_ConfirmPropertyDeletionWindow_confirmed():
if (0 == authored_properties_to_delete.size()):
Expand Down
5 changes: 5 additions & 0 deletions godot/BNumberBlueprint.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func _init(in_storyworld, in_creation_index, in_id, in_property_name, in_depth =
creation_time = OS.get_unix_time()
modified_time = OS.get_unix_time()

func get_index():
if (null != storyworld):
return storyworld.authored_properties.find(self)
return -1

func get_property_name():
if ("" != property_name):
return property_name
Expand Down
5 changes: 3 additions & 2 deletions godot/BNumberEffect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func set_as_copy_of(original):
assignment_script.set_as_copy_of(original.assignment_script)
else:
success = false
cause = original.cause
return success

func remap(storyworld):
Expand Down Expand Up @@ -99,7 +100,7 @@ func load_from_json_v0_0_21_through_v0_0_29(storyworld, data_to_load):
else:
return false

func load_from_json_v0_0_34_through_v0_0_37(storyworld, data_to_load):
func load_from_json_v0_0_34_through_v0_0_38(storyworld, data_to_load):
clear()
if (data_to_load.has_all(["Set", "to"])):
if (data_to_load["Set"].has_all(["pointer_type", "character", "coefficient", "keyring"]) and "Bounded Number Pointer" == data_to_load["Set"]["pointer_type"] and TYPE_STRING == typeof(data_to_load["Set"]["character"]) and storyworld.character_directory.has(data_to_load["Set"]["character"])):
Expand All @@ -116,7 +117,7 @@ func load_from_json_v0_0_34_through_v0_0_37(storyworld, data_to_load):
output_datatype = sw_script_data_types.BNUMBER
elif (assignee.output_type == sw_script_data_types.BOOLEAN):
output_datatype = sw_script_data_types.BOOLEAN
script.load_from_json_v0_0_34_through_v0_0_37(storyworld, data_to_load["to"], output_datatype)
script.load_from_json_v0_0_34_through_v0_0_38(storyworld, data_to_load["to"], output_datatype)
assignment_script = script
if (null != assignee and assignee is BNumberPointer and null != assignment_script and assignment_script is ScriptManager):
return true
Expand Down
2 changes: 1 addition & 1 deletion godot/CharacterEditScreen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func _on_DeleteCharacter_pressed():
$ConfirmCharacterDeletion/Center/AntagonistReplacementPicker.set_item_metadata(option_index, each)
option_index += 1
$ConfirmCharacterDeletion/Center/AntagonistReplacementPicker.select(0)
$ConfirmCharacterDeletion.popup()
$ConfirmCharacterDeletion.popup_centered()
else:
print("The storyworld must have at least one character.")

Expand Down
119 changes: 119 additions & 0 deletions godot/Clipboard.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
extends Object
class_name Clipboard

var storyworld = null
#Clipboard system variables:
var clipped_copies = [] #Copies of the clipped data.
var clipped_originals = [] #References to the original objects that were clipped.
enum clipboard_task_types {NONE, CUT, COPY}
var clipboard_task = clipboard_task_types.NONE
enum clippable_item_types {OPTION, REACTION, EFFECT}

func _init():
pass

func clear():
clipped_originals.clear()
for item in clipped_copies:
item.clear()
item.call_deferred("free")
clipped_copies.clear()
clipboard_task = clipboard_task_types.NONE

func clip(items):
clear()
clipped_originals = items
for item in items:
if (item is Option):
var copy = Option.new(null, "", "")
copy.set_as_copy_of(item, false)
clipped_copies.append(copy)
elif (item is Reaction):
var copy = Reaction.new(null, "", "")
copy.set_as_copy_of(item, false)
clipped_copies.append(copy)
elif (item is BNumberEffect):
var copy = BNumberEffect.new()
copy.set_as_copy_of(item)
clipped_copies.append(copy)
elif (item is SpoolEffect):
var copy = SpoolEffect.new()
copy.set_as_copy_of(item)
clipped_copies.append(copy)

func cut(items):
clip(items)
clipboard_task = clipboard_task_types.CUT

func copy(items):
clip(items)
clipboard_task = clipboard_task_types.COPY

func log_update(encounter = null):
#If encounter == null, then the project as a whole is being updated, rather than a specific encounter, or an encounter has been added, deleted, or duplicated.
if (null != encounter):
encounter.log_update()
storyworld.log_update()
OS.set_window_title("SweepWeave - " + storyworld.storyworld_title + "*")
storyworld.project_saved = false
emit_signal("refresh_encounter_list")

func delete_clipped_originals():
if (clipped_originals.empty()):
return
for item in clipped_originals:
if (item is Option):
storyworld.delete_option_from_scripts(item)
if (null != item.encounter):
item.encounter.options.erase(item)
item.encounter.wordcount()
log_update(item.encounter)
item.clear()
item.call_deferred("free")
emit_signal("refresh_graphview")
elif (item is Reaction):
storyworld.delete_reaction_from_scripts(item)
if (null != item.option):
item.option.reactions.erase(item)
item.option.encounter.wordcount()
log_update(item.option.encounter)
item.clear()
item.call_deferred("free")
emit_signal("refresh_graphview")
elif (item is BNumberEffect):
if (null != item.cause):
item.cause.after_effects.erase(item)
log_update(item.cause.option.encounter)
item.clear()
item.call_deferred("free")
elif (item is SpoolEffect):
if (null != item.cause):
item.cause.after_effects.erase(item)
log_update(item.cause.option.encounter)
item.clear()
item.call_deferred("free")
clipped_originals.clear()

func paste():
var items_to_paste = []
if (null == storyworld or !(storyworld is Storyworld)):
#Cannot create new items without a storyworld to tie them to.
return items_to_paste
for item in clipped_copies:
if (item is Option):
var copy = storyworld.create_new_generic_option(null)
copy.set_as_copy_of(item, false)
items_to_paste.append(copy)
elif (item is Reaction):
var copy = storyworld.create_new_generic_reaction(null)
copy.set_as_copy_of(item, false)
items_to_paste.append(copy)
elif (item is BNumberEffect):
var copy = BNumberEffect.new()
copy.set_as_copy_of(item)
items_to_paste.append(copy)
elif (item is SpoolEffect):
var copy = SpoolEffect.new()
copy.set_as_copy_of(item)
items_to_paste.append(copy)
return items_to_paste
7 changes: 5 additions & 2 deletions godot/Compiler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ func get_template_from_file():
print(error_message)
return html_content

func _init(game_data, storyworld_title, storyworld_author, ifid, template = "res://custom_resources/encounter_engine.html"):
func _init(game_data, storyworld_title, storyworld_author, ifid, storyworld_debug_mode_on, template = "res://custom_resources/encounter_engine.html"):
file_to_read = template
output = get_template_from_file()
if (!storyworld_debug_mode_on):
var regex = RegEx.new()
regex.compile("\\s*console\\.log\\(.*\\);")
output = regex.sub(output, "", true)
if ("" != storyworld_title):
output = output.replacen("<title>SweepWeave Storyworld Interpreter</title>", "<title>" + storyworld_title + "</title>")
if ("" != storyworld_author):
output = output.replacen("<meta name=\"author\" content=\"Anonymous\">", "<meta name=\"author\" content=\"" + storyworld_author + "\">")
if ("" != ifid):
output = output.replacen("<meta prefix=\"ifiction: http://babel.ifarchive.org/protocol/iFiction/\" property=\"ifiction:ifid\" content=\"\">", "<meta prefix=\"ifiction: http://babel.ifarchive.org/protocol/iFiction/\" property=\"ifiction:ifid\" content=\"" + ifid + "\">")

output = output.replacen('<script type="text/javascript" src="storyworld_data.js"></script>', "<script>" + game_data.replacen("\\n", "<br>\\n") + "</script>")
21 changes: 0 additions & 21 deletions godot/Desiderata_settings.tscn

This file was deleted.

2 changes: 0 additions & 2 deletions godot/DocPageDisplay.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ size_flags_vertical = 3
scroll_horizontal_enabled = false

[node name="VBC" type="VBoxContainer" parent="Scroll"]
margin_right = 1366.0
margin_bottom = 736.0
size_flags_horizontal = 3
size_flags_vertical = 3
Loading

0 comments on commit 999df4f

Please sign in to comment.