PlayerRevive

PlayerRevive

5M Downloads

Player death events are ignored/replaced with just "Player died"

Cre8or opened this issue · 22 comments

commented

Version: PlayerRevive_v1.2.14_mc1.12.2.jar

When a player is killed, the reason for their death is being replaced with "Player died". This isn't just a minor inconvenience (let's say for immersion's sake), but an actual problem for addons or servers that rely on player kill events (deathmatch gamemodes, or decapitating a player to acquire their head).

Suppose I attack another player and deal fatal damage. In normal Minecraft, the death event would register that I killed the other player, increasing my kills count and printing a message in chat along the lines of: Cre8or killed SomeGuy with a Diamond Sword. However, with the Player Revive mod installed, the victim becomes incapacitated and will slowly bleed out, after which they will simply die as if they commited suicide (e.g. via /kill). This is bad because it stops certain game mechanics from triggering (TiC's beheading, or scoreboard rules).

I haven't looked at the code, but my guess is you're overwriting a return value somewhere, or perhaps overwriting the death event altogether? If so, would it be possible to simply save the original death event (me killing the victim with a diamond sword) and return it once they bleed out? This should also fix the death messages, along the way.

commented

It was on my todo list for a while now, but I never find time to implement it. Uploaded v1.2.16, which will fix your issue and should be available soon.

commented

Thank you for the quick reply! Unfortunately, while using PlayerRevive_v1.2.16_mc1.12.2.jar, I still get the generic Player died messages. This occurs not only when giving up, but also when bleeding out. In both cases the victim was killed by another player.

I went further and tested if Tinkers' Construct's beheading modifier worked, like so:
grafik
...however I was still unable to acquire a player head this way (despite the 100% head drop chance), which leads me to believe that the death event is not being handled correctly.

If it helps: I am using PlayerRevive alongside a custom modpack, and am testing it using a local LAN server and two game instances, one of which is running offline with a different player name. I haven't tested the mod in a real multiplayer environment yet (with a dedicated server), but am planning on using it for exactly that in the future.

Finally, if you need any additional information, ask away - I'll do my best to help you get this issue solved.

EDIT: Using the same weapon in the same scenario, but without the PlayerRevive mod, the victim drops its player head as expected, and the chat messages show:
grafik

commented

Update: After some more testing, I noticed that the death event is sometimes correct. It appears to be random, to be honest, but every now and then I do get a correct death message. Decapitating, on the other hand, while also randomly working, seems completely detached from death messages, and sometimes occurs even when the death message is wrong (and just states 'Player died'). Other times, the death messages are correct, but the player's head doesn't drop nonetheless.

For a test, I tried removing most of the mods in the modpack (from 147 to 15) and repeated the experiment (still with a level 10 beheading sword from Tinkers' Construct) and the results were the same. Death messages and head drops were seemingly random, working roughly half of the time. Because of this, I doubt that something else is interfering with your mod - but I still don't know exactly what's going on...

commented

No idea about the head drop issue, but there are some issues regarding the death message, I will try to fix it, but not today sorry :(

commented

No problem at all - take your time! This issue wasn't exactly urgent anyway, I just wanted to bring it up since it seemed nobody else had reported it yet.

commented

I'm a bit confused that it is not working all the time. I changed a few things, maybe it works now?
https://www.dropbox.com/s/civdpmohzxvwuby/PlayerRevive_v1.2.17_mc1.12.2.jar?dl=1

commented

Sorry for not responding in 3 days, had some IRL business to tackle.

I just tested v1.2.17 and had similar results to before. In my tests, I always attacked the target player with the same weapon, knocking them unconscious instantly, after which I alt-tabbed to the other game instance and gave up. I ran this test 5 times in a row, while making sure the conditions were almost identical every time. However, the results varied significantly, as seen here:
grafik

What's intriguing is that, despite using the same sword as in my previous tests (with Beheading X), not a single head was dropped at any point in this experiment (unlike previously). Not sure if this is just bad luck on my part, or if something in the code changed in that regard, so take it with a grain of salt.

On a somewhat unrelated note, I see that your changes in regard to the death events haven't been pushed to here on github (yet). Would you consider uploading your changes so that I (any maybe other people) could look at the code to help you figure out the issue?

commented

I did some test and it seems that the message shows correctly only if you click 'give up' within 5 seconds.

commented

image
No, I'm trying with the v1.2.17 you uploaded, with CreativeCore v1.9.30 and it's still the same. (Showing just "died" if timer is less than 55 secs)

Below is the expected result which shows if I "give up fast enough":
image

commented

This version should fix it, can you test it?
https://www.dropbox.com/s/civdpmohzxvwuby/PlayerRevive_v1.2.17_mc1.12.2.jar?dl=1

Sorry, for not responding earlier. I was quite busy being on vacation :D

commented

Oh sorry, I realized a few mistakes I made. I hope this version works now:
https://drive.google.com/file/d/1MAQMr2omRglxTlhIRMx6sYcFBFpsVq_5/view?usp=sharing

commented

This time I got stuck in the bleeding screen. Clicking give up and choosing Yes does nothing...
And when the time is up the server crashed. o.0
crash-2018-09-04_18.22.35-server.txt

commented
commented

image
Nope o.0 It still says player died. All deaths were done by falling damage but only one of the messages shows that. Also I notice some message in the server, is this related?
I'm testing as the only player in the server, so I don't know if it actually works correctly when there are more players.

commented

Ok looks like vanilla resets the combat tracker after a short time, I could implement a work around for it (now it should work in theory, but don't take it for granted):
https://www.dropbox.com/s/j2d3fuwu5mz56ti/PlayerRevive_v1.2.17_mc1.12.2.jar?dl=1

commented

Nice one! This time it works :D No more player died now~

commented

Agreed, death messages worked consistently in my testing. However, there is one mod compatibility issue that I found, regarding the Cyberware internal defibrilator.

Normally, when a player dies with a defibrilator installed, they will avoid death and get restored to ~5 hearts of health, consuming the defibrilator in the process. This feature still works with player revive installed, but not the way I was expecting. Instead of triggering instantly, the player goes into the bleeding stage. Only once the timer runs out, or if the player chooses to give up, only then does the defibrilator trigger, bringing the player back to life, as if revived by a player (but with the health buff that comes with the item).

Personally, I think this... process... is great, despite being rather unintuitive (I expected the defibrilator to trigger before going into bleeding stage, but this way seems way more logical (and useful!)), however the issue that arises from this is that the player will be unable to go into the bleeding stage again - even if reinstalling a new defibrilator. The next time they go down, they will straight up die and have the vanilla "Respawn"/"Main Menu" screen shown to them, rather than becoming revivable.

Side note: head drops are stil not 100% reliable (probably because the drop triggers when the victim entity is killed, which only occurs to players when they bleed out or give up), but when it works, the victim receives the head, rather than the killer. For coop servers where two friends are trying to acquire their own heads, this is not a major issue, but still something to consider for future updates.

EDIT: Another small bug: when going down, the victim's hunger is being set to the the config value rather than being lowered to it. This matters because if the victim was starving prior to death, but I:playerFoodAfter is set to 16, the player will gain food shanks by going down. Combined with player saturation being ignored, this makes for some unpredictable (and possibly annoying) situations.

All in all, good progress on squashing those bugs, keep up the good work! Looking forward to the next version.

commented
  • I uploaded a new version to curseforge, maybe it fixes the defibrilator issue? If not create a new issue.
  • I don't think there is a good solution to the head drop issue :(
  • I don't want players to starve again immediately after being revived. They have to have some time before running into the same problem again. Maybe not set the value, but make sure the player has at least or more than the given food level?
commented

For the head drop issue, maybe it'll be a good time to make it when you are going to add an "execution" system? Like mentioned in the suggestion thread #17

commented

Good idea!

commented

Just tested the new version, and unfortunately there's a new (major) bug. In my modpack, whenever I hit the "give up" button, my bleedout timer simply resets, and I don't actually get killed. Because of this, I am unable to respawn, instead I always end up stuck in the injured mode, and it appears the only way out is to get revived by another player.
This happens both with and without the cyberware defibrilator installed, so I don't think this has anything to do with it.

commented

Oh right sorry. I uploaded a new version which fixes it. Thanks for reporting this issue!