minetest-mods / 3d_armor

Visible player armor & wielded items for minetest
Other
17 stars 39 forks source link

set_hp(0) and fall damage runs into armor healing #68

Open Bastrabun opened 2 years ago

Bastrabun commented 2 years ago

Sometimes, we want to kill people.

Then we do player:set_hp(0), but if the armor the player wears has some healing properties, we can't kill them.

Repro:

IMO set_hp(0) should do exactly that: kill the player.

Also, fall damage seems to count against the heal property.

Could you please make it that high fall damage and set_hp(0) does not let anyone live?

Or could you make it that armors can register against what type of damage they help?

For my reference 998

BuckarooBanzay commented 2 years ago

Sometimes, we want to kill people.

That's a good way to start a conversation :laughing:

Could you please make it that high fall damage and set_hp(0) does not let anyone live?

Do you have an idea how to achieve this?

Bastrabun commented 2 years ago

In the register_on_player_hpchange you decide when to apply damage and when heal catches it.

  1. You could make it a public function, so that we can override it.
  2. You could make the globalstep function public as well, so we can add custom aoe
  3. You could iterate through a table of damage sources, which bring damage functions with them

This way, a game could select to apply the heal (rather a "deflect") value to falling damage or to ignore it. Imagine falling off a cliff in full plate mail. Sure, the plate would prevent bruises, but the person would die regardless of sudden deceleration.

Also, set_hp allows to provide custom reasons. In a game where laser damage is a thing and a coat of mirrors deflects lazer pew pew, but not missiles, they could specify set_hp(1000,"pewpew") on hit. My game will introduce blunt, slash and stab damage, also magic and others, even combinations of those.

fluxionary commented 2 years ago

IMO, as a start, the kill command that's part of builtin should provide a reason to the player:set_hp call...