mc776/HideousDestructor
21
42
Fork
You've already forked HideousDestructor
24

HDArmour refactors based on initial updates/tests #395

Merged
mc776 merged 22 commits from UndeadZeratul/HideousDestructor:develop into main 2026年05月26日 03:59:54 +02:00
Contributor
Copy link

Mainly trying to reduce hardcoded magic numbers by pulling them out into parameters, or extracting as little as needed in child classes into new virtuals, since it seems most of if not all addon armours seem to simply tweak damage numbers or location calculations, and the remaining boilerplate can remain unnecessary to re-implement.

To give some examples of some addon armours that leverage these, here's a few diffs comparing their existing code and my forks:

I did notice Hideous Helmet's code was quite a bit different though, still working through that one.

Mainly trying to reduce hardcoded magic numbers by pulling them out into parameters, or extracting as little as needed in child classes into new virtuals, since it seems most of if not all addon armours seem to simply tweak damage numbers or location calculations, and the remaining boilerplate can remain unnecessary to re-implement. To give some examples of some addon armours that leverage these, here's a few diffs comparing their existing code and my forks: - [RadTech's Leather Armor](https://git.gay/swampyrad/RadTechItemPack/compare/main...Undead_Zeratul/RadTechItemPack:main#diff-85f8bc7041a40f7b7e848cb6a04ece1c4d045694) - [Icarus' HEV Armor](https://github.com/HDest-Community/icarus-innovations-improved/pull/40/changes#diff-e555355c031c463ac0dae93c1f70181914ddf156a7dad70f6b2534634ebbf082) - [Potetobloke's Armor Plates](https://github.com/Potetobloke/PB_HDAddon_ArmorPlates/compare/main...UndeadZeratul:PB_HDAddon_ArmorPlates:develop#diff-f2927df3a9176b1b1a252ec89e123ffcdfee4046607021b2512f57fb944b90eb) - [Half-Baked Cake's UAC Corporate Armor](https://github.com/HDest-Community/hd-uacarmor/pull/2/changes#diff-11e45c8c538f97d1c5f02924033c2579d312bc86a6918d740618b868eb9f28a0) I did notice Hideous Helmet's code was quite a bit different though, still working through that one.
Also saw Radtech override the MaxCheat() method, figured it might be useful here as well?
This way addon armours don't have to reimplement the entirety of the HandleDamage() method just to tweak the damage formulas.
originaldamage was never being altered between creation & usage, so simply referring to the damage passed in here should be fine. It's used later on after it's been altered, outside of this method, which makes sense.
added check for ArmourChangeEffect to skip the blackout effect (Armor Plates do this)
This way child classes that only want to adjust how much protection their armour provides don't need to reimplement the entire damage/impact logic
also use HDF.Give() instead of A_GiveInventory
This can cause Spawn Replacers to mess with what was tossed, which should be guaranteed to end up being the item version of the HDArmourWorn.
@ -257,2 +279,2 @@
(owner.pos.xy,owner.pos.z+owner.height-20),
ALLOW_REPLACE
(owner.pos.xy,owner.pos.z+owner.height-20)
/* , ALLOW_REPLACE */ // Should the tossed armour be replaceable?
Owner
Copy link

Oops. Yeah no the ALLOW_REPLACE was a brainfart, we can delete this

Oops. Yeah no the ALLOW_REPLACE was a brainfart, we can delete this
(hdmb && !hdmb.bHASHELMET) would short-circuit to false with players, which would always return -1 penetration for headshots. Since the parameter is inverted, the check should be, too. This results in (!hdmb || hdmb.bHASHELMET) instead, meaning if the thing isn't an HDest Mob, or if it is then it needs a helmet.
Owner
Copy link

Looks good to me. Merge now, or anything bits of stuff to add or fix?

Looks good to me. Merge now, or anything bits of stuff to add or fix?
Bullets & damage functions seem to account for impact location, plus with the HideousHelmet being exclusively head-based protection, the Leather Jacket being Torso + Arms, there's some potential to allow for more granularly defined armour coverage zones beyond a toggle for vanilla armours being only torso or "full coverage"
Author
Contributor
Copy link

was messing with the Hideous Helmet a bit and attempted a bit of configurable coverage zones for armours. Beyond that this should be a good first attempt for what we have, assuming it all looks good to you as well.

was messing with the [Hideous Helmet](https://github.com/dastrukar/hideous-helmet/compare/master...UndeadZeratul:hideous-helmet:master#diff-c85685a6ae93baea719916dd2b7bace3d4ae643c76d517747eae60c3b6ec30fd) a bit and attempted a bit of configurable coverage zones for armours. Beyond that this should be a good first attempt for what we have, assuming it all looks good to you as well.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mc776/HideousDestructor!395
Reference in a new issue
mc776/HideousDestructor
No description provided.
Delete branch "UndeadZeratul/HideousDestructor:develop"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?