Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: moving time methods to ModLoaderTime #346

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

AlajeBash
Copy link

@AlajeBash AlajeBash commented Oct 19, 2023

DESCRIPTION

I Created a new GDScript file with the name time.gd to hold the ModLoaderTime class.
And in time.gd, i define the ModLoaderTime class and move the time-related utility methods into it.

closes #246

@KANAjetzt KANAjetzt changed the base branch from main to development October 19, 2023 10:22
@KANAjetzt KANAjetzt added enhancement New feature or request refactor / cleanup Improves readability or maintainability labels Oct 19, 2023
@KANAjetzt KANAjetzt added this to the v6.3.0 milestone Oct 19, 2023
@KANAjetzt KANAjetzt requested review from KANAjetzt, Qubus0 and a team October 19, 2023 10:23
Copy link
Collaborator

@KANAjetzt KANAjetzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR 😃
Let me know if anything is unclear.

Comment on lines 1 to 3
extends Node

class_name ModLoaderTime
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extends Node
class_name ModLoaderTime
class_name ModLoaderTime
extends Node

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add a short comment above the class_name that describes this class.
See the top comment of log.gd for an example.

addons/mod_loader/api/log.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/log.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/time.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/time.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/time.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/time.gd Show resolved Hide resolved
@KANAjetzt KANAjetzt changed the title Spliting Date & Time Methods in to Dedicated Class refactor: moving time methods to ModLoaderTime Oct 19, 2023
AlajeBash and others added 4 commits October 19, 2023 19:12
Co-authored-by: KANAjetzt <41547570+KANAjetzt@users.noreply.github.com>
Co-authored-by: KANAjetzt <41547570+KANAjetzt@users.noreply.github.com>
Co-authored-by: KANAjetzt <41547570+KANAjetzt@users.noreply.github.com>
@@ -505,7 +490,7 @@ static func _rotate_log_file() -> void:
var error := log_file.open(MOD_LOG_PATH, File.WRITE)
if not error == OK:
assert(false, "Could not open log file, error code: %s" % error)
log_file.store_string('%s Created log' % _get_date_string())
log_file.store_string('%s Created log' % ModLoaderTime.get_date_string())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please search the entire codebase for calls to the Time utility functions and update them to ModLoaderTime. In Godot, you can press Ctrl + Alt + F to search the entire project. Additionally, please perform a test run. You can create an empty Godot project and symlink the repository into the addons folder for testing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KANAjetzt is there need for Internal Date Time functions in addons/mod_loader/setup/setup_log.gd ?

Copy link
Collaborator

@KANAjetzt KANAjetzt Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep everything related to the setup (everything in the setup directory) as it is. The setup has to be completely separate, which is why there is a lot of duplicated code in these files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thank you

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one more call to _get_date_time_string()

var datetime := _get_date_time_string().replace(":", ".")

addons/mod_loader/api/time.gd Outdated Show resolved Hide resolved
# This class provides utility functions to retrieve the current time, date, and date-time in specific string formats.
class_name ModLoaderTime
extends Node

Copy link
Collaborator

@KANAjetzt KANAjetzt Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One empty line missing.
If you are interested you can read up on the GDScript style guide here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty line is still missing.

Co-authored-by: KANAjetzt <41547570+KANAjetzt@users.noreply.github.com>
# This class provides utility functions to retrieve the current time, date, and date-time in specific string formats.
class_name ModLoaderTime
extends Node

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty line is still missing.

@@ -505,7 +490,7 @@ static func _rotate_log_file() -> void:
var error := log_file.open(MOD_LOG_PATH, File.WRITE)
if not error == OK:
assert(false, "Could not open log file, error code: %s" % error)
log_file.store_string('%s Created log' % _get_date_string())
log_file.store_string('%s Created log' % ModLoaderTime.get_date_string())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one more call to _get_date_time_string()

var datetime := _get_date_time_string().replace(":", ".")

@KANAjetzt
Copy link
Collaborator

@AlajeBash, you requested a review but did not apply my requested changes. Additionally, there is now a second PR for this? Please check my last comments and make the requested changes. Let me know if you need any help or if something is unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor / cleanup Improves readability or maintainability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants