diff --git a/code/__HELPERS/fade_into_nothing.dm b/code/__HELPERS/fade_into_nothing.dm new file mode 100644 index 00000000000..d8df8ced78e --- /dev/null +++ b/code/__HELPERS/fade_into_nothing.dm @@ -0,0 +1,9 @@ +/// Deletes the atom with a little fading out animation after a specified time +/atom/proc/fade_into_nothing(life_time = 5 SECONDS, fade_time = 3 SECONDS) + QDEL_IN(src, life_time) + if (life_time > fade_time && fade_time > 0) + addtimer(CALLBACK(src, PROC_REF(fade_into_nothing_animate), fade_time), life_time - fade_time, TIMER_DELETE_ME) + +/// Actually does the fade out, used by fade_into_nothing() +/atom/proc/fade_into_nothing_animate(fade_time) + animate(src, alpha = 0, time = fade_time, flags = ANIMATION_PARALLEL) diff --git a/code/datums/components/ranged_attacks.dm b/code/datums/components/ranged_attacks.dm index e60c3645206..4501db379ef 100644 --- a/code/datums/components/ranged_attacks.dm +++ b/code/datums/components/ranged_attacks.dm @@ -85,7 +85,7 @@ target_zone = ran_zone() casing.fire_casing(target, firer, null, null, null, target_zone, 0, firer) casing.update_appearance() - casing.AddElement(/datum/element/temporary_atom, 30 SECONDS) + casing.fade_into_nothing(30 SECONDS) SEND_SIGNAL(parent, COMSIG_BASICMOB_POST_ATTACK_RANGED, target, modifiers) return diff --git a/code/datums/components/storm_hating.dm b/code/datums/components/storm_hating.dm index ce43ba73276..4060dc09a5e 100644 --- a/code/datums/components/storm_hating.dm +++ b/code/datums/components/storm_hating.dm @@ -43,5 +43,5 @@ var/atom/parent_atom = parent if (!isturf(parent_atom.loc)) return - parent.AddElement(/datum/element/temporary_atom, life_time = 3 SECONDS, fade_time = 2 SECONDS) + parent_atom.fade_into_nothing(life_time = 3 SECONDS, fade_time = 2 SECONDS) qdel(src) diff --git a/code/datums/elements/temporary_atom.dm b/code/datums/elements/temporary_atom.dm deleted file mode 100644 index 6f91e8360b6..00000000000 --- a/code/datums/elements/temporary_atom.dm +++ /dev/null @@ -1,17 +0,0 @@ -/// Deletes the atom with a little fading out animation after a specified time -/datum/element/temporary_atom - -/datum/element/temporary_atom/Attach(datum/target, life_time = 5 SECONDS, fade_time = 3 SECONDS) - . = ..() - if (!isatom(target)) - return ELEMENT_INCOMPATIBLE - - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), WEAKREF(target)), life_time, TIMER_DELETE_ME) - if (life_time > fade_time && fade_time > 0) - addtimer(CALLBACK(src, PROC_REF(fade_out), WEAKREF(target), fade_time), life_time - fade_time, TIMER_DELETE_ME) - -/datum/element/temporary_atom/proc/fade_out(datum/weakref/target_ref, fade_time) - var/atom/target = target_ref?.resolve() - if (isnull(target)) - return - animate(target, alpha = 0, time = fade_time, flags = ANIMATION_PARALLEL) diff --git a/code/datums/records/manifest.dm b/code/datums/records/manifest.dm index afc5cef6aa4..0d469305235 100644 --- a/code/datums/records/manifest.dm +++ b/code/datums/records/manifest.dm @@ -163,6 +163,14 @@ GLOBAL_DATUM_INIT(manifest, /datum/manifest, new) target.rank = assignment target.trim = trim +///Removes a record based on its name. +/datum/manifest/proc/remove(name) + var/datum/record/crew/target = find_record(name) + if(!target) + return + general -= target + qdel(target) + /** * Using the name to find the record, and person in reference to the body, we recreate photos for the manifest (and records). * Args: diff --git a/code/game/objects/effects/spiderwebs.dm b/code/game/objects/effects/spiderwebs.dm index f3b3cc92dce..22ee3499e33 100644 --- a/code/game/objects/effects/spiderwebs.dm +++ b/code/game/objects/effects/spiderwebs.dm @@ -275,6 +275,6 @@ /obj/structure/spider/effigy/Initialize(mapload) . = ..() - AddElement(/datum/element/temporary_atom, 1 MINUTES) + fade_into_nothing(1 MINUTES) #undef SPIDER_WEB_TINT diff --git a/code/modules/admin/smites/smite.dm b/code/modules/admin/smites/_smite.dm similarity index 100% rename from code/modules/admin/smites/smite.dm rename to code/modules/admin/smites/_smite.dm diff --git a/code/modules/admin/smites/retcon.dm b/code/modules/admin/smites/retcon.dm new file mode 100644 index 00000000000..461b7b330bb --- /dev/null +++ b/code/modules/admin/smites/retcon.dm @@ -0,0 +1,39 @@ +/datum/smite/retcon + name = "Retcon" + /// how long until the thing attacked by this smite gets deleted + var/timer + /// the time it takes to actually do the fade out animation, the victim will always have some time still fully visible + var/fade_out_timer + +/datum/smite/retcon/configure(client/user) + timer = tgui_input_number(user, "How long should it take before the target disappears, in seconds?", "Retcon", 5) + + if (isnull(timer)) + return FALSE + + fade_out_timer = timer*3*0.2 + +/datum/smite/retcon/effect(client/user, mob/living/target) + . = ..() + target.fade_into_nothing(timer SECONDS,fade_out_timer SECONDS) + if(ishuman(target)) + delete_record(target) + delete_bank_account(target) + reopen_job_slot(target) + +/datum/smite/retcon/proc/delete_record(mob/living/target) + var/name = target.real_name + GLOB.manifest.remove(name) + +/datum/smite/retcon/proc/delete_bank_account(mob/living/target) + var/name = target.real_name + var/account_list = flatten_list(SSeconomy.bank_accounts_by_id) + for(var/datum/bank_account/account in account_list) + if(account.account_holder == name) + qdel(account) + return + +/datum/smite/retcon/proc/reopen_job_slot(mob/living/target) + var/datum/job/target_job = target.mind?.assigned_role + if(target_job) + target_job.total_positions += 1 diff --git a/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm b/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm index 0b27ac6958e..adce439095e 100644 --- a/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm +++ b/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm @@ -75,7 +75,7 @@ /mob/living/basic/mining/demon_afterimage/Initialize(mapload) . = ..() AddElement(/datum/element/simple_flying) - AddElement(/datum/element/temporary_atom, life_time = existence_period) + fade_into_nothing(life_time = existence_period) ///afterimage subtypes summoned by the crusher /mob/living/basic/mining/demon_afterimage/crusher diff --git a/code/modules/modular_computers/file_system/programs/virtual_pet.dm b/code/modules/modular_computers/file_system/programs/virtual_pet.dm index 9047e3014e6..8df6647ed9b 100644 --- a/code/modules/modular_computers/file_system/programs/virtual_pet.dm +++ b/code/modules/modular_computers/file_system/programs/virtual_pet.dm @@ -584,7 +584,7 @@ GLOBAL_LIST_EMPTY(virtual_pets_list) announce_global_updates(message = "has found a chocolate at [selected_area.name]") selected_area = null var/obj/item/food/virtual_chocolate/chocolate = new(get_turf(computer)) - chocolate.AddElement(/datum/element/temporary_atom, life_time = 30 SECONDS) //we cant maintain its existence for too long! + chocolate.fade_into_nothing(life_time = 30 SECONDS) //we cant maintain its existence for too long! /datum/computer_file/program/virtual_pet/proc/recall_pet(mob/living/friend) animate(pet, transform = matrix().Scale(0.3, 0.3), time = 1.5 SECONDS) diff --git a/tgstation.dme b/tgstation.dme index 334092b0077..593e423cb63 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -484,6 +484,7 @@ #include "code\__HELPERS\string_assoc_nested_lists.dm" #include "code\__HELPERS\string_lists.dm" #include "code\__HELPERS\string_numbers_lists.dm" +#include "code\__HELPERS\fade_into_nothing.dm" #include "code\__HELPERS\text.dm" #include "code\__HELPERS\time.dm" #include "code\__HELPERS\traits.dm" @@ -1596,7 +1597,6 @@ #include "code\datums\elements\strippable.dm" #include "code\datums\elements\structure_repair.dm" #include "code\datums\elements\swabbable.dm" -#include "code\datums\elements\temporary_atom.dm" #include "code\datums\elements\tenacious.dm" #include "code\datums\elements\tiny_mob_hunter.dm" #include "code\datums\elements\tool_flash.dm" @@ -2967,6 +2967,7 @@ #include "code\modules\admin\trophy_manager.dm" #include "code\modules\admin\whitelist.dm" #include "code\modules\admin\callproc\callproc.dm" +#include "code\modules\admin\smites\_smite.dm" #include "code\modules\admin\smites\bad_luck.dm" #include "code\modules\admin\smites\become_object.dm" #include "code\modules\admin\smites\berforate.dm" @@ -2990,9 +2991,9 @@ #include "code\modules\admin\smites\phobia_ocky_icky.dm" #include "code\modules\admin\smites\puzzgrid.dm" #include "code\modules\admin\smites\puzzle.dm" +#include "code\modules\admin\smites\retcon.dm" #include "code\modules\admin\smites\rod.dm" #include "code\modules\admin\smites\scarify.dm" -#include "code\modules\admin\smites\smite.dm" #include "code\modules\admin\smites\supply_pod.dm" #include "code\modules\admin\smites\supply_pod_quick.dm" #include "code\modules\admin\verb_datums\_admin_verb_datum.dm"