mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-31 06:26:49 +01:00
bugfix / tweaks (#6959)
This commit is contained in:
@@ -345,11 +345,10 @@
|
||||
for(var/datum/listening_datum as anything in queued_calls)
|
||||
. |= call(listening_datum, queued_calls[listening_datum])(arglist(arguments))
|
||||
|
||||
// The type arg is casted so initial works, you shouldn't be passing a real instance into this
|
||||
/**
|
||||
* Return any component assigned to this datum of the given type
|
||||
* Return any component assigned to this datum of the given registered component type
|
||||
*
|
||||
* If it has a registered type, that'll be used instead!
|
||||
* * `registered_type` must be set on the component for this to work.
|
||||
*
|
||||
* Arguments:
|
||||
* * datum/component/c_type The type of the component you want to get a reference to. It will be overridden with the type of its [registered_type] if it's set.
|
||||
@@ -360,7 +359,9 @@
|
||||
return . && (length(.) ? .[1] : .)
|
||||
|
||||
/**
|
||||
* Get all components of a given type that are attached to this datum
|
||||
* Get all components of a given registered component type that are attached to this datum
|
||||
*
|
||||
* * `registered_type` must be set on the component for this to work.
|
||||
*
|
||||
* Arguments:
|
||||
* * c_type The component type path
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//* This file is explicitly licensed under the MIT license. *//
|
||||
//* Copyright (c) 2025 Citadel Station Developers *//
|
||||
|
||||
// todo: datumize impairments; the way this works right now is pretty stupid
|
||||
// it's because we're using different components since i was too
|
||||
// lazy to do a single tracking component
|
||||
|
||||
/**
|
||||
* Component added to a mob by the mob themselves to feign an impairment
|
||||
*/
|
||||
/datum/component/mob_feign_impairment
|
||||
var/power
|
||||
var/feign_impairment_type
|
||||
|
||||
/datum/component/mob_feign_impairment/Initialize(power)
|
||||
if(!ismob(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
. = ..()
|
||||
if(. == COMPONENT_INCOMPATIBLE)
|
||||
return
|
||||
src.power = power
|
||||
|
||||
/datum/component/mob_feign_impairment/RegisterWithParent()
|
||||
. = ..()
|
||||
// todo: on update stat
|
||||
RegisterSignal(parent, COMSIG_MOB_ON_UPDATE_MOBILITY, PROC_REF(recheck_stat))
|
||||
var/mob/mob_parent = parent
|
||||
LAZYSET(mob_parent.impairments_feigned, feign_impairment_type, src)
|
||||
|
||||
/datum/component/mob_feign_impairment/UnregisterFromParent()
|
||||
. = ..()
|
||||
// todo: on update stat
|
||||
UnregisterSignal(parent, COMSIG_MOB_ON_UPDATE_MOBILITY)
|
||||
var/mob/mob_parent = parent
|
||||
LAZYREMOVE(mob_parent.impairments_feigned, feign_impairment_type)
|
||||
|
||||
/datum/component/mob_feign_impairment/proc/recheck_stat(mob/source)
|
||||
SIGNAL_HANDLER
|
||||
if(IS_CONSCIOUS(source))
|
||||
return
|
||||
qdel(src)
|
||||
|
||||
/datum/component/mob_feign_impairment/slurring
|
||||
// this must be set
|
||||
registered_type = /datum/component/mob_feign_impairment/slurring
|
||||
feign_impairment_type = /datum/feign_impairment/slurring
|
||||
|
||||
/datum/component/mob_feign_impairment/stutter
|
||||
// this must be set
|
||||
registered_type = /datum/component/mob_feign_impairment/stutter
|
||||
feign_impairment_type = /datum/feign_impairment/stutter
|
||||
|
||||
/datum/component/mob_feign_impairment/jitter
|
||||
// this must be set
|
||||
registered_type = /datum/component/mob_feign_impairment/jitter
|
||||
feign_impairment_type = /datum/feign_impairment/jitter
|
||||
|
||||
/datum/component/mob_feign_impairment/jitter/RegisterWithParent()
|
||||
. = ..()
|
||||
// shitcode but whatever
|
||||
var/mob/mob_parent = parent
|
||||
mob_parent.make_jittery(0)
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user