From bfd9d3199bfcdf0cd3385e18d6021f6947391d39 Mon Sep 17 00:00:00 2001 From: rainlizard <15337628+rainlizard@users.noreply.github.com> Date: Tue, 28 May 2024 21:13:41 +1000 Subject: [PATCH] removed remnants of custom_objects.cfg, use fallback when loading objects.cfg --- Scenes/AddCustomObjectWindow.gd | 153 --------------------------- Scenes/AddCustomSlabWindow.gd | 4 + Scenes/CfgLoader.gd | 35 +++++-- Scenes/CustomObjectSystem.gd | 70 ------------- Scenes/Main.tscn | 176 +------------------------------- Scenes/Menu.gd | 4 +- Scenes/OpenMap.gd | 4 +- Scenes/PickThingWindow.gd | 7 -- Scenes/Selector.gd | 1 - Scenes/SlabsetWindow.gd | 4 +- 10 files changed, 40 insertions(+), 418 deletions(-) delete mode 100644 Scenes/AddCustomObjectWindow.gd delete mode 100644 Scenes/CustomObjectSystem.gd diff --git a/Scenes/AddCustomObjectWindow.gd b/Scenes/AddCustomObjectWindow.gd deleted file mode 100644 index 32b0daa8..00000000 --- a/Scenes/AddCustomObjectWindow.gd +++ /dev/null @@ -1,153 +0,0 @@ -extends WindowDialog -onready var oPickThingWindow = Nodelist.list["oPickThingWindow"] -onready var oNewObjectSubtypeID = Nodelist.list["oNewObjectSubtypeID"] -onready var oNewObjectName = Nodelist.list["oNewObjectName"] -onready var oNewObjectTab = Nodelist.list["oNewObjectTab"] -onready var oNewObjectType = Nodelist.list["oNewObjectType"] -onready var oMessage = Nodelist.list["oMessage"] -onready var oSelector = Nodelist.list["oSelector"] -onready var oThingTabs = Nodelist.list["oThingTabs"] -onready var oCustomObjectSystem = Nodelist.list["oCustomObjectSystem"] -onready var oWarningIdInUse = Nodelist.list["oWarningIdInUse"] - -var tab = Things.TAB_CREATURE - -func _ready(): - oWarningIdInUse.visible = false - var optionButtonIndex = 0 - for tabEnum in oPickThingWindow.tabs: - oNewObjectTab.add_item(oPickThingWindow.tabs[tabEnum][oPickThingWindow.GRIDCON_PATH].name) - oNewObjectTab.set_item_metadata(optionButtonIndex, tabEnum) - optionButtonIndex += 1 - -func _process(delta): - if visible == false: return - - var value = int(oNewObjectSubtypeID.text) - oWarningIdInUse.visible = thinglist_has_subtype(get_thingType(), value) - -func _on_AddCustomObjectButton_pressed(): - var givenName = oNewObjectName.text - - if givenName == "": - oMessage.quick("Enter a name") - return - if oNewObjectSubtypeID.text == "": - oMessage.quick("Enter an ID") - return - - var tabToPlaceIn = oNewObjectTab.get_item_metadata(oNewObjectTab.selected) - - - - Settings.unearthdata.plus_file("custom-object-images").plus_file(filename) - - oCustomObjectSystem.add_object([ - get_thingType(), # thingType - int(oNewObjectSubtypeID.text), # subtype - givenName, # Name - null, # Image - null, # Portrait - tabToPlaceIn, - ]) - - # Close window - visible = false - - # Switch to show the thing you've added - oSelector.change_mode(oSelector.MODE_SUBTILE) - - for i in oThingTabs.get_tab_count(): - if oThingTabs.get_tab_control(i) == oPickThingWindow.tabs[tabToPlaceIn][oPickThingWindow.GRIDCON_PATH]: - oThingTabs.current_tab = i - - # Clear the stuff you set - oNewObjectName.text = "" - oNewObjectSubtypeID.text = "" - -func _on_NewObjectSubtypeID_focus_exited(): - var value = int(oNewObjectSubtypeID.text) - value = clamp(value, 0, 255) # Needs to fit within a byte for saving and loading to work correctly. - oNewObjectSubtypeID.text = str(value) - - - -func _on_NewObjectType_item_selected(index): - auto_fill_subtype_field() - - -func _on_AddCustomObjectWindow_visibility_changed(): - if visible == true: - auto_fill_subtype_field() - else: - yield(get_tree(),'idle_frame') - - -func auto_fill_subtype_field(): - var theNextEmptySubtypeID = get_empty_entry_thinglist(get_thingType()) - oNewObjectSubtypeID.text = str(theNextEmptySubtypeID) - - -func get_thingType(): - match oNewObjectType.selected: - 0: return Things.TYPE.OBJECT - 1: return Things.TYPE.CREATURE - 2: return Things.TYPE.EFFECTGEN - 3: return Things.TYPE.TRAP - 4: return Things.TYPE.DOOR - -func thinglist_has_subtype(thingType, subtype): - if subtype == 0: return true # Don't allow 0 to be recognized as empty - - match thingType: - Things.TYPE.OBJECT: return Things.DATA_OBJECT.has(subtype) - Things.TYPE.CREATURE: return Things.DATA_CREATURE.has(subtype) - Things.TYPE.EFFECTGEN: return Things.DATA_EFFECTGEN.has(subtype) - Things.TYPE.TRAP: return Things.DATA_TRAP.has(subtype) - Things.TYPE.DOOR: return Things.DATA_DOOR.has(subtype) - Things.TYPE.EXTRA: return Things.DATA_EXTRA.has(subtype) - -func get_empty_entry_thinglist(thingType): - var db - match thingType: - Things.TYPE.OBJECT: db = Things.DATA_OBJECT - Things.TYPE.CREATURE: db = Things.DATA_CREATURE - Things.TYPE.EFFECTGEN: db = Things.DATA_EFFECTGEN - Things.TYPE.TRAP: db = Things.DATA_TRAP - Things.TYPE.DOOR: db = Things.DATA_DOOR - Things.TYPE.EXTRA: db = Things.DATA_EXTRA - - var i = 1 # These arrays don't start at 0 - while true: - if db.has(i) == false: - return i - i += 1 - - -func _on_CustomObjectHelpButton_pressed(): - var helptext = "" - helptext += "'Type' and 'ID' are the important fields that affect how the custom object will be read by the game. The other fields only affect how it appears within the Unearth Editor." - helptext += "\n\n" - helptext += "A quick guide on adding KeeperFX objects:" - helptext += "\n" - helptext += "1. Browse to your Dungeon Keeper directory and open the file: /fxdata/objects.cfg in a text editor." - helptext += "\n" - helptext += "2. Scroll down to [object137], this is the ID that represents the Fern. 137+ are all new KeeperFX objects." - helptext += "\n" - helptext += "3. In that case you would set the Type to 'Object' and write the ID: 137." - helptext += "\n" - helptext += "4. Fill out the other fields with whatever you like and then click Add. Remember which 'Editor tab' you've chosen." - helptext += "\n" - helptext += "5. In the Thing selection window, look for the object you've added inside the Editor tab you chose and place it on your map." - helptext += "\n" - helptext += "Keep in mind a custom object without an editor Image will appear as a diamond shape, but it will appear correctly in-game." - helptext += "\n\n" - helptext += "After adding one, right click on its portrait within the thing selection window to remove custom things from the editor." - #helptext += "\n\n" - #helptext += "For now, placing a Fake Slab on a new/different map than the one you created it on, will not carry over the exact same column data." - oMessage.big("Help",helptext) - - -func _on_CustomObjectImagesButton_pressed(): - print("This button works in stand alone but not in editor") - OS.shell_open(Settings.unearthdata.plus_file("custom-object-images")) diff --git a/Scenes/AddCustomSlabWindow.gd b/Scenes/AddCustomSlabWindow.gd index 0a33c05c..59a66303 100644 --- a/Scenes/AddCustomSlabWindow.gd +++ b/Scenes/AddCustomSlabWindow.gd @@ -1,4 +1,5 @@ extends WindowDialog +onready var oAddCustomSlabWindow = Nodelist.list["oAddCustomSlabWindow"] onready var oColumnEditorVoxelView = Nodelist.list["oColumnEditorVoxelView"] onready var oCustomSlabVoxelView = Nodelist.list["oCustomSlabVoxelView"] onready var oGridContainerCustomColumns3x3 = Nodelist.list["oGridContainerCustomColumns3x3"] @@ -138,6 +139,7 @@ func _on_SlabWibbleOptionButton_item_selected(index): oWibbleEdgesSpacing.visible = false oWibbleEdgesCheckBox.visible = false + func copy_values_from_slabset_and_index_them(): for i in 9: var srcClmIndex = oSlabsetWindow.columnSettersArray[i].get_node("CustomSpinBox").value @@ -148,6 +150,7 @@ func copy_values_from_slabset_and_index_them(): #oMessage.big("", "Columns in your map's .clm file have been found that match the columns from slabs.clm/dat. Any that weren't found were added.") + func get_column_indexes_on_tile(cursorTile): for ySubtile in 3: for xSubtile in 3: @@ -157,6 +160,7 @@ func get_column_indexes_on_tile(cursorTile): + func update_type(): oFakeCustomColumnsPanelContainer.visible = true oCustomSlabVoxelView.modulate.a = 1 diff --git a/Scenes/CfgLoader.gd b/Scenes/CfgLoader.gd index e9968b40..cfe3b74b 100644 --- a/Scenes/CfgLoader.gd +++ b/Scenes/CfgLoader.gd @@ -51,7 +51,9 @@ func start(mapPath): var file_path = cfg_dir.plus_file(file_name) if cfg_type == LOAD_CFG_CURRENT_MAP: file_path = cfg_dir + "." + file_name - + + print("CFG loader: ", file_path) + if File.new().file_exists(file_path): match file_name: "objects.cfg": @@ -95,13 +97,34 @@ func load_objects_data(path): # 10ms if id == 0: continue if id >= 136 or id in [100, 101, 102, 103, 104, 105]: # Dummy Boxes should be overwritten var objSection = objects_cfg[section] - var newName = objSection["Name"] - var animID = objSection["AnimationID"] - var newSprite = get_sprite(animID, newName) - var newGenre = objSection.get("Genre", null) - var newEditorTab = Things.GENRE_TO_TAB[newGenre] + var newName + var animID + var newSprite + var newEditorTab + var newGenre + + if Things.DATA_OBJECT.has(id) == true: # Existing values are written by other calls to load_objects_data() (can be from /fxdata/, campaign, local map, etc.) + newName = objSection.get("Name", Things.DATA_OBJECT[id][Things.NAME_ID]) + + animID = objSection.get("AnimationID") + newSprite = get_sprite(animID, newName) + if newSprite == null: newSprite = Things.DATA_OBJECT[id][Things.SPRITE] + + newGenre = objSection.get("Genre") + newEditorTab = Things.GENRE_TO_TAB.get(newGenre, Things.DATA_OBJECT[id][Things.EDITOR_TAB]) + else: + newName = objSection.get("Name", "UNDEFINED_NAME") + + animID = objSection.get("AnimationID") + newSprite = get_sprite(animID, newName) + + newGenre = objSection.get("Genre") + newEditorTab = Things.GENRE_TO_TAB.get(newGenre, Things.TAB_DECORATION) + + Things.DATA_OBJECT[id] = [newName, newSprite, newEditorTab] + var keeperfx_edited_slabs = [Slabs.GEMS] # This is to help with backwards compatibility for previous keeperfx versions that don't have these edits. func load_terrain_data(path): # 4ms var terrain_cfg = Utils.read_dkcfg_file(path) diff --git a/Scenes/CustomObjectSystem.gd b/Scenes/CustomObjectSystem.gd deleted file mode 100644 index 7066ab75..00000000 --- a/Scenes/CustomObjectSystem.gd +++ /dev/null @@ -1,70 +0,0 @@ -extends Node -onready var oPickThingWindow = Nodelist.list["oPickThingWindow"] - -var objectsFile = ConfigFile.new() - -func add_object(array): - print("Objected added: " + str(array)) - var section = 'OBJECT:' + str(array[0]) + ':' + str(array[1]) - objectsFile.set_value(section,"NAME", array[2]) - #objectsFile.set_value(section,"IMAGE", array[3]) - #objectsFile.set_value(section,"PORTRAIT", array[4]) - objectsFile.set_value(section,"TAB", array[5]) - - objectsFile.save(Settings.unearthdata.plus_file("custom_objects.cfg")) - load_file() - oPickThingWindow.initialize_thing_grid_items() - -func load_file(): - var LOAD_CUSTOM_OBJECTS_CODETIME_START = OS.get_ticks_msec() - - objectsFile.load(Settings.unearthdata.plus_file("custom_objects.cfg")) - - for sectionName in objectsFile.get_sections(): - var sectionNameArray = sectionName.split(":") - var objThingType = int(sectionNameArray[1]) - var objSubtype = int(sectionNameArray[2]) - - var objName = objectsFile.get_value(sectionName, "NAME", "") -# var objImage = objectsFile.get_value(sectionName, "IMAGE", "") -# var objPortrait = objectsFile.get_value(sectionName, "PORTRAIT", "") - var objTab = objectsFile.get_value(sectionName, "TAB", 0) - - var constructArray = [ - objName, # NAME - null, # ANIMATION_ID - null, # TEXTURE - null, # PORTRAIT - objTab, - ] - match objThingType: - Things.TYPE.OBJECT: Things.DATA_OBJECT[objSubtype] = constructArray - Things.TYPE.CREATURE: Things.DATA_CREATURE[objSubtype] = constructArray - Things.TYPE.EFFECTGEN: Things.DATA_EFFECTGEN[objSubtype] = constructArray - Things.TYPE.TRAP: Things.DATA_TRAP[objSubtype] = constructArray - Things.TYPE.DOOR: Things.DATA_DOOR[objSubtype] = constructArray - - #print(Things.DATA_OBJECT[objSubtype]) - - print('Loaded custom objects: ' + str(OS.get_ticks_msec() - LOAD_CUSTOM_OBJECTS_CODETIME_START) + 'ms') - -func remove_object(thingType, subtype): - var section = 'OBJECT:'+str(thingType)+':'+str(subtype) - if objectsFile.has_section(section) == false: return - - objectsFile.erase_section(section) - - - match thingType: - Things.TYPE.OBJECT: Things.DATA_OBJECT.erase(subtype) - Things.TYPE.CREATURE: Things.DATA_CREATURE.erase(subtype) - Things.TYPE.EFFECTGEN: Things.DATA_EFFECTGEN.erase(subtype) - Things.TYPE.TRAP: Things.DATA_TRAP.erase(subtype) - Things.TYPE.DOOR: Things.DATA_DOOR.erase(subtype) - - objectsFile.save(Settings.unearthdata.plus_file("custom_objects.cfg")) - load_file() - oPickThingWindow.set_selection(null, null) - oPickThingWindow.initialize_thing_grid_items() - - print('Removed custom object type: '+str(thingType) + ' subtype: '+ str(subtype)) diff --git a/Scenes/Main.tscn b/Scenes/Main.tscn index 1e007014..03dab168 100644 --- a/Scenes/Main.tscn +++ b/Scenes/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=191 format=2] +[gd_scene load_steps=189 format=2] [ext_resource path="res://Scenes/SlabStyle.gd" type="Script" id=1] [ext_resource path="res://Scenes/SlabPlacement.gd" type="Script" id=2] @@ -90,8 +90,6 @@ [ext_resource path="res://Scenes/EditBrushSizeValue.gd" type="Script" id=88] [ext_resource path="res://Scenes/LineEditFloat.gd" type="Script" id=89] [ext_resource path="res://Scenes/SlabNameDisplay.gd" type="Script" id=90] -[ext_resource path="res://Scenes/AddCustomObjectWindow.gd" type="Script" id=91] -[ext_resource path="res://Scenes/CustomObjectSystem.gd" type="Script" id=92] [ext_resource path="res://Scenes/SlabOwnerCheckBox.gd" type="Script" id=93] [ext_resource path="res://Scenes/Inspector.gd" type="Script" id=94] [ext_resource path="res://Shaders/cursorMat.tres" type="Material" id=95] @@ -418,9 +416,6 @@ script = ExtResource( 53 ) [node name="SaveMap" type="Node" parent="."] script = ExtResource( 31 ) -[node name="CustomObjectSystem" type="Node" parent="."] -script = ExtResource( 92 ) - [node name="CustomSlabSystem" type="Node" parent="."] script = ExtResource( 127 ) @@ -3635,169 +3630,6 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="AddCustomObjectWindow" type="WindowDialog" parent="Ui/UiSystem"] -visible = true -margin_left = 648.0 -margin_top = 687.0 -margin_right = 1010.0 -margin_bottom = 961.0 -rect_min_size = Vector2( 329, 274 ) -window_title = "Add custom object" -resizable = true -script = ExtResource( 91 ) - -[node name="MarginContainer" type="MarginContainer" parent="Ui/UiSystem/AddCustomObjectWindow"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 15.0 -margin_top = 15.0 -margin_right = -15.0 -margin_bottom = -15.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer"] -margin_right = 332.0 -margin_bottom = 248.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="HBoxContainer2" type="HBoxContainer" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer"] -margin_right = 332.0 -margin_bottom = 32.0 - -[node name="CustomObjectHelpButton" type="TextureButton" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/HBoxContainer2"] -margin_right = 32.0 -margin_bottom = 32.0 -rect_min_size = Vector2( 32, 32 ) -size_flags_horizontal = 4 -size_flags_vertical = 4 -texture_normal = ExtResource( 156 ) -texture_pressed = ExtResource( 66 ) -texture_hover = ExtResource( 128 ) -expand = true -stretch_mode = 4 - -[node name="CustomObjectImagesButton" type="Button" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/HBoxContainer2"] -margin_left = 182.0 -margin_right = 332.0 -margin_bottom = 27.0 -size_flags_horizontal = 10 -size_flags_vertical = 0 -text = "Custom images" - -[node name="Spacing" type="Control" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer"] -margin_top = 36.0 -margin_right = 332.0 -margin_bottom = 60.0 -rect_min_size = Vector2( 24, 24 ) - -[node name="WarningIdInUse" type="Label" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer"] -modulate = Color( 1, 0.28, 0.28, 1 ) -margin_top = 64.0 -margin_right = 332.0 -margin_bottom = 85.0 -text = "Warning: ID already in use by editor." -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="GridContainer" type="GridContainer" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer"] -margin_top = 89.0 -margin_right = 332.0 -margin_bottom = 217.0 -columns = 2 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label" type="Label" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_top = 3.0 -margin_right = 114.0 -margin_bottom = 24.0 -text = "Type:" - -[node name="NewObjectType" type="OptionButton" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_left = 244.0 -margin_right = 332.0 -margin_bottom = 27.0 -size_flags_horizontal = 10 -text = "Object" -items = [ "Object", null, false, 0, null, "Creature", null, false, 1, null, "Effect", null, false, 2, null, "Trap", null, false, 3, null, "Door", null, false, 4, null ] -selected = 0 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label2" type="Label" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_top = 36.0 -margin_right = 114.0 -margin_bottom = 57.0 -text = "ID:" - -[node name="NewObjectSubtypeID" type="LineEdit" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_left = 274.0 -margin_top = 31.0 -margin_right = 332.0 -margin_bottom = 62.0 -size_flags_horizontal = 10 - -[node name="Label3" type="Label" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_top = 71.0 -margin_right = 114.0 -margin_bottom = 92.0 -text = "Editor name:" -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="NewObjectName" type="LineEdit" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_left = 182.0 -margin_top = 66.0 -margin_right = 332.0 -margin_bottom = 97.0 -rect_min_size = Vector2( 150, 0 ) -size_flags_horizontal = 10 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label5" type="Label" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_top = 104.0 -margin_right = 114.0 -margin_bottom = 125.0 -text = "Editor tab:" -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="NewObjectTab" type="OptionButton" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer"] -margin_left = 303.0 -margin_top = 101.0 -margin_right = 332.0 -margin_bottom = 128.0 -size_flags_horizontal = 10 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="HBoxContainer" type="HBoxContainer" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer"] -margin_top = 221.0 -margin_right = 332.0 -margin_bottom = 248.0 -size_flags_vertical = 10 - -[node name="AddCustomObjectButton" type="Button" parent="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/HBoxContainer"] -margin_left = 142.0 -margin_right = 189.0 -margin_bottom = 27.0 -size_flags_horizontal = 6 -text = "Add" -__meta__ = { -"_edit_use_anchors_": false -} - [node name="ImageAsMapDialog" type="WindowDialog" parent="Ui/UiSystem"] visible = true margin_left = 8.0 @@ -7571,12 +7403,6 @@ script = SubResource( 20 ) [connection signal="confirmed" from="Ui/UiSystem/ConfirmGenerateScript" to="Ui/UiSystem/MapSettingsWindow/MapSettingsTabs/ScriptGenerator" method="_on_ConfirmGenerateScript_confirmed"] [connection signal="confirmed" from="Ui/UiSystem/ConfirmClmClearUnused" to="Ui/UiSystem/ColumnEditor" method="_on_ConfirmClmClearUnused_confirmed"] [connection signal="about_to_show" from="Ui/UiSystem/AboutWindow" to="Ui/UiSystem/AboutWindow" method="_on_AboutWindow_about_to_show"] -[connection signal="visibility_changed" from="Ui/UiSystem/AddCustomObjectWindow" to="Ui/UiSystem/AddCustomObjectWindow" method="_on_AddCustomObjectWindow_visibility_changed"] -[connection signal="pressed" from="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/HBoxContainer2/CustomObjectHelpButton" to="Ui/UiSystem/AddCustomObjectWindow" method="_on_CustomObjectHelpButton_pressed"] -[connection signal="pressed" from="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/HBoxContainer2/CustomObjectImagesButton" to="Ui/UiSystem/AddCustomObjectWindow" method="_on_CustomObjectImagesButton_pressed"] -[connection signal="item_selected" from="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer/NewObjectType" to="Ui/UiSystem/AddCustomObjectWindow" method="_on_NewObjectType_item_selected"] -[connection signal="focus_exited" from="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/GridContainer/NewObjectSubtypeID" to="Ui/UiSystem/AddCustomObjectWindow" method="_on_NewObjectSubtypeID_focus_exited"] -[connection signal="pressed" from="Ui/UiSystem/AddCustomObjectWindow/MarginContainer/VBoxContainer/HBoxContainer/AddCustomObjectButton" to="Ui/UiSystem/AddCustomObjectWindow" method="_on_AddCustomObjectButton_pressed"] [connection signal="visibility_changed" from="Ui/UiSystem/ImageAsMapDialog" to="Ui/UiSystem/ImageAsMapDialog" method="_on_ImageAsMapDialog_visibility_changed"] [connection signal="pressed" from="Ui/UiSystem/ImageAsMapDialog/HBoxContainer/VBoxContainer/HBoxContainer/ImgMapButtonNewMap" to="Ui/UiSystem/ImageAsMapDialog" method="_on_ImgMapButtonNewMap_pressed"] [connection signal="pressed" from="Ui/UiSystem/ImageAsMapDialog/HBoxContainer/VBoxContainer/HBoxContainer/ImgMapButtonSelectImage" to="Ui/UiSystem/ImageAsMapDialog" method="_on_ImgMapButtonSelectImage_pressed"] diff --git a/Scenes/Menu.gd b/Scenes/Menu.gd index 8dde044b..1aa06300 100644 --- a/Scenes/Menu.gd +++ b/Scenes/Menu.gd @@ -32,7 +32,6 @@ onready var oUi = Nodelist.list["oUi"] onready var oSlabsetWindow = Nodelist.list["oSlabsetWindow"] onready var oNewMapWindow = Nodelist.list["oNewMapWindow"] onready var oDataMapName = Nodelist.list["oDataMapName"] -onready var oAddCustomObjectWindow = Nodelist.list["oAddCustomObjectWindow"] onready var oCurrentFormat = Nodelist.list["oCurrentFormat"] onready var oDataLof = Nodelist.list["oDataLof"] onready var oExportPreview = Nodelist.list["oExportPreview"] @@ -223,7 +222,8 @@ func _on_EditSubmenu_Pressed(pressedID): 1: # Custom columns Utils.popup_centered(oColumnEditor) 2: # Custom objects - Utils.popup_centered(oAddCustomObjectWindow) + #Utils.popup_centered(oAddCustomObjectWindow) + pass 3: # Resize and shift Utils.popup_centered(oResizeCurrentMapSize) 4: # Update all slabs diff --git a/Scenes/OpenMap.gd b/Scenes/OpenMap.gd index be863060..13610dd8 100644 --- a/Scenes/OpenMap.gd +++ b/Scenes/OpenMap.gd @@ -36,7 +36,6 @@ onready var oNewMapWindow = Nodelist.list["oNewMapWindow"] onready var oSlabPlacement = Nodelist.list["oSlabPlacement"] onready var oDataSlx = Nodelist.list["oDataSlx"] onready var oPickThingWindow = Nodelist.list["oPickThingWindow"] -onready var oCustomObjectSystem = Nodelist.list["oCustomObjectSystem"] onready var oCurrentFormat = Nodelist.list["oCurrentFormat"] onready var oSetNewFormat = Nodelist.list["oSetNewFormat"] onready var oBuffers = Nodelist.list["oBuffers"] @@ -71,7 +70,8 @@ func start(): #for i in 200: # yield(get_tree(), "idle_frame") #oCurrentMap.clear_map() - open_map("D:/Dungeon Keeper/levels/personal/map00002.slb") + #open_map("D:/Dungeon Keeper/levels/personal/map00002.slb") + open_map("D:/Dungeon Keeper/campgns/dpthshdw/map00014.slb") pass else: # initialize a cleared map diff --git a/Scenes/PickThingWindow.gd b/Scenes/PickThingWindow.gd index b95bce49..6028fdb5 100644 --- a/Scenes/PickThingWindow.gd +++ b/Scenes/PickThingWindow.gd @@ -8,7 +8,6 @@ onready var oGridFunctions = Nodelist.list["oGridFunctions"] onready var oPropertiesWindow = Nodelist.list["oPropertiesWindow"] onready var oPlacingSettings = Nodelist.list["oPlacingSettings"] onready var oInspector = Nodelist.list["oInspector"] -onready var oCustomObjectSystem = Nodelist.list["oCustomObjectSystem"] enum { GRIDCON_PATH @@ -110,7 +109,6 @@ func add_to_category(tabNode, thingsData, thingtype, subtype): var id = scnGridItem.instance() id.img_margin = 3 id.connect('mouse_entered',oThingDetails,"_on_thing_portrait_mouse_entered",[id]) - id.connect('gui_input',self,"_on_thing_portrait_gui_input",[id]) id.set_meta("thingSubtype", subtype) id.set_meta("thingType", thingtype) @@ -300,11 +298,6 @@ func remove_all_grid_items(): for id in get_grid_container_node(tabID).get_children(): id.queue_free() -func _on_thing_portrait_gui_input(event, id): - if event.is_action_pressed("mouse_right"): - oPropertiesWindow.oPropertiesTabs.current_tab = 0 - oCustomObjectSystem.remove_object(id.get_meta("thingType"), id.get_meta("thingSubtype")) - func rect_changed_start_timer(): rectChangedTimer.start(0.2) diff --git a/Scenes/Selector.gd b/Scenes/Selector.gd index ca319809..d0289c94 100644 --- a/Scenes/Selector.gd +++ b/Scenes/Selector.gd @@ -1,5 +1,4 @@ extends Node2D -onready var oAddCustomObjectWindow = Nodelist.list["oAddCustomObjectWindow"] onready var oSelection = Nodelist.list["oSelection"] onready var oEditor = Nodelist.list["oEditor"] onready var oCurrentMap = Nodelist.list["oCurrentMap"] diff --git a/Scenes/SlabsetWindow.gd b/Scenes/SlabsetWindow.gd index 031ac711..82d468cd 100644 --- a/Scenes/SlabsetWindow.gd +++ b/Scenes/SlabsetWindow.gd @@ -1,5 +1,4 @@ extends WindowDialog -onready var oAddCustomObjectWindow = Nodelist.list["oAddCustomObjectWindow"] onready var oDkSlabsetVoxelView = Nodelist.list["oDkSlabsetVoxelView"] onready var oColumnsetVoxelView = Nodelist.list["oColumnsetVoxelView"] onready var oVariationInfoLabel = Nodelist.list["oVariationInfoLabel"] @@ -33,6 +32,7 @@ onready var oObjThingTypeLabel = Nodelist.list["oObjThingTypeLabel"] onready var oObjNameLabel = Nodelist.list["oObjNameLabel"] onready var oVarButtonsApplyToAllCheckBox = Nodelist.list["oVarButtonsApplyToAllCheckBox"] onready var oOverheadGraphics = Nodelist.list["oOverheadGraphics"] +onready var oAddCustomSlabWindow = Nodelist.list["oAddCustomSlabWindow"] var clipboard = { "dat": [], @@ -214,7 +214,7 @@ func ensure_tng_array_has_space(variation): func _on_SlabsetCopyValues_pressed(): - oAddCustomObjectWindow.copy_values_from_slabset_and_index_them() + oAddCustomSlabWindow.copy_values_from_slabset_and_index_them() visible = false oPickSlabWindow._on_pressed_add_new_custom_slab()