Files
Bubberstation/code/modules/capture_the_flag/ctf_player_component.dm
SkyratBot 4769d47f24 [MIRROR] Grand Ritual Finale: An end to death [MDB IGNORE] (#24053)
* Grand Ritual Finale: An end to death (#78497)

## About The Pull Request

Adds a new Wizard Ritual Finale effect which makes everything immortal.
By this I mean, 10 seconds after death a ghostly image of them will
appear somewhere near where the corpse was and then 50 seconds after
that the mob will return to life at that location.
This applies to every mob, everywhere.
This is likely to cause a little bit of disruption to the rest of the
round, so you can only do it after at least 30 minutes have passed.
After that the crew will have to figure out how to deal with their new
gift of immortality. It will involve throwing people into chasms and
lava, probably.

![dreamseeker_7SwMsSrnt1](https://github.com/tgstation/tgstation/assets/7483112/5b794bcc-fcba-46b5-b228-e95aa685942d)
Here's a gif sped up for example purposes.

You can escape from the cycle of death and rebirth via suicide, purely
because it's pointless to try and force people to play the video game if
they don't want to.

Also I split all of these effects into their own files, the only new
code for those is in `immortality.dm`

shout out to Vekter for distracting Oranges while I posted this
wizard-related PR so I didn't get disapprovingly reacted for posting
magic shit (yet)

## Why It's Good For The Game

This might be _too_ much but I want to see what would happen.
It will allow us to simulate whether polite society can survive when
violence has no consequences.

## Changelog

🆑
add: Wizards who complete the grand ritual can now gift everyone with
eternal life
/🆑

* Grand Ritual Finale: An end to death

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-09-30 23:57:44 -04:00

81 lines
3.2 KiB
Plaintext

///A component added to the mind of anyone who is playing in an ongoing CTF match. Any player specific CTF functionality should be implimented here. (someone should impliment score tracking here)
/datum/component/ctf_player
///The team that this player is associated with.
var/team
///A reference to the players mob, cleared after they die, restored on respawn.
var/mob/living/player_mob
///Weather or not the player is currently able to respawn.
var/can_respawn = TRUE
///Reference to the game this player is participating in.
var/datum/ctf_controller/ctf_game
///Item dropped on death,
var/death_drop = /obj/effect/powerup/ammo/ctf
///Reference to players ckey, used for sending messages to them relating to CTF.
var/ckey_reference
/datum/component/ctf_player/Initialize(team, ctf_game, death_drop)
src.team = team
src.ctf_game = ctf_game
src.death_drop = death_drop
if(!istype(parent, /datum/mind))
return COMPONENT_INCOMPATIBLE
var/datum/mind/true_parent = parent
player_mob = true_parent.current
ckey_reference = player_mob.ckey
register_mob()
/datum/component/ctf_player/PostTransfer()
if(!istype(parent, /datum/mind))
return COMPONENT_INCOMPATIBLE
var/datum/mind/true_parent = parent
player_mob = true_parent.current
register_mob()
/// Called when we get a new player mob, register signals and set up the mob.
/datum/component/ctf_player/proc/register_mob()
RegisterSignal(player_mob, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(damage_type_check))
RegisterSignal(player_mob, COMSIG_MOB_GHOSTIZED, PROC_REF(ctf_dust))
ADD_TRAIT(player_mob, TRAIT_PERMANENTLY_MORTAL, CTF_TRAIT)
///Stamina and oxygen damage will not dust a player by themself.
/datum/component/ctf_player/proc/damage_type_check(datum/source, damage, damage_type)
SIGNAL_HANDLER
if(damage_type != STAMINA && damage_type != OXY)
ctf_dust()
///Dusts the player and starts a respawn countdown.
/datum/component/ctf_player/proc/ctf_dust()
SIGNAL_HANDLER
if(!HAS_TRAIT(player_mob, TRAIT_CRITICAL_CONDITION) && !player_mob.stat == DEAD && player_mob.client)
return
UnregisterSignal(player_mob, list(COMSIG_MOB_AFTER_APPLY_DAMAGE, COMSIG_MOB_GHOSTIZED))
var/turf/death_turf = get_turf(player_mob)
player_mob.dust()
player_mob = null
can_respawn = FALSE
addtimer(CALLBACK(src, PROC_REF(allow_respawns)), ctf_game.respawn_cooldown, TIMER_UNIQUE)
if(death_drop)
new death_drop(death_turf)
///Called after a period of time pulled from ctf_game, allows the player to respawn in CTF.
/datum/component/ctf_player/proc/allow_respawns()
can_respawn = TRUE
send_message(span_notice("You can now respawn in CTF!"))
///Sends a message to the player.
/datum/component/ctf_player/proc/send_message(message)
to_chat(GLOB.directory[ckey_reference], message)
///Called when the associated CTF game ends or their associated team is deleted, dusts the player and deletes this component to ensure no data from it is carried over to future games.
/datum/component/ctf_player/proc/end_game()
if(player_mob)
for(var/obj/item/ctf_flag/flag in player_mob)
player_mob.dropItemToGround(flag)
player_mob.dust()
qdel(src)
/datum/component/ctf_player/Destroy(force, silent)
if(player_mob)
UnregisterSignal(player_mob, list(COMSIG_MOB_AFTER_APPLY_DAMAGE, COMSIG_MOB_GHOSTIZED))
return ..()