commit 3b964510471f54ac1ab1346e7b8e2a1f0c7bce74 Author: Haze Weathers Date: Wed Aug 6 10:26:28 2025 -0600 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..2a27bf0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Haze Weathers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/addons/walkabout/LICENSE.txt b/addons/walkabout/LICENSE.txt new file mode 120000 index 0000000..1ef648f --- /dev/null +++ b/addons/walkabout/LICENSE.txt @@ -0,0 +1 @@ +../../LICENSE.txt \ No newline at end of file diff --git a/addons/walkabout/basic_interactable.gd b/addons/walkabout/basic_interactable.gd new file mode 100644 index 0000000..7ced6a1 --- /dev/null +++ b/addons/walkabout/basic_interactable.gd @@ -0,0 +1,22 @@ +@tool +class_name WBBasicInteractive +extends StaticBody2D +## Collision object that emits a signal when interacted with by a player character. + + +## Emitted when a player character interacts with this object. +signal interacted() + + +func _init() -> void: + for child in get_children(): + if child is CollisionShape2D or child is CollisionPolygon2D: + return + var col_shape := CollisionShape2D.new() + col_shape.shape = RectangleShape2D.new() + col_shape.shape.size = Vector2(8.0, 8.0) + add_child(col_shape) + + +func interact() -> void: + interacted.emit() diff --git a/addons/walkabout/basic_interactable.gd.uid b/addons/walkabout/basic_interactable.gd.uid new file mode 100644 index 0000000..8d6f95b --- /dev/null +++ b/addons/walkabout/basic_interactable.gd.uid @@ -0,0 +1 @@ +uid://dkj06ucsoypda diff --git a/addons/walkabout/characters/character.gd b/addons/walkabout/characters/character.gd new file mode 100644 index 0000000..1c94ff7 --- /dev/null +++ b/addons/walkabout/characters/character.gd @@ -0,0 +1,174 @@ +@tool +@icon("character.svg") +class_name WBCharacter +extends CharacterBody2D +## A character that can be controlled by events and behaviors and moves on a grid. + + +## Emitted when the character begins moving. +signal move_started() +## Emitted when the character reaches its target position. +signal move_finished() + + +enum Dir {LEFT, RIGHT, UP, DOWN} + + +const DIR_VECTORS: Dictionary[Dir, Vector2] = { + Dir.LEFT: Vector2.LEFT, + Dir.RIGHT: Vector2.RIGHT, + Dir.UP: Vector2.UP, + Dir.DOWN: Vector2.DOWN, +} + + +const DIR_ANIM_SUFFIXES: Dictionary[Dir, StringName] = { + Dir.LEFT: &"_left", + Dir.RIGHT: &"_right", + Dir.UP: &"_up", + Dir.DOWN: &"_down", +} + + +## Size of the grid the character is restricted to. +@export var tile_size: float = 16.0 +## Speed the character walks at. +@export var walk_speed: float = 4.0 +## Speed the character runs at. +@export var run_speed: float = 8.0 + +## Direction the character is facing. +@export var facing: Dir = Dir.DOWN + +## Animation library for the character. [br] +## At a minimum, the [code]idle_*[/code] animations are required. [br] +## The following animations are used by default behavior: [br] +## [code]idle_[left,right,up,down][/code] [br] +## [code]walk_[left,right,up,down][/code] [br] +## [code]run_[left,right,up,down][/code] [br] +## [code]run_*[/code] will fallback to [code]walk_*[/code], +## which will fallback to [code]idle_*[/code]. [br] +## Addition custom animations may be provided to play on demand. +@export var animations: SpriteFrames: + set(value): + animations = value + sprite.sprite_frames = animations + +## Texture drawing offset of the animated sprite. +@export var sprite_offset: Vector2 = Vector2.ZERO: + set(value): + sprite_offset = value + sprite.offset = sprite_offset + + +## True when the character is moving. +var moving: bool = false +## Whether the character is running. +var running: bool = false + +## Tile position of the character on the grid. +var tile_position: Vector2i: + get(): + return pos_to_tile(global_position) + + +var sprite: AnimatedSprite2D +var _next_pos: Vector2 +var _playing_custom_animation: bool = false + + +func _init() -> void: + sprite = AnimatedSprite2D.new() + sprite.sprite_frames = animations + add_child(sprite) + + +func _ready() -> void: + global_position = closest_tile_center(global_position) + for child in get_children(): + if child is CollisionShape2D or child is CollisionPolygon2D: + return + var col_shape := CollisionShape2D.new() + col_shape.shape = RectangleShape2D.new() + col_shape.shape.size = Vector2(tile_size - 2.0, tile_size - 2.0) + add_child(col_shape) + + +func _physics_process(delta: float) -> void: + if moving: + var move_delta := (run_speed if running else walk_speed) * tile_size * delta + global_position = global_position.move_toward(_next_pos, move_delta) + if global_position == _next_pos: + moving = false + move_finished.emit() + + +func _process(delta: float) -> void: + if moving: + _playing_custom_animation = false + var anims: Array[StringName] = [ + &"walk" + DIR_ANIM_SUFFIXES[facing], + &"idle" + DIR_ANIM_SUFFIXES[facing] + ] + if running: + anims.push_front(&"run" + DIR_ANIM_SUFFIXES[facing]) + _try_animations(anims) + elif not _playing_custom_animation: + _try_animations([&"idle" + DIR_ANIM_SUFFIXES[facing]]) + + +## Makes the character move one tile in the given direction. [br] +## If [param ignore_collision] is true, the character will not perform collision checks. +func start_move(dir: Dir, ignore_collision: bool = false) -> bool: + if moving: + return false + + facing = dir + + _next_pos = global_position + DIR_VECTORS[dir] * tile_size + var col := move_and_collide(_next_pos - global_position, true) + if col and not ignore_collision: + return false + + moving = true + move_started.emit() + return true + + +## Plays a given custom animation from the animation set. [br] +## If [param reset_after] is [constant true], the animation will return to +## the default idle animation after it finishes. +func play_custom_animation(anim: StringName, reset_after: bool = false) -> void: + _try_animations([anim]) + _playing_custom_animation = true + + if reset_after and not animations.get_animation_loop(anim): + await sprite.animation_finished + _playing_custom_animation = false + +## Stops playing custom animation if one is currently playing. +func end_custom_animation() -> void: + _playing_custom_animation = false + + +## Returns the closest tile center position to a given position in global coordinates. +func closest_tile_center(pos: Vector2) -> Vector2: + var tile := pos - Vector2(tile_size, tile_size) * 0.5 + tile = tile.snappedf(tile_size) + tile += Vector2(tile_size, tile_size) * 0.5 + return tile + +## Returns the tile coordinates of a given position in global coordinates. +func pos_to_tile(pos: Vector2) -> Vector2i: + return Vector2i((global_position / Vector2(tile_size, tile_size)).floor()) + +## Returns the center position of a given tile in global coordinates. +func tile_center_pos(tile: Vector2i) -> Vector2: + return (Vector2(tile) * Vector2(tile_size, tile_size)) + (Vector2(tile_size, tile_size) * 0.5) + + +func _try_animations(anims: Array[StringName]) -> void: + for anim in anims: + if animations.has_animation(anim): + sprite.play(anim) + return diff --git a/addons/walkabout/characters/character.gd.uid b/addons/walkabout/characters/character.gd.uid new file mode 100644 index 0000000..34e6a9c --- /dev/null +++ b/addons/walkabout/characters/character.gd.uid @@ -0,0 +1 @@ +uid://dx8lxwwkyrjin diff --git a/addons/walkabout/characters/character.svg b/addons/walkabout/characters/character.svg new file mode 100644 index 0000000..fa9b56f --- /dev/null +++ b/addons/walkabout/characters/character.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + diff --git a/addons/walkabout/characters/character.svg.import b/addons/walkabout/characters/character.svg.import new file mode 100644 index 0000000..5598790 --- /dev/null +++ b/addons/walkabout/characters/character.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ufpt8ejikj1j" +path="res://.godot/imported/character.svg-492c7305b4930c6092d7995fed4891a3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/characters/character.svg" +dest_files=["res://.godot/imported/character.svg-492c7305b4930c6092d7995fed4891a3.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/characters/character_behavior.gd b/addons/walkabout/characters/character_behavior.gd new file mode 100644 index 0000000..b5fefe0 --- /dev/null +++ b/addons/walkabout/characters/character_behavior.gd @@ -0,0 +1,44 @@ +@tool +@icon("character_behavior.svg") +class_name WBCharacterBehavior +extends Node +## Controls/puppets a parent character. + + +## Whether the behavior is currently active. +@export var active: bool: + set(value): + var last_value := active + active = value + if active: + if not is_node_ready(): + await ready + for child in get_parent().get_children(): + if child != self and child is WBCharacterBehavior: + child.active = false + if active: + _activate() + else: + _deactivate() + + +## The character being controlled. +var character: WBCharacter: + get(): + return get_parent() as WBCharacter + + +## Enables the behavior. +func enable() -> void: + active = true + +## Disables the behavior. +func disable() -> void: + active = false + + +func _activate() -> void: + pass + +func _deactivate() -> void: + pass diff --git a/addons/walkabout/characters/character_behavior.gd.uid b/addons/walkabout/characters/character_behavior.gd.uid new file mode 100644 index 0000000..13ab39f --- /dev/null +++ b/addons/walkabout/characters/character_behavior.gd.uid @@ -0,0 +1 @@ +uid://cgunv5ngogsky diff --git a/addons/walkabout/characters/character_behavior.svg b/addons/walkabout/characters/character_behavior.svg new file mode 100644 index 0000000..43a3de8 --- /dev/null +++ b/addons/walkabout/characters/character_behavior.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + + diff --git a/addons/walkabout/characters/character_behavior.svg.import b/addons/walkabout/characters/character_behavior.svg.import new file mode 100644 index 0000000..6819bf9 --- /dev/null +++ b/addons/walkabout/characters/character_behavior.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://lib4e4qnml8a" +path="res://.godot/imported/character_behavior.svg-d7dbdf997daf0ba87cdd58e5db5e61e1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/characters/character_behavior.svg" +dest_files=["res://.godot/imported/character_behavior.svg-d7dbdf997daf0ba87cdd58e5db5e61e1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/characters/path_behavior.gd b/addons/walkabout/characters/path_behavior.gd new file mode 100644 index 0000000..0eaa159 --- /dev/null +++ b/addons/walkabout/characters/path_behavior.gd @@ -0,0 +1,81 @@ +@tool +@icon("path_behavior.svg") +class_name WBPathBehavior +extends WBCharacterBehavior +## A behavior that makes a character walk along a specified path, +## looping when they reach the end. + + +## List of points to walk to. +@export var points: Array[Vector2i] +## Whether the character should be running. +@export var run: bool = false + + +var _current_point: int + + +func _init() -> void: + if Engine.is_editor_hint(): + add_child(DebugView.new(self)) + + +func _activate() -> void: + _do_move() + + +func _do_move() -> void: + if not active: + return + + if character.tile_position == points[_current_point]: + _current_point = posmod(_current_point + 1, points.size()) + + var point := points[_current_point] + if character.tile_position.x < point.x: + character.start_move(WBCharacter.Dir.RIGHT) + elif character.tile_position.x > point.x: + character.start_move(WBCharacter.Dir.LEFT) + elif character.tile_position.y < point.y: + character.start_move(WBCharacter.Dir.DOWN) + elif character.tile_position.y > point.y: + character.start_move(WBCharacter.Dir.UP) + + if character.moving: + await character.move_finished + + _do_move() + + +class DebugView extends Node2D: + var behavior: WBPathBehavior + + func _init(p_behavior: WBPathBehavior) -> void: + behavior = p_behavior + + func _process(delta: float) -> void: + if Engine.get_frames_drawn() % 60 == 0: + queue_redraw() + + func _draw() -> void: + if not behavior.character: + return + + var color := Color.MEDIUM_PURPLE + var width := -1.0 + var selection := EditorInterface.get_selection() + if behavior in selection.get_selected_nodes(): + color = Color.PURPLE + width = 2.0 + + var last_point := to_local(behavior.character.closest_tile_center(behavior.character.global_position)) + for point in behavior.points + [behavior.points[0]]: + var current_point := to_local(behavior.character.tile_center_pos(point)) + draw_line(last_point, Vector2(current_point.x, last_point.y), color, width) + draw_line(Vector2(current_point.x, last_point.y), current_point, color, width) + var arrow_dir := current_point.direction_to(Vector2(current_point.x, last_point.y)) + if arrow_dir.is_zero_approx(): + arrow_dir = current_point.direction_to(last_point) + draw_line(current_point, current_point + arrow_dir.rotated(deg_to_rad(45.0)) * 8.0, color, width) + draw_line(current_point, current_point + arrow_dir.rotated(deg_to_rad(-45.0)) * 8.0, color, width) + last_point = current_point diff --git a/addons/walkabout/characters/path_behavior.gd.uid b/addons/walkabout/characters/path_behavior.gd.uid new file mode 100644 index 0000000..743f75a --- /dev/null +++ b/addons/walkabout/characters/path_behavior.gd.uid @@ -0,0 +1 @@ +uid://deanlc8wbefgm diff --git a/addons/walkabout/characters/path_behavior.svg b/addons/walkabout/characters/path_behavior.svg new file mode 100644 index 0000000..20e0a8f --- /dev/null +++ b/addons/walkabout/characters/path_behavior.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + diff --git a/addons/walkabout/characters/path_behavior.svg.import b/addons/walkabout/characters/path_behavior.svg.import new file mode 100644 index 0000000..42803d8 --- /dev/null +++ b/addons/walkabout/characters/path_behavior.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d3los038dn424" +path="res://.godot/imported/path_behavior.svg-92b1066b81b0693c0689fa68366f00d0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/characters/path_behavior.svg" +dest_files=["res://.godot/imported/path_behavior.svg-92b1066b81b0693c0689fa68366f00d0.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/characters/player_character.gd b/addons/walkabout/characters/player_character.gd new file mode 100644 index 0000000..b47f5ff --- /dev/null +++ b/addons/walkabout/characters/player_character.gd @@ -0,0 +1,98 @@ +@tool +@icon("player_character.svg") +class_name WBPlayerCharacter +extends WBCharacter +## A character controlled directly by the player. + + +## Whether the character will react to player input. +@export var controllable: bool = true +## Time to wait after turning before the character will start moving. +@export var turn_walk_time: float = 0.25 +## Collision mask for interactive objects. +## If a collision is detected, [method interact] will be called on the target object if it exists. +@export_flags_2d_physics var interact_mask: int: + set(value): + interact_mask = value + _interact_raycast.collision_mask = interact_mask + +@export_group("Input Actions", "input_") +@export var input_left: StringName = &"ui_left" +@export var input_right: StringName = &"ui_right" +@export var input_up: StringName = &"ui_up" +@export var input_down: StringName = &"ui_down" +@export var input_interact: StringName = &"ui_accept" +@export var input_run: StringName = &"ui_cancel" + + +var _interact_raycast: RayCast2D +var _turn_cooldown: float = 0.0 + + +func _init() -> void: + super._init() + + move_finished.connect(_check_move_input) + + _interact_raycast = RayCast2D.new() + _interact_raycast.enabled = false + _interact_raycast.collide_with_areas = true + _interact_raycast.hit_from_inside = true + _interact_raycast.add_exception(self) + add_child(_interact_raycast) + + +func _physics_process(delta: float) -> void: + if Engine.is_editor_hint(): + return + + _turn_cooldown -= delta + running = Input.is_action_pressed(input_run) + if not moving: + _check_move_input(true) + super._physics_process(delta) + + +## Enables player control of the character. +func enable_control() -> void: + controllable = true + +## Disables player control of the character. +func disable_control() -> void: + controllable = false + + +func _check_move_input(check_turn_cooldown: bool = false) -> void: + if not controllable: + return + + if Input.is_action_pressed(input_left): + _try_move(Dir.LEFT, check_turn_cooldown) + elif Input.is_action_pressed(input_right): + _try_move(Dir.RIGHT, check_turn_cooldown) + elif Input.is_action_pressed(input_up): + _try_move(Dir.UP, check_turn_cooldown) + elif Input.is_action_pressed(input_down): + _try_move(Dir.DOWN, check_turn_cooldown) + elif Input.is_action_just_pressed(input_interact): + _try_interact() + + +func _try_move(dir: Dir, check_turn_cooldown: bool) -> void: + if facing != dir: + _turn_cooldown = turn_walk_time + if running: + _turn_cooldown *= 0.5 + facing = dir + if check_turn_cooldown and _turn_cooldown >= 0.0: + return + start_move(dir) + + +func _try_interact() -> void: + _interact_raycast.target_position = DIR_VECTORS[facing] * tile_size + _interact_raycast.force_raycast_update() + if _interact_raycast.is_colliding(): + var interactive := _interact_raycast.get_collider() + if interactive.has_method(&"interact"): + interactive.interact() diff --git a/addons/walkabout/characters/player_character.gd.uid b/addons/walkabout/characters/player_character.gd.uid new file mode 100644 index 0000000..4883293 --- /dev/null +++ b/addons/walkabout/characters/player_character.gd.uid @@ -0,0 +1 @@ +uid://cbc7nngunyym7 diff --git a/addons/walkabout/characters/player_character.svg b/addons/walkabout/characters/player_character.svg new file mode 100644 index 0000000..b12066b --- /dev/null +++ b/addons/walkabout/characters/player_character.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + diff --git a/addons/walkabout/characters/player_character.svg.import b/addons/walkabout/characters/player_character.svg.import new file mode 100644 index 0000000..b2ff772 --- /dev/null +++ b/addons/walkabout/characters/player_character.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cdwrfpa2xn5cf" +path="res://.godot/imported/player_character.svg-b26ca4ad6a1901b6ebacace37c911113.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/characters/player_character.svg" +dest_files=["res://.godot/imported/player_character.svg-b26ca4ad6a1901b6ebacace37c911113.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/characters/wander_behavior.gd b/addons/walkabout/characters/wander_behavior.gd new file mode 100644 index 0000000..3b4300f --- /dev/null +++ b/addons/walkabout/characters/wander_behavior.gd @@ -0,0 +1,78 @@ +@tool +@icon("wander_behavior.svg") +class_name WBWanderBehavior +extends WBCharacterBehavior +## A behavior that makes a character randomly wander around within a specified area. + + +## Rectangle enclosing the tiles the character is allowed to move to. +@export var territory: Rect2i +## Minimum distance to travel in one "burst". +@export var min_distance: int +## Maximum distance to travel in one "burst". +@export var max_distance: int +## Minimum time to idle after finishing a "burst". +@export_custom(0, "suffix:s") var min_idle: float +## Maximum time to idle after finishing a "burst". +@export_custom(0, "suffix:s") var max_idle: float +## Whether the character should run. +@export var run: bool = false + + +func _init() -> void: + if Engine.is_editor_hint(): + add_child(DebugView.new(self)) + + +func _activate() -> void: + if character: + _do_move() + + +func _do_move() -> void: + if not active: + return + + var remaining_distance: int = randi_range(min_distance, max_distance) + var dir: WBCharacter.Dir = WBCharacter.Dir.values().pick_random() + + while remaining_distance > 0: + while not territory.has_point(character.tile_position + Vector2i(WBCharacter.DIR_VECTORS[dir])): + dir = WBCharacter.Dir.values().pick_random() + character.running = run + character.start_move(dir) + if character.moving: + await character.move_finished + remaining_distance -= 1 + + await create_tween().tween_interval(randf_range(min_idle, max_idle)).finished + _do_move() + + +class DebugView extends Node2D: + var behavior: WBWanderBehavior + + func _init(p_behavior: WBWanderBehavior) -> void: + behavior = p_behavior + + func _process(delta: float) -> void: + if Engine.get_frames_drawn() % 60 == 0: + queue_redraw() + + func _draw() -> void: + if not behavior.character: + return + + var position := to_local(Vector2(behavior.territory.position) * behavior.character.tile_size) + var size := Vector2(behavior.territory.size) * behavior.character.tile_size + + var color := Color.MEDIUM_PURPLE + var width := -1.0 + var selection := EditorInterface.get_selection() + if behavior in selection.get_selected_nodes(): + color = Color.PURPLE + width = 2.0 + draw_rect( + Rect2(position, size), + color, false, width + ) diff --git a/addons/walkabout/characters/wander_behavior.gd.uid b/addons/walkabout/characters/wander_behavior.gd.uid new file mode 100644 index 0000000..ed9c447 --- /dev/null +++ b/addons/walkabout/characters/wander_behavior.gd.uid @@ -0,0 +1 @@ +uid://xcfljtjwi1vt diff --git a/addons/walkabout/characters/wander_behavior.svg b/addons/walkabout/characters/wander_behavior.svg new file mode 100644 index 0000000..cbd1642 --- /dev/null +++ b/addons/walkabout/characters/wander_behavior.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + diff --git a/addons/walkabout/characters/wander_behavior.svg.import b/addons/walkabout/characters/wander_behavior.svg.import new file mode 100644 index 0000000..3b91331 --- /dev/null +++ b/addons/walkabout/characters/wander_behavior.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dcb3i7xdowdte" +path="res://.godot/imported/wander_behavior.svg-cec028e106c64cd15d62b2fb10cf549b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/characters/wander_behavior.svg" +dest_files=["res://.godot/imported/wander_behavior.svg-cec028e106c64cd15d62b2fb10cf549b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/character_animation_event.gd b/addons/walkabout/events/character_animation_event.gd new file mode 100644 index 0000000..360f111 --- /dev/null +++ b/addons/walkabout/events/character_animation_event.gd @@ -0,0 +1,31 @@ +@icon("character_animation_event.svg") +class_name WBCharacterAnimationEvent +extends WBEvent +## Event that makes a character play a specific animation. + + +## Character to animate. +@export var character: WBCharacter +## Animation to play. +@export var animation: StringName +## Number of times to let animation loop if the animation loops. +@export var loops: int = 1 + + +func _perform() -> void: + if not character: + push_error("Target character does not exist.") + return + if not character.animations.has_animation(animation): + push_error("The specified animation does not exist in this character.") + return + + character.play_custom_animation(animation) + if character.animations.get_animation_loop(animation): + var remaining_loops := loops + while remaining_loops > 0: + await character.sprite.animation_looped + remaining_loops -= 1 + else: + await character.sprite.animation_finished + character.end_custom_animation() diff --git a/addons/walkabout/events/character_animation_event.gd.uid b/addons/walkabout/events/character_animation_event.gd.uid new file mode 100644 index 0000000..1495bb3 --- /dev/null +++ b/addons/walkabout/events/character_animation_event.gd.uid @@ -0,0 +1 @@ +uid://c4bjkninxu305 diff --git a/addons/walkabout/events/character_animation_event.svg b/addons/walkabout/events/character_animation_event.svg new file mode 100644 index 0000000..bbad245 --- /dev/null +++ b/addons/walkabout/events/character_animation_event.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + diff --git a/addons/walkabout/events/character_animation_event.svg.import b/addons/walkabout/events/character_animation_event.svg.import new file mode 100644 index 0000000..73d3f85 --- /dev/null +++ b/addons/walkabout/events/character_animation_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ddeaoeqtcg5x2" +path="res://.godot/imported/character_animation_event.svg-d0fd25cb2ad4401cf873b25840865b53.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/character_animation_event.svg" +dest_files=["res://.godot/imported/character_animation_event.svg-d0fd25cb2ad4401cf873b25840865b53.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/delay_event.gd b/addons/walkabout/events/delay_event.gd new file mode 100644 index 0000000..c225fba --- /dev/null +++ b/addons/walkabout/events/delay_event.gd @@ -0,0 +1,12 @@ +@icon("delay_event.svg") +class_name WBDelayEvent +extends WBEvent +## Event that waits for a given duration. + + +## Time to wait for. +@export_custom(0, "suffix:s") var delay: float + + +func _perform() -> void: + await create_tween().tween_interval(delay).finished diff --git a/addons/walkabout/events/delay_event.gd.uid b/addons/walkabout/events/delay_event.gd.uid new file mode 100644 index 0000000..0055d5c --- /dev/null +++ b/addons/walkabout/events/delay_event.gd.uid @@ -0,0 +1 @@ +uid://bqapvnlskkprc diff --git a/addons/walkabout/events/delay_event.svg b/addons/walkabout/events/delay_event.svg new file mode 100644 index 0000000..d1d9604 --- /dev/null +++ b/addons/walkabout/events/delay_event.svg @@ -0,0 +1,46 @@ + + + + + + + diff --git a/addons/walkabout/events/delay_event.svg.import b/addons/walkabout/events/delay_event.svg.import new file mode 100644 index 0000000..3fd9eb1 --- /dev/null +++ b/addons/walkabout/events/delay_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://codl7c70plmp0" +path="res://.godot/imported/delay_event.svg-51be5be8e4173986beaba93125ff14e2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/delay_event.svg" +dest_files=["res://.godot/imported/delay_event.svg-51be5be8e4173986beaba93125ff14e2.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/event.gd b/addons/walkabout/events/event.gd new file mode 100644 index 0000000..4d7345c --- /dev/null +++ b/addons/walkabout/events/event.gd @@ -0,0 +1,33 @@ +@icon("event.svg") +class_name WBEvent +extends Node +## Basic event that does nothing and emits its signals. + + +## Emitted when the event starts performing. +signal event_started() +## Emitted when the event has finished performing. +signal event_finished() + + +## [constant true] when the event is currently active. +## It is an error to try to perform an event that is already running. +var running: bool = false + + +## Starts the event. +func perform() -> void: + if running: + push_error("Event may not be performed if it is already running.") + + running = true + event_started.emit() + + await _perform() + + running = false + event_finished.emit() + + +func _perform() -> void: + pass diff --git a/addons/walkabout/events/event.gd.uid b/addons/walkabout/events/event.gd.uid new file mode 100644 index 0000000..b7fbb25 --- /dev/null +++ b/addons/walkabout/events/event.gd.uid @@ -0,0 +1 @@ +uid://drkkeoynpxpgd diff --git a/addons/walkabout/events/event.svg b/addons/walkabout/events/event.svg new file mode 100644 index 0000000..29ed8a3 --- /dev/null +++ b/addons/walkabout/events/event.svg @@ -0,0 +1,55 @@ + + + + + + + + diff --git a/addons/walkabout/events/event.svg.import b/addons/walkabout/events/event.svg.import new file mode 100644 index 0000000..91050f0 --- /dev/null +++ b/addons/walkabout/events/event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://df7egmuwd6mtt" +path="res://.godot/imported/event.svg-94666083a457e4b1b83e2b5cf3cf906d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/event.svg" +dest_files=["res://.godot/imported/event.svg-94666083a457e4b1b83e2b5cf3cf906d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/move_character_event.gd b/addons/walkabout/events/move_character_event.gd new file mode 100644 index 0000000..d058178 --- /dev/null +++ b/addons/walkabout/events/move_character_event.gd @@ -0,0 +1,37 @@ +@icon("move_character_event.svg") +class_name WBMoveCharacterEvent +extends WBEvent +## Event that moves a character to the specified tile. + + +## Charcter to move. +@export var character: WBCharacter +## Tile position to move the target to. +@export var target_tile: Vector2i +## Whether the character should be running. +@export var run: bool = false +## Whether the character should move vertically or horizontally first. +@export var prefer_vertical: bool = false + + +func _perform() -> void: + while character.tile_position != target_tile: + if prefer_vertical: + if character.tile_position.y < target_tile.y: + character.start_move(WBCharacter.Dir.DOWN, true) + elif character.tile_position.y > target_tile.y: + character.start_move(WBCharacter.Dir.UP, true) + elif character.tile_position.x < target_tile.x: + character.start_move(WBCharacter.Dir.RIGHT, true) + elif character.tile_position.x > target_tile.x: + character.start_move(WBCharacter.Dir.LEFT, true) + else: + if character.tile_position.x < target_tile.x: + character.start_move(WBCharacter.Dir.RIGHT, true) + elif character.tile_position.x > target_tile.x: + character.start_move(WBCharacter.Dir.LEFT, true) + elif character.tile_position.y < target_tile.y: + character.start_move(WBCharacter.Dir.DOWN, true) + elif character.tile_position.y > target_tile.y: + character.start_move(WBCharacter.Dir.UP, true) + await character.move_finished diff --git a/addons/walkabout/events/move_character_event.gd.uid b/addons/walkabout/events/move_character_event.gd.uid new file mode 100644 index 0000000..104381b --- /dev/null +++ b/addons/walkabout/events/move_character_event.gd.uid @@ -0,0 +1 @@ +uid://tajefl5yoipy diff --git a/addons/walkabout/events/move_character_event.svg b/addons/walkabout/events/move_character_event.svg new file mode 100644 index 0000000..bb76ba4 --- /dev/null +++ b/addons/walkabout/events/move_character_event.svg @@ -0,0 +1,46 @@ + + + + + + + diff --git a/addons/walkabout/events/move_character_event.svg.import b/addons/walkabout/events/move_character_event.svg.import new file mode 100644 index 0000000..4f8ea7e --- /dev/null +++ b/addons/walkabout/events/move_character_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ckyw0hvg7jhij" +path="res://.godot/imported/move_character_event.svg-9eb1716c5e768c9b0d5289ef761908df.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/move_character_event.svg" +dest_files=["res://.godot/imported/move_character_event.svg-9eb1716c5e768c9b0d5289ef761908df.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/parallel_event.gd b/addons/walkabout/events/parallel_event.gd new file mode 100644 index 0000000..16b7848 --- /dev/null +++ b/addons/walkabout/events/parallel_event.gd @@ -0,0 +1,26 @@ +@icon("parallel_event.svg") +class_name WBParallelEvent +extends WBEvent +## Event that starts all child events at the same time, then finishes once all have completed. + + +signal _children_finished() + + +var _children_running: int = 0 + + +func _perform() -> void: + for child in get_children(): + if child is WBEvent: + _start_child(child) + if _children_running > 0: + await _children_finished + + +func _start_child(event: WBEvent) -> void: + _children_running += 1 + await event.perform() + _children_running -= 1 + if _children_running <= 0: + _children_finished.emit() diff --git a/addons/walkabout/events/parallel_event.gd.uid b/addons/walkabout/events/parallel_event.gd.uid new file mode 100644 index 0000000..f7a3445 --- /dev/null +++ b/addons/walkabout/events/parallel_event.gd.uid @@ -0,0 +1 @@ +uid://dcwk6e3ufl2rs diff --git a/addons/walkabout/events/parallel_event.svg b/addons/walkabout/events/parallel_event.svg new file mode 100644 index 0000000..789cb4e --- /dev/null +++ b/addons/walkabout/events/parallel_event.svg @@ -0,0 +1,55 @@ + + + + + + + + diff --git a/addons/walkabout/events/parallel_event.svg.import b/addons/walkabout/events/parallel_event.svg.import new file mode 100644 index 0000000..ce70402 --- /dev/null +++ b/addons/walkabout/events/parallel_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ckrac6a5h1sd4" +path="res://.godot/imported/parallel_event.svg-c258bd2568944bcb205b6d0f605db926.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/parallel_event.svg" +dest_files=["res://.godot/imported/parallel_event.svg-c258bd2568944bcb205b6d0f605db926.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/sequence_event.gd b/addons/walkabout/events/sequence_event.gd new file mode 100644 index 0000000..5996bd6 --- /dev/null +++ b/addons/walkabout/events/sequence_event.gd @@ -0,0 +1,12 @@ +@icon("sequence_event.svg") +class_name WBSequenceEvent +extends WBEvent +## Event that performs each child event in sequence, one after another. + + +func _perform() -> void: + event_started.emit() + for child in get_children(): + if child is WBEvent: + await child.perform() + event_finished.emit() diff --git a/addons/walkabout/events/sequence_event.gd.uid b/addons/walkabout/events/sequence_event.gd.uid new file mode 100644 index 0000000..2fa7f20 --- /dev/null +++ b/addons/walkabout/events/sequence_event.gd.uid @@ -0,0 +1 @@ +uid://cghsjdjghxhn6 diff --git a/addons/walkabout/events/sequence_event.svg b/addons/walkabout/events/sequence_event.svg new file mode 100644 index 0000000..b9e72ce --- /dev/null +++ b/addons/walkabout/events/sequence_event.svg @@ -0,0 +1,62 @@ + + + + + + + + + diff --git a/addons/walkabout/events/sequence_event.svg.import b/addons/walkabout/events/sequence_event.svg.import new file mode 100644 index 0000000..a2ed5ee --- /dev/null +++ b/addons/walkabout/events/sequence_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bakm6fp22sxac" +path="res://.godot/imported/sequence_event.svg-1b2ebbf7d19a80d4622c19258498b900.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/sequence_event.svg" +dest_files=["res://.godot/imported/sequence_event.svg-1b2ebbf7d19a80d4622c19258498b900.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/teleport_character_event.gd b/addons/walkabout/events/teleport_character_event.gd new file mode 100644 index 0000000..80316fb --- /dev/null +++ b/addons/walkabout/events/teleport_character_event.gd @@ -0,0 +1,17 @@ +@icon("teleport_character_event.svg") +class_name WBTeleportCharacterEvent +extends WBEvent +## Event that teleports a character to the specified tile position. + + +## Character to teleport. +@export var character: WBCharacter +## Tile position to teleport the character to. +@export var target_tile: Vector2i + + +func _perform() -> void: + if not character: + push_error("Target character does not exist.") + return + character.global_position = character.tile_center_pos(target_tile) diff --git a/addons/walkabout/events/teleport_character_event.gd.uid b/addons/walkabout/events/teleport_character_event.gd.uid new file mode 100644 index 0000000..7464edf --- /dev/null +++ b/addons/walkabout/events/teleport_character_event.gd.uid @@ -0,0 +1 @@ +uid://dco2ay8p6o615 diff --git a/addons/walkabout/events/teleport_character_event.svg b/addons/walkabout/events/teleport_character_event.svg new file mode 100644 index 0000000..dc955d2 --- /dev/null +++ b/addons/walkabout/events/teleport_character_event.svg @@ -0,0 +1,59 @@ + + + + + + + diff --git a/addons/walkabout/events/teleport_character_event.svg.import b/addons/walkabout/events/teleport_character_event.svg.import new file mode 100644 index 0000000..af16a8f --- /dev/null +++ b/addons/walkabout/events/teleport_character_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cpqqmbh3d5nev" +path="res://.godot/imported/teleport_character_event.svg-984335146dbb260f6d1052999d295a22.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/teleport_character_event.svg" +dest_files=["res://.godot/imported/teleport_character_event.svg-984335146dbb260f6d1052999d295a22.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/wait_signal_event.gd b/addons/walkabout/events/wait_signal_event.gd new file mode 100644 index 0000000..b1e4ce2 --- /dev/null +++ b/addons/walkabout/events/wait_signal_event.gd @@ -0,0 +1,21 @@ +@icon("wait_signal_event.svg") +class_name WBWaitSignalEvent +extends WBEvent +## Event that waits for a specified signal on a target node to be emitted. + + +## Node to await a signal of. +@export var target: Node +## Signal to await. +@export var signal_to_await: StringName = &"" + + +func _perform() -> void: + if not target: + push_error("Target object is not specified.") + return + if not target.has_signal(signal_to_await): + push_error("Target does not have the specified signal.") + return + + await Signal(target, signal_to_await) diff --git a/addons/walkabout/events/wait_signal_event.gd.uid b/addons/walkabout/events/wait_signal_event.gd.uid new file mode 100644 index 0000000..9333285 --- /dev/null +++ b/addons/walkabout/events/wait_signal_event.gd.uid @@ -0,0 +1 @@ +uid://cqodqaf46ktes diff --git a/addons/walkabout/events/wait_signal_event.svg b/addons/walkabout/events/wait_signal_event.svg new file mode 100644 index 0000000..c6ca23a --- /dev/null +++ b/addons/walkabout/events/wait_signal_event.svg @@ -0,0 +1,46 @@ + + + + + + + diff --git a/addons/walkabout/events/wait_signal_event.svg.import b/addons/walkabout/events/wait_signal_event.svg.import new file mode 100644 index 0000000..363a697 --- /dev/null +++ b/addons/walkabout/events/wait_signal_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ccury2hlmsf45" +path="res://.godot/imported/wait_signal_event.svg-d1b2d658af4493719cdf3a0f1a267c69.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/wait_signal_event.svg" +dest_files=["res://.godot/imported/wait_signal_event.svg-d1b2d658af4493719cdf3a0f1a267c69.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/events/walk_character_event.gd b/addons/walkabout/events/walk_character_event.gd new file mode 100644 index 0000000..beffc6c --- /dev/null +++ b/addons/walkabout/events/walk_character_event.gd @@ -0,0 +1,27 @@ +@icon("walk_character_event.svg") +class_name WBWalkCharacterEvent +extends WBEvent +## Event that makes a character walk a certain distance in the given direction. + + +## Character to move. +@export var character: WBCharacter +## Direction for the character to walk. +@export var direction: WBCharacter.Dir +## Number of tiles to move the character. +@export_custom(0, "suffix:tiles") var distance: int +## Whether the character should be running. +@export var run: bool = false + + +func _perform() -> void: + if not character: + push_error("Target character does not exist.") + return + + character.running = run + var remaining_distance := distance + while remaining_distance > 0: + character.start_move(direction, true) + await character.move_finished + remaining_distance -= 1 diff --git a/addons/walkabout/events/walk_character_event.gd.uid b/addons/walkabout/events/walk_character_event.gd.uid new file mode 100644 index 0000000..7ad192a --- /dev/null +++ b/addons/walkabout/events/walk_character_event.gd.uid @@ -0,0 +1 @@ +uid://csxb817wahr5q diff --git a/addons/walkabout/events/walk_character_event.svg b/addons/walkabout/events/walk_character_event.svg new file mode 100644 index 0000000..6a79d20 --- /dev/null +++ b/addons/walkabout/events/walk_character_event.svg @@ -0,0 +1,46 @@ + + + + + + + diff --git a/addons/walkabout/events/walk_character_event.svg.import b/addons/walkabout/events/walk_character_event.svg.import new file mode 100644 index 0000000..3d2ceab --- /dev/null +++ b/addons/walkabout/events/walk_character_event.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dc8q0sv4w2lxc" +path="res://.godot/imported/walk_character_event.svg-dcf6bff1559ceda5cbf4918ee7e487a2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/walkabout/events/walk_character_event.svg" +dest_files=["res://.godot/imported/walk_character_event.svg-dcf6bff1559ceda5cbf4918ee7e487a2.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/walkabout/plugin.cfg b/addons/walkabout/plugin.cfg new file mode 100644 index 0000000..a9dce35 --- /dev/null +++ b/addons/walkabout/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="WalkAbout" +description="Overworld character movement and cutscenes system." +author="fogwaves" +version="0.1" +script="walkabout_plugin.gd" diff --git a/addons/walkabout/walkabout_plugin.gd b/addons/walkabout/walkabout_plugin.gd new file mode 100644 index 0000000..aa1b8e0 --- /dev/null +++ b/addons/walkabout/walkabout_plugin.gd @@ -0,0 +1,12 @@ +@tool +extends EditorPlugin + + +func _enter_tree() -> void: + # Initialization of the plugin goes here. + pass + + +func _exit_tree() -> void: + # Clean-up of the plugin goes here. + pass diff --git a/addons/walkabout/walkabout_plugin.gd.uid b/addons/walkabout/walkabout_plugin.gd.uid new file mode 100644 index 0000000..b48ef94 --- /dev/null +++ b/addons/walkabout/walkabout_plugin.gd.uid @@ -0,0 +1 @@ +uid://bgk2xef0qnnhl diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..1c73f47 Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..d1649ca --- /dev/null +++ b/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dr7lkn2nxpjwl" +path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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 diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..d502064 --- /dev/null +++ b/icon.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..ffb74dd --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b43nfydexd88g" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..7d71d1d --- /dev/null +++ b/project.godot @@ -0,0 +1,24 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Godot WalkAbout" +config/features=PackedStringArray("4.4", "GL Compatibility") +config/icon="res://icon.svg" + +[editor_plugins] + +enabled=PackedStringArray("res://addons/walkabout/plugin.cfg") + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility"