mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-11 07:58:57 +01:00
be6b35485d
requires #22442 This PR adds the new Psi-Protect pills required by the current Lemurian Sea lore arc. They can be obtained exclusively via the psychiatric medicine selection, and are a new prescription drug marketed by Zeng-Hu Pharmaceuticals as a solution for ADPI exposure that doesn't require a more invasive implant. When taken, these pills provide 10 minutes of temporary protection from telepathy, as well as a reduction in psi-sensitivity. In the loadouts: <img width="312" height="72" alt="image" src="https://github.com/user-attachments/assets/2dc3a0bd-1d8e-4913-819b-b30fd5718d27" /> Spawning in: <img width="914" height="98" alt="image" src="https://github.com/user-attachments/assets/79223fe0-56f3-4fbc-9a1f-7afdaa87baa8" /> Messages playing when taking the pill <img width="602" height="55" alt="image" src="https://github.com/user-attachments/assets/2175b5bd-3b7f-47ee-957d-54154bc27197" /> Verifying in testing that the component correctly attaches <img width="504" height="278" alt="image" src="https://github.com/user-attachments/assets/f65a2d48-0337-47d2-ad79-fce548a07ab9" /> And verifying that component TTD is set, as well as Signals are being correctly registered. <img width="512" height="692" alt="image" src="https://github.com/user-attachments/assets/31416703-1c59-47f7-bc80-36329d43905a" />
46 lines
1.9 KiB
Plaintext
46 lines
1.9 KiB
Plaintext
/**
|
|
* A component that will delete itself after a certain amount of time has passed.
|
|
* This is useful for things like temporary buffs, or temporary objects that should be cleaned up after a while.
|
|
*
|
|
* As an abstract type, this component is not meant to be used directly. Instead, other components should extend this one and set the lifetime variable to the desired amount of time.
|
|
* For example, a component that gives a temporary speed boost might set lifetime to 30 seconds.
|
|
*/
|
|
ABSTRACT_TYPE(/datum/component/timed_life)
|
|
/**
|
|
* The amount of time, in seconds, that this component will last before it deletes itself.
|
|
* This is set during initialization, or by calling set_lifetime() on the component.
|
|
* This is a final variable because it should really only be set during initialization, and not by any external code. The component will handle updating this variable as needed.
|
|
*/
|
|
VAR_FINAL/lifetime = 0
|
|
|
|
/**
|
|
* The target time in real life seconds that the component will delete itself.
|
|
* This is calculated as REALTIMEOFDAY + lifetime when the component is initialized, and can be refreshed by calling refresh() on it.
|
|
* This is a final variable because it should only be set by the component itself, and not by any external code. The component will handle updating this variable as needed.
|
|
*/
|
|
VAR_FINAL/time_to_die = 0
|
|
|
|
/datum/component/timed_life/Initialize(lifetime_seconds = 5 MINUTES)
|
|
. = ..()
|
|
if (!parent)
|
|
return
|
|
|
|
lifetime = lifetime_seconds
|
|
time_to_die = REALTIMEOFDAY + lifetime
|
|
START_PROCESSING(SSprocessing, src)
|
|
|
|
/datum/component/timed_life/Destroy()
|
|
STOP_PROCESSING(SSprocessing, src)
|
|
return ..()
|
|
|
|
/datum/component/timed_life/proc/refresh()
|
|
time_to_die = REALTIMEOFDAY + lifetime
|
|
|
|
/datum/component/timed_life/proc/set_lifetime(new_lifetime)
|
|
lifetime = new_lifetime
|
|
refresh()
|
|
|
|
/datum/component/timed_life/process(seconds_per_tick)
|
|
if (REALTIMEOFDAY >= time_to_die)
|
|
qdel(src)
|