mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
## About The Pull Request 50 files. Sorry about that, I was faster today. Just merge without looking, it'll be fine. This is the end of `/machinery/` & `/stack/` `attackby()`s(that aren't actually meant for being attacked) when these are all merged. Like, 200 left? I think? Also, this one will make light replacer reloading slightly more difficult until whichever one converted the light replacer is merged. If, for some ungodly reason, this one gets merged first. Changes beyond conversion: if a `/porta_turret_construct` somehow became anchored out of sync with its construction steps, it's no longer softlocked you can no longer place an infinite amount of blackboxes into the blackbox recorder a TTV will no longer keep its ghost on your back when you cut its wires while wearing it RCLs will properly update their appearance when initially given their first coil The creator of `robot_suit/attackby()` has been cursed to spend a thousand years in the lake of fire ## Why It's Good For The Game Now that all of these are remade, you can find bugs in them and then get GBP for fixing them(not that my code would ever have bugs). ## Changelog 🆑 fix: It's no longer possible to softlock building a turret(if it ever was) fix: you can no longer stuff the blackbox recorder full with as many blackboxes as you've somehow collected fix: TTVs will no longer remain on your back as a ghost when you cut their wire straps fix: RCLs will now properly update their appearance when given their first coil of cleaners code: 50 files have been converted from attackby() to item_interaction() /🆑
86 lines
4.4 KiB
Plaintext
86 lines
4.4 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/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
|
if(uses == 0)
|
|
to_chat(user, span_warning("The sharpening block is too worn to use again!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(tool.force >= max || tool.throwforce >= max) //So the whetstone never reduces force or throw_force
|
|
to_chat(user, span_warning("[tool] is much too powerful to sharpen further!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(requires_sharpness && !tool.get_sharpness())
|
|
to_chat(user, span_warning("You can only sharpen items that are already sharp, such as knives!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(is_type_in_list(tool, 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 [tool] will be the thing getting modified if you use it on \the [src]!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
//This block is used to check more things if the item has a relevant component.
|
|
var/signal_out = SEND_SIGNAL(tool, 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("[tool] is much too powerful to sharpen further!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(signal_out & COMPONENT_BLOCK_SHARPEN_BLOCKED)
|
|
to_chat(user, span_warning("[tool] is not able to be sharpened right now!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
if((signal_out & COMPONENT_BLOCK_SHARPEN_ALREADY) || (tool.force > initial(tool.force) && !signal_out)) //No sharpening stuff twice
|
|
to_chat(user, span_warning("[tool] has already been refined before. It cannot be sharpened further!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
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
|
|
tool.force = clamp(tool.force + increment, 0, max)
|
|
tool.wound_bonus = tool.wound_bonus + increment //wound_bonus has no cap
|
|
user.visible_message(span_notice("[user] sharpens [tool] with [src]!"), span_notice("You sharpen [tool], making it much more deadly than before."))
|
|
playsound(src, 'sound/items/unsheath.ogg', 25, TRUE)
|
|
if(!(signal_out & COMPONENT_BLOCK_SHARPEN_SHARPNESS))
|
|
tool.sharpness = SHARP_EDGED //When you whetstone something, it becomes an edged weapon, even if it was previously dull or pointy
|
|
tool.throwforce = clamp(tool.throwforce + increment, 0, max)
|
|
tool.name = "[prefix] [tool.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()
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/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
|