From 8fb4f4c51a37737cd98c9f4b3c7987e29e2500a2 Mon Sep 17 00:00:00 2001 From: Nathan Lovato Date: Thu, 2 Jan 2020 23:42:41 +0100 Subject: [PATCH] Replace multiline comments with comment blocks The use of multiline blocks in GDSCript for comments leaves them in the final compiled file, increasing size and potentially processing for no end-user gain. --- project/demos/pursue_vs_seek/BoundaryManager.gd | 4 +--- project/demos/pursue_vs_seek/Player.gd | 4 +--- project/demos/pursue_vs_seek/Pursuer.gd | 4 +--- project/demos/pursue_vs_seek/Ship.gd | 4 +--- project/demos/seek_and_flee/Boundary.gd | 4 +--- project/demos/seek_and_flee/Player.gd | 4 +--- project/demos/seek_and_flee/SeekFleeDemo.gd | 4 +--- project/demos/seek_and_flee/Seeker.gd | 4 +--- project/demos/seek_and_flee/Spawner.gd | 4 +--- project/src/GSTAgentLocation.gd | 4 +--- project/src/GSTSteeringAgent.gd | 4 +--- project/src/GSTSteeringBehavior.gd | 4 +--- project/src/GSTTargetAcceleration.gd | 4 +--- project/src/Utils.gd | 4 +--- project/src/behaviors/GSTArrive.gd | 6 ++---- project/src/behaviors/GSTBlend.gd | 12 +++++------- project/src/behaviors/GSTEvade.gd | 6 ++---- project/src/behaviors/GSTFace.gd | 6 ++---- project/src/behaviors/GSTFlee.gd | 4 +--- project/src/behaviors/GSTLookWhereYouGo.gd | 4 +--- project/src/behaviors/GSTMatchOrientation.gd | 6 ++---- project/src/behaviors/GSTPriority.gd | 6 ++---- project/src/behaviors/GSTPursue.gd | 6 ++---- project/src/behaviors/GSTSeek.gd | 4 +--- 24 files changed, 34 insertions(+), 82 deletions(-) diff --git a/project/demos/pursue_vs_seek/BoundaryManager.gd b/project/demos/pursue_vs_seek/BoundaryManager.gd index ea5bb00..8cb79f4 100644 --- a/project/demos/pursue_vs_seek/BoundaryManager.gd +++ b/project/demos/pursue_vs_seek/BoundaryManager.gd @@ -1,7 +1,5 @@ extends Node2D -""" -Wraps the ships' positions around the world border, and controls their rendering clones. -""" +# Wraps the ships' positions around the world border, and controls their rendering clones. onready var ShipType: = preload("res://demos/pursue_vs_seek/Ship.gd") diff --git a/project/demos/pursue_vs_seek/Player.gd b/project/demos/pursue_vs_seek/Player.gd index 111c013..b0b7762 100644 --- a/project/demos/pursue_vs_seek/Player.gd +++ b/project/demos/pursue_vs_seek/Player.gd @@ -1,7 +1,5 @@ extends "res://demos/pursue_vs_seek/Ship.gd" -""" -Controls the player ship's movements based on player input. -""" +# Controls the player ship's movements based on player input. onready var agent: = GSTSteeringAgent.new() diff --git a/project/demos/pursue_vs_seek/Pursuer.gd b/project/demos/pursue_vs_seek/Pursuer.gd index 52ea2a6..12ea4a6 100644 --- a/project/demos/pursue_vs_seek/Pursuer.gd +++ b/project/demos/pursue_vs_seek/Pursuer.gd @@ -1,7 +1,5 @@ extends "res://demos/pursue_vs_seek/Ship.gd" -""" -Represents a ship that chases after the player. -""" +# Represents a ship that chases after the player. onready var agent: = GSTSteeringAgent.new() diff --git a/project/demos/pursue_vs_seek/Ship.gd b/project/demos/pursue_vs_seek/Ship.gd index 5ef0e9c..7d9d770 100644 --- a/project/demos/pursue_vs_seek/Ship.gd +++ b/project/demos/pursue_vs_seek/Ship.gd @@ -1,7 +1,5 @@ extends KinematicBody2D -""" -Draws a notched triangle based on the vertices of the ship's polygon collider. -""" +# Draws a notched triangle based on the vertices of the ship's polygon collider. export var color: = Color() diff --git a/project/demos/seek_and_flee/Boundary.gd b/project/demos/seek_and_flee/Boundary.gd index 7bef08e..b5a9c03 100644 --- a/project/demos/seek_and_flee/Boundary.gd +++ b/project/demos/seek_and_flee/Boundary.gd @@ -1,7 +1,5 @@ extends StaticBody2D -""" -Draws the bounding box of the static body wall. -""" +# Draws the bounding box of the static body wall. var rect: Rect2 diff --git a/project/demos/seek_and_flee/Player.gd b/project/demos/seek_and_flee/Player.gd index bc943b6..037b73d 100644 --- a/project/demos/seek_and_flee/Player.gd +++ b/project/demos/seek_and_flee/Player.gd @@ -1,7 +1,5 @@ extends KinematicBody2D -""" -Class to control the player in basic left/right up/down movement. -""" +# Class to control the player in basic left/right up/down movement. onready var collision_shape: = $CollisionShape2D diff --git a/project/demos/seek_and_flee/SeekFleeDemo.gd b/project/demos/seek_and_flee/SeekFleeDemo.gd index d5a26d8..bf3bbc2 100644 --- a/project/demos/seek_and_flee/SeekFleeDemo.gd +++ b/project/demos/seek_and_flee/SeekFleeDemo.gd @@ -1,7 +1,5 @@ extends Node2D -""" -Access helper class for children to access window boundaries. -""" +# Access helper class for children to access window boundaries. onready var player: KinematicBody2D = $Player diff --git a/project/demos/seek_and_flee/Seeker.gd b/project/demos/seek_and_flee/Seeker.gd index 3dcc860..58473fd 100644 --- a/project/demos/seek_and_flee/Seeker.gd +++ b/project/demos/seek_and_flee/Seeker.gd @@ -1,7 +1,5 @@ extends KinematicBody2D -""" -AI agent that uses the Seek behavior to hone in on the player's location as directly as possible. -""" +# AI agent that uses the Seek behavior to hone in on the player's location as directly as possible. onready var collision_shape: = $CollisionShape2D diff --git a/project/demos/seek_and_flee/Spawner.gd b/project/demos/seek_and_flee/Spawner.gd index 6caa254..9d6cbc2 100644 --- a/project/demos/seek_and_flee/Spawner.gd +++ b/project/demos/seek_and_flee/Spawner.gd @@ -1,7 +1,5 @@ extends Node2D -""" -Holds data to instantiate and configure a number of agent entities. -""" +# Holds data to instantiate and configure a number of agent entities. export(PackedScene) var Entity: PackedScene diff --git a/project/src/GSTAgentLocation.gd b/project/src/GSTAgentLocation.gd index 4e5720e..df804c5 100644 --- a/project/src/GSTAgentLocation.gd +++ b/project/src/GSTAgentLocation.gd @@ -1,7 +1,5 @@ class_name GSTAgentLocation -""" -Data type to represent an agent with a location and an orientation -""" +# Data type to represent an agent with a location and an orientation var position: = Vector3.ZERO diff --git a/project/src/GSTSteeringAgent.gd b/project/src/GSTSteeringAgent.gd index 3a75d02..17b34b6 100644 --- a/project/src/GSTSteeringAgent.gd +++ b/project/src/GSTSteeringAgent.gd @@ -1,8 +1,6 @@ extends GSTAgentLocation class_name GSTSteeringAgent -""" -Extended agent data type that adds velocity and speed data. -""" +# Extended agent data type that adds velocity and speed data. var zero_linear_speed_threshold: = 0.01 diff --git a/project/src/GSTSteeringBehavior.gd b/project/src/GSTSteeringBehavior.gd index 16177ae..961c49a 100644 --- a/project/src/GSTSteeringBehavior.gd +++ b/project/src/GSTSteeringBehavior.gd @@ -1,7 +1,5 @@ class_name GSTSteeringBehavior -""" -Base class to calculate how an AI agent steers itself. -""" +# Base class to calculate how an AI agent steers itself. var enabled: = true diff --git a/project/src/GSTTargetAcceleration.gd b/project/src/GSTTargetAcceleration.gd index 8445262..a9caccf 100644 --- a/project/src/GSTTargetAcceleration.gd +++ b/project/src/GSTTargetAcceleration.gd @@ -1,7 +1,5 @@ class_name GSTTargetAcceleration -""" -A linear and angular amount of acceleration. -""" +# A linear and angular amount of acceleration. var linear: = Vector3.ZERO diff --git a/project/src/Utils.gd b/project/src/Utils.gd index bed6dd3..9433861 100644 --- a/project/src/Utils.gd +++ b/project/src/Utils.gd @@ -1,7 +1,5 @@ class_name Utils -""" -Useful math and utility functions to complement Godot's own. -""" +# Useful math and utility functions to complement Godot's own. static func clampedv3(vector: Vector3, limit: float) -> Vector3: diff --git a/project/src/behaviors/GSTArrive.gd b/project/src/behaviors/GSTArrive.gd index feedcc6..5d5ab59 100644 --- a/project/src/behaviors/GSTArrive.gd +++ b/project/src/behaviors/GSTArrive.gd @@ -1,9 +1,7 @@ extends GSTSteeringBehavior class_name GSTArrive -""" -Calculates acceleration to take an agent to its target's location. -The calculation will attempt to arrive with zero remaining velocity. -""" +# Calculates acceleration to take an agent to its target's location. +# The calculation will attempt to arrive with zero remaining velocity. var target: GSTAgentLocation diff --git a/project/src/behaviors/GSTBlend.gd b/project/src/behaviors/GSTBlend.gd index 1705553..7c76308 100644 --- a/project/src/behaviors/GSTBlend.gd +++ b/project/src/behaviors/GSTBlend.gd @@ -1,14 +1,12 @@ extends GSTSteeringBehavior class_name GSTBlend -""" -Blends multiple steering behaviors into one, and returns acceleration combining all of them. +# Blends multiple steering behaviors into one, and returns acceleration combining all of them. -Each behavior is associated with a weight - a modifier by which the result will be multiplied by, -then added to a total acceleration. +# # Each behavior is associated with a weight - a modifier by which the result will be multiplied by, +# then added to a total acceleration. -Each behavior is stored internally as a `Dictionary` with a `behavior` key with a value of type -`GSTSteeringBehavior` and a `weight` key with a value of type float. -""" +# # Each behavior is stored internally as a `Dictionary` with a `behavior` key with a value of type +# `GSTSteeringBehavior` and a `weight` key with a value of type float. onready var _behaviors: = [] diff --git a/project/src/behaviors/GSTEvade.gd b/project/src/behaviors/GSTEvade.gd index 001069c..ce89767 100644 --- a/project/src/behaviors/GSTEvade.gd +++ b/project/src/behaviors/GSTEvade.gd @@ -1,10 +1,8 @@ extends GSTPursue class_name GSTEvade -""" -Calculates acceleration to take an agent away from where a target agent will be. +# Calculates acceleration to take an agent away from where a target agent will be. -The `max_predict_time` variable represents how far ahead to calculate the intersection point. -""" +# # The `max_predict_time` variable represents how far ahead to calculate the intersection point. func _init( diff --git a/project/src/behaviors/GSTFace.gd b/project/src/behaviors/GSTFace.gd index c467bcf..7a5c3dd 100644 --- a/project/src/behaviors/GSTFace.gd +++ b/project/src/behaviors/GSTFace.gd @@ -1,9 +1,7 @@ extends GSTMatchOrientation class_name GSTFace -""" -Calculates angular acceleration to rotate a target to face its target's position. -The acceleration will attempt to arrive with zero remaining angular velocity. -""" +# Calculates angular acceleration to rotate a target to face its target's position. +# The acceleration will attempt to arrive with zero remaining angular velocity. func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void: diff --git a/project/src/behaviors/GSTFlee.gd b/project/src/behaviors/GSTFlee.gd index 73208b0..021ed24 100644 --- a/project/src/behaviors/GSTFlee.gd +++ b/project/src/behaviors/GSTFlee.gd @@ -1,8 +1,6 @@ extends GSTSeek class_name GSTFlee -""" -Calculates acceleration to take an agent directly away from a target agent. -""" +# Calculates acceleration to take an agent directly away from a target agent. func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void: diff --git a/project/src/behaviors/GSTLookWhereYouGo.gd b/project/src/behaviors/GSTLookWhereYouGo.gd index 26a261b..058becf 100644 --- a/project/src/behaviors/GSTLookWhereYouGo.gd +++ b/project/src/behaviors/GSTLookWhereYouGo.gd @@ -1,8 +1,6 @@ extends GSTMatchOrientation class_name GSTLookWhereYouGo -""" -Calculates an angular acceleration to match an agent's orientation to its direction of travel. -""" +# Calculates an angular acceleration to match an agent's orientation to its direction of travel. func _init(agent: GSTSteeringAgent).(agent, null) -> void: diff --git a/project/src/behaviors/GSTMatchOrientation.gd b/project/src/behaviors/GSTMatchOrientation.gd index cce5055..8185dc9 100644 --- a/project/src/behaviors/GSTMatchOrientation.gd +++ b/project/src/behaviors/GSTMatchOrientation.gd @@ -1,9 +1,7 @@ extends GSTSteeringBehavior class_name GSTMatchOrientation -""" -Calculates an angular acceleration to match an agent's orientation to its target's. -The calculation will attempt to arrive with zero remaining angular velocity. -""" +# Calculates an angular acceleration to match an agent's orientation to its target's. +# The calculation will attempt to arrive with zero remaining angular velocity. var target: GSTAgentLocation diff --git a/project/src/behaviors/GSTPriority.gd b/project/src/behaviors/GSTPriority.gd index 3f5a867..3c8dfa7 100644 --- a/project/src/behaviors/GSTPriority.gd +++ b/project/src/behaviors/GSTPriority.gd @@ -1,9 +1,7 @@ extends GSTSteeringBehavior class_name GSTPriority -""" -Contains multiple steering behaviors and returns only the result of the first that has a non-zero - acceleration. -""" +# Contains multiple steering behaviors and returns only the result of the first that has a non-zero + # acceleration. onready var _behaviors: = [] diff --git a/project/src/behaviors/GSTPursue.gd b/project/src/behaviors/GSTPursue.gd index ccb45f2..84b2efd 100644 --- a/project/src/behaviors/GSTPursue.gd +++ b/project/src/behaviors/GSTPursue.gd @@ -1,10 +1,8 @@ extends GSTSteeringBehavior class_name GSTPursue -""" -Calculates acceleration to take an agent to intersect with where a target agent will be. +# Calculates acceleration to take an agent to intersect with where a target agent will be. -The `max_predict_time` variable represents how far ahead to calculate the intersection point. -""" +# # The `max_predict_time` variable represents how far ahead to calculate the intersection point. var target: GSTSteeringAgent diff --git a/project/src/behaviors/GSTSeek.gd b/project/src/behaviors/GSTSeek.gd index 89a0b3d..7d9ee30 100644 --- a/project/src/behaviors/GSTSeek.gd +++ b/project/src/behaviors/GSTSeek.gd @@ -1,8 +1,6 @@ extends GSTSteeringBehavior class_name GSTSeek -""" -Calculates acceleration to take an agent to a target agent's position as directly as possible -""" +# Calculates acceleration to take an agent to a target agent's position as directly as possible var target: GSTAgentLocation