Foonghost

godot_neat_code.gd

Oct 10th, 2024 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @tool # must be at the very top
  2. # comment
  3. ## documentation comment
  4. #code()
  5.  
  6. extends Node2D
  7. class_name PascalCase # file name should be 'pascal_case.gd' (snake_case)
  8. ## Here you can do a description
  9. ## It's optional, with double hashes
  10. ##
  11. ## Im gonna take this moment to remind myself that Ctrl+R is Find&Replace
  12. ## Ctrl+Shift+F is Find&Replace through multiple files!
  13. ##
  14. ## Below are a couple tags
  15. ##
  16. ## @deprecated: use [another_class] instead
  17. ## @experimental: i'm unstable!
  18.  
  19. # NOTE: The following keywords will be highlighted in comments :)
  20. # Critical (appears in red): ALERT, ATTENTION, CAUTION, CRITICAL, DANGER, SECURITY
  21. # Warning (appears in yellow): BUG, DEPRECATED, FIXME, HACK, TASK, TBD, TODO, WARNING
  22. # Notice (appears in green): INFO, NOTE, NOTICE, TEST, TESTING
  23.  
  24. # signals right after class_name
  25. signal was_named # in the past tense
  26.  
  27. enum {
  28.     AFTER_SIGNALS,
  29.     THEN_DEFINE,
  30.     ENUMS_AND_CONSTANTS,
  31.     IF_APPLICABLE,
  32. }
  33.  
  34. const CAPS_WITH_UNDERSCORES = "good!"
  35. const PascalCaseAgain = preload("res://loading_class/into_const_or_var.gd")
  36.  
  37. @export what_comes_next = "usually export variables, then public, then private, then @onready"
  38.  
  39. var suitable_quotes = "double" # not 'single'
  40. var trailing_comma_example = [
  41.     in_multi,
  42.     line_lists,
  43.     leave_comma,
  44.     for_easy_refactor,
  45. ]
  46. space_between_operators_example = a * b + c
  47. var snake_case_variable_names = "yippie"
  48.  
  49. var _private_variable = "leading underscore"
  50.  
  51. @onready onready_var : String = what_comes_next
  52.  
  53.  
  54. func 2_spaces_before_func():
  55.     if line_after_if:
  56.         happy()
  57.     if (
  58.             long_if == true
  59.             and good_formatting
  60.     ):
  61.         double_indent = true
  62.         multiline = true
  63.  
  64. func _override_me(): # also used for "private" functions
  65.     pass # functions aren't actually private, but if they should be then _leading_underscore
  66.    
  67.     # actually also used for "notification" functions but they are generally builtin
  68.     # stuff like _ready()
Advertisement
Add Comment
Please, Sign In to add comment