From 9bfc5a5a19438508ccae38759153d8dea383f8a1 Mon Sep 17 00:00:00 2001 From: rainlizard Date: Sat, 25 Nov 2023 17:05:35 +1100 Subject: [PATCH] wip custom slab system --- Autoload/Slabs.gd | 193 ++++++++++++++++------------------ Scenes/AddCustomSlabWindow.gd | 68 ++++++------ Scenes/CustomSlabSystem.gd | 104 ++++++++---------- Scenes/Instances.gd | 1 - Scenes/Main.tscn | 88 +++++++++++++--- Scenes/PickSlabWindow.gd | 29 +++-- Scenes/PlaceThingWithSlab.gd | 9 -- Scenes/Selection.gd | 2 +- Scenes/SlabDisplay.gd | 40 +++---- Scenes/SlabPlacement.gd | 20 ++-- Scenes/SlabsetWindow.gd | 2 - 11 files changed, 285 insertions(+), 271 deletions(-) diff --git a/Autoload/Slabs.gd b/Autoload/Slabs.gd index 9862c5f0..f160d85a 100644 --- a/Autoload/Slabs.gd +++ b/Autoload/Slabs.gd @@ -4,14 +4,6 @@ extends Node # DISPLAYS DECORATION STUFF ON THE SIDE -enum { - BITMASK_GENERAL - BITMASK_WALL - BITMASK_TALL - BITMASK_OTHER - BITMASK_CLAIMED -} - enum { NAME IS_SOLID # Whether units can walk there, and how fortified walls do their bitmask, AND for 3D generation optimization @@ -96,111 +88,106 @@ enum { WALL_AUTOMATIC = 999, } -var rooms = {14:null,16:null,18:null,20:null,22:null,24:null,26:null,28:null,30:null,32:null,34:null,36:null,38:null,40:null} +var rooms_that_have_walls = {14:null,16:null,18:null,20:null,22:null,24:null,26:null,28:null,30:null,32:null,34:null,36:null,38:null,40:null} var doors = {42:null,43:null,44:null,45:null,46:null,47:null,48:null,49:null} -#var walls = [ -# 4,5,6,7,8,9 -#] - -func _init(): - #var CODETIME_START = OS.get_ticks_msec() - # Fill empty entries to prevent crashes, takes 0ms - - for i in 2000: - if data.has(i) == false: - data[i] = data[-1] - #print('Codetime: ' + str(OS.get_ticks_msec() - CODETIME_START) + 'ms') - - ######################################################################## # These are just to make it easier to read -const OWNABLE = true const NOT_OWNABLE = false -const BLOCK_SLAB = true +const OWNABLE = true const FLOOR_SLAB = false +const BLOCK_SLAB = true +enum { + BITMASK_FLOOR = 0 + BITMASK_REINFORCED = 1 + BITMASK_BLOCK = 2 + BITMASK_OTHER = 3 + BITMASK_CLAIMED = 4 +} +enum { + REMEMBER_PATH = 0 + REMEMBER_LAVA = 1 + REMEMBER_WATER = 2 +} +enum { + WIBBLE_OFF = 0 + WIBBLE_ON = 1 + WIBBLE_ANIMATED = 2 +} +enum { + TAB_MAINSLAB = 0 + TAB_OTHER = 1 + TAB_CUSTOM = 2 + TAB_STYLE = 3 + TAB_OWNER = 4 + TAB_NONE = 5 +} enum { - REMEMBER_PATH - REMEMBER_LAVA - REMEMBER_WATER - - WIBBLE_OFF - WIBBLE_ON - WIBBLE_ANIMATED - - TAB_MAINSLAB - TAB_OTHER - TAB_CUSTOM - TAB_STYLE - TAB_OWNER - TAB_NONE - - PANEL_TOP_VIEW - PANEL_SIDE_VIEW - PANEL_DOOR_VIEW + PANEL_TOP_VIEW = 0 + PANEL_SIDE_VIEW = 1 + PANEL_DOOR_VIEW = 2 } ######################################################################## var data = { - -1: ["Unknown", BLOCK_SLAB, BITMASK_TALL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # -1 - ROCK: ["Impenetrable Rock", BLOCK_SLAB, BITMASK_TALL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 0 - GOLD: ["Gold Seam", BLOCK_SLAB, BITMASK_TALL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 1 - EARTH: ["Earth", BLOCK_SLAB, BITMASK_TALL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 2 - EARTH_WITH_TORCH: ["Torch Earth", BLOCK_SLAB, BITMASK_TALL, PANEL_SIDE_VIEW, 4, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 3 - WALL_WITH_BANNER: ["Banner Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 4 - WALL_WITH_TORCH: ["Torch Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 4, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 5 - WALL_WITH_TWINS: ["Twins Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 6 - WALL_WITH_WOMAN: ["Woman Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 7 - WALL_WITH_PAIR: ["Pair Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 8 - WALL_DAMAGED: ["Damaged Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 9 - PATH: ["Dirt Path", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 10 - CLAIMED_GROUND: ["Claimed Area", FLOOR_SLAB, BITMASK_CLAIMED, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 11 - LAVA: ["Lava", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_LAVA, NOT_OWNABLE], # 12 - WATER: ["Water", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_WATER, NOT_OWNABLE], # 13 - PORTAL: ["Portal", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 14 - PORTAL_WALL: ["Portal Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 15 - TREASURE_ROOM: ["Treasure Room", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 16 - TREASURE_ROOM_WALL: ["Treasure Room Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 17 - LIBRARY: ["Library", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 18 - LIBRARY_WALL: ["Library Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 19 - PRISON: ["Prison", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 20 - PRISON_WALL: ["Prison Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 21 - TORTURE_CHAMBER: ["Torture Chamber", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 22 - TORTURE_CHAMBER_WALL:["Torture Chamber Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 23 - TRAINING_ROOM: ["Training Room", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 24 - TRAINING_ROOM_WALL: ["Training Room Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 25 - DUNGEON_HEART: ["Heart Room", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 26 - DUNGEON_HEART_WALL: ["Heart Room Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 27 - WORKSHOP: ["Workshop", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 28 - WORKSHOP_WALL: ["Workshop Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 29 - SCAVENGER_ROOM: ["Scavenger Room", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 30 - SCAVENGER_ROOM_WALL: ["Scavenger Room Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 31 - TEMPLE: ["Temple", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 32 - TEMPLE_WALL: ["Temple Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 33 - GRAVEYARD: ["Graveyard", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 34 - GRAVEYARD_WALL: ["Graveyard Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 35 - HATCHERY: ["Hatchery", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 36 - HATCHERY_WALL: ["Hatchery Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 37 - LAIR: ["Lair", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 38 - LAIR_WALL: ["Lair Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 39 - BARRACKS: ["Barracks", FLOOR_SLAB, BITMASK_GENERAL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 40 - BARRACKS_WALL: ["Barracks Wall", BLOCK_SLAB, BITMASK_WALL, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 41 - WOODEN_DOOR_1: ["Wooden Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 42 - WOODEN_DOOR_2: ["Wooden Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 43 - BRACED_DOOR_1: ["Braced Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 44 - BRACED_DOOR_2: ["Braced Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 45 - IRON_DOOR_1: ["Iron Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 46 - IRON_DOOR_2: ["Iron Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 47 - MAGIC_DOOR_1: ["Magic Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 48 - MAGIC_DOOR_2: ["Magic Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 49 - SLAB_50: ["Slab 50", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 50 - BRIDGE: ["Bridge", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 51 - GEMS: ["Gems", BLOCK_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 52 - GUARD_POST: ["Guard Post", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 53 - PURPLE_PATH: ["Purple Path", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, NOT_OWNABLE], # 54 -# PURPLE_PATH2: ["Purple Path 2", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, true], # 55 -# PURPLE_PATH3: ["Purple Path 3", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, true], # 56 -# PURPLE_PATH4: ["Purple Path 4", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, true], # 57 - WALL_AUTOMATIC: ["Wall Automatic", BLOCK_SLAB, BITMASK_WALL, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, true], # 99999 + ROCK: ["Impenetrable Rock", BLOCK_SLAB, BITMASK_BLOCK, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 0 + GOLD: ["Gold Seam", BLOCK_SLAB, BITMASK_BLOCK, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 1 + EARTH: ["Earth", BLOCK_SLAB, BITMASK_BLOCK, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 2 + EARTH_WITH_TORCH: ["Torch Earth", BLOCK_SLAB, BITMASK_BLOCK, PANEL_SIDE_VIEW, 4, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 3 + WALL_WITH_BANNER: ["Banner Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 4 + WALL_WITH_TORCH: ["Torch Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 5 + WALL_WITH_TWINS: ["Twins Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 6 + WALL_WITH_WOMAN: ["Woman Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 7 + WALL_WITH_PAIR: ["Pair Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 8 + WALL_DAMAGED: ["Damaged Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 9 + PATH: ["Dirt Path", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 10 + CLAIMED_GROUND: ["Claimed Area", FLOOR_SLAB, BITMASK_CLAIMED, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 11 + LAVA: ["Lava", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_LAVA, NOT_OWNABLE], # 12 + WATER: ["Water", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ANIMATED, REMEMBER_WATER, NOT_OWNABLE], # 13 + PORTAL: ["Portal", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 14 + PORTAL_WALL: ["Portal Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 15 + TREASURE_ROOM: ["Treasure Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 16 + TREASURE_ROOM_WALL: ["Treasure Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 17 + LIBRARY: ["Library", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 18 + LIBRARY_WALL: ["Library Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 19 + PRISON: ["Prison", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 20 + PRISON_WALL: ["Prison Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 21 + TORTURE_CHAMBER: ["Torture Chamber", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 22 + TORTURE_CHAMBER_WALL:["Torture Chamber Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 4, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 23 + TRAINING_ROOM: ["Training Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 24 + TRAINING_ROOM_WALL: ["Training Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 25 + DUNGEON_HEART: ["Heart Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 26 + DUNGEON_HEART_WALL: ["Heart Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 27 + WORKSHOP: ["Workshop", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 28 + WORKSHOP_WALL: ["Workshop Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 29 + SCAVENGER_ROOM: ["Scavenger Room", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 30 + SCAVENGER_ROOM_WALL: ["Scavenger Room Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 31 + TEMPLE: ["Temple", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 32 + TEMPLE_WALL: ["Temple Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 33 + GRAVEYARD: ["Graveyard", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 34 + GRAVEYARD_WALL: ["Graveyard Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 35 + HATCHERY: ["Hatchery", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 36 + HATCHERY_WALL: ["Hatchery Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 37 + LAIR: ["Lair", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 38 + LAIR_WALL: ["Lair Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 39 + BARRACKS: ["Barracks", FLOOR_SLAB, BITMASK_FLOOR, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 40 + BARRACKS_WALL: ["Barracks Wall", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_SIDE_VIEW, 3, TAB_OTHER, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 41 + WOODEN_DOOR_1: ["Wooden Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 42 + WOODEN_DOOR_2: ["Wooden Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 43 + BRACED_DOOR_1: ["Braced Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 44 + BRACED_DOOR_2: ["Braced Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 45 + IRON_DOOR_1: ["Iron Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 46 + IRON_DOOR_2: ["Iron Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 47 + MAGIC_DOOR_1: ["Magic Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_NONE, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 48 + MAGIC_DOOR_2: ["Magic Door", FLOOR_SLAB, BITMASK_OTHER, PANEL_DOOR_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 49 + SLAB_50: ["Slab 50", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 50 + BRIDGE: ["Bridge", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 51 + GEMS: ["Gems", BLOCK_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, NOT_OWNABLE], # 52 + GUARD_POST: ["Guard Post", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 3, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 53 + PURPLE_PATH: ["Purple Path", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_OTHER, WIBBLE_OFF, REMEMBER_PATH, NOT_OWNABLE], # 54 +# PURPLE_PATH2: ["Purple Path 2", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 55 +# PURPLE_PATH3: ["Purple Path 3", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 56 +# PURPLE_PATH4: ["Purple Path 4", FLOOR_SLAB, BITMASK_OTHER, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_OFF, REMEMBER_PATH, OWNABLE], # 57 + WALL_AUTOMATIC: ["Wall Automatic", BLOCK_SLAB, BITMASK_REINFORCED, PANEL_TOP_VIEW, 0, TAB_MAINSLAB, WIBBLE_ON, REMEMBER_PATH, OWNABLE], # 99999 } var icons = { BARRACKS: preload("res://dk_images/room_64/armory_std.png"), diff --git a/Scenes/AddCustomSlabWindow.gd b/Scenes/AddCustomSlabWindow.gd index 77dcb763..ee78d3ab 100644 --- a/Scenes/AddCustomSlabWindow.gd +++ b/Scenes/AddCustomSlabWindow.gd @@ -20,6 +20,10 @@ onready var oDataClmPos = Nodelist.list["oDataClmPos"] onready var oColumnEditor = Nodelist.list["oColumnEditor"] onready var oFakeSlabCheckBox = Nodelist.list["oFakeSlabCheckBox"] onready var oFakeCustomColumnsPanelContainer = Nodelist.list["oFakeCustomColumnsPanelContainer"] +onready var oSlabBitmaskOptionButton = Nodelist.list["oSlabBitmaskOptionButton"] +onready var oSlabIsSolidOptionButton = Nodelist.list["oSlabIsSolidOptionButton"] +onready var oSlabOwnableOptionButton = Nodelist.list["oSlabOwnableOptionButton"] + var scnColumnSetter = preload('res://Scenes/ColumnSetter.tscn') var customSlabArrayOfSpinbox = [] @@ -61,53 +65,35 @@ func _on_CustomSlabID_value_changed(value): func _on_AddCustomSlabButton_pressed(): - if oFakeSlabCheckBox.pressed == true: - add_fake_slab() - else: - add_slabset_slab() - - -func add_slabset_slab(): - var newID = oCustomSlabID.value # We'll say fake slabs are ID 1000 and up - #if oCustomSlabSystem.data.has(newID) == true: - var slabName = oNewSlabName.text var recognizedAs = oCustomSlabID.value var liquidType = oSlabLiquidOptionButton.get_selected_id() - var wibbleType = oSlabWibbleOptionButton.get_selected_id() #Slabs.WIBBLE_ON + var wibbleType = oSlabWibbleOptionButton.get_selected_id() var wibbleEdges = oWibbleEdgesCheckBox.pressed - oCustomSlabSystem.add_custom_slab(newID, slabName, recognizedAs, liquidType, wibbleType, wibbleEdges, [], []) - - oPickSlabWindow.add_slabs() - oSlabTabs.current_tab = Slabs.TAB_CUSTOM - oPickSlabWindow.set_selection(newID) - - -func add_fake_slab(): - var newID = 1000 # We'll say fake slabs are ID 1000 and up - while true: # Find an unused ID within the fake data dictionary - if oCustomSlabSystem.data.has(newID) == false: - break - else: + var is_fake = oFakeSlabCheckBox.pressed + var newID + if is_fake: + newID = 1000 # We'll say fake slabs are ID 1000 and up + # Find an unused ID within the fake data dictionary + while oCustomSlabSystem.data.has(newID): newID += 1 - - var slabName = oNewSlabName.text - var recognizedAs = oCustomSlabID.value - var liquidType = oSlabLiquidOptionButton.get_selected_id() - var wibbleType = oSlabWibbleOptionButton.get_selected_id() #Slabs.WIBBLE_ON - var wibbleEdges = oWibbleEdgesCheckBox.pressed + else: + newID = recognizedAs # For slabset, use the value from the UI + if oCustomSlabSystem.data.has(newID): + oMessage.big("Error", "For Slabset slabs you must use a unique ID. You may need to first delete the existing one.") + return var slabCubeData = [] var slabFloorData = [] - for id in oGridContainerCustomColumns3x3.get_children(): - var spinbox = id.get_node("CustomSpinBox") - var clmIndex = spinbox.value - slabCubeData.append(oDataClm.cubes[clmIndex]) - slabFloorData.append(oDataClm.floorTexture[clmIndex]) + if is_fake: # For fake slabs, gather cube and floor data from the UI elements + for id in oGridContainerCustomColumns3x3.get_children(): + var spinbox = id.get_node("CustomSpinBox") + var clmIndex = spinbox.value + slabCubeData.append(oDataClm.cubes[clmIndex]) + slabFloorData.append(oDataClm.floorTexture[clmIndex]) oCustomSlabSystem.add_custom_slab(newID, slabName, recognizedAs, liquidType, wibbleType, wibbleEdges, slabCubeData, slabFloorData) - oPickSlabWindow.add_slabs() oSlabTabs.current_tab = Slabs.TAB_CUSTOM oPickSlabWindow.set_selection(newID) @@ -174,3 +160,13 @@ func _on_HelpCustomSlabsButton_pressed(): var helptext = "" helptext += "After adding a custom slab, right click on its portrait within the slab selection window to remove it from the editor." oMessage.big("Help",helptext) + + +func _on_SlabIsSolidOptionButton_item_selected(index): + pass # Replace with function body. + +func _on_SlabOwnableOptionButton_item_selected(index): + pass # Replace with function body. + +func _on_SlabBitmaskOptionButton_item_selected(index): + pass # Replace with function body. diff --git a/Scenes/CustomSlabSystem.gd b/Scenes/CustomSlabSystem.gd index a1b2c6bb..62f40433 100644 --- a/Scenes/CustomSlabSystem.gd +++ b/Scenes/CustomSlabSystem.gd @@ -3,16 +3,8 @@ onready var oDataClm = Nodelist.list["oDataClm"] onready var oPickSlabWindow = Nodelist.list["oPickSlabWindow"] onready var oMessage = Nodelist.list["oMessage"] -var data = {} var cfg = ConfigFile.new() -enum { - RECOGNIZED_AS - WIBBLE_EDGES - CUBE_DATA - FLOOR_DATA -} - func _ready(): load_file() @@ -32,75 +24,71 @@ func load_file(): return for section in cfg.get_sections(): - var newID = int(section.trim_prefix("slab")) - var slabName = cfg.get_value(section, "name") - var recognizedAs = cfg.get_value(section, "recognized_as") - var liquidType = cfg.get_value(section, "liquid_type") - var wibbleType = cfg.get_value(section, "wibble_type") - var wibbleEdges = cfg.get_value(section, "wibble_edges") - var slabCubeData = [] var slabFloorData = [] for i in 9: slabCubeData.append( cfg.get_value(section, "cubes"+str(i), [])) slabFloorData.append( cfg.get_value(section, "floor"+str(i), [])) - add_custom_slab(newID, slabName, recognizedAs, liquidType, wibbleType, wibbleEdges, slabCubeData, slabFloorData) + var slab_dict = { + "header_id": int(section.trim_prefix("slab")), + "name": cfg.get_value(section, "name", "Unknown"), + "recognized_as": cfg.get_value(section, "recognized_as", Slabs.ROCK), + "liquid_type": cfg.get_value(section, "liquid_type", Slabs.REMEMBER_PATH), + "wibble_type": cfg.get_value(section, "wibble_type", Slabs.WIBBLE_ON), + "wibble_edges": cfg.get_value(section, "wibble_edges", false), + "cube_data": slabCubeData, + "floor_data": slabFloorData, + "bitmask": cfg.get_value(section, "bitmask", Slabs.BITMASK_FLOOR), + "is_solid": cfg.get_value(section, "is_solid", Slabs.FLOOR_SLAB), + "ownable": cfg.get_value(section, "ownable", Slabs.OWNABLE) + } + + add_custom_slab(slab_dict) -func add_custom_slab(newID, slabName, recognizedAs, liquidType, wibbleType, wibbleEdges, slabCubeData, slabFloorData): - - Slabs.data[newID] = [ - slabName, - Slabs.BLOCK_SLAB, - Slabs.BITMASK_TALL, +func add_custom_slab(slab_dict): + #var newID = slab_dict.id + #var section = 'slab'+str(newID) + Slabs.data[slab_dict.header_id] = [ + slab_dict.name, + slab_dict.is_solid, + slab_dict.bitmask, Slabs.PANEL_TOP_VIEW, - 0, + 0, # SIDE_VIEW_Z_OFFSET Slabs.TAB_CUSTOM, - wibbleType, - liquidType, - Slabs.NOT_OWNABLE + slab_dict.wibble_type, + slab_dict.liquid_type, + slab_dict.ownable ] - - data[newID] = [recognizedAs, wibbleEdges, slabCubeData, slabFloorData] - var section = 'slab'+str(newID) - cfg.set_value(section,"name", slabName) - cfg.set_value(section,"recognized_as",int(recognizedAs)) - cfg.set_value(section,"liquid_type", liquidType) - cfg.set_value(section,"wibble_type", wibbleType) - cfg.set_value(section,"wibble_edges", wibbleEdges) + var section = 'slab'+str(slab_dict.header_id) + cfg.set_value(section,"name", slab_dict.name) + cfg.set_value(section,"recognized_as", slab_dict.recognized_as) + cfg.set_value(section,"liquid_type", slab_dict.liquid_type) + cfg.set_value(section,"wibble_type", slab_dict.wibble_type) + cfg.set_value(section,"wibble_edges", slab_dict.wibble_edges) + cfg.set_value(section,"bitmask", slab_dict.bitmask) + cfg.set_value(section,"is_solid", slab_dict.is_solid) + cfg.set_value(section,"ownable", slab_dict.ownable) for i in 9: - if slabCubeData.size() > 0: - cfg.set_value(section,"cubes"+str(i),slabCubeData[i]) - if slabFloorData.size() > 0: - cfg.set_value(section,"floor"+str(i),slabFloorData[i]) + if slab_dict.cube_data.size() > 0: + cfg.set_value(section,"cubes"+str(i),slab_dict.cube_data[i]) + if slab_dict.floor_data.size() > 0: + cfg.set_value(section,"floor"+str(i),slab_dict.floor_data[i]) cfg.save(Settings.unearthdata.plus_file("custom_slabs.cfg")) - -# The purpose of this function is so I don't have to index the columns into clm for simply displaying within the slab window. Only index when PLACING the Fake Slab. -func get_top_cube_face(indexIn3x3, slabID): - var cubesArray = data[slabID][CUBE_DATA][indexIn3x3] - var get_height = oDataClm.get_real_height(cubesArray) - if get_height == 0: - return data[slabID][FLOOR_DATA][indexIn3x3] - else: - var cubeID = cubesArray[get_height-1] - if cubeID > Cube.CUBES_COUNT: - return 1 - return Cube.tex[cubeID][Cube.SIDE_TOP] - -func remove_custom_slab(slabID): - if slabID < 1000: return # means it's not a Fake Slab - - print('Attempting to remove Custom Slab:' + str(slabID)) +func remove_custom_slab(header_id): oPickSlabWindow.set_selection(null) - if data.has(slabID): - data.erase(slabID) + var statusOfRemoval = Slabs.data.erase(header_id) + if statusOfRemoval == true: + oMessage.quick("Removed custom slab") + else: + oMessage.quick("Tried to remove a custom slab that wasn't present in the data") - var section = 'slab'+str(slabID) + var section = 'slab'+str(header_id) if cfg.has_section(section): cfg.erase_section(section) diff --git a/Scenes/Instances.gd b/Scenes/Instances.gd index 8533a729..ef368a09 100644 --- a/Scenes/Instances.gd +++ b/Scenes/Instances.gd @@ -505,7 +505,6 @@ func on_slab_delete_stray_door_thing_and_key(id, slabID): if id.is_in_group("Door") or id.is_in_group("Key"): if Slabs.doors.has(slabID) == false: id.queue_free() - func on_slab_set_gold_owner_to_slab_owner(id, slabID, ownership): if slabID == Slabs.TREASURE_ROOM and id.thingType == Things.TYPE.OBJECT and id.subtype in [52,53,54,55,56,3,6,43,136]: diff --git a/Scenes/Main.tscn b/Scenes/Main.tscn index bda7449a..8cb854ec 100644 --- a/Scenes/Main.tscn +++ b/Scenes/Main.tscn @@ -5130,19 +5130,19 @@ stretch_mode = 4 [node name="PanelContainer" type="PanelContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2"] margin_top = 90.0 margin_right = 347.0 -margin_bottom = 261.0 +margin_bottom = 354.0 size_flags_horizontal = 3 [node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer"] margin_left = 9.0 margin_top = 9.0 margin_right = 338.0 -margin_bottom = 162.0 +margin_bottom = 255.0 size_flags_horizontal = 3 [node name="GridContainer" type="GridContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer"] margin_right = 329.0 -margin_bottom = 153.0 +margin_bottom = 246.0 size_flags_horizontal = 3 columns = 2 __meta__ = { @@ -5226,8 +5226,8 @@ margin_bottom = 122.0 rect_min_size = Vector2( 150, 0 ) hint_tooltip = "If a bridge is placed on this slab, this indicates what's underneath the bridge." size_flags_horizontal = 10 -text = "0 : No" -items = [ "0 : No", null, false, 0, null, "1 : Lava", null, false, 1, null, "2 : Water", null, false, 2, null ] +text = "No" +items = [ "No", null, false, 0, null, "Lava", null, false, 1, null, "Water", null, false, 2, null ] selected = 0 [node name="Label" type="Label" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] @@ -5248,15 +5248,36 @@ margin_bottom = 153.0 rect_min_size = Vector2( 150, 0 ) hint_tooltip = "Sets whether the slab will have a clean appearance, a deformed appearance, or a wavy appearance." size_flags_horizontal = 10 -text = "1 : On" -items = [ "0 : Off", null, false, 0, null, "1 : On", null, false, 1, null, "2 : Animated", null, false, 2, null ] +text = "On" +items = [ "Off", null, false, 0, null, "On", null, false, 1, null, "Animated", null, false, 2, null ] selected = 1 +[node name="Label5" type="Label" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] +margin_top = 160.0 +margin_right = 175.0 +margin_bottom = 181.0 +text = "Bitmask" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="SlabBitmaskOptionButton" type="OptionButton" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] +margin_left = 179.0 +margin_top = 157.0 +margin_right = 329.0 +margin_bottom = 184.0 +rect_min_size = Vector2( 150, 0 ) +hint_tooltip = "Editor placement rules" +size_flags_horizontal = 10 +text = "Floor" +items = [ "Floor", null, false, 0, null, "Reinforced", null, false, 1, null, "Block", null, false, 2, null, "Other", null, false, 3, null, "Claimed", null, false, 4, null ] +selected = 0 + [node name="WibbleEdgesSpacing" type="Control" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] visible = false -margin_top = 157.0 -margin_right = 128.0 -margin_bottom = 186.0 +margin_top = 188.0 +margin_right = 175.0 +margin_bottom = 209.0 __meta__ = { "_edit_use_anchors_": false } @@ -5272,10 +5293,46 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="Label6" type="Label" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] +margin_top = 191.0 +margin_right = 175.0 +margin_bottom = 212.0 +text = "Type" + +[node name="SlabIsSolidOptionButton" type="OptionButton" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] +margin_left = 179.0 +margin_top = 188.0 +margin_right = 329.0 +margin_bottom = 215.0 +rect_min_size = Vector2( 150, 0 ) +hint_tooltip = "Editor placement rules" +size_flags_horizontal = 10 +text = "Block" +items = [ "Floor", null, false, 0, null, "Block", null, false, 1, null ] +selected = 1 + +[node name="Label7" type="Label" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] +margin_top = 222.0 +margin_right = 175.0 +margin_bottom = 243.0 +text = "Ownable" + +[node name="SlabOwnableOptionButton" type="OptionButton" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"] +margin_left = 179.0 +margin_top = 219.0 +margin_right = 329.0 +margin_bottom = 246.0 +rect_min_size = Vector2( 150, 0 ) +hint_tooltip = "Editor placement rules" +size_flags_horizontal = 10 +text = "Yes" +items = [ "Yes", null, false, 0, null, "No", null, false, 1, null ] +selected = 0 + [node name="FakeCustomColumnsPanelContainer" type="PanelContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2"] -margin_top = 265.0 +margin_top = 358.0 margin_right = 347.0 -margin_bottom = 308.0 +margin_bottom = 401.0 [node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/FakeCustomColumnsPanelContainer"] margin_left = 9.0 @@ -5301,9 +5358,9 @@ size_flags_vertical = 4 columns = 3 [node name="PanelContainer3" type="PanelContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2"] -margin_top = 312.0 +margin_top = 405.0 margin_right = 347.0 -margin_bottom = 362.0 +margin_bottom = 455.0 [node name="AddCustomSlabButton" type="Button" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer3"] margin_left = 150.0 @@ -7041,6 +7098,9 @@ script = SubResource( 20 ) [connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer/FakeSlabHelpButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_FakeSlabHelpButton_pressed"] [connection signal="value_changed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/CustomSlabID" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_CustomSlabID_value_changed"] [connection signal="item_selected" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/SlabWibbleOptionButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabWibbleOptionButton_item_selected"] +[connection signal="item_selected" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/SlabBitmaskOptionButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabBitmaskOptionButton_item_selected"] +[connection signal="item_selected" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/SlabIsSolidOptionButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabIsSolidOptionButton_item_selected"] +[connection signal="item_selected" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/SlabOwnableOptionButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabOwnableOptionButton_item_selected"] [connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer3/AddCustomSlabButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_AddCustomSlabButton_pressed"] [connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer3/HelpCustomSlabsButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_HelpCustomSlabsButton_pressed"] [connection signal="visibility_changed" from="Ui/UiSystem/SlabsetWindow" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetWindow_visibility_changed"] diff --git a/Scenes/PickSlabWindow.gd b/Scenes/PickSlabWindow.gd index 2690cecd..123ad0b7 100644 --- a/Scenes/PickSlabWindow.gd +++ b/Scenes/PickSlabWindow.gd @@ -78,7 +78,11 @@ func add_slabs(): var allSlabIDs = [] allSlabIDs.append_array(Slabs.slabOrder) - allSlabIDs.append_array(oCustomSlabSystem.data.keys()) + + # The rest of them are added in any order (custom slabs) + for slabID in Slabs.data.keys(): + if Slabs.slabOrder.has(slabID) == false: + allSlabIDs.append(slabID) for slabID in allSlabIDs: var putIntoTab = Slabs.data[slabID][Slabs.EDITOR_TAB] @@ -226,20 +230,27 @@ func _on_SlabTabs_tab_changed(tab): # When you change to or from tab 2, need to update grid to hide or show numbers oDisplaySlxNumbers.update_grid() -func _on_slab_portrait_gui_input(event, id): - if event.is_action_pressed("mouse_right"): - var slabID = id.get_meta("ID_of_slab") - if slabID >= 1000: - Utils.popup_centered(oConfirmDeleteCustomSlab) - oConfirmDeleteCustomSlab.set_meta("ID_TO_DELETE", slabID) - _on_hovered_none() func rect_changed_start_timer(): rectChangedTimer.start(0.2) + + +func _on_slab_portrait_gui_input(event, id): + # Attempt to remove custom slab by right clicking on it + if event.is_action_pressed("mouse_right"): + var oGridContainer = current_grid_container() + if oGridContainer != tabs[Slabs.TAB_CUSTOM][GRIDCON_PATH]: + return + Utils.popup_centered(oConfirmDeleteCustomSlab) + var slabID = id.get_meta("ID_of_slab") + oConfirmDeleteCustomSlab.set_meta("ID_TO_DELETE", slabID) + _on_hovered_none() + func _on_ConfirmDeleteCustomSlab_confirmed(): var slabID = oConfirmDeleteCustomSlab.get_meta("ID_TO_DELETE") - for child in tabs[Slabs.TAB_CUSTOM][GRIDCON_PATH].get_children(): + var gridContainer = tabs[Slabs.TAB_CUSTOM][GRIDCON_PATH] + for child in gridContainer.get_children(): if child.has_meta("ID_of_slab") and child.get_meta("ID_of_slab") == slabID: child.queue_free() oCustomSlabSystem.remove_custom_slab(slabID) diff --git a/Scenes/PlaceThingWithSlab.gd b/Scenes/PlaceThingWithSlab.gd index f1aab1d3..87cbad2f 100644 --- a/Scenes/PlaceThingWithSlab.gd +++ b/Scenes/PlaceThingWithSlab.gd @@ -37,15 +37,6 @@ func place_slab_objects(xSlab, ySlab, slabID, ownership, clmIndexGroup, bitmask, var createAtPos = Vector3(xSubtile, ySubtile, zSubtile) oInstances.place_new_thing(Things.TYPE.EFFECTGEN, 1, createAtPos, ownership) -# var constructedSlab = oSlabPlacement.bitmaskToSlab[bitmask] -# if bitmask == 0 and Slabs.rooms_with_middle_object.has(slabID): -# var isMiddle = determine_if_middle(slabID, ownership, bitmask, surrID, surrOwner) -# if isMiddle == false: -# constructedSlab = oSlabPlacement.slab_solo - #print(slabVar + constructedSlab[0]) - #print(slabVar) - - # HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! for i in range(9): # iterate over the range of 0-8, assuming 9 subtiles per variation var variation = int(clmIndexGroup[i] / 9) # Convert to int for safety, as division of ints in GDScript results in float var convertedSubtile = clmIndexGroup[i] % 9 diff --git a/Scenes/Selection.gd b/Scenes/Selection.gd index f354ce2f..a0fa7e85 100644 --- a/Scenes/Selection.gd +++ b/Scenes/Selection.gd @@ -107,7 +107,7 @@ func update_paint(): oOnlyOwnership.select_appropriate_button() else: if Slabs.data.has(cursorOverSlab) == true and cursorOverSlab < 1000: - if Slabs.data[cursorOverSlab][Slabs.BITMASK_TYPE] == Slabs.BITMASK_WALL: + if Slabs.data[cursorOverSlab][Slabs.BITMASK_TYPE] == Slabs.BITMASK_REINFORCED: # When you right click on a wall, select "Wall (Automatic)" cursorOverSlab = Slabs.WALL_AUTOMATIC if cursorOverSlab == Slabs.EARTH_WITH_TORCH: diff --git a/Scenes/SlabDisplay.gd b/Scenes/SlabDisplay.gd index 28ee38c8..ff6a86d4 100644 --- a/Scenes/SlabDisplay.gd +++ b/Scenes/SlabDisplay.gd @@ -35,34 +35,18 @@ func set_visual(columnArray): dataImage.lock() if panelView == Slabs.PANEL_TOP_VIEW: - if slabID < 1000: - for y in 3: - for x in 3: - var clmIndex = columnArray[(y*3) + x] - var cubeFace = Columnset.get_top_cube_face(clmIndex, slabID) - var valueInput = cubeFace - var r = clamp(valueInput, 0, 255) - valueInput -= 255 - var g = clamp(valueInput, 0, 255) - valueInput -= 255 - var b = clamp(valueInput, 0, 255) - dataImage.set_pixel(x, y, Color8(r,g,b)) - else: - var oCustomSlabSystem = Nodelist.list["oCustomSlabSystem"] - for y in 3: - for x in 3: - var cubeFace = 0 - if oCustomSlabSystem.data.has(slabID): - var indexIn3x3 = (y*3) + x - cubeFace = oCustomSlabSystem.get_top_cube_face(indexIn3x3, slabID) - - var valueInput = cubeFace - var r = clamp(valueInput, 0, 255) - valueInput -= 255 - var g = clamp(valueInput, 0, 255) - valueInput -= 255 - var b = clamp(valueInput, 0, 255) - dataImage.set_pixel(x, y, Color8(r,g,b)) + for y in 3: + for x in 3: + var clmIndex = columnArray[(y*3) + x] + var cubeFace = Columnset.get_top_cube_face(clmIndex, slabID) + + var valueInput = cubeFace + var r = clamp(valueInput, 0, 255) + valueInput -= 255 + var g = clamp(valueInput, 0, 255) + valueInput -= 255 + var b = clamp(valueInput, 0, 255) + dataImage.set_pixel(x, y, Color8(r,g,b)) if panelView == Slabs.PANEL_SIDE_VIEW or panelView == Slabs.PANEL_DOOR_VIEW: var y = 2 diff --git a/Scenes/SlabPlacement.gd b/Scenes/SlabPlacement.gd index 2cb48f66..4c1fdea0 100644 --- a/Scenes/SlabPlacement.gd +++ b/Scenes/SlabPlacement.gd @@ -165,7 +165,7 @@ func place_shape_of_slab_id(shapePositionArray, slabID, ownership): var surroundingPositions = {} var removeFromShape = [] - var CODETIME_START = OS.get_ticks_msec() + #var CODETIME_START = OS.get_ticks_msec() for pos in shapePositionArray: oDataOwnership.set_cellv(pos, ownership) @@ -243,7 +243,7 @@ onready var oLoadingBar = Nodelist.list["oLoadingBar"] func generate_slabs_based_on_id(shapePositionArray, updateNearby): oOverheadOwnership.update_ownership_image_based_on_shape(shapePositionArray) - var CODETIME_START = OS.get_ticks_msec() + #var CODETIME_START = OS.get_ticks_msec() oEditor.mapHasBeenEdited = true if updateNearby == true: @@ -350,7 +350,7 @@ func do_slab(xSlab, ySlab, slabID, ownership): var bitmaskType = Slabs.data[slabID][Slabs.BITMASK_TYPE] match bitmaskType: - Slabs.BITMASK_WALL: + Slabs.BITMASK_REINFORCED: place_fortified_wall(xSlab, ySlab, slabID, ownership, surrID, surrOwner, bitmaskType) Slabs.BITMASK_OTHER: place_other(xSlab, ySlab, slabID, ownership, surrID, surrOwner, bitmaskType) @@ -479,9 +479,9 @@ func place_general(xSlab, ySlab, slabID, ownership, surrID, surrOwner, bitmaskTy var bitmask match bitmaskType: - Slabs.BITMASK_GENERAL: bitmask = get_general_bitmask(slabID, ownership, surrID, surrOwner) + Slabs.BITMASK_FLOOR: bitmask = get_general_bitmask(slabID, ownership, surrID, surrOwner) Slabs.BITMASK_CLAIMED: bitmask = get_claimed_bitmask(slabID, ownership, surrID, surrOwner) - Slabs.BITMASK_TALL: bitmask = get_tall_bitmask(surrID) + Slabs.BITMASK_BLOCK: bitmask = get_tall_bitmask(surrID) var clmIndexGroup = make_slab(fullVariationIndex, bitmask) clmIndexGroup = modify_for_liquid(clmIndexGroup, surrID, slabID) @@ -627,7 +627,7 @@ func randomize_columns(fullSlabData, slabID, bitmaskType): var slabCubes = fullSlabData[0] var slabFloor = fullSlabData[1] - if bitmaskType == Slabs.BITMASK_WALL: + if bitmaskType == Slabs.BITMASK_REINFORCED: for i in 9: if slabCubes[i][0] in rngEarthPathUnderneath: slabCubes[i][0] = 25 # No need to randomize the path cube, it's not visible and the game overwrites it anyway. @@ -906,7 +906,7 @@ func modify_wall_based_on_nearby_room_and_liquid(clmIndexGroup, surrID, slabID): var modify0 = 0; var modify1 = 0; var modify2 = 0; var modify3 = 0; var modify4 = 0; var modify5 = 0; var modify6 = 0; var modify7 = 0; var modify8 = 0 - if Slabs.rooms.has(surrID[dir.s]): + if Slabs.rooms_that_have_walls.has(surrID[dir.s]): var roomFace = surrID[dir.s] + 1 var offset = ((roomFace-slabID)*28)*9 if surrID[dir.se] == surrID[dir.s] and surrID[dir.sw] == surrID[dir.s]: @@ -915,7 +915,7 @@ func modify_wall_based_on_nearby_room_and_liquid(clmIndexGroup, surrID, slabID): modify7 = offset modify8 = offset - if Slabs.rooms.has(surrID[dir.w]): + if Slabs.rooms_that_have_walls.has(surrID[dir.w]): var roomFace = surrID[dir.w] + 1 var offset = ((roomFace-slabID)*28)*9 if surrID[dir.sw] == surrID[dir.w] and surrID[dir.nw] == surrID[dir.w]: @@ -923,7 +923,7 @@ func modify_wall_based_on_nearby_room_and_liquid(clmIndexGroup, surrID, slabID): modify0 = offset modify3 = offset modify6 = offset - if Slabs.rooms.has(surrID[dir.n]): + if Slabs.rooms_that_have_walls.has(surrID[dir.n]): var roomFace = surrID[dir.n] + 1 var offset = ((roomFace-slabID)*28)*9 if surrID[dir.ne] == surrID[dir.n] and surrID[dir.nw] == surrID[dir.n]: @@ -931,7 +931,7 @@ func modify_wall_based_on_nearby_room_and_liquid(clmIndexGroup, surrID, slabID): modify0 = offset modify1 = offset modify2 = offset - if Slabs.rooms.has(surrID[dir.e]): + if Slabs.rooms_that_have_walls.has(surrID[dir.e]): var roomFace = surrID[dir.e] + 1 var offset = ((roomFace-slabID)*28)*9 if surrID[dir.se] == surrID[dir.e] and surrID[dir.ne] == surrID[dir.e]: diff --git a/Scenes/SlabsetWindow.gd b/Scenes/SlabsetWindow.gd index 76bb1508..d369f33c 100644 --- a/Scenes/SlabsetWindow.gd +++ b/Scenes/SlabsetWindow.gd @@ -525,8 +525,6 @@ func _on_VarCopyButton_pressed(): var variation = get_current_variation() clipboard["dat"] = Slabset.dat[variation].duplicate(true) clipboard["tng"] = Slabset.tng[variation].duplicate(true) - var slabID = variation / 28 - var localVariation = variation % 28 oMessage.quick("Copied variation to clipboard") func _on_VarPasteButton_pressed():