mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 23:58:07 +01: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>
75 lines
2.6 KiB
Plaintext
75 lines
2.6 KiB
Plaintext
/// You can't use items on anyone other than yourself if you stand in a blacklisted room
|
|
/datum/component/shy_in_room
|
|
can_transfer = TRUE
|
|
/// Typecache of areas you can't stand
|
|
var/list/blacklist
|
|
/// Message shown when you are in a blacklisted room
|
|
var/message = "%ROOM is too creepy to do that!"
|
|
|
|
/// _blacklist, and _message map to vars
|
|
/datum/component/shy_in_room/Initialize(blacklist, message)
|
|
if(!ismob(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
src.blacklist = blacklist
|
|
if(message)
|
|
src.message = message
|
|
|
|
/datum/component/shy_in_room/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_MOB_CLICKON, PROC_REF(on_clickon))
|
|
RegisterSignal(parent, COMSIG_LIVING_TRY_PULL, PROC_REF(on_try_pull))
|
|
RegisterSignal(parent, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(on_unarmed_attack))
|
|
RegisterSignal(parent, COMSIG_TRY_STRIP, PROC_REF(on_try_strip))
|
|
RegisterSignal(parent, COMSIG_TRY_ALT_ACTION, PROC_REF(on_try_alt_action))
|
|
|
|
|
|
/datum/component/shy_in_room/UnregisterFromParent()
|
|
UnregisterSignal(parent, list(
|
|
COMSIG_MOB_CLICKON,
|
|
COMSIG_LIVING_TRY_PULL,
|
|
COMSIG_LIVING_UNARMED_ATTACK,
|
|
COMSIG_TRY_STRIP,
|
|
COMSIG_TRY_ALT_ACTION,
|
|
))
|
|
|
|
/datum/component/shy_in_room/PostTransfer()
|
|
if(!ismob(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
/datum/component/shy_in_room/InheritComponent(datum/component/shy_in_room/friend, i_am_original, list/arguments)
|
|
if(i_am_original)
|
|
blacklist = friend.blacklist
|
|
message = friend.message
|
|
|
|
/// Returns TRUE or FALSE if you are in a blacklisted area
|
|
/datum/component/shy_in_room/proc/is_shy(atom/target)
|
|
var/mob/owner = parent
|
|
if(!length(blacklist) || (target in owner.DirectAccess()))
|
|
return
|
|
|
|
var/area/room = get_area(owner)
|
|
if(is_type_in_typecache(room, blacklist))
|
|
to_chat(owner, span_warning("[replacetext(message, "%ROOM", room)]"))
|
|
return TRUE
|
|
|
|
/datum/component/shy_in_room/proc/on_clickon(datum/source, atom/target, list/modifiers)
|
|
SIGNAL_HANDLER
|
|
if(modifiers[SHIFT_CLICK]) //let them examine their surroundings.
|
|
return
|
|
return is_shy(target) && COMSIG_MOB_CANCEL_CLICKON
|
|
|
|
/datum/component/shy_in_room/proc/on_try_pull(datum/source, atom/movable/target, force)
|
|
SIGNAL_HANDLER
|
|
return is_shy(target) && COMSIG_LIVING_CANCEL_PULL
|
|
|
|
/datum/component/shy_in_room/proc/on_unarmed_attack(datum/source, atom/target, proximity, modifiers)
|
|
SIGNAL_HANDLER
|
|
return is_shy(target) && COMPONENT_CANCEL_ATTACK_CHAIN
|
|
|
|
/datum/component/shy_in_room/proc/on_try_strip(datum/source, atom/target, obj/item/equipping)
|
|
SIGNAL_HANDLER
|
|
return is_shy(target) && COMPONENT_CANT_STRIP
|
|
|
|
/datum/component/shy_in_room/proc/on_try_alt_action(datum/source, atom/target)
|
|
SIGNAL_HANDLER
|
|
return is_shy(target) && COMPONENT_CANT_ALT_ACTION
|