mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-22 14:44:12 +01:00
d68efbbf45
## 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 /🆑
85 lines
4.2 KiB
Plaintext
85 lines
4.2 KiB
Plaintext
/**
|
|
* # Whetstone
|
|
*
|
|
* Items used for sharpening stuff
|
|
*
|
|
* Whetstones can be used to increase an item's force, throw_force and wound_bonus and it changes its sharpness to SHARP_EDGED. Whetstones do not work with energy weapons. Two-handed weapons will only get the throw_force bonus. A whetstone can only be used once.
|
|
*
|
|
*/
|
|
/obj/item/sharpener
|
|
name = "whetstone"
|
|
icon = 'icons/obj/service/kitchen.dmi'
|
|
icon_state = "sharpener"
|
|
desc = "A block that makes things sharp."
|
|
force = 5
|
|
///Amount of uses the whetstone has. Set to -1 for functionally infinite uses.
|
|
var/uses = 1
|
|
///How much force the whetstone can add to an item.
|
|
var/increment = 4
|
|
///Maximum force sharpening items with the whetstone can result in
|
|
var/max = 30
|
|
///The prefix a whetstone applies when an item is sharpened with it
|
|
var/prefix = "sharpened"
|
|
///If TRUE, the whetstone will only sharpen already sharp items
|
|
var/requires_sharpness = TRUE
|
|
|
|
/obj/item/sharpener/attackby(obj/item/I, mob/user, list/modifiers, list/attack_modifiers)
|
|
if(uses == 0)
|
|
to_chat(user, span_warning("The sharpening block is too worn to use again!"))
|
|
return
|
|
if(I.force >= max || I.throwforce >= max) //So the whetstone never reduces force or throw_force
|
|
to_chat(user, span_warning("[I] is much too powerful to sharpen further!"))
|
|
return
|
|
if(requires_sharpness && !I.get_sharpness())
|
|
to_chat(user, span_warning("You can only sharpen items that are already sharp, such as knives!"))
|
|
return
|
|
if(is_type_in_list(I, list(/obj/item/melee/energy, /obj/item/dualsaber))) //You can't sharpen the photons in energy meelee weapons
|
|
to_chat(user, span_warning("You don't think \the [I] will be the thing getting modified if you use it on \the [src]!"))
|
|
return
|
|
|
|
//This block is used to check more things if the item has a relevant component.
|
|
var/signal_out = SEND_SIGNAL(I, COMSIG_ITEM_SHARPEN_ACT, increment, max) //Stores the bitflags returned by SEND_SIGNAL
|
|
if(signal_out & COMPONENT_BLOCK_SHARPEN_MAXED) //If the item's components enforce more limits on maximum power from sharpening, we fail
|
|
to_chat(user, span_warning("[I] is much too powerful to sharpen further!"))
|
|
return
|
|
if(signal_out & COMPONENT_BLOCK_SHARPEN_BLOCKED)
|
|
to_chat(user, span_warning("[I] is not able to be sharpened right now!"))
|
|
return
|
|
if((signal_out & COMPONENT_BLOCK_SHARPEN_ALREADY) || (I.force > initial(I.force) && !signal_out)) //No sharpening stuff twice
|
|
to_chat(user, span_warning("[I] has already been refined before. It cannot be sharpened further!"))
|
|
return
|
|
if(!(signal_out & COMPONENT_BLOCK_SHARPEN_APPLIED)) //If the item has a relevant component and COMPONENT_BLOCK_SHARPEN_APPLIED is returned, the item only gets the throw force increase
|
|
I.force = clamp(I.force + increment, 0, max)
|
|
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)
|
|
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."
|
|
uses-- //this doesn't cause issues because we check if uses == 0 earlier in this proc
|
|
if(uses == 0)
|
|
name = "worn out [name]" //whetstone becomes used whetstone
|
|
update_appearance()
|
|
|
|
/obj/item/sharpener/update_name()
|
|
name = "[!uses ? "worn out " : null][initial(name)]"
|
|
return ..()
|
|
|
|
/**
|
|
* # Super whetstone
|
|
*
|
|
* Extremely powerful admin-only whetstone
|
|
*
|
|
* Whetstone that adds 200 damage to an item, with the maximum force and throw_force reachable with it being 200. As with normal whetstones, energy weapons cannot be sharpened with it and two-handed weapons will only get the throw_force bonus.
|
|
*
|
|
*/
|
|
/obj/item/sharpener/super
|
|
name = "super whetstone"
|
|
desc = "A block that will make your weapon sharper than Einstein on adderall."
|
|
increment = 200
|
|
max = 200
|
|
prefix = "super-sharpened"
|
|
requires_sharpness = FALSE //Super whetstones can sharpen even tooboxes
|