instruction
stringlengths
34
212
input
stringlengths
0
7.8k
output
stringlengths
70
3.97k
source
stringclasses
1 value
Vervollständige den GDScript-Code:
# Calculates an acceleration that repels the agent from its neighbors in the # given `GSAIProximity`. # # The acceleration is an average based on all neighbors, multiplied by a # strength decreasing by the inverse square law in relation to distance, and it # accumulates. # @category - Group behaviors class_name GSAISep...
func _init(agent: GSAISteeringAgent, proximity: GSAIProximity) -> void: super._init(agent, proximity) pass func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: acceleration.set_zero() self._acceleration = acceleration # warning-ignore:return_value_discarded proximity._find_neighbors(_callback...
null
Erstelle eine Godot-Klasse 'ScreenTransition' die von CanvasLayer erbt mit folgenden Funktionen: _ready, clear, cover, _tween_transition
## A transition (usually between gameplay scenes) in which the screen is hidden behind an opaque ## color and then shown again. ## ## Screen transitions are often used in [Cutscenes] to cover up changes in the scenery or sudden ## changes to the loaded area. Many games begin with the screen covered and play some kind o...
null
Erstelle eine Godot-Klasse 'GSAICohesion' die von GSAIGroupBehavior erbt mit folgenden Funktionen: _init, _calculate_steering, _report_neighbor
# Calculates an acceleration that attempts to move the agent towards the center # of mass of the agents in the area defined by the `GSAIProximity`. # @category - Group behaviors class_name GSAICohesion extends GSAIGroupBehavior var _center_of_mass: Vector3 func _init(agent: GSAISteeringAgent, proximity: GSAIProximity...
null
Vervollständige den GDScript-Code:
# Copyright (c) 2023 Patryk Kalinowski (patrykkalinowski.com) # SPDX-License-Identifier: MIT ## Implementation of the 1€ filter (https://gery.casiez.net/1euro/).[br] ## Modification of https://github.com/patrykkalinowski/godot-xr-kit/blob/master/addons/xr-kit/smooth-input-filter/scripts/one_euro_filter.gd class_name O...
x_filter = LowPassFilter.new() dx_filter = LowPassFilter.new() func alpha(rate: float, cutoff: float) -> float: var tau: float = 1.0 / (2 * PI * cutoff) var te: float = 1.0 / rate return 1.0 / (1.0 + tau/te) func filter(value: float, delta: float) -> float: var rate: float = 1.0 / delta var dx: float = (value...
null
Vervollständige den GDScript-Code:
extends Node3D signal session_started signal focus_lost signal focus_gained signal pose_recentered ## Set the highest refresh rate we wish to enable. ## We'll find the closest matching one. @export var maximum_refresh_rate: int = 90 var xr_interface: OpenXRInterface var xr_is_focused: bool = false ## Get our OpenX...
xr_interface.session_visible.connect(_on_openxr_visible_state) xr_interface.session_focussed.connect(_on_openxr_focused_state) xr_interface.session_stopping.connect(_on_openxr_stopping) xr_interface.pose_recentered.connect(_on_openxr_pose_recentered) else: # We couldn't start OpenXR. print("OpenXR not inst...
null
Erstelle eine Godot-Klasse 'GdUnitGodotErrorAssert' die von GdUnitAssert erbt mit folgenden Funktionen: is_null, is_not_null, is_equal, is_not_equal, override_failure_message
## An assertion tool to verify for Godot runtime errors like assert() and push notifications like push_error(). @abstract class_name GdUnitGodotErrorAssert extends GdUnitAssert ## Verifies that the current value is null. @abstract func is_null() -> GdUnitGodotErrorAssert ## Verifies that the current value is not null...
null
Vervollständige den GDScript-Code:
## A signal bus to connect distant scenes to various field-exclusive events. extends Node ## Set this object's process priority to a very high number. ## We want the Field Event manager's _process method to run after all Gamepieces and Controllers. const PROCESS_PRIORITY: = 99999999 ## Emitted when the cursor moves t...
## Emitted when the player selects a cell that is covered by an [Interaction]. @warning_ignore("unused_signal") signal interaction_selected(interaction: Interaction) ### Emitted when the player moves over a cell containing a [Trigger]. #@warning_ignore("unused_signal") #signal interaction_selected(interaction: Intera...
null
Erstelle eine Godot-Klasse 'GSAIProximity' die von RefCounted erbt mit folgenden Funktionen: _init, _find_neighbors
# Base container type that stores data to find the neighbors of an agent. # @category - Proximities # @tags - abstract class_name GSAIProximity extends RefCounted # The owning agent whose neighbors are found in the group var agent: GSAISteeringAgent # The agents who are part of this group and could be potential neighb...
null
Vervollständige den GDScript-Code:
## An Assertion Tool to verify function callback values @abstract class_name GdUnitFuncAssert extends GdUnitAssert ## Verifies that the current value is null. @abstract func is_null() -> GdUnitFuncAssert ## Verifies that the current value is not null. @abstract func is_not_null() -> GdUnitFuncAssert ## Verifies t...
@abstract func is_equal(expected: Variant) -> GdUnitFuncAssert ## Verifies that the current value is not equal to expected one. @abstract func is_not_equal(expected: Variant) -> GdUnitFuncAssert ## Overrides the default failure message by given custom message. @abstract func override_failure_message(message: String) ...
null
Vervollständige den GDScript-Code:
#* #* move_state.gd #* ============================================================================= #* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors. #* #* Use of this source code is governed by an MIT-style #* license that can be found in the LICENSE file or at #* https://opensource.org/lic...
const VERTICAL_FACTOR := 0.8 @export var animation_player: AnimationPlayer @export var animation: StringName @export var speed: float = 500.0 func _enter() -> void: animation_player.play(animation, 0.1) func _update(_delta: float) -> void: var horizontal_move: float = Input.get_axis(&"move_left", &"move_right") ...
null
Erstelle eine Godot-Klasse 'GdUnitAssertions' die von RefCounted erbt mit folgenden Funktionen: _init, __lazy_load, validate_value_type, get_line_number
# Preloads all GdUnit assertions class_name GdUnitAssertions extends RefCounted @warning_ignore("return_value_discarded") func _init() -> void: # preload all gdunit assertions to speedup testsuite loading time # gdlint:disable=private-method-call @warning_ignore_start("return_value_discarded") GdUnitAssertions.__l...
null
Vervollständige den GDScript-Code:
## A tuple implementation for GdUnit4 test assertions and value extraction. ## @tutorial(GdUnit4 Array Assertions): https://mikeschulze.github.io/gdUnit4/latest/testing/assert-array/#extractv ## @tutorial(GdUnit4 Testing Framework): https://mikeschulze.github.io/gdUnit4/ ## [br] ## The GdUnitTuple class is a utility co...
## assert_array(enemies) \ ## .extractv(extr("position.x"), extr("position.y")) \ ## .contains_exactly([ ## tuple(100, 200), ## tuple(150, 200), ## tuple(200, 200) ## ]) ## [/codeblock] ## [br] ## [b]Integration with GdUnit4 Assertions:[/b] [br] ## Tuples ...
null
Vervollständige den GDScript-Code:
extends GdUnitDictionaryAssert var _base: GdUnitAssertImpl func _init(current :Variant) -> void: _base = GdUnitAssertImpl.new(current) # save the actual assert instance on the current thread context GdUnitThreadManager.get_current_context().set_assert(self) if not GdUnitAssertions.validate_value_type(current, TY...
if not GdObjects.equals(current, expected): var c := GdAssertMessages.format_dict(current) var e := GdAssertMessages.format_dict(expected) return report_error(GdAssertMessages.error_equal(c, e)) return report_success() func is_not_equal(expected: Variant) -> GdUnitDictionaryAssert: var current: Variant = curr...
null
Erstelle eine GDScript-Funktion namens '_ready':
func _ready() -> void: # Ensure that playback state is always updating, otherwise the smoothing # filter causes issues. process_mode = Node.PROCESS_MODE_ALWAYS func _process(_delta: float) -> void: if not _is_playing: return # Handle a web bug where AudioServer.get_time_since_last_mix() occasionally # returns...
extracted_function
Vervollständige den GDScript-Code:
extends Node3D signal session_started signal focus_lost signal focus_gained signal pose_recentered ## Set the highest refresh rate we wish to enable. ## We'll find the closest matching one. @export var maximum_refresh_rate: int = 90 var xr_interface: OpenXRInterface var xr_is_focused: bool = false ## Get our OpenX...
xr_interface.session_visible.connect(_on_openxr_visible_state) xr_interface.session_focussed.connect(_on_openxr_focused_state) xr_interface.session_stopping.connect(_on_openxr_stopping) xr_interface.pose_recentered.connect(_on_openxr_pose_recentered) else: # We couldn't start OpenXR. print("OpenXR not inst...
null
Vervollständige den GDScript-Code:
extends Node3D var xr_interface : MobileVRInterface # Called when the node enters the scene tree for the first time. func _ready(): xr_interface = XRServer.find_interface("Native mobile") if xr_interface and xr_interface.initialize(): # Disable lens distortion. #xr_interface.k1 = 0.0 #xr_interface.k2 = 0.0
# Set up viewport. var vp = get_viewport() vp.use_xr = true vp.vrs_mode = Viewport.VRS_XR else: # How did we get here? get_tree().quit() func _process(delta): var dir : Vector2 = Vector2() if Input.is_action_pressed(&"ui_left"): dir.x = -1.0 elif Input.is_action_pressed(&"ui_right"): dir.x = 1.0 ...
null
Vervollständige den GDScript-Code:
@tool extends GamepieceController ## The points in the path_to_follow will be used to generate the waypoints that the controller will ## follow. @export var path_to_follow: Line2D: set(value): path_to_follow = value update_configuration_warnings() var _current_waypoint_index: = -1 var _path_origin: = Vector2.ZER...
# Node exports are currently broken. if not path_to_follow: warnings.append("The path loop controller needs a valid Line2D to follow!") return warnings # Try to convert the path_to_follow into a series of cells for the gamepiece to move to. # Loop through the points in the Line2D, using Gameboard.pathfinder to ...
null
Erstelle eine Godot-Klasse 'GSAIMatchOrientation' die von GSAISteeringBehavior erbt mit folgenden Funktionen: _init, _match_orientation, _calculate_steering
# Calculates an angular acceleration to match an agent's orientation to that of # its target. Attempts to make the agent arrive with zero remaining angular # velocity. # @category - Individual behaviors class_name GSAIMatchOrientation extends GSAISteeringBehavior # The target orientation for the behavior to try and ma...
null
Vervollständige den GDScript-Code:
# Calculates acceleration to take an agent directly away from a target agent. # @category - Individual behaviors class_name GSAIFlee extends GSAISeek
func _init(agent: GSAISteeringAgent, target: GSAIAgentLocation) -> void: super._init(agent, target) func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: acceleration.linear = ( (agent.position - target.position).normalized() * agent.linear_acceleration_max ) acceleration.angular = 0
null
Vervollständige den GDScript-Code:
extends Control ## The utterance ID to use for text to speech. var id := 0 var ut_map := {} var vs: Array[Dictionary] func _ready() -> void: # Get voice data. vs = DisplayServer.tts_get_voices() var root: TreeItem = $Tree.create_item() $Tree.set_hide_root(true) $Tree.set_column_title(0, "Name") $Tree.set_colum...
func _on_utterance_end(ut_id: int) -> void: $RichTextLabel.text = "[bgcolor=yellow][color=black]" + ut_map[ut_id] + "[/color][/bgcolor]" $Log.text += "Utterance %d ended.\n" % [ut_id] ut_map.erase(ut_id) func _on_utterance_error(ut_id: int) -> void: $RichTextLabel.text = "" $Log.text += "Utterance %d canceled/fai...
null
Vervollständige den GDScript-Code:
# Base type for group-based steering behaviors. # @category - Base types class_name GSAIGroupBehavior extends GSAISteeringBehavior # Container to find neighbors of the agent and calculate group behavior. var proximity: GSAIProximity
var _callback := Callable(self, "_report_neighbor") func _init(agent: GSAISteeringAgent, _proximity: GSAIProximity) -> void: super._init(agent) self.proximity = _proximity # Internal callback for the behavior to define whether or not a member is # relevant # @tags - virtual func _report_neighbor(_neighbor: GSAISte...
null
Vervollständige den GDScript-Code:
# Base class for all steering behaviors. # # Steering behaviors calculate the linear and the angular acceleration to be # to the agent that owns them. # # The `calculate_steering` function is the entry point for all behaviors. # Individual steering behaviors encapsulate the steering logic. # @category - Base types clas...
# If `false`, all calculations return zero amounts of acceleration. var is_enabled := true # The AI agent on which the steering behavior bases its calculations. var agent: GSAISteeringAgent func _init(_agent: GSAISteeringAgent) -> void: self.agent = _agent # Sets the `acceleration` with the behavior's desired amount...
null
Vervollständige den GDScript-Code:
class_name PickupAbleBody3D extends RigidBody3D var highlight_material : Material = preload("res://shaders/highlight_material.tres") var picked_up_by : Area3D var closest_areas : Array var original_parent : Node3D var tween : Tween # Called when this object becomes the closest body in an area func add_is_closest(ar...
# Pick this object up. func pick_up(pick_up_by) -> void: # Already picked up? Can't pick up twice. if picked_up_by: if picked_up_by == pick_up_by: return let_go() # Remember some state we want to reapply on release. original_parent = get_parent() var current_transform = global_transform # Remove us from...
null
Vervollständige den GDScript-Code:
extends Control var button_count : int = 0
func _input(event): if event is InputEventMouseMotion: # Move our cursor var mouse_motion : InputEventMouseMotion = event $Cursor.position = mouse_motion.position - Vector2(16, 16) func _on_button_pressed(): button_count = button_count + 1 $CountLabel.text = "The button has been pressed %d times!" % [ button_...
null
Vervollständige den GDScript-Code:
# Preloads all GdUnit assertions class_name GdUnitAssertions extends RefCounted @warning_ignore("return_value_discarded") func _init() -> void: # preload all gdunit assertions to speedup testsuite loading time # gdlint:disable=private-method-call @warning_ignore_start("return_value_discarded") GdUnitAssertions.__...
GdUnitAssertions.__lazy_load("res://addons/gdUnit4/src/asserts/GdUnitFailureAssertImpl.gd") GdUnitAssertions.__lazy_load("res://addons/gdUnit4/src/asserts/GdUnitGodotErrorAssertImpl.gd") @warning_ignore_restore("return_value_discarded") ### We now load all used asserts and tool scripts into the cache according to t...
null
Vervollständige den GDScript-Code:
# a value provider unsing a callback to get `next` value from a certain function class_name CallBackValueProvider extends ValueProvider var _cb :Callable var _args :Array
func _init(instance :Object, func_name :String, args :Array = Array(), force_error := true) -> void: _cb = Callable(instance, func_name); _args = args if force_error and not _cb.is_valid(): push_error("Can't find function '%s' checked instance %s" % [func_name, instance]) func get_value() -> Variant: if not _cb....
null
Erstelle eine Godot-Klasse 'GdUnitFuncAssert' die von GdUnitAssert erbt mit folgenden Funktionen: is_null, is_not_null, is_equal, is_not_equal, override_failure_message
## An Assertion Tool to verify function callback values @abstract class_name GdUnitFuncAssert extends GdUnitAssert ## Verifies that the current value is null. @abstract func is_null() -> GdUnitFuncAssert ## Verifies that the current value is not null. @abstract func is_not_null() -> GdUnitFuncAssert ## Verifies that...
null
Erstelle eine Godot-Klasse 'FieldCamera' die von Camera2D erbt mit folgenden Funktionen: _ready, reset_position, _on_viewport_resized
## Specialized camera that is constrained to the [Gameboard]'s boundaries. ## ## The camera's limits are set dynamically according to the viewport's dimensions. Normally, the ## camera is limited to the [member Gameboard.boundaries]. ## [br][br]In some cases the gameboard is smaller than the viewport, in which case it ...
null
Vervollständige den GDScript-Code:
## Accurately tracks the current beat of a song. class_name Conductor extends Node ## If [code]true[/code], the song is paused. Setting [member is_paused] to ## [code]false[/code] resumes the song. @export var is_paused: bool = false: get: if player: return player.stream_paused return false set(value): if p...
process_mode = Node.PROCESS_MODE_ALWAYS func _process(_delta: float) -> void: if not _is_playing: return # Handle a web bug where AudioServer.get_time_since_last_mix() occasionally # returns unsigned 64-bit integer max value. This is likely due to minor # timing issues between the main/audio threads, thus caus...
null
Vervollständige den GDScript-Code:
extends CharacterBody3D # Settings to control the character. @export var rotation_speed := 1.0 @export var movement_speed := 5.0 @export var movement_acceleration := 5.0 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity := float(ProjectSettings.get_setting("physics/3d/default_...
# Finally reset character orientation transform.basis = Basis() # Returns our move input by querying the move action on each controller. func _get_movement_input() -> Vector2: var movement := Vector2() # If move is not bound to one of our controllers, # that controller will return `Vector2.ZERO`. movement += $...
null
Vervollständige den GDScript-Code:
extends Control ## The utterance ID to use for text to speech. var id := 0 var ut_map := {} var vs: Array[Dictionary] func _ready() -> void: # Get voice data. vs = DisplayServer.tts_get_voices() var root: TreeItem = $Tree.create_item() $Tree.set_hide_root(true) $Tree.set_column_title(0, "Name") $Tree.set_colum...
func _on_utterance_end(ut_id: int) -> void: $RichTextLabel.text = "[bgcolor=yellow][color=black]" + ut_map[ut_id] + "[/color][/bgcolor]" $Log.text += "Utterance %d ended.\n" % [ut_id] ut_map.erase(ut_id) func _on_utterance_error(ut_id: int) -> void: $RichTextLabel.text = "" $Log.text += "Utterance %d canceled/fai...
null
Erstelle eine GDScript-Funktion namens 'get_behavior_at':
func get_behavior_at(index: int) -> Dictionary: if _behaviors.size() > index: return _behaviors[index] printerr("Tried to get index " + str(index) + " in array of size " + str(_behaviors.size())) return {}
null
Erstelle eine Godot-Klasse 'GSAIFollowPath' die von GSAIArrive erbt mit folgenden Funktionen: _init, _calculate_steering
# Produces a linear acceleration that moves the agent along the specified path. # @category - Individual behaviors class_name GSAIFollowPath extends GSAIArrive # The path to follow and travel along. var path: GSAIPath # The distance along the path to generate the next target position. var path_offset := 0.0 # Whether...
null
Erstelle eine Godot-Klasse 'Combat' die von CanvasLayer erbt mit folgenden Funktionen: _ready, setup, next_round, _select_next_player_action, _on_selected_battler_action_cached
## The Combat class manages combat logic from beginning to end. ## ## The battle is composed from several components which should all be wrapped up in a [CombatArena]. ## The Combat class instantiates the arena as a child before instantiating the player battlers and ## assigning them as descendants of the arena's [Batt...
null
Erstelle eine GDScript-Funktion namens '_init':
func _init() -> void: set_report_directory(GdUnitFileAccess.current_dir() + "reports") set_current_report_path() func _process(_delta: float) -> bool: # check if reports exists if not reports_available(): prints("no reports found") return true # only process if godot logging is enabled if not GdUnitSettings...
null
Erstelle eine Godot-Klasse 'GdUnitStringAssert' die von GdUnitAssert erbt mit folgenden Funktionen: is_null, is_not_null, is_equal, is_equal_ignoring_case, is_not_equal
## An Assertion Tool to verify String values @abstract class_name GdUnitStringAssert extends GdUnitAssert ## Verifies that the current value is null. @abstract func is_null() -> GdUnitStringAssert ## Verifies that the current value is not null. @abstract func is_not_null() -> GdUnitStringAssert ## Verifies that the ...
null
Erstelle eine GDScript-Funktion namens '_init':
func _init() -> void: add_to_group("state_machine") func _ready() -> void: await owner.ready state.enter() func _unhandled_input(event: InputEvent) -> void: state.unhandled_input(event) func _physics_process(delta: float) -> void: state.physics_process(delta) func transition_to(target_state_path: String, msg: ...
null
Vervollständige den GDScript-Code:
class_name XRHandFallbackModifier3D extends SkeletonModifier3D ## This node implements a fallback if the hand tracking API is not available ## or if one of the data sources is not supported by the XR runtime. ## It uses trigger and grip inputs from the normal controller tracker to ## animate the index finger and botto...
# Check if we have an active hand tracker, # if so, we don't need our fallback! var xr_parent : XRNode3D = parent if not xr_parent.tracker in [ "left_hand", "right_hand" ]: return var trigger : float = 0.0 var grip : float = 0.0 # Check our tracker for trigger and grip values var tracker : XRControllerTrac...
null
Erstelle eine GDScript-Funktion namens 'physics_process':
func physics_process(_delta: float) -> void: pass func enter(_msg: Dictionary = {}
extracted_function
Vervollständige den GDScript-Code:
extends XRNode3D ## Detect which tracker we should use to position our hand, we prefer ## hand tracking as this works in unison with our hand skeleton updates. ## Hand for which to get our tracking data. @export_enum("Left","Right") var hand : int = 0 # Called every frame. 'delta' is the elapsed time since the previ...
else "/user/hand_tracker/right" var hand_tracker : XRHandTracker = XRServer.get_tracker(new_tracker) if hand_tracker and hand_tracker.has_tracking_data: if tracker != new_tracker: print("Switching to left hand tracker" if hand == 0 \ else "Switching to right hand tracker") tracker = new_tracker pose ...
null
Erstelle eine Godot-Klasse 'UIInventoryItem' die von TextureRect erbt mit folgenden Funktionen: set_count
## An inventory item, tracking both it's UI representation and underlying data. ## Will be replaced in future iterations of the OpenRPG project. ## Please see UIInventory for additional information. class_name UIInventoryItem extends TextureRect var ID: = Inventory.ItemTypes.KEY var count: = 0: set = set_count @onr...
null
Vervollständige den GDScript-Code:
extends Node2D var _audio_samples := [ preload("explosion_01.wav"), preload("explosion_02.wav"), preload("explosion_03.wav"), preload("explosion_04.wav"), ]
@export var Shockwave: PackedScene @onready var audio: AudioStreamPlayer2D = $AudioStreamPlayer2D @onready var anim: AnimationPlayer = $AnimationPlayer func _ready() -> void: Events.explosion_occurred.emit() audio.stream = _audio_samples[randi() % _audio_samples.size()] audio.play() var shockwave := Shockwave.in...
null
Vervollständige den GDScript-Code:
#* #* code_edit.gd #* ============================================================================= #* Copyright 2024 Serhii Snitsaruk #* #* Use of this source code is governed by an MIT-style #* license that can be found in the LICENSE file or at #* https://opensource.org/licenses/MIT. #* =============================...
"in", "is", "not", "or", # Special values. "false", "null", "true", # Constants. "INF", "NAN", "PI", "TAU", # Functions. "assert", "preload", ] const TYPE_WORDS := [ "bool", "int", "float", "void", "String", "Vector2", "Vector2i", "Rect2", "Rect2i", "Vector3", "Vector3i", "T...
null
Erstelle eine Godot-Klasse 'GamepieceController' die von Node2D erbt mit folgenden Funktionen: _ready, _on_input_paused, _get_configuration_warnings, _notification, move_along_path
@tool @icon("res://assets/editor/icons/IconGamepieceController.svg") class_name GamepieceController extends Node2D ## Emitted whenever the gamepiece begins moving towards a new cell in its [member move_path]. signal waypoint_changed(waypoint: Vector2i) ## An active controller will receive inputs (player or otherwise)...
null
Erstelle eine Godot-Klasse 'Health' die von Node erbt mit folgenden Funktionen: _ready, take_damage, get_current
#* #* health.gd #* ============================================================================= #* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors. #* #* Use of this source code is governed by an MIT-style #* license that can be found in the LICENSE file or at #* https://opensource.org/license...
null
Erstelle eine GDScript-Funktion namens 'format_dict':
func format_dict(value :Variant) -> String: if not value is Dictionary: return str(value) var dict_value: Dictionary = value if dict_value.is_empty(): return "{ }
null
Erstelle eine Godot-Klasse 'CombatArena' die von Control erbt mit folgenden Funktionen: get_battler_roster
## An arena is the editor-configured environment for a battle. It is a Control node that contains ## the combat participants and details (such as background, foreground, music, etc.). class_name CombatArena extends Control ## The music that will be automatically played during this combat instance. @export var music: A...
null
Erstelle eine Godot-Klasse 'GSAIRigidBody2DAgent' die von GSAISpecializedAgent erbt mit folgenden Funktionen: _init, _apply_steering, _set_body, _on_SceneTree_frame
# A specialized steering agent that updates itself every frame so the user does # not have to using a RigidBody2D # @category - Specialized agents class_name GSAIRigidBody2DAgent extends GSAISpecializedAgent # The RigidBody2D to keep track of var body: RigidBody2D: set = _set_body var _last_position: Vector2 var _bod...
null
Erstelle eine Godot-Klasse 'PlayStats' die von Resource erbt mit folgenden Funktionen:
class_name PlayStats extends Resource @export var mean_hit_error: float = 0.0: set(value): if mean_hit_error != value: mean_hit_error = value emit_changed() @export var perfect_count: int = 0: set(value): if perfect_count != value: perfect_count = value emit_changed() @export var good_count: int = ...
null
Vervollständige den GDScript-Code:
# Generic State Machine. Initializes states and delegates engine callbacks # (_physics_process, _unhandled_input) to the active state. extends Node class_name StateMachine @export var initial_state := NodePath() @onready var state: State = get_node(initial_state): set = set_state @onready var _state_name := state.nam...
func _ready() -> void: await owner.ready state.enter() func _unhandled_input(event: InputEvent) -> void: state.unhandled_input(event) func _physics_process(delta: float) -> void: state.physics_process(delta) func transition_to(target_state_path: String, msg: Dictionary = {}) -> void: if not has_node(target_sta...
null
Vervollständige den GDScript-Code:
# Calculates acceleration to take an agent away from where a target agent is # moving. # @category - Individual behaviors class_name GSAIEvade
extends GSAIPursue func _init(agent: GSAISteeringAgent, target: GSAISteeringAgent, predict_time_max := 1.0): super._init(agent, target, predict_time_max) func _get_modified_acceleration() -> float: return -agent.linear_acceleration_max
null
Erstelle eine GDScript-Funktion namens '_ready':
func _ready() -> void: # Ensure that playback state is always updating, otherwise the smoothing # filter causes issues. process_mode = Node.PROCESS_MODE_ALWAYS func _process(_delta: float) -> void: if not _is_playing: return # Handle a web bug where AudioServer.get_time_since_last_mix() occasionally # returns...
extracted_function
Erstelle eine GDScript-Funktion namens '_ready':
func _ready(): blackboard = blackboard.duplicate() _data[DEFAULT] = blackboard func keys() -> Array[String]: var keys: Array[String] keys.assign(_data.keys().duplicate()) return keys func set_value(key: Variant, value: Variant, blackboard_name: String = DEFAULT) -> void: if not _data.has(blackboard_name): _da...
extracted_function
Erstelle eine Godot-Klasse 'GdUnitTuple' die von RefCounted erbt mit folgenden Funktionen: test_player_stats_after_level_up, test_enemy_spawn_positions, _init, values, _to_string
## A tuple implementation for GdUnit4 test assertions and value extraction. ## @tutorial(GdUnit4 Array Assertions): https://mikeschulze.github.io/gdUnit4/latest/testing/assert-array/#extractv ## @tutorial(GdUnit4 Testing Framework): https://mikeschulze.github.io/gdUnit4/ ## [br] ## The GdUnitTuple class is a utility co...
null
Vervollständige den GDScript-Code:
class_name XRPointer extends RayCast3D var pointing_at: Node3D var colliding_at: Vector3 = Vector3() # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta): $Laser.visible = enabled var col_with: Node3D var col_at: Vector3 = Vector3()
if enabled: if is_colliding(): col_with = get_collider() col_at = get_collision_point() $Target.global_position = col_at $Target.visible = true else: $Target.visible = false else: $Target.visible = false if pointing_at and pointing_at != col_with: if pointing_at.has_method(&"_exit_pointer"):...
null
Erstelle eine Godot-Klasse 'Pathfinder' die von AStar2D erbt mit folgenden Funktionen: _init, _on_gamepiece_moved, _on_gamepiece_free, has_cell, can_move_to
## A wrapper for [AStar2D] that allows working with [Vector2i] coordinates. ## ## Additionally provides utility methods for easily dealing with cell availability and passability. class_name Pathfinder extends AStar2D ## When finding a path, we may want to ignore certain cells that are occupied by Gamepeices. ## These ...
null
Erstelle eine Godot-Klasse 'PickupHandler3D' die von Area3D erbt mit folgenden Funktionen: _update_detect_range, _update_closest_body, _get_parent_controller, _ready, _physics_process
@tool class_name PickupHandler3D extends Area3D # This area3D class detects all physics bodies based on # PickupAbleBody3D within range and handles the logic # for selecting the closest one and allowing pickup # of that object. # Detect range specifies within what radius we detect # objects we can pick up. @export va...
null
Vervollständige den GDScript-Code:
@tool ## An animated pop-up graphic. These are often found, for example, in dialogue bubbles to ## demonstrate the need for player input. class_name UIPopup extends Node2D ## Emitted when the popup has completely disappeared. signal disappeared ## The states in which a popup may exist. enum States { HIDDEN, SHOWN, HI...
# immediately hidden and still look smooth as butter. elif not _is_shown and _anim.current_animation == "bounce_wait": _anim.play("disappear") _state = States.HIDING # Track what is currently happening to the popup. var _state: = States.HIDDEN @onready var _anim: = $AnimationPlayer as AnimationPlayer @onrea...
null
Erstelle eine GDScript-Funktion namens '_init':
func _init() -> void: add_to_group("state_machine") func _ready() -> void: await owner.ready state.enter() func _unhandled_input(event: InputEvent) -> void: state.unhandled_input(event) func _physics_process(delta: float) -> void: state.physics_process(delta) func transition_to(target_state_path: String, msg: ...
extracted_function
Vervollständige den GDScript-Code:
## The BattlerRoster provides easy access to combat participants. ## ## The roster is a central means of accessing all the [Battler]s in a combat, providing utility ## methods to filter them for a number of criteria (player, enemy, is_alive, etc.). ## ## Note that Battlers must be a descendent (though not necessarily a...
## Returns all existing Battlers that are opposed to the player. func get_enemy_battlers() -> Array[Battler]: return get_battlers().filter( func _filter_enemies(battler: Battler): return not battler.is_player ) ## Filter an array of Battlers to return only whose health points are currently greater than 0. func...
null
Vervollständige den GDScript-Code:
#* #* is_aligned_with_target.gd #* ============================================================================= #* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors. #* #* Use of this source code is governed by an MIT-style #* license that can be found in the LICENSE file or at #* https://openso...
## Checks if the agent is horizontally aligned with the target. [br] ## Returns [code]SUCCESS[/code] if the agent is horizontally aligned with the target. ## Returns [code]FAILURE[/code] if not aligned or if target is not a valid node instance. @export var target_var: StringName = &"target" @export var tolerance: floa...
null
Erstelle eine Godot-Klasse 'GameboardProperties' die von Resource erbt mit folgenden Funktionen: _to_string
@tool ## Defines the properties of the playable game map. class_name GameboardProperties extends Resource ## Emitted whenever [member cell_size] changes. signal cell_size_changed ## Emitted whenever [member extents] changes. signal extents_changed ## An invalid index is not found on the gameboard. Note that this requ...
null
Vervollständige den GDScript-Code:
extends Control var button_count : int = 0
func _input(event): if event is InputEventMouseMotion: # Move our cursor var mouse_motion : InputEventMouseMotion = event $Cursor.position = mouse_motion.position - Vector2(16, 16) func _on_button_pressed(): button_count = button_count + 1 $CountLabel.text = "The button has been pressed %d times!" % [ button_...
null
Erstelle eine Godot-Klasse 'Stats' die von Resource erbt mit folgenden Funktionen: _init, initialize, get_stat, add_modifier, remove_modifier
# Virtual base class for stats (health, speed...) that support upgrades. # # You must call `initialize()` to initialize the stats' values. This ensures that they are in sync # with the values modified in Godot's inspector. # # Each stat should be a floating point value, and we recommend to make them private properties,...
null
Erstelle eine GDScript-Funktion namens '_ready':
func _ready(): blackboard = blackboard.duplicate() _data[DEFAULT] = blackboard func keys() -> Array[String]: var keys: Array[String] keys.assign(_data.keys().duplicate()) return keys func set_value(key: Variant, value: Variant, blackboard_name: String = DEFAULT) -> void: if not _data.has(blackboard_name): _da...
extracted_function
Vervollständige den GDScript-Code:
# default value provider, simple returns the initial value class_name DefaultValueProvider extends ValueProvider
var _value: Variant func _init(value: Variant) -> void: _value = value func get_value() -> Variant: return _value
null
Vervollständige den GDScript-Code:
extends Control @export var controller: XRController3D @onready var trigger_input_node: HSlider = $VBoxContainer/TriggerInput/HSlider @onready var trigger_click_node: CheckBox = $VBoxContainer/TriggerInput/CheckBox @onready var on_threshold_node: Label = $VBoxContainer/Thresholds/OnThreshold @onready var off_threshol...
var off_trigger_threshold: float = 1.0 var on_trigger_threshold: float = 0.0 func _process(_delta: float) -> void: if controller: var trigger_input = controller.get_float(&"trigger") trigger_input_node.value = trigger_input var trigger_click = controller.is_button_pressed(&"trigger_click") trigger_click_nod...
null
Vervollständige den GDScript-Code:
@icon("icons/blackboard.svg") class_name Blackboard extends Node const DEFAULT = "default" ## The blackboard is an object that can be used to store and access data between ## multiple nodes of the behavior tree. @export var blackboard: Dictionary = {}: set(b): blackboard = b.duplicate() _data[DEFAULT] = blackboa...
return _data[blackboard_name].get(key, default_value) return default_value func has_value(key: Variant, blackboard_name: String = DEFAULT) -> bool: return ( _data.has(blackboard_name) and _data[blackboard_name].has(key) and _data[blackboard_name][key] != null ) func erase_value(key: Variant, blackboard_nam...
null
Vervollständige den GDScript-Code:
#* #* idle_state.gd #* ============================================================================= #* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors. #* #* Use of this source code is governed by an MIT-style #* license that can be found in the LICENSE file or at #* https://opensource.org/lic...
#* extends LimboState ## Idle state. @export var animation_player: AnimationPlayer @export var idle_animation: StringName func _enter() -> void: animation_player.play(idle_animation, 0.1) func _update(_delta: float) -> void: var horizontal_move: float = Input.get_axis(&"move_left", &"move_right") var vertical_mov...
null
Vervollständige den GDScript-Code:
extends TileMapLayer @onready var _occupancy: TileMapLayer = $OccupancyGrid func _ready() -> void: _occupancy.tile_set = tile_set
Gameboard.pathfinder_changed.connect( func _on_pathfinder_changed(added_cells: Array[Vector2i], removed_cells: Array[Vector2i]) -> void: for cell in added_cells: set_cell(cell, 0, Vector2i(0, 0), 0) for cell in removed_cells: set_cell(cell) # Flag the cell as blocked. ) GamepieceRegistry.gamepi...
null
Erstelle eine Godot-Klasse 'GdUnitObjectAssert' die von GdUnitAssert erbt mit folgenden Funktionen: is_null, is_not_null, is_equal, is_not_equal, override_failure_message
## An Assertion Tool to verify Object values @abstract class_name GdUnitObjectAssert extends GdUnitAssert ## Verifies that the current value is null. @abstract func is_null() -> GdUnitObjectAssert ## Verifies that the current value is not null. @abstract func is_not_null() -> GdUnitObjectAssert ## Verifies that the ...
null
Erstelle eine Godot-Klasse 'GSAIPursue' die von GSAISteeringBehavior erbt mit folgenden Funktionen: _init, _calculate_steering, _get_modified_acceleration
# Calculates an acceleration to make an agent intercept another based on the # target agent's movement. # @category - Individual behaviors class_name GSAIPursue extends GSAISteeringBehavior # The target agent that the behavior is trying to intercept. var target: GSAISteeringAgent # The maximum amount of time in the fu...
null
Vervollständige den GDScript-Code:
extends GdUnitIntAssert var _base: GdUnitAssertImpl func _init(current :Variant) -> void: _base = GdUnitAssertImpl.new(current) # save the actual assert instance on the current thread context GdUnitThreadManager.get_current_context().set_assert(self) if not GdUnitAssertions.validate_value_type(current, TYPE_INT)...
_base.is_null() return self func is_not_null() -> GdUnitIntAssert: @warning_ignore("return_value_discarded") _base.is_not_null() return self func is_equal(expected: Variant) -> GdUnitIntAssert: @warning_ignore("return_value_discarded") _base.is_equal(expected) return self func is_not_equal(expected: Variant)...
null
Vervollständige den GDScript-Code:
#* #* player.gd #* ============================================================================= #* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors. #* #* Use of this source code is governed by an MIT-style #* license that can be found in the LICENSE file or at #* https://opensource.org/license...
func _unhandled_input(event: InputEvent) -> void: if event.is_echo(): return if event.is_action_pressed("attack"): attack_pressed = true _process_attack_input() if event.is_action_pressed("dodge"): hsm.dispatch("dodge!") func _process_attack_input() -> void: if not attack_pressed or hsm.get_active_state() ...
null
Erstelle eine Godot-Klasse 'GdAssertMessages' die von Resource erbt mit folgenden Funktionen: format_dict, input_event_as_text, _colored_string_div, colored_array_div, _typed_value
class_name GdAssertMessages extends Resource const WARN_COLOR = "#EFF883" const ERROR_COLOR = "#CD5C5C" const VALUE_COLOR = "#1E90FF" const SUB_COLOR := Color(1, 0, 0, .15) const ADD_COLOR := Color(0, 1, 0, .15) # Dictionary of control characters and their readable representations const CONTROL_CHARS = { "\n": "<L...
null
Vervollständige den GDScript-Code:
# Container for multiple behaviors that returns the result of the first child # behavior with non-zero acceleration. # @category - Combination behaviors class_name GSAIPriority extends GSAISteeringBehavior var _behaviors := [] # The index of the last behavior the container prioritized. var last_selected_index: int # ...
self.zero_threshold = _zero_threshold # Appends a steering behavior as a child of this container. func add(behavior: GSAISteeringBehavior) -> void: _behaviors.append(behavior) # Returns the behavior at the position in the pool referred to by `index`, or # `null` if no behavior was found. func get_behavior_at(index:...
null
Erstelle eine Godot-Klasse 'Inventory' die von Resource erbt mit folgenden Funktionen: _init, restore, add, remove, get_item_count
@tool ## A simple inventory implementation that includes all item types and data within the class. class_name Inventory extends Resource ## All item types available to add or remove from the inventory. enum ItemTypes { KEY, COIN, BOMB, RED_WAND, BLUE_WAND, GREEN_WAND } #TODO: I expect we'll want to have a proper inve...
null
Erstelle eine GDScript-Funktion namens '_notification':
func _notification(event: int) -> void: if event == NOTIFICATION_PREDELETE: if _base != null: _base.notification(event) _base = null func report_success() -> GdUnitArrayAssert: @warning_ignore("return_value_discarded") _base.report_success() return self func report_error(error: String) -> GdUnitArrayAsser...
null
Vervollständige den GDScript-Code:
@tool class_name PickupHandler3D extends Area3D # This area3D class detects all physics bodies based on # PickupAbleBody3D within range and handles the logic # for selecting the closest one and allowing pickup # of that object. # Detect range specifies within what radius we detect # objects we can pick up. @export va...
# Do not check this if we've picked something up. if picked_up_body: if closest_body: closest_body.remove_is_closest(self) closest_body = null return # Find the body that is currently the closest. var new_closest_body : PickupAbleBody3D var closest_distance : float = 1000000.0 for body in get_overlap...
null
Vervollständige den GDScript-Code:
extends Camera3D ## This script allows us to place a camera in the world that provides ## a spectator view where we see what the player sees. ## The positioning is smoothed to create a steadycam type of effect. ## Specify the XRCamera3D node we're replicating the view for. @export var xr_camera : XRCamera3D ## Remov...
var first_frame : bool = true # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): if current and xr_camera: # Note, we apply our smoothing in the local space of our XROrigin3D node. # This way we don't apply smoothing when game logic moves the XROrigin3D node. # We ...
null
Vervollständige den GDScript-Code:
extends AudioStreamPlayer @export var conductor: Conductor var _playing: bool = false var _last_beat: float = -17 # 16 beat count-in var _cached_latency: float = AudioServer.get_output_latency()
func _process(_delta: float) -> void: if not _playing: return # Note that this implementation is flawed since every tick is rounded to the # next mix window (~11ms at the default 44100 Hz mix rate) due to Godot's # audio mix buffer. Precise audio scheduling is requested in # https://github.com/godotengine/godo...
null
Erstelle eine Godot-Klasse 'Blackboard' die von Node erbt mit folgenden Funktionen: _ready, keys, set_value, get_value, has_value
@icon("icons/blackboard.svg") class_name Blackboard extends Node const DEFAULT = "default" ## The blackboard is an object that can be used to store and access data between ## multiple nodes of the behavior tree. @export var blackboard: Dictionary = {}: set(b): blackboard = b.duplicate() _data[DEFAULT] = blackboa...
null
Vervollständige den GDScript-Code:
extends CharacterBody2D @onready var animation_player: AnimationPlayer = $AnimationPlayer @onready var hurtbox: Hurtbox = $Hurtbox @onready var root: Node2D = $Root
func _on_health_damaged(_amount: float, _knockback: Vector2) -> void: root.scale.x = -signf(hurtbox.last_attack_vector.x) animation_player.clear_queue() animation_player.play(&"hurt", 0.1) func get_facing() -> float: return signf(root.scale.x)
null
Erstelle eine Godot-Klasse 'UIPopup' die von Node2D erbt mit folgenden Funktionen: _ready, hide_and_free, _on_bounce_finished, _on_animation_finished
@tool ## An animated pop-up graphic. These are often found, for example, in dialogue bubbles to ## demonstrate the need for player input. class_name UIPopup extends Node2D ## Emitted when the popup has completely disappeared. signal disappeared ## The states in which a popup may exist. enum States { HIDDEN, SHOWN, HI...
null
Erstelle eine Godot-Klasse 'RandomAction' die von ActionLeaf erbt mit folgenden Funktionen: _get_random_action, tick
## Random action node that changes its state over time. ## ## Action node that returns a random status, depending on the action ## [member weights]. Changes its status every [member reset_duration_msec] ## milliseconds. @tool class_name RandomAction extends ActionLeaf ## How often this action changes its return status...
null
Erstelle eine GDScript-Funktion namens 'get_cell_under_node':
func get_cell_under_node(node: Node2D) -> Vector2i: return pixel_to_cell(node.global_position/node.global_scale) ## Convert cell coordinates to an index unique to those coordinates. ## [br][br][b]Note:[/b] cell coordinates outside the [member extents] will return ## [constant INVALID_INDEX]. func cell_to_index(cell_c...
extracted_function
Vervollständige den GDScript-Code:
# Spawns the station, asteroids, and pirates when entering the game. # Keeps track of resources available in the world and which asteroid clusters holds it, # and spawns more when running low. # It also signals the pirate spawner when an upgrade has been made. class_name GameWorld extends Node2D # Radius of the world ...
@onready var pirate_spawner: PirateSpawner = $PirateSpawner func _ready() -> void: await owner.ready setup() func setup() -> void: rng.randomize() Events.upgrade_chosen.connect(_on_Events_upgrade_chosen) asteroid_spawner.cluster_depleted.connect(_on_AsteroidSpawner_cluster_depleted) station_spawner.spawn_stat...
null
Vervollständige den GDScript-Code:
# One-shot particle emitter that recycles itself after use. extends GPUParticles2D @onready var timer := $Timer var is_dying := false
func _ready() -> void: one_shot = true emitting = true func _process(_delta: float) -> void: if not emitting and not is_dying: die() func die() -> void: is_dying = true timer.start(lifetime) await timer.timeout queue_free()
null
Erstelle eine Godot-Klasse 'CollisionFinder' die von RefCounted erbt mit folgenden Funktionen: _init, search
## Find all collision shapes of a given mask within a specified search radius. ## ## The CollisionFinder is used to search for objects that contain a [CollisionObject2D]. In the ## OpenRPG it serves as the cornerstone of the [Gameboard]/[Gamepiece] system, since objects ## (gamepieces, terrain, etc.) are found dynamica...
null
Vervollständige den GDScript-Code:
extends Control const EXPOSE_DURATION := 2.0 const FADE_DURATION := 0.5 @onready var container := $HBoxContainer/CenterContainer @onready var tween := create_tween() @onready var keyboard := container.get_node("AnyKey") @onready var xbox := container.get_node("XboxA") @onready var playstation := container.get_node("P...
func _ready() -> void: var total_time := 0.0 for element in elements: total_time += _fade_in(element, total_time) total_time += _fade_out(element, total_time) tween.set_loops() tween.play() func _fade_in(target: Control, total_time: float) -> float: tween.tween_property( target, "modulate", Color.WHITE...
null
Erstelle eine Godot-Klasse 'PianoKey' die von Control erbt mit folgenden Funktionen: setup, activate, deactivate
class_name PianoKey extends Control var pitch_scale: float @onready var key: ColorRect = $Key @onready var start_color: Color = key.color @onready var color_timer: Timer = $ColorTimer func setup(pitch_index: int) -> void: name = "PianoKey" + str(pitch_index) var exponent := (pitch_index - 69.0) / 12.0 pitch_scale...
null
Erstelle eine Godot-Klasse 'GSAICharacterBody2DAgent' die von GSAISpecializedAgent erbt mit folgenden Funktionen: _init, _apply_steering, _apply_sliding_steering, _apply_collide_steering, _apply_position_steering
# A specialized steering agent that updates itself every frame so the user does # not have to using a CharacterBody2D # @category - Specialized agents class_name GSAICharacterBody2DAgent extends GSAISpecializedAgent # SLIDE uses `move_and_slide` # COLLIDE uses `move_and_collide` # POSITION changes the `global_position...
null
Erstelle eine GDScript-Funktion namens 'report_success':
func report_success() -> GdUnitArrayAssert: @warning_ignore("return_value_discarded") _base.report_success() return self func report_error(error: String) -> GdUnitArrayAssert: @warning_ignore("return_value_discarded") _base.report_error(error) return self func failure_message() -> String: return _base.failure_...
extracted_function
Erstelle eine Godot-Klasse 'GdUnitArrayAssertImpl' die von GdUnitArrayAssert erbt mit folgenden Funktionen: _init, _notification, report_success, report_error, failure_message
class_name GdUnitArrayAssertImpl extends GdUnitArrayAssert var _base: GdUnitAssertImpl var _current_value_provider: ValueProvider var _type_check: bool func _init(current: Variant, type_check := true) -> void: _type_check = type_check _current_value_provider = DefaultValueProvider.new(current) _base = GdUnitAssert...
null
Vervollständige den GDScript-Code:
class_name NoteManager extends Node2D signal play_stats_updated(play_stats: PlayStats) signal note_hit(beat: float, hit_type: Enums.HitType, hit_error: float) signal song_finished(play_stats: PlayStats) const NOTE_SCENE = preload("res://objects/note/note.tscn") const HIT_MARGIN_PERFECT = 0.050 const HIT_MARGIN_GOOD =...
if _notes.is_empty(): return var curr_beat := _get_curr_beat() for i in range(_notes.size()): _notes[i].update_beat(curr_beat) _miss_old_notes() if Input.is_action_just_pressed(&"main_key"): _handle_keypress() if _notes.is_empty(): _finish_song() func _miss_old_notes() -> void: while not _notes.is_e...
null
Vervollständige den GDScript-Code:
#* #* select_flanking_pos.gd #* ============================================================================= #* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors. #* #* Use of this source code is governed by an MIT-style #* license that can be found in the LICENSE file or at #* https://opensourc...
## Which agent's side should we flank? @export var flank_side: AgentSide = AgentSide.CLOSEST ## Minimum range relative to the target. @export var range_min: int = 300 ## Maximum range relative to the target. @export var range_max: int = 400 ## Blackboard variable that will be used to store selected position. @expor...
null
Vervollständige den GDScript-Code:
## An Assertion Tool to verify integer values @abstract class_name GdUnitIntAssert extends GdUnitAssert ## Verifies that the current value is null. @abstract func is_null() -> GdUnitIntAssert ## Verifies that the current value is not null. @abstract func is_not_null() -> GdUnitIntAssert ## Verifies that the curre...
@abstract func append_failure_message(message: String) -> GdUnitIntAssert ## Verifies that the current value is less than the given one. @abstract func is_less(expected: int) -> GdUnitIntAssert ## Verifies that the current value is less than or equal the given one. @abstract func is_less_equal(expected: int) -> GdUni...
null
Vervollständige den GDScript-Code:
@tool class_name CombatTrigger extends Trigger @export var combat_arena: PackedScene func _execute() -> void: # Let other systems know that a combat has been triggered and then wait for its outcome. FieldEvents.combat_triggered.emit(combat_arena) var did_player_win: bool = await CombatEvents.combat_finished ...
Transition.clear.call_deferred(0.2) await Transition.finished # We want to run post-combat events. In some cases, this may not involve much, such as playing a # game-over screen or removing an AI combat-starting gamepiece from the field. # In some cases, however, we'll want a dialogue to play or some creative eve...
null
Erstelle eine Godot-Klasse 'GdUnitVectorAssert' die von GdUnitAssert erbt mit folgenden Funktionen: is_null, is_not_null, is_equal, is_not_equal, is_equal_approx
## An Assertion Tool to verify Vector values @abstract class_name GdUnitVectorAssert extends GdUnitAssert ## Verifies that the current value is null. @abstract func is_null() -> GdUnitVectorAssert ## Verifies that the current value is not null. @abstract func is_not_null() -> GdUnitVectorAssert ## Verifies that the ...
null
Erstelle eine GDScript-Funktion namens '_on_gamepiece_free':
func _on_gamepiece_free(_gp: Gamepiece, coord: Vector2i) -> void: var cell_id: = Gameboard.cell_to_index(coord) if has_point(cell_id): set_point_disabled(cell_id, false) ) ## Returns true if the coordinate is found in the Pathfinder. func has_cell(coord: Vector2i) -> bool: return has_point(Gameboard.cell_t...
extracted_function