-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3199 from masatake/masatake-gdscript
GDScript based on #3194
- Loading branch information
Showing
38 changed files
with
1,946 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a crash test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@foo | ||
var |
4 changes: 4 additions & 0 deletions
4
Units/parser-gdscript.r/class_name-extends-no-implicit-class.d/args.ctags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--sort=no | ||
--fields=+irK | ||
--extras=+r | ||
--extras-GDScript=-{implicitClass} |
2 changes: 2 additions & 0 deletions
2
Units/parser-gdscript.r/class_name-extends-no-implicit-class.d/expected.tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Node input.gd /^class_name MyNode extends Node$/;" class roles:extended | ||
MyNode input.gd /^class_name MyNode extends Node$/;" class inherits:Node roles:def |
1 change: 1 addition & 0 deletions
1
Units/parser-gdscript.r/class_name-extends-no-implicit-class.d/input.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class_name MyNode extends Node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--sort=no | ||
--fields=+irK | ||
--extras=+r | ||
--extras-GDScript=+{implicitClass} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
MyNode input.gd /^class_name MyNode extends Node$/;" class inherits:Node roles:def | ||
Node input.gd /^class_name MyNode extends Node$/;" class roles:extended |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class_name MyNode extends Node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--sort=no | ||
--fields=+{inherits}{signature} | ||
--kinds-GDScript=-{local} | ||
--kinds-GDScript=-{parameter} | ||
--extras-GDScript=+{implicitClass} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
anon_class_186e00360100 input.gd /^# Taken from godot-demo-projects\/networking\/webrtc_signaling\/server\/ws_webrtc_server.gd$/;" c inherits:Node | ||
TIMEOUT input.gd /^const TIMEOUT = 1000 # Unresponsive clients times out after 1 sec$/;" C class:anon_class_186e00360100 | ||
SEAL_TIME input.gd /^const SEAL_TIME = 10000 # A sealed room will be closed after this time$/;" C class:anon_class_186e00360100 | ||
ALFNUM input.gd /^const ALFNUM = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"$/;" C class:anon_class_186e00360100 | ||
_alfnum input.gd /^var _alfnum = ALFNUM.to_ascii()$/;" v class:anon_class_186e00360100 | ||
rand input.gd /^var rand: RandomNumberGenerator = RandomNumberGenerator.new()$/;" v class:anon_class_186e00360100 typeref:typename:RandomNumberGenerator | ||
lobbies input.gd /^var lobbies: Dictionary = {}$/;" v class:anon_class_186e00360100 typeref:typename:Dictionary | ||
server input.gd /^var server: WebSocketServer = WebSocketServer.new()$/;" v class:anon_class_186e00360100 typeref:typename:WebSocketServer | ||
peers input.gd /^var peers: Dictionary = {}$/;" v class:anon_class_186e00360100 typeref:typename:Dictionary | ||
Peer input.gd /^class Peer extends Reference:$/;" c class:anon_class_186e00360100 inherits:Reference | ||
id input.gd /^ var id = -1$/;" v class:anon_class_186e00360100.Peer | ||
lobby input.gd /^ var lobby = ""$/;" v class:anon_class_186e00360100.Peer | ||
time input.gd /^ var time = OS.get_ticks_msec()$/;" v class:anon_class_186e00360100.Peer | ||
_init input.gd /^ func _init(peer_id):$/;" m class:anon_class_186e00360100.Peer signature:(peer_id) | ||
Lobby input.gd /^class Lobby extends Reference:$/;" c class:anon_class_186e00360100 inherits:Reference | ||
peers input.gd /^ var peers: Array = []$/;" v class:anon_class_186e00360100.Lobby typeref:typename:Array | ||
host input.gd /^ var host: int = -1$/;" v class:anon_class_186e00360100.Lobby typeref:typename:int | ||
sealed input.gd /^ var sealed: bool = false$/;" v class:anon_class_186e00360100.Lobby typeref:typename:bool | ||
time input.gd /^ var time = 0$/;" v class:anon_class_186e00360100.Lobby | ||
_init input.gd /^ func _init(host_id: int):$/;" m class:anon_class_186e00360100.Lobby signature:(host_id: int) | ||
join input.gd /^ func join(peer_id, server) -> bool:$/;" m class:anon_class_186e00360100.Lobby typeref:typename:bool signature:(peer_id, server) | ||
leave input.gd /^ func leave(peer_id, server) -> bool:$/;" m class:anon_class_186e00360100.Lobby typeref:typename:bool signature:(peer_id, server) | ||
seal input.gd /^ func seal(peer_id, server) -> bool:$/;" m class:anon_class_186e00360100.Lobby typeref:typename:bool signature:(peer_id, server) | ||
Circle2D input.gd /^class Circle2D:$/;" c class:anon_class_186e00360100 inherits:Node2D | ||
center input.gd /^ var center$/;" v class:anon_class_186e00360100.Circle2D | ||
radius input.gd /^ var radius$/;" v class:anon_class_186e00360100.Circle2D | ||
color input.gd /^ var color$/;" v class:anon_class_186e00360100.Circle2D | ||
_draw input.gd /^ func _draw():$/;" m class:anon_class_186e00360100.Circle2D signature:() | ||
_init input.gd /^func _init():$/;" m class:anon_class_186e00360100 signature:() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Taken from godot-demo-projects/networking/webrtc_signaling/server/ws_webrtc_server.gd | ||
# of https://github.com/godotengine/godot-demo-projects.git | ||
|
||
extends Node | ||
|
||
const TIMEOUT = 1000 # Unresponsive clients times out after 1 sec | ||
const SEAL_TIME = 10000 # A sealed room will be closed after this time | ||
const ALFNUM = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" | ||
|
||
var _alfnum = ALFNUM.to_ascii() | ||
|
||
var rand: RandomNumberGenerator = RandomNumberGenerator.new() | ||
var lobbies: Dictionary = {} | ||
var server: WebSocketServer = WebSocketServer.new() | ||
var peers: Dictionary = {} | ||
|
||
class Peer extends Reference: | ||
var id = -1 | ||
var lobby = "" | ||
var time = OS.get_ticks_msec() | ||
|
||
func _init(peer_id): | ||
id = peer_id | ||
|
||
|
||
|
||
class Lobby extends Reference: | ||
var peers: Array = [] | ||
var host: int = -1 | ||
var sealed: bool = false | ||
var time = 0 | ||
|
||
func _init(host_id: int): | ||
host = host_id | ||
|
||
func join(peer_id, server) -> bool: | ||
if sealed: return false | ||
if not server.has_peer(peer_id): return false | ||
var new_peer: WebSocketPeer = server.get_peer(peer_id) | ||
new_peer.put_packet(("I: %d\n" % (1 if peer_id == host else peer_id)).to_utf8()) | ||
for p in peers: | ||
if not server.has_peer(p): | ||
continue | ||
server.get_peer(p).put_packet(("N: %d\n" % peer_id).to_utf8()) | ||
new_peer.put_packet(("N: %d\n" % (1 if p == host else p)).to_utf8()) | ||
peers.push_back(peer_id) | ||
return true | ||
|
||
|
||
func leave(peer_id, server) -> bool: | ||
if not peers.has(peer_id): return false | ||
peers.erase(peer_id) | ||
var close = false | ||
if peer_id == host: | ||
# The room host disconnected, will disconnect all peers. | ||
close = true | ||
if sealed: return close | ||
# Notify other peers. | ||
for p in peers: | ||
if not server.has_peer(p): return close | ||
if close: | ||
# Disconnect peers. | ||
server.disconnect_peer(p) | ||
else: | ||
# Notify disconnection. | ||
server.get_peer(p).put_packet(("D: %d\n" % peer_id).to_utf8()) | ||
return close | ||
|
||
|
||
func seal(peer_id, server) -> bool: | ||
# Only host can seal the room. | ||
if host != peer_id: return false | ||
sealed = true | ||
for p in peers: | ||
server.get_peer(p).put_packet("S: \n".to_utf8()) | ||
time = OS.get_ticks_msec() | ||
return true | ||
|
||
|
||
# Taken from godot-demo-projects/2d/physics_tests/test.gd | ||
class Circle2D: | ||
extends Node2D | ||
var center | ||
var radius | ||
var color | ||
|
||
func _draw(): | ||
draw_circle(center, radius, color) | ||
|
||
func _init(): | ||
server.connect("data_received", self, "_on_data") | ||
server.connect("client_connected", self, "_peer_connected") | ||
server.connect("client_disconnected", self, "_peer_disconnected") | ||
|
||
|
||
# ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--sort=no | ||
--kinds-GDScript=+zl | ||
--fields-GDScript={annotations} | ||
--extras-GDScript=+{implicitClass} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
anon_class_025551790100 input.gd /^# Taken from godot-demo-projects\/3d\/voxel\/world\/chunk.gd$/;" c | ||
_create_block_collider input.gd /^func _create_block_collider(block_sub_position):$/;" m class:anon_class_025551790100 | ||
block_sub_position input.gd /^func _create_block_collider(block_sub_position):$/;" z method:anon_class_025551790100._create_block_collider file: | ||
collider input.gd /^ var collider = CollisionShape.new()$/;" l method:anon_class_025551790100._create_block_collider file: | ||
calculate_block_uvs input.gd /^static func calculate_block_uvs(block_id):$/;" m class:anon_class_025551790100 annotations:static | ||
block_id input.gd /^static func calculate_block_uvs(block_id):$/;" z method:anon_class_025551790100.calculate_block_uvs file: | ||
row input.gd /^ var row = block_id \/ TEXTURE_SHEET_WIDTH$/;" l method:anon_class_025551790100.calculate_block_uvs file: | ||
col input.gd /^ var col = block_id % TEXTURE_SHEET_WIDTH$/;" l method:anon_class_025551790100.calculate_block_uvs file: | ||
id input.gd /^func id(a):$/;" m class:anon_class_025551790100 | ||
a input.gd /^func id(a):$/;" z method:anon_class_025551790100.id file: | ||
r input.gd /^remote func r(b):$/;" m class:anon_class_025551790100 annotations:remote | ||
b input.gd /^remote func r(b):$/;" z method:anon_class_025551790100.r file: | ||
x input.gd /^remote static func x(c):$/;" m class:anon_class_025551790100 annotations:remote,static | ||
c input.gd /^remote static func x(c):$/;" z method:anon_class_025551790100.x file: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Taken from godot-demo-projects/3d/voxel/world/chunk.gd | ||
func _create_block_collider(block_sub_position): | ||
var collider = CollisionShape.new() | ||
collider.shape = BoxShape.new() | ||
collider.shape.extents = Vector3.ONE / 2 | ||
collider.transform.origin = block_sub_position + Vector3.ONE / 2 | ||
add_child(collider) | ||
|
||
static func calculate_block_uvs(block_id): | ||
# This method only supports square texture sheets. | ||
var row = block_id / TEXTURE_SHEET_WIDTH | ||
var col = block_id % TEXTURE_SHEET_WIDTH | ||
|
||
return [ | ||
TEXTURE_TILE_SIZE * Vector2(col, row), | ||
TEXTURE_TILE_SIZE * Vector2(col, row + 1), | ||
TEXTURE_TILE_SIZE * Vector2(col + 1, row), | ||
TEXTURE_TILE_SIZE * Vector2(col + 1, row + 1), | ||
] | ||
|
||
func id(a): | ||
return a | ||
|
||
remote func r(b): | ||
return b | ||
|
||
remote static func x(c): | ||
return c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--sort=no | ||
--extras=+r | ||
--fields=+rEiS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
BaseClass input.gd /^extends BaseClass$/;" c roles:extended extras:reference | ||
MyClass input.gd /^class_name MyClass, "res:\/\/path\/to\/optional\/icon.svg"$/;" c roles:def | ||
a input.gd /^@export_range(start=0, end=100, step=1) var a = 5$/;" v roles:def annotations:export_range(start=0, end=100, step=1) | ||
s input.gd /^var s = "Hello"$/;" v roles:def annotations:export | ||
arr input.gd /^@onready var arr = [1, 2, 3]$/;" v roles:def annotations:onready | ||
dict input.gd /^var dict = {"key": "value", 2: 3}$/;" v roles:def | ||
typed_var input.gd /^var typed_var: int$/;" v typeref:typename:int roles:def | ||
inferred_type input.gd /^inferred_type\\$/;" v roles:def annotations:onready,export_multiline | ||
ANSWER input.gd /^const ANSWER = 42$/;" C roles:def | ||
THE_NAME input.gd /^const THE_NAME:String = "Charly"$/;" C typeref:typename:String roles:def | ||
anon_enum_84e343bf0104 input.gd /^enum {UNIT_NEUTRAL, UNIT_ENEMY, UNIT_ALL}$/;" g roles:def extras:anonymous | ||
UNIT_NEUTRAL input.gd /^enum {UNIT_NEUTRAL, UNIT_ENEMY, UNIT_ALL}$/;" e enum:anon_enum_84e343bf0104 file: roles:def | ||
UNIT_ENEMY input.gd /^enum {UNIT_NEUTRAL, UNIT_ENEMY, UNIT_ALL}$/;" e enum:anon_enum_84e343bf0104 file: roles:def | ||
UNIT_ALL input.gd /^enum {UNIT_NEUTRAL, UNIT_ENEMY, UNIT_ALL}$/;" e enum:anon_enum_84e343bf0104 file: roles:def | ||
Named input.gd /^enum Named {THING_1, THING_2, ANOTHER_THING=1}$/;" g roles:def | ||
THING_1 input.gd /^enum Named {THING_1, THING_2, ANOTHER_THING=1}$/;" e enum:Named file: roles:def | ||
THING_2 input.gd /^enum Named {THING_1, THING_2, ANOTHER_THING=1}$/;" e enum:Named file: roles:def | ||
ANOTHER_THING input.gd /^enum Named {THING_1, THING_2, ANOTHER_THING=1}$/;" e enum:Named file: roles:def | ||
v2 input.gd /^var v2 = Vector2(1, 2)$/;" v roles:def | ||
v3 input.gd /^var v3 = Vector3(1, 2, 3)$/;" v roles:def | ||
some_function input.gd /^func some_function(param1: Vector3, param2: int) -> int:$/;" m typeref:typename:int signature:(param1: Vector3, param2: int) roles:def annotations:master | ||
something input.gd /^func something(p1, p2):$/;" m signature:(p1, p2) roles:def annotations:puppet | ||
Something input.gd /^class Something:$/;" c inherits: roles:def | ||
a input.gd /^ var a = 10$/;" v class:Something roles:def | ||
_private_var input.gd /^ const _private_var:String = "hi\\n\\\\escape"$/;" C class:Something typeref:typename:String roles:def | ||
foooooooo input.gd /^ func foooooooo() -> String:$/;" m class:Something typeref:typename:String signature:() roles:def | ||
_init input.gd /^func _init():$/;" m signature:() roles:def |
Oops, something went wrong.