diff --git a/code/__DEFINES/~skyrat_defines/keybindings.dm b/code/__DEFINES/~skyrat_defines/keybindings.dm index 76dc277fe59..fff432ea7ac 100644 --- a/code/__DEFINES/~skyrat_defines/keybindings.dm +++ b/code/__DEFINES/~skyrat_defines/keybindings.dm @@ -8,3 +8,4 @@ #define COMSIG_KB_CLIENT_WHISPER_DOWN "keybinding_client_whisper_down" #define COMSIG_KB_LIVING_COMBAT_INDICATOR "keybinding_living_combat_indicator" #define COMSIG_KB_CARBON_TOGGLE_SAFETY "keybinding_carbon_toggle_safety" +#define COMSIG_KB_MOVEMENT_ARMY_CRAWL_DOWN "keybinding_movement_army_crawl_down" diff --git a/code/__DEFINES/~skyrat_defines/signals.dm b/code/__DEFINES/~skyrat_defines/signals.dm index 800ccfd8601..fefa7b65ed5 100644 --- a/code/__DEFINES/~skyrat_defines/signals.dm +++ b/code/__DEFINES/~skyrat_defines/signals.dm @@ -110,3 +110,5 @@ /// Whenever we need the soulcatcher soul to communicate something. #define COMSIG_CARRIER_MOB_SAY "carrier_mob_communicate" +//signal sent when a mob tries to de-prone +#define COMSIG_MOVABLE_REMOVE_PRONE_STATE "living_remove_prone_state" diff --git a/code/__DEFINES/~skyrat_defines/traits.dm b/code/__DEFINES/~skyrat_defines/traits.dm index 116ad7e5fb2..05fdeef0731 100644 --- a/code/__DEFINES/~skyrat_defines/traits.dm +++ b/code/__DEFINES/~skyrat_defines/traits.dm @@ -5,3 +5,5 @@ #define SLIPPERY_MAX 9 /// Permit hud clothing trait #define TRAIT_PERMIT_HUD "permit_hud" +//for if we are army crawling or not +#define TRAIT_PRONE "prone" diff --git a/modular_skyrat/master_files/code/datums/components/prone_mob.dm b/modular_skyrat/master_files/code/datums/components/prone_mob.dm new file mode 100644 index 00000000000..739187bdab3 --- /dev/null +++ b/modular_skyrat/master_files/code/datums/components/prone_mob.dm @@ -0,0 +1,42 @@ +/datum/component/prone_mob + +/datum/component/prone_mob/Initialize(mob/living/source) + . = ..() + if(!isliving(parent)) + return COMPONENT_INCOMPATIBLE + source = parent + parent.add_traits(list(TRAIT_PRONE, TRAIT_FLOORED, TRAIT_NO_THROWING), type) + parent.add_traits(list(TRAIT_PRONE, TRAIT_FLOORED, TRAIT_NO_THROWING), type) + passtable_on(parent, type) + source.layer = PROJECTILE_HIT_THRESHHOLD_LAYER + +/datum/component/prone_mob/RegisterWithParent() + RegisterSignals(parent, list(COMSIG_MOVABLE_REMOVE_PRONE_STATE, COMSIG_LIVING_GET_PULLED), PROC_REF(stop_army_crawl)) + RegisterSignals(parent, list(COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_ITEM_ATTACK), PROC_REF(check_attack)) + RegisterSignal(parent, COMSIG_LIVING_TRY_PULL, PROC_REF(check_pull)) + +/datum/component/prone_mob/UnregisterFromParent() + UnregisterSignal(parent, list( + COMSIG_LIVING_GET_PULLED, + COMSIG_MOB_ATTACK_HAND, + COMSIG_MOB_ITEM_ATTACK, + COMSIG_LIVING_GET_PULLED, + COMSIG_LIVING_TRY_PULL + )) + return ..() + +/datum/component/prone_mob/proc/check_attack(mob/living/source) + SIGNAL_HANDLER + return COMPONENT_CANCEL_ATTACK_CHAIN + +/datum/component/prone_mob/proc/check_pull(mob/living/source) + SIGNAL_HANDLER + return COMSIG_LIVING_CANCEL_PULL + +/datum/component/prone_mob/proc/stop_army_crawl(mob/living/source) + SIGNAL_HANDLER + source = parent + parent.remove_traits(list(TRAIT_PRONE, TRAIT_FLOORED, TRAIT_NO_THROWING), type) + passtable_off(parent, type) + source.layer = MOB_LAYER + qdel(src) diff --git a/modular_skyrat/master_files/code/datums/keybinding/movement.dm b/modular_skyrat/master_files/code/datums/keybinding/movement.dm new file mode 100644 index 00000000000..33158afde60 --- /dev/null +++ b/modular_skyrat/master_files/code/datums/keybinding/movement.dm @@ -0,0 +1,14 @@ +/datum/keybinding/movement/army_crawl + hotkey_keys = list("K") + name = "prone" + full_name = "army crawl" + description = "lay yourself as close to the ground as possible after a short delay" + keybind_signal = COMSIG_KB_MOVEMENT_ARMY_CRAWL_DOWN + +/datum/keybinding/movement/army_crawl/down(client/user) + . = ..() + if(.) + return + var/mob/living/carbon/crawler = user.mob + if(istype(crawler, /mob/living/carbon)) + crawler.army_crawl() diff --git a/modular_skyrat/master_files/code/modules/mob/living/human/human.dm b/modular_skyrat/master_files/code/modules/mob/living/human/human.dm new file mode 100644 index 00000000000..ad8d7792d47 --- /dev/null +++ b/modular_skyrat/master_files/code/modules/mob/living/human/human.dm @@ -0,0 +1,5 @@ +/mob/living/carbon/human/can_use_guns(obj/item/G) + . = ..() + if(HAS_TRAIT(src, TRAIT_PRONE)) + to_chat(src, span_warning("You are crawling too low to used a ranged weapon!")) + return FALSE diff --git a/modular_skyrat/master_files/code/modules/mob/mob_movement.dm b/modular_skyrat/master_files/code/modules/mob/mob_movement.dm new file mode 100644 index 00000000000..ea6793d99b0 --- /dev/null +++ b/modular_skyrat/master_files/code/modules/mob/mob_movement.dm @@ -0,0 +1,21 @@ +/mob/living/carbon/verb/army_crawl() + set name = "Army Crawl" + set category = "IC" + + var/mob/living/carbon/crawler = src + + if(HAS_TRAIT(crawler, TRAIT_PRONE)) + visible_message("[crawler] starts to get up") + if(!do_after(crawler, 3 SECONDS)) + return + SEND_SIGNAL(crawler, COMSIG_MOVABLE_REMOVE_PRONE_STATE) + else + visible_message("[crawler] begins to lower themself further") + if(!do_after(crawler, 3 SECONDS, extra_checks = CALLBACK(crawler, PROC_REF(can_army_crawl)))) + if(!crawler.resting) + balloon_alert(crawler, "must be laying down!") + return + crawler.AddComponent(/datum/component/prone_mob) + +/mob/living/carbon/proc/can_army_crawl() + return resting diff --git a/modular_skyrat/modules/cortical_borer/code/abilities/_borer_abilities.dm b/modular_skyrat/modules/cortical_borer/code/abilities/_borer_abilities.dm index 2ee3889f715..e19407dd6db 100644 --- a/modular_skyrat/modules/cortical_borer/code/abilities/_borer_abilities.dm +++ b/modular_skyrat/modules/cortical_borer/code/abilities/_borer_abilities.dm @@ -392,15 +392,15 @@ if(!.) return FALSE var/mob/living/basic/cortical_borer/cortical_owner = owner - if(owner.layer == PROJECTILE_HIT_THRESHHOLD_LAYER) + if(HAS_TRAIT(cortical_owner, TRAIT_PRONE)) + SEND_SIGNAL(cortical_owner, COMSIG_MOVABLE_REMOVE_PRONE_STATE) cortical_owner.upgrade_flags &= ~BORER_HIDING owner.balloon_alert(owner, "stopped hiding") - owner.layer = BELOW_MOB_LAYER StartCooldown() return cortical_owner.upgrade_flags |= BORER_HIDING owner.balloon_alert(owner, "started hiding") - owner.layer = PROJECTILE_HIT_THRESHHOLD_LAYER + cortical_owner.AddComponent(/datum/component/prone_mob) StartCooldown() //to paralyze people diff --git a/tgstation.dme b/tgstation.dme index a9ab02840e5..5018ac1b6c6 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6494,6 +6494,7 @@ #include "modular_skyrat\master_files\code\datums\components\fullauto.dm" #include "modular_skyrat\master_files\code\datums\components\grillable.dm" #include "modular_skyrat\master_files\code\datums\components\leash.dm" +#include "modular_skyrat\master_files\code\datums\components\prone_mob.dm" #include "modular_skyrat\master_files\code\datums\components\shielded_suit.dm" #include "modular_skyrat\master_files\code\datums\components\tippable.dm" #include "modular_skyrat\master_files\code\datums\greyscale\config_types\greyscale_configs.dm" @@ -6501,6 +6502,7 @@ #include "modular_skyrat\master_files\code\datums\id_trim\solfed.dm" #include "modular_skyrat\master_files\code\datums\id_trim\syndicate.dm" #include "modular_skyrat\master_files\code\datums\keybinding\mob.dm" +#include "modular_skyrat\master_files\code\datums\keybinding\movement.dm" #include "modular_skyrat\master_files\code\datums\mind\_mind.dm" #include "modular_skyrat\master_files\code\datums\mood_events\drink_events.dm" #include "modular_skyrat\master_files\code\datums\mood_events\generic_negative_events.dm" @@ -6763,6 +6765,7 @@ #include "modular_skyrat\master_files\code\modules\mining\equipment\kinetic_crusher.dm" #include "modular_skyrat\master_files\code\modules\mining\equipment\kinetic_gauntlets.dm" #include "modular_skyrat\master_files\code\modules\mob\login.dm" +#include "modular_skyrat\master_files\code\modules\mob\mob_movement.dm" #include "modular_skyrat\master_files\code\modules\mob\dead\new_player\latejoin_menu.dm" #include "modular_skyrat\master_files\code\modules\mob\dead\new_player\preferences_setup.dm" #include "modular_skyrat\master_files\code\modules\mob\living\blood.dm" @@ -6782,6 +6785,7 @@ #include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\species_type\lizardpeople.dm" #include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\species_type\podpeople.dm" #include "modular_skyrat\master_files\code\modules\mob\living\carbon\human\species_type\snail.dm" +#include "modular_skyrat\master_files\code\modules\mob\living\human\human.dm" #include "modular_skyrat\master_files\code\modules\mob\living\human\species.dm" #include "modular_skyrat\master_files\code\modules\mob\living\human\species_types\ethereal.dm" #include "modular_skyrat\master_files\code\modules\mob\living\human\species_types\flypeople.dm"