Skip to content

Commit

Permalink
various bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Nov 27, 2023
1 parent 887babb commit 49f4e89
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
10 changes: 3 additions & 7 deletions Autoload/Slabs.gd
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,7 @@ PURPLE_PATH,
]

func is_door(slabID):
if data.has(slabID) == false:
var oMessage = Nodelist.list["oMessage"]
oMessage.quick("Door ID missing from structure")
return false

if data[slabID][BITMASK_TYPE] == BITMASK_DOOR1 or data[slabID][BITMASK_TYPE] == BITMASK_DOOR2:
return true
if data.has(slabID) == true:
if data[slabID][BITMASK_TYPE] == BITMASK_DOOR1 or data[slabID][BITMASK_TYPE] == BITMASK_DOOR2:
return true
return false
8 changes: 4 additions & 4 deletions Autoload/Things.gd
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ var DATA_OBJECT = {
049 : ["Hero Gate", null,null, preload("res://dk_images/crucials/anim0780/AnimHeroGate.res"), null, TAB_ACTION],
050 : ["Spinning Key 2", null,null, preload("res://dk_images/traps_doors/anim0811/AnimSpinningKey.res"), null, TAB_MISC],
051 : ["Armour Effect", null,null, null, null, TAB_MISC],
052 : ["Treasury Gold 1 (800)", null,null, preload("res://dk_images/valuables/gold_hoard1_tp/AnimGoldHoard1.res"), null, TAB_GOLD],
053 : ["Treasury Gold 2 (1200)", null,null, preload("res://dk_images/valuables/gold_hoard2_tp/AnimGoldHoard2.res"), null, TAB_GOLD],
054 : ["Treasury Gold 3 (1600)", null,null, preload("res://dk_images/valuables/gold_hoard3_tp/AnimGoldHoard3.res"), null, TAB_GOLD],
055 : ["Treasury Gold 4 (2000)", null,null, preload("res://dk_images/valuables/gold_hoard4_tp/AnimGoldHoard4.res"), null, TAB_GOLD],
052 : ["Treasury Gold 1 (800)", null,null, preload("res://dk_images/valuables/gold_hoard2_tp/AnimGoldHoard2.res"), null, TAB_GOLD],
053 : ["Treasury Gold 2 (1200)", null,null, preload("res://dk_images/valuables/gold_hoard3_tp/AnimGoldHoard3.res"), null, TAB_GOLD],
054 : ["Treasury Gold 3 (1600)", null,null, preload("res://dk_images/valuables/gold_hoard4_tp/AnimGoldHoard4.res"), null, TAB_GOLD],
055 : ["Treasury Gold 4 (2000)", null,null, preload("res://dk_images/valuables/gold_hoard5_tp/AnimGoldHoard5.res"), null, TAB_GOLD],
056 : ["Treasury Gold 5 (2400)", null,null, preload("res://dk_images/valuables/gold_hoard5_tp/AnimGoldHoard5.res"), null, TAB_GOLD],
057 : ["Lair: Wizard", null,null, preload("res://edited_images/lair/creature_generic/anim0126/AnimLairGeneric.res"), null, TAB_LAIR],
058 : ["Lair: Barbarian", null,null, preload("res://edited_images/lair/creature_generic/anim0126/AnimLairGeneric.res"), null, TAB_LAIR],
Expand Down
2 changes: 2 additions & 0 deletions Scenes/DisplaySlxNumbers.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extends Node2D
onready var oDataSlx = Nodelist.list["oDataSlx"]
onready var oSlabStyle = Nodelist.list["oSlabStyle"]
onready var oSelector = Nodelist.list["oSelector"]

var tileDrawDist = 96
var draw_grid = false
Expand All @@ -15,6 +16,7 @@ func update_grid():

func _draw():
if oSlabStyle.visible == false: return
if oSelector.mode != oSelector.MODE_TILE: return

oDataSlx.slxImgData.lock()
for x in M.xSize:
Expand Down
2 changes: 2 additions & 0 deletions Scenes/MapBrowser.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ onready var oMapBrowserTabPlay = Nodelist.list["oMapBrowserTabPlay"]
onready var oMapBrowserTabContainer = Nodelist.list["oMapBrowserTabContainer"]
onready var oRandomMapContainer = Nodelist.list["oRandomMapContainer"]
onready var oMenu = Nodelist.list["oMenu"]
onready var oInspector = Nodelist.list["oInspector"]


func _ready():
Expand All @@ -41,6 +42,7 @@ func _on_MapBrowser_about_to_show():
oDynamicMapTree.update_dynamic_tree()

oLineEditFilter.grab_focus()
oInspector.deselect()

func _on_DynamicMapTree_item_activated():
var selectedTreeItem = oDynamicMapTree.get_selected()
Expand Down
23 changes: 11 additions & 12 deletions Scenes/Selection.gd
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ func update_paint():


func construct_shape_for_placement(constructType):
if paintSlab == null: return

oEditor.mapHasBeenEdited = true
var shapePositionArray = []
match constructType:
Expand Down Expand Up @@ -215,16 +213,17 @@ func construct_shape_for_placement(constructType):
var updateNearby = some_manual_placements_dont_update_nearby()
oSlabPlacement.generate_slabs_based_on_id(shapePositionArray, updateNearby)
else:
# Slab placement
var useOwner = paintOwnership

oSlabPlacement.place_shape_of_slab_id(shapePositionArray, paintSlab, useOwner)

if oMirrorPlacementCheckBox.pressed == true:
oSlabPlacement.mirror_placement(shapePositionArray, oSlabPlacement.MIRROR_SLAB_AND_OWNER)

var updateNearby = some_manual_placements_dont_update_nearby()
oSlabPlacement.generate_slabs_based_on_id(shapePositionArray, updateNearby)
if paintSlab != null:
# Slab placement
var useOwner = paintOwnership

oSlabPlacement.place_shape_of_slab_id(shapePositionArray, paintSlab, useOwner)

if oMirrorPlacementCheckBox.pressed == true:
oSlabPlacement.mirror_placement(shapePositionArray, oSlabPlacement.MIRROR_SLAB_AND_OWNER)

var updateNearby = some_manual_placements_dont_update_nearby()
oSlabPlacement.generate_slabs_based_on_id(shapePositionArray, updateNearby)

func some_manual_placements_dont_update_nearby():
# Fake Slabs don't update the surroundings (! HAD TO COMMENT THIS OUT BECAUSE IT BREAKS CUSTOM SLABSET SLABS)
Expand Down
5 changes: 4 additions & 1 deletion Scenes/Selector.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ onready var oDataClm = Nodelist.list["oDataClm"]
onready var oDataClmPos = Nodelist.list["oDataClmPos"]
onready var oSlabSideViewer = Nodelist.list["oSlabSideViewer"]
onready var oAddCustomSlabWindow = Nodelist.list["oAddCustomSlabWindow"]
onready var oDisplaySlxNumbers = Nodelist.list["oDisplaySlxNumbers"]

onready var TILE_SIZE = Constants.TILE_SIZE
onready var SUBTILE_SIZE = Constants.SUBTILE_SIZE
Expand Down Expand Up @@ -258,7 +259,7 @@ func adjust_range(instance, property_name, increment, message_prefix):
var newRange = clamp(instance.get(property_name) + increment, 0, 32767)
instance.set(property_name, newRange)
oThingDetails.update_details()
oMessage.quick(message_prefix + str(newRange))
#oMessage.quick(message_prefix + str(newRange))
get_tree().set_input_as_handled()
var originalPosition = Vector2(instance.locationX, instance.locationY)
oInstances.mirror_adjusted_value(instance, property_name, originalPosition)
Expand Down Expand Up @@ -322,6 +323,7 @@ func change_mode(changeModeTo):
oEditingTools.switched_to_slab_mode()
oInspector.deselect()
oBrushPreview.update_img()
oDisplaySlxNumbers.update_grid()
MODE_SUBTILE:
position = cursorSubtile * SUBTILE_SIZE
$SubtileSelector.visible = true
Expand All @@ -330,6 +332,7 @@ func change_mode(changeModeTo):
oEditingTools.switched_to_thing_mode()
oEditingMode.switch_mode("Thing")
oBrushPreview.update_img()
oDisplaySlxNumbers.update_grid()

func world2tile(pos):
return Vector2(floor(pos.x/TILE_SIZE),floor(pos.y/TILE_SIZE))
Expand Down

0 comments on commit 49f4e89

Please sign in to comment.