mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 03:02:38 +00:00
## About The Pull Request - Deletes `spec_unarmedattack` - Deletes `spec_unarmedattacked` - Replaces `COMSIG_HUMAN_EARLY_UNARMED_ATTACK` with `COMSIG_LIVING_EARLY_UNARMED_ATTACK` - Replaces uses of `COMSIG_HUMAN_MELEE_UNARMED_ATTACK` with `COMSIG_LIVING_EARLY_UNARMED_ATTACK` - Fixes(?)(I've never seen this work) / Elementizes Monkey ability to bite while handcuffed - Monkey clever `attack paw` / `attack hand` thing is now handled the same on the human level (via `resolve_unarmed_attack`) ## Why It's Good For The Game Atomized from swing branch. I was really annoyed with these two signals, this kinda unifies the behavior between living and human mobs (they were already quite similar). One thing of note is that this will make dis-coordinated humans use `attack_paw` rather than `attack_hand`, so they'll bite people instead of punching them. I'm not sure if this is what we want, if we wanna tweak that before then I can by all means. ## Changelog 🆑 Melbert refactor: Refactored unarmed attacking mechanisms, this means dis-coordinated humans will now bite people like monkeys (like how coordinated monkeys punch people like humans?) refactor: Dis-coordinated humans smashing up machines now use their hands, rather than their paws /🆑 --------- Co-authored-by: san7890 <the@san7890.com>
46 lines
1.6 KiB
Plaintext
46 lines
1.6 KiB
Plaintext
/// Intercepts attacks from mobs with this component to instead repair specified structures.
|
|
/datum/element/structure_repair
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
/// How much to heal structures by
|
|
var/heal_amount
|
|
/// Typecache of types of structures to repair
|
|
var/list/structure_types_typecache
|
|
|
|
/datum/element/structure_repair/Attach(
|
|
datum/target,
|
|
heal_amount = 5,
|
|
structure_types_typecache = typecacheof(list(/obj/structure)),
|
|
)
|
|
. = ..()
|
|
if (!isliving(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
src.heal_amount = heal_amount
|
|
src.structure_types_typecache = structure_types_typecache
|
|
RegisterSignals(target, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_HOSTILE_PRE_ATTACKINGTARGET), PROC_REF(try_repair))
|
|
|
|
/datum/element/structure_repair/Detach(datum/source)
|
|
UnregisterSignal(source, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_HOSTILE_PRE_ATTACKINGTARGET))
|
|
return ..()
|
|
|
|
/// If the target is of a valid type, interrupt the attack chain to repair it instead
|
|
/datum/element/structure_repair/proc/try_repair(mob/living/fixer, atom/target, proximity)
|
|
SIGNAL_HANDLER
|
|
|
|
if (!proximity || !is_type_in_typecache(target, structure_types_typecache))
|
|
return NONE
|
|
|
|
if (target.get_integrity() >= target.max_integrity)
|
|
target.balloon_alert(fixer, "not damaged!")
|
|
return COMPONENT_CANCEL_ATTACK_CHAIN
|
|
|
|
target.repair_damage(heal_amount)
|
|
fixer.Beam(target, icon_state = "sendbeam", time = 0.4 SECONDS)
|
|
fixer.visible_message(
|
|
span_danger("[fixer] repairs [target]."),
|
|
span_danger("You repair [target], leaving it at <b>[round(target.get_integrity() * 100 / target.max_integrity)]%</b> stability."),
|
|
)
|
|
|
|
return COMPONENT_CANCEL_ATTACK_CHAIN
|