Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
670 stars 72 forks source link

Missing Parameter in door sync code #192

Open Solid-AI opened 1 month ago

Solid-AI commented 1 month ago

Cogito and Godot Engine Version: Godot 4.2.2.stable, Cogito beta 202404.01

Description: Upon adding a door to the "Doors to sync with" array in a cogito_door, the game breaks with a missing parameter error in cogito_door.gd line 110: object.open_door()

Reproduction steps: As per description

Expected behavior: Synced doors open and close without errors, I guess.

Fix I'm new to Godot and GDscript, but it seems like this issue is readily fixed by passing the 'interactor' variable into object.open_door() function in cogito_door.gd line 110 and object.close_door() in line 117.

Please feel free to tell me I'm just doing it wrong, I only picked up Cogito yesterday.

Phazorknight commented 1 month ago

Thanks for flagging this, looking into it.

Phazorknight commented 1 month ago

Could you take a look at https://github.com/Phazorknight/Cogito/commit/d2132c7d6a739cd8f614103707f5cf5798e9e996 ? should hopefully fix that issue.

Solid-AI commented 1 month ago

Could you take a look at d2132c7 ? should hopefully fix that issue.

Yes this works, and it's how I fixed it too. However, I see that the close_door() function doesn't actually use the interactor at all, and open_door() only uses it for bidirectional swings. Maybe it would be cleaner to make these functions accept null values for interactor, and have open_door() only check for its value for bidirectional doors? Then again, maybe interactor will find more use in those functions in future.