Terasology / LightAndShadow

Light & Shadow is an experimental game type set in a quirky Alice in Wonderland inspired setting
Apache License 2.0
8 stars 22 forks source link

Update Death Counter Due To Fall Damage #158

Closed ahv15 closed 4 years ago

ahv15 commented 4 years ago

Contains

"Fixes #145" Updates the death counter every time the player dies due to fall damage.

How to test

In game give fall damage to the player until the player dies.

Outstanding before merging

ahv15 commented 4 years ago

All I did was make sure that if the player died and was not killed by anyone there would be no null pointer exception, which before blocked the flow, but now allows for the code to continue as can be seen by restoration of health. But the problem lies in teleportation back to the base. Maybe I didnt really understand what you meant?

Cervator commented 4 years ago

Hmm, on looking at the code more closely, you're right - I thought the death would have been handled elsewhere, and this just handled the counter. But that method seems to approximate player death without actually dying - as you say it includes the teleport step and everything, that just doesn't work for some reason.

That helps - sorry for my misunderstanding, I haven't dug deep in this part of the code lately :-)

As for why the teleport doesn't work - hmm. The flow probably still differs - usually when a player kills another player it is handled somewhere with an instigator entity to quiz for the killer's details and the damage type that finished off the victim. I don't see that on this event handler, so maybe there's another place involved when it is a player kill, which could prepare some variables that lets the teleport work? 🤔

That's me just thinking out loud more than anything, would need to look around some more, but it is nearing in on midnight here, I should probably get some sleep ... 😅

ahv15 commented 4 years ago

ok sure , Just wanted to mention that when I had a look at it I noticed that a few components which had been added such as the location component , rigid body component etc ,was removed for some reason which probably should not be happening , but right when I thought I found the error the behavior started changing completely so hopefully I will be able to observe something more consistent, wont disturb your sleep anymore :grinning:.

stefaniamak commented 4 years ago

Why was that closed? 🤔 @ahv15

jdrueckert commented 4 years ago

I believe because of

However, I wonder if this is the right approach 🤔 Is this not merely adding a count for the deaths when the player would have died, but doesn't, as opposed to making the player actually die properly to fall damage, which would automatically involve the respawn on the flag base just as if killed by another player? And maybe even increase the death counter through that logic too.

ahv15 commented 4 years ago

@stefaniamak The PR I made only updated the statistics but for some reason death due to fall damage did not trigger teleport back to the base. As I did not take a further look at it I decided to close it and open it back later if I try to fix this later on.

ahv15 commented 4 years ago

I guess something is going on in some other class which prevents the teleport

stefaniamak commented 4 years ago

I see, so the flag didn't teleport too. I was to suggest merging just the counter and having the issue only being at teleporting the player, but that could be really confusing to the player when seeing their score. Alright, got it 👍