Files
Paradise/code/game/objects/items/weapons/whetstone.dm
warriorstar-orion 525c68d617 Attack chain, initial setup. (pull *immediately* for *any* TM issues) (#26834)
* refactor: Attack chain, initial setup.

* migrate curtain to make dreamchecker happy

* update thurible

* don't call attacked_by separately for legacy attack chain

* remove duplicate proc

* condense similar code, put allowances for legacy code in new procs

* update docs, include diagram source

* add comment on how to update diagram

* fix admonition

* mindflayer updates

* remove commented out code

* clarify all steps

* after_attack should be overridable

* whoops

* retrofit recent changes

* duh, can't restrict this yet because of tool_acts

* i hate ore bags with the fire of a thousand suns

* return correct value for object attack logic

* Various cleanups.

We don't want to attempt to pull stuff out of `/obj/item/attackby`,
because those pieces are part of the related objects' migrations, not
`/obj/item` itself. Attempting to do this causes knockon effects where
things expected to call e.g. `/obj/item/storage/attackby` in the call
chain were not ferried over to the new item interaction code, because
the related objects hadn't actually been migrated over yet.

I've used refactoring /obj/vehicle as the example for migrating
`attackby` methods instead.

* simplify some argument names

* fuck it

* make it do the thing

* Rename CI module call

* Prove that CI works

* improve test output

* aaand fix it again

* fix curtain tool interactions

* fix compile error

* fix compile error

* Better docs, introduce migration plan tool.
2024-12-02 23:36:36 +00:00

78 lines
3.3 KiB
Plaintext

/obj/item/whetstone
name = "whetstone"
icon = 'icons/obj/kitchen.dmi'
icon_state = "whetstone"
desc = "A block of stone used to sharpen things."
w_class = WEIGHT_CLASS_SMALL
usesound = 'sound/items/screwdriver.ogg'
var/used = FALSE
var/increment = 4
var/max = 30
var/prefix = "sharpened"
var/requires_sharpness = TRUE
var/claw_damage_increase = 2
/obj/item/whetstone/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(used)
to_chat(user, "<span class='warning'>The whetstone is too worn to use again!</span>")
return
if(requires_sharpness && !I.sharp)
to_chat(user, "<span class='warning'>You can only sharpen items that are already sharp, such as knives!</span>")
return
var/signal_out = SEND_SIGNAL(I, COMSIG_ITEM_SHARPEN_ACT, increment, max)
if((signal_out & COMPONENT_BLOCK_SHARPEN_MAXED) || I.force >= max || I.throwforce >= max) //If the item's components enforce more limits on maximum power from sharpening, we fail
to_chat(user, "<span class='warning'>[I] is much too powerful to sharpen further!</span>")
return
if(signal_out & COMPONENT_BLOCK_SHARPEN_BLOCKED)
to_chat(user, "<span class='warning'>[I] is not able to be sharpened right now!</span>")
return
if((signal_out & COMPONENT_BLOCK_SHARPEN_ALREADY) || (I.force > initial(I.force) && !(signal_out & COMPONENT_SHARPEN_APPLIED))) //No sharpening stuff twice
to_chat(user, "<span class='warning'>[I] has already been refined before. It cannot be sharpened further!</span>")
return
if(!(signal_out & COMPONENT_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)
user.visible_message("<span class='notice'>[user] sharpens [I] with [src]!</span>", "<span class='notice'>You sharpen [I], making it much more deadly than before.</span>")
if(!requires_sharpness)
set_sharpness(TRUE)
I.throwforce = clamp(I.throwforce + increment, 0, max)
I.name = "[prefix] [I.name]"
playsound(get_turf(src), usesound, 50, TRUE)
name = "worn out [name]"
desc = "[desc] At least, it used to."
used = TRUE
update_icon()
/obj/item/whetstone/attack_self__legacy__attackchain(mob/user)
if(used)
to_chat(user, "<span class='warning'>The whetstone is too worn to use again!</span>")
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/datum/unarmed_attack/attack = H.get_unarmed_attack()
if(istype(attack, /datum/unarmed_attack/claws))
var/datum/unarmed_attack/claws/C = attack
if(!C.has_been_sharpened)
C.has_been_sharpened = TRUE
attack.damage += claw_damage_increase
H.visible_message("<span class='notice'>[H] sharpens [H.p_their()] claws on [src]!</span>", "<span class='notice'>You sharpen your claws on [src].</span>")
playsound(get_turf(H), usesound, 50, 1)
name = "worn out [name]"
desc = "[desc] At least, it used to."
used = TRUE
update_icon()
else
to_chat(user, "<span class='warning'>You can not sharpen your claws any further!</span>")
/obj/item/whetstone/super
name = "super whetstone block"
desc = "A block of stone that will make your weapon sharper than Einstein on adderall."
increment = 200
max = 200
prefix = "super-sharpened"
requires_sharpness = FALSE
claw_damage_increase = 200