From d72fcc949c23485ca42fdde333b99fa127950b66 Mon Sep 17 00:00:00 2001 From: Fira Date: Wed, 8 Nov 2023 16:45:58 +0000 Subject: [PATCH 1/3] Refactor Freeze --- code/__DEFINES/traits.dm | 8 +++++++ code/datums/agents/tools/chloroform.dm | 4 ++-- .../effects/xeno_strains/boiler_trap.dm | 12 ++++------ code/datums/mob_hud.dm | 2 +- code/game/objects/items/storage/smartpack.dm | 6 ++--- .../objects/structures/vulture_spotter.dm | 4 ++-- .../admin/player_panel/actions/general.dm | 8 +++++-- .../admin/player_panel/player_panel.dm | 2 +- code/modules/cm_marines/m2c.dm | 2 +- code/modules/cm_marines/smartgun_mount.dm | 4 ++-- .../living/carbon/human/human_abilities.dm | 6 ++--- .../mob/living/carbon/human/human_defense.dm | 10 -------- .../mob/living/carbon/human/human_helpers.dm | 1 - .../mob/living/carbon/human/update_icons.dm | 8 +++++++ .../mob/living/carbon/xenomorph/XenoProcs.dm | 8 ++++--- .../abilities/ability_helper_procs.dm | 4 ++-- .../abilities/burrower/burrower_powers.dm | 6 ++--- .../abilities/defender/defender_powers.dm | 4 ++-- .../xenomorph/abilities/general_abilities.dm | 2 +- .../xenomorph/abilities/general_powers.dm | 6 ++--- .../abilities/praetorian/praetorian_powers.dm | 24 +++++++++---------- .../abilities/predalien/predalien_powers.dm | 11 +++++---- .../abilities/ravager/ravager_powers.dm | 4 ++-- .../mutators/strains/praetorian/oppressor.dm | 2 +- code/modules/mob/living/init_signals.dm | 17 +++++++++++++ code/modules/mob/mob.dm | 18 +------------- code/modules/mob/mob_defines.dm | 1 - colonialmarines.dme | 1 + 28 files changed, 96 insertions(+), 89 deletions(-) create mode 100644 code/modules/mob/living/init_signals.dm diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index ef500b6af9f8..45060eb55e30 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -131,6 +131,8 @@ /// Example trait // #define TRAIT_X "t_x" //-- mob traits -- +/// Prevents voluntary movement. +#define TRAIT_IMMOBILIZED "immobilized" // SPECIES TRAITS /// Knowledge of Yautja technology #define TRAIT_YAUTJA_TECH "t_yautja_tech" @@ -279,6 +281,7 @@ GLOBAL_LIST_INIT(mob_traits, list( */ GLOBAL_LIST_INIT(traits_by_type, list( /mob = list( + "TRAIT_IMMOBILIZED" = TRAIT_IMMOBILIZED, "TRAIT_YAUTJA_TECH" = TRAIT_YAUTJA_TECH, "TRAIT_SUPER_STRONG" = TRAIT_SUPER_STRONG, "TRAIT_FOREIGN_BIO" = TRAIT_FOREIGN_BIO, @@ -390,3 +393,8 @@ GLOBAL_LIST(trait_name_map) //Status trait coming from clothing. #define TRAIT_SOURCE_CLOTHING "t_s_clothing" + +/// traits associated with actively interacted machinery +#define INTERACTION_TRAIT "interaction" +/// traits from chloroform usage +#define CHLOROFORM_TRAIT "chloroform" diff --git a/code/datums/agents/tools/chloroform.dm b/code/datums/agents/tools/chloroform.dm index 464533309bcc..12eaa1b92699 100644 --- a/code/datums/agents/tools/chloroform.dm +++ b/code/datums/agents/tools/chloroform.dm @@ -47,7 +47,7 @@ /obj/item/weapon/chloroform/proc/grab_stun(mob/living/M, mob/living/user) M.anchored = TRUE - M.frozen = TRUE + ADD_TRAIT(M, TRAIT_IMMOBILIZED, CHLOROFORM_TRAIT) M.density = FALSE M.able_to_speak = FALSE M.update_canmove() @@ -82,7 +82,7 @@ M.density = TRUE M.able_to_speak = TRUE M.layer = MOB_LAYER - M.unfreeze() + REMOVE_TRAIT(M, TRAIT_IMMOBILIZED, CHLOROFORM_TRAIT) QDEL_NULL(mask_item) diff --git a/code/datums/effects/xeno_strains/boiler_trap.dm b/code/datums/effects/xeno_strains/boiler_trap.dm index 61451391e816..1833b9641a9a 100644 --- a/code/datums/effects/xeno_strains/boiler_trap.dm +++ b/code/datums/effects/xeno_strains/boiler_trap.dm @@ -4,19 +4,17 @@ effect_name = "boiler trap" duration = null flags = INF_DURATION - /// Ghetto flag indicating whether we actually placed the freeze or not, until we have an actual effects system - var/freezer = FALSE /datum/effects/boiler_trap/New(atom/A, mob/from, last_dmg_source, zone) . = ..() if(!QDELETED(src)) var/mob/M = affected_atom - freezer = M.freeze() + ADD_TRAIT(M, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY(effect_name)) /datum/effects/boiler_trap/Destroy(force) - if(ismob(affected_atom) && freezer) + if(ismob(affected_atom)) var/mob/M = affected_atom - M.unfreeze() + REMOVE_TRAIT(M, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY(effect_name)) return ..() /datum/effects/boiler_trap/validate_atom(atom/A) @@ -29,7 +27,5 @@ . = ..() if(!.) return FALSE var/mob/M = affected_atom - if(M.frozen) return TRUE - if(!freezer) - freezer = M.freeze() + ADD_TRAIT(M, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY(effect_name)) return TRUE diff --git a/code/datums/mob_hud.dm b/code/datums/mob_hud.dm index 65c5a47896fa..b0df9bca7745 100644 --- a/code/datums/mob_hud.dm +++ b/code/datums/mob_hud.dm @@ -798,7 +798,7 @@ var/global/image/hud_icon_hudfocus tag_holder.overlays += image('icons/mob/hud/hud.dmi', src, "prae_tag") // Hacky, but works. Currently effects are hard to make with precise timings - var/freeze_found = frozen + var/freeze_found = HAS_TRAIT(src, TRAIT_IMMOBILIZED) && !buckled && !lying if (freeze_found) freeze_holder.overlays += image('icons/mob/hud/hud.dmi', src, "xeno_freeze") diff --git a/code/game/objects/items/storage/smartpack.dm b/code/game/objects/items/storage/smartpack.dm index 8df079c92ca4..0b0fd05eac17 100644 --- a/code/game/objects/items/storage/smartpack.dm +++ b/code/game/objects/items/storage/smartpack.dm @@ -144,7 +144,7 @@ immobile_form = FALSE M.status_flags |= CANPUSH M.anchored = FALSE - M.unfreeze() + REMOVE_TRAIT(M, TRAIT_IMMOBILIZED, TRAIT_SOURCE_EQUIPMENT(WEAR_BACK)) ..() /obj/item/storage/backpack/marine/smartpack/attack_self(mob/user) @@ -236,7 +236,7 @@ battery_charge -= IMMOBILE_COST user.status_flags &= ~CANPUSH user.anchored = TRUE - user.frozen = TRUE + ADD_TRAIT(user, TRAIT_IMMOBILIZED, TRAIT_SOURCE_EQUIPMENT(WEAR_BACK)) to_chat(user, SPAN_DANGER("[name] beeps, \"You are anchored in place and cannot be moved.\"")) to_chat(user, SPAN_INFO("The current charge reads [battery_charge]/[SMARTPACK_MAX_POWER_STORED]")) @@ -248,7 +248,7 @@ else user.status_flags |= CANPUSH user.anchored = FALSE - user.unfreeze() + REMOVE_TRAIT(user, TRAIT_IMMOBILIZED, TRAIT_SOURCE_EQUIPMENT(WEAR_BACK)) to_chat(user, SPAN_DANGER("[name] beeps, \"You can now move again.\"")) user.remove_filter("synth_immobile_form") diff --git a/code/game/objects/structures/vulture_spotter.dm b/code/game/objects/structures/vulture_spotter.dm index 50505ab239b8..44efd5ce84ea 100644 --- a/code/game/objects/structures/vulture_spotter.dm +++ b/code/game/objects/structures/vulture_spotter.dm @@ -92,7 +92,7 @@ user.lighting_alpha = 127 user.sync_lighting_plane_alpha() user.overlay_fullscreen("vulture_spotter", /atom/movable/screen/fullscreen/vulture/spotter) - user.freeze() + ADD_TRAIT(user, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Vulture spotter")) user.status_flags |= IMMOBILE_ACTION user.visible_message(SPAN_NOTICE("[user] looks through [src]."),SPAN_NOTICE("You look through [src], ready to go!")) user.forceMove(loc) @@ -105,7 +105,7 @@ /obj/structure/vulture_spotter_tripod/on_unset_interaction(mob/user) user.status_flags &= ~IMMOBILE_ACTION user.visible_message(SPAN_NOTICE("[user] looks up from [src]."),SPAN_NOTICE("You look up from [src].")) - user.unfreeze() + REMOVE_TRAIT(user, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Vulture spotter")) user.reset_view(null) user.Move(get_step(src, reverse_direction(src.dir))) user.client?.change_view(world_view_size, src) diff --git a/code/modules/admin/player_panel/actions/general.dm b/code/modules/admin/player_panel/actions/general.dm index 174dfef55ad8..c3788ced7d33 100644 --- a/code/modules/admin/player_panel/actions/general.dm +++ b/code/modules/admin/player_panel/actions/general.dm @@ -109,9 +109,13 @@ name = "Toggle Frozen" /datum/player_action/toggle_frozen/act(client/user, mob/target, list/params) - target.frozen = text2num(params["freeze"]) + var/frozen = text2num(params["freeze"]) + if(frozen) + ADD_TRAIT(target, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ADMIN) + else + REMOVE_TRAIT(target, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ADMIN) - message_admins("[key_name_admin(user)] [target.frozen? "froze" : "unfroze"] [key_name_admin(target)]") + message_admins("[key_name_admin(user)] [frozen? "froze" : "unfroze"] [key_name_admin(target)]") return TRUE // MESSAGE diff --git a/code/modules/admin/player_panel/player_panel.dm b/code/modules/admin/player_panel/player_panel.dm index 4b79c8c91569..1843f7b6ad9b 100644 --- a/code/modules/admin/player_panel/player_panel.dm +++ b/code/modules/admin/player_panel/player_panel.dm @@ -475,7 +475,7 @@ .["mob_name"] = targetMob.name .["mob_sleeping"] = targetMob.sleeping - .["mob_frozen"] = targetMob.frozen + .["mob_frozen"] = HAS_TRAIT_FROM(targetMob, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ADMIN) .["mob_speed"] = targetMob.speed .["mob_status_flags"] = targetMob.status_flags diff --git a/code/modules/cm_marines/m2c.dm b/code/modules/cm_marines/m2c.dm index a0943bb7f0a6..75c96f67176b 100644 --- a/code/modules/cm_marines/m2c.dm +++ b/code/modules/cm_marines/m2c.dm @@ -466,7 +466,7 @@ return if(user.get_active_hand() == null && user.get_inactive_hand() == null) - user.freeze() + ADD_TRAIT(user, TRAIT_IMMOBILIZED, INTERACTION_TRAIT) user.set_interaction(src) give_action(user, /datum/action/human_action/mg_exit) else diff --git a/code/modules/cm_marines/smartgun_mount.dm b/code/modules/cm_marines/smartgun_mount.dm index b450f5f02841..225b85506279 100644 --- a/code/modules/cm_marines/smartgun_mount.dm +++ b/code/modules/cm_marines/smartgun_mount.dm @@ -831,7 +831,7 @@ to_chat(user, SPAN_WARNING("You aren't allowed to use firearms!")) return else - user.freeze() + ADD_TRAIT(user, TRAIT_IMMOBILIZED, INTERACTION_TRAIT) user.set_interaction(src) give_action(user, /datum/action/human_action/mg_exit) @@ -859,7 +859,7 @@ SEND_SIGNAL(src, COMSIG_GUN_INTERRUPT_FIRE) user.status_flags &= ~IMMOBILE_ACTION user.visible_message(SPAN_NOTICE("[user] lets go of \the [src]."),SPAN_NOTICE("You let go of \the [src], letting the gun rest.")) - user.unfreeze() + REMOVE_TRAIT(user, TRAIT_IMMOBILIZED, INTERACTION_TRAIT) UnregisterSignal(user, list(COMSIG_MOB_MOUSEUP, COMSIG_MOB_MOUSEDOWN, COMSIG_MOB_MOUSEDRAG)) user.reset_view(null) user.remove_temp_pass_flags(PASS_MOB_THRU) // this is necessary because being knocked over while using the gun makes you incorporeal diff --git a/code/modules/mob/living/carbon/human/human_abilities.dm b/code/modules/mob/living/carbon/human/human_abilities.dm index fda4cea20ad1..027e279e2983 100644 --- a/code/modules/mob/living/carbon/human/human_abilities.dm +++ b/code/modules/mob/living/carbon/human/human_abilities.dm @@ -456,21 +456,21 @@ CULT to_chat(chosen, SPAN_HIGHDANGER("You feel a dangerous presence in the back of your head. You find yourself unable to move!")) - chosen.frozen = TRUE + ADD_TRAIT(chosen, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Cultist Stun")) chosen.update_canmove() chosen.update_xeno_hostile_hud() if(!do_after(H, 2 SECONDS, INTERRUPT_ALL | BEHAVIOR_IMMOBILE, BUSY_ICON_HOSTILE, chosen, INTERRUPT_ALL, BUSY_ICON_HOSTILE)) to_chat(H, SPAN_XENOMINORWARNING("You decide not to stun [chosen].")) - unroot_human(chosen) + unroot_human(chosen, TRAIT_SOURCE_ABILITY("Cultist Stun")) enter_cooldown(5 SECONDS) return enter_cooldown() - unroot_human(chosen) + unroot_human(chosen, TRAIT_SOURCE_ABILITY("Cultist Stun")) chosen.apply_effect(10, PARALYZE) chosen.make_jittery(105) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index a8734afd7301..ede57d64241b 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -378,16 +378,6 @@ Contains most of the procs that are called when a mob is attacked by something var/list/overlap = compare_group & access_to_check return length(overlap) -/mob/living/carbon/human/freeze() - . = ..() - if(.) - update_xeno_hostile_hud() - -/mob/living/carbon/human/unfreeze() - . = ..() - if(.) - update_xeno_hostile_hud() - /mob/living/carbon/human/get_target_lock(access_to_check) if(isnull(access_to_check)) return diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm index 7f36df8ceae2..c4690c03068f 100644 --- a/code/modules/mob/living/carbon/human/human_helpers.dm +++ b/code/modules/mob/living/carbon/human/human_helpers.dm @@ -230,7 +230,6 @@ /mob/living/carbon/human/proc/disable_special_flags() status_flags |= CANPUSH anchored = FALSE - frozen = FALSE /mob/living/carbon/human/proc/disable_special_items() set waitfor = FALSE // Scout decloak animation uses sleep(), which is problematic for taser gun diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index fd9c786bd147..1dcefec9b63b 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -799,3 +799,11 @@ Applied by gun suicide and high impact bullet executions, removed by rejuvenate, #undef FIRE_LAYER #undef BURST_LAYER +/* To update the rooting graphic effect. Surely there's a better way... */ +/mob/living/carbon/human/on_immobilized_trait_gain(datum/source) + . = ..() + update_xeno_hostile_hud() + +/mob/living/carbon/human/on_immobilized_trait_loss(datum/source) + . = ..() + update_xeno_hostile_hud() diff --git a/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm b/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm index 3fd8e53024d5..0135e8c0acb9 100644 --- a/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm +++ b/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm @@ -320,9 +320,8 @@ if(pounceAction.freeze_play_sound) playsound(loc, rand(0, 100) < 95 ? 'sound/voice/alien_pounce.ogg' : 'sound/voice/alien_pounce2.ogg', 25, 1) canmove = FALSE - frozen = TRUE - pounceAction.freeze_timer_id = addtimer(CALLBACK(src, PROC_REF(unfreeze)), pounceAction.freeze_time, TIMER_STOPPABLE) - + ADD_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Pounce")) + pounceAction.freeze_timer_id = addtimer(CALLBACK(src, PROC_REF(unfreeze_pounce)), pounceAction.freeze_time, TIMER_STOPPABLE) pounceAction.additional_effects(M) if(pounceAction.slash) @@ -330,6 +329,9 @@ throwing = FALSE //Reset throwing since something was hit. +/mob/living/carbon/xenomorph/proc/unfreeze_pounce() + REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Pounce")) + /mob/living/carbon/xenomorph/proc/pounced_mob_wrapper(mob/living/L) pounced_mob(L) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/ability_helper_procs.dm b/code/modules/mob/living/carbon/xenomorph/abilities/ability_helper_procs.dm index 705837699275..82d6ff9ccb4a 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/ability_helper_procs.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/ability_helper_procs.dm @@ -160,11 +160,11 @@ SPAN_XENOWARNING("You vomit globs of vile stuff all over [O]. It begins to sizzle and melt under the bubbling mess of acid!"), null, 5) playsound(loc, "sound/bullets/acid_impact1.ogg", 25) -/proc/unroot_human(mob/living/carbon/H) +/proc/unroot_human(mob/living/carbon/H, trait_source) if (!isxeno_human(H)) return - H.frozen = 0 + REMOVE_TRAIT(H, TRAIT_IMMOBILIZED, trait_source) H.update_canmove() if(ishuman(H)) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm index 4d3aae33ae9c..18c8a4780589 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm @@ -36,7 +36,6 @@ // TODO Make immune to all damage here. to_chat(src, SPAN_XENOWARNING("You burrow yourself into the ground.")) burrow = TRUE - frozen = TRUE invisibility = 101 anchored = TRUE density = FALSE @@ -46,6 +45,7 @@ COMSIG_LIVING_FLAMER_CROSSED, COMSIG_LIVING_FLAMER_FLAMED, ), PROC_REF(flamer_crossed_immune)) + ADD_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Burrow")) ADD_TRAIT(src, TRAIT_ABILITY_BURROWED, TRAIT_SOURCE_ABILITY("Burrow")) playsound(src.loc, 'sound/effects/burrowing_b.ogg', 25) update_canmove() @@ -75,8 +75,8 @@ COMSIG_LIVING_FLAMER_CROSSED, COMSIG_LIVING_FLAMER_FLAMED, )) + REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Burrow")) REMOVE_TRAIT(src, TRAIT_ABILITY_BURROWED, TRAIT_SOURCE_ABILITY("Burrow")) - frozen = FALSE invisibility = FALSE anchored = FALSE density = TRUE @@ -166,9 +166,7 @@ /mob/living/carbon/xenomorph/proc/do_tunnel(turf/T) to_chat(src, SPAN_NOTICE("You tunnel to your destination.")) anchored = FALSE - unfreeze() forceMove(T) - UnregisterSignal(src, COMSIG_LIVING_FLAMER_FLAMED) burrow_off() /mob/living/carbon/xenomorph/proc/do_tunnel_cooldown() diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm index 67e16d4b70de..4bb4a442d1f2 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm @@ -215,7 +215,7 @@ else X.armor_deflection_buff += 30 X.armor_explosive_buff += 60 - X.frozen = TRUE + ADD_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Fortify")) X.anchored = TRUE X.small_explosives_stun = FALSE X.update_canmove() @@ -226,7 +226,7 @@ X.fortify = TRUE else to_chat(X, SPAN_XENOWARNING("You resume your normal stance.")) - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Fortify")) X.anchored = FALSE if(X.steelcrest) X.armor_deflection_buff -= 10 diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm index c1b1ee5f8902..5e3ab3b0afd9 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm @@ -251,7 +251,7 @@ if(freeze_timer_id == TIMER_ID_NULL) return var/mob/living/carbon/xenomorph/X = owner - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Pounce")) X.update_canmove() deltimer(freeze_timer_id) freeze_timer_id = TIMER_ID_NULL diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm index 7a8151d8aa02..eeb6c94b10ab 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm @@ -411,7 +411,7 @@ if (windup) X.set_face_dir(get_cardinal_dir(X, A)) if (!windup_interruptable) - X.frozen = TRUE + ADD_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Pounce")) X.anchored = TRUE X.update_canmove() pre_windup_effects() @@ -419,14 +419,14 @@ if (!do_after(X, windup_duration, INTERRUPT_NO_NEEDHAND, BUSY_ICON_HOSTILE)) to_chat(X, SPAN_XENODANGER("You cancel your [ability_name]!")) if (!windup_interruptable) - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Pounce")) X.anchored = FALSE X.update_canmove() post_windup_effects(interrupted = TRUE) return if (!windup_interruptable) - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Pounce")) X.anchored = FALSE X.update_canmove() post_windup_effects() diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/praetorian/praetorian_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/praetorian/praetorian_powers.dm index e926349af60d..0d7a86c58318 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/praetorian/praetorian_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/praetorian/praetorian_powers.dm @@ -175,14 +175,14 @@ vanguard_user.visible_message(SPAN_XENODANGER("[vanguard_user] slams [target_atom] into the ground!"), SPAN_XENOHIGHDANGER("You slam [target_atom] into the ground!")) - target_carbon.frozen = TRUE + ADD_TRAIT(target_carbon, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Cleave")) target_carbon.update_canmove() if (ishuman(target_carbon)) var/mob/living/carbon/human/Hu = target_carbon Hu.update_xeno_hostile_hud() - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(unroot_human), target_carbon), get_xeno_stun_duration(target_carbon, root_duration)) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(unroot_human), target_carbon, TRAIT_SOURCE_ABILITY("Cleave")), get_xeno_stun_duration(target_carbon, root_duration)) to_chat(target_carbon, SPAN_XENOHIGHDANGER("[vanguard_user] has pinned you to the ground! You cannot move!")) vanguard_user.flick_attack_overlay(target_carbon, "punch") @@ -292,7 +292,7 @@ var/throw_target_turf = get_step(X.loc, facing) - X.frozen = TRUE + ADD_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Abduct")) X.update_canmove() if(!do_after(X, windup, INTERRUPT_NO_NEEDHAND, BUSY_ICON_HOSTILE, numticks = 1)) to_chat(X, SPAN_XENOWARNING("You relax your tail.")) @@ -302,7 +302,7 @@ telegraph_atom_list -= XT qdel(XT) - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Abduct")) X.update_canmove() return @@ -310,7 +310,7 @@ if(!check_and_use_plasma_owner()) return - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Abduct")) X.update_canmove() playsound(get_turf(X), 'sound/effects/bang.ogg', 25, 0) @@ -340,7 +340,7 @@ H.apply_effect(1, SLOW) else if (LAZYLEN(targets) == 2) - H.frozen = TRUE + ADD_TRAIT(H, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Abduct")) H.update_canmove() if (ishuman(H)) var/mob/living/carbon/human/Hu = H @@ -409,16 +409,16 @@ oppressor_user.animation_attack_on(target_carbon) oppressor_user.flick_attack_overlay(target_carbon, "punch") - if (target_carbon.frozen || target_carbon.slowed || target_carbon.knocked_down) + if (HAS_TRAIT(target_carbon, TRAIT_IMMOBILIZED) || target_carbon.slowed || target_carbon.knocked_down) target_carbon.apply_damage(get_xeno_damage_slash(target_carbon, damage), BRUTE, target_limb? target_limb.name : "chest") - target_carbon.frozen = TRUE + ADD_TRAIT(target_carbon, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Oppressor Punch")) target_carbon.update_canmove() if (ishuman(target_carbon)) var/mob/living/carbon/human/Hu = target_carbon Hu.update_xeno_hostile_hud() - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(unroot_human), target_carbon), get_xeno_stun_duration(target_carbon, 12)) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(unroot_human), target_carbon, TRAIT_SOURCE_ABILITY("Oppressor Punch")), get_xeno_stun_duration(target_carbon, 1.2 SECONDS)) to_chat(target_carbon, SPAN_XENOHIGHDANGER("[oppressor_user] has pinned you to the ground! You cannot move!")) var/datum/action/xeno_action/activable/prae_abduct/abduct_action = get_xeno_action_by_type(oppressor_user, /datum/action/xeno_action/activable/prae_abduct) @@ -1012,7 +1012,7 @@ if(!(behind_turf.density)) throw_target_turf = behind_turf - X.frozen = TRUE + ADD_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Praetorian Retrieve")) X.update_canmove() if(windup) if(!do_after(X, windup, INTERRUPT_NO_NEEDHAND, BUSY_ICON_HOSTILE, numticks = 1)) @@ -1023,12 +1023,12 @@ telegraph_atom_list -= XT qdel(XT) - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Praetorian Retrieve")) X.update_canmove() return - X.frozen = FALSE + REMOVE_TRAIT(X, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Praetorian Retrieve")) X.update_canmove() playsound(get_turf(X), 'sound/effects/bang.ogg', 25, 0) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm index 3b52a60419df..a26cc922c528 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm @@ -78,14 +78,14 @@ for(var/mob/living/carbon/carbon in oview(round(behavior.kills * 0.5 + 2), xeno)) if(!xeno.can_not_harm(carbon) && carbon.stat != DEAD) - carbon.frozen = 1 + ADD_TRAIT(carbon, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Smash")) carbon.update_canmove() if (ishuman(carbon)) var/mob/living/carbon/human/human = carbon human.update_xeno_hostile_hud() - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(unroot_human), carbon), get_xeno_stun_duration(carbon, freeze_duration)) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(unroot_human), carbon, TRAIT_SOURCE_ABILITY("Smash")), get_xeno_stun_duration(carbon, freeze_duration)) for(var/mob/M in view(xeno)) @@ -125,7 +125,7 @@ if (!check_and_use_plasma_owner()) return - carbon.frozen = 1 + ADD_TRAIT(carbon, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Devastate")) carbon.update_canmove() if (ishuman(carbon)) @@ -134,7 +134,7 @@ apply_cooldown() - xeno.frozen = 1 + ADD_TRAIT(xeno, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Devastate")) xeno.anchored = TRUE xeno.update_canmove() @@ -151,8 +151,9 @@ playsound(owner, 'sound/voice/predalien_growl.ogg', 75, 0, status = 0) - xeno.frozen = 0 + REMOVE_TRAIT(xeno, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Devastate")) xeno.anchored = FALSE + unroot_human(carbon, TRAIT_SOURCE_ABILITY("Devastate")) xeno.update_canmove() unroot_human(carbon) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm index cd4533eabc83..ae28cd63fef9 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm @@ -385,7 +385,7 @@ else xeno.visible_message(SPAN_XENODANGER("[xeno] begins digging in for a strike!"), SPAN_XENOHIGHDANGER("You begin digging in for a strike!")) - xeno.frozen = 1 + ADD_TRAIT(xeno, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Eviscerate")) xeno.anchored = TRUE xeno.update_canmove() @@ -430,7 +430,7 @@ if(!xeno.on_fire) xeno.gain_health(Clamp(valid_count * lifesteal_per_marine, 0, max_lifesteal)) - xeno.frozen = 0 + REMOVE_TRAIT(xeno, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Eviscerate")) xeno.anchored = FALSE xeno.update_canmove() diff --git a/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/oppressor.dm b/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/oppressor.dm index 4a3bd3a7d182..ecb0e1eff51e 100644 --- a/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/oppressor.dm +++ b/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/oppressor.dm @@ -56,7 +56,7 @@ if(target_carbon.stat == DEAD) return - if(!(target_carbon.knocked_down || target_carbon.frozen || target_carbon.slowed)) + if(!(target_carbon.knocked_down || HAS_TRAIT(target_carbon, TRAIT_IMMOBILIZED) || target_carbon.slowed)) return target_carbon.apply_armoured_damage(get_xeno_damage_slash(target_carbon, tearing_damage), ARMOR_MELEE, BRUTE, bound_xeno.zone_selected ? bound_xeno.zone_selected : "chest") diff --git a/code/modules/mob/living/init_signals.dm b/code/modules/mob/living/init_signals.dm new file mode 100644 index 000000000000..7596d0566354 --- /dev/null +++ b/code/modules/mob/living/init_signals.dm @@ -0,0 +1,17 @@ +/// Called on [/mob/living/Initialize(mapload)], for the mob to register to relevant signals. +/mob/living/proc/register_init_signals() + + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_IMMOBILIZED), PROC_REF(on_immobilized_trait_gain)) + RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_IMMOBILIZED), PROC_REF(on_immobilized_trait_loss)) + +/// Called when [TRAIT_IMMOBILIZED] is added to the mob. +/mob/living/proc/on_immobilized_trait_gain(datum/source) + SIGNAL_HANDLER +// mobility_flags &= ~MOBILITY_MOVE + update_canmove() + +/// Called when [TRAIT_IMMOBILIZED] is removed from the mob. +/mob/living/proc/on_immobilized_trait_loss(datum/source) + SIGNAL_HANDLER +// mobility_flags |= MOBILITY_MOVE + update_canmove() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index ec8249fdca5c..5f463bf30abd 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -723,7 +723,7 @@ note dizziness decrements automatically in the mob's Life() proc. else lying = FALSE - canmove = !(stunned || frozen) + canmove = !(stunned || HAS_TRAIT(src, TRAIT_IMMOBILIZED)) if(!can_crawl && lying) canmove = FALSE @@ -789,22 +789,6 @@ note dizziness decrements automatically in the mob's Life() proc. /mob/proc/get_species() return "" -/// Sets freeze if possible and wasn't already set, returning success -/mob/proc/freeze() - if(frozen) - return FALSE - frozen = TRUE - update_canmove() - return TRUE - -/// Attempts to unfreeze mob, returning success -/mob/proc/unfreeze() - if(!frozen) - return FALSE - frozen = FALSE - update_canmove() - return TRUE - /mob/proc/flash_weak_pain() overlay_fullscreen("pain", /atom/movable/screen/fullscreen/pain, 1) clear_fullscreen("pain") diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 3e765e167ec1..e78d1bfe66fd 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -67,7 +67,6 @@ var/floatiness = 0 var/knocked_out = 0 var/stunned = 0 - var/frozen = 0 var/knocked_down = 0 var/losebreath = 0.0//Carbon var/dazed = 0 diff --git a/colonialmarines.dme b/colonialmarines.dme index 745d9a2bccd7..1469d5a65af5 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1812,6 +1812,7 @@ #include "code\modules\mob\language\languages.dm" #include "code\modules\mob\living\blood.dm" #include "code\modules\mob\living\damage_procs.dm" +#include "code\modules\mob\living\init_signals.dm" #include "code\modules\mob\living\living.dm" #include "code\modules\mob\living\living_defense.dm" #include "code\modules\mob\living\living_defines.dm" From ee1bc9945a36b2881c941e49178e1e278afdac19 Mon Sep 17 00:00:00 2001 From: Fira Date: Wed, 8 Nov 2023 16:49:00 +0000 Subject: [PATCH 2/3] small oopsie --- code/modules/mob/living/living.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 1190e55925a1..633f0286a3c5 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -19,6 +19,7 @@ initialize_incision_depths() initialize_pain() initialize_stamina() + register_init_signals() GLOB.living_mob_list += src /mob/living/Destroy() From 72637f9f44482e87e22182bcb6b8b9a0d6b2252f Mon Sep 17 00:00:00 2001 From: Fira Date: Thu, 9 Nov 2023 13:57:29 +0000 Subject: [PATCH 3/3] merged doubled init --- code/modules/mob/living/living.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 48e89f0b0737..9f01b8037e0f 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -20,7 +20,6 @@ initialize_incision_depths() initialize_pain() initialize_stamina() - register_init_signals() GLOB.living_mob_list += src /mob/living/Destroy()