Skip to content

Commit

Permalink
Permadeath (#1034)
Browse files Browse the repository at this point in the history
<!-- Пишите **НИЖЕ** заголовков и **ВЫШЕ** комментариев, иначе что то
может пойти не так. -->
<!-- Вы можете прочитать Contributing.MD, если хотите узнать больше. -->

## Что этот PR делает

closes #1032

Через запись конфига REVIVAL_BRAIN_LIFE при ее значение выше 0 позволяет
изменить скорость разложения мозга. Так-же если это значение было
изменено, это включает в себя перманентную смерть для игрока, в случае,
если мозг умер (накладывает состояние DNR)

<!-- Вкратце опишите изменения, которые вносите. -->
<!-- Опишите **все** изменения, так как противное может сказаться на
рассмотрении этого PR'а! -->
<!-- Если вы исправляете Issue, добавьте "Fixes #xxxx" (где xxxx - номер
Issue) где-нибудь в описании PR'а. Это автоматически закроет Issue после
принятия PR'а. -->

## Почему это хорошо для игры

По запросу стримеров и для закрытия #1032

<!-- Опишите, почему, по вашему, следует добавить эти изменения в игру.
-->

## Изображения изменений

<!-- Если вы не меняли карту или спрайты, можете опустить эту секцию.
Если хотите, можете вставить видео. -->

## Тестирование

Локальный сервер

<!-- Как вы тестировали свой PR, если делали это вовсе? -->

## Changelog

:cl:
balance: Теперь в игре на сервере можно настроить перманентную смерть
/:cl:

<!-- Оба :cl:'а должны быть на месте, что-бы чейнджлог работал! Вы
можете написать свой ник справа от первого :cl:, если хотите. Иначе
будет использован ваш ник на ГитХабе. -->
<!-- Вы можете использовать несколько записей с одинаковым префиксом
(Они используются только для иконки в игре) и удалить ненужные. Помните,
что чейнджлог должен быть понятен обычным игроком. -->
<!-- Если чейнджлог не влияет на игроков(например, это рефактор), вы
можете исключить всю секцию. -->

## Summary by Sourcery

Implement permanent death configurable via the `revival_brain_life`
config setting. If set to a value greater than 0, the brain decay rate
is modified and permanent death is enabled for the player if their brain
dies (DNR status is applied).

New Features:
- Introduce a configurable permanent death option.

Tests:
- Test the permanent death functionality on a local server.

---------

Co-authored-by: tgstation-server-ci[bot] <161980869+tgstation-server-ci[bot]@users.noreply.github.com>
Co-authored-by: Gaxeer <44334376+Gaxeer@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 30, 2025
1 parent 76f4c70 commit 9f9d204
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@
#define DEFIB_FAIL_NO_INTELLIGENCE (1<<8)
#define DEFIB_FAIL_BLACKLISTED (1<<9)
#define DEFIB_NOGRAB_AGHOST (1<<10)
#define DEFIB_FAIL_PERMANENTLY_DEAD (1<<11) // BANDASTATION ADDITION - PERMA-DEATH

// Bit mask of possible return values by can_defib that would result in a revivable patient
#define DEFIB_REVIVABLE_STATES (DEFIB_FAIL_NO_HEART | DEFIB_FAIL_FAILING_HEART | DEFIB_FAIL_HUSK | DEFIB_FAIL_TISSUE_DAMAGE | DEFIB_FAIL_FAILING_BRAIN | DEFIB_POSSIBLE)
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,10 @@
fail_reason = "Tissue damage too severe, repair and try again."
if (DEFIB_FAIL_HUSK)
fail_reason = "Patient's body is a mere husk, repair and try again."
// BANDASTATION EDIT START - PERMA-DEATH
if (DEFIB_FAIL_PERMANENTLY_DEAD)
fail_reason = "Patient's brain electomagnetic activity gone. It's too late for them..."
// BANDASTATION EDIT END - PERMA-DEATH
if (DEFIB_FAIL_FAILING_BRAIN)
fail_reason = "Patient's brain is too damaged, repair and try again."
if (DEFIB_FAIL_NO_INTELLIGENCE)
Expand Down
21 changes: 20 additions & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -962,14 +962,31 @@
return ..()

/mob/living/carbon/can_be_revived()
if(!get_organ_by_type(/obj/item/organ/brain) && (!IS_CHANGELING(src)) || HAS_TRAIT(src, TRAIT_HUSK))
// BANDASTATION EDIT START - PERMA-DEATH
var/obj/item/organ/brain/brain = get_organ_by_type(/obj/item/organ/brain)
var/brain_non_functional = isnull(brain) || (CONFIG_GET(flag/brain_permanent_death) && brain.organ_flags & ORGAN_FAILING)
if(brain_non_functional && !IS_CHANGELING(src) || HAS_TRAIT(src, TRAIT_HUSK))
return FALSE
// BANDASTATION EDIT END - PERMA-DEATH
return ..()

/mob/living/carbon/proc/can_defib()
if (HAS_TRAIT(src, TRAIT_SUICIDED))
return DEFIB_FAIL_SUICIDE

// BANDASTATION EDIT START - PERMA-DEATH
var/obj/item/organ/brain/current_brain = get_organ_by_type(/obj/item/organ/brain)

if (QDELETED(current_brain))
return DEFIB_FAIL_NO_BRAIN

if (current_brain.suicided || (current_brain.brainmob && HAS_TRAIT(current_brain.brainmob, TRAIT_SUICIDED)))
return DEFIB_FAIL_NO_INTELLIGENCE

if (current_brain.organ_flags & ORGAN_FAILING)
return CONFIG_GET(flag/brain_permanent_death) ? DEFIB_FAIL_PERMANENTLY_DEAD : DEFIB_FAIL_FAILING_BRAIN
// BANDASTATION EDIT END - PERMA-DEATH

if (HAS_TRAIT(src, TRAIT_HUSK))
return DEFIB_FAIL_HUSK

Expand All @@ -989,6 +1006,7 @@
if (heart.organ_flags & ORGAN_FAILING)
return DEFIB_FAIL_FAILING_HEART

/* // BANDASTATION EDIT START - PERMA-DEATH
var/obj/item/organ/brain/current_brain = get_organ_by_type(/obj/item/organ/brain)
if (QDELETED(current_brain))
Expand All @@ -999,6 +1017,7 @@
if (current_brain.suicided || (current_brain.brainmob && HAS_TRAIT(current_brain.brainmob, TRAIT_SUICIDED)))
return DEFIB_FAIL_NO_INTELLIGENCE
*/ // BANDASTATION EDIT END - PERMA-DEATH

if(key && key[1] == "@") // Adminghosts
return DEFIB_NOGRAB_AGHOST
Expand Down
1 change: 1 addition & 0 deletions code/modules/research/techweb/nodes/medbay_nodes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"stasis",
"cryo_grenade",
"splitbeaker",
"stasisbodybag", // BANDASTATION ADDITION - PERMA-DEATH
)
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = TECHWEB_TIER_4_POINTS)
discount_experiments = list(/datum/experiment/scanning/reagent/cryostylane = TECHWEB_TIER_4_POINTS)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/surgery/organs/_organ.dm
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,17 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
var/message = check_damage_thresholds(owner)
prev_damage = damage

