Skip to content

Commit

Permalink
Merge pull request #172 from Skies-Of-Blue/butcher-buff
Browse files Browse the repository at this point in the history
Ports Butchering Effects From MapleStation
  • Loading branch information
SynthTwo authored Dec 26, 2024
2 parents 9ef8d5e + 6e078bb commit 88d1a90
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 25 deletions.
73 changes: 65 additions & 8 deletions code/datums/components/butchering.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/datum/component/butchering
/// Time in deciseconds taken to butcher something
var/speed = 8 SECONDS
var/speed = 6 SECONDS // IRIS EDIT: Originally 8 SECONDS
/// Percentage effectiveness; numbers above 100 yield extra drops
var/effectiveness = 100
/// Percentage increase to bonus item chance
Expand All @@ -15,14 +15,15 @@
var/datum/callback/butcher_callback

/datum/component/butchering/Initialize(
speed = 8 SECONDS,
speed = 6 SECONDS,
effectiveness = 100,
bonus_modifier = 0,
butcher_sound = 'sound/effects/butcher.ogg',
disabled = FALSE,
can_be_blunt = FALSE,
butcher_callback,
)
// IRIS EDIT: Originally 8 SECONDS
src.speed = speed
src.effectiveness = effectiveness
src.bonus_modifier = bonus_modifier
Expand All @@ -42,11 +43,15 @@
SIGNAL_HANDLER

if(!user.combat_mode)
return
//IRIS EDIT START: MapleStation Port https://github.com/MrMelbert/MapleStationCode/pull/612
return NONE
if(M.stat == DEAD && (M.butcher_results || M.guaranteed_butcher_results)) //can we butcher it?
if(butchering_enabled && (can_be_blunt || source.get_sharpness()))
INVOKE_ASYNC(src, PROC_REF(startButcher), source, M, user)
return COMPONENT_CANCEL_ATTACK_CHAIN
if(!DOING_INTERACTION(user, "[REF(M)]_butchering"))
INVOKE_ASYNC(src, PROC_REF(startButcher), source, M, user)
return COMPONENT_CANCEL_ATTACK_CHAIN
return NONE
//IRIS EDIT END

if(ishuman(M) && source.force && source.get_sharpness())
var/mob/living/carbon/human/H = M
Expand All @@ -56,17 +61,36 @@
return COMPONENT_CANCEL_ATTACK_CHAIN

if(H.has_status_effect(/datum/status_effect/neck_slice))
return
return NONE //IRIS EDIT: MapleStation Port https://github.com/MrMelbert/MapleStationCode/pull/612

INVOKE_ASYNC(src, PROC_REF(startNeckSlice), source, H, user)
return COMPONENT_CANCEL_ATTACK_CHAIN

return NONE //IRIS EDIT START: MapleStation Port https://github.com/MrMelbert/MapleStationCode/pull/612

/datum/component/butchering/proc/startButcher(obj/item/source, mob/living/M, mob/living/user)
to_chat(user, span_notice("You begin to butcher [M]..."))
playsound(M.loc, butcher_sound, 50, TRUE, -1)
if(do_after(user, speed, M) && M.Adjacent(source))
playsound(M, butcher_sound, 50, TRUE, -1)
if(do_after(user, speed, M, extra_checks = CALLBACK(src, PROC_REF(butcher_effects), source, M, user), interaction_key = "[REF(M)]_butchering") && M.Adjacent(source))
on_butchering(user, M)

/datum/component/butchering/proc/butcher_effects(obj/item/source, mob/living/butchering, mob/living/user)
if(user.next_move <= world.time)
user.face_atom(butchering)
// performs an attack against the mob
var/old_combat_mode = user.combat_mode
user.set_combat_mode(TRUE, TRUE)
source.melee_attack_chain(user, butchering)
user.set_combat_mode(old_combat_mode, TRUE)
// and play the sound
playsound(butchering, butcher_sound, 50, TRUE, -1)
// start our own click cd
user.changeNext_move(0.6 SECONDS)
// so the butchering doesn't stop
return TRUE

//IRIS EDIT END

/datum/component/butchering/proc/startNeckSlice(obj/item/source, mob/living/carbon/human/H, mob/living/user)
if(DOING_INTERACTION_WITH_TARGET(user, H))
to_chat(user, span_warning("You're already interacting with [H]!"))
Expand Down Expand Up @@ -221,6 +245,13 @@
if(victim.stat == DEAD && (victim.butcher_results || victim.guaranteed_butcher_results))
on_butchering(parent, victim)

//IRIS ADDITION START: MapleStation Port https://github.com/MrMelbert/MapleStationCode/pull/612

/datum/component/butchering/recycler/butcher_effects(obj/item/source, mob/living/butchering, mob/living/user)
return TRUE // p sure this won't work

//IRIS ADDITION END

/datum/component/butchering/mecha

