diff --git a/citadel.dme b/citadel.dme index 897ce810808c..b361fb26f654 100644 --- a/citadel.dme +++ b/citadel.dme @@ -812,6 +812,7 @@ #include "code\datums\components\items\wielding.dm" #include "code\datums\components\mobs\block_frame.dm" #include "code\datums\components\mobs\mob_self_horizontal_inversion.dm" +#include "code\datums\components\mobs\mob_self_vertical_inversion.dm" #include "code\datums\components\mobs\parry_frame.dm" #include "code\datums\components\movable\aquarium.dm" #include "code\datums\components\movable\spatial_grid.dm" @@ -4146,6 +4147,7 @@ #include "code\modules\mob\observer\dead\perspective.dm" #include "code\modules\mob\observer\dead\say.dm" #include "code\modules\mob\verbs\horizontal_invert_self.dm" +#include "code\modules\mob\verbs\vertical_invert_self.dm" #include "code\modules\modular_computers\laptop_vendor.dm" #include "code\modules\modular_computers\computers\modular_computer\core.dm" #include "code\modules\modular_computers\computers\modular_computer\damage.dm" diff --git a/code/datums/components/mobs/mob_self_horizontal_inversion.dm b/code/datums/components/mobs/mob_self_horizontal_inversion.dm index 79df9ca7c29e..fc85738cf3e9 100644 --- a/code/datums/components/mobs/mob_self_horizontal_inversion.dm +++ b/code/datums/components/mobs/mob_self_horizontal_inversion.dm @@ -15,6 +15,7 @@ /datum/component/mob_self_horizontal_inversion/RegisterWithParent() . = ..() RegisterSignal(parent, COMSIG_MOVABLE_BASE_TRANSFORM, PROC_REF(alter_base_transform)) + RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_move)) var/mob/target = parent var/matrix/to_apply = target.transform to_apply.Scale(-1, 1) @@ -23,6 +24,7 @@ /datum/component/mob_self_horizontal_inversion/UnregisterFromParent() . = ..() UnregisterSignal(parent, COMSIG_MOVABLE_BASE_TRANSFORM) + UnregisterSignal(parent, COMSIG_MOVABLE_MOVED) var/mob/target = parent var/matrix/to_apply = target.transform to_apply.Scale(-1, 1) @@ -31,3 +33,7 @@ /datum/component/mob_self_horizontal_inversion/proc/alter_base_transform(datum/source, matrix/applying) SIGNAL_HANDLER applying.Scale(-1, 1) + +/datum/component/mob_self_horizontal_inversion/proc/on_move(datum/source) + SIGNAL_HANDLER + qdel(src) diff --git a/code/datums/components/mobs/mob_self_vertical_inversion.dm b/code/datums/components/mobs/mob_self_vertical_inversion.dm new file mode 100644 index 000000000000..8bdec05ff5f3 --- /dev/null +++ b/code/datums/components/mobs/mob_self_vertical_inversion.dm @@ -0,0 +1,40 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Component added to a mob by the mob themselves to invert themselves vertically. + */ +/datum/component/mob_self_vertical_inversion + registered_type = /datum/component/mob_self_vertical_inversion + +/datum/component/mob_self_vertical_inversion/Initialize() + if(!ismob(parent)) + return COMPONENT_INCOMPATIBLE + return ..() + +/datum/component/mob_self_vertical_inversion/RegisterWithParent() + . = ..() + // todo: allow it if they're being moved by an external source; MOB_SLEFMOVE? + RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_move)) + RegisterSignal(parent, COMSIG_MOVABLE_BASE_TRANSFORM, PROC_REF(alter_base_transform)) + var/mob/target = parent + var/matrix/to_apply = target.transform + to_apply.Scale(1, -1) + target.set_transform(to_apply) + +/datum/component/mob_self_vertical_inversion/UnregisterFromParent() + . = ..() + UnregisterSignal(parent, COMSIG_MOVABLE_BASE_TRANSFORM) + UnregisterSignal(parent, COMSIG_MOVABLE_MOVED) + var/mob/target = parent + var/matrix/to_apply = target.transform + to_apply.Scale(1, -1) + target.set_transform(to_apply) + +/datum/component/mob_self_vertical_inversion/proc/alter_base_transform(datum/source, matrix/applying) + SIGNAL_HANDLER + applying.Scale(1, -1) + +/datum/component/mob_self_vertical_inversion/proc/on_move(datum/source) + SIGNAL_HANDLER + qdel(src) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 251cfc5f004e..d5e89635d878 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -66,7 +66,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) /mob/living/carbon/human/apply_transform(matrix/to_apply) var/anim_time = CHECK_MOBILITY(src, MOBILITY_CAN_STAND)? 3 : 1 - animate(src, transform = to_apply, time = anim_time, flags = ANIMATION_PARALLEL) + animate(src, transform = to_apply, time = anim_time, flags = ANIMATION_PARALLEL | ANIMATION_LINEAR_TRANSFORM) update_icon_special() //May contain transform-altering things update_ssd_overlay() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 62cc2e737e8c..069d93070efe 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -605,7 +605,7 @@ default behaviour is: return applying /mob/living/apply_transform(matrix/to_apply) - animate(src, transform = to_apply, time = 1 SECONDS) + animate(src, transform = to_apply, time = 1 SECONDS, flags = ANIMATION_LINEAR_TRANSFORM | ANIMATION_PARALLEL) update_ssd_overlay() // This handles setting the client's color variable, which makes everything look a specific color. diff --git a/code/modules/mob/verbs/horizontal_invert_self.dm b/code/modules/mob/verbs/horizontal_invert_self.dm index 09adab8dbc59..57b55fd188f3 100644 --- a/code/modules/mob/verbs/horizontal_invert_self.dm +++ b/code/modules/mob/verbs/horizontal_invert_self.dm @@ -1,6 +1,7 @@ //* This file is explicitly licensed under the MIT license. *// //* Copyright (c) 2024 Citadel Station Developers *// +// todo: DECLARE_MOB_VERB /mob/verb/horizontal_invert_self() set name = "Invert Yourself (Horizontal)" set desc = "Mirror your sprite across the N-S axis." diff --git a/code/modules/mob/verbs/vertical_invert_self.dm b/code/modules/mob/verbs/vertical_invert_self.dm new file mode 100644 index 000000000000..9b179d98fe0d --- /dev/null +++ b/code/modules/mob/verbs/vertical_invert_self.dm @@ -0,0 +1,24 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2025 Citadel Station Developers *// + +// todo: DECLARE_MOB_VERB +/mob/verb/vertical_invert_self() + set name = "Invert Yourself (Vertical)" + set desc = "Mirror your sprite across the N-S axis." + set category = VERB_CATEGORY_IC + + // todo: remote control? mobs that don't allow it? + + if(TIMER_COOLDOWN_CHECK(src, CD_INDEX_MOB_VERB_INVERT_SELF)) + // todo: don't usr lol + to_chat(usr, SPAN_WARNING("You can't do that yet!")) + return + TIMER_COOLDOWN_START(src, CD_INDEX_MOB_VERB_INVERT_SELF, 0.5 SECONDS) + + log_game("[key_name(usr)] invoked vertical_invert_self on [key_name(src)].") + + var/datum/component/mob_self_vertical_inversion/inversion = GetComponent(/datum/component/mob_self_vertical_inversion) + if(inversion) + qdel(inversion) + else + AddComponent(/datum/component/mob_self_vertical_inversion)