Fixes transforming items getting their force incorrectly modified when metalgenned multiple times (#95739)

## About The Pull Request

Transforming weapons could change their sharpness which would break
material force modification as materials modify the force differently
based on item sharpness. Also the force was hard reset every time you
switched it on or off, which would also break the math.
I've rewritten the transforming component to preserve force and
sharpness, and account for different sharpness of the item when switched
on/off. Additionally, I've updated the two-handed component to use the
new system to make it easier to work with/less prone to breaking.

## Why It's Good For The Game

<img width="557" height="218" alt="image"
src="https://github.com/user-attachments/assets/59cfb21a-e97e-4843-9c11-c87ed32384a9"
/>

## Changelog
🆑
fix: Transforming items like eswords should no longer get absurd stats
when metalgenned multiple times in a row
/🆑
This commit is contained in:
SmArtKar
2026-04-19 22:58:37 +01:00
committed by GitHub
parent 99ec96a775
commit d68efbbf45
7 changed files with 166 additions and 63 deletions
+2 -1
View File
@@ -53,7 +53,8 @@
I.wound_bonus = I.wound_bonus + increment //wound_bonus has no cap
user.visible_message(span_notice("[user] sharpens [I] with [src]!"), span_notice("You sharpen [I], making it much more deadly than before."))
playsound(src, 'sound/items/unsheath.ogg', 25, TRUE)
I.sharpness = SHARP_EDGED //When you whetstone something, it becomes an edged weapon, even if it was previously dull or pointy
if(!(signal_out & COMPONENT_BLOCK_SHARPEN_SHARPNESS))
I.sharpness = SHARP_EDGED //When you whetstone something, it becomes an edged weapon, even if it was previously dull or pointy
I.throwforce = clamp(I.throwforce + increment, 0, max)
I.name = "[prefix] [I.name]" //This adds a prefix and a space to the item's name regardless of what the prefix is
desc = "[desc] At least, it used to."