stujones11 / minetest-3d_armor

Visible player armor & wielded items for minetest
Other
55 stars 97 forks source link

Support for non-fleshy damage groups #47

Closed raymoo closed 7 years ago

raymoo commented 8 years ago

I tested and in fact non-fleshy damage groups are handled for players, other than special ones like immortal.

stujones11 commented 8 years ago

This is interesting but it will require a lot of experimentation to integrate this in any meaningful way. I will look into this at some point but if anyone else has any ideas then please post them here or submit a pull request.

raymoo commented 8 years ago

You could have different damage types registrable by mods, and these armor groups would be given to players at join time. The way to define armor would need to be changed to accommodate new damage groups. There are two approaches that come to mind:

In either case, there's the issue of how to deal with different pieces of armor covering the same body part. It looks like the current code just chooses the first piece for each area, so this could be applied to armor with multiple damage types also.

The "armor_" .. k item groups currently used would still be useful for determining which body part each piece of armor covers. To keep compatibility with armor made against the older API, it could be made as an alternative place to put armor values for the fleshy damage type.

stujones11 commented 7 years ago

New branch available for testing and discussion https://github.com/stujones11/minetest-3d_armor/tree/non-fleshy

Uses radiation as an example of how new damage groups can be registered. Should work with player/armor monoids and remain backwards compatible with existing armor registrations. The default armor has yet to be updated to use the new api.

@raymoo I'd be interested to know if this is anything like what you had in mind.

raymoo commented 7 years ago

It looks like the kind of thing I was asking for, thanks.

I noticed some issues and line-commented on the commit. Also, how are you currently preventing multiple armor pieces of the same type (like two torso pieces) from stacking?

stujones11 commented 7 years ago

Thanks for the reply, and the line-comments, well spotted. Regarding stacking, the idea was that you would not be able to wear two pairs of boots at the same time. I guess I could make the inventory allow_put check optional, that way effects would stack but the visual effect would depend on placement order.

Edit: I think I misread your question, stacking of elements is prevented here: https://github.com/stujones11/minetest-3d_armor/blob/non-fleshy/3d_armor/init.lua#L142

stujones11 commented 7 years ago

Rebased and updated. I have tested as best I can and armor levels now seem consistent with or without armor_monoid enabled. Will probably merge later and close this issue if no objections.