var/old_organ_flags = organ_flags // BANDASTATION ADD - PERMA-DEATH
if(damage >= maxHealth)
organ_flags |= ORGAN_FAILING
else
organ_flags &= ~ORGAN_FAILING

// BANDASTATION ADDITION START - PERMA-DEATH
if(old_organ_flags != organ_flags)
owner?.med_hud_set_status()
// BANDASTATION ADDITION END - PERMA-DEATH

if(message && owner && owner.stat <= SOFT_CRIT)
to_chat(owner, message)

Expand Down
3 changes: 3 additions & 0 deletions config/bandastation/bandastation_config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ ROUNDSTART_RACES vulpkanin
## List of ckeys, that bypass speech filter.
# SPEECH_FILTER_BYPASS ckey
# SPEECH_FILTER_BYPASS ckey

## Boolean value to derminate is it posible to die permanently due death of brain or not (value true means it's enabled)
BRAIN_PERMANENT_DEATH
1 change: 1 addition & 0 deletions modular_bandastation/balance/_balance.dme
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
#include "code/station_traits.dm"
#include "code/supply_packs.dm"
#include "code/wounds/cranial_fissure.dm"
#include "code/_brain.dm"

#include "code/~undefs.dm"
98 changes: 98 additions & 0 deletions modular_bandastation/balance/code/_brain.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/obj/item/organ/brain/Initialize(mapload)
. = ..()
if(CONFIG_GET(flag/brain_permanent_death))
decay_factor = STANDARD_ORGAN_DECAY * 2 //7 минут до полной смерти (в 4 раза быстрее чем по умолчанию (30 минут))

/datum/surgery/brain_surgery/can_start(mob/user, mob/living/carbon/target)
. = ..()
if(!.)
return

var/obj/item/organ/brain/brain = target.get_organ_slot(ORGAN_SLOT_BRAIN)
return !(brain.organ_flags & ORGAN_FAILING) || !CONFIG_GET(flag/brain_permanent_death)

/datum/config_entry/flag/brain_permanent_death
default = TRUE

