Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/tg/ Status Effects Prelude D - Mob Freeze Refactor #4878

Merged
merged 5 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@
// #define TRAIT_X "t_x"

//-- mob traits --
/// Prevents voluntary movement.
#define TRAIT_IMMOBILIZED "immobilized"
/// Apply this to make a mob not dense, and remove it when you want it to no longer make them undense, other sorces of undesity will still apply. Always define a unique source when adding a new instance of this!
#define TRAIT_UNDENSE "undense"

Expand Down Expand Up @@ -294,6 +296,7 @@ GLOBAL_LIST_INIT(mob_traits, list(
*/
GLOBAL_LIST_INIT(traits_by_type, list(
/mob = list(
"TRAIT_IMMOBILIZED" = TRAIT_IMMOBILIZED,
"TRAIT_UNDENSE" = TRAIT_UNDENSE,
"TRAIT_YAUTJA_TECH" = TRAIT_YAUTJA_TECH,
"TRAIT_SUPER_STRONG" = TRAIT_SUPER_STRONG,
Expand Down Expand Up @@ -411,6 +414,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"
/// trait effect related to active specialist gear
#define SPECIALIST_GEAR_TRAIT "specialist_gear"
/// traits associated with usage of snowflake dropship double seats
Expand Down
4 changes: 2 additions & 2 deletions code/datums/agents/tools/chloroform.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
ADD_TRAIT(M, TRAIT_UNDENSE, CHLOROFORM_TRAIT)
M.able_to_speak = FALSE
M.update_canmove()
Expand Down Expand Up @@ -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)
REMOVE_TRAIT(M, TRAIT_UNDENSE, CHLOROFORM_TRAIT)

QDEL_NULL(mask_item)
Expand Down
12 changes: 4 additions & 8 deletions code/datums/effects/xeno_strains/boiler_trap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
2 changes: 1 addition & 1 deletion code/datums/mob_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
6 changes: 3 additions & 3 deletions code/game/objects/items/storage/smartpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]"))

Expand All @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/structures/vulture_spotter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions code/modules/admin/player_panel/actions/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/player_panel/player_panel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
else
.["mob_sleeping"] = 0

.["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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cm_marines/m2c.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/modules/cm_marines/smartgun_mount.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/carbon/human/human_abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/human/human_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/living/carbon/human/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
8 changes: 5 additions & 3 deletions code/modules/mob/living/carbon/xenomorph/XenoProcs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,18 @@
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)
M.attack_alien(src, pounceAction.slash_bonus_damage)

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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
return
// TODO Make immune to all damage here.
to_chat(src, SPAN_XENOWARNING("You burrow yourself into the ground."))
frozen = TRUE
invisibility = 101
anchored = TRUE
density = FALSE
Expand All @@ -45,6 +44,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"))
ADD_TRAIT(src, TRAIT_UNDENSE, TRAIT_SOURCE_ABILITY("Burrow"))
playsound(src.loc, 'sound/effects/burrowing_b.ogg', 25)
Expand Down Expand Up @@ -74,9 +74,9 @@
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"))
REMOVE_TRAIT(src, TRAIT_UNDENSE, TRAIT_SOURCE_ABILITY("Burrow"))
frozen = FALSE
invisibility = FALSE
anchored = FALSE
density = TRUE
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,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()
Expand All @@ -228,7 +228,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.mutation_type == DEFENDER_STEELCREST)
X.armor_deflection_buff -= 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,22 @@
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()

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()
Expand Down
Loading