1 /** 2 Base class for all $(I scene) objects. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.node; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.inputevent; 24 import godot.inputeventkey; 25 import godot.scenetree; 26 import godot.viewport; 27 import godot.multiplayerapi; 28 /** 29 Base class for all $(I scene) objects. 30 31 Nodes are Godot's building blocks. They can be assigned as the child of another node, resulting in a tree arrangement. A given node can contain any number of nodes as children with the requirement that all siblings (direct children of a node) should have unique names. 32 A tree of nodes is called a $(I scene). Scenes can be saved to the disk and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of Godot projects. 33 $(B Scene tree:) The $(D SceneTree) contains the active tree of nodes. When a node is added to the scene tree, it receives the NOTIFICATION_ENTER_TREE notification and its $(D _enterTree) callback is triggered. Child nodes are always added $(I after) their parent node, i.e. the $(D _enterTree) callback of a parent node will be triggered before its child's. 34 Once all nodes have been added in the scene tree, they receive the NOTIFICATION_READY notification and their respective $(D _ready) callbacks are triggered. For groups of nodes, the $(D _ready) callback is called in reverse order, starting with the children and moving up to the parent nodes. 35 This means that when adding a node to the scene tree, the following order will be used for the callbacks: $(D _enterTree) of the parent, $(D _enterTree) of the children, $(D _ready) of the children and finally $(D _ready) of the parent (recursively for the entire scene tree). 36 $(B Processing:) Nodes can override the "process" state, so that they receive a callback on each frame requesting them to process (do something). Normal processing (callback $(D _process), toggled with $(D setProcess)) happens as fast as possible and is dependent on the frame rate, so the processing time $(I delta) is passed as an argument. Physics processing (callback $(D _physicsProcess), toggled with $(D setPhysicsProcess)) happens a fixed number of times per second (60 by default) and is useful for code related to the physics engine. 37 Nodes can also process input events. When present, the $(D _input) function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the $(D _unhandledInput) function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI $(D Control) nodes), ensuring that the node only receives the events that were meant for it. 38 To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with $(D setOwner). This keeps track of who instanced what. This is mostly useful when writing editors and tools, though. 39 Finally, when a node is freed with $(D GodotObject.free) or $(D queueFree), it will also free all its children. 40 $(B Groups:) Nodes can be added to as many groups as you want to be easy to manage, you could create groups like "enemies" or "collectables" for example, depending on your game. See $(D addToGroup), $(D isInGroup) and $(D removeFromGroup). You can then retrieve all nodes in these groups, iterate them and even call methods on groups via the methods on $(D SceneTree). 41 $(B Networking with nodes:) After connecting to a server (or making one, see $(D NetworkedMultiplayerENet)) it is possible to use the built-in RPC (remote procedure call) system to communicate over the network. By calling $(D rpc) with a method name, it will be called locally and in all connected peers (peers = clients and the server that accepts connections). To identify which node receives the RPC call Godot will use its $(D NodePath) (make sure node names are the same on all peers). Also take a look at the high-level networking tutorial and corresponding demos. 42 */ 43 @GodotBaseClass struct Node 44 { 45 enum string _GODOT_internal_name = "Node"; 46 public: 47 @nogc nothrow: 48 union { godot_object _godot_object; GodotObject _GODOT_base; } 49 alias _GODOT_base this; 50 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 51 package(godot) __gshared bool _classBindingInitialized = false; 52 package(godot) static struct _classBinding 53 { 54 __gshared: 55 @GodotName("_process") GodotMethod!(void, double) _process; 56 @GodotName("_physics_process") GodotMethod!(void, double) _physicsProcess; 57 @GodotName("_enter_tree") GodotMethod!(void) _enterTree; 58 @GodotName("_exit_tree") GodotMethod!(void) _exitTree; 59 @GodotName("_ready") GodotMethod!(void) _ready; 60 @GodotName("_input") GodotMethod!(void, InputEvent) _input; 61 @GodotName("_unhandled_input") GodotMethod!(void, InputEvent) _unhandledInput; 62 @GodotName("_unhandled_key_input") GodotMethod!(void, InputEventKey) _unhandledKeyInput; 63 @GodotName("_get_configuration_warning") GodotMethod!(String) _getConfigurationWarning; 64 @GodotName("add_child_below_node") GodotMethod!(void, GodotObject, GodotObject, bool) addChildBelowNode; 65 @GodotName("set_name") GodotMethod!(void, String) setName; 66 @GodotName("get_name") GodotMethod!(String) getName; 67 @GodotName("add_child") GodotMethod!(void, GodotObject, bool) addChild; 68 @GodotName("remove_child") GodotMethod!(void, GodotObject) removeChild; 69 @GodotName("get_child_count") GodotMethod!(long) getChildCount; 70 @GodotName("get_children") GodotMethod!(Array) getChildren; 71 @GodotName("get_child") GodotMethod!(Node, long) getChild; 72 @GodotName("has_node") GodotMethod!(bool, NodePath) hasNode; 73 @GodotName("get_node") GodotMethod!(Node, NodePath) getNode; 74 @GodotName("get_parent") GodotMethod!(Node) getParent; 75 @GodotName("find_node") GodotMethod!(Node, String, bool, bool) findNode; 76 @GodotName("find_parent") GodotMethod!(Node, String) findParent; 77 @GodotName("has_node_and_resource") GodotMethod!(bool, NodePath) hasNodeAndResource; 78 @GodotName("get_node_and_resource") GodotMethod!(Array, NodePath) getNodeAndResource; 79 @GodotName("is_inside_tree") GodotMethod!(bool) isInsideTree; 80 @GodotName("is_a_parent_of") GodotMethod!(bool, GodotObject) isAParentOf; 81 @GodotName("is_greater_than") GodotMethod!(bool, GodotObject) isGreaterThan; 82 @GodotName("get_path") GodotMethod!(NodePath) getPath; 83 @GodotName("get_path_to") GodotMethod!(NodePath, GodotObject) getPathTo; 84 @GodotName("add_to_group") GodotMethod!(void, String, bool) addToGroup; 85 @GodotName("remove_from_group") GodotMethod!(void, String) removeFromGroup; 86 @GodotName("is_in_group") GodotMethod!(bool, String) isInGroup; 87 @GodotName("move_child") GodotMethod!(void, GodotObject, long) moveChild; 88 @GodotName("get_groups") GodotMethod!(Array) getGroups; 89 @GodotName("raise") GodotMethod!(void) raise; 90 @GodotName("set_owner") GodotMethod!(void, GodotObject) setOwner; 91 @GodotName("get_owner") GodotMethod!(Node) getOwner; 92 @GodotName("remove_and_skip") GodotMethod!(void) removeAndSkip; 93 @GodotName("get_index") GodotMethod!(long) getIndex; 94 @GodotName("print_tree") GodotMethod!(void) printTree; 95 @GodotName("print_tree_pretty") GodotMethod!(void) printTreePretty; 96 @GodotName("set_filename") GodotMethod!(void, String) setFilename; 97 @GodotName("get_filename") GodotMethod!(String) getFilename; 98 @GodotName("propagate_notification") GodotMethod!(void, long) propagateNotification; 99 @GodotName("propagate_call") GodotMethod!(void, String, Array, bool) propagateCall; 100 @GodotName("set_physics_process") GodotMethod!(void, bool) setPhysicsProcess; 101 @GodotName("get_physics_process_delta_time") GodotMethod!(double) getPhysicsProcessDeltaTime; 102 @GodotName("is_physics_processing") GodotMethod!(bool) isPhysicsProcessing; 103 @GodotName("get_process_delta_time") GodotMethod!(double) getProcessDeltaTime; 104 @GodotName("set_process") GodotMethod!(void, bool) setProcess; 105 @GodotName("set_process_priority") GodotMethod!(void, long) setProcessPriority; 106 @GodotName("is_processing") GodotMethod!(bool) isProcessing; 107 @GodotName("set_process_input") GodotMethod!(void, bool) setProcessInput; 108 @GodotName("is_processing_input") GodotMethod!(bool) isProcessingInput; 109 @GodotName("set_process_unhandled_input") GodotMethod!(void, bool) setProcessUnhandledInput; 110 @GodotName("is_processing_unhandled_input") GodotMethod!(bool) isProcessingUnhandledInput; 111 @GodotName("set_process_unhandled_key_input") GodotMethod!(void, bool) setProcessUnhandledKeyInput; 112 @GodotName("is_processing_unhandled_key_input") GodotMethod!(bool) isProcessingUnhandledKeyInput; 113 @GodotName("set_pause_mode") GodotMethod!(void, long) setPauseMode; 114 @GodotName("get_pause_mode") GodotMethod!(Node.PauseMode) getPauseMode; 115 @GodotName("can_process") GodotMethod!(bool) canProcess; 116 @GodotName("print_stray_nodes") GodotMethod!(void) printStrayNodes; 117 @GodotName("get_position_in_parent") GodotMethod!(long) getPositionInParent; 118 @GodotName("set_display_folded") GodotMethod!(void, bool) setDisplayFolded; 119 @GodotName("is_displayed_folded") GodotMethod!(bool) isDisplayedFolded; 120 @GodotName("set_process_internal") GodotMethod!(void, bool) setProcessInternal; 121 @GodotName("is_processing_internal") GodotMethod!(bool) isProcessingInternal; 122 @GodotName("set_physics_process_internal") GodotMethod!(void, bool) setPhysicsProcessInternal; 123 @GodotName("is_physics_processing_internal") GodotMethod!(bool) isPhysicsProcessingInternal; 124 @GodotName("get_tree") GodotMethod!(SceneTree) getTree; 125 @GodotName("duplicate") GodotMethod!(Node, long) duplicate; 126 @GodotName("replace_by") GodotMethod!(void, GodotObject, bool) replaceBy; 127 @GodotName("set_scene_instance_load_placeholder") GodotMethod!(void, bool) setSceneInstanceLoadPlaceholder; 128 @GodotName("get_scene_instance_load_placeholder") GodotMethod!(bool) getSceneInstanceLoadPlaceholder; 129 @GodotName("get_viewport") GodotMethod!(Viewport) getViewport; 130 @GodotName("queue_free") GodotMethod!(void) queueFree; 131 @GodotName("request_ready") GodotMethod!(void) requestReady; 132 @GodotName("set_network_master") GodotMethod!(void, long, bool) setNetworkMaster; 133 @GodotName("get_network_master") GodotMethod!(long) getNetworkMaster; 134 @GodotName("is_network_master") GodotMethod!(bool) isNetworkMaster; 135 @GodotName("get_multiplayer") GodotMethod!(MultiplayerAPI) getMultiplayer; 136 @GodotName("get_custom_multiplayer") GodotMethod!(MultiplayerAPI) getCustomMultiplayer; 137 @GodotName("set_custom_multiplayer") GodotMethod!(void, MultiplayerAPI) setCustomMultiplayer; 138 @GodotName("rpc_config") GodotMethod!(void, String, long) rpcConfig; 139 @GodotName("rset_config") GodotMethod!(void, String, long) rsetConfig; 140 @GodotName("_set_import_path") GodotMethod!(void, NodePath) _setImportPath; 141 @GodotName("_get_import_path") GodotMethod!(NodePath) _getImportPath; 142 @GodotName("rpc") GodotMethod!(Variant, String, GodotVarArgs) rpc; 143 @GodotName("rpc_unreliable") GodotMethod!(Variant, String, GodotVarArgs) rpcUnreliable; 144 @GodotName("rpc_id") GodotMethod!(Variant, long, String, GodotVarArgs) rpcId; 145 @GodotName("rpc_unreliable_id") GodotMethod!(Variant, long, String, GodotVarArgs) rpcUnreliableId; 146 @GodotName("rset") GodotMethod!(void, String, Variant) rset; 147 @GodotName("rset_id") GodotMethod!(void, long, String, Variant) rsetId; 148 @GodotName("rset_unreliable") GodotMethod!(void, String, Variant) rsetUnreliable; 149 @GodotName("rset_unreliable_id") GodotMethod!(void, long, String, Variant) rsetUnreliableId; 150 } 151 bool opEquals(in Node other) const { return _godot_object.ptr is other._godot_object.ptr; } 152 Node opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 153 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 154 mixin baseCasts; 155 static Node _new() 156 { 157 static godot_class_constructor constructor; 158 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Node"); 159 if(constructor is null) return typeof(this).init; 160 return cast(Node)(constructor()); 161 } 162 @disable new(size_t s); 163 /// 164 enum PauseMode : int 165 { 166 /** 167 Inherits pause mode from the node's parent. For the root node, it is equivalent to PAUSE_MODE_STOP. Default. 168 */ 169 pauseModeInherit = 0, 170 /** 171 Stop processing when the $(D SceneTree) is paused. 172 */ 173 pauseModeStop = 1, 174 /** 175 Continue to process regardless of the $(D SceneTree) pause state. 176 */ 177 pauseModeProcess = 2, 178 } 179 /// 180 enum DuplicateFlags : int 181 { 182 /** 183 Duplicate the node's signals. 184 */ 185 duplicateSignals = 1, 186 /** 187 Duplicate the node's groups. 188 */ 189 duplicateGroups = 2, 190 /** 191 Duplicate the node's scripts. 192 */ 193 duplicateScripts = 4, 194 /** 195 Duplicate using instancing. 196 */ 197 duplicateUseInstancing = 8, 198 } 199 /// 200 enum Constants : int 201 { 202 pauseModeInherit = 0, 203 duplicateSignals = 1, 204 pauseModeStop = 1, 205 duplicateGroups = 2, 206 pauseModeProcess = 2, 207 duplicateScripts = 4, 208 duplicateUseInstancing = 8, 209 /** 210 Notification received when the node enters a $(D SceneTree). 211 */ 212 notificationEnterTree = 10, 213 /** 214 Notification received when the node is about to exit a $(D SceneTree). 215 */ 216 notificationExitTree = 11, 217 /** 218 Notification received when the node is moved in the parent. 219 */ 220 notificationMovedInParent = 12, 221 /** 222 Notification received when the node is ready. See $(D _ready). 223 */ 224 notificationReady = 13, 225 /** 226 Notification received when the node is paused. 227 */ 228 notificationPaused = 14, 229 /** 230 Notification received when the node is unpaused. 231 */ 232 notificationUnpaused = 15, 233 /** 234 Notification received every frame when the physics process flag is set (see $(D setPhysicsProcess)). 235 */ 236 notificationPhysicsProcess = 16, 237 /** 238 Notification received every frame when the process flag is set (see $(D setProcess)). 239 */ 240 notificationProcess = 17, 241 /** 242 Notification received when a node is set as a child of another node. Note that this doesn't mean that a node entered the Scene Tree. 243 */ 244 notificationParented = 18, 245 /** 246 Notification received when a node is unparented (parent removed it from the list of children). 247 */ 248 notificationUnparented = 19, 249 /** 250 Notification received when the node is instanced. 251 */ 252 notificationInstanced = 20, 253 /** 254 Notification received when a drag begins. 255 */ 256 notificationDragBegin = 21, 257 /** 258 Notification received when a drag ends. 259 */ 260 notificationDragEnd = 22, 261 /** 262 Notification received when the node's $(D NodePath) changed. 263 */ 264 notificationPathChanged = 23, 265 /** 266 Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like $(D GodotObject.tr). 267 */ 268 notificationTranslationChanged = 24, 269 /** 270 Notification received every frame when the internal process flag is set (see $(D setProcessInternal)). 271 */ 272 notificationInternalProcess = 25, 273 /** 274 Notification received every frame when the internal physics process flag is set (see $(D setPhysicsProcessInternal)). 275 */ 276 notificationInternalPhysicsProcess = 26, 277 } 278 /** 279 Called during the processing step of the main loop. Processing happens at every frame and as fast as possible, so the `delta` time since the previous frame is not constant. 280 It is only called if processing is enabled, which is done automatically if this method is overridden, and can be toggled with $(D setProcess). 281 Corresponds to the NOTIFICATION_PROCESS notification in $(D GodotObject._notification). 282 */ 283 void _process(in double delta) 284 { 285 Array _GODOT_args = Array.empty_array; 286 _GODOT_args.append(delta); 287 String _GODOT_method_name = String("_process"); 288 this.callv(_GODOT_method_name, _GODOT_args); 289 } 290 /** 291 Called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the `delta` variable should be constant. 292 It is only called if physics processing is enabled, which is done automatically if this method is overridden, and can be toggled with $(D setPhysicsProcess). 293 Corresponds to the NOTIFICATION_PHYSICS_PROCESS notification in $(D GodotObject._notification). 294 */ 295 void _physicsProcess(in double delta) 296 { 297 Array _GODOT_args = Array.empty_array; 298 _GODOT_args.append(delta); 299 String _GODOT_method_name = String("_physics_process"); 300 this.callv(_GODOT_method_name, _GODOT_args); 301 } 302 /** 303 Called when the node enters the $(D SceneTree) (e.g. upon instancing, scene changing, or after calling $(D addChild) in a script). If the node has children, its $(D _enterTree) callback will be called first, and then that of the children. 304 Corresponds to the NOTIFICATION_ENTER_TREE notification in $(D GodotObject._notification). 305 */ 306 void _enterTree() 307 { 308 Array _GODOT_args = Array.empty_array; 309 String _GODOT_method_name = String("_enter_tree"); 310 this.callv(_GODOT_method_name, _GODOT_args); 311 } 312 /** 313 Called when the node is about to leave the $(D SceneTree) (e.g. upon freeing, scene changing, or after calling $(D removeChild) in a script). If the node has children, its $(D _exitTree) callback will be called last, after all its children have left the tree. 314 Corresponds to the NOTIFICATION_EXIT_TREE notification in $(D GodotObject._notification) and signal $(D treeExiting). To get notified when the node has already left the active tree, connect to the $(D treeExited) 315 */ 316 void _exitTree() 317 { 318 Array _GODOT_args = Array.empty_array; 319 String _GODOT_method_name = String("_exit_tree"); 320 this.callv(_GODOT_method_name, _GODOT_args); 321 } 322 /** 323 Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their $(D _ready) callbacks get triggered first, and the parent node will receive the ready notification afterwards. 324 Corresponds to the NOTIFICATION_READY notification in $(D GodotObject._notification). See also the `onready` keyword for variables. 325 Usually used for initialization. For even earlier initialization, $(D GodotObject._init) may be used. Also see $(D _enterTree). 326 */ 327 void _ready() 328 { 329 Array _GODOT_args = Array.empty_array; 330 String _GODOT_method_name = String("_ready"); 331 this.callv(_GODOT_method_name, _GODOT_args); 332 } 333 /** 334 Called when there is an input event. The input event propagates up through the node tree until a node consumes it. 335 It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with $(D setProcessInput). 336 To consume the input event and stop it propagating further to other nodes, $(D SceneTree.setInputAsHandled) can be called. 337 For gameplay input, $(D _unhandledInput) and $(D _unhandledKeyInput) are usually a better fit as they allow the GUI to intercept the events first. 338 */ 339 void _input(InputEvent event) 340 { 341 Array _GODOT_args = Array.empty_array; 342 _GODOT_args.append(event); 343 String _GODOT_method_name = String("_input"); 344 this.callv(_GODOT_method_name, _GODOT_args); 345 } 346 /** 347 Called when an $(D InputEvent) hasn't been consumed by $(D _input) or any GUI. The input event propagates up through the node tree until a node consumes it. 348 It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with $(D setProcessUnhandledInput). 349 To consume the input event and stop it propagating further to other nodes, $(D SceneTree.setInputAsHandled) can be called. 350 For gameplay input, this and $(D _unhandledKeyInput) are usually a better fit than $(D _input) as they allow the GUI to intercept the events first. 351 */ 352 void _unhandledInput(InputEvent event) 353 { 354 Array _GODOT_args = Array.empty_array; 355 _GODOT_args.append(event); 356 String _GODOT_method_name = String("_unhandled_input"); 357 this.callv(_GODOT_method_name, _GODOT_args); 358 } 359 /** 360 Called when an $(D InputEventKey) hasn't been consumed by $(D _input) or any GUI. The input event propagates up through the node tree until a node consumes it. 361 It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with $(D setProcessUnhandledKeyInput). 362 To consume the input event and stop it propagating further to other nodes, $(D SceneTree.setInputAsHandled) can be called. 363 For gameplay input, this and $(D _unhandledInput) are usually a better fit than $(D _input) as they allow the GUI to intercept the events first. 364 */ 365 void _unhandledKeyInput(InputEventKey event) 366 { 367 Array _GODOT_args = Array.empty_array; 368 _GODOT_args.append(event); 369 String _GODOT_method_name = String("_unhandled_key_input"); 370 this.callv(_GODOT_method_name, _GODOT_args); 371 } 372 /** 373 374 */ 375 String _getConfigurationWarning() 376 { 377 Array _GODOT_args = Array.empty_array; 378 String _GODOT_method_name = String("_get_configuration_warning"); 379 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!String); 380 } 381 /** 382 Adds a child node. The child is placed below the given node in the list of children. 383 Setting "legible_unique_name" `true` creates child nodes with human-readable names, based on the name of the node being instanced instead of its type. 384 */ 385 void addChildBelowNode(GodotObject node, GodotObject child_node, in bool legible_unique_name = false) 386 { 387 checkClassBinding!(typeof(this))(); 388 ptrcall!(void)(_classBinding.addChildBelowNode, _godot_object, node, child_node, legible_unique_name); 389 } 390 /** 391 392 */ 393 void setName(StringArg0)(in StringArg0 name) 394 { 395 checkClassBinding!(typeof(this))(); 396 ptrcall!(void)(_classBinding.setName, _godot_object, name); 397 } 398 /** 399 400 */ 401 String getName() const 402 { 403 checkClassBinding!(typeof(this))(); 404 return ptrcall!(String)(_classBinding.getName, _godot_object); 405 } 406 /** 407 Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node. 408 Setting "legible_unique_name" `true` creates child nodes with human-readable names, based on the name of the node being instanced instead of its type. 409 */ 410 void addChild(GodotObject node, in bool legible_unique_name = false) 411 { 412 checkClassBinding!(typeof(this))(); 413 ptrcall!(void)(_classBinding.addChild, _godot_object, node, legible_unique_name); 414 } 415 /** 416 Removes a child node. The node is NOT deleted and must be deleted manually. 417 */ 418 void removeChild(GodotObject node) 419 { 420 checkClassBinding!(typeof(this))(); 421 ptrcall!(void)(_classBinding.removeChild, _godot_object, node); 422 } 423 /** 424 Returns the number of child nodes. 425 */ 426 long getChildCount() const 427 { 428 checkClassBinding!(typeof(this))(); 429 return ptrcall!(long)(_classBinding.getChildCount, _godot_object); 430 } 431 /** 432 Returns an array of references to node's children. 433 */ 434 Array getChildren() const 435 { 436 checkClassBinding!(typeof(this))(); 437 return ptrcall!(Array)(_classBinding.getChildren, _godot_object); 438 } 439 /** 440 Returns a child node by its index (see $(D getChildCount)). This method is often used for iterating all children of a node. 441 To access a child node via its name, use $(D getNode). 442 */ 443 Node getChild(in long idx) const 444 { 445 checkClassBinding!(typeof(this))(); 446 return ptrcall!(Node)(_classBinding.getChild, _godot_object, idx); 447 } 448 /** 449 Returns `true` if the node that the $(D NodePath) points to exists. 450 */ 451 bool hasNode(NodePathArg0)(in NodePathArg0 path) const 452 { 453 checkClassBinding!(typeof(this))(); 454 return ptrcall!(bool)(_classBinding.hasNode, _godot_object, path); 455 } 456 /** 457 Fetches a node. The $(D NodePath) can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, a `null instance` is returned and attempts to access it will result in an "Attempt to call <method> on a null instance." error. 458 $(B Note:) Fetching absolute paths only works when the node is inside the scene tree (see $(D isInsideTree)). 459 $(B Example:) Assume your current node is Character and the following tree: 460 461 462 /root 463 /root/Character 464 /root/Character/Sword 465 /root/Character/Backpack/Dagger 466 /root/MyGame 467 /root/Swamp/Alligator 468 /root/Swamp/Mosquito 469 /root/Swamp/Goblin 470 471 472 Possible paths are: 473 474 475 get_node("Sword") 476 get_node("Backpack/Dagger") 477 get_node("../Swamp/Alligator") 478 get_node("/root/MyGame") 479 480 481 */ 482 Node getNode(NodePathArg0)(in NodePathArg0 path) const 483 { 484 checkClassBinding!(typeof(this))(); 485 return ptrcall!(Node)(_classBinding.getNode, _godot_object, path); 486 } 487 /** 488 Returns the parent node of the current node, or an empty `Node` if the node lacks a parent. 489 */ 490 Node getParent() const 491 { 492 checkClassBinding!(typeof(this))(); 493 return ptrcall!(Node)(_classBinding.getParent, _godot_object); 494 } 495 /** 496 Finds a descendant of this node whose name matches `mask` as in $(D String.match) (i.e. case sensitive, but '*' matches zero or more characters and '?' matches any single character except '.'). Note that it does not match against the full path, just against individual node names. 497 If `owned` is `true`, this method only finds nodes whose owner is this node. This is especially important for scenes instantiated through script, because those scenes don't have an owner. 498 */ 499 Node findNode(StringArg0)(in StringArg0 mask, in bool recursive = true, in bool owned = true) const 500 { 501 checkClassBinding!(typeof(this))(); 502 return ptrcall!(Node)(_classBinding.findNode, _godot_object, mask, recursive, owned); 503 } 504 /** 505 Finds the first parent of the current node whose name matches `mask` as in $(D String.match) (i.e. case sensitive, but '*' matches zero or more characters and '?' matches any single character except '.'). Note that it does not match against the full path, just against individual node names. 506 */ 507 Node findParent(StringArg0)(in StringArg0 mask) const 508 { 509 checkClassBinding!(typeof(this))(); 510 return ptrcall!(Node)(_classBinding.findParent, _godot_object, mask); 511 } 512 /** 513 514 */ 515 bool hasNodeAndResource(NodePathArg0)(in NodePathArg0 path) const 516 { 517 checkClassBinding!(typeof(this))(); 518 return ptrcall!(bool)(_classBinding.hasNodeAndResource, _godot_object, path); 519 } 520 /** 521 522 */ 523 Array getNodeAndResource(NodePathArg0)(in NodePathArg0 path) 524 { 525 checkClassBinding!(typeof(this))(); 526 return ptrcall!(Array)(_classBinding.getNodeAndResource, _godot_object, path); 527 } 528 /** 529 Returns `true` if this node is currently inside a $(D SceneTree). 530 */ 531 bool isInsideTree() const 532 { 533 checkClassBinding!(typeof(this))(); 534 return ptrcall!(bool)(_classBinding.isInsideTree, _godot_object); 535 } 536 /** 537 Returns `true` if the given node is a direct or indirect child of the current node. 538 */ 539 bool isAParentOf(GodotObject node) const 540 { 541 checkClassBinding!(typeof(this))(); 542 return ptrcall!(bool)(_classBinding.isAParentOf, _godot_object, node); 543 } 544 /** 545 Returns `true` if the given node occurs later in the scene hierarchy than the current node. 546 */ 547 bool isGreaterThan(GodotObject node) const 548 { 549 checkClassBinding!(typeof(this))(); 550 return ptrcall!(bool)(_classBinding.isGreaterThan, _godot_object, node); 551 } 552 /** 553 Returns the absolute path of the current node. This only works if the current node is inside the scene tree (see $(D isInsideTree)). 554 */ 555 NodePath getPath() const 556 { 557 checkClassBinding!(typeof(this))(); 558 return ptrcall!(NodePath)(_classBinding.getPath, _godot_object); 559 } 560 /** 561 Returns the relative $(D NodePath) from this node to the specified `node`. Both nodes must be in the same scene or the function will fail. 562 */ 563 NodePath getPathTo(GodotObject node) const 564 { 565 checkClassBinding!(typeof(this))(); 566 return ptrcall!(NodePath)(_classBinding.getPathTo, _godot_object, node); 567 } 568 /** 569 Adds the node to a group. Groups are helpers to name and organize a subset of nodes, for example "enemies" or "collectables". A node can be in any number of groups. Nodes can be assigned a group at any time, but will not be added until they are inside the scene tree (see $(D isInsideTree)). See notes in the description, and the group methods in $(D SceneTree). 570 */ 571 void addToGroup(StringArg0)(in StringArg0 group, in bool persistent = false) 572 { 573 checkClassBinding!(typeof(this))(); 574 ptrcall!(void)(_classBinding.addToGroup, _godot_object, group, persistent); 575 } 576 /** 577 Removes a node from a group. See notes in the description, and the group methods in $(D SceneTree). 578 */ 579 void removeFromGroup(StringArg0)(in StringArg0 group) 580 { 581 checkClassBinding!(typeof(this))(); 582 ptrcall!(void)(_classBinding.removeFromGroup, _godot_object, group); 583 } 584 /** 585 Returns `true` if this node is in the specified group. See notes in the description, and the group methods in $(D SceneTree). 586 */ 587 bool isInGroup(StringArg0)(in StringArg0 group) const 588 { 589 checkClassBinding!(typeof(this))(); 590 return ptrcall!(bool)(_classBinding.isInGroup, _godot_object, group); 591 } 592 /** 593 Moves a child node to a different position (order) amongst the other children. Since calls, signals, etc are performed by tree order, changing the order of children nodes may be useful. 594 */ 595 void moveChild(GodotObject child_node, in long to_position) 596 { 597 checkClassBinding!(typeof(this))(); 598 ptrcall!(void)(_classBinding.moveChild, _godot_object, child_node, to_position); 599 } 600 /** 601 Returns an array listing the groups that the node is a member of. 602 */ 603 Array getGroups() const 604 { 605 checkClassBinding!(typeof(this))(); 606 return ptrcall!(Array)(_classBinding.getGroups, _godot_object); 607 } 608 /** 609 Moves this node to the top of the array of nodes of the parent node. This is often useful in GUIs ($(D Control) nodes), because their order of drawing depends on their order in the tree. 610 */ 611 void raise() 612 { 613 checkClassBinding!(typeof(this))(); 614 ptrcall!(void)(_classBinding.raise, _godot_object); 615 } 616 /** 617 618 */ 619 void setOwner(GodotObject owner) 620 { 621 checkClassBinding!(typeof(this))(); 622 ptrcall!(void)(_classBinding.setOwner, _godot_object, owner); 623 } 624 /** 625 626 */ 627 Node getOwner() const 628 { 629 checkClassBinding!(typeof(this))(); 630 return ptrcall!(Node)(_classBinding.getOwner, _godot_object); 631 } 632 /** 633 Removes a node and sets all its children as children of the parent node (if it exists). All event subscriptions that pass by the removed node will be unsubscribed. 634 */ 635 void removeAndSkip() 636 { 637 checkClassBinding!(typeof(this))(); 638 ptrcall!(void)(_classBinding.removeAndSkip, _godot_object); 639 } 640 /** 641 Returns the node's index, i.e. its position among the siblings of its parent. 642 */ 643 long getIndex() const 644 { 645 checkClassBinding!(typeof(this))(); 646 return ptrcall!(long)(_classBinding.getIndex, _godot_object); 647 } 648 /** 649 Prints the tree to stdout. Used mainly for debugging purposes. This version displays the path relative to the current node, and is good for copy/pasting into the $(D getNode) function. Example output: 650 651 652 TheGame 653 TheGame/Menu 654 TheGame/Menu/Label 655 TheGame/Menu/Camera2D 656 TheGame/SplashScreen 657 TheGame/SplashScreen/Camera2D 658 659 660 */ 661 void printTree() 662 { 663 checkClassBinding!(typeof(this))(); 664 ptrcall!(void)(_classBinding.printTree, _godot_object); 665 } 666 /** 667 Similar to $(D printTree), this prints the tree to stdout. This version displays a more graphical representation similar to what is displayed in the scene inspector. It is useful for inspecting larger trees. Example output: 668 669 670 ┖╴TheGame 671 ┠╴Menu 672 ┃ ┠╴Label 673 ┃ ┖╴Camera2D 674 ┖-SplashScreen 675 ┖╴Camera2D 676 677 678 */ 679 void printTreePretty() 680 { 681 checkClassBinding!(typeof(this))(); 682 ptrcall!(void)(_classBinding.printTreePretty, _godot_object); 683 } 684 /** 685 686 */ 687 void setFilename(StringArg0)(in StringArg0 filename) 688 { 689 checkClassBinding!(typeof(this))(); 690 ptrcall!(void)(_classBinding.setFilename, _godot_object, filename); 691 } 692 /** 693 694 */ 695 String getFilename() const 696 { 697 checkClassBinding!(typeof(this))(); 698 return ptrcall!(String)(_classBinding.getFilename, _godot_object); 699 } 700 /** 701 Notifies the current node and all its children recursively by calling notification() on all of them. 702 */ 703 void propagateNotification(in long what) 704 { 705 checkClassBinding!(typeof(this))(); 706 ptrcall!(void)(_classBinding.propagateNotification, _godot_object, what); 707 } 708 /** 709 Calls the given method (if present) with the arguments given in `args` on this node and recursively on all its children. If the parent_first argument is `true` then the method will be called on the current node first, then on all children. If it is `false` then the children will be called first. 710 */ 711 void propagateCall(StringArg0)(in StringArg0 method, in Array args = Array.empty_array, in bool parent_first = false) 712 { 713 checkClassBinding!(typeof(this))(); 714 ptrcall!(void)(_classBinding.propagateCall, _godot_object, method, args, parent_first); 715 } 716 /** 717 Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a NOTIFICATION_PHYSICS_PROCESS at a fixed (usually 60 fps, see $(D OS) to change) interval (and the $(D _physicsProcess) callback will be called if exists). Enabled automatically if $(D _physicsProcess) is overridden. Any calls to this before $(D _ready) will be ignored. 718 */ 719 void setPhysicsProcess(in bool enable) 720 { 721 checkClassBinding!(typeof(this))(); 722 ptrcall!(void)(_classBinding.setPhysicsProcess, _godot_object, enable); 723 } 724 /** 725 Returns the time elapsed since the last physics-bound frame (see $(D _physicsProcess)). This is always a constant value in physics processing unless the frames per second is changed in $(D OS). 726 */ 727 double getPhysicsProcessDeltaTime() const 728 { 729 checkClassBinding!(typeof(this))(); 730 return ptrcall!(double)(_classBinding.getPhysicsProcessDeltaTime, _godot_object); 731 } 732 /** 733 Returns `true` if physics processing is enabled (see $(D setPhysicsProcess)). 734 */ 735 bool isPhysicsProcessing() const 736 { 737 checkClassBinding!(typeof(this))(); 738 return ptrcall!(bool)(_classBinding.isPhysicsProcessing, _godot_object); 739 } 740 /** 741 Returns the time elapsed (in seconds) since the last process callback. This value may vary from frame to frame. 742 */ 743 double getProcessDeltaTime() const 744 { 745 checkClassBinding!(typeof(this))(); 746 return ptrcall!(double)(_classBinding.getProcessDeltaTime, _godot_object); 747 } 748 /** 749 Enables or disables processing. When a node is being processed, it will receive a NOTIFICATION_PROCESS on every drawn frame (and the $(D _process) callback will be called if exists). Enabled automatically if $(D _process) is overridden. Any calls to this before $(D _ready) will be ignored. 750 */ 751 void setProcess(in bool enable) 752 { 753 checkClassBinding!(typeof(this))(); 754 ptrcall!(void)(_classBinding.setProcess, _godot_object, enable); 755 } 756 /** 757 758 */ 759 void setProcessPriority(in long priority) 760 { 761 checkClassBinding!(typeof(this))(); 762 ptrcall!(void)(_classBinding.setProcessPriority, _godot_object, priority); 763 } 764 /** 765 Returns `true` if processing is enabled (see $(D setProcess)). 766 */ 767 bool isProcessing() const 768 { 769 checkClassBinding!(typeof(this))(); 770 return ptrcall!(bool)(_classBinding.isProcessing, _godot_object); 771 } 772 /** 773 Enables or disables input processing. This is not required for GUI controls! Enabled automatically if $(D _input) is overridden. Any calls to this before $(D _ready) will be ignored. 774 */ 775 void setProcessInput(in bool enable) 776 { 777 checkClassBinding!(typeof(this))(); 778 ptrcall!(void)(_classBinding.setProcessInput, _godot_object, enable); 779 } 780 /** 781 Returns `true` if the node is processing input (see $(D setProcessInput)). 782 */ 783 bool isProcessingInput() const 784 { 785 checkClassBinding!(typeof(this))(); 786 return ptrcall!(bool)(_classBinding.isProcessingInput, _godot_object); 787 } 788 /** 789 Enables unhandled input processing. This is not required for GUI controls! It enables the node to receive all input that was not previously handled (usually by a $(D Control)). Enabled automatically if $(D _unhandledInput) is overridden. Any calls to this before $(D _ready) will be ignored. 790 */ 791 void setProcessUnhandledInput(in bool enable) 792 { 793 checkClassBinding!(typeof(this))(); 794 ptrcall!(void)(_classBinding.setProcessUnhandledInput, _godot_object, enable); 795 } 796 /** 797 Returns `true` if the node is processing unhandled input (see $(D setProcessUnhandledInput)). 798 */ 799 bool isProcessingUnhandledInput() const 800 { 801 checkClassBinding!(typeof(this))(); 802 return ptrcall!(bool)(_classBinding.isProcessingUnhandledInput, _godot_object); 803 } 804 /** 805 Enables unhandled key input processing. Enabled automatically if $(D _unhandledKeyInput) is overridden. Any calls to this before $(D _ready) will be ignored. 806 */ 807 void setProcessUnhandledKeyInput(in bool enable) 808 { 809 checkClassBinding!(typeof(this))(); 810 ptrcall!(void)(_classBinding.setProcessUnhandledKeyInput, _godot_object, enable); 811 } 812 /** 813 Returns `true` if the node is processing unhandled key input (see $(D setProcessUnhandledKeyInput)). 814 */ 815 bool isProcessingUnhandledKeyInput() const 816 { 817 checkClassBinding!(typeof(this))(); 818 return ptrcall!(bool)(_classBinding.isProcessingUnhandledKeyInput, _godot_object); 819 } 820 /** 821 822 */ 823 void setPauseMode(in long mode) 824 { 825 checkClassBinding!(typeof(this))(); 826 ptrcall!(void)(_classBinding.setPauseMode, _godot_object, mode); 827 } 828 /** 829 830 */ 831 Node.PauseMode getPauseMode() const 832 { 833 checkClassBinding!(typeof(this))(); 834 return ptrcall!(Node.PauseMode)(_classBinding.getPauseMode, _godot_object); 835 } 836 /** 837 Returns `true` if the node can process while the scene tree is paused (see $(D setPauseMode)). Always returns `true` if the scene tree is not paused, and `false` if the node is not in the tree. FIXME: Why FAIL_COND? 838 */ 839 bool canProcess() const 840 { 841 checkClassBinding!(typeof(this))(); 842 return ptrcall!(bool)(_classBinding.canProcess, _godot_object); 843 } 844 /** 845 Prints all stray nodes (nodes outside the $(D SceneTree)). Used for debugging. Works only in debug builds. 846 */ 847 void printStrayNodes() 848 { 849 checkClassBinding!(typeof(this))(); 850 ptrcall!(void)(_classBinding.printStrayNodes, _godot_object); 851 } 852 /** 853 Returns the node's order in the scene tree branch. For example, if called on the first child node the position is `0`. 854 */ 855 long getPositionInParent() const 856 { 857 checkClassBinding!(typeof(this))(); 858 return ptrcall!(long)(_classBinding.getPositionInParent, _godot_object); 859 } 860 /** 861 Sets the folded state of the node in the Scene dock. 862 */ 863 void setDisplayFolded(in bool fold) 864 { 865 checkClassBinding!(typeof(this))(); 866 ptrcall!(void)(_classBinding.setDisplayFolded, _godot_object, fold); 867 } 868 /** 869 Returns `true` if the node is folded (collapsed) in the Scene dock. 870 */ 871 bool isDisplayedFolded() const 872 { 873 checkClassBinding!(typeof(this))(); 874 return ptrcall!(bool)(_classBinding.isDisplayedFolded, _godot_object); 875 } 876 /** 877 Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal $(D _process) calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting ($(D setProcess)). Only useful for advanced uses to manipulate built-in nodes behaviour. 878 */ 879 void setProcessInternal(in bool enable) 880 { 881 checkClassBinding!(typeof(this))(); 882 ptrcall!(void)(_classBinding.setProcessInternal, _godot_object, enable); 883 } 884 /** 885 Returns `true` if internal processing is enabled (see $(D setProcessInternal)). 886 */ 887 bool isProcessingInternal() const 888 { 889 checkClassBinding!(typeof(this))(); 890 return ptrcall!(bool)(_classBinding.isProcessingInternal, _godot_object); 891 } 892 /** 893 Enables or disables internal physics for this node. Internal physics processing happens in isolation from the normal $(D _physicsProcess) calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting ($(D setPhysicsProcess)). Only useful for advanced uses to manipulate built-in nodes behaviour. 894 */ 895 void setPhysicsProcessInternal(in bool enable) 896 { 897 checkClassBinding!(typeof(this))(); 898 ptrcall!(void)(_classBinding.setPhysicsProcessInternal, _godot_object, enable); 899 } 900 /** 901 Returns `true` if internal physics processing is enabled (see $(D setPhysicsProcessInternal)). 902 */ 903 bool isPhysicsProcessingInternal() const 904 { 905 checkClassBinding!(typeof(this))(); 906 return ptrcall!(bool)(_classBinding.isPhysicsProcessingInternal, _godot_object); 907 } 908 /** 909 Returns the $(D SceneTree) that contains this node. 910 */ 911 SceneTree getTree() const 912 { 913 checkClassBinding!(typeof(this))(); 914 return ptrcall!(SceneTree)(_classBinding.getTree, _godot_object); 915 } 916 /** 917 Duplicates the node, returning a new node. 918 You can fine-tune the behavior using the `flags`. See DUPLICATE_* constants. 919 */ 920 Node duplicate(in long flags = 15) const 921 { 922 checkClassBinding!(typeof(this))(); 923 return ptrcall!(Node)(_classBinding.duplicate, _godot_object, flags); 924 } 925 /** 926 Replaces a node in a scene by the given one. Subscriptions that pass through this node will be lost. 927 */ 928 void replaceBy(GodotObject node, in bool keep_data = false) 929 { 930 checkClassBinding!(typeof(this))(); 931 ptrcall!(void)(_classBinding.replaceBy, _godot_object, node, keep_data); 932 } 933 /** 934 Sets whether this is an instance load placeholder. See $(D InstancePlaceholder). 935 */ 936 void setSceneInstanceLoadPlaceholder(in bool load_placeholder) 937 { 938 checkClassBinding!(typeof(this))(); 939 ptrcall!(void)(_classBinding.setSceneInstanceLoadPlaceholder, _godot_object, load_placeholder); 940 } 941 /** 942 Returns `true` if this is an instance load placeholder. See $(D InstancePlaceholder). 943 */ 944 bool getSceneInstanceLoadPlaceholder() const 945 { 946 checkClassBinding!(typeof(this))(); 947 return ptrcall!(bool)(_classBinding.getSceneInstanceLoadPlaceholder, _godot_object); 948 } 949 /** 950 Returns the node's $(D Viewport). 951 */ 952 Viewport getViewport() const 953 { 954 checkClassBinding!(typeof(this))(); 955 return ptrcall!(Viewport)(_classBinding.getViewport, _godot_object); 956 } 957 /** 958 Queues a node for deletion at the end of the current frame. When deleted, all of its child nodes will be deleted as well. This method ensures it's safe to delete the node, contrary to $(D GodotObject.free). Use $(D GodotObject.isQueuedForDeletion) to check whether a node will be deleted at the end of the frame. 959 */ 960 void queueFree() 961 { 962 checkClassBinding!(typeof(this))(); 963 ptrcall!(void)(_classBinding.queueFree, _godot_object); 964 } 965 /** 966 Requests that `_ready` be called again. 967 */ 968 void requestReady() 969 { 970 checkClassBinding!(typeof(this))(); 971 ptrcall!(void)(_classBinding.requestReady, _godot_object); 972 } 973 /** 974 Sets the node's network master to the peer with the given peer ID. The network master is the peer that has authority over the node on the network. Useful in conjunction with the `master` and `puppet` keywords. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server). If `recursive`, the given peer is recursively set as the master for all children of this node. 975 */ 976 void setNetworkMaster(in long id, in bool recursive = true) 977 { 978 checkClassBinding!(typeof(this))(); 979 ptrcall!(void)(_classBinding.setNetworkMaster, _godot_object, id, recursive); 980 } 981 /** 982 Returns the peer ID of the network master for this node. See $(D setNetworkMaster). 983 */ 984 long getNetworkMaster() const 985 { 986 checkClassBinding!(typeof(this))(); 987 return ptrcall!(long)(_classBinding.getNetworkMaster, _godot_object); 988 } 989 /** 990 Returns `true` if the local system is the master of this node. 991 */ 992 bool isNetworkMaster() const 993 { 994 checkClassBinding!(typeof(this))(); 995 return ptrcall!(bool)(_classBinding.isNetworkMaster, _godot_object); 996 } 997 /** 998 999 */ 1000 Ref!MultiplayerAPI getMultiplayer() const 1001 { 1002 checkClassBinding!(typeof(this))(); 1003 return ptrcall!(MultiplayerAPI)(_classBinding.getMultiplayer, _godot_object); 1004 } 1005 /** 1006 1007 */ 1008 Ref!MultiplayerAPI getCustomMultiplayer() const 1009 { 1010 checkClassBinding!(typeof(this))(); 1011 return ptrcall!(MultiplayerAPI)(_classBinding.getCustomMultiplayer, _godot_object); 1012 } 1013 /** 1014 1015 */ 1016 void setCustomMultiplayer(MultiplayerAPI api) 1017 { 1018 checkClassBinding!(typeof(this))(); 1019 ptrcall!(void)(_classBinding.setCustomMultiplayer, _godot_object, api); 1020 } 1021 /** 1022 Changes the RPC mode for the given `method` to the given `mode`. See $(D MultiplayerAPI.rpcmode). An alternative is annotating methods and properties with the corresponding keywords (`remote`, `master`, `puppet`, `remotesync`, `mastersync`, `puppetsync`). By default, methods are not exposed to networking (and RPCs). Also see $(D rset) and $(D rsetConfig) for properties. 1023 */ 1024 void rpcConfig(StringArg0)(in StringArg0 method, in long mode) 1025 { 1026 checkClassBinding!(typeof(this))(); 1027 ptrcall!(void)(_classBinding.rpcConfig, _godot_object, method, mode); 1028 } 1029 /** 1030 Changes the RPC mode for the given `property` to the given `mode`. See $(D MultiplayerAPI.rpcmode). An alternative is annotating methods and properties with the corresponding keywords (`remote`, `master`, `puppet`, `remotesync`, `mastersync`, `puppetsync`). By default, properties are not exposed to networking (and RPCs). Also see $(D rpc) and $(D rpcConfig) for methods. 1031 */ 1032 void rsetConfig(StringArg0)(in StringArg0 property, in long mode) 1033 { 1034 checkClassBinding!(typeof(this))(); 1035 ptrcall!(void)(_classBinding.rsetConfig, _godot_object, property, mode); 1036 } 1037 /** 1038 1039 */ 1040 void _setImportPath(NodePathArg0)(in NodePathArg0 import_path) 1041 { 1042 Array _GODOT_args = Array.empty_array; 1043 _GODOT_args.append(import_path); 1044 String _GODOT_method_name = String("_set_import_path"); 1045 this.callv(_GODOT_method_name, _GODOT_args); 1046 } 1047 /** 1048 1049 */ 1050 NodePath _getImportPath() const 1051 { 1052 Array _GODOT_args = Array.empty_array; 1053 String _GODOT_method_name = String("_get_import_path"); 1054 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!NodePath); 1055 } 1056 /** 1057 Sends a remote procedure call request for the given `method` to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same $(D NodePath), including the exact same node name. Behaviour depends on the RPC configuration for the given method, see $(D rpcConfig). Methods are not exposed to RPCs by default. Also see $(D rset) and $(D rsetConfig) for properties. Returns an empty $(D Variant). Note that you can only safely use RPCs on clients after you received the `connected_to_server` signal from the $(D SceneTree). You also need to keep track of the connection state, either by the $(D SceneTree) signals like `server_disconnected` or by checking `SceneTree.network_peer.get_connection_status() == CONNECTION_CONNECTED`. 1058 */ 1059 Variant rpc(StringArg0, VarArgs...)(in StringArg0 method, VarArgs varArgs) 1060 { 1061 Array _GODOT_args = Array.empty_array; 1062 _GODOT_args.append(method); 1063 foreach(vai, VA; VarArgs) 1064 { 1065 _GODOT_args.append(varArgs[vai]); 1066 } 1067 String _GODOT_method_name = String("rpc"); 1068 return this.callv(_GODOT_method_name, _GODOT_args); 1069 } 1070 /** 1071 Sends a $(D rpc) using an unreliable protocol. Returns an empty $(D Variant). 1072 */ 1073 Variant rpcUnreliable(StringArg0, VarArgs...)(in StringArg0 method, VarArgs varArgs) 1074 { 1075 Array _GODOT_args = Array.empty_array; 1076 _GODOT_args.append(method); 1077 foreach(vai, VA; VarArgs) 1078 { 1079 _GODOT_args.append(varArgs[vai]); 1080 } 1081 String _GODOT_method_name = String("rpc_unreliable"); 1082 return this.callv(_GODOT_method_name, _GODOT_args); 1083 } 1084 /** 1085 Sends a $(D rpc) to a specific peer identified by `peer_id` (see $(D NetworkedMultiplayerPeer.setTargetPeer)). Returns an empty $(D Variant). 1086 */ 1087 Variant rpcId(StringArg1, VarArgs...)(in long peer_id, in StringArg1 method, VarArgs varArgs) 1088 { 1089 Array _GODOT_args = Array.empty_array; 1090 _GODOT_args.append(peer_id); 1091 _GODOT_args.append(method); 1092 foreach(vai, VA; VarArgs) 1093 { 1094 _GODOT_args.append(varArgs[vai]); 1095 } 1096 String _GODOT_method_name = String("rpc_id"); 1097 return this.callv(_GODOT_method_name, _GODOT_args); 1098 } 1099 /** 1100 Sends a $(D rpc) to a specific peer identified by `peer_id` using an unreliable protocol (see $(D NetworkedMultiplayerPeer.setTargetPeer)). Returns an empty $(D Variant). 1101 */ 1102 Variant rpcUnreliableId(StringArg1, VarArgs...)(in long peer_id, in StringArg1 method, VarArgs varArgs) 1103 { 1104 Array _GODOT_args = Array.empty_array; 1105 _GODOT_args.append(peer_id); 1106 _GODOT_args.append(method); 1107 foreach(vai, VA; VarArgs) 1108 { 1109 _GODOT_args.append(varArgs[vai]); 1110 } 1111 String _GODOT_method_name = String("rpc_unreliable_id"); 1112 return this.callv(_GODOT_method_name, _GODOT_args); 1113 } 1114 /** 1115 Remotely changes a property's value on other peers (and locally). Behaviour depends on the RPC configuration for the given property, see $(D rsetConfig). Also see $(D rpc) for RPCs for methods, most information applies to this method as well. 1116 */ 1117 void rset(StringArg0, VariantArg1)(in StringArg0 property, in VariantArg1 value) 1118 { 1119 checkClassBinding!(typeof(this))(); 1120 ptrcall!(void)(_classBinding.rset, _godot_object, property, value); 1121 } 1122 /** 1123 Remotely changes the property's value on a specific peer identified by `peer_id` (see $(D NetworkedMultiplayerPeer.setTargetPeer)). 1124 */ 1125 void rsetId(StringArg1, VariantArg2)(in long peer_id, in StringArg1 property, in VariantArg2 value) 1126 { 1127 checkClassBinding!(typeof(this))(); 1128 ptrcall!(void)(_classBinding.rsetId, _godot_object, peer_id, property, value); 1129 } 1130 /** 1131 Remotely changes the property's value on other peers (and locally) using an unreliable protocol. 1132 */ 1133 void rsetUnreliable(StringArg0, VariantArg1)(in StringArg0 property, in VariantArg1 value) 1134 { 1135 checkClassBinding!(typeof(this))(); 1136 ptrcall!(void)(_classBinding.rsetUnreliable, _godot_object, property, value); 1137 } 1138 /** 1139 Remotely changes property's value on a specific peer identified by `peer_id` using an unreliable protocol (see $(D NetworkedMultiplayerPeer.setTargetPeer)). 1140 */ 1141 void rsetUnreliableId(StringArg1, VariantArg2)(in long peer_id, in StringArg1 property, in VariantArg2 value) 1142 { 1143 checkClassBinding!(typeof(this))(); 1144 ptrcall!(void)(_classBinding.rsetUnreliableId, _godot_object, peer_id, property, value); 1145 } 1146 /** 1147 1148 */ 1149 @property NodePath _importPath() 1150 { 1151 return _getImportPath(); 1152 } 1153 /// ditto 1154 @property void _importPath(NodePath v) 1155 { 1156 _setImportPath(v); 1157 } 1158 /** 1159 Pause mode. How the node will behave if the $(D SceneTree) is paused. 1160 */ 1161 @property Node.PauseMode pauseMode() 1162 { 1163 return getPauseMode(); 1164 } 1165 /// ditto 1166 @property void pauseMode(long v) 1167 { 1168 setPauseMode(v); 1169 } 1170 /** 1171 1172 */ 1173 @property bool editorDisplayFolded() 1174 { 1175 return isDisplayedFolded(); 1176 } 1177 /// ditto 1178 @property void editorDisplayFolded(bool v) 1179 { 1180 setDisplayFolded(v); 1181 } 1182 /** 1183 The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed 1184 */ 1185 @property String name() 1186 { 1187 return getName(); 1188 } 1189 /// ditto 1190 @property void name(String v) 1191 { 1192 setName(v); 1193 } 1194 /** 1195 When a scene is instanced from a file, its topmost node contains the filename from which it was loaded. 1196 */ 1197 @property String filename() 1198 { 1199 return getFilename(); 1200 } 1201 /// ditto 1202 @property void filename(String v) 1203 { 1204 setFilename(v); 1205 } 1206 /** 1207 The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using $(D PackedScene)) all the nodes it owns will be saved with it. This allows for the creation of complex $(D SceneTree)s, with instancing and subinstancing. 1208 */ 1209 @property Node owner() 1210 { 1211 return getOwner(); 1212 } 1213 /// ditto 1214 @property void owner(GodotObject v) 1215 { 1216 setOwner(v); 1217 } 1218 /** 1219 The $(D MultiplayerAPI) instance associated with this node. Either the $(D customMultiplayer), or the default SceneTree one (if inside tree). 1220 */ 1221 @property MultiplayerAPI multiplayer() 1222 { 1223 return getMultiplayer(); 1224 } 1225 /** 1226 The override to the default $(D MultiplayerAPI). Set to null to use the default SceneTree one. 1227 */ 1228 @property MultiplayerAPI customMultiplayer() 1229 { 1230 return getCustomMultiplayer(); 1231 } 1232 /// ditto 1233 @property void customMultiplayer(MultiplayerAPI v) 1234 { 1235 setCustomMultiplayer(v); 1236 } 1237 }