/datum/design/stasisbodybag
name = "Stasis Body Bag"
desc = "A folded bag designed for the storage and transportation of cadavers with portable stasis module and little space."
id = "stasisbodybag"
build_type = PROTOLATHE | AWAY_LATHE
materials = list(/datum/material/iron =SHEET_MATERIAL_AMOUNT * 1.5, /datum/material/plasma =SHEET_MATERIAL_AMOUNT, /datum/material/diamond =SMALL_MATERIAL_AMOUNT*5)
build_path = /obj/item/bodybag/stasis
category = list(
RND_CATEGORY_EQUIPMENT + RND_SUBCATEGORY_TOOLS_MEDICAL
)
departmental_flags = DEPARTMENT_BITFLAG_MEDICAL | DEPARTMENT_BITFLAG_SCIENCE

/obj/item/bodybag/stasis
name = "Stasis body bag"
desc = "A folded bag designed for the storage and transportation of cadavers with portable stasis module and little space."
icon = 'modular_bandastation/balance/icons/bodybag.dmi' //на замену
icon_state = "stasisbag_folded" //на замену
// Stored path we use for spawning a new body bag entity when unfolded.
unfoldedbag_path = /obj/structure/closet/body_bag/stasis
color = "#11978c"

/obj/item/bodybag/stasis/deploy_bodybag(mob/user, atom/location)
. = ..()
var/obj/structure/closet/body_bag/item_bag = .
item_bag.color = color
return item_bag

/obj/structure/closet/body_bag/stasis
name = "stasis body bag"
desc = "A plastic bag designed for the storage and transportation of cadavers with portable stasis module and little space."
icon = 'modular_bandastation/balance/icons/bodybag.dmi' //на замену
icon_state = "stasisbag"
mob_storage_capacity = 1
color = "#11978c"
open_sound = 'sound/effects/spray.ogg'
close_sound = 'sound/effects/spray.ogg'
foldedbag_path = /obj/item/bodybag/stasis

//Добавить механизм добавления оверлея на предмет
/obj/structure/closet/body_bag/stasis/closet_update_overlays(list/new_overlays)
. = ..()
. = new_overlays
var/overlay_state = isnull(base_icon_state) ? initial(icon_state) : base_icon_state
if(opened && has_opened_overlay)
var/mutable_appearance/door_underlay = mutable_appearance(icon, "[overlay_state]_open_over", alpha = src.alpha)
. += door_underlay
door_underlay.color = "#6bd5ff"
door_underlay.overlays += emissive_blocker(door_underlay.icon, door_underlay.icon_state, src, alpha = door_underlay.alpha) // If we don't do this the door doesn't block emissives and it looks weird.
if(!opened && length(contents))
var/mutable_appearance/door_underlay = mutable_appearance(icon, "[overlay_state]_over", alpha = src.alpha)
. += door_underlay
door_underlay.color = "#059900"
door_underlay.overlays += emissive_blocker(door_underlay.icon, door_underlay.icon_state, src, alpha = door_underlay.alpha)
return .

/obj/structure/closet/body_bag/stasis/undeploy_bodybag(atom/fold_loc)
. = ..()
var/obj/item/bodybag/folding_bodybag = .
folding_bodybag.color = color
return folding_bodybag

/obj/structure/closet/body_bag/stasis/close(mob/living/user)
. = ..()
for(var/mob/living/mob in contents)
mob.apply_status_effect(/datum/status_effect/grouped/stasis, STASIS_MACHINE_EFFECT)
ADD_TRAIT(mob, TRAIT_TUMOR_SUPPRESSED, TRAIT_GENERIC)
mob.extinguish_mob()

/obj/structure/closet/body_bag/stasis/open(mob/living/user, force = FALSE, special_effects = TRUE)
for(var/mob/living/mob in contents)
mob.remove_status_effect(/datum/status_effect/grouped/stasis, STASIS_MACHINE_EFFECT)
REMOVE_TRAIT(mob, TRAIT_TUMOR_SUPPRESSED, TRAIT_GENERIC)
. = ..()

/obj/item/reagent_containers/hypospray/medipen
list_reagents = list(/datum/reagent/medicine/epinephrine = 10, /datum/reagent/medicine/coagulant = 2)

/obj/item/reagent_containers/hypospray/medipen/survival
list_reagents = list( /datum/reagent/medicine/epinephrine = 7, /datum/reagent/medicine/c2/aiuri = 7, /datum/reagent/medicine/c2/libital = 7, /datum/reagent/medicine/leporazine = 6, /datum/reagent/toxin/formaldehyde = 3)

/obj/item/reagent_containers/hypospray/medipen/survival/luxury
list_reagents = list(/datum/reagent/medicine/salbutamol = 10, /datum/reagent/medicine/c2/penthrite = 10, /datum/reagent/medicine/oxandrolone = 10, /datum/reagent/medicine/sal_acid = 10 ,/datum/reagent/medicine/omnizine = 10 ,/datum/reagent/medicine/leporazine = 5, /datum/reagent/toxin/formaldehyde = 5)
Binary file added modular_bandastation/balance/icons/bodybag.dmi
Binary file not shown.

0 comments on commit 9f9d204

Please sign in to comment.