mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Make unnatural resizing even better and more efficient with the power of DCS™️
This commit is contained in:
19
code/datums/components/resize_guard.dm
Normal file
19
code/datums/components/resize_guard.dm
Normal file
@@ -0,0 +1,19 @@
|
||||
/datum/component/resize_guard
|
||||
|
||||
/datum/component/resize_guard/Initialize()
|
||||
if(!isliving(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
/datum/component/resize_guard/RegisterWithParent()
|
||||
// When our parent mob enters any atom, we check resize
|
||||
RegisterSignal(parent, COMSIG_ATOM_ENTERING, .proc/check_resize)
|
||||
|
||||
/datum/component/resize_guard/UnregisterFromParent()
|
||||
UnregisterSignal(parent, COMSIG_ATOM_ENTERING)
|
||||
|
||||
/datum/component/resize_guard/proc/check_resize()
|
||||
var/area/A = get_area(parent)
|
||||
if(A?.limit_mob_size)
|
||||
var/mob/living/L = parent
|
||||
L.resize(L.size_multiplier)
|
||||
qdel(src)
|
||||
Reference in New Issue
Block a user