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

Add server-side object events onObjectBreak & onObjectDamage #3380

Closed
wants to merge 8 commits into from

Conversation

FileEX
Copy link
Contributor

@FileEX FileEX commented May 1, 2024

This PR adds onObjectBreak and onObjectDamage events on the server side.

addEventHandler('onObjectBreak', root, function(attacker)
    print('Object: ', source)
    print('Attacker: ', attacker)
end)

addEventHandler('onObjectDamage', root, function(loss,attacker)
     print('Object: ', source)
     print('Attacker: ', attacker)
     print('Loss: ', loss)
end)

@myusernamewo
Copy link
Contributor

Idea is very good, but what you "forgot" to include are functions to enable these events, for example, SetDamageStateOnObject and GetDamageStateOnObject

Server/mods/deathmatch/logic/CGame.cpp Outdated Show resolved Hide resolved
Server/mods/deathmatch/logic/CGame.cpp Outdated Show resolved Hide resolved
Server/mods/deathmatch/logic/CGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
@FileEX
Copy link
Contributor Author

FileEX commented May 2, 2024

Idea is very good, but what you "forgot" to include are functions to enable these events, for example, SetDamageStateOnObject and GetDamageStateOnObject

I do not understand what you mean. If you don't want the object to take damage or be destroyed, you can cancel client-side events or use setObjectBreakable & isObjectBreakable

Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.h Outdated Show resolved Hide resolved
@FileEX FileEX requested a review from tederis May 5, 2024 14:11
@FileEX
Copy link
Contributor Author

FileEX commented May 6, 2024

I removed the onObjectDamage event. I wanted to do it in the same way as it is done with onPlayerDamage, i.e. in the synchronization package, but object synchronization does not seem to work. I haven't found a definition anywhere for "WITH_OBJECTS_SYNC", which is a condition for this synchronization.

Objects sync has been disabled in #460

@FileEX FileEX closed this May 23, 2024
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.

5 participants