-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add inversion verb, fix inversion verbs
- Loading branch information
Showing
7 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
code/datums/components/mobs/mob_self_vertical_inversion.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |