Skip to content

Object respawn functions #3450

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

Merged
merged 31 commits into from
Sep 4, 2024
Merged

Conversation

FileEX
Copy link
Contributor

@FileEX FileEX commented Jun 9, 2024

Added respawnObject and toggleObjectRespawn to the server-side.
Added new function isObjectRespawnable as shared function.

This PR is part of #3405

@TracerDS
Copy link
Contributor

TracerDS commented Jun 9, 2024

Would toggleObjectRespawn work only if the object broke?

@FileEX
Copy link
Contributor Author

FileEX commented Jun 9, 2024

Yes - I don't think it matters when it comes to returning false for toggleObjectRespawn, because the object respawn logic checks if the object has 0 hp anyway, so returning false for unbreakable objects won't change much here

// Don't stream the object in, if respawn is disabled and the object is broken
if (!m_bRespawnEnabled && m_fHealth == 0.0f)
return;

// Save the health
if (m_pObject)
{
// If respawn is enabled, reset the health
if (m_bRespawnEnabled && m_fHealth == 0.0f)
m_fHealth = 1000.0f;
else
m_fHealth = m_pObject->GetHealth();
}

Copy link
Contributor

@TracerDS TracerDS left a comment

Choose a reason for hiding this comment

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

Good job!

@tederis tederis added the enhancement New feature or request label Aug 29, 2024
Copy link
Member

@tederis tederis left a comment

Choose a reason for hiding this comment

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

LGTM

@tederis tederis merged commit 9d65bb6 into multitheftauto:master Sep 4, 2024
6 checks passed
MTABot pushed a commit that referenced this pull request Sep 4, 2024
@FileEX FileEX deleted the feature/respawnObject branch September 4, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants