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

Object respawn functions #3450

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

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!

Server/mods/deathmatch/logic/CObject.h Outdated Show resolved Hide resolved
Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp Outdated Show resolved Hide resolved
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.

None yet

2 participants