/
Object.hx
669 lines (498 loc) · 28.3 KB
/
Object.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
// Automatically generated Godot externs: DO NOT EDIT
// MIT licensed, see LICENSE.md
package godot;
import cs.system.*;
/**
Every class which is not a built-in type inherits from this class.
You can construct Objects from scripting languages, using `Object.new()` in GDScript, `new Object` in C#, or the "Construct Object" node in VisualScript.
Objects do not manage memory. If a class inherits from Object, you will have to delete instances of it manually. To do so, call the `godot.Object.free` method from your script or delete the instance from C++.
Some classes that extend Object add memory management. This is the case of `godot.Reference`, which counts references and deletes itself automatically when no longer referenced. `godot.Node`, another fundamental type, deletes all its children when freed from memory.
Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in `godot.Object._GetPropertyList` and handled in `godot.Object._Get` and `godot.Object._Set`. However, scripting languages and C++ have simpler means to export them.
Property membership can be tested directly in GDScript using `in`:
```
var n = Node2D.new()
print("position" in n) # Prints "True".
print("other_property" in n) # Prints "False".
```
The `in` operator will evaluate to `true` as long as the key exists, even if the value is `null`.
Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See `godot.Object._Notification`.
Note: Unlike references to a `godot.Reference`, references to an Object stored in a variable can become invalid without warning. Therefore, it's recommended to use `godot.Reference` for data classes instead of `godot.Object`.
Note: Due to a bug, you can't create a "plain" Object using `Object.new()`. Instead, use `ClassDB.instance("Object")`. This bug only applies to Object itself, not any of its descendents like `godot.Reference`.
**/
@:libType
@:csNative
@:native("Godot.Object")
@:autoBuild(godot.Godot.buildUserClass())
extern class Object implements cs.system.IDisposable {
/**
`script_changed` signal.
**/
public var onScriptChanged(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onScriptChanged():Signal<Void->Void> {
return new Signal(this, "script_changed", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
Gets a new `godot.DynamicGodotObject` associated with this instance.
**/
@:native("DynamicObject")
public var dynamicObject(default, never):Dynamic;
/**
The pointer to the native instance of this `godot.Object`.
**/
@:native("NativeInstance")
public var nativeInstance(default, never):cs.system.IntPtr;
/**
Called before the object is about to be deleted.
**/
@:native("NotificationPredelete")
public static var NOTIFICATION_PREDELETE(default, never):Int;
/**
Called right when the object is initialized. Not available in script.
**/
@:native("NotificationPostinitialize")
public static var NOTIFICATION_POSTINITIALIZE(default, never):Int;
/**
Returns whether `instance` is a valid object
(e.g. has not been deleted from memory).
@param instance The instance to check.
@returns If the instance is a valid object.
**/
@:native("IsInstanceValid")
public static function isInstanceValid(instance:godot.Object):Bool;
/**
Returns a weak reference to an object, or `null`
if the argument is invalid.
A weak reference to an object is not enough to keep the object alive:
when the only remaining references to a referent are weak references,
garbage collection is free to destroy the referent and reuse its memory
for something else. However, until the object is actually destroyed the
weak reference may return the object even if there are no strong references
to it.
@param obj The object.
@returns
The `godot.Object.weakRef` reference to the object or `null`.
**/
@:native("WeakRef")
public static function weakRef(obj:godot.Object):godot.WeakRef;
/**
Constructs a new `godot.Object`.
**/
@:native("new")
public function new():Void;
/**
Disposes of this `godot.Object`.
**/
@:native("Dispose")
public overload function dispose():Void;
/**
Disposes implementation of this `godot.Object`.
**/
@:native("Dispose") @:protected
public overload function dispose(disposing:Bool):Void;
/**
Converts this `godot.Object` to a string.
@returns A string representation of this object.
**/
@:native("ToString")
public function toString():std.String;
/**
Returns a new `godot.SignalAwaiter` awaiter configured to complete when the instance
`source` emits the signal specified by the `signal` parameter.
@param source
The instance the awaiter will be listening to.
@param signal
The signal the awaiter will be waiting for.
This sample prints a message once every frame up to 100 times.
```
public override void _Ready()
{
for (int i = 0; i < 100; i++)
{
await ToSignal(GetTree(), "idle_frame");
GD.Print($"Frame {i}");
}
}
```
@returns
A `godot.SignalAwaiter` that completes when
`source` emits the `signal`.
**/
@:native("ToSignal")
public function toSignal(source:godot.Object, signal:std.String):godot.SignalAwaiter;
/**
Virtual method which can be overridden to customize the return value of `godot.Object.get`.
Returns the given property. Returns `null` if the `property` does not exist.
**/
@:native("_Get")
public function _Get(property:std.String):Dynamic;
/**
Virtual method which can be overridden to customize the return value of `godot.Object.getPropertyList`.
Returns the object's property list as an `godot.Collections_Array` of dictionaries.
Each property's `godot.Collections_Dictionary` must contain at least `name: String` and `type: int` (see `godot.Variant_Type`) entries. Optionally, it can also include `hint: int` (see `godot.PropertyHint`), `hint_string: String`, and `usage: int` (see `godot.PropertyUsageFlags`).
**/
@:native("_GetPropertyList")
public function _GetPropertyList():godot.collections.Array;
/**
Called whenever the object receives a notification, which is identified in `what` by a constant. The base `godot.Object` has two constants `godot.Object.notificationPostinitialize` and `godot.Object.notificationPredelete`, but subclasses such as `godot.Node` define a lot more notifications which are also received by this method.
**/
@:native("_Notification")
public function _Notification(what:Int):Void;
/**
Virtual method which can be overridden to customize the return value of `godot.Object.set`.
Sets a property. Returns `true` if the `property` exists.
**/
@:native("_Set")
public function _Set(property:std.String, value:Dynamic):Bool;
/**
Deletes the object from memory immediately. For `godot.Node`s, you may want to use `godot.Node.queueFree` to queue the node for safe deletion at the end of the current frame.
Important: If you have a variable pointing to an object, it will not be assigned to `null` once the object is freed. Instead, it will point to a previously freed instance and you should validate it with `@GDScript.is_instance_valid` before attempting to call its methods or access its properties.
**/
@:native("Free")
public function free():Void;
/**
Returns the object's class as a `String`. See also `godot.Object.isClass`.
Note: `godot.Object.getClass` does not take `class_name` declarations into account. If the object has a `class_name` defined, the base class name will be returned instead.
**/
@:native("GetClass")
public function getClass():std.String;
/**
Returns `true` if the object inherits from the given `class`. See also `godot.Object.getClass`.
Note: `godot.Object.isClass` does not take `class_name` declarations into account. If the object has a `class_name` defined, `godot.Object.isClass` will return `false` for that name.
**/
@:native("IsClass")
public function isClass(class_:std.String):Bool;
/**
Assigns a new value to the given property. If the `property` does not exist or the given value's type doesn't match, nothing will happen.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
**/
@:native("Set")
public function set(property:std.String, value:Dynamic):Void;
/**
Returns the `Variant` value of the given `property`. If the `property` doesn't exist, this will return `null`.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
**/
@:native("Get")
public function get(property:std.String):Dynamic;
/**
Assigns a new value to the property identified by the `godot.NodePath`. The node path should be relative to the current object and can use the colon character (`:`) to access nested properties. Example:
```
set_indexed("position", Vector2(42, 0))
set_indexed("position:y", -10)
print(position) # (42, -10)
```
**/
@:native("SetIndexed")
public function setIndexed(property:godot.NodePath, value:Dynamic):Void;
/**
Gets the object's property indexed by the given `godot.NodePath`. The node path should be relative to the current object and can use the colon character (`:`) to access nested properties. Examples: `"position:x"` or `"material:next_pass:blend_mode"`.
Note: Even though the method takes `godot.NodePath` argument, it doesn't support actual paths to `godot.Node`s in the scene tree, only colon-separated sub-property paths. For the purpose of nodes, use `godot.Node.getNodeAndResource` instead.
**/
@:native("GetIndexed")
public function getIndexed(property:godot.NodePath):Dynamic;
/**
Returns the object's property list as an `godot.Collections_Array` of dictionaries.
Each property's `godot.Collections_Dictionary` contain at least `name: String` and `type: int` (see `godot.Variant_Type`) entries. Optionally, it can also include `hint: int` (see `godot.PropertyHint`), `hint_string: String`, and `usage: int` (see `godot.PropertyUsageFlags`).
**/
@:native("GetPropertyList")
public function getPropertyList():godot.collections.Array;
/**
Returns the object's methods and their signatures as an `godot.Collections_Array`.
**/
@:native("GetMethodList")
public function getMethodList():godot.collections.Array;
#if doc_gen
/**
Send a given notification to the object, which will also trigger a call to the `godot.Object._Notification` method of all classes that the object inherits from.
If `reversed` is `true`, `godot.Object._Notification` is called first on the object's own class, and then up to its successive parent classes. If `reversed` is `false`, `godot.Object._Notification` is called first on the highest ancestor (`godot.Object` itself), and then down to its successive inheriting classes.
**/
@:native("Notification")
public function notification(what:Int, ?reversed:Bool):Void;
#else
/**
Send a given notification to the object, which will also trigger a call to the `godot.Object._Notification` method of all classes that the object inherits from.
If `reversed` is `true`, `godot.Object._Notification` is called first on the object's own class, and then up to its successive parent classes. If `reversed` is `false`, `godot.Object._Notification` is called first on the highest ancestor (`godot.Object` itself), and then down to its successive inheriting classes.
**/
@:native("Notification")
public overload function notification(what:Int):Void;
/**
Send a given notification to the object, which will also trigger a call to the `godot.Object._Notification` method of all classes that the object inherits from.
If `reversed` is `true`, `godot.Object._Notification` is called first on the object's own class, and then up to its successive parent classes. If `reversed` is `false`, `godot.Object._Notification` is called first on the highest ancestor (`godot.Object` itself), and then down to its successive inheriting classes.
**/
@:native("Notification")
public overload function notification(what:Int, reversed:Bool):Void;
#end
/**
Returns the object's unique instance ID.
This ID can be saved in `godot.EncodedObjectAsID`, and can be used to retrieve the object instance with `@GDScript.instance_from_id`.
**/
@:native("GetInstanceId")
public function getInstanceId():cs.types.UInt64;
/**
Assigns a script to the object. Each object can have a single script assigned to it, which are used to extend its functionality.
If the object already had a script, the previous script instance will be freed and its variables and state will be lost. The new script's method will be called.
**/
@:native("SetScript")
public function setScript(script:godot.Reference):Void;
/**
Returns the object's `godot.Script` instance, or `null` if none is assigned.
**/
@:native("GetScript")
public function getScript():godot.Reference;
/**
Adds, changes or removes a given entry in the object's metadata. Metadata are serialized and can take any `Variant` value.
To remove a given entry from the object's metadata, use `godot.Object.removeMeta`. Metadata is also removed if its value is set to `null`. This means you can also use `set_meta("name", null)` to remove metadata for `"name"`.
**/
@:native("SetMeta")
public function setMeta(name:std.String, value:Dynamic):Void;
/**
Removes a given entry from the object's metadata. See also `godot.Object.setMeta`.
**/
@:native("RemoveMeta")
public function removeMeta(name:std.String):Void;
/**
Returns the object's metadata entry for the given `name`.
**/
@:native("GetMeta")
public function getMeta(name:std.String):Dynamic;
/**
Returns `true` if a metadata entry is found with the given `name`.
**/
@:native("HasMeta")
public function hasMeta(name:std.String):Bool;
/**
Returns the object's metadata as a `String`.
**/
public extern inline function getMetaList():std.Array<std.String> {
return cs.Lib.array(cs.Syntax.code("{0}.GetMetaList()", this));
}
#if doc_gen
/**
Adds a user-defined `signal`. Arguments are optional, but can be added as an `godot.Collections_Array` of dictionaries, each containing `name: String` and `type: int` (see `godot.Variant_Type`) entries.
@param arguments If the parameter is null, then the default value is new Godot.Collections.Array { }
**/
@:native("AddUserSignal")
public function addUserSignal(signal:std.String, ?arguments:godot.collections.Array):Void;
#else
/**
Adds a user-defined `signal`. Arguments are optional, but can be added as an `godot.Collections_Array` of dictionaries, each containing `name: String` and `type: int` (see `godot.Variant_Type`) entries.
@param arguments If the parameter is null, then the default value is new Godot.Collections.Array { }
**/
@:native("AddUserSignal")
public overload function addUserSignal(signal:std.String):Void;
/**
Adds a user-defined `signal`. Arguments are optional, but can be added as an `godot.Collections_Array` of dictionaries, each containing `name: String` and `type: int` (see `godot.Variant_Type`) entries.
@param arguments If the parameter is null, then the default value is new Godot.Collections.Array { }
**/
@:native("AddUserSignal")
public overload function addUserSignal(signal:std.String, arguments:godot.collections.Array):Void;
#end
/**
Returns `true` if the given user-defined `signal` exists. Only signals added using `godot.Object.addUserSignal` are taken into account.
**/
@:native("HasUserSignal")
public function hasUserSignal(signal:std.String):Bool;
/**
Emits the given `signal`. The signal must exist, so it should be a built-in signal of this class or one of its parent classes, or a user-defined signal. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
```
emit_signal("hit", weapon_type, damage)
emit_signal("game_over")
```
**/
@:native("EmitSignal")
public function emitSignal(signal:std.String, args:HaxeArray<Dynamic>):Void;
/**
Calls the `method` on the object and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
```
call("set", "position", Vector2(42.0, 0.0))
```
Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).
**/
@:native("Call")
public function call(method:std.String, args:HaxeArray<Dynamic>):Dynamic;
/**
Calls the `method` on the object during idle time. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
```
call_deferred("set", "position", Vector2(42.0, 0.0))
```
Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).
**/
@:native("CallDeferred")
public function callDeferred(method:std.String, args:HaxeArray<Dynamic>):Void;
/**
Assigns a new value to the given property, after the current frame's physics step. This is equivalent to calling `godot.Object.set` via `godot.Object.callDeferred`, i.e. `call_deferred("set", property, value)`.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
**/
@:native("SetDeferred")
public function setDeferred(property:std.String, value:Dynamic):Void;
/**
Calls the `method` on the object and returns the result. Contrarily to `godot.Object.call`, this method does not support a variable number of arguments but expects all parameters to be via a single `godot.Collections_Array`.
```
callv("set", [ "position", Vector2(42.0, 0.0) ])
```
**/
@:native("Callv")
public function callv(method:std.String, argArray:godot.collections.Array):Dynamic;
/**
Returns `true` if the object contains the given `method`.
**/
@:native("HasMethod")
public function hasMethod(method:std.String):Bool;
/**
Returns `true` if the given `signal` exists.
**/
@:native("HasSignal")
public function hasSignal(signal:std.String):Bool;
/**
Returns the list of signals as an `godot.Collections_Array` of dictionaries.
**/
@:native("GetSignalList")
public function getSignalList():godot.collections.Array;
/**
Returns an `godot.Collections_Array` of connections for the given `signal`.
**/
@:native("GetSignalConnectionList")
public function getSignalConnectionList(signal:std.String):godot.collections.Array;
/**
Returns an `godot.Collections_Array` of dictionaries with information about signals that are connected to the object.
Each `godot.Collections_Dictionary` contains three String entries:
- `source` is a reference to the signal emitter.
- `signal_name` is the name of the connected signal.
- `method_name` is the name of the method to which the signal is connected.
**/
@:native("GetIncomingConnections")
public function getIncomingConnections():godot.collections.Array;
#if doc_gen
/**
Connects a `signal` to a `method` on a `target` object. Pass optional `binds` to the call as an `godot.Collections_Array` of parameters. These parameters will be passed to the method after any parameter used in the call to `godot.Object.emitSignal`. Use `flags` to set deferred or one-shot connections. See `godot.Object_ConnectFlags` constants.
A `signal` can only be connected once to a `method`. It will print an error if already connected, unless the signal was connected with `godot.Object_ConnectFlags.referenceCounted`. To avoid this, first, use `godot.Object.isConnected` to check for existing connections.
If the `target` is destroyed in the game's lifecycle, the connection will be lost.
Examples:
```
connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal
```
An example of the relationship between `binds` passed to `godot.Object.connect` and parameters used when calling `godot.Object.emitSignal`:
```
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])
```
@param binds If the parameter is null, then the default value is new Godot.Collections.Array { }
**/
@:native("Connect")
public function connect(signal:std.String, target:godot.Object, method:std.String, ?binds:godot.collections.Array, ?flags:UInt):godot.Error;
#else
/**
Connects a `signal` to a `method` on a `target` object. Pass optional `binds` to the call as an `godot.Collections_Array` of parameters. These parameters will be passed to the method after any parameter used in the call to `godot.Object.emitSignal`. Use `flags` to set deferred or one-shot connections. See `godot.Object_ConnectFlags` constants.
A `signal` can only be connected once to a `method`. It will print an error if already connected, unless the signal was connected with `godot.Object_ConnectFlags.referenceCounted`. To avoid this, first, use `godot.Object.isConnected` to check for existing connections.
If the `target` is destroyed in the game's lifecycle, the connection will be lost.
Examples:
```
connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal
```
An example of the relationship between `binds` passed to `godot.Object.connect` and parameters used when calling `godot.Object.emitSignal`:
```
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])
```
@param binds If the parameter is null, then the default value is new Godot.Collections.Array { }
**/
@:native("Connect")
public overload function connect(signal:std.String, target:godot.Object, method:std.String):godot.Error;
/**
Connects a `signal` to a `method` on a `target` object. Pass optional `binds` to the call as an `godot.Collections_Array` of parameters. These parameters will be passed to the method after any parameter used in the call to `godot.Object.emitSignal`. Use `flags` to set deferred or one-shot connections. See `godot.Object_ConnectFlags` constants.
A `signal` can only be connected once to a `method`. It will print an error if already connected, unless the signal was connected with `godot.Object_ConnectFlags.referenceCounted`. To avoid this, first, use `godot.Object.isConnected` to check for existing connections.
If the `target` is destroyed in the game's lifecycle, the connection will be lost.
Examples:
```
connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal
```
An example of the relationship between `binds` passed to `godot.Object.connect` and parameters used when calling `godot.Object.emitSignal`:
```
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])
```
@param binds If the parameter is null, then the default value is new Godot.Collections.Array { }
**/
@:native("Connect")
public overload function connect(signal:std.String, target:godot.Object, method:std.String, binds:godot.collections.Array):godot.Error;
/**
Connects a `signal` to a `method` on a `target` object. Pass optional `binds` to the call as an `godot.Collections_Array` of parameters. These parameters will be passed to the method after any parameter used in the call to `godot.Object.emitSignal`. Use `flags` to set deferred or one-shot connections. See `godot.Object_ConnectFlags` constants.
A `signal` can only be connected once to a `method`. It will print an error if already connected, unless the signal was connected with `godot.Object_ConnectFlags.referenceCounted`. To avoid this, first, use `godot.Object.isConnected` to check for existing connections.
If the `target` is destroyed in the game's lifecycle, the connection will be lost.
Examples:
```
connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal
```
An example of the relationship between `binds` passed to `godot.Object.connect` and parameters used when calling `godot.Object.emitSignal`:
```
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])
```
@param binds If the parameter is null, then the default value is new Godot.Collections.Array { }
**/
@:native("Connect")
public overload function connect(signal:std.String, target:godot.Object, method:std.String, binds:godot.collections.Array, flags:UInt):godot.Error;
#end
/**
Disconnects a `signal` from a `method` on the given `target`.
If you try to disconnect a connection that does not exist, the method will print an error. Use `godot.Object.isConnected` to ensure that the connection exists.
**/
@:native("Disconnect")
public function disconnect(signal:std.String, target:godot.Object, method:std.String):Void;
/**
Returns `true` if a connection exists for a given `signal`, `target`, and `method`.
**/
@:native("IsConnected")
public function isConnected(signal:std.String, target:godot.Object, method:std.String):Bool;
/**
If set to `true`, signal emission is blocked.
**/
@:native("SetBlockSignals")
public function setBlockSignals(enable:Bool):Void;
/**
Returns `true` if signal emission blocking is enabled.
**/
@:native("IsBlockingSignals")
public function isBlockingSignals():Bool;
/**
Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.
**/
@:native("PropertyListChangedNotify")
public function propertyListChangedNotify():Void;
/**
Defines whether the object can translate strings (with calls to `godot.Object.tr`). Enabled by default.
**/
@:native("SetMessageTranslation")
public function setMessageTranslation(enable:Bool):Void;
/**
Returns `true` if the object can translate strings. See `godot.Object.setMessageTranslation` and `godot.Object.tr`.
**/
@:native("CanTranslateMessages")
public function canTranslateMessages():Bool;
/**
Translates a message using translation catalogs configured in the Project Settings.
Only works if message translation is enabled (which it is by default), otherwise it returns the `message` unchanged. See `godot.Object.setMessageTranslation`.
**/
@:native("Tr")
public function tr(message:std.String):std.String;
/**
Returns `true` if the `godot.Node.queueFree` method was called for the object.
**/
@:native("IsQueuedForDeletion")
public function isQueuedForDeletion():Bool;
}