Refactors butchering to a component - item-based butchering effectiveness, speed, and chances (#35744)

* Butchering component

* auto-butchering based on toolspeed

* Gives drills their butchering back

* redoes toggles
This commit is contained in:
Ashe Higgs
2018-02-25 15:50:16 -05:00
committed by CitadelStationBot
parent 0589c06507
commit a7d5e4cdcf
29 changed files with 207 additions and 30 deletions
+10 -6
View File
@@ -34,14 +34,18 @@
/mob/living/attackby(obj/item/I, mob/living/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if(user.a_intent == INTENT_HARM && stat == DEAD && butcher_results) //can we butcher it?
var/sharpness = I.is_sharp()
if(sharpness)
if(user.a_intent == INTENT_HARM && stat == DEAD && (butcher_results || guaranteed_butcher_results)) //can we butcher it?
GET_COMPONENT_FROM(butchering, /datum/component/butchering, I)
if(butchering && butchering.butchering_enabled)
to_chat(user, "<span class='notice'>You begin to butcher [src]...</span>")
playsound(loc, 'sound/weapons/slice.ogg', 50, 1, -1)
if(do_mob(user, src, 80/sharpness) && Adjacent(I))
harvest(user)
playsound(loc, butchering.butcher_sound, 50, TRUE, -1)
if(do_mob(user, src, butchering.speed) && Adjacent(I))
butchering.Butcher(user, src)
return 1
else if(I.is_sharp() && !butchering) //give sharp objects butchering functionality, for consistency
I.AddComponent(/datum/component/butchering, 80 * I.toolspeed)
attackby(I, user, params) //call the attackby again to refresh and do the butchering check again
return
return I.attack(src, user)