Skip to content

Commit

Permalink
Add gdlint checking of template components (#29)
Browse files Browse the repository at this point in the history
This PR adds gdlint checking of template component files.
  • Loading branch information
Malcolmnixon authored Dec 6, 2023
1 parent ee56a6c commit a0770f5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/gdlint-on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Workflow to automatically lint gdscript code
name: gdlint on push

on:
[push, pull_request]

jobs:
gdlint:
name: gdlint scripts
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'gdtoolkit==4.*'
- name: Lint Godot XR Template Components
run: |
gdlint components
10 changes: 5 additions & 5 deletions components/persistent/persistent_world.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ signal world_saving
signal world_saved


## Static instance of the world data
static var instance : PersistentWorld = null


@export_group("Persistence Settings")

## Password for encrypted save files
Expand All @@ -51,6 +47,10 @@ var _data := {}
var _mutex := Mutex.new()


## Static instance of the world data
static var instance : PersistentWorld = null


# Check for configuration issues on this node
func _get_configuration_warnings() -> PackedStringArray:
var warnings := PackedStringArray()
Expand Down Expand Up @@ -115,7 +115,7 @@ func clear_value(id : String) -> void:
_mutex.unlock()


## This method clears all values matching the glob [param pattern]. See
## This method clears all values matching the glob [param pattern]. See
## [method String.match] for pattern matching rules.
func clear_matching(pattern : String) -> void:
_mutex.lock()
Expand Down
7 changes: 3 additions & 4 deletions components/persistent/persistent_zone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func scene_loaded(user_data = null):

# Find the zone items the PersistentWorld thinks should be in this zone.
var zone_items = PersistentWorld.instance.get_value(zone_info.zone_id)

# Free items designed into the zone but PersistentWorld thinks should
# be removed.
if zone_items is Array:
Expand Down Expand Up @@ -102,7 +102,6 @@ func scene_exiting(user_data = null):

# Clear the current zone
GameState.current_zone = self



## This method saves the state of the zone to the [PersistentWorld]. This gets
Expand All @@ -111,7 +110,7 @@ func scene_exiting(user_data = null):
func save_world_state() -> void:
# Save world-state for all items in the zone
propagate_notification(Persistent.NOTIFICATION_SAVE_STATE)

# Identify items held directly by the zone
var items_in_zone : Array[String] = []
for node in get_tree().get_nodes_in_group("persistent"):
Expand Down Expand Up @@ -193,7 +192,7 @@ func create_item_instance(item_id : String) -> PersistentItem:


# This method returns true if the node is an item held by a zone rather than
# being held by some sort of persistent object such as a PersistentPocket or
# being held by some sort of persistent object such as a PersistentPocket or
# an XRToolsFunctionPickup.
static func is_item_held_by_zone(node : Node) -> bool:
# Skip if not valid
Expand Down

0 comments on commit a0770f5

Please sign in to comment.