From 80350fa007ee32bfc476291a3f1ab2f57511f69d Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:58:51 +0300 Subject: [PATCH 01/13] some add --- code/__DEFINES/dcs/signals.dm | 5 ++- code/__DEFINES/organ_defines.dm | 3 ++ code/__DEFINES/status_effects.dm | 2 + code/datums/status_effects/buffs.dm | 45 +++++++++++++++++++ code/modules/mob/living/carbon/human/life.dm | 3 ++ .../mob/living/carbon/human/species/drask.dm | 29 ++++-------- code/modules/surgery/organs/lungs.dm | 21 +++++++++ code/modules/surgery/organs/subtypes/drask.dm | 27 +++++++++++ 8 files changed, 114 insertions(+), 21 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 1dcafee2bf0..c6ec3780232 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -908,7 +908,10 @@ #define COMSIG_HUMAN_REGENERATE_ICONS "human_regenerate_icons" ///From /mob/living/carbon/human/proc/set_species(): (datum/species/old_species) #define COMSIG_HUMAN_SPECIES_CHANGED "human_species_changed" - +/// Source: /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) +#define COMSIG_HUMAN_EARLY_HANDLE_ENVIRONMENT "human_early_handle_environment" +/// Source: /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) +#define COMSIG_HUMAN_HANDLE_ENVIRONMENT "human_handle_environment" ///from /mob/living/carbon/human/proc/check_shields(): (atom/hit_by, damage, attack_text, attack_type, armour_penetration, damage_type) #define COMSIG_HUMAN_CHECK_SHIELDS "human_check_shields" diff --git a/code/__DEFINES/organ_defines.dm b/code/__DEFINES/organ_defines.dm index 34e97a90c74..e18ec9e97ad 100644 --- a/code/__DEFINES/organ_defines.dm +++ b/code/__DEFINES/organ_defines.dm @@ -59,3 +59,6 @@ /// used for species that can see without eyes #define NO_VISION_ORGAN "no_vision_organ" +/// Species organs +#define DRASK_LUNGS_COOLING_START_TEMP 280 +#define DRASK_LUNGS_COOLING_STOP_TEMP 400 diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm index 29e33ed9265..0908012f3ef 100644 --- a/code/__DEFINES/status_effects.dm +++ b/code/__DEFINES/status_effects.dm @@ -30,6 +30,8 @@ #define STATUS_EFFECT_REGENERATIVE_CORE /datum/status_effect/regenerative_core +#define STATUS_EFFECT_DRASK_COMA /datum/status_effect/drask_coma + #define STATUS_EFFECT_TERROR_REGEN /datum/status_effect/terror/regeneration //over time healing, 125 HP within 25~ seconds #define STATUS_EFFECT_TERROR_FOOD_REGEN /datum/status_effect/terror/food_regen //over time healing for mobs to gain full HP within 25~ seconds diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index eeb076ff564..cb22daac2ea 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -774,3 +774,48 @@ /datum/status_effect/drill_payback/on_remove() ..() owner.clear_fullscreen("payback") + +/datum/status_effect/drask_coma + id = "drask_coma" + tick_interval = 2 SECONDS + + var/temp_step + var/sleep_delay + + var/sleep_time + COOLDOWN_DECLARE(sleep_timer) + +/datum/status_effect/drask_coma/on_creation( + mob/living/new_owner, + duration = 0 SECONDS, + temp_step = 5, + sleep_delay = 5 SECONDS, + sleep_time = 30 SECONDS + ) + src.duration = duration + src.temp_step = temp_step + src.sleep_delay = sleep_delay + src.sleep_time = sleep_time + + return ..() + +/datum/status_effect/drask_coma/on_apply() + to_chat(owner, span_notice("Your metabolical processes are stopping.")) + + COOLDOWN_START(src, sleep_time, sleep_time + sleep_delay) + addtimer(CALLBACK(owner, TYPE_PROC_REF(/mob/living, AdjustSleeping), sleep_time), sleep_delay) + + return TRUE + +/datum/status_effect/drask_coma/tick(seconds_between_ticks) + if(COOLDOWN_FINISHED(src, sleep_timer) || owner.stat == DEAD) + qdel(src) + return + + if(owner.stat != UNCONSCIOUS) + return + + owner.adjust_bodytemperature(-temp_step) + +/datum/status_effect/drask_coma/on_remove() + to_chat(owner, span_notice("You feel that your metabolism restored to normal state.")) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 3f08ff83a94..e0cad001aa2 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -291,12 +291,15 @@ if(!environment) return + SEND_SIGNAL(src, COMSIG_HUMAN_EARLY_HANDLE_ENVIRONMENT, environment) + var/loc_temp = get_temperature(environment) // to_chat(world, "Loc temp: [loc_temp] - Body temp: [bodytemperature] - Fireloss: [getFireLoss()] - Thermal protection: [get_thermal_protection()] - Fire protection: [thermal_protection + add_fire_protection(loc_temp)] - Heat capacity: [environment_heat_capacity] - Location: [loc] - src: [src]") //Body temperature is adjusted in two steps. Firstly your body tries to stabilize itself a bit. if(stat != DEAD) body_thermal_regulation(loc_temp) + SEND_SIGNAL(src, COMSIG_HUMAN_HANDLE_ENVIRONMENT, environment) // After then, it reacts to the surrounding atmosphere based on your thermal protection // If we are on fire, we do not heat up or cool down based on surrounding gases diff --git a/code/modules/mob/living/carbon/human/species/drask.dm b/code/modules/mob/living/carbon/human/species/drask.dm index e970e3668e4..a68d89d4bd5 100644 --- a/code/modules/mob/living/carbon/human/species/drask.dm +++ b/code/modules/mob/living/carbon/human/species/drask.dm @@ -1,6 +1,3 @@ -#define DRASK_COOLINGSTARTTEMP 280 -#define ENVIRONMENT_COOLINGSTOPTEMP 400 - /datum/species/drask name = SPECIES_DRASK name_plural = "Drask" @@ -95,21 +92,14 @@ . = ..() remove_verb(H, /mob/living/carbon/human/proc/emote_hum) -/datum/species/drask/handle_life(mob/living/carbon/human/H) - ..() - if(H.stat == DEAD) +/datum/species/drask/handle_life(mob/living/carbon/human/human) + . = ..() + + if(human.stat == DEAD) return - var/datum/gas_mixture/environment = H.return_air() - if(environment && H.bodytemperature > DRASK_COOLINGSTARTTEMP && environment.temperature <= ENVIRONMENT_COOLINGSTOPTEMP) - H.adjust_bodytemperature(-5) - if(H.bodytemperature < TCRYO) - var/update = NONE - update |= H.heal_overall_damage(2, 4, updating_health = FALSE) - update |= H.heal_damages(tox = 0.5, oxy = 2, clone = 1, updating_health = FALSE) - if(update) - H.updatehealth() - var/obj/item/organ/external/head/head = H.get_organ(BODY_ZONE_HEAD) - head?.undisfigure() + + var/datum/reagent/reagent = GLOB.chemical_reagents_list[exotic_blood] + reagent.on_mob_life(human) /datum/species/drask/handle_reagents(mob/living/carbon/human/H, datum/reagent/R) switch(R.id) @@ -119,9 +109,8 @@ if("salglu_solution") if(prob(33)) H.heal_overall_damage(1, 1, updating_health = FALSE) + H.reagents.remove_reagent(R.id, REAGENTS_METABOLISM * H.metabolism_efficiency * H.digestion_ratio) return FALSE + return ..() - -#undef DRASK_COOLINGSTARTTEMP -#undef ENVIRONMENT_COOLINGSTOPTEMP diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index f348dd3cd8a..7637ebe0c4b 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -334,6 +334,27 @@ cold_level_3_damage = -COLD_GAS_DAMAGE_LEVEL_3 cold_damage_types = list(BRUTE = 0.5, BURN = 0.25) + var/cooling_start_temp = DRASK_LUNGS_COOLING_START_TEMP + var/cooling_stop_temp = DRASK_LUNGS_COOLING_STOP_TEMP + +/obj/item/organ/internal/lungs/drask/insert(mob/living/carbon/target, special = ORGAN_MANIPULATION_DEFAULT) + . = ..() + + if(!.) + return FALSE + + RegisterSignal(owner, COMSIG_HUMAN_HANDLE_ENVIRONMENT, PROC_REF(regulate_temperature)) + +/obj/item/organ/internal/lungs/drask/proc/regulate_temperature(datum/source, datum/gas_mixture/environment) + SIGNAL_HANDLER + + if(owner.bodytemperature > cooling_start_temp && environment.temperature <= cooling_stop_temp) + owner.adjust_bodytemperature(-5) + +/obj/item/organ/internal/lungs/drask/remove(mob/living/user, special = ORGAN_MANIPULATION_DEFAULT) + UnregisterSignal(owner, COMSIG_HUMAN_HANDLE_ENVIRONMENT) + return ..() + /obj/item/organ/internal/lungs/cybernetic name = "cybernetic lungs" desc = "A cybernetic version of the lungs found in traditional humanoid entities. It functions the same as an organic lung and is merely meant as a replacement." diff --git a/code/modules/surgery/organs/subtypes/drask.dm b/code/modules/surgery/organs/subtypes/drask.dm index 81b461d2a74..96909fd2662 100644 --- a/code/modules/surgery/organs/subtypes/drask.dm +++ b/code/modules/surgery/organs/subtypes/drask.dm @@ -19,6 +19,33 @@ icon_state = "kidneys" alcohol_intensity = 0.8 +/obj/item/organ/internal/liver/drask/insert(mob/living/carbon/target, special = ORGAN_MANIPULATION_DEFAULT) + . = ..() + + if(!.) + return FALSE + + var/datum/action/innate/drask_coma/coma = new + coma.Grant(owner) + +/obj/item/organ/internal/liver/drask/remove(mob/living/user, special = ORGAN_MANIPULATION_DEFAULT) + var/datum/action/innate/drask_coma/coma = locate() in owner.actions + coma?.Remove(owner) + + return ..() + +/datum/action/innate/drask_coma + name = "Enter coma" + check_flags = AB_CHECK_CONSCIOUS + +/datum/action/innate/drask_coma/activate() + if(owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) + owner.remove_status_effect(STATUS_EFFECT_DRASK_COMA) + return + + owner.apply_status_effect(STATUS_EFFECT_DRASK_COMA) + + /obj/item/organ/internal/brain/drask species_type = /datum/species/drask icon = 'icons/obj/species_organs/drask.dmi' From 2bda537af48d0de757d477d9c12df82bbcf9bf15 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:44:38 +0300 Subject: [PATCH 02/13] organ actions implementation --- code/modules/surgery/organs/organ.dm | 25 ++++++++++++++++++- code/modules/surgery/organs/organ_external.dm | 4 +++ code/modules/surgery/organs/organ_internal.dm | 1 + code/modules/surgery/organs/subtypes/drask.dm | 17 +------------ 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm index 04a08e1a281..d1471225ca1 100644 --- a/code/modules/surgery/organs/organ.dm +++ b/code/modules/surgery/organs/organ.dm @@ -48,6 +48,8 @@ var/emp_proof = FALSE /// Will it skip pain messages? var/hidden_pain = FALSE + /// Put your spells/actions here. They will be granted if organ inserted and removed when organ removed. + var/list/organ_actions /obj/item/organ/New(mob/living/carbon/human/holder) @@ -371,12 +373,33 @@ if(owner?.stat != DEAD && vital && !special) add_attack_logs(user, owner, "Removed vital organ ([src])") owner.death() + + if(LAZYLEN(organ_actions)) + for(var/datum/action/action in owner.actions) + if(!is_type_in_list(action, organ_actions)) + continue + + action.Remove(owner) + + for(var/obj/effect/proc_holder/spell/spell in owner.mind?.spell_list) + if(!is_type_in_list(spell, organ_actions)) + continue + + owner.mind.RemoveSpell(spell) + owner = null return src /obj/item/organ/proc/replaced(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) - return // Nothing uses this, it is always overridden + if(LAZYLEN(organ_actions)) + for(var/datum/action/action in organ_actions) + action.Grant(target) + + for(var/obj/effect/proc_holder/spell/spell in organ_actions) + target.mind?.AddSpell(new spell) + + return // A version of `replaced` that "flattens" the process of insertion, making organs "Plug'n'play" diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 4eacc7768a4..c90d80927bf 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -168,6 +168,8 @@ /obj/item/organ/external/replaced(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) + . = ..() + owner = target forceMove(owner) @@ -181,8 +183,10 @@ return var/obj/item/organ/external/replaced = owner.bodyparts_by_name[limb_zone] + if(!isnull(replaced)) replaced.remove(target, ORGAN_MANIPULATION_NOEFFECT) + owner.bodyparts_by_name[limb_zone] = src owner.bodyparts |= src diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index c12203c2244..1ec52d0c5a7 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -114,6 +114,7 @@ /obj/item/organ/internal/replaced(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) + . = ..() insert(target) diff --git a/code/modules/surgery/organs/subtypes/drask.dm b/code/modules/surgery/organs/subtypes/drask.dm index 96909fd2662..368f4306d2e 100644 --- a/code/modules/surgery/organs/subtypes/drask.dm +++ b/code/modules/surgery/organs/subtypes/drask.dm @@ -19,24 +19,10 @@ icon_state = "kidneys" alcohol_intensity = 0.8 -/obj/item/organ/internal/liver/drask/insert(mob/living/carbon/target, special = ORGAN_MANIPULATION_DEFAULT) - . = ..() - - if(!.) - return FALSE - - var/datum/action/innate/drask_coma/coma = new - coma.Grant(owner) - -/obj/item/organ/internal/liver/drask/remove(mob/living/user, special = ORGAN_MANIPULATION_DEFAULT) - var/datum/action/innate/drask_coma/coma = locate() in owner.actions - coma?.Remove(owner) - - return ..() - /datum/action/innate/drask_coma name = "Enter coma" check_flags = AB_CHECK_CONSCIOUS + organ_actions = list(/datum/action/innate/drask_coma) /datum/action/innate/drask_coma/activate() if(owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) @@ -44,7 +30,6 @@ return owner.apply_status_effect(STATUS_EFFECT_DRASK_COMA) - /obj/item/organ/internal/brain/drask species_type = /datum/species/drask From 77c247a28df0443bb255949c481f800ff70187bc Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:20:27 +0300 Subject: [PATCH 03/13] some adjustments --- code/datums/status_effects/buffs.dm | 2 +- code/modules/surgery/organs/organ.dm | 26 ++++++++++++- code/modules/surgery/organs/organ_internal.dm | 1 + code/modules/surgery/organs/subtypes/drask.dm | 38 +++++++++++++------ 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index cb22daac2ea..727e53c0f6d 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -790,7 +790,7 @@ duration = 0 SECONDS, temp_step = 5, sleep_delay = 5 SECONDS, - sleep_time = 30 SECONDS + sleep_time = 20 SECONDS ) src.duration = duration src.temp_step = temp_step diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm index d1471225ca1..d12c4274006 100644 --- a/code/modules/surgery/organs/organ.dm +++ b/code/modules/surgery/organs/organ.dm @@ -48,7 +48,7 @@ var/emp_proof = FALSE /// Will it skip pain messages? var/hidden_pain = FALSE - /// Put your spells/actions here. They will be granted if organ inserted and removed when organ removed. + /// Put your spells/actions here. They will be granted if organ inserted and removed with organ removal. var/list/organ_actions @@ -67,11 +67,15 @@ /obj/item/organ/Destroy() STOP_PROCESSING(SSobj, src) + if(owner) remove(owner, ORGAN_MANIPULATION_NOEFFECT) + QDEL_LIST_ASSOC_VAL(autopsy_data) + if(dna) QDEL_NULL(dna) + return ..() @@ -88,6 +92,7 @@ if(is_robotic() && !species_type) // no DNA for cybernetics, except IPC parts if(update_blood) update_blood() + return if(!dna) @@ -119,6 +124,7 @@ /obj/item/organ/proc/update_blood() if(!dna || (TRAIT_NO_BLOOD in dna.species.inherent_traits)) return + LAZYSET(blood_DNA, dna.unique_enzymes, dna.blood_type) @@ -129,13 +135,17 @@ /obj/item/organ/proc/necrotize(silent = FALSE) if(status & (ORGAN_ROBOT|ORGAN_DEAD)) return FALSE + damage = max_damage status |= ORGAN_DEAD STOP_PROCESSING(SSobj, src) + if(dead_icon && !is_robotic()) icon_state = dead_icon + if(owner && vital) owner.death() + return TRUE @@ -146,6 +156,7 @@ /obj/item/organ/proc/unnecrotize() if(!is_dead()) return FALSE + status &= ~ORGAN_DEAD return TRUE @@ -154,12 +165,15 @@ if(istype(I, /obj/item/stack/nanopaste)) add_fingerprint(user) var/obj/item/stack/nanopaste/nanopaste = I + if(!is_robotic()) to_chat(user, span_warning("The [nanopaste.name] can only be used on robotic bodyparts.")) return ATTACK_CHAIN_PROCEED + if(!nanopaste.use(1)) to_chat(user, span_warning("You need at least one unit of [nanopaste] to proceed.")) return ATTACK_CHAIN_PROCEED + to_chat(user, span_notice("You have repaired the damage on [src].")) rejuvenate() return ATTACK_CHAIN_PROCEED_SUCCESS @@ -185,10 +199,13 @@ // Maybe scale it down a bit, have it REALLY kick in once past the basic infection threshold // Another mercy for surgeons preparing transplant organs germ_level++ + if(germ_level >= INFECTION_LEVEL_ONE) germ_level += rand(2,6) + if(germ_level >= INFECTION_LEVEL_TWO) germ_level += rand(2,6) + if(germ_level >= INFECTION_LEVEL_THREE) necrotize() @@ -212,12 +229,15 @@ for(var/typepath in preserved_holders) if(is_found_within(typepath)) return TRUE + if(istype(loc,/obj/item/mmi)) // So a brain can slowly recover from being left out of an MMI germ_level = max(0, germ_level - 1) return TRUE + if(istype(loc, /mob/living/simple_animal/hostile/headslug) || istype(loc, /obj/item/organ/internal/body_egg/changeling_egg)) germ_level = 0 // weird stuff might happen, best to be safe return TRUE + if(isturf(loc)) var/is_in_freezer = FALSE if(world.time - last_freezer_update_time > freezer_update_period) @@ -343,6 +363,7 @@ /obj/item/organ/proc/heal_internal_damage(amount, robo_repair = FALSE) if(is_robotic() && !robo_repair) return + damage = max(damage - amount, 0) @@ -418,6 +439,7 @@ /obj/item/organ/proc/has_damage() if(damage) return TRUE + return FALSE /obj/item/organ/proc/is_robotic() @@ -426,6 +448,7 @@ /obj/item/organ/serialize() var/data = ..() + if(status != 0) data["status"] = status @@ -433,6 +456,7 @@ // the owner if(!(owner && dna.unique_enzymes == owner.dna.unique_enzymes)) data["dna"] = dna.serialize() + return data diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index 1ec52d0c5a7..1b1f15ef4d6 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -106,6 +106,7 @@ /obj/item/organ/internal/emp_act(severity) if(!is_robotic() || emp_proof) return + switch(severity) if(1) internal_receive_damage(20, silent = TRUE) diff --git a/code/modules/surgery/organs/subtypes/drask.dm b/code/modules/surgery/organs/subtypes/drask.dm index 368f4306d2e..f9820131975 100644 --- a/code/modules/surgery/organs/subtypes/drask.dm +++ b/code/modules/surgery/organs/subtypes/drask.dm @@ -11,6 +11,7 @@ name = "drask heart" icon = 'icons/obj/species_organs/drask.dmi' parent_organ_zone = BODY_ZONE_HEAD + organ_actions = list(/datum/action/innate/drask_coma) /obj/item/organ/internal/liver/drask species_type = /datum/species/drask @@ -19,18 +20,6 @@ icon_state = "kidneys" alcohol_intensity = 0.8 -/datum/action/innate/drask_coma - name = "Enter coma" - check_flags = AB_CHECK_CONSCIOUS - organ_actions = list(/datum/action/innate/drask_coma) - -/datum/action/innate/drask_coma/activate() - if(owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) - owner.remove_status_effect(STATUS_EFFECT_DRASK_COMA) - return - - owner.apply_status_effect(STATUS_EFFECT_DRASK_COMA) - /obj/item/organ/internal/brain/drask species_type = /datum/species/drask icon = 'icons/obj/species_organs/drask.dmi' @@ -44,3 +33,28 @@ icon = 'icons/obj/species_organs/drask.dmi' desc = "Drask eyes. They look even stranger disembodied." see_in_dark = 5 + +/datum/action/innate/drask_coma + name = "Enter coma" + desc = "Постепенно останавливает метаболизм, понижает температуру тела и заставляет уснуть на некоторое время." + + check_flags = AB_CHECK_CONSCIOUS + + button_icon = 'icons/obj/species_organs/drask.dmi' + button_icon_state = "heart_on" + +/datum/action/innate/drask_coma/activate() + . = TRUE + + if(owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) + owner.remove_status_effect(STATUS_EFFECT_DRASK_COMA) + . = FALSE + + if(.) + owner.apply_status_effect(STATUS_EFFECT_DRASK_COMA) + + UpdateButtonIcon() + +/datum/action/innate/drask_coma/UpdateButtonIcon() + button_icon_state = owner.has_status_effect(STATUS_EFFECT_DRASK_COMA) ? "heart_off" : initial(button_icon_state) + return ..() From b9620f3861b5970c0f9df3eb816726fd0e85373a Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 21 Oct 2024 18:47:43 +0300 Subject: [PATCH 04/13] mega improve --- code/datums/status_effects/buffs.dm | 27 +++++--------- code/modules/surgery/organs/subtypes/drask.dm | 37 +++++++++++++------ 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 727e53c0f6d..97b2d9091ef 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -780,41 +780,32 @@ tick_interval = 2 SECONDS var/temp_step - var/sleep_delay - - var/sleep_time - COOLDOWN_DECLARE(sleep_timer) /datum/status_effect/drask_coma/on_creation( mob/living/new_owner, - duration = 0 SECONDS, + duration = 300 SECONDS, temp_step = 5, - sleep_delay = 5 SECONDS, - sleep_time = 20 SECONDS ) src.duration = duration src.temp_step = temp_step - src.sleep_delay = sleep_delay - src.sleep_time = sleep_time return ..() /datum/status_effect/drask_coma/on_apply() - to_chat(owner, span_notice("Your metabolical processes are stopping.")) + to_chat(owner, span_notice("Your metabolical processes are stopped.")) - COOLDOWN_START(src, sleep_time, sleep_time + sleep_delay) - addtimer(CALLBACK(owner, TYPE_PROC_REF(/mob/living, AdjustSleeping), sleep_time), sleep_delay) + owner.AdjustSleeping(duration) + RegisterSignal(owner, COMSIG_MOB_STATCHANGE, PROC_REF(stat_change)) return TRUE -/datum/status_effect/drask_coma/tick(seconds_between_ticks) - if(COOLDOWN_FINISHED(src, sleep_timer) || owner.stat == DEAD) - qdel(src) - return +/datum/status_effect/drask_coma/proc/stat_change(datum/source, new_stat, old_stat) + SIGNAL_HANDLER - if(owner.stat != UNCONSCIOUS) - return + if(new_stat == CONSCIOUS || new_stat == DEAD) + qdel(src) +/datum/status_effect/drask_coma/tick(seconds_between_ticks) owner.adjust_bodytemperature(-temp_step) /datum/status_effect/drask_coma/on_remove() diff --git a/code/modules/surgery/organs/subtypes/drask.dm b/code/modules/surgery/organs/subtypes/drask.dm index f9820131975..339f6d83ba6 100644 --- a/code/modules/surgery/organs/subtypes/drask.dm +++ b/code/modules/surgery/organs/subtypes/drask.dm @@ -36,25 +36,38 @@ /datum/action/innate/drask_coma name = "Enter coma" - desc = "Постепенно останавливает метаболизм, понижает температуру тела и заставляет уснуть на некоторое время." - - check_flags = AB_CHECK_CONSCIOUS + desc = "Постепенно усыпляет, понижает температуру тела. Повторная активация способности позволит прервать вход в кому, либо выйти из нее." button_icon = 'icons/obj/species_organs/drask.dmi' button_icon_state = "heart_on" + COOLDOWN_DECLARE(wake_up_cooldown) + var/activation_time + /datum/action/innate/drask_coma/activate() - . = TRUE + activation_time = world.time - if(owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) - owner.remove_status_effect(STATUS_EFFECT_DRASK_COMA) - . = FALSE + if(!owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) + if(!do_after(owner, 5 SECONDS, owner, ALL, extra_checks = CALLBACK(src, PROC_REF(stopped_channeling)), max_interaction_count = 1)) + to_chat(owner, span_notice("Вы подсознательно возобновляете метаболизм")) + return FALSE - if(.) owner.apply_status_effect(STATUS_EFFECT_DRASK_COMA) + COOLDOWN_START(src, wake_up_cooldown, 10 SECONDS) + return + + if(!COOLDOWN_FINISHED(src, wake_up_cooldown)) + to_chat(owner, span_warning("Вы не можете пробудиться сейчас.")) + return + + to_chat(owner, span_notice("Вы начинаете пробуждаться.")) + + if(!do_after(owner, 10 SECONDS, owner, ALL, extra_checks = CALLBACK(src, PROC_REF(stopped_channeling)) max_interaction_count = 1)) + to_chat(owner, span_notice("Вы решили продолжить сон.")) + return - UpdateButtonIcon() + owner.remove_status_effect(STATUS_EFFECT_DRASK_COMA) + return -/datum/action/innate/drask_coma/UpdateButtonIcon() - button_icon_state = owner.has_status_effect(STATUS_EFFECT_DRASK_COMA) ? "heart_off" : initial(button_icon_state) - return ..() +/datum/action/innate/drask_coma/proc/stopped_channeling() + return activation_time != 0 From 62083833a73f39305d1c6c54d764f1452dafec24 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:18:12 +0300 Subject: [PATCH 05/13] the last one --- code/__DEFINES/dcs/signals.dm | 5 +++ code/datums/status_effects/status_effect.dm | 2 + code/modules/surgery/organs/subtypes/drask.dm | 43 +++++++++++++++---- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index c6ec3780232..4da76ebf1b4 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -577,6 +577,11 @@ #define COMSIG_LIVING_RESTING "living_resting" ///from base of mob/update_transform() #define COMSIG_LIVING_POST_UPDATE_TRANSFORM "living_post_update_transform" +/// Source: /mob/living/proc/apply_status_effect(datum/status_effect/new_instance) +#define COMSIG_LIVING_GAINED_STATUS_EFFECT "living_gained_status_effect" +/// Source: /mob/living/proc/remove_status_effect(datum/status_effect/existing_effect) +#define COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT "living_lost_status_effect" + // Called before qdel ///called on /living when someone starts pulling (atom/movable/pulled, state, force) #define COMSIG_LIVING_START_PULL "living_start_pull" diff --git a/code/datums/status_effects/status_effect.dm b/code/datums/status_effects/status_effect.dm index eac5289d91b..238adcde39a 100644 --- a/code/datums/status_effects/status_effect.dm +++ b/code/datums/status_effects/status_effect.dm @@ -248,6 +248,7 @@ // Create the status effect with our mob + our arguments var/datum/status_effect/new_instance = new new_effect(arguments) if(!QDELETED(new_instance)) + SEND_SIGNAL(src, COMSIG_LIVING_GAINED_STATUS_EFFECT, new_instance) return new_instance @@ -265,6 +266,7 @@ . = FALSE for(var/datum/status_effect/existing_effect as anything in status_effects) if(existing_effect.id == initial(removed_effect.id) && existing_effect.before_remove(arglist(arguments))) + SEND_SIGNAL(src, COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT, existing_effect) qdel(existing_effect) . = TRUE diff --git a/code/modules/surgery/organs/subtypes/drask.dm b/code/modules/surgery/organs/subtypes/drask.dm index 339f6d83ba6..30039e86d50 100644 --- a/code/modules/surgery/organs/subtypes/drask.dm +++ b/code/modules/surgery/organs/subtypes/drask.dm @@ -36,24 +36,48 @@ /datum/action/innate/drask_coma name = "Enter coma" - desc = "Постепенно усыпляет, понижает температуру тела. Повторная активация способности позволит прервать вход в кому, либо выйти из нее." + desc = "Постепенно вводит в состояние комы, понижает температуру тела. Повторная активация способности позволит прервать вход в кому, либо выйти из нее." button_icon = 'icons/obj/species_organs/drask.dmi' button_icon_state = "heart_on" COOLDOWN_DECLARE(wake_up_cooldown) - var/activation_time -/datum/action/innate/drask_coma/activate() - activation_time = world.time +/datum/action/innate/drask_coma/Grant(mob/user) + . = ..() + + if(!.) + return FALSE + + RegisterSignal(owner, list( + COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT, + COMSIG_LIVING_GAINED_STATUS_EFFECT), + PROC_REF(handle_effect)) + +/datum/action/innate/drask_coma/Remove(mob/user) + UnregisterSignal(owner, list( + COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT, + COMSIG_LIVING_GAINED_STATUS_EFFECT)) + + return ..() + +/datum/action/innate/drask_coma/proc/handle_effect(datum/status_effect/effect) + SIGNAL_HANDLER + if(!istype(effect, STATUS_EFFECT_DRASK_COMA)) + return + + INVOKE_ASYNC(src, PROC_REF(UpdateButtonIcon)) + +/datum/action/innate/drask_coma/activate() if(!owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) - if(!do_after(owner, 5 SECONDS, owner, ALL, extra_checks = CALLBACK(src, PROC_REF(stopped_channeling)), max_interaction_count = 1)) + if(!do_after(owner, 5 SECONDS, owner, ALL, cancel_on_max = TRUE, max_interaction_count = 1)) to_chat(owner, span_notice("Вы подсознательно возобновляете метаболизм")) - return FALSE + return owner.apply_status_effect(STATUS_EFFECT_DRASK_COMA) COOLDOWN_START(src, wake_up_cooldown, 10 SECONDS) + return if(!COOLDOWN_FINISHED(src, wake_up_cooldown)) @@ -62,12 +86,13 @@ to_chat(owner, span_notice("Вы начинаете пробуждаться.")) - if(!do_after(owner, 10 SECONDS, owner, ALL, extra_checks = CALLBACK(src, PROC_REF(stopped_channeling)) max_interaction_count = 1)) + if(!do_after(owner, 10 SECONDS, owner, ALL, cancel_on_max = TRUE, max_interaction_count = 1)) to_chat(owner, span_notice("Вы решили продолжить сон.")) return owner.remove_status_effect(STATUS_EFFECT_DRASK_COMA) return -/datum/action/innate/drask_coma/proc/stopped_channeling() - return activation_time != 0 +/datum/action/innate/drask_coma/UpdateButtonIcon() + button_icon_state = owner.has_status_effect(STATUS_EFFECT_DRASK_COMA) ? "heart_off" : initial(button_icon_state) + return ..() From 91d7780e5ce849273b902350ea54fbee3c55c5d5 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:20:27 +0300 Subject: [PATCH 06/13] smol moments --- code/__DEFINES/dcs/signals.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 4da76ebf1b4..9b20ee64195 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -580,8 +580,7 @@ /// Source: /mob/living/proc/apply_status_effect(datum/status_effect/new_instance) #define COMSIG_LIVING_GAINED_STATUS_EFFECT "living_gained_status_effect" /// Source: /mob/living/proc/remove_status_effect(datum/status_effect/existing_effect) -#define COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT "living_lost_status_effect" - // Called before qdel +#define COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT "living_early_lost_status_effect" // Called before qdel ///called on /living when someone starts pulling (atom/movable/pulled, state, force) #define COMSIG_LIVING_START_PULL "living_start_pull" From d0a4cf614198de8b8b6b7aeb75dba94c37d3458e Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:09:45 +0300 Subject: [PATCH 07/13] the last one --- code/datums/status_effects/buffs.dm | 4 ++ .../mob/living/carbon/human/species/drask.dm | 70 +++++++++++++++++-- code/modules/surgery/organs/organ.dm | 22 ------ code/modules/surgery/organs/organ_external.dm | 2 - code/modules/surgery/organs/organ_internal.dm | 3 +- code/modules/surgery/organs/subtypes/drask.dm | 64 ----------------- 6 files changed, 69 insertions(+), 96 deletions(-) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 97b2d9091ef..cc021308b90 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -780,6 +780,7 @@ tick_interval = 2 SECONDS var/temp_step + var/cached_sleep_time /datum/status_effect/drask_coma/on_creation( mob/living/new_owner, @@ -794,6 +795,7 @@ /datum/status_effect/drask_coma/on_apply() to_chat(owner, span_notice("Your metabolical processes are stopped.")) + cached_sleep_time = world.time owner.AdjustSleeping(duration) RegisterSignal(owner, COMSIG_MOB_STATCHANGE, PROC_REF(stat_change)) @@ -810,3 +812,5 @@ /datum/status_effect/drask_coma/on_remove() to_chat(owner, span_notice("You feel that your metabolism restored to normal state.")) + owner.AdjustSleeping(duration - cached_sleep_time) + UnregisterSignal(owner, COMSIG_MOB_STATCHANGE) diff --git a/code/modules/mob/living/carbon/human/species/drask.dm b/code/modules/mob/living/carbon/human/species/drask.dm index a68d89d4bd5..b5a1bedec42 100644 --- a/code/modules/mob/living/carbon/human/species/drask.dm +++ b/code/modules/mob/living/carbon/human/species/drask.dm @@ -84,13 +84,24 @@ var/obj/item/organ/internal/eyes/E = H.get_int_organ(/obj/item/organ/internal/eyes) return E.eye_colour -/datum/species/drask/on_species_gain(mob/living/carbon/human/H) +/datum/species/drask/on_species_gain(mob/living/carbon/human/human) . = ..() - add_verb(H, /mob/living/carbon/human/proc/emote_hum) -/datum/species/drask/on_species_loss(mob/living/carbon/human/H) + var/datum/action/innate/drask/coma/coma = locate() in human.actions + + if(!coma) + coma = new + coma.Grant(human) + + add_verb(human, /mob/living/carbon/human/proc/emote_hum) + +/datum/species/drask/on_species_loss(mob/living/carbon/human/human) . = ..() - remove_verb(H, /mob/living/carbon/human/proc/emote_hum) + + var/datum/action/innate/drask/coma/coma = locate() in human.actions + coma?.Remove(human) + + remove_verb(human, /mob/living/carbon/human/proc/emote_hum) /datum/species/drask/handle_life(mob/living/carbon/human/human) . = ..() @@ -98,8 +109,16 @@ if(human.stat == DEAD) return - var/datum/reagent/reagent = GLOB.chemical_reagents_list[exotic_blood] - reagent.on_mob_life(human) + if(human.bodytemperature < TCRYO) + var/update = NONE + update |= human.heal_overall_damage(2, 4, updating_health = FALSE) + update |= human.heal_damages(tox = 0.5, oxy = 2, clone = 1, updating_health = FALSE) + + if(update) + human.updatehealth() + + var/obj/item/organ/external/head/head = human.get_organ(BODY_ZONE_HEAD) + head?.undisfigure() /datum/species/drask/handle_reagents(mob/living/carbon/human/H, datum/reagent/R) switch(R.id) @@ -114,3 +133,42 @@ return FALSE return ..() + +/datum/action/innate/drask + +/datum/action/innate/drask/Grant(mob/user) + . = ..() + + if(!. && !isdrask(user)) + return FALSE + + return . + +/datum/action/innate/drask/coma + name = "Enter coma" + desc = "Постепенно вводит в состояние комы, понижает температуру тела. Повторная активация способности позволит прервать вход в кому, либо выйти из нее." + + button_icon_state = "heal" + + COOLDOWN_DECLARE(wake_up_cooldown) + +/datum/action/innate/drask/coma/Activate() + var/mob/living/living = owner + + if(!living.has_status_effect(STATUS_EFFECT_DRASK_COMA)) + if(!do_after(living, 5 SECONDS, living, ALL, cancel_on_max = TRUE, max_interact_count = 1)) + return + + living.apply_status_effect(STATUS_EFFECT_DRASK_COMA) + COOLDOWN_START(src, wake_up_cooldown, 10 SECONDS) + + return + + if(!COOLDOWN_FINISHED(src, wake_up_cooldown)) + to_chat(living, span_warning("Вы не можете пробудиться сейчас.")) + return + + if(!do_after(living, 10 SECONDS, living, ALL, cancel_on_max = TRUE, max_interact_count = 1)) + return + + living.remove_status_effect(STATUS_EFFECT_DRASK_COMA) diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm index d12c4274006..59373e06756 100644 --- a/code/modules/surgery/organs/organ.dm +++ b/code/modules/surgery/organs/organ.dm @@ -48,8 +48,6 @@ var/emp_proof = FALSE /// Will it skip pain messages? var/hidden_pain = FALSE - /// Put your spells/actions here. They will be granted if organ inserted and removed with organ removal. - var/list/organ_actions /obj/item/organ/New(mob/living/carbon/human/holder) @@ -395,31 +393,11 @@ add_attack_logs(user, owner, "Removed vital organ ([src])") owner.death() - if(LAZYLEN(organ_actions)) - for(var/datum/action/action in owner.actions) - if(!is_type_in_list(action, organ_actions)) - continue - - action.Remove(owner) - - for(var/obj/effect/proc_holder/spell/spell in owner.mind?.spell_list) - if(!is_type_in_list(spell, organ_actions)) - continue - - owner.mind.RemoveSpell(spell) - owner = null return src /obj/item/organ/proc/replaced(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) - if(LAZYLEN(organ_actions)) - for(var/datum/action/action in organ_actions) - action.Grant(target) - - for(var/obj/effect/proc_holder/spell/spell in organ_actions) - target.mind?.AddSpell(new spell) - return diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index c90d80927bf..20a2fb27128 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -168,8 +168,6 @@ /obj/item/organ/external/replaced(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) - . = ..() - owner = target forceMove(owner) diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index 1b1f15ef4d6..78d3974a70d 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -115,8 +115,7 @@ /obj/item/organ/internal/replaced(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) - . = ..() - insert(target) + insert(target) /obj/item/organ/internal/item_action_slot_check(slot, mob/user, datum/action/action) diff --git a/code/modules/surgery/organs/subtypes/drask.dm b/code/modules/surgery/organs/subtypes/drask.dm index 30039e86d50..81b461d2a74 100644 --- a/code/modules/surgery/organs/subtypes/drask.dm +++ b/code/modules/surgery/organs/subtypes/drask.dm @@ -11,7 +11,6 @@ name = "drask heart" icon = 'icons/obj/species_organs/drask.dmi' parent_organ_zone = BODY_ZONE_HEAD - organ_actions = list(/datum/action/innate/drask_coma) /obj/item/organ/internal/liver/drask species_type = /datum/species/drask @@ -33,66 +32,3 @@ icon = 'icons/obj/species_organs/drask.dmi' desc = "Drask eyes. They look even stranger disembodied." see_in_dark = 5 - -/datum/action/innate/drask_coma - name = "Enter coma" - desc = "Постепенно вводит в состояние комы, понижает температуру тела. Повторная активация способности позволит прервать вход в кому, либо выйти из нее." - - button_icon = 'icons/obj/species_organs/drask.dmi' - button_icon_state = "heart_on" - - COOLDOWN_DECLARE(wake_up_cooldown) - -/datum/action/innate/drask_coma/Grant(mob/user) - . = ..() - - if(!.) - return FALSE - - RegisterSignal(owner, list( - COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT, - COMSIG_LIVING_GAINED_STATUS_EFFECT), - PROC_REF(handle_effect)) - -/datum/action/innate/drask_coma/Remove(mob/user) - UnregisterSignal(owner, list( - COMSIG_LIVING_EARLY_LOST_STATUS_EFFECT, - COMSIG_LIVING_GAINED_STATUS_EFFECT)) - - return ..() - -/datum/action/innate/drask_coma/proc/handle_effect(datum/status_effect/effect) - SIGNAL_HANDLER - - if(!istype(effect, STATUS_EFFECT_DRASK_COMA)) - return - - INVOKE_ASYNC(src, PROC_REF(UpdateButtonIcon)) - -/datum/action/innate/drask_coma/activate() - if(!owner.has_status_effect(STATUS_EFFECT_DRASK_COMA)) - if(!do_after(owner, 5 SECONDS, owner, ALL, cancel_on_max = TRUE, max_interaction_count = 1)) - to_chat(owner, span_notice("Вы подсознательно возобновляете метаболизм")) - return - - owner.apply_status_effect(STATUS_EFFECT_DRASK_COMA) - COOLDOWN_START(src, wake_up_cooldown, 10 SECONDS) - - return - - if(!COOLDOWN_FINISHED(src, wake_up_cooldown)) - to_chat(owner, span_warning("Вы не можете пробудиться сейчас.")) - return - - to_chat(owner, span_notice("Вы начинаете пробуждаться.")) - - if(!do_after(owner, 10 SECONDS, owner, ALL, cancel_on_max = TRUE, max_interaction_count = 1)) - to_chat(owner, span_notice("Вы решили продолжить сон.")) - return - - owner.remove_status_effect(STATUS_EFFECT_DRASK_COMA) - return - -/datum/action/innate/drask_coma/UpdateButtonIcon() - button_icon_state = owner.has_status_effect(STATUS_EFFECT_DRASK_COMA) ? "heart_off" : initial(button_icon_state) - return ..() From 92caaf4314cc284afeeea88e6b75abea2ed73ed6 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:22:29 +0300 Subject: [PATCH 08/13] =?UTF-8?q?=D0=B4=D0=BEQoL=D0=B8=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/datums/status_effects/buffs.dm | 7 ++++++- code/modules/mob/living/carbon/human/species/drask.dm | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index cc021308b90..521b35d6a21 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -812,5 +812,10 @@ /datum/status_effect/drask_coma/on_remove() to_chat(owner, span_notice("You feel that your metabolism restored to normal state.")) - owner.AdjustSleeping(duration - cached_sleep_time) + + var/elapsed_time = world.time - cached_sleep_time + + if(elapsed_time < duration) + owner.AdjustSleeping(-(duration - elapsed_time)) + UnregisterSignal(owner, COMSIG_MOB_STATCHANGE) diff --git a/code/modules/mob/living/carbon/human/species/drask.dm b/code/modules/mob/living/carbon/human/species/drask.dm index b5a1bedec42..5e08c2364c4 100644 --- a/code/modules/mob/living/carbon/human/species/drask.dm +++ b/code/modules/mob/living/carbon/human/species/drask.dm @@ -139,7 +139,7 @@ /datum/action/innate/drask/Grant(mob/user) . = ..() - if(!. && !isdrask(user)) + if(!. && !isliving(user)) return FALSE return . From e6a7528656f4778547230220901809d1dd5c96ab Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:53:38 +0300 Subject: [PATCH 09/13] doqol x2 --- code/datums/status_effects/buffs.dm | 2 +- code/modules/surgery/organs/organ_internal.dm | 33 +++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 521b35d6a21..725d873532a 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -785,7 +785,7 @@ /datum/status_effect/drask_coma/on_creation( mob/living/new_owner, duration = 300 SECONDS, - temp_step = 5, + temp_step = 10, ) src.duration = duration src.temp_step = temp_step diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index 78d3974a70d..e17da61196f 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -14,6 +14,7 @@ /obj/item/organ/internal/New(mob/living/carbon/holder) ..() + if(istype(holder)) insert(holder) @@ -30,6 +31,7 @@ do_pickup_animation(src, target) var/obj/item/organ/internal/replaced = target.get_organ_slot(slot) + if(replaced) replaced.remove(target, ORGAN_MANIPULATION_NOEFFECT) @@ -44,6 +46,7 @@ stack_trace("[src] attempted to insert into a [parent_organ_zone], but [parent_organ_zone] wasn't an organ! [atom_loc_line(h_target)]") else LAZYOR(parent.internal_organs, src) + h_target.update_int_organs() loc = null @@ -75,10 +78,13 @@ if(iscarbon(organ_owner)) organ_owner.internal_organs -= src + if(organ_owner.internal_organs_slot[slot] == src) organ_owner.internal_organs_slot[slot] = null + if(!special) send_signal = TRUE + if(vital && !special && organ_owner.stat != DEAD) organ_owner.death() @@ -106,7 +112,7 @@ /obj/item/organ/internal/emp_act(severity) if(!is_robotic() || emp_proof) return - + switch(severity) if(1) internal_receive_damage(20, silent = TRUE) @@ -115,7 +121,7 @@ /obj/item/organ/internal/replaced(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) - insert(target) + insert(target) /obj/item/organ/internal/item_action_slot_check(slot, mob/user, datum/action/action) @@ -138,6 +144,7 @@ /obj/item/organ/internal/proc/prepare_eat() if(is_robotic()) return //no eating cybernetic implants! + var/obj/item/reagent_containers/food/snacks/organ/S = new S.name = name S.desc = desc @@ -151,6 +158,7 @@ /obj/item/organ/internal/attempt_become_organ(obj/item/organ/external/parent, mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT) if(parent_organ_zone != parent.limb_zone) return FALSE + insert(target, special) return TRUE @@ -172,6 +180,7 @@ return ..() var/obj/item/reagent_containers/food/snacks/snack = prepare_eat() + if(!snack) return ATTACK_CHAIN_PROCEED @@ -198,9 +207,11 @@ H.icon_base = "[slot]-c" H.dead_icon = "[slot]-c-off" H.update_icon() + else if("[slot]-c" in states) //Give the robotic organ its robotic organ icons if they exist. icon = icon('icons/obj/surgery.dmi') icon_state = "[slot]-c" + name = "cybernetic [slot]" ..() //Go apply all the organ flags/robotic statuses. @@ -217,12 +228,14 @@ for(var/datum/disease/appendicitis/A in M.diseases) A.cure() inflamed = TRUE + update_icon() . = ..() /obj/item/organ/internal/appendix/insert(mob/living/carbon/M, special = ORGAN_MANIPULATION_DEFAULT) ..() + if(inflamed) var/datum/disease/appendicitis/D = new D.Contract(M) @@ -230,8 +243,10 @@ /obj/item/organ/internal/appendix/prepare_eat() var/obj/S = ..() + if(inflamed) S.reagents.add_reagent("????", 5) + return S @@ -263,8 +278,10 @@ var/light_count = T.get_lumcount()*10 if(light_count > 4 && obj_integrity > 0) //Die in the light obj_integrity-- + else if(light_count < 2 && obj_integrity < max_integrity) //Heal in the dark obj_integrity++ + if(obj_integrity <= 0) visible_message(span_warning("[src] collapses in on itself!")) qdel(src) @@ -287,6 +304,7 @@ /obj/item/organ/internal/honktumor/insert(mob/living/carbon/M, special = ORGAN_MANIPULATION_DEFAULT) ..() + M.force_gene_block(GLOB.clumsyblock, TRUE) M.force_gene_block(GLOB.comicblock, TRUE) organhonked = world.time @@ -334,6 +352,7 @@ /obj/item/organ/internal/honktumor/cursed/on_life() //No matter what you do, no matter who you are, no matter where you go, you're always going to be a fat, stuttering dimwit. ..() + owner.setBrainLoss(80) owner.set_nutrition(9000) owner.overeatduration = 9000 @@ -379,13 +398,16 @@ if(ishuman(owner)) var/mob/living/carbon/human/H = owner var/obj/item/organ/external/head/head_organ = H.get_organ(BODY_ZONE_HEAD) + if(!(head_organ.h_style == "Very Long Hair" || head_organ.h_style == "Mohawk")) if(prob(10)) head_organ.h_style = "Mohawk" else head_organ.h_style = "Very Long Hair" + head_organ.hair_colour = "#D8C078" H.update_hair() + if(!(head_organ.f_style == "Very Long Beard")) head_organ.f_style = "Very Long Beard" head_organ.facial_colour = "#D8C078" @@ -396,7 +418,9 @@ ..() if(!ishuman(owner)) return + var/germs_mod = owner.dna.species.germs_growth_mod * owner.physiology.germs_growth_mod + if(germ_level >= INFECTION_LEVEL_TWO && prob(3 * germs_mod)) // big message from every 1 damage is not good. If germs growth rate is big, it will spam the chat. internal_receive_damage(1, silent = prob(30 * germs_mod)) @@ -404,16 +428,19 @@ /mob/living/carbon/human/proc/check_infections() var/list/infections = list() + for(var/obj/item/organ/internal/organ as anything in internal_organs) if(organ.germ_level > 0) infections.Add(organ) + return infections /mob/living/carbon/human/proc/check_damaged_organs() var/list/damaged = list() + for(var/obj/item/organ/internal/organ as anything in internal_organs) if(organ.damage > 0) damaged.Add(organ) - return damaged + return damaged From 2201bf8cfa2d82d314324ef712af6dbeefd12c38 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:31:42 +0300 Subject: [PATCH 10/13] fix moment with coma uncons --- code/datums/status_effects/buffs.dm | 2 +- code/modules/mob/living/carbon/human/species/drask.dm | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 725d873532a..521b35d6a21 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -785,7 +785,7 @@ /datum/status_effect/drask_coma/on_creation( mob/living/new_owner, duration = 300 SECONDS, - temp_step = 10, + temp_step = 5, ) src.duration = duration src.temp_step = temp_step diff --git a/code/modules/mob/living/carbon/human/species/drask.dm b/code/modules/mob/living/carbon/human/species/drask.dm index 5e08c2364c4..15dacc74462 100644 --- a/code/modules/mob/living/carbon/human/species/drask.dm +++ b/code/modules/mob/living/carbon/human/species/drask.dm @@ -156,6 +156,9 @@ var/mob/living/living = owner if(!living.has_status_effect(STATUS_EFFECT_DRASK_COMA)) + if(living.stat) + return + if(!do_after(living, 5 SECONDS, living, ALL, cancel_on_max = TRUE, max_interact_count = 1)) return From efeb70a4e172530c617193a12ed29c85a6341c2f Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 28 Oct 2024 08:23:09 +0300 Subject: [PATCH 11/13] temp 5 to 10 --- code/datums/status_effects/buffs.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 521b35d6a21..725d873532a 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -785,7 +785,7 @@ /datum/status_effect/drask_coma/on_creation( mob/living/new_owner, duration = 300 SECONDS, - temp_step = 5, + temp_step = 10, ) src.duration = duration src.temp_step = temp_step From 3b0e9654bbd6e6e68ba6f03630a9509888f8720c Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:27:44 +0100 Subject: [PATCH 12/13] Update drask.dm --- code/modules/mob/living/carbon/human/species/drask.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/species/drask.dm b/code/modules/mob/living/carbon/human/species/drask.dm index e16c0511fab..ba3397f9b1b 100644 --- a/code/modules/mob/living/carbon/human/species/drask.dm +++ b/code/modules/mob/living/carbon/human/species/drask.dm @@ -189,6 +189,4 @@ . = ..() . += DRASK_PITCH_SHIFT -#undef DRASK_COOLINGSTARTTEMP -#undef ENVIRONMENT_COOLINGSTOPTEMP #undef DRASK_PITCH_SHIFT From 915458151e94b9c91b77080077bdb48d2ee87931 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 23 Dec 2024 13:38:03 +0100 Subject: [PATCH 13/13] impprove --- code/__DEFINES/dcs/signals.dm | 2 -- code/datums/status_effects/buffs.dm | 4 +-- code/modules/mob/living/carbon/human/life.dm | 1 - .../mob/living/carbon/human/species/drask.dm | 29 ++++++++++++------- code/modules/surgery/organs/lungs.dm | 9 ++++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 5b8e97d0a6a..9386de2d734 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -916,8 +916,6 @@ #define COMSIG_HUMAN_SPECIES_CHANGED "human_species_changed" /// Source: /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) #define COMSIG_HUMAN_EARLY_HANDLE_ENVIRONMENT "human_early_handle_environment" -/// Source: /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) -#define COMSIG_HUMAN_HANDLE_ENVIRONMENT "human_handle_environment" ///from /mob/living/carbon/human/proc/check_shields(): (atom/hit_by, damage, attack_text, attack_type, armour_penetration, damage_type) #define COMSIG_HUMAN_CHECK_SHIELDS "human_check_shields" diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 725d873532a..a84a24dfa75 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -793,7 +793,7 @@ return ..() /datum/status_effect/drask_coma/on_apply() - to_chat(owner, span_notice("Your metabolical processes are stopped.")) + to_chat(owner, span_notice("Ваш метаболизм полностью остановлен.")) cached_sleep_time = world.time owner.AdjustSleeping(duration) @@ -811,7 +811,7 @@ owner.adjust_bodytemperature(-temp_step) /datum/status_effect/drask_coma/on_remove() - to_chat(owner, span_notice("You feel that your metabolism restored to normal state.")) + to_chat(owner, span_notice("Вы чувствуете прилив сил и наконец просыпаетесь.")) var/elapsed_time = world.time - cached_sleep_time diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index e0cad001aa2..9013ba58031 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -299,7 +299,6 @@ //Body temperature is adjusted in two steps. Firstly your body tries to stabilize itself a bit. if(stat != DEAD) body_thermal_regulation(loc_temp) - SEND_SIGNAL(src, COMSIG_HUMAN_HANDLE_ENVIRONMENT, environment) // After then, it reacts to the surrounding atmosphere based on your thermal protection // If we are on fire, we do not heat up or cool down based on surrounding gases diff --git a/code/modules/mob/living/carbon/human/species/drask.dm b/code/modules/mob/living/carbon/human/species/drask.dm index ba3397f9b1b..04b47fd6e14 100644 --- a/code/modules/mob/living/carbon/human/species/drask.dm +++ b/code/modules/mob/living/carbon/human/species/drask.dm @@ -148,7 +148,7 @@ /datum/action/innate/drask/Grant(mob/user) . = ..() - if(!. && !isliving(user)) + if(!. || !isliving(user)) return FALSE return . @@ -165,26 +165,35 @@ var/mob/living/living = owner if(!living.has_status_effect(STATUS_EFFECT_DRASK_COMA)) - if(living.stat) - return + handle_activation(living) + return - if(!do_after(living, 5 SECONDS, living, ALL, cancel_on_max = TRUE, max_interact_count = 1)) - return + handle_deactivation(living) - living.apply_status_effect(STATUS_EFFECT_DRASK_COMA) - COOLDOWN_START(src, wake_up_cooldown, 10 SECONDS) +/datum/action/innate/drask/coma/proc/handle_activation(mob/living/living) + if(living.stat) + return FALSE - return + if(!do_after(living, 5 SECONDS, living, ALL, cancel_on_max = TRUE, max_interact_count = 1)) + return FALSE + + living.apply_status_effect(STATUS_EFFECT_DRASK_COMA) + COOLDOWN_START(src, wake_up_cooldown, 10 SECONDS) + + return TRUE +/datum/action/innate/drask/coma/proc/handle_deactivation(mob/living/living) if(!COOLDOWN_FINISHED(src, wake_up_cooldown)) to_chat(living, span_warning("Вы не можете пробудиться сейчас.")) - return + return FALSE if(!do_after(living, 10 SECONDS, living, ALL, cancel_on_max = TRUE, max_interact_count = 1)) - return + return FALSE living.remove_status_effect(STATUS_EFFECT_DRASK_COMA) + return TRUE + /datum/species/drask/get_emote_pitch(mob/living/carbon/human/H, tolerance) . = ..() . += DRASK_PITCH_SHIFT diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index 7637ebe0c4b..97e26f68deb 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -343,16 +343,19 @@ if(!.) return FALSE - RegisterSignal(owner, COMSIG_HUMAN_HANDLE_ENVIRONMENT, PROC_REF(regulate_temperature)) + RegisterSignal(owner, COMSIG_HUMAN_EARLY_HANDLE_ENVIRONMENT, PROC_REF(regulate_temperature)) -/obj/item/organ/internal/lungs/drask/proc/regulate_temperature(datum/source, datum/gas_mixture/environment) +/obj/item/organ/internal/lungs/drask/proc/regulate_temperature(mob/living/source, datum/gas_mixture/environment) SIGNAL_HANDLER + + if(source.stat == DEAD) + return if(owner.bodytemperature > cooling_start_temp && environment.temperature <= cooling_stop_temp) owner.adjust_bodytemperature(-5) /obj/item/organ/internal/lungs/drask/remove(mob/living/user, special = ORGAN_MANIPULATION_DEFAULT) - UnregisterSignal(owner, COMSIG_HUMAN_HANDLE_ENVIRONMENT) + UnregisterSignal(owner, COMSIG_HUMAN_EARLY_HANDLE_ENVIRONMENT) return ..() /obj/item/organ/internal/lungs/cybernetic