/datum/component/butchering/mecha/RegisterWithParent()
Expand All @@ -242,6 +273,13 @@
SIGNAL_HANDLER
INVOKE_ASYNC(src, PROC_REF(on_butchering), chassis, target)

//IRIS ADDITION START: MapleStation Port https://github.com/MrMelbert/MapleStationCode/pull/612

/datum/component/butchering/mecha/butcher_effects(obj/item/source, mob/living/butchering, mob/living/user)
return TRUE // could give this one, unsure if it's needed though

//IRIS ADDITION END

/datum/component/butchering/wearable

/datum/component/butchering/wearable/RegisterWithParent()
Expand Down Expand Up @@ -276,3 +314,22 @@
if(!isliving(target))
return NONE
return onItemAttack(parent, target, user)

//IRIS ADDITION START: MapleStation Port https://github.com/MrMelbert/MapleStationCode/pull/612

/datum/component/butchering/wearable/butcher_effects(obj/item/source, mob/living/butchering, mob/living/user)
if(user.next_move <= world.time)
user.face_atom(butchering)
// performs an attack against the mob
var/old_combat_mode = user.combat_mode
user.set_combat_mode(TRUE, TRUE)
user.UnarmedAttack(butchering, TRUE)
user.set_combat_mode(old_combat_mode, TRUE)
// and play the sound
playsound(butchering, butcher_sound, 50, TRUE, -1)
// start our own click cd
user.changeNext_move(0.6 SECONDS)
// so the butchering doesn't stop
return TRUE

//IRIS ADDITION END
2 changes: 1 addition & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
species_exception = string_list(species_exception)

if(sharpness && force > 5) //give sharp objects butchering functionality, for consistency
AddComponent(/datum/component/butchering, speed = 8 SECONDS * toolspeed)
AddComponent(/datum/component/butchering, speed = 6 SECONDS * toolspeed) // IRIS EDIT: Originally 8 SECONDS

if(!greyscale_config && greyscale_colors && (greyscale_config_worn || greyscale_config_belt || greyscale_config_inhand_right || greyscale_config_inhand_left))
update_greyscale()
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/fireaxe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ GLOBAL_DATUM(bridge_axe, /obj/item/fireaxe)
GLOB.bridge_axe = src

AddComponent(/datum/component/butchering, \
speed = 10 SECONDS, \
speed = 7.5 SECONDS, \
effectiveness = 80, \
bonus_modifier = 0 , \
butcher_sound = hitsound, \
)
// IRIS EDIT: Originally 10 SECONDS
//axes are not known for being precision butchering tools
AddComponent(/datum/component/two_handed, force_unwielded=force_unwielded, force_wielded=force_wielded, icon_wielded="[base_icon_state]1")

Expand Down
6 changes: 4 additions & 2 deletions code/game/objects/items/knives.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@
///Adds the butchering component, used to override stats for special cases
/obj/item/knife/proc/set_butchering()
AddComponent(/datum/component/butchering, \
speed = 8 SECONDS - force, \
speed = 6 SECONDS - force, \
effectiveness = 100, \
bonus_modifier = force - 10, \
)
// IRIS EDIT: Originally 8 SECONDS
//bonus chance increases depending on force

/obj/item/knife/suicide_act(mob/living/user)
Expand Down Expand Up @@ -113,10 +114,11 @@

/obj/item/knife/hunting/set_butchering()
AddComponent(/datum/component/butchering, \
speed = 8 SECONDS - force, \
speed = 6 SECONDS - force, \
effectiveness = 100, \
bonus_modifier = force + 10, \
)
// IRIS EDIT: Originally 8 SECONDS

/obj/item/knife/combat
name = "combat knife"
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/spear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@
)

