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

Update character.lua #665

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

WhereiamL
Copy link

Fixed a Black Screen Issue: Resolved an issue where players encountered a black screen when creating an identity with "starting apartments" enabled.

Description

This pull request introduces the following improvements:

Bug Fix: Added a fallback mechanism to handle cases where required resources (qbx_spawn or qbx_apartments) are missing. If a resource is unavailable, the system defaults to spawnDefault, preventing the black screen issue.

Code Refactor: Encapsulated the spawn logic into a modular and reusable function. This improves readability, maintainability, and makes the codebase easier to extend in the future.

Inline Documentation: Added LuaDoc comments to describe function parameters, return types, and key logic flows. This helps other developers quickly understand the purpose and usage of the code.

Checklist

  • I have personally loaded this code into an updated Qbox project and checked all of its functionality.
  • My pull request fits the contribution guidelines & code conventions.

Fixed a Black Screen Issue: Resolved an issue where players encountered a black screen when creating an identity with "starting apartments" enabled.
--- @param resourceName string The name of the resource to check.
--- @return boolean True if the resource is missing, false otherwise.
local function isResourceMissing(resourceName)
return GetResourceState(resourceName) == 'missing'
Copy link
Contributor

Choose a reason for hiding this comment

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

what if resource is stopped , uninitialized or any other state, would be better just ~= 'started'

Copy link
Member

Choose a reason for hiding this comment

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

There's also no real need to make that a function

Copy link
Author

Choose a reason for hiding this comment

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

what if resource is stopped , uninitialized or any other state, would be better just ~= 'started'

Even better I did not check that qbx_apartments is achieved

Copy link
Author

Choose a reason for hiding this comment

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

There's also no real need to make that a function

It's user friendly for people who don't know a lot, and as u can see on the discord there are multiple people with the black screen issue

Copy link
Member

Choose a reason for hiding this comment

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

isResourceMissing(qbx_spawn) says the exact same thing as GetResourceState('qbx_spawn') == 'missing'. It's unneeded

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't mind, but I think since we're already using GetResourceState with its method in the same file, we should just continue using it so GetResourceState('qbx_spawn'):find('start') would be better.

WhereiamL

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants