mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
Use "not" instead of the exclamation mark in GDScript files
Also add String casts
This commit is contained in:
@@ -92,7 +92,7 @@ func _initialize_collision_shapes():
|
||||
for node in $Shapes.get_children():
|
||||
var body = node as PhysicsBody2D
|
||||
var shape = body.shape_owner_get_shape(0, 0)
|
||||
shape.resource_name = node.name.substr("RigidBody".length())
|
||||
shape.resource_name = String(node.name).substr("RigidBody".length())
|
||||
|
||||
_collision_shapes.push_back(shape)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ func _physics_process(_delta):
|
||||
for node in $Shapes.get_children():
|
||||
var body = node as PhysicsBody2D
|
||||
var space_state = body.get_world_2d().direct_space_state
|
||||
var body_name = body.name.substr("RigidBody".length())
|
||||
var body_name = String(body.name).substr("RigidBody".length())
|
||||
|
||||
Log.print_log("* Testing: %s" % body_name)
|
||||
|
||||
@@ -45,7 +45,7 @@ func _physics_process(_delta):
|
||||
res = _add_raycast(space_state, center, center + Vector2(0, 40))
|
||||
Log.print_log("Raycast inside: %s" % ("HIT" if res else "NO HIT"))
|
||||
|
||||
if body.name.ends_with("ConcavePolygon"):
|
||||
if String(body.name).ends_with("ConcavePolygon"):
|
||||
# Raycast inside an internal face.
|
||||
center.x += 20
|
||||
res = _add_raycast(space_state, center, center + Vector2(0, 40))
|
||||
|
||||
@@ -91,7 +91,7 @@ func _on_option_selected(option):
|
||||
func _find_type_index(type_name):
|
||||
for type_index in range(_object_templates.size()):
|
||||
var type_node = _object_templates[type_index]
|
||||
if type_node.name.find(type_name) > -1:
|
||||
if String(type_node.name).find(type_name) > -1:
|
||||
return type_index
|
||||
|
||||
Log.print_error("Invalid shape type: " + type_name)
|
||||
|
||||
Reference in New Issue
Block a user