AddComponent(/datum/component/butchering, \
speed = 10 SECONDS, \
speed = 7.5 SECONDS, \
effectiveness = 70, \
)
// IRIS EDIT: Originally 10 SECONDS
AddComponent(/datum/component/two_handed, \
force_unwielded = force_unwielded, \
force_wielded = force_wielded, \
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/tools/spess_knife.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
/obj/item/spess_knife/Initialize(mapload)
. = ..()
AddComponent(/datum/component/butchering, \
speed = 8 SECONDS, \
speed = 6 SECONDS, \
effectiveness = 100, \
disabled = TRUE, \
)
// IRIS EDIT: Originally 8 SECONDS
options = list(
NO_TOOL = image(icon = 'icons/obj/tools.dmi', icon_state = initial(icon_state)),
TOOL_KNIFE = image(icon = 'icons/obj/tools.dmi', icon_state = "[initial(icon_state)]_[TOOL_KNIFE]"),
Expand Down
3 changes: 2 additions & 1 deletion code/modules/antagonists/cult/cult_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,10 @@ Striking a noncultist, however, will tear their flesh."}
/obj/item/melee/cultblade/halberd/Initialize(mapload)
. = ..()
AddComponent(/datum/component/butchering, \
speed = 10 SECONDS, \
speed = 7.5 SECONDS, \
effectiveness = 90, \
)
// IRIS EDIT: Originally 10 SECONDS
AddComponent(/datum/component/two_handed, \
force_unwielded = 17, \
force_wielded = 24, \
Expand Down
3 changes: 2 additions & 1 deletion code/modules/antagonists/nightmare/nightmare_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
AddComponent(/datum/component/butchering, \
speed = 8 SECONDS, \
speed = 6 SECONDS, \
effectiveness = 70, \
)
// IRIS EDIT: Originally 8 SECONDS
AddComponent(/datum/component/light_eater)

/obj/item/light_eater/equipped(mob/user, slot, initial = FALSE)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/hydroponics/hydroitemdefines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,10 @@
/obj/item/hatchet/Initialize(mapload)
. = ..()
AddComponent(/datum/component/butchering, \
speed = 7 SECONDS, \
speed = 6 SECONDS, \
effectiveness = 100, \
)
// IRIS EDIT: Originally 7 SECONDS

/obj/item/hatchet/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] is chopping at [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
Expand Down
6 changes: 4 additions & 2 deletions code/modules/jobs/job_types/chaplain/chaplain_nullrod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@
. = ..()
AddComponent(
/datum/component/butchering, \
speed = 7 SECONDS, \
speed = 6 SECONDS, \
effectiveness = 110, \
)
// IRIS EDIT: Originally 7 SECONDS

/obj/item/nullrod/vibro/spellblade
name = "dormant spellblade"
Expand Down Expand Up @@ -535,9 +536,10 @@
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
AddComponent(/datum/component/butchering, \
speed = 8 SECONDS, \
speed = 6 SECONDS, \
effectiveness = 70, \
)
// IRIS EDIT: Originally 8 SECONDS

// Unholy Blessing - Just a reskinned dark blessing.

Expand Down
3 changes: 2 additions & 1 deletion code/modules/mining/equipment/mining_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@
/obj/item/shovel/Initialize(mapload)
. = ..()
AddComponent(/datum/component/butchering, \
speed = 15 SECONDS, \
speed = 11.5 SECONDS, \
effectiveness = 40, \
)
// IRIS EDIT: Originally 15 SECONDS
//it's sharp, so it works, but barely.
AddElement(/datum/element/gravedigger)

Expand Down
3 changes: 2 additions & 1 deletion code/modules/mining/lavaland/megafauna_loot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,10 @@
SSpoints_of_interest.make_point_of_interest(src)
AddComponent(\
/datum/component/butchering, \
speed = 15 SECONDS, \
speed = 11.5 SECONDS, \
effectiveness = 90, \
)
// IRIS EDIT: Originally 15 SECONDS

/obj/item/melee/ghost_sword/Destroy()
for(var/mob/dead/observer/G in spirits)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/reagents/reagent_containers/cups/glassbottle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,10 @@
. = ..()
AddComponent(/datum/component/caltrop, min_damage = force)
AddComponent(/datum/component/butchering, \
speed = 20 SECONDS, \
speed = 15 SECONDS, \
effectiveness = 55, \
)
// IRIS EDIT: Originally 20 SECONDS

/// Mimics the appearance and properties of the passed in bottle.
/// Takes the broken bottle to mimic, and the thing the bottle was broken agaisnt as args
Expand Down
3 changes: 2 additions & 1 deletion code/modules/surgery/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@
/obj/item/scalpel/Initialize(mapload)
. = ..()
AddComponent(/datum/component/butchering, \
speed = 8 SECONDS * toolspeed, \
speed = 6 SECONDS * toolspeed, \
effectiveness = 100, \
bonus_modifier = 0, \
)
// IRIS EDIT: Originally 8 SECONDS
AddElement(/datum/element/eyestab)

/obj/item/scalpel/get_surgery_tool_overlay(tray_extended)
Expand Down
3 changes: 2 additions & 1 deletion modular_nova/modules/exp_corps/code/tomahawk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/obj/item/melee/tomahawk/Initialize(mapload)
. = ..()
AddComponent(/datum/component/butchering, \
speed = 7 SECONDS, \
speed = 6 SECONDS, \
effectiveness = 100, \
)
// IRIS EDIT: Originally 7 SECONDS
3 changes: 2 additions & 1 deletion modular_nova/modules/reagent_forging/code/forge_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@
/obj/item/forging/reagent_weapon/dagger/Initialize(mapload)
. = ..()
AddComponent(/datum/component/butchering, \
speed = 8 SECONDS, \
speed = 6 SECONDS, \
effectiveness = 100, \
bonus_modifier = force + 7, \
)
// IRIS EDIT: Originally 8 SECONDS

/datum/embed_data/forged_dagger
embed_chance = 50
Expand Down

0 comments on commit 88d1a90

Please sign in to comment.