Datasets:
instruction stringlengths 34 212 | input stringlengths 0 7.8k | output stringlengths 70 3.97k | source stringclasses 1
value |
|---|---|---|---|
Erstelle eine Godot-Klasse 'GSAISteeringAgent' die von GSAIAgentLocation erbt mit folgenden Funktionen: | # Adds velocity, speed, and size data to `GSAIAgentLocation`.
#
# It is the character's responsibility to keep this information up to date for
# the steering toolkit to work correctly.
# @category - Base types
class_name GSAISteeringAgent
extends GSAIAgentLocation
# The amount of velocity to be considered effectively ... | null | |
Vervollständige den GDScript-Code: | # Autoloaded singleton that holds signals that would be troublesome to wire in a
# local parent or a scene owner.
#
# This keeps objects passed through setup functions or unsafe accessors at a
# lower count, and can be replaced with simpler `Events.connect` calls.
extends Node
signal player_died
signal quit_requested... | signal asteroid_spawned(object)
signal map_toggled(is_visible, animation_length)
signal upgrade_unlocked
signal upgrade_chosen(choice)
signal damaged(target, damage, shooter)
signal begin_patrol(squad_leader)
signal end_patrol(squad_leader)
signal reached_cluster(squad_leader)
signal squad_leader_changed(old_leader... | null |
Vervollständige den GDScript-Code: | extends Control
func _on_toggle_music_toggled(button_pressed: bool) -> void:
if button_pressed:
$SoundEffects/Music.play()
else:
$SoundEffects/Music.stop()
func _on_ding_button_pressed() -> void:
$SoundEffects/Ding.play()
func _on_glass_button_pressed() -> void:
$SoundEffects/Glass.play()
func _on_meow_... |
func _on_toggle_amplify_toggled(button_pressed: bool) -> void:
AudioServer.set_bus_effect_enabled(0, 0, button_pressed)
func _on_toggle_band_limiter_toggled(button_pressed: bool) -> void:
AudioServer.set_bus_effect_enabled(0, 1, button_pressed)
func _on_toggle_band_pass_filter_toggled(button_pressed: bool) -> vo... | null |
Erstelle eine Godot-Klasse 'NoteManager' die von Node2D erbt mit folgenden Funktionen: _ready, _process, _miss_old_notes, _handle_keypress, _finish_song | 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 =... | null | |
Vervollständige den GDScript-Code: | extends Control
var effect: AudioEffect
var recording: AudioStreamWAV
var stereo: bool = true
var mix_rate := 44100 # This is the default mix rate on recordings.
var format := AudioStreamWAV.FORMAT_16_BITS # This is the default format on recordings.
func _ready() -> void:
var idx := AudioServer.get_bus_index(&"R... |
func _on_play_button_pressed() -> void:
print_rich("\n[b]Playing recording:[/b] %s" % recording)
print_rich("[b]Format:[/b] %s" % ("8-bit uncompressed" if recording.format == 0 else "16-bit uncompressed" if recording.format == 1 else "IMA ADPCM compressed"))
print_rich("[b]Mix rate:[/b] %s Hz" % recording.mix_rate)... | null |
Vervollständige den GDScript-Code: | ## This is the base interface for value extraction
class_name GdUnitValueExtractor
extends RefCounted |
## Extracts a value by given implementation
func extract_value(value :Variant) -> Variant:
push_error("Uninplemented func 'extract_value'")
return value
| null |
Erstelle eine Godot-Klasse 'GameWorld' die von Node2D erbt mit folgenden Funktionen: _ready, setup, _find_largest_inoccupied_asteroid_cluster, _on_Events_upgrade_chosen, _on_AsteroidSpawner_cluster_depleted | # 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 ... | null | |
Erstelle eine Godot-Klasse 'Cutscene' die von Node2D erbt mit folgenden Funktionen: is_cutscene_in_progress, run, _execute | ## A cutscene stops field gameplay to run a scripted event.
##
## A cutscene may be thought of as the videogame equivalent of a short scene in a film. For example,
## dialogue may be displayed, the scene may switch to show key NPCs performing an event, or the
## inventory may be altered. Gameplay on the field is [b]sto... | null | |
Vervollständige den GDScript-Code: | 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 = 0:
set(value):
if good_count != value:
good_count = value
emit_changed()
@export var miss_count: int = 0:
set(value):
if miss_count != value:
miss_count... | null |
Vervollständige den GDScript-Code: | # Calculates an acceleration to take an agent to a target agent's position
# directly.
# @category - Individual behaviors
class_name GSAISeek
extends GSAISteeringBehavior
# The target that the behavior aims to move the agent to. | var target: GSAIAgentLocation
func _init(agent: GSAISteeringAgent, _target: GSAIAgentLocation) -> void:
super._init(agent)
self.target = _target
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
acceleration.linear = (
(target.position - agent.position).normalized()
* agent.linear_acceler... | null |
Vervollständige den GDScript-Code: | ## 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... | # The screen transitions need to run over the gameplay, which is instantiated below all
# autoloads (including this class). Therefore, we want to move the ScreenTransition object to
# the very bottom of the SceneTree's child list.
# We cannot do so during ready, in which this node's parents are not yet ready. There... | null |
Vervollständige den GDScript-Code: | ## 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: AudioStream
## Retrieve the list of the combat participants, in [BattlerRoster] form.
func get_battler_roster() -> BattlerRoster:
return $Battlers as BattlerRoster
| null |
Erstelle eine Godot-Klasse 'GdUnitSceneRunner' die von RefCounted erbt mit folgenden Funktionen: simulate_action_pressed, simulate_action_press, simulate_action_release, test_key_presssed, simulate_key_pressed | ## The Scene Runner is a tool used for simulating interactions on a scene.
## With this tool, you can simulate input events such as keyboard or mouse input and/or simulate scene processing over a certain number of frames.
## This tool is typically used for integration testing a scene.
@abstract class_name GdUnitSceneRu... | null | |
Vervollständige den GDScript-Code: | extends Trigger
@export var _anim: AnimationPlayer
|
func _ready() -> void:
super._ready()
assert(_anim, "%s error: animation player reference is not set!" % name)
func _on_area_entered(area: Area2D) -> void:
super._on_area_entered(area)
_anim.play("open")
| 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 Godot-Klasse 'Trigger' die von Cutscene erbt mit folgenden Funktionen: _ready, _get_configuration_warnings, _on_input_paused, _on_area_entered, _on_area_exited | @tool
## A [Cutscene] that triggers on collision with a [Gamepiece]'s collision shapes.
##
## A Gamepiece with collision shapes on a layer monitored by the Trigger may activate the Trigger.
## Triggers typically wait for [signal Gamepiece.arriving] before being run, but that behaviour may
## be overridden in derived T... | null | |
Erstelle eine Godot-Klasse 'GSAIPath' die von RefCounted erbt mit folgenden Funktionen: _init, create_path, calculate_distance, calculate_target_position, get_start_point | # Represents a path made up of Vector3 waypoints, split into segments path
# follow behaviors can use.
# @category - Base types
class_name GSAIPath
extends RefCounted
# If `false`, the path loops.
var is_open: bool
# Total length of the path.
var length: float
var _segments: Array
var _nearest_point_on_segment: Vect... | null | |
Vervollständige den GDScript-Code: | extends ProgressBar
@export var Ore: PackedScene = preload("res://world/ores/iron_ore.tscn")
@onready var arc_bottom := $ArcBottom
@onready var arc_top := $ArcTop
@onready var fill := $Fill
@onready var tween : Tween
@onready var anim_player := $AnimationPlayer
@onready var audio_unload: AudioStreamPlayer = $AudioUnl... |
func initialize(player: PlayerShip) -> void:
player.cargo.stats.stat_changed.connect(_on_Stats_stat_changed)
max_value = player.cargo.stats.get_max_cargo()
value = player.cargo.stats.get_stat("cargo")
func spawn_ore() -> void:
var ore := Ore.instantiate()
add_child(ore)
if _player_is_mining:
ore.global_positi... | null |
Erstelle eine GDScript-Funktion namens '_process': | 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 causing an underflow
# in the engine code.
v... | extracted_function | |
Erstelle eine Godot-Klasse 'XRHandFallbackModifier3D' die von SkeletonModifier3D erbt mit folgenden Funktionen: _process_modification | 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... | null | |
Vervollständige den GDScript-Code: | # 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... | func _init(agent: GSAISteeringAgent, _target: GSAISteeringAgent, _predict_time_max := 1.0) -> void:
super._init(agent)
self.target = _target
self.predict_time_max = _predict_time_max
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
var target_position := target.position
var distance_squared... | null |
Erstelle eine Godot-Klasse 'GdUnitSignalAssert' 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 emitted signals until a waiting time
@abstract class_name GdUnitSignalAssert
extends GdUnitAssert
## Verifies that the current value is null.
@abstract func is_null() -> GdUnitSignalAssert
## Verifies that the current value is not null.
@abstract func is_not_null() -> GdUnitSignalAs... | null | |
Vervollständige den GDScript-Code: | ## An assertion tool to verify GDUnit asserts.
## This assert is for internal use only, to verify that failed asserts work as expected.
@abstract class_name GdUnitFailureAssert
extends GdUnitAssert
## Verifies that the current value is null.
@abstract func is_null() -> GdUnitFailureAssert
## Verifies that the curre... |
## Verifies that the current value is not equal to expected one.
@abstract func is_not_equal(expected: Variant) -> GdUnitFailureAssert
## Overrides the default failure message by given custom message.
@abstract func override_failure_message(message: String) -> GdUnitFailureAssert
## Appends a custom message to the f... | null |
Erstelle eine Godot-Klasse 'DebugGameboardBoundaries' die von Node2D erbt mit folgenden Funktionen: _ready, _draw, _update_boundaries | @tool
## Draws the boundaries set by a [Gameboard] object.
##
## Used within the editor to illustrate which cells will be included in the pathfinder calculations.
class_name DebugGameboardBoundaries extends Node2D
@export var gameboard_properties: GameboardProperties:
set(value):
gameboard_properties = value
_upd... | null | |
Erstelle eine GDScript-Funktion namens '_init': | func _init(agent: GSAISteeringAgent) -> void:
super._init(agent)
# Appends a behavior to the internal array along with its `weight`.
func add(behavior: GSAISteeringBehavior, weight: float) -> void:
behavior.agent = agent
_behaviors.append({behavior = behavior, weight = weight} | extracted_function | |
Erstelle eine Godot-Klasse 'DefaultValueProvider' die von ValueProvider erbt mit folgenden Funktionen: _init, get_value | # 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 | |
Erstelle eine Godot-Klasse 'GdUnitIntAssert' 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 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 current ... | null | |
Erstelle eine GDScript-Funktion namens 'set_value': | func set_value(key: Variant, value: Variant, blackboard_name: String = DEFAULT) -> void:
if not _data.has(blackboard_name):
_data[blackboard_name] = {} | null | |
Vervollständige den GDScript-Code: | @tool
extends TextureRect
|
func _ready() -> void:
var vp_text = get_node("../../DistortMaskView/SubViewport").get_texture()
var s_mat = material as ShaderMaterial
s_mat.set_shader_parameter("displacement_mask", vp_text)
| null |
Vervollständige den GDScript-Code: | @tool
## A [Cutscene] that triggers on collision with a [Gamepiece]'s collision shapes.
##
## A Gamepiece with collision shapes on a layer monitored by the Trigger may activate the Trigger.
## Triggers typically wait for [signal Gamepiece.arriving] before being run, but that behaviour may
## be overridden in derived T... | if callable == _on_area_entered :
var connected_area: = data["signal"].get_object() as Area2D
if connected_area:
for node in connected_area.find_children("*", "CollisionShape2D"):
(node as CollisionShape2D).disabled = !is_active
for node in connected_area.find_children("*", "CollisionPo... | null |
Erstelle eine Godot-Klasse 'UIInventory' die von HBoxContainer erbt mit folgenden Funktionen: _ready, get_ui_item, _update_item, _on_inventory_item_changed | ## An exceptionally simple item inventory that tracks which items the player has picked up.
## Normally, inventory design would be more complex. In particular, you would want to separate the
## inventory data structures from the UI implementation, as should be done in a future update to
## the OpenRPG project.
## In th... | null | |
Erstelle eine Godot-Klasse 'GSAISeek' die von GSAISteeringBehavior erbt mit folgenden Funktionen: _init, _calculate_steering | # Calculates an acceleration to take an agent to a target agent's position
# directly.
# @category - Individual behaviors
class_name GSAISeek
extends GSAISteeringBehavior
# The target that the behavior aims to move the agent to.
var target: GSAIAgentLocation
func _init(agent: GSAISteeringAgent, _target: GSAIAgentLoca... | null | |
Erstelle eine GDScript-Funktion namens '_init': | func _init() -> void:
for stat in _stats_list:
_modifiers[stat] = []
_cache[stat] = 0.0
# Call this function from your node's ready function, before accessing the stats. This ensures
# they're all loaded.
func initialize() -> void:
_update_all()
# Get the final value of a stat, with all modifiers applied to it.... | null | |
Vervollständige den GDScript-Code: | ## The base class responsible for AI-controlled Battlers.
##
## For now, this simply selects a random [BattlerAction] and picks a random target, if one is
## available.
class_name CombatAI extends Node
## Defines the max number of loops that the controller will search for a valid action. If no valid
## action has been... | # that the controller fails ITERATION_MAX times, it will cease searching for an action.
# We do this because it is possible that the designer may create a scenario where there are
# no valid actions to choose, in which case the AI would loop forever finding a valid action.
var iteration_counter = 0
if not source.... | null |
Vervollständige den GDScript-Code: | ## An Assertion Tool to verify dictionary
@abstract class_name GdUnitDictionaryAssert
extends GdUnitAssert
## Verifies that the current value is null.
@abstract func is_null() -> GdUnitDictionaryAssert
## Verifies that the current value is not null.
@abstract func is_not_null() -> GdUnitDictionaryAssert
## Verifi... | @abstract func append_failure_message(message: String) -> GdUnitDictionaryAssert
## Verifies that the current dictionary is empty, it has a size of 0.
@abstract func is_empty() -> GdUnitDictionaryAssert
## Verifies that the current dictionary is not empty, it has a size of minimum 1.
@abstract func is_not_empty() -> ... | null |
Erstelle eine GDScript-Funktion namens 'set_current_report_path': | func set_current_report_path() -> void:
# scan for latest report directory
var iteration := GdUnitFileAccess.find_last_path_index(
_report_root_path, GdUnitConstants.REPORT_DIR_PREFIX
)
_current_report_path = "%s/%s%d" % [_report_root_path, GdUnitConstants.REPORT_DIR_PREFIX, iteration]
func set_report_directory(... | extracted_function | |
Vervollständige den GDScript-Code: | extends Node3D
signal focus_lost
signal focus_gained
signal pose_recentered
@export var maximum_refresh_rate: int = 90
var xr_interface: OpenXRInterface
var xr_is_focused: bool = false
func _ready() -> void:
xr_interface = XRServer.find_interface("OpenXR")
if xr_interface and xr_interface.is_initialized():
pri... | # We couldn't start OpenXR.
print("OpenXR not instantiated!")
get_tree().quit()
# Handle OpenXR session ready.
func _on_openxr_session_begun() -> void:
# Get the reported refresh rate.
var current_refresh_rate: float = xr_interface.get_display_refresh_rate()
if current_refresh_rate > 0:
print("OpenXR: Refre... | null |
Erstelle eine Godot-Klasse 'MusicPlayer' die von Node erbt mit folgenden Funktionen: play, stop, is_playing, get_playing_track | class_name MusicPlayer extends Node
@onready var _anim: = $AnimationPlayer as AnimationPlayer
@onready var _track: = $AudioStreamPlayer as AudioStreamPlayer
func play(new_stream: AudioStream, time_in: = 0.0, time_out: = 0.0) -> void:
if new_stream == _track.stream:
return
if is_playing():
if is_equal_approx(ti... | 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 "{ } | extracted_function | |
Vervollständige den GDScript-Code: | extends Camera3D
## If true, we are in control of positioning.
@export var enable_positioning: bool = true:
set(value):
if enable_positioning == value:
return
enable_positioning = value
if is_inside_tree():
$Area3D/CollisionShape3D.disabled = not enable_positioning
if enable_positioning:
# We just... | global_transform = last_transform
## Our camera should be pointed at this node.
@export var lookat_node: Node3D
@onready var last_transform: Transform3D = global_transform
@onready var display: MeshInstance3D = $CameraBody/DisplayContainer/Display
# Called when the node enters the scene tree for the first time.
... | null |
Vervollständige den GDScript-Code: | ## A playable combatant that carries out [BattlerActions] as its [member readiness] charges.
##
## Battlers are the playable characters or enemies that show up in battle. They have [BattlerStats],
## a list of [BattlerAction]s to choose from, and respond to a variety of stimuli such as status
## effects and [BattlerHit... | ## If not, the player controls this battler. The system should allow for ally AIs.
@export var ai_scene: PackedScene:
set(value):
ai_scene = value
if ai_scene != null:
# In the editor, check to make sure that the value set to ai_scene is actually a
# CombatAI bject.
var new_instance: = ai_scene.instantia... | null |
Erstelle eine Godot-Klasse 'GdUnitValueExtractor' die von RefCounted erbt mit folgenden Funktionen: extract_value | ## This is the base interface for value extraction
class_name GdUnitValueExtractor
extends RefCounted
## Extracts a value by given implementation
func extract_value(value :Variant) -> Variant:
push_error("Uninplemented func 'extract_value'")
return value
| 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 | |
Erstelle eine GDScript-Funktion namens '_ready': | func _ready() -> void:
await owner.ready
_parent = get_parent() as State
func unhandled_input(_event: InputEvent) -> void:
pass
func physics_process(_delta: float) -> void:
pass
func enter(_msg: Dictionary = {} | extracted_function | |
Vervollständige den GDScript-Code: | extends Node3D
## The position of this node will be updated if a camera tracker is available.
@export var tracked_camera : Node3D:
set(value):
tracked_camera = value
if tracked_camera:
%CameraRemoteTransform3D.remote_path = tracked_camera.get_path()
else:
%CameraRemoteTransform3D.remote_path = NodePath()
... |
# Enable the pointer on the last controller we pressed a button on.
func _enable_pointer():
$XROrigin3D/LeftHandAim/XRPointer.enabled = left_or_right == 0
$XROrigin3D/RightHandAim/XRPointer.enabled = left_or_right == 1
# Called when the node enters the scene tree for the first time.
func _ready():
_enable_pointer(... | null |
Vervollständige den GDScript-Code: | ## 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 t... | ## Verifies that the current value is not equal to expected one.
@abstract func is_not_equal(expected: Variant) -> GdUnitObjectAssert
## Overrides the default failure message by given custom message.
@abstract func override_failure_message(message: String) -> GdUnitObjectAssert
## Appends a custom message to the fail... | null |
Vervollständige den GDScript-Code: | ## A variation of [TileMapLayer] that is used to create the [Gameboard].
##
## Comes setup with a few tools used by designers to setup maps, specifying which cells may be
## moved to or from. Multiple GameboardLayers may exist simultaneously to allow developers to
## affect the gameboard with more than one layer.
##
##... | # TileMapLayers is being cleaned up an should no longer affect the pathfinder.
var _affects_collision: = true
func _ready() -> void:
add_to_group(GROUP)
Gameboard.register_gameboard_layer(self)
tree_exiting.connect(
func _on_tree_exiting() -> void:
_affects_collision = false
var blocked_cells: Array[Vecto... | null |
Vervollständige den GDScript-Code: | extends Area3D
@export var interaction_action: String = "interact"
var _parent_camera: Camera3D
var _current_pointer: XRPointer
var _controller: XRController3D
var _was_pos: Vector3
# Find the XRController3D ancester of the given node.
func _get_controller(node: Node3D) -> XRController3D:
var parent = node.get_pare... | # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
if not _parent_camera:
return
# If we don't have a controller, let's see if we can find one!
if not _controller:
# If nothing is pointing at us, we have nothing to do!
if not _current_pointer:
return
# Fin... | null |
Vervollständige den GDScript-Code: | class_name GdUnitAssertImpl
extends GdUnitAssert
var _current :Variant
var _current_failure_message :String = ""
var _custom_failure_message :String = ""
var _additional_failure_message: String = ""
func _init(current :Variant) -> void:
_current = current
# save the actual assert instance on the current thread co... | GdAssertReports.report_success()
return self
func report_error(failure :String, failure_line_number: int = -1) -> GdUnitAssert:
var line_number := failure_line_number if failure_line_number != -1 else GdUnitAssertions.get_line_number()
GdAssertReports.set_last_error_line_number(line_number)
_current_failure_messa... | null |
Erstelle eine Godot-Klasse 'FadeMessage3D' die von Node3D erbt mit folgenden Funktionen: _update_text, _update_color, _ready, _process | @tool
class_name FadeMessage3D
extends Node3D
## Text to show, after assigning text it will disappear after a time.
@export var text : String = "":
set(value):
# Note, even if we don't change the value, we re-initiate our fade
text = value
if is_inside_tree():
_update_text()
## Text color.
@export var text_... | null | |
Vervollständige den GDScript-Code: | #*
#* agent_base.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... |
## Update agent's facing in the velocity direction.
func update_facing() -> void:
_frames_since_facing_update += 1
if _frames_since_facing_update > 3:
face_dir(velocity.x)
## Face specified direction.
func face_dir(dir: float) -> void:
if dir > 0.0 and root.scale.x < 0.0:
root.scale.x = 1.0;
_frames_since_fa... | 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... | 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... | null | |
Vervollständige den GDScript-Code: | extends XROrigin3D
# 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_gravi... | return movement
# `_process_on_physical_movement` handles the physical movement of the player
# adjusting our character body position to "catch up to" the player.
# If the character body encounters an obstruction our view will black out
# and we will stop further character movement until the player physically
# moves... | null |
Vervollständige den GDScript-Code: | extends Node3D
signal focus_lost
signal focus_gained
signal pose_recentered
@export var maximum_refresh_rate: int = 90
var xr_interface: OpenXRInterface
var xr_is_focused: bool = false
func _ready() -> void:
xr_interface = XRServer.find_interface("OpenXR")
if xr_interface and xr_interface.is_initialized():
pri... | # We couldn't start OpenXR.
print("OpenXR not instantiated!")
get_tree().quit()
# Handle OpenXR session ready.
func _on_openxr_session_begun() -> void:
# Get the reported refresh rate.
var current_refresh_rate: float = xr_interface.get_display_refresh_rate()
if current_refresh_rate > 0:
print("OpenXR: Refre... | null |
Erstelle eine Godot-Klasse 'GSAIEvade' die von GSAIPursue erbt mit folgenden Funktionen: _init, _get_modified_acceleration | # 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_a... | null | |
Erstelle eine GDScript-Funktion namens '_process': | 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 causing an underflow
# in the engine code.
v... | null | |
Erstelle eine GDScript-Funktion namens 'physics_process': | func physics_process(_delta: float) -> void:
pass
func enter(_msg: Dictionary = {} | null | |
Vervollständige den GDScript-Code: | extends Control
# A standard piano with 88 keys has keys from 21 to 108.
# To get a different set of keys, modify these numbers.
# A maximally extended 108-key piano goes from 12 to 119.
# A 76-key piano goes from 23 to 98, 61-key from 36 to 96,
# 49-key from 36 to 84, 37-key from 41 to 77, and 25-key
# from 48 to 72.... |
func _input(input_event: InputEvent) -> void:
if input_event is not InputEventMIDI:
return
var midi_event: InputEventMIDI = input_event
if midi_event.pitch < START_KEY or midi_event.pitch > END_KEY:
# The given pitch isn't on the on-screen keyboard, so return.
return
_print_midi_info(midi_event)
var key: ... | null |
Vervollständige den GDScript-Code: | #*
#* move_forward.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/l... | ## until the [member duration] is exceeded. [br]
## Returns [code]SUCCESS[/code] if the elapsed time exceeds [member duration]. [br]
## Returns [code]RUNNING[/code] if the elapsed time does not exceed [member duration]. [br]
## Blackboard variable that stores desired speed.
@export var speed_var: StringName = &"speed"... | null |
Erstelle eine GDScript-Funktion namens '_init': | func _init():
name = "BeehavePlugin"
add_autoload_singleton("BeehaveGlobalMetrics", "metrics/beehave_global_metrics.gd")
add_autoload_singleton("BeehaveGlobalDebugger", "debug/global_debugger.gd")
# Add project settings
if not ProjectSettings.has_setting("beehave/debugger/start_detached"):
ProjectSettings.set_s... | extracted_function | |
Vervollständige den GDScript-Code: | @tool
## An [InteractionPopup] that follows a moving [Gamepiece].
##
## This [code]Popup[/code] must be a child of a [Gamepiece] to function.
##
## Note that other popup types will jump to the occupied cell of the ancestor [Gamepiece], whereas
## MovingInteractionPopups sync their position to that of the gamepiece's gr... | func _ready() -> void:
super._ready()
# Do not follow anything in editor or if this object's parent is not of the correct type.
if Engine.is_editor_hint() or not _gp:
set_process(false)
func _get_configuration_warnings() -> PackedStringArray:
if not _gp:
return ["This popup must be a child of a Gamepiece node... | null |
Erstelle eine Godot-Klasse 'BattlerAnim' die von Marker2D erbt mit folgenden Funktionen: _ready, _on_animation_player_finished, setup, _on_battler_health_depleted, _on_battler_hit_received | ## The visual representation of a [Battler].
##
## Battler animations respond visually to a closed set of stimiuli, such as receiving a hit or
## moving to a position. These animations often represent a single character or a class of enemies
## and are added as children to a given Battler.
##
## [br][br]Note: BattlerAn... | null | |
Erstelle eine Godot-Klasse 'Battler' die von Node2D erbt mit folgenden Funktionen: sort, _ready, on_stats_health_depleted, act, take_hit | ## A playable combatant that carries out [BattlerActions] as its [member readiness] charges.
##
## Battlers are the playable characters or enemies that show up in battle. They have [BattlerStats],
## a list of [BattlerAction]s to choose from, and respond to a variety of stimuli such as status
## effects and [BattlerHit... | null | |
Erstelle eine Godot-Klasse 'GdUnitResultAssert' 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 Results
@abstract class_name GdUnitResultAssert
extends GdUnitAssert
## Verifies that the current value is null.
@abstract func is_null() -> GdUnitResultAssert
## Verifies that the current value is not null.
@abstract func is_not_null() -> GdUnitResultAssert
## Verifies that the curren... | 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 | |
Erstelle eine GDScript-Funktion namens '_ready': | func _ready() -> void:
await owner.ready
_parent = get_parent() as State
func unhandled_input(_event: InputEvent) -> void:
pass
func physics_process(_delta: float) -> void:
pass
func enter(_msg: Dictionary = {} | extracted_function | |
Vervollständige den GDScript-Code: | extends Area3D
@export var interaction_action: String = "interact"
var _parent_camera: Camera3D
var _current_pointer: XRPointer
var _controller: XRController3D
var _was_pos: Vector3
# Find the XRController3D ancester of the given node.
func _get_controller(node: Node3D) -> XRController3D:
var parent = node.get_pare... | # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
if not _parent_camera:
return
# If we don't have a controller, let's see if we can find one!
if not _controller:
# If nothing is pointing at us, we have nothing to do!
if not _current_pointer:
return
# Fin... | null |
Vervollständige den GDScript-Code: | 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 = pow(2, exponent)
func activate() -> void:
key.color = (Color.YELLOW + start_color) / 2
var audio := AudioStreamPlayer.new()
add_child(audio)
audio.stream = preload("res://piano_keys/A440.wav")
audio.pitch_scale = pit... | null |
Erstelle eine Godot-Klasse 'LoopingAudioStreamPlayer2D' die von AudioStreamPlayer2D erbt mit folgenden Funktionen: _ready, start, end, _on_finished | class_name LoopingAudioStreamPlayer2D
extends AudioStreamPlayer2D
@export var sound_start: AudioStream
@export var sound_loop: AudioStream
@export var sound_tail: AudioStream
var ending := false
func _ready() -> void:
finished.connect(_on_finished)
func start() -> void:
stream = sound_start
ending = false
play(... | null | |
Vervollständige den GDScript-Code: | extends Node3D
signal session_begun
signal focus_lost
signal focus_gained
signal pose_recentered
@export var maximum_refresh_rate: int = 90
var xr_interface: OpenXRInterface
var xr_is_focused := false
func get_vr_render_size():
if xr_interface and xr_interface.is_initialized():
return xr_interface.get_render_ta... | 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 instantiated!")
get_tree().quit()
# Handle OpenXR session ready.
f... | 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: | #*
#* pursue.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... | ## Desired distance from target.
@export var approach_distance: float = 100.0
var _waypoint: Vector2
# Display a customized name (requires @tool).
func _generate_name() -> String:
return "Pursue %s" % [LimboUtility.decorate_var(target_var)]
# Called each time this task is entered.
func _enter() -> void:
var target... | null |
Vervollständige den GDScript-Code: | # A specialized steering agent that updates itself every frame so the user does
# not have to using a RigidBody3D
# @category - Specialized agents
class_name GSAIRigidBody3DAgent
extends GSAISpecializedAgent
# The RigidBody3D to keep track of
var body: RigidBody3D: set = _set_body
var _last_position: Vector3
var _bod... | # @tags - virtual
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
var _body: RigidBody3D = _body_ref.get_ref()
if not _body:
return
_applied_steering = true
_body.apply_central_impulse(acceleration.linear)
_body.apply_torque_impulse(Vector3.UP * acceleration.angular)
if calcu... | null |
Vervollständige den GDScript-Code: | ## 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 ... | ## Returns true if the coordinate is found in the Pathfinder.
func has_cell(coord: Vector2i) -> bool:
return has_point(Gameboard.cell_to_index(coord))
## Returns true if the coordinate is found in the Pathfinder and the cell is unoccupied.
func can_move_to(coord: Vector2i) -> bool:
var uid: = Gameboard.cell_to_index... | null |
Vervollständige den GDScript-Code: | # Calculates angular acceleration to rotate a target to face its target's
# position. The behavior attemps to arrive with zero remaining angular velocity.
# @category - Individual behaviors
class_name GSAIFace
extends GSAIMatchOrientation
func _init(agent: GSAISteeringAgent, target: GSAIAgentLocation, use_z := false)... |
func _face(acceleration: GSAITargetAcceleration, target_position: Vector3) -> void:
var to_target := target_position - agent.position
var distance_squared := to_target.length_squared()
if distance_squared < agent.zero_linear_speed_threshold:
acceleration.set_zero()
else:
var orientation = (
GSAIUtils.vecto... | null |
Erstelle eine Godot-Klasse 'Gamepiece' die von Path2D erbt mit folgenden Funktionen: _ready, _process, move_to, stop, is_moving | @tool
## A Gamepiece is a scene that moves about and is snapped to the gameboard.
##
## Gamepieces, like other scenes in Godot, are expected to be composed from other nodes (i.e. an AI
## [GamepieceController], a collision shape, or a [Sprite2D], for example). Gamepieces themselves
## are 'dumb' objects that do nothin... | null | |
Vervollständige den GDScript-Code: | extends GdUnitStringAssert
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 current != null and typeof(current) != TYPE_STRING and t... | func is_equal_ignoring_case(expected: Variant) -> GdUnitStringAssert:
return _is_equal(expected, true, GdAssertMessages.error_equal_ignoring_case)
@warning_ignore_start("unsafe_call_argument")
func _is_equal(expected: Variant, ignore_case: bool, message_cb: Callable) -> GdUnitStringAssert:
var current: Variant = cur... | null |
Vervollständige den GDScript-Code: | extends Node3D
var tween : Tween
var active_hand : XRController3D
# Called when the node enters the scene tree for the first time.
func _ready():
$XROrigin3D/LeftHand/Pointer.visible = false
$XROrigin3D/RightHand/Pointer.visible = true
active_hand = $XROrigin3D/RightHand
# Callback for our tween to set the ener... | # Start our tween to show a pulse on our click.
func _do_tween_energy():
if tween:
tween.kill()
tween = create_tween()
tween.tween_method(_update_energy, 5.0, 1.0, 0.5)
# Called if left hand trigger is pressed.
func _on_left_hand_button_pressed(action_name):
if action_name == "select":
# Make the left hand th... | null |
Vervollständige den GDScript-Code: | @tool
extends Node2D
## The map defines the properties of the playable grid, which will be applied on _ready to the
## [Gameboard]. These properties usually correspond to one or multiple tilesets.
@export var gameboard_properties: GameboardProperties:
set(value):
gameboard_properties = value
if not is_inside_t... | await ready
_debug_boundaries.gameboard_properties = gameboard_properties
@onready var _debug_boundaries: DebugGameboardBoundaries = $Overlay/DebugBoundaries
func _ready() -> void:
if not Engine.is_editor_hint():
Camera.gameboard_properties = gameboard_properties
Gameboard.properties = gameboard_properties... | null |
Erstelle eine Godot-Klasse 'GdUnitAssertImpl' die von GdUnitAssert erbt mit folgenden Funktionen: _init, failure_message, current_value, report_success, report_error | class_name GdUnitAssertImpl
extends GdUnitAssert
var _current :Variant
var _current_failure_message :String = ""
var _custom_failure_message :String = ""
var _additional_failure_message: String = ""
func _init(current :Variant) -> void:
_current = current
# save the actual assert instance on the current thread cont... | 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 |
Erstelle eine Godot-Klasse 'GSAIFace' die von GSAIMatchOrientation erbt mit folgenden Funktionen: _init, _face, _calculate_steering | # Calculates angular acceleration to rotate a target to face its target's
# position. The behavior attemps to arrive with zero remaining angular velocity.
# @category - Individual behaviors
class_name GSAIFace
extends GSAIMatchOrientation
func _init(agent: GSAISteeringAgent, target: GSAIAgentLocation, use_z := false) ... | null | |
Vervollständige den GDScript-Code: | extends GdUnitFileAssert
const GdUnitTools := preload("res://addons/gdUnit4/src/core/GdUnitTools.gd")
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().s... | func failure_message() -> String:
return _base.failure_message()
func override_failure_message(message: String) -> GdUnitFileAssert:
@warning_ignore("return_value_discarded")
_base.override_failure_message(message)
return self
func append_failure_message(message: String) -> GdUnitFileAssert:
@warning_ignore("ret... | null |
Vervollständige den GDScript-Code: | @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... |
func _init() -> void:
for item_name in ItemTypes:
_items[ItemTypes[item_name]] = 0
## Load the [Inventory] from file or create a new resource, if it was missing. Godot caches calls,
## so this can be used every time needed.
static func restore() -> Inventory:
if Engine.is_editor_hint():
return null
if FileAcc... | null |
Erstelle eine Godot-Klasse 'GSAILookWhereYouGo' die von GSAIMatchOrientation erbt mit folgenden Funktionen: _init, _calculate_steering | # Calculates an angular acceleration to match an agent's orientation to its
# direction of travel.
# @category - Individual behaviors
class_name GSAILookWhereYouGo
extends GSAIMatchOrientation
func _init(agent: GSAISteeringAgent, use_z := false) -> void:
super._init(agent, null, use_z)
func _calculate_steering(accel... | null | |
Erstelle eine Godot-Klasse 'State' die von Node erbt mit folgenden Funktionen: _ready, unhandled_input, physics_process, enter, exit | # State interface to use in Hierarchical State Machines.
# The lowest leaf tries to handle callbacks, and if it can't, it delegates the work to its parent.
# It's up to the user to call the parent state's functions, e.g. `_parent.physics_process(delta)`
# Use State as a child of a StateMachine node.
# tags: abstract
ex... | null | |
Vervollständige den GDScript-Code: | @tool
## A [UIPopup] used specifically to mark [Interaction]s and other points of interest for the player.
##
## InteractionPopups may be added as children to a variety of objects. They respond to the player's
## physics layer and show up as an emote bubble when the player is nearby.
class_name InteractionPopup extends... | await ready
_sprite.texture = EMOTES.get(emote, EMOTES[EmoteTypes.EMPTY])
## How close the player must be to the emote before it will display.
@export var radius: = 32:
set(value):
radius = value
if not is_inside_tree():
await ready
_collision_shape.shape.radius = radius
## Is true if the Interactio... | null |
Vervollständige den GDScript-Code: | # State interface to use in Hierarchical State Machines.
# The lowest leaf tries to handle callbacks, and if it can't, it delegates the work to its parent.
# It's up to the user to call the parent state's functions, e.g. `_parent.physics_process(delta)`
# Use State as a child of a StateMachine node.
# tags: abstract
ex... | func _ready() -> void:
await owner.ready
_parent = get_parent() as State
func unhandled_input(_event: InputEvent) -> void:
pass
func physics_process(_delta: float) -> void:
pass
func enter(_msg: Dictionary = {}) -> void:
pass
func exit() -> void:
pass
func _get_state_machine(node: Node) -> Node:
if node != ... | null |
Erstelle eine Godot-Klasse 'GSAIBlend' die von GSAISteeringBehavior erbt mit folgenden Funktionen: _init, add, get_behavior_at, _calculate_steering | # Blends multiple steering behaviors into one, and returns a weighted
# acceleration from their calculations.
#
# Stores the behaviors internally as dictionaries of the form
# {
# behavior : GSAISteeringBehavior,
# weight : float
# }
# @category - Combination behaviors
class_name GSAIBlend
extends GSAISteeringBehavio... | null | |
Vervollständige den GDScript-Code: | # 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: GSAIProximit... | super._init(agent, proximity)
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
acceleration.set_zero()
_center_of_mass = Vector3.ZERO
var neighbor_count = proximity._find_neighbors(_callback)
if neighbor_count > 0:
_center_of_mass *= 1.0 / neighbor_count
acceleration.linear = (
(_cen... | 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 StaticBody2D
signal gong_struck
var enabled: bool = true |
@onready var animation_player: AnimationPlayer = $AnimationPlayer
func _on_health_damaged(_amount: float, _knockback: Vector2) -> void:
if not enabled:
return
animation_player.play(&"struck")
gong_struck.emit()
enabled = false
| null |
Vervollständige den GDScript-Code: | #!/usr/bin/env -S godot -s
extends MainLoop
const GdUnitTools := preload("res://addons/gdUnit4/src/core/GdUnitTools.gd")
# gdlint: disable=max-line-length
const LOG_FRAME_TEMPLATE = """
<!DOCTYPE html>
<html style="display: inline-grid;">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-wid... | if not reports_available():
prints("no reports found")
return true
# only process if godot logging is enabled
if not GdUnitSettings.is_log_enabled():
write_report(NO_LOG_MESSAGE, "")
return true
# parse possible custom report path,
var cmd_parser := CmdArgumentParser.new(_cmd_options, "GdUnitCmdTool.gd")... | null |
Erstelle eine Godot-Klasse 'FieldCursor' die von TileMapLayer erbt mit folgenden Funktionen: _ready, _unhandled_input, set_focus, _get_cell_under_mouse, _on_input_paused | ## Handles mouse/touch events for the field gamestate.
##
## The field cursor's role is to determine whether or not the input event occurs over a particular
## cell and how that cell should be highlighted.
class_name FieldCursor
extends TileMapLayer
## Emitted when the highlighted cell changes to a new value. An inval... | null | |
Erstelle eine Godot-Klasse 'GdUnitFloatAssert' 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 float values
@abstract class_name GdUnitFloatAssert
extends GdUnitAssert
## Verifies that the current value is null.
@abstract func is_null() -> GdUnitFloatAssert
## Verifies that the current value is not null.
@abstract func is_not_null() -> GdUnitFloatAssert
## Verifies that the curr... | null | |
Erstelle eine Godot-Klasse 'GdUnitConstants' die von RefCounted erbt mit folgenden Funktionen: | class_name GdUnitConstants
extends RefCounted
const NO_ARG :Variant = "<--null-->"
const EXPECT_ASSERT_REPORT_FAILURES := "expect_assert_report_failures"
## The maximum number of report history files to store
const DEFAULT_REPORT_HISTORY_COUNT = 20
const REPORT_DIR_PREFIX = "report_"
| null | |
Erstelle eine GDScript-Funktion namens '_unhandled_input': | 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 = {} | extracted_function | |
Erstelle eine GDScript-Funktion namens 'unhandled_input': | func unhandled_input(_event: InputEvent) -> void:
pass
func physics_process(_delta: float) -> void:
pass
func enter(_msg: Dictionary = {} | extracted_function | |
Vervollständige den GDScript-Code: | ## A signal bus to connect distant scenes to various combat-exclusive events.
extends Node
## Emitted whenever a combat has been setup and is ready to become the active 'game state'. At this
## point, the screen is fully covered by the [ScreenTransition] autoload.
@warning_ignore("unused_signal") | signal combat_initiated(arena: PackedScene)
## Emitted whenever the player has finished with the combat state regardless of whether or not the
## combat was won by the player. At this point the screen has faded to black and any events that
## immediately follow the combat may occur.
@warning_ignore("unused_signal")
si... | null |
End of preview. Expand in Data Studio
Godot LORA Dataset
GDScript training dataset for fine-tuning code models on Godot engine development.
Dataset Info
- Total samples: 476
- Train split: 428
- Validation split: 48
- Format: JSONL (instruction, input, output)
- Language: GDScript (Godot 4.x)
- Languages: German instructions, GDScript code
Sources
- godotengine/godot-demo-projects
- GDQuest/godot-open-rpg
- GDQuest/godot-3d-dodge-the-creeps
- bitbrain/beehave (behavior trees)
- limboai/limboai (AI for Godot)
Sample Format
{
"instruction": "Erstelle einen Player-Controller in Godot 4",
"input": "",
"output": "extends CharacterBody3D\n\nconst SPEED = 5.0\n..."
}
Usage
from datasets import load_dataset
dataset = load_dataset("matzejo/godot-lora-dataset")
Training
Use with Unsloth/PEFT for LORA fine-tuning:
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
"Qwen/Qwen2.5-Coder-7B-Instruct",
load_in_4bit=True,
)
model = FastLanguageModel.get_peft_model(
model,
r=16,
target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
)
License
MIT License. Individual licenses from source repositories may apply to specific code samples.
- Downloads last month
- 25