1st things 1st:
pll =player:get_player_name()
Death caused by a fall is one when
Code: Select all
minetest.get_node(player:getpos()).name == air
for greater than several seconds.
So we can check for distance a player has walked since last check (lagproof) and a node at the pos I mentioned above (this however isn't lag proof).
But if a player is dead (player.get_hp()==0) and he was in air for too long, I guess it's normal to send smth like "pll hits the ground too hard!" (e.g. avoid the word "fall").
------------------------------------------------------------------------------------------------------
As for monsters - we can use check for health (actually we need track it on every tick) and if a player dies we can get his pos and find the nearest mob. Distance should be checked, a mob has to be in 0..1 meters away.
Fireballs of DM, arrows and any entities thrown at the player can bear inside them the name of the one who has released them.
Also if there are several mobs in a distance (0..1) we can send smth like "pll was killed by the anonymous group of sandmen". (Well, you know... alcoholics... anonymity... groups... sand monsters should be very thirsty... ... sorry, my imagination is on it's top these days )
------------------------------------------------------------------------------------------------------
What else?
Death, caused by another player?
We can't do it yet, but what if we send_all only potential killers?
Example:
Someone killed someone.
In such circumstances the killer wouldn't be able to teleport momentarily after the kill.
So:
our killer should be nearby.
If there's NO other things to die of - we can send all that "killer might have seen or heard who just killed pll". So we don't blame anyone, but make people suspicious. Later the killed one can clear possible killer's name. On PVP servers that may be treated like a joke - everyone would know what does it mean "might have seen". Yeah...
"I might have seen... and might not"
Note:
If there's lava or fire or the killed one was falling while fighting - I assume it's "ok" to show the message that smth natural has killed him/her.
But if there's a player nearby we also can add that he/she just might have seen how did pll die.
Also, imagine that someone want to kill someone but wants to do it unnoticed. The killer may lure pll to a group of monsters and kill pll with a distance.
We have 2 options: to add possible killer's name or not.
First option will approve some skilled assassination.
The 2nd one will tell everyone who might've been responsible (arrows are entities that are nearby the player when he dies and if they contain someone's name...)
----------------------------------------------------------------------------------
Do we have suffocation yet? Drowning is for water. Suffocation is for sending smth like "pll has tried to pretend he's a worm" or "pll failed to prove he can do better than regular worms".
----------------------------------------------------------------------------------
'pll was blasted with TNT!' - this may be done likewise the arrows. TNT's particles of smoke should fill the entire radius of a blast. On_collision with a player we can check his HP.
----------------------------------------------------------------------------------
Regards!