Files
Yogstation/code/datums/components/bane.dm
SapphicOverload b13ed70f05 Replaces intents with combat mode (#21883)
* it begins

* Update gun.dm

* misc fixes

* Update gun.dm

* more fixes

* Update lightning_flow.dm

* i may be stupid

* Update suicide.dm

* fix mech strafing

* Update mecha.dm

* let there be qol

* ghost stuff

* Update screen_clockwork.dmi

* does the stuff

* stuff

* Update worldbreaker.dm

* moltial arts

* Update worldbreaker.dm

* CRITICAL FIX

* mech stuff

* Update tables_racks.dm

* stuff

* fix seismic arm

* buster/seismic arm fix 2

* saber + lockers

* stuff

* hand tele and pre_attack_secondary

* more right click acts

* Update closets.dm

* who did this

* heck

* Update mob.dm

* Update items.dm

* darkspawn fix

* fixes wound healing

* Update item_attack.dm

* minor qol stuff

* Update kinetic_crusher.dm

* Update kinetic_crusher.dm

* runtime fix

* Update kinetic_crusher.dm

* Update screen_plasmafire.dmi

* stuff

* syringes

* i am very silly

* death to /obj/item/toolset_handler

* Update assembly.dm

* surgery fix + hypo stuff

* mantis fix

* gas harpoon

* atmos machines

---------

Co-authored-by: Molti <gamingjoelouis@gmail.com>
2024-05-09 13:50:24 -05:00

46 lines
1.4 KiB
Plaintext

/datum/component/bane
dupe_mode = COMPONENT_DUPE_ALLOWED
var/mobtype
var/speciestype
var/damage_multiplier
/datum/component/bane/Initialize(mobtype, damage_multiplier=1)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
if(ispath(mobtype, /mob/living))
src.mobtype = mobtype
else if(ispath(mobtype, /datum/species))
speciestype = mobtype
else
return COMPONENT_INCOMPATIBLE
src.damage_multiplier = damage_multiplier
/datum/component/bane/RegisterWithParent()
if(speciestype)
RegisterSignal(parent, COMSIG_ITEM_AFTERATTACK, PROC_REF(speciesCheck))
else
RegisterSignal(parent, COMSIG_ITEM_AFTERATTACK, PROC_REF(mobCheck))
/datum/component/bane/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_ITEM_AFTERATTACK)
/datum/component/bane/proc/speciesCheck(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
if(!is_species(target, speciestype))
return
activate(source, target, user)
/datum/component/bane/proc/mobCheck(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
if(!istype(target, mobtype))
return
activate(source, target, user)
/datum/component/bane/proc/activate(obj/item/source, mob/living/target, mob/living/attacker)
if(!attacker.combat_mode)
return
var/extra_damage = max(0, source.force * damage_multiplier)
target.apply_damage(extra_damage, source.damtype, attacker.zone